patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: stable@dpdk.org
Subject: [PATCH 19.11 2/2] net/bnxt: fix VLAN indication in Rx mbuf
Date: Sun,  5 Dec 2021 09:32:06 +0530	[thread overview]
Message-ID: <20211205040206.8050-2-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20211205040206.8050-1-kalesh-anakkur.purayil@broadcom.com>

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

[ upstream commit 620e0290d14cc9a1126ef1af4eaa71ef9eadca72 ]

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")

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              | 1 +
 drivers/net/bnxt/bnxt_rxr.c          | 8 +++++---
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 5 +++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 63d7475..73001b1 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -599,6 +599,7 @@ struct bnxt {
 	uint32_t		vnic_cap_flags;
 #define BNXT_VNIC_CAP_COS_CLASSIFY	BIT(0)
 #define BNXT_VNIC_CAP_VLAN_RX_STRIP	BIT(1)
+#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;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 56213f0..3355e00 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -209,8 +209,9 @@ static void bnxt_tpa_start(struct bnxt_rx_queue *rxq,
 		mbuf->hash.fdir.id = rte_le_to_cpu_16(tpa_start1->cfa_code);
 		mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
 	}
-	if (tpa_start1->flags2 &
-	    rte_cpu_to_le_32(RX_TPA_START_CMPL_FLAGS2_META_FORMAT_VLAN)) {
+	if (BNXT_RX_VLAN_STRIP_EN(rxq->bp) &&
+	    (tpa_start1->flags2 &
+	     rte_cpu_to_le_32(RX_TPA_START_CMPL_FLAGS2_META_FORMAT_VLAN))) {
 		mbuf->vlan_tci = rte_le_to_cpu_32(tpa_start1->metadata);
 		mbuf->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
 	}
@@ -601,7 +602,8 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	if (agg_buf)
 		bnxt_rx_pages(rxq, mbuf, &tmp_raw_cons, agg_buf, NULL);
 
-	if (rxcmp1->flags2 & RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN) {
+	if (BNXT_RX_VLAN_STRIP_EN(rxq->bp) &&
+	    (rxcmp1->flags2 & RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN)) {
 		mbuf->vlan_tci = rxcmp1->metadata &
 			(RX_PKT_CMPL_METADATA_VID_MASK |
 			RX_PKT_CMPL_METADATA_DE |
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 9c3ae39..3d2081b 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -287,8 +287,9 @@ recv_burst_vec_sse(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			if (rxcmp->flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID)
 				mbuf->ol_flags |= PKT_RX_RSS_HASH;
 
-			if (rxcmp1->flags2 &
-			    RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN) {
+			if (BNXT_RX_VLAN_STRIP_EN(rxq->bp) &&
+			    (rxcmp1->flags2 &
+			     RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN)) {
 				mbuf->vlan_tci = rxcmp1->metadata &
 					(RX_PKT_CMPL_METADATA_VID_MASK |
 					RX_PKT_CMPL_METADATA_DE |
-- 
2.10.1


  reply	other threads:[~2021-12-05  3:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-05  4:02 [PATCH 19.11 1/2] net/bnxt: check FW capability for VLAN offloads Kalesh A P
2021-12-05  4:02 ` Kalesh A P [this message]
2021-12-06  8:27   ` [PATCH 19.11 2/2] net/bnxt: fix VLAN indication in Rx mbuf Christian Ehrhardt
2021-12-06  8:27 ` [PATCH 19.11 1/2] net/bnxt: check FW capability for VLAN offloads Christian Ehrhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211205040206.8050-2-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).