get_status() is a much more intuitive name since "status" is what
the database column is called.

Signed-off-by: Ethan Jackson <et...@nicira.com>
---
 lib/netdev-provider.h |    6 +++---
 lib/netdev-vport.c    |   53 ++++++++++++++++++-------------------------------
 lib/netdev.c          |    6 +++---
 lib/netdev.h          |    2 +-
 vswitchd/bridge.c     |    2 +-
 5 files changed, 27 insertions(+), 42 deletions(-)

diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h
index 94f60af..7f481c5 100644
--- a/lib/netdev-provider.h
+++ b/lib/netdev-provider.h
@@ -547,15 +547,15 @@ struct netdev_class {
     /* Retrieves driver information of the device.
      *
      * Populates 'sh' with key-value pairs representing the status of the
-     * device.  Driver info is a set of key-value string pairs
-     * representing netdev type specific information.  For more information see
+     * device.  'smap'is a set of key-value string pairs representing netdev
+     * type specific information.  For more information see
      * ovs-vswitchd.conf.db(5).
      *
      * The caller is responsible for destroying 'smap' and its data.
      *
      * This function may be set to null if it would always return EOPNOTSUPP
      * anyhow. */
-    int (*get_drv_info)(const struct netdev *netdev, struct smap *smap);
+    int (*get_status)(const struct netdev *netdev, struct smap *smap);
 
     /* Looks up the ARP table entry for 'ip' on 'netdev' and stores the
      * corresponding MAC address in 'mac'.  A return value of ENXIO, in
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index a527f91..fc7f8c0 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -82,8 +82,6 @@ static int tnl_port_config_from_nlattr(const struct nlattr 
*options,
                                        size_t options_len,
                                        struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 
1]);
 
-static const char *netdev_vport_get_tnl_iface(const struct netdev *netdev);
-
 static bool
 is_vport_class(const struct netdev_class *class)
 {
@@ -380,11 +378,21 @@ netdev_vport_get_stats(const struct netdev *netdev, 
struct netdev_stats *stats)
 }
 
 static int
-netdev_vport_get_drv_info(const struct netdev *netdev, struct smap *smap)
+tunnel_get_status(const struct netdev *netdev, struct smap *smap)
 {
-    const char *iface = netdev_vport_get_tnl_iface(netdev);
+    struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1];
+    struct netdev_dev_vport *ndv;
+    static char iface[IFNAMSIZ];
+    ovs_be32 route;
 
-    if (iface) {
+    ndv = netdev_dev_vport_cast(netdev_get_dev(netdev));
+    if (tnl_port_config_from_nlattr(ndv->options->data,
+                                    ndv->options->size, a)) {
+        return 0;
+    }
+    route = nl_attr_get_be32(a[OVS_TUNNEL_ATTR_DST_IPV4]);
+
+    if (route_table_get_name(route, iface)) {
         struct netdev *egress_netdev;
 
         smap_add(smap, "tunnel_egress_iface", iface);
@@ -430,29 +438,6 @@ netdev_vport_wait(void)
     route_table_wait();
 }
 
-/* get_tnl_iface() implementation. */
-static const char *
-netdev_vport_get_tnl_iface(const struct netdev *netdev)
-{
-    struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1];
-    ovs_be32 route;
-    struct netdev_dev_vport *ndv;
-    static char name[IFNAMSIZ];
-
-    ndv = netdev_dev_vport_cast(netdev_get_dev(netdev));
-    if (tnl_port_config_from_nlattr(ndv->options->data, ndv->options->size,
-                                    a)) {
-        return NULL;
-    }
-    route = nl_attr_get_be32(a[OVS_TUNNEL_ATTR_DST_IPV4]);
-
-    if (route_table_get_name(route, name)) {
-        return name;
-    }
-
-    return NULL;
-}
-
 /* Helper functions. */
 
 static void
@@ -904,27 +889,27 @@ netdev_vport_register(void)
 {
     static const struct vport_class vport_classes[] = {
         { OVS_VPORT_TYPE_GRE,
-          { "gre", VPORT_FUNCTIONS(netdev_vport_get_drv_info) },
+          { "gre", VPORT_FUNCTIONS(tunnel_get_status) },
           parse_tunnel_config, unparse_tunnel_config },
 
         { OVS_VPORT_TYPE_GRE,
-          { "ipsec_gre", VPORT_FUNCTIONS(netdev_vport_get_drv_info) },
+          { "ipsec_gre", VPORT_FUNCTIONS(tunnel_get_status) },
           parse_tunnel_config, unparse_tunnel_config },
 
         { OVS_VPORT_TYPE_GRE64,
-          { "gre64", VPORT_FUNCTIONS(netdev_vport_get_drv_info) },
+          { "gre64", VPORT_FUNCTIONS(tunnel_get_status) },
           parse_tunnel_config, unparse_tunnel_config },
 
         { OVS_VPORT_TYPE_GRE64,
-          { "ipsec_gre64", VPORT_FUNCTIONS(netdev_vport_get_drv_info) },
+          { "ipsec_gre64", VPORT_FUNCTIONS(tunnel_get_status) },
           parse_tunnel_config, unparse_tunnel_config },
 
         { OVS_VPORT_TYPE_CAPWAP,
-          { "capwap", VPORT_FUNCTIONS(netdev_vport_get_drv_info) },
+          { "capwap", VPORT_FUNCTIONS(tunnel_get_status) },
           parse_tunnel_config, unparse_tunnel_config },
 
         { OVS_VPORT_TYPE_VXLAN,
-          { "vxlan", VPORT_FUNCTIONS(netdev_vport_get_drv_info) },
+          { "vxlan", VPORT_FUNCTIONS(tunnel_get_status) },
           parse_tunnel_config, unparse_tunnel_config },
 
         { OVS_VPORT_TYPE_PATCH,
diff --git a/lib/netdev.c b/lib/netdev.c
index 1921ac0..c63b2cc 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -771,12 +771,12 @@ netdev_get_next_hop(const struct netdev *netdev,
  * information may be used to populate the status column of the Interface table
  * as defined in ovs-vswitchd.conf.db(5). */
 int
-netdev_get_drv_info(const struct netdev *netdev, struct smap *smap)
+netdev_get_status(const struct netdev *netdev, struct smap *smap)
 {
     struct netdev_dev *dev = netdev_get_dev(netdev);
 
-    return (dev->netdev_class->get_drv_info
-            ? dev->netdev_class->get_drv_info(netdev, smap)
+    return (dev->netdev_class->get_status
+            ? dev->netdev_class->get_status(netdev, smap)
             : EOPNOTSUPP);
 }
 
diff --git a/lib/netdev.h b/lib/netdev.h
index 67122ee..de869e3 100644
--- a/lib/netdev.h
+++ b/lib/netdev.h
@@ -160,7 +160,7 @@ int netdev_get_in6(const struct netdev *, struct in6_addr 
*);
 int netdev_add_router(struct netdev *, struct in_addr router);
 int netdev_get_next_hop(const struct netdev *, const struct in_addr *host,
                         struct in_addr *next_hop, char **);
-int netdev_get_drv_info(const struct netdev *, struct smap *);
+int netdev_get_status(const struct netdev *, struct smap *);
 int netdev_arp_lookup(const struct netdev *, ovs_be32 ip, uint8_t mac[6]);
 
 int netdev_get_flags(const struct netdev *, enum netdev_flags *);
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index d23caf2..a37ef6c 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1710,7 +1710,7 @@ iface_refresh_status(struct iface *iface)
 
     smap_init(&smap);
 
-    if (!netdev_get_drv_info(iface->netdev, &smap)) {
+    if (!netdev_get_status(iface->netdev, &smap)) {
         ovsrec_interface_set_status(iface->cfg, &smap);
     } else {
         ovsrec_interface_set_status(iface->cfg, NULL);
-- 
1.7.9.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to