Commit ac7eccd4 authored by Jiri Benc's avatar Jiri Benc Committed by David S. Miller

bnx2x: track vxlan port count

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: default avatarJiri Benc <jbenc@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1e5b311a
...@@ -1946,6 +1946,7 @@ struct bnx2x { ...@@ -1946,6 +1946,7 @@ struct bnx2x {
u16 vlan_cnt; u16 vlan_cnt;
u16 vlan_credit; u16 vlan_credit;
u16 vxlan_dst_port; u16 vxlan_dst_port;
u8 vxlan_dst_port_count;
bool accept_any_vlan; bool accept_any_vlan;
}; };
......
...@@ -10108,12 +10108,18 @@ static void __bnx2x_add_vxlan_port(struct bnx2x *bp, u16 port) ...@@ -10108,12 +10108,18 @@ static void __bnx2x_add_vxlan_port(struct bnx2x *bp, u16 port)
if (!netif_running(bp->dev)) if (!netif_running(bp->dev))
return; 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"); DP(BNX2X_MSG_SP, "Vxlan destination port limit reached\n");
return; return;
} }
bp->vxlan_dst_port = port; bp->vxlan_dst_port = port;
bp->vxlan_dst_port_count = 1;
bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_ADD_VXLAN_PORT, 0); 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, ...@@ -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) 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"); DP(BNX2X_MSG_SP, "Invalid vxlan port\n");
return; return;
} }
bp->vxlan_dst_port--;
if (bp->vxlan_dst_port)
return;
if (netif_running(bp->dev)) { if (netif_running(bp->dev)) {
bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_DEL_VXLAN_PORT, 0); bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_DEL_VXLAN_PORT, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment