Message ID | 1495062835-27780-1-git-send-email-zhouhan@gmail.com |
---|---|
State | Accepted |
Headers | show |
On Wed, May 17, 2017 at 04:13:55PM -0700, Han Zhou wrote: > Currently in pinctrl.c and ofctrl.c there are similar logic to log > ignored messages, which is somehow inaccurate and confusing. For example, > OFPTYPE_PACKET_IN is handled only in pinctrl.c but in ofctrl.c it > is listed as expected input and not logged as "ignored" messages, while > it is in fact unexpected and ignored there. This patch clearup the > unnecessary "if" conditions and logs all messages that are not > expected/handled honestly, so that there will be logs for debugging > if such abnormal case really happens. > > Signed-off-by: Han Zhou <zhouhan@gmail.com> This can't hurt much, so I applied it to master. Thank you!
diff --git a/ovn/controller/ofctrl.c b/ovn/controller/ofctrl.c index 417fdc9..4b4277a 100644 --- a/ovn/controller/ofctrl.c +++ b/ovn/controller/ofctrl.c @@ -587,11 +587,7 @@ ofctrl_recv(const struct ofp_header *oh, enum ofptype type) } else if (type == OFPTYPE_ERROR) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300); log_openflow_rl(&rl, VLL_INFO, oh, "OpenFlow error"); - } else if (type != OFPTYPE_ECHO_REPLY && - type != OFPTYPE_BARRIER_REPLY && - type != OFPTYPE_PACKET_IN && - type != OFPTYPE_PORT_STATUS && - type != OFPTYPE_FLOW_REMOVED) { + } else { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300); log_openflow_rl(&rl, VLL_DBG, oh, "OpenFlow packet ignored"); } diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c index 9ad4133..b93cf06 100644 --- a/ovn/controller/pinctrl.c +++ b/ovn/controller/pinctrl.c @@ -991,7 +991,7 @@ pinctrl_recv(const struct ofp_header *oh, enum ofptype type, set_switch_config(swconn, &config); } else if (type == OFPTYPE_PACKET_IN) { process_packet_in(oh, ctx); - } else if (type != OFPTYPE_ECHO_REPLY && type != OFPTYPE_BARRIER_REPLY) { + } else { if (VLOG_IS_DBG_ENABLED()) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300);
Currently in pinctrl.c and ofctrl.c there are similar logic to log ignored messages, which is somehow inaccurate and confusing. For example, OFPTYPE_PACKET_IN is handled only in pinctrl.c but in ofctrl.c it is listed as expected input and not logged as "ignored" messages, while it is in fact unexpected and ignored there. This patch clearup the unnecessary "if" conditions and logs all messages that are not expected/handled honestly, so that there will be logs for debugging if such abnormal case really happens. Signed-off-by: Han Zhou <zhouhan@gmail.com> --- ovn/controller/ofctrl.c | 6 +----- ovn/controller/pinctrl.c | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-)