From 5c6d2a3f3a3649a7f1e7f1bbcd02139fff3bf433 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 16 Jun 2009 10:01:04 -0700 Subject: [PATCH] dpif: Make dpif_port_query_by_name() more useful by logging less on failure. One potential user of dpif_port_query_by_name() actually open-coded the function because it didn't want logging on failure. There was only one actual caller of the function, which didn't want logging on failure either. So, clean up by reducing the failure log level to DBG and making the open-coded version an actual caller. --- lib/dpif.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/dpif.c b/lib/dpif.c index 7cfe2a7c..646d2a73 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -307,8 +307,11 @@ dpif_port_query_by_name(const struct dpif *dpif, const char *devname, dpif_name(dpif), devname, port->port); return 0; } else { - VLOG_WARN_RL(&error_rl, "%s: failed to query port %s: %s", - dpif_name(dpif), devname, strerror(errno)); + /* Log level is DBG here because all the current callers are interested + * in whether 'dpif' actually has a port 'devname', so that it's not an + * issue worth logging if it doesn't. */ + VLOG_DBG_RL(&error_rl, "%s: failed to query port %s: %s", + dpif_name(dpif), devname, strerror(errno)); return errno; } } @@ -784,13 +787,9 @@ again: uint32_t master_ifindex = nl_attr_get_u32(attrs[IFLA_MASTER]); for_us = master_ifindex == mon->local_ifindex; } else { - /* It's for us if that device is one of our ports. This is - * open-coded instead of using dpif_port_query_by_name() to - * avoid logging a warning on failure. */ + /* It's for us if that device is one of our ports. */ struct odp_port port; - memset(&port, 0, sizeof port); - strncpy(port.devname, devname, sizeof port.devname); - for_us = !ioctl(mon->dpif.fd, ODP_PORT_QUERY, &port); + for_us = !dpif_port_query_by_name(mon->dpif, devname, &port); } if (!for_us) { -- 2.30.2