net/bnxt: fix UDP tunnel port removal
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Mon, 12 Oct 2020 15:44:59 +0000 (21:14 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 16 Oct 2020 17:48:19 +0000 (19:48 +0200)
The HWRM supports only one global destination port for a tunnel type.

When port is stopped, driver deletes the UDP tunnel port configured
in the HW, but it does not update the counter which causes the
tunnel port addition to fail after port is started again.

Fixed to update the counter when tunnel port is deleted.

Fixes: 10d074b2022d ("net/bnxt: support tunneling")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
drivers/net/bnxt/bnxt_ethdev.c
drivers/net/bnxt/bnxt_hwrm.c

index b4654ec..8dd4ec3 100644 (file)
@@ -2192,14 +2192,6 @@ bnxt_udp_tunnel_port_del_op(struct rte_eth_dev *eth_dev,
        }
 
        rc = bnxt_hwrm_tunnel_dst_port_free(bp, port, tunnel_type);
-       if (!rc) {
-               if (tunnel_type ==
-                   HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_VXLAN)
-                       bp->vxlan_port = 0;
-               if (tunnel_type ==
-                   HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_GENEVE)
-                       bp->geneve_port = 0;
-       }
        return rc;
 }
 
index eef282b..361f995 100644 (file)
@@ -2742,11 +2742,10 @@ bnxt_free_tunnel_ports(struct bnxt *bp)
        if (bp->vxlan_port_cnt)
                bnxt_hwrm_tunnel_dst_port_free(bp, bp->vxlan_fw_dst_port_id,
                        HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_VXLAN);
-       bp->vxlan_port = 0;
+
        if (bp->geneve_port_cnt)
                bnxt_hwrm_tunnel_dst_port_free(bp, bp->geneve_fw_dst_port_id,
                        HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_GENEVE);
-       bp->geneve_port = 0;
 }
 
 void bnxt_free_all_hwrm_resources(struct bnxt *bp)
@@ -3809,6 +3808,18 @@ int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port,
        HWRM_CHECK_RESULT();
        HWRM_UNLOCK();
 
+       if (tunnel_type ==
+           HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_VXLAN) {
+               bp->vxlan_port = 0;
+               bp->vxlan_port_cnt = 0;
+       }
+
+       if (tunnel_type ==
+           HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_GENEVE) {
+               bp->geneve_port = 0;
+               bp->geneve_port_cnt = 0;
+       }
+
        return rc;
 }