]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
bnx2x: track vxlan port count
authorJiri Benc <jbenc@redhat.com>
Thu, 17 Sep 2015 14:11:14 +0000 (16:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Sep 2015 05:32:16 +0000 (22:32 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

index ba936635322a83eee32f15e49f12e393ed924d38..b5e64b02200cd54e54a64b1812abac55e1674e06 100644 (file)
@@ -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;
 };
 
index 89a174fa1300e233aea126a6bc3c5830d6dcc7cb..f1d62d5dbaff9a83ccacd0a530c855b14209eb7a 100644 (file)
@@ -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);