aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2014-06-26 03:58:26 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-01 17:40:17 -0400
commit5b9e7e1607956e2454ccbd94ccf5631309ade054 (patch)
tree0b0d12f60c183d72e4d34ce8c4cc9dd22de32f0c /net
parentb0ab2fabb5b91da99c189db02e91ae10bc8355c5 (diff)
openvswitch: introduce rtnl ops stub
This stub now allows userspace to see IFLA_INFO_KIND for ovs master and IFLA_INFO_SLAVE_KIND for slave. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/openvswitch/datapath.c9
-rw-r--r--net/openvswitch/vport-internal_dev.c16
-rw-r--r--net/openvswitch/vport-internal_dev.h2
3 files changed, 26 insertions, 1 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 0d407bca81e3..fe95b6c224a7 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -2054,10 +2054,14 @@ static int __init dp_init(void)
2054 2054
2055 pr_info("Open vSwitch switching datapath\n"); 2055 pr_info("Open vSwitch switching datapath\n");
2056 2056
2057 err = ovs_flow_init(); 2057 err = ovs_internal_dev_rtnl_link_register();
2058 if (err) 2058 if (err)
2059 goto error; 2059 goto error;
2060 2060
2061 err = ovs_flow_init();
2062 if (err)
2063 goto error_unreg_rtnl_link;
2064
2061 err = ovs_vport_init(); 2065 err = ovs_vport_init();
2062 if (err) 2066 if (err)
2063 goto error_flow_exit; 2067 goto error_flow_exit;
@@ -2084,6 +2088,8 @@ error_vport_exit:
2084 ovs_vport_exit(); 2088 ovs_vport_exit();
2085error_flow_exit: 2089error_flow_exit:
2086 ovs_flow_exit(); 2090 ovs_flow_exit();
2091error_unreg_rtnl_link:
2092 ovs_internal_dev_rtnl_link_unregister();
2087error: 2093error:
2088 return err; 2094 return err;
2089} 2095}
@@ -2096,6 +2102,7 @@ static void dp_cleanup(void)
2096 rcu_barrier(); 2102 rcu_barrier();
2097 ovs_vport_exit(); 2103 ovs_vport_exit();
2098 ovs_flow_exit(); 2104 ovs_flow_exit();
2105 ovs_internal_dev_rtnl_link_unregister();
2099} 2106}
2100 2107
2101module_init(dp_init); 2108module_init(dp_init);
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 789af9280e77..295471a66c78 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -26,6 +26,7 @@
26 26
27#include <net/dst.h> 27#include <net/dst.h>
28#include <net/xfrm.h> 28#include <net/xfrm.h>
29#include <net/rtnetlink.h>
29 30
30#include "datapath.h" 31#include "datapath.h"
31#include "vport-internal_dev.h" 32#include "vport-internal_dev.h"
@@ -121,6 +122,10 @@ static const struct net_device_ops internal_dev_netdev_ops = {
121 .ndo_get_stats64 = internal_dev_get_stats, 122 .ndo_get_stats64 = internal_dev_get_stats,
122}; 123};
123 124
125static struct rtnl_link_ops internal_dev_link_ops __read_mostly = {
126 .kind = "openvswitch",
127};
128
124static void do_setup(struct net_device *netdev) 129static void do_setup(struct net_device *netdev)
125{ 130{
126 ether_setup(netdev); 131 ether_setup(netdev);
@@ -131,6 +136,7 @@ static void do_setup(struct net_device *netdev)
131 netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE; 136 netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
132 netdev->destructor = internal_dev_destructor; 137 netdev->destructor = internal_dev_destructor;
133 netdev->ethtool_ops = &internal_dev_ethtool_ops; 138 netdev->ethtool_ops = &internal_dev_ethtool_ops;
139 netdev->rtnl_link_ops = &internal_dev_link_ops;
134 netdev->tx_queue_len = 0; 140 netdev->tx_queue_len = 0;
135 141
136 netdev->features = NETIF_F_LLTX | NETIF_F_SG | NETIF_F_FRAGLIST | 142 netdev->features = NETIF_F_LLTX | NETIF_F_SG | NETIF_F_FRAGLIST |
@@ -248,3 +254,13 @@ struct vport *ovs_internal_dev_get_vport(struct net_device *netdev)
248 254
249 return internal_dev_priv(netdev)->vport; 255 return internal_dev_priv(netdev)->vport;
250} 256}
257
258int ovs_internal_dev_rtnl_link_register(void)
259{
260 return rtnl_link_register(&internal_dev_link_ops);
261}
262
263void ovs_internal_dev_rtnl_link_unregister(void)
264{
265 rtnl_link_unregister(&internal_dev_link_ops);
266}
diff --git a/net/openvswitch/vport-internal_dev.h b/net/openvswitch/vport-internal_dev.h
index 9a7d30ecc6a2..1b179a190cff 100644
--- a/net/openvswitch/vport-internal_dev.h
+++ b/net/openvswitch/vport-internal_dev.h
@@ -24,5 +24,7 @@
24 24
25int ovs_is_internal_dev(const struct net_device *); 25int ovs_is_internal_dev(const struct net_device *);
26struct vport *ovs_internal_dev_get_vport(struct net_device *); 26struct vport *ovs_internal_dev_get_vport(struct net_device *);
27int ovs_internal_dev_rtnl_link_register(void);
28void ovs_internal_dev_rtnl_link_unregister(void);
27 29
28#endif /* vport-internal_dev.h */ 30#endif /* vport-internal_dev.h */