dpif: Don't log a warning in dpifmon_poll() for missing device.
authorBen Pfaff <blp@nicira.com>
Fri, 6 Mar 2009 18:57:30 +0000 (10:57 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 6 Mar 2009 18:57:30 +0000 (10:57 -0800)
We were using dpif_port_query_by_name() here to see whether the device is
part of the datapath, so there's no point in logging a warning if it isn't.

lib/dpif.c

index aa75f58c4cb67984c7111c57d1dcc5de330dd615..8512ad7f3aa3c3b97fcd979c60fe33530c50ce6a 100644 (file)
@@ -658,9 +658,13 @@ again:
                 uint32_t master_ifindex = nl_attr_get_u32(attrs[IFLA_MASTER]);
                 for_us = master_ifindex == mon->local_ifindex;
             } else {
-                struct odp_port odp_port;
-                for_us = (dpif_port_query_by_name(&mon->dpif, devname,
-                                                  &odp_port) == 0);
+                /* 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. */
+                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);
             }
 
             if (!for_us) {