aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/vport-internal_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/openvswitch/vport-internal_dev.c')
-rw-r--r--net/openvswitch/vport-internal_dev.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 789af9280e77..84516126e5f3 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,14 +136,18 @@ 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 |
137 NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE; 143 NETIF_F_HIGHDMA | NETIF_F_HW_CSUM |
144 NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL;
138 145
139 netdev->vlan_features = netdev->features; 146 netdev->vlan_features = netdev->features;
147 netdev->hw_enc_features = netdev->features;
140 netdev->features |= NETIF_F_HW_VLAN_CTAG_TX; 148 netdev->features |= NETIF_F_HW_VLAN_CTAG_TX;
141 netdev->hw_features = netdev->features & ~NETIF_F_LLTX; 149 netdev->hw_features = netdev->features & ~NETIF_F_LLTX;
150
142 eth_hw_addr_random(netdev); 151 eth_hw_addr_random(netdev);
143} 152}
144 153
@@ -159,7 +168,8 @@ static struct vport *internal_dev_create(const struct vport_parms *parms)
159 netdev_vport = netdev_vport_priv(vport); 168 netdev_vport = netdev_vport_priv(vport);
160 169
161 netdev_vport->dev = alloc_netdev(sizeof(struct internal_dev), 170 netdev_vport->dev = alloc_netdev(sizeof(struct internal_dev),
162 parms->name, do_setup); 171 parms->name, NET_NAME_UNKNOWN,
172 do_setup);
163 if (!netdev_vport->dev) { 173 if (!netdev_vport->dev) {
164 err = -ENOMEM; 174 err = -ENOMEM;
165 goto error_free_vport; 175 goto error_free_vport;
@@ -248,3 +258,13 @@ struct vport *ovs_internal_dev_get_vport(struct net_device *netdev)
248 258
249 return internal_dev_priv(netdev)->vport; 259 return internal_dev_priv(netdev)->vport;
250} 260}
261
262int ovs_internal_dev_rtnl_link_register(void)
263{
264 return rtnl_link_register(&internal_dev_link_ops);
265}
266
267void ovs_internal_dev_rtnl_link_unregister(void)
268{
269 rtnl_link_unregister(&internal_dev_link_ops);
270}