net/bnxt: fix VLAN indication in Rx mbuf
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Mon, 23 Aug 2021 08:12:14 +0000 (13:42 +0530)
committerAjit Khaparde <ajit.khaparde@broadcom.com>
Thu, 2 Sep 2021 00:34:03 +0000 (02:34 +0200)
Fix to ignore the RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN
when the firmware doesn't support the VLAN strip offload.

Fixes: 2eb53b134aae ("net/bnxt: add initial Rx code")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt.h
drivers/net/bnxt/bnxt_rxr.c

index 3ccc06c..a64b138 100644 (file)
@@ -745,6 +745,7 @@ struct bnxt {
 #define BNXT_VNIC_CAP_OUTER_RSS                BIT(1)
 #define BNXT_VNIC_CAP_RX_CMPL_V2       BIT(2)
 #define BNXT_VNIC_CAP_VLAN_RX_STRIP    BIT(3)
+#define BNXT_RX_VLAN_STRIP_EN(bp)      ((bp)->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP)
        unsigned int            rx_nr_rings;
        unsigned int            rx_cp_nr_rings;
        unsigned int            rx_num_qs_per_vnic;
index ccff80b..a40fa50 100644 (file)
@@ -272,7 +272,7 @@ static void bnxt_tpa_start(struct bnxt_rx_queue *rxq,
                mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
        }
 
-       if (tpa_info->vlan_valid) {
+       if (tpa_info->vlan_valid && BNXT_RX_VLAN_STRIP_EN(rxq->bp)) {
                mbuf->vlan_tci = tpa_info->vlan;
                mbuf->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
        }
@@ -574,8 +574,10 @@ bnxt_init_ol_flags_tables(struct bnxt_rx_queue *rxq)
        for (i = 0; i < BNXT_OL_FLAGS_TBL_DIM; i++) {
                pt[i] = 0;
 
-               if (i & RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN)
-                       pt[i] |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
+               if (BNXT_RX_VLAN_STRIP_EN(rxq->bp)) {
+                       if (i & RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN)
+                               pt[i] |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
+               }
 
                if (i & (RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC << 3)) {
                        /* Tunnel case. */