DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] bnxt fixes
@ 2021-08-23  8:12 Kalesh A P
  2021-08-23  8:12 ` [dpdk-dev] [PATCH 1/3] net/bnxt: fix Rx mbuf VLAN in scalar Rx Kalesh A P
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kalesh A P @ 2021-08-23  8:12 UTC (permalink / raw)
  To: dev

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

Please apply.

Kalesh AP (3):
  net/bnxt: fix Rx mbuf VLAN in scalar Rx
  net/bnxt: check FW capability for VLAN offloads
  net/bnxt: fix VLAN indication in Rx mbuf

 drivers/net/bnxt/bnxt.h        |  7 ++++---
 drivers/net/bnxt/bnxt_ethdev.c |  4 ++++
 drivers/net/bnxt/bnxt_hwrm.c   |  9 +++++++++
 drivers/net/bnxt/bnxt_rxr.c    | 10 +++++++---
 drivers/net/bnxt/bnxt_rxr.h    | 10 ++++++++++
 5 files changed, 34 insertions(+), 6 deletions(-)

-- 
2.10.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 1/3] net/bnxt: fix Rx mbuf VLAN in scalar Rx
  2021-08-23  8:12 [dpdk-dev] [PATCH 0/3] bnxt fixes Kalesh A P
@ 2021-08-23  8:12 ` Kalesh A P
  2021-08-23  8:12 ` [dpdk-dev] [PATCH 2/3] net/bnxt: check FW capability for VLAN offloads Kalesh A P
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kalesh A P @ 2021-08-23  8:12 UTC (permalink / raw)
  To: dev

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

In the scalar Rx path, for the VLAN packet, TCI is not saved in
the "mbuf->vlan_tci", however the STRIPPED offload flag is set
along with PKT_RX_VLAN flag.

Fixes: c1b33d40315f ("net/bnxt: use table based mbuf flags handling")
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_rxr.c |  2 ++
 drivers/net/bnxt/bnxt_rxr.h | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index aea7170..5d8b738 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -962,6 +962,8 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 
 	mbuf->packet_type = bnxt_parse_pkt_type(rxcmp, rxcmp1);
 
+	bnxt_set_vlan(rxcmp1, mbuf);
+
 	if (BNXT_TRUFLOW_EN(bp))
 		mark_id = bnxt_ulp_set_mark_in_mbuf(rxq->bp, rxcmp1, mbuf,
 						    &vfr_flag);
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index dc2b1b7..59adb72 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -185,6 +185,16 @@ bnxt_check_ptype_constants(void)
 
 extern uint32_t bnxt_ptype_table[BNXT_PTYPE_TBL_DIM];
 
+static inline void bnxt_set_vlan(struct rx_pkt_cmpl_hi *rxcmp1,
+				 struct rte_mbuf *mbuf)
+{
+	uint32_t metadata = rte_le_to_cpu_32(rxcmp1->metadata);
+
+	mbuf->vlan_tci = metadata & (RX_PKT_CMPL_METADATA_VID_MASK |
+				     RX_PKT_CMPL_METADATA_DE |
+				     RX_PKT_CMPL_METADATA_PRI_MASK);
+}
+
 /* Stingray2 specific code for RX completion parsing */
 #define RX_CMP_VLAN_VALID(rxcmp)        \
 	(((struct rx_pkt_v2_cmpl *)rxcmp)->metadata1_payload_offset &	\
-- 
2.10.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/3] net/bnxt: check FW capability for VLAN offloads
  2021-08-23  8:12 [dpdk-dev] [PATCH 0/3] bnxt fixes Kalesh A P
  2021-08-23  8:12 ` [dpdk-dev] [PATCH 1/3] net/bnxt: fix Rx mbuf VLAN in scalar Rx Kalesh A P
@ 2021-08-23  8:12 ` Kalesh A P
  2021-08-23  8:12 ` [dpdk-dev] [PATCH 3/3] net/bnxt: fix VLAN indication in Rx mbuf Kalesh A P
  2021-09-02  0:35 ` [dpdk-dev] [PATCH 0/3] bnxt fixes Ajit Khaparde
  3 siblings, 0 replies; 5+ messages in thread
From: Kalesh A P @ 2021-08-23  8:12 UTC (permalink / raw)
  To: dev

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

VLAN offload capability may be disabled in the FW. The driver
should not attempt to override or utilize this feature in such
scenarios since it will not work as expected.

Fixes: 0a6d2a720078 ("net/bnxt: get device infos")
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        | 6 +++---
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++++
 drivers/net/bnxt/bnxt_hwrm.c   | 9 +++++++++
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 494a1ef..3ccc06c 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -577,8 +577,7 @@ struct bnxt_rep_info {
 	ETH_RSS_NONFRAG_IPV6_UDP |	\
 	ETH_RSS_LEVEL_MASK)
 
-#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_VLAN_INSERT | \
-				     DEV_TX_OFFLOAD_IPV4_CKSUM | \
+#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_IPV4_CKSUM | \
 				     DEV_TX_OFFLOAD_TCP_CKSUM | \
 				     DEV_TX_OFFLOAD_UDP_CKSUM | \
 				     DEV_TX_OFFLOAD_TCP_TSO | \
@@ -591,7 +590,6 @@ struct bnxt_rep_info {
 				     DEV_TX_OFFLOAD_MULTI_SEGS)
 
 #define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
-				     DEV_RX_OFFLOAD_VLAN_STRIP | \
 				     DEV_RX_OFFLOAD_IPV4_CKSUM | \
 				     DEV_RX_OFFLOAD_UDP_CKSUM | \
 				     DEV_RX_OFFLOAD_TCP_CKSUM | \
@@ -737,6 +735,7 @@ struct bnxt {
 #define BNXT_FW_CAP_ADV_FLOW_COUNTERS	BIT(6)
 #define BNXT_FW_CAP_LINK_ADMIN		BIT(7)
 #define BNXT_FW_CAP_TRUFLOW_EN		BIT(8)
+#define BNXT_FW_CAP_VLAN_TX_INSERT	BIT(9)
 #define BNXT_TRUFLOW_EN(bp)	((bp)->fw_cap & BNXT_FW_CAP_TRUFLOW_EN)
 
 	pthread_mutex_t         flow_lock;
@@ -745,6 +744,7 @@ struct bnxt {
 #define BNXT_VNIC_CAP_COS_CLASSIFY	BIT(0)
 #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)
 	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_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index de34a2f..e072771 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -981,9 +981,13 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
 	if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
 		dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
+	if (bp->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP)
+		dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_VLAN_STRIP;
 	dev_info->tx_queue_offload_capa = DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT |
 				    dev_info->tx_queue_offload_capa;
+	if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT)
+		dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_VLAN_INSERT;
 	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
 	dev_info->speed_capa = bnxt_get_speed_capabilities(bp);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 73deb41..d641d70 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -941,6 +941,10 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_LINK_ADMIN_STATUS_SUPPORTED)
 		bp->fw_cap |= BNXT_FW_CAP_LINK_ADMIN;
 
+	if (!(flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VLAN_ACCELERATION_TX_DISABLED)) {
+		bp->fw_cap |= BNXT_FW_CAP_VLAN_TX_INSERT;
+		PMD_DRV_LOG(DEBUG, "VLAN acceleration for TX is enabled\n");
+	}
 unlock:
 	HWRM_UNLOCK();
 
@@ -1001,6 +1005,11 @@ int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
 	if (flags & HWRM_VNIC_QCAPS_OUTPUT_FLAGS_RX_CMPL_V2_CAP)
 		bp->vnic_cap_flags |= BNXT_VNIC_CAP_RX_CMPL_V2;
 
+	if (flags & HWRM_VNIC_QCAPS_OUTPUT_FLAGS_VLAN_STRIP_CAP) {
+		bp->vnic_cap_flags |= BNXT_VNIC_CAP_VLAN_RX_STRIP;
+		PMD_DRV_LOG(DEBUG, "Rx VLAN strip capability enabled\n");
+	}
+
 	bp->max_tpa_v2 = rte_le_to_cpu_16(resp->max_aggs_supported);
 
 	HWRM_UNLOCK();
-- 
2.10.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 3/3] net/bnxt: fix VLAN indication in Rx mbuf
  2021-08-23  8:12 [dpdk-dev] [PATCH 0/3] bnxt fixes Kalesh A P
  2021-08-23  8:12 ` [dpdk-dev] [PATCH 1/3] net/bnxt: fix Rx mbuf VLAN in scalar Rx Kalesh A P
  2021-08-23  8:12 ` [dpdk-dev] [PATCH 2/3] net/bnxt: check FW capability for VLAN offloads Kalesh A P
@ 2021-08-23  8:12 ` Kalesh A P
  2021-09-02  0:35 ` [dpdk-dev] [PATCH 0/3] bnxt fixes Ajit Khaparde
  3 siblings, 0 replies; 5+ messages in thread
From: Kalesh A P @ 2021-08-23  8:12 UTC (permalink / raw)
  To: dev

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

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

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 3ccc06c..a64b138 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -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;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 5d8b738..1da9a7d 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -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. */
-- 
2.10.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] bnxt fixes
  2021-08-23  8:12 [dpdk-dev] [PATCH 0/3] bnxt fixes Kalesh A P
                   ` (2 preceding siblings ...)
  2021-08-23  8:12 ` [dpdk-dev] [PATCH 3/3] net/bnxt: fix VLAN indication in Rx mbuf Kalesh A P
@ 2021-09-02  0:35 ` Ajit Khaparde
  3 siblings, 0 replies; 5+ messages in thread
From: Ajit Khaparde @ 2021-09-02  0:35 UTC (permalink / raw)
  To: Kalesh A P; +Cc: dpdk-dev

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

On Mon, Aug 23, 2021 at 12:51 AM Kalesh A P
<kalesh-anakkur.purayil@broadcom.com> wrote:
>
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> Please apply.
>
> Kalesh AP (3):
>   net/bnxt: fix Rx mbuf VLAN in scalar Rx
>   net/bnxt: check FW capability for VLAN offloads
>   net/bnxt: fix VLAN indication in Rx mbuf
Patchset applied to dpdk-next-net-brcm.

>
>  drivers/net/bnxt/bnxt.h        |  7 ++++---
>  drivers/net/bnxt/bnxt_ethdev.c |  4 ++++
>  drivers/net/bnxt/bnxt_hwrm.c   |  9 +++++++++
>  drivers/net/bnxt/bnxt_rxr.c    | 10 +++++++---
>  drivers/net/bnxt/bnxt_rxr.h    | 10 ++++++++++
>  5 files changed, 34 insertions(+), 6 deletions(-)
>
> --
> 2.10.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-02  0:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23  8:12 [dpdk-dev] [PATCH 0/3] bnxt fixes Kalesh A P
2021-08-23  8:12 ` [dpdk-dev] [PATCH 1/3] net/bnxt: fix Rx mbuf VLAN in scalar Rx Kalesh A P
2021-08-23  8:12 ` [dpdk-dev] [PATCH 2/3] net/bnxt: check FW capability for VLAN offloads Kalesh A P
2021-08-23  8:12 ` [dpdk-dev] [PATCH 3/3] net/bnxt: fix VLAN indication in Rx mbuf Kalesh A P
2021-09-02  0:35 ` [dpdk-dev] [PATCH 0/3] bnxt fixes Ajit Khaparde

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