* [PATCH net 0/5] vxlan fixes
@ 2015-09-17 14:11 Jiri Benc
2015-09-17 14:11 ` [PATCH net 1/5] vxlan: set needed headroom correctly Jiri Benc
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Jiri Benc @ 2015-09-17 14:11 UTC (permalink / raw)
To: netdev
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(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net 1/5] vxlan: set needed headroom correctly
2015-09-17 14:11 [PATCH net 0/5] vxlan fixes Jiri Benc
@ 2015-09-17 14:11 ` Jiri Benc
2015-09-17 14:11 ` [PATCH net 2/5] vxlan: reject IPv6 addresses if IPv6 is not configured Jiri Benc
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Jiri Benc @ 2015-09-17 14:11 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang
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.
Fixes: e4c7ed415387c ("vxlan: add ipv6 support")
Fixes: 2853af6a2ea1a ("vxlan: use dev->needed_headroom instead of dev->hard_header_len")
CC: Cong Wang <cwang@twopensource.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
drivers/net/vxlan.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index cf8b7f0473b3..6ebe562af04e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -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)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net 2/5] vxlan: reject IPv6 addresses if IPv6 is not configured
2015-09-17 14:11 [PATCH net 0/5] vxlan fixes Jiri Benc
2015-09-17 14:11 ` [PATCH net 1/5] vxlan: set needed headroom correctly Jiri Benc
@ 2015-09-17 14:11 ` Jiri Benc
2015-09-17 14:11 ` [PATCH net 3/5] qlcnic: track vxlan port count Jiri Benc
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Jiri Benc @ 2015-09-17 14:11 UTC (permalink / raw)
To: netdev
When 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.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
drivers/net/vxlan.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 6ebe562af04e..bbac1d35ed4e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -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
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net 3/5] qlcnic: track vxlan port count
2015-09-17 14:11 [PATCH net 0/5] vxlan fixes Jiri Benc
2015-09-17 14:11 ` [PATCH net 1/5] vxlan: set needed headroom correctly Jiri Benc
2015-09-17 14:11 ` [PATCH net 2/5] vxlan: reject IPv6 addresses if IPv6 is not configured Jiri Benc
@ 2015-09-17 14:11 ` Jiri Benc
2015-09-17 14:11 ` [PATCH net 4/5] be2net: allow offloading with the same port for IPv4 and IPv6 Jiri Benc
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Jiri Benc @ 2015-09-17 14:11 UTC (permalink / raw)
To: netdev; +Cc: Shahed Shaikh, Dept-GELinuxNICDev
The 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.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 1 +
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 18 +++++++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 06bcc734fe8d..d6696cfa11d2 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -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;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 8b08b20e8b30..d4481454b5f8 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -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,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net 4/5] be2net: allow offloading with the same port for IPv4 and IPv6
2015-09-17 14:11 [PATCH net 0/5] vxlan fixes Jiri Benc
` (2 preceding siblings ...)
2015-09-17 14:11 ` [PATCH net 3/5] qlcnic: track vxlan port count Jiri Benc
@ 2015-09-17 14:11 ` Jiri Benc
2015-09-18 3:30 ` Sathya Perla
2015-09-17 14:11 ` [PATCH net 5/5] bnx2x: track vxlan port count Jiri Benc
2015-09-18 5:32 ` [PATCH net 0/5] vxlan fixes David Miller
5 siblings, 1 reply; 8+ messages in thread
From: Jiri Benc @ 2015-09-17 14:11 UTC (permalink / raw)
To: netdev
Cc: Sathya Perla, Ajit Khaparde, Padmanabh Ratnakar,
Sriharsha Basavapatna
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 <jbenc@redhat.com>
---
drivers/net/ethernet/emulex/benet/be.h | 1 +
drivers/net/ethernet/emulex/benet/be_main.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 0a27805cbbbd..821540913343 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -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;
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 12687bf52b95..7bf51a1a0a77 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -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,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net 5/5] bnx2x: track vxlan port count
2015-09-17 14:11 [PATCH net 0/5] vxlan fixes Jiri Benc
` (3 preceding siblings ...)
2015-09-17 14:11 ` [PATCH net 4/5] be2net: allow offloading with the same port for IPv4 and IPv6 Jiri Benc
@ 2015-09-17 14:11 ` Jiri Benc
2015-09-18 5:32 ` [PATCH net 0/5] vxlan fixes David Miller
5 siblings, 0 replies; 8+ messages in thread
From: Jiri Benc @ 2015-09-17 14:11 UTC (permalink / raw)
To: netdev; +Cc: Ariel Elior
The 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.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 1 +
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index ba936635322a..b5e64b02200c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -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;
};
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 89a174fa1300..f1d62d5dbaff 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net 4/5] be2net: allow offloading with the same port for IPv4 and IPv6
2015-09-17 14:11 ` [PATCH net 4/5] be2net: allow offloading with the same port for IPv4 and IPv6 Jiri Benc
@ 2015-09-18 3:30 ` Sathya Perla
0 siblings, 0 replies; 8+ messages in thread
From: Sathya Perla @ 2015-09-18 3:30 UTC (permalink / raw)
To: Jiri Benc
Cc: netdev, Ajit Khaparde, Padmanabh Ratnakar, Sriharsha Basavapatna
On Thu, Sep 17, 2015 at 7:41 PM, Jiri Benc <jbenc@redhat.com> wrote:
> 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 <jbenc@redhat.com>
> ---
> drivers/net/ethernet/emulex/benet/be.h | 1 +
> drivers/net/ethernet/emulex/benet/be_main.c | 10 ++++++++++
> 2 files changed, 11 insertions(+)
Acked-by: Sathya Perla <sathya.perla@avagotech.com>
Thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net 0/5] vxlan fixes
2015-09-17 14:11 [PATCH net 0/5] vxlan fixes Jiri Benc
` (4 preceding siblings ...)
2015-09-17 14:11 ` [PATCH net 5/5] bnx2x: track vxlan port count Jiri Benc
@ 2015-09-18 5:32 ` David Miller
5 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2015-09-18 5:32 UTC (permalink / raw)
To: jbenc; +Cc: netdev
From: Jiri Benc <jbenc@redhat.com>
Date: Thu, 17 Sep 2015 16:11:09 +0200
> This fixes various issues with vxlan related to IPv6.
Series applied, thanks Jiri.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-09-18 5:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 14:11 [PATCH net 0/5] vxlan fixes Jiri Benc
2015-09-17 14:11 ` [PATCH net 1/5] vxlan: set needed headroom correctly Jiri Benc
2015-09-17 14:11 ` [PATCH net 2/5] vxlan: reject IPv6 addresses if IPv6 is not configured Jiri Benc
2015-09-17 14:11 ` [PATCH net 3/5] qlcnic: track vxlan port count Jiri Benc
2015-09-17 14:11 ` [PATCH net 4/5] be2net: allow offloading with the same port for IPv4 and IPv6 Jiri Benc
2015-09-18 3:30 ` Sathya Perla
2015-09-17 14:11 ` [PATCH net 5/5] bnx2x: track vxlan port count Jiri Benc
2015-09-18 5:32 ` [PATCH net 0/5] vxlan fixes David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).