datapath: introduce rtnl ops stub
authorThomas Graf <tgraf@noironetworks.com>
Wed, 7 Jan 2015 11:55:49 +0000 (12:55 +0100)
committerThomas Graf <tgraf@noironetworks.com>
Wed, 7 Jan 2015 11:55:49 +0000 (12:55 +0100)
This stub now allows userspace to see IFLA_INFO_KIND for ovs master and
IFLA_INFO_SLAVE_KIND for slave.

Upstream: 5b9e7e16 ("openvswitch: introduce rtnl ops stub")
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
datapath/datapath.c
datapath/vport-internal_dev.c
datapath/vport-internal_dev.h

index ebab68c..de912f6 100644 (file)
@@ -2149,10 +2149,14 @@ static int __init dp_init(void)
        if (err)
                goto error;
 
-       err = ovs_flow_init();
+       err = ovs_internal_dev_rtnl_link_register();
        if (err)
                goto error_action_fifos_exit;
 
+       err = ovs_flow_init();
+       if (err)
+               goto error_unreg_rtnl_link;
+
        err = ovs_vport_init();
        if (err)
                goto error_flow_exit;
@@ -2179,6 +2183,8 @@ error_vport_exit:
        ovs_vport_exit();
 error_flow_exit:
        ovs_flow_exit();
+error_unreg_rtnl_link:
+       ovs_internal_dev_rtnl_link_unregister();
 error_action_fifos_exit:
        action_fifos_exit();
 error:
@@ -2193,6 +2199,7 @@ static void dp_cleanup(void)
        rcu_barrier();
        ovs_vport_exit();
        ovs_flow_exit();
+       ovs_internal_dev_rtnl_link_unregister();
        action_fifos_exit();
 }
 
index 997bb3f..b698f6f 100644 (file)
@@ -143,6 +143,10 @@ static const struct net_device_ops internal_dev_netdev_ops = {
 #endif
 };
 
+static struct rtnl_link_ops internal_dev_link_ops __read_mostly = {
+       .kind = "openvswitch",
+};
+
 static void do_setup(struct net_device *netdev)
 {
        ether_setup(netdev);
@@ -153,6 +157,7 @@ static void do_setup(struct net_device *netdev)
        netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
        netdev->destructor = internal_dev_destructor;
        netdev->ethtool_ops = &internal_dev_ethtool_ops;
+       netdev->rtnl_link_ops = &internal_dev_link_ops;
        netdev->tx_queue_len = 0;
 
        netdev->features = NETIF_F_LLTX | NETIF_F_SG | NETIF_F_FRAGLIST |
@@ -300,3 +305,13 @@ struct vport *ovs_internal_dev_get_vport(struct net_device *netdev)
 
        return internal_dev_priv(netdev)->vport;
 }
+
+int ovs_internal_dev_rtnl_link_register(void)
+{
+       return rtnl_link_register(&internal_dev_link_ops);
+}
+
+void ovs_internal_dev_rtnl_link_unregister(void)
+{
+       rtnl_link_unregister(&internal_dev_link_ops);
+}
index 9a7d30e..1b179a1 100644 (file)
@@ -24,5 +24,7 @@
 
 int ovs_is_internal_dev(const struct net_device *);
 struct vport *ovs_internal_dev_get_vport(struct net_device *);
+int ovs_internal_dev_rtnl_link_register(void);
+void ovs_internal_dev_rtnl_link_unregister(void);
 
 #endif /* vport-internal_dev.h */