Skip to content

Commit

Permalink
datapath: introduce rtnl ops stub
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
  • Loading branch information
Thomas Graf committed Jan 7, 2015
1 parent 9789437 commit 5282e28
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
9 changes: 8 additions & 1 deletion datapath/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -2179,6 +2183,8 @@ static int __init dp_init(void)
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:
Expand All @@ -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();
}

Expand Down
15 changes: 15 additions & 0 deletions datapath/vport-internal_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 |
Expand Down Expand Up @@ -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);
}
2 changes: 2 additions & 0 deletions datapath/vport-internal_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 5282e28

Please sign in to comment.