vxlan fixes
Subsystems (5)
cover vxlan fixes
This fixes various issues with vxlan related to IPv6.
Jiri Benc (5):
vxlan: set needed headroom correctly
vxlan: reject IPv6 addresses if IPv6 is not configured
qlcnic: track vxlan port count
be2net: allow offloading with the same port for IPv4 and IPv6
bnx2x: track vxlan port count
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 1 + drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 14 ++++++++++++-- drivers/net/ethernet/emulex/benet/be.h | 1 + drivers/net/ethernet/emulex/benet/be_main.c | 10 ++++++++++ drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 1 + drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 18 +++++++++++++----- drivers/net/vxlan.c | 15 +++++++++------ 7 files changed, 47 insertions(+), 13 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/5 vxlan: set needed headroom correctly
vxlan_setup is called when allocating the net_device, i.e. way before vxlan_newlink (or vxlan_dev_configure) is called. This means vxlan->default_dst is actually unset in vxlan_setup and the condition that sets needed_headroom always takes the else branch.
Set the needed_headrom at the point when we have the information about the address family available.
--- drivers/net/vxlan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/vxlan.c +5 -5
@@ -2392,10 +2392,6 @@ static void vxlan_setup(struct net_device *dev)eth_hw_addr_random (dev);ether_setup (dev); -if (vxlan->default_dst.remote_ip.sa.sa_family ==AF_INET6 ) - dev->needed_headroom =ETH_HLEN +VXLAN6_HEADROOM ; -else - dev->needed_headroom =ETH_HLEN +VXLAN_HEADROOM ; dev->netdev_ops = &vxlan_netdev_ops; dev->destructor = free_netdev;
@@ -2670,8 +2666,12 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, dev->needed_headroom = lowerdev->hard_header_len + (use_ipv6 ?VXLAN6_HEADROOM :VXLAN_HEADROOM ); - }else if (use_ipv6) + }else if (use_ipv6) { vxlan->flags |=VXLAN_F_IPV6 ; + dev->needed_headroom =ETH_HLEN +VXLAN6_HEADROOM ; + }else { + dev->needed_headroom =ETH_HLEN +VXLAN_HEADROOM ; + }memcpy (&vxlan->cfg, conf,sizeof (*conf));if (!vxlan->cfg.dst_port)
Signature · 1 line
1.8.3.1
PATCH 2/5 vxlan: reject IPv6 addresses if IPv6 is not configured
In reply to Jiri BencWhen IPv6 address is set without IPv6 configured, the vxlan socket is mostly treated as an IPv4 one but various lookus in fdb etc. still take the AF_INET6 into account. This creates incosistencies with weird consequences.
Just reject IPv6 addresses in such case.
--- drivers/net/vxlan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/vxlan.c +4 -1
@@ -2636,8 +2636,11 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, dst->remote_ip.sa.sa_family =AF_INET ;if (dst->remote_ip.sa.sa_family ==AF_INET6 || - vxlan->cfg.saddr.sa.sa_family ==AF_INET6 ) + vxlan->cfg.saddr.sa.sa_family ==AF_INET6 ) { +if (!IS_ENABLED (CONFIG_IPV6 )) +return -EPFNOSUPPORT ; use_ipv6 = true; + }if (conf->remote_ifindex) {struct net_device *lowerdev
Signature · 1 line
1.8.3.1
PATCH 3/5 qlcnic: track vxlan port count
In reply to Jiri BencThe callback for adding vxlan port can be called with the same port for both IPv4 and IPv6. Do not disable the offloading when the same port for both protocols is added and later one of them removed.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 1 + drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +1 -0
@@ -536,6 +536,7 @@ struct qlcnic_hardware_context {u8 extend_lb_time;u8 phys_port_id[ETH_ALEN ];u8 lb_mode; +u8 vxlan_port_count;u16 vxlan_port;struct device *hwmon_dev;u32 post_mode;
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +13 -5
@@ -483,11 +483,17 @@ static void qlcnic_add_vxlan_port(struct net_device *netdev,/* Adapter supports only one VXLAN port. Use very first port * for enabling offload */ -if (!qlcnic_encap_rx_offload (adapter) || ahw->vxlan_port) +if (!qlcnic_encap_rx_offload (adapter))return ; +if (!ahw->vxlan_port_count) { + ahw->vxlan_port_count =1 ; + ahw->vxlan_port =ntohs (port); + adapter->flags |=QLCNIC_ADD_VXLAN_PORT ; +return ; + } +if (ahw->vxlan_port ==ntohs (port)) + ahw->vxlan_port_count++; - ahw->vxlan_port =ntohs (port); - adapter->flags |=QLCNIC_ADD_VXLAN_PORT ; } static void qlcnic_del_vxlan_port(struct net_device *netdev,
@@ -496,11 +502,13 @@ static void qlcnic_del_vxlan_port(struct net_device *netdev,struct qlcnic_adapter *adapter =netdev_priv (netdev);struct qlcnic_hardware_context *ahw = adapter->ahw; -if (!qlcnic_encap_rx_offload (adapter) || !ahw->vxlan_port || +if (!qlcnic_encap_rx_offload (adapter) || !ahw->vxlan_port_count || (ahw->vxlan_port !=ntohs (port)))return ; - adapter->flags |=QLCNIC_DEL_VXLAN_PORT ; + ahw->vxlan_port_count--; +if (!ahw->vxlan_port_count) + adapter->flags |=QLCNIC_DEL_VXLAN_PORT ; } static netdev_features_t qlcnic_features_check(struct sk_buff *skb,
Signature · 1 line
1.8.3.1
PATCH 4/5 be2net: allow offloading with the same port for IPv4 and IPv6
In reply to Jiri BencThe callback for adding vxlan port can be called with the same port for both IPv4 and IPv6. Do not disable the offloading if this occurs.
--- drivers/net/ethernet/emulex/benet/be.h | 1 + drivers/net/ethernet/emulex/benet/be_main.c | 10 ++++++++++ 2 files changed, 11 insertions(+)
drivers/net/ethernet/emulex/benet/be.h +1 -0
@@ -582,6 +582,7 @@ struct be_adapter {u16 pvid;__be16 vxlan_port;int vxlan_port_count; +int vxlan_port_aliases;struct phy_info phy;u8 wol_cap;bool wol_en;
drivers/net/ethernet/emulex/benet/be_main.c +10 -0
@@ -5176,6 +5176,11 @@ static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family,if (lancer_chip (adapter) ||BEx_chip (adapter) ||be_is_mc (adapter))return ; +if (adapter->vxlan_port == port && adapter->vxlan_port_count) { + adapter->vxlan_port_aliases++; +return ; + } +if (adapter->flags &BE_FLAGS_VXLAN_OFFLOADS ) {dev_info (dev,"Only one UDP port supported for VxLAN offloads\n" );
@@ -5226,6 +5231,11 @@ static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family,if (adapter->vxlan_port != port) goto done; +if (adapter->vxlan_port_aliases) { + adapter->vxlan_port_aliases--; +return ; + } +be_disable_vxlan_offloads (adapter); dev_info(&adapter->pdev->dev,
Signature · 1 line
1.8.3.1
Re: [PATCH net 4/5] be2net: allow offloading with the same port for IPv4 and IPv6
Quoted 8 lines · Jiri Benc
The callback for adding vxlan port can be called with the same port for both IPv4 and IPv6. Do not disable the offloading if this occurs.
Signed-off-by Jiri Benc <[email protected]>--- drivers/net/ethernet/emulex/benet/be.h | 1 + drivers/net/ethernet/emulex/benet/be_main.c | 10 ++++++++++ 2 files changed, 11 insertions(+)
Thanks!
PATCH 5/5 bnx2x: track vxlan port count
In reply to Jiri BencThe callback for adding vxlan port can be called with the same port for both IPv4 and IPv6. Do not disable the offloading when the same port for both protocols is added and later one of them removed.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 1 + drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -0
@@ -1946,6 +1946,7 @@ struct bnx2x {u16 vlan_cnt;u16 vlan_credit;u16 vxlan_dst_port; +u8 vxlan_dst_port_count;bool accept_any_vlan; };
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +12 -2
@@ -10108,12 +10108,18 @@ static void __bnx2x_add_vxlan_port(struct bnx2x *bp, u16 port)if (!netif_running (bp->dev))return ; -if (bp->vxlan_dst_port || !IS_PF (bp)) { +if (bp->vxlan_dst_port_count && bp->vxlan_dst_port == port) { + bp->vxlan_dst_port_count++; +return ; + } + +if (bp->vxlan_dst_port_count || !IS_PF (bp)) {DP (BNX2X_MSG_SP ,"Vxlan destination port limit reached\n" );return ; } bp->vxlan_dst_port = port; + bp->vxlan_dst_port_count =1 ;bnx2x_schedule_sp_rtnl (bp,BNX2X_SP_RTNL_ADD_VXLAN_PORT ,0 ); }
@@ -10128,10 +10134,14 @@ static void bnx2x_add_vxlan_port(struct net_device *netdev,static void __bnx2x_del_vxlan_port (struct bnx2x *bp,u16 port) { -if (!bp->vxlan_dst_port || bp->vxlan_dst_port != port || !IS_PF (bp)) { +if (!bp->vxlan_dst_port_count || bp->vxlan_dst_port != port || + !IS_PF (bp)) {DP (BNX2X_MSG_SP ,"Invalid vxlan port\n" );return ; } + bp->vxlan_dst_port--; +if (bp->vxlan_dst_port) +return ;if (netif_running (bp->dev)) {bnx2x_schedule_sp_rtnl (bp,BNX2X_SP_RTNL_DEL_VXLAN_PORT ,0 );
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Jiri Benc <[email protected]>
Date: Thu, 17 Sep 2015 16:11:09 +0200
Quoted 1 line
This fixes various issues with vxlan related to IPv6.
Series applied, thanks Jiri.