vxlan: move Ethernet initialization to a separate function
This will allow to initialize vxlan in ARPHRD_NONE mode based on the passed rtnl attributes. v2: renamed "l2mode" to "ether". Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8a21ec4e0a
commit
0c867c9bf8
|
@ -2404,7 +2404,7 @@ static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct net_device_ops vxlan_netdev_ops = {
|
static const struct net_device_ops vxlan_netdev_ether_ops = {
|
||||||
.ndo_init = vxlan_init,
|
.ndo_init = vxlan_init,
|
||||||
.ndo_uninit = vxlan_uninit,
|
.ndo_uninit = vxlan_uninit,
|
||||||
.ndo_open = vxlan_open,
|
.ndo_open = vxlan_open,
|
||||||
|
@ -2458,10 +2458,6 @@ static void vxlan_setup(struct net_device *dev)
|
||||||
struct vxlan_dev *vxlan = netdev_priv(dev);
|
struct vxlan_dev *vxlan = netdev_priv(dev);
|
||||||
unsigned int h;
|
unsigned int h;
|
||||||
|
|
||||||
eth_hw_addr_random(dev);
|
|
||||||
ether_setup(dev);
|
|
||||||
|
|
||||||
dev->netdev_ops = &vxlan_netdev_ops;
|
|
||||||
dev->destructor = free_netdev;
|
dev->destructor = free_netdev;
|
||||||
SET_NETDEV_DEVTYPE(dev, &vxlan_type);
|
SET_NETDEV_DEVTYPE(dev, &vxlan_type);
|
||||||
|
|
||||||
|
@ -2476,8 +2472,7 @@ static void vxlan_setup(struct net_device *dev)
|
||||||
dev->hw_features |= NETIF_F_GSO_SOFTWARE;
|
dev->hw_features |= NETIF_F_GSO_SOFTWARE;
|
||||||
dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
|
dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
|
||||||
netif_keep_dst(dev);
|
netif_keep_dst(dev);
|
||||||
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
|
dev->priv_flags |= IFF_NO_QUEUE;
|
||||||
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
|
|
||||||
|
|
||||||
INIT_LIST_HEAD(&vxlan->next);
|
INIT_LIST_HEAD(&vxlan->next);
|
||||||
spin_lock_init(&vxlan->hash_lock);
|
spin_lock_init(&vxlan->hash_lock);
|
||||||
|
@ -2496,6 +2491,15 @@ static void vxlan_setup(struct net_device *dev)
|
||||||
INIT_HLIST_HEAD(&vxlan->fdb_head[h]);
|
INIT_HLIST_HEAD(&vxlan->fdb_head[h]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vxlan_ether_setup(struct net_device *dev)
|
||||||
|
{
|
||||||
|
eth_hw_addr_random(dev);
|
||||||
|
ether_setup(dev);
|
||||||
|
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
|
||||||
|
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
|
||||||
|
dev->netdev_ops = &vxlan_netdev_ether_ops;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct nla_policy vxlan_policy[IFLA_VXLAN_MAX + 1] = {
|
static const struct nla_policy vxlan_policy[IFLA_VXLAN_MAX + 1] = {
|
||||||
[IFLA_VXLAN_ID] = { .type = NLA_U32 },
|
[IFLA_VXLAN_ID] = { .type = NLA_U32 },
|
||||||
[IFLA_VXLAN_GROUP] = { .len = FIELD_SIZEOF(struct iphdr, daddr) },
|
[IFLA_VXLAN_GROUP] = { .len = FIELD_SIZEOF(struct iphdr, daddr) },
|
||||||
|
@ -2722,6 +2726,8 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
|
||||||
__be16 default_port = vxlan->cfg.dst_port;
|
__be16 default_port = vxlan->cfg.dst_port;
|
||||||
struct net_device *lowerdev = NULL;
|
struct net_device *lowerdev = NULL;
|
||||||
|
|
||||||
|
vxlan_ether_setup(dev);
|
||||||
|
|
||||||
vxlan->net = src_net;
|
vxlan->net = src_net;
|
||||||
|
|
||||||
dst->remote_vni = conf->vni;
|
dst->remote_vni = conf->vni;
|
||||||
|
|
Loading…
Reference in New Issue