DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor
@ 2022-05-07  9:36 Yiding Zhou
  2022-05-07 16:15 ` [PATCH v2] " Yiding Zhou
  2022-05-07 19:52 ` Yiding Zhou
  0 siblings, 2 replies; 7+ messages in thread
From: Yiding Zhou @ 2022-05-07  9:36 UTC (permalink / raw)
  To: dev, jingjing.wu, beilei.xing
  Cc: qiming.yang, qi.z.zhang, stable, ramamani.yeleswarapu

Some kernel drivers return the capability VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC
when IAVF_RXDID_COMMS_OVS_1 is not supported. This causes PMD to use
rx_pkt_burst that handles the Flex Receive Descriptor format, but actually
configures the RXDID into IAVF_RXDID_LEGACY_1, then the fields of rte_mbuf
Will be filled with wrong values in rx_pkt_burst, which will eventually
lead to coredump.

This patch fixes mismatch between rx_pkt_burst and rx descriptor.

Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")
Cc: stable@dpdk.org

Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
---
 drivers/net/iavf/iavf_rxtx.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 345f6aeebc..69584264de 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2908,6 +2908,18 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	bool use_avx512 = false;
 	bool use_flex = false;
 
+	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+		use_flex = true;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq->rxdid <= IAVF_RXDID_LEGACY_1 ||
+			!(vf->supported_rxdid & BIT(rxq->rxdid))) {
+			use_flex = false;
+			break;
+		}
+	}
+
 	check_ret = iavf_rx_vec_dev_check(dev);
 	if (check_ret >= 0 &&
 	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
@@ -2923,10 +2935,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 			use_avx512 = true;
 #endif
 
-		if (vf->vf_res->vf_cap_flags &
-			VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
-			use_flex = true;
-
 		for (i = 0; i < dev->data->nb_rx_queues; i++) {
 			rxq = dev->data->rx_queues[i];
 			(void)iavf_rxq_vec_setup(rxq);
@@ -3030,7 +3038,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	if (dev->data->scattered_rx) {
 		PMD_DRV_LOG(DEBUG, "Using a Scattered Rx callback (port=%d).",
 			    dev->data->port_id);
-		if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+		if (use_flex)
 			dev->rx_pkt_burst = iavf_recv_scattered_pkts_flex_rxd;
 		else
 			dev->rx_pkt_burst = iavf_recv_scattered_pkts;
@@ -3041,7 +3049,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	} else {
 		PMD_DRV_LOG(DEBUG, "Using Basic Rx callback (port=%d).",
 			    dev->data->port_id);
-		if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+		if (use_flex)
 			dev->rx_pkt_burst = iavf_recv_pkts_flex_rxd;
 		else
 			dev->rx_pkt_burst = iavf_recv_pkts;
-- 
2.25.1


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

* [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor
  2022-05-07  9:36 [PATCH] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor Yiding Zhou
@ 2022-05-07 16:15 ` Yiding Zhou
  2022-05-07 19:52 ` Yiding Zhou
  1 sibling, 0 replies; 7+ messages in thread
From: Yiding Zhou @ 2022-05-07 16:15 UTC (permalink / raw)
  To: dev, jingjing.wu, beilei.xing
  Cc: qiming.yang, qi.z.zhang, stable, ramamani.yeleswarapu

Some kernel drivers return the capability VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC
when IAVF_RXDID_COMMS_OVS_1 is not supported. This causes PMD to use
rx_pkt_burst that handles the Flex Receive Descriptor format, but actually
configures the RXDID into IAVF_RXDID_LEGACY_1, then the fields of rte_mbuf
Will be filled with wrong values in rx_pkt_burst, which will eventually
lead to coredump.

This patch fixes mismatch between rx_pkt_burst and rx descriptor.

Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")
Cc: stable@dpdk.org

Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
---
 drivers/net/iavf/iavf_rxtx.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 345f6aeebc..ed8d51dbb2 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2899,14 +2899,23 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+	int i;
+	struct iavf_rx_queue *rxq;
+	bool use_flex = true;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq->rxdid <= IAVF_RXDID_LEGACY_1 ||
+			!(vf->supported_rxdid & BIT(rxq->rxdid))) {
+			use_flex = false;
+			break;
+		}
+	}
 
 #ifdef RTE_ARCH_X86
-	struct iavf_rx_queue *rxq;
-	int i;
 	int check_ret;
 	bool use_avx2 = false;
 	bool use_avx512 = false;
-	bool use_flex = false;
 
 	check_ret = iavf_rx_vec_dev_check(dev);
 	if (check_ret >= 0 &&
@@ -2923,10 +2932,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 			use_avx512 = true;
 #endif
 
-		if (vf->vf_res->vf_cap_flags &
-			VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
-			use_flex = true;
-
 		for (i = 0; i < dev->data->nb_rx_queues; i++) {
 			rxq = dev->data->rx_queues[i];
 			(void)iavf_rxq_vec_setup(rxq);
@@ -3030,7 +3035,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	if (dev->data->scattered_rx) {
 		PMD_DRV_LOG(DEBUG, "Using a Scattered Rx callback (port=%d).",
 			    dev->data->port_id);
-		if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+		if (use_flex)
 			dev->rx_pkt_burst = iavf_recv_scattered_pkts_flex_rxd;
 		else
 			dev->rx_pkt_burst = iavf_recv_scattered_pkts;
@@ -3041,7 +3046,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	} else {
 		PMD_DRV_LOG(DEBUG, "Using Basic Rx callback (port=%d).",
 			    dev->data->port_id);
-		if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+		if (use_flex)
 			dev->rx_pkt_burst = iavf_recv_pkts_flex_rxd;
 		else
 			dev->rx_pkt_burst = iavf_recv_pkts;
-- 
2.25.1


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

* [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor
  2022-05-07  9:36 [PATCH] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor Yiding Zhou
  2022-05-07 16:15 ` [PATCH v2] " Yiding Zhou
@ 2022-05-07 19:52 ` Yiding Zhou
  2022-05-09  2:05   ` Zhang, Qi Z
  1 sibling, 1 reply; 7+ messages in thread
From: Yiding Zhou @ 2022-05-07 19:52 UTC (permalink / raw)
  To: dev, jingjing.wu, beilei.xing
  Cc: qiming.yang, qi.z.zhang, stable, ramamani.yeleswarapu

Some kernel drivers return the capability VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC
when IAVF_RXDID_COMMS_OVS_1 is not supported. This causes PMD to use
rx_pkt_burst that handles the Flex Receive Descriptor format, but actually
configures the RXDID into IAVF_RXDID_LEGACY_1, then the fields of rte_mbuf
Will be filled with wrong values in rx_pkt_burst, which will eventually
lead to coredump.

This patch fixes mismatch between rx_pkt_burst and rx descriptor.

Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")
Cc: stable@dpdk.org

Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
---
 drivers/net/iavf/iavf_rxtx.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 345f6aeebc..d3b1a58b27 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2899,14 +2899,27 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+	int i;
+	struct iavf_rx_queue *rxq;
+	bool use_flex = true;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq->rxdid <= IAVF_RXDID_LEGACY_1) {
+			PMD_DRV_LOG(NOTICE, "request RXDID[%d] in Queue[%d] is legacy, "
+				"set rx_pkt_burst as legacy for all queues", rxq->rxdid, i);
+			use_flex = false;
+		} else if (!(vf->supported_rxdid & BIT(rxq->rxdid))) {
+			PMD_DRV_LOG(NOTICE, "request RXDID[%d] in Queue[%d] is not supported, "
+				"set rx_pkt_burst as legacy for all queues", rxq->rxdid, i);
+			use_flex = false;
+		}
+	}
 
 #ifdef RTE_ARCH_X86
-	struct iavf_rx_queue *rxq;
-	int i;
 	int check_ret;
 	bool use_avx2 = false;
 	bool use_avx512 = false;
-	bool use_flex = false;
 
 	check_ret = iavf_rx_vec_dev_check(dev);
 	if (check_ret >= 0 &&
@@ -2923,10 +2936,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 			use_avx512 = true;
 #endif
 
-		if (vf->vf_res->vf_cap_flags &
-			VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
-			use_flex = true;
-
 		for (i = 0; i < dev->data->nb_rx_queues; i++) {
 			rxq = dev->data->rx_queues[i];
 			(void)iavf_rxq_vec_setup(rxq);
@@ -3030,7 +3039,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	if (dev->data->scattered_rx) {
 		PMD_DRV_LOG(DEBUG, "Using a Scattered Rx callback (port=%d).",
 			    dev->data->port_id);
-		if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+		if (use_flex)
 			dev->rx_pkt_burst = iavf_recv_scattered_pkts_flex_rxd;
 		else
 			dev->rx_pkt_burst = iavf_recv_scattered_pkts;
@@ -3041,7 +3050,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	} else {
 		PMD_DRV_LOG(DEBUG, "Using Basic Rx callback (port=%d).",
 			    dev->data->port_id);
-		if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+		if (use_flex)
 			dev->rx_pkt_burst = iavf_recv_pkts_flex_rxd;
 		else
 			dev->rx_pkt_burst = iavf_recv_pkts;
-- 
2.25.1


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

* RE: [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor
  2022-05-07 19:52 ` Yiding Zhou
@ 2022-05-09  2:05   ` Zhang, Qi Z
  2022-05-11  0:04     ` Zhang, Qi Z
  0 siblings, 1 reply; 7+ messages in thread
From: Zhang, Qi Z @ 2022-05-09  2:05 UTC (permalink / raw)
  To: Zhou, YidingX, dev, Wu, Jingjing, Xing, Beilei
  Cc: Yang, Qiming, stable, Yeleswarapu, Ramamani



> -----Original Message-----
> From: Zhou, YidingX <yidingx.zhou@intel.com>
> Sent: Sunday, May 8, 2022 3:53 AM
> To: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; stable@dpdk.org; Yeleswarapu, Ramamani
> <ramamani.yeleswarapu@intel.com>
> Subject: [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX
> descriptor
> 
> Some kernel drivers return the capability
> VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC when IAVF_RXDID_COMMS_OVS_1 is
> not supported. This causes PMD to use rx_pkt_burst that handles the Flex
> Receive Descriptor format, but actually configures the RXDID into
> IAVF_RXDID_LEGACY_1, then the fields of rte_mbuf Will be filled with wrong
> values in rx_pkt_burst, which will eventually lead to coredump.
> 
> This patch fixes mismatch between rx_pkt_burst and rx descriptor.
> 
> Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

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

* RE: [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor
  2022-05-09  2:05   ` Zhang, Qi Z
@ 2022-05-11  0:04     ` Zhang, Qi Z
  2022-05-17  0:57       ` Zhang, Qi Z
  0 siblings, 1 reply; 7+ messages in thread
From: Zhang, Qi Z @ 2022-05-11  0:04 UTC (permalink / raw)
  To: Zhang, Qi Z, Zhou, YidingX, dev, Wu, Jingjing, Xing, Beilei
  Cc: Yang, Qiming, stable, Yeleswarapu, Ramamani



> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Monday, May 9, 2022 10:05 AM
> To: Zhou, YidingX <yidingx.zhou@intel.com>; dev@dpdk.org; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org; Yeleswarapu,
> Ramamani <ramamani.yeleswarapu@intel.com>
> Subject: RE: [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX
> descriptor
> 
> 
> 
> > -----Original Message-----
> > From: Zhou, YidingX <yidingx.zhou@intel.com>
> > Sent: Sunday, May 8, 2022 3:53 AM
> > To: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>
> > Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; stable@dpdk.org; Yeleswarapu, Ramamani
> > <ramamani.yeleswarapu@intel.com>
> > Subject: [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX
> > descriptor

Refined the title to " fix wrong data path selection which cause segment fault" 
In dpdk-next-net-intel to make it clear what it is going to fix.

> >
> > Some kernel drivers return the capability
> > VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC when IAVF_RXDID_COMMS_OVS_1
> is not
> > supported. This causes PMD to use rx_pkt_burst that handles the Flex
> > Receive Descriptor format, but actually configures the RXDID into
> > IAVF_RXDID_LEGACY_1, then the fields of rte_mbuf Will be filled with
> > wrong values in rx_pkt_burst, which will eventually lead to coredump.
> >
> > This patch fixes mismatch between rx_pkt_burst and rx descriptor.
> >
> > Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata
> > extraction")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
> 
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
> 
> Applied to dpdk-next-net-intel.
> 
> Thanks
> Qi

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

* RE: [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor
  2022-05-11  0:04     ` Zhang, Qi Z
@ 2022-05-17  0:57       ` Zhang, Qi Z
  0 siblings, 0 replies; 7+ messages in thread
From: Zhang, Qi Z @ 2022-05-17  0:57 UTC (permalink / raw)
  To: Zhou, YidingX, dev, Wu, Jingjing, Xing, Beilei
  Cc: Yang, Qiming, stable, Yeleswarapu, Ramamani



> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Wednesday, May 11, 2022 8:04 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhou, YidingX
> <yidingx.zhou@intel.com>; dev@dpdk.org; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org; Yeleswarapu,
> Ramamani <ramamani.yeleswarapu@intel.com>
> Subject: RE: [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX
> descriptor
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Monday, May 9, 2022 10:05 AM
> > To: Zhou, YidingX <yidingx.zhou@intel.com>; dev@dpdk.org; Wu, Jingjing
> > <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> > Cc: Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org;
> > Yeleswarapu, Ramamani <ramamani.yeleswarapu@intel.com>
> > Subject: RE: [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst
> > and RX descriptor
> >
> >
> >
> > > -----Original Message-----
> > > From: Zhou, YidingX <yidingx.zhou@intel.com>
> > > Sent: Sunday, May 8, 2022 3:53 AM
> > > To: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> > > <beilei.xing@intel.com>
> > > Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > > <qi.z.zhang@intel.com>; stable@dpdk.org; Yeleswarapu, Ramamani
> > > <ramamani.yeleswarapu@intel.com>
> > > Subject: [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and
> > > RX descriptor
> 
> Refined the title to " fix wrong data path selection which cause segment fault"
> In dpdk-next-net-intel to make it clear what it is going to fix.

Further refine the commit log in dpdk-next-net-intel as below base on Thomas's comment:

If PF driver don't support a flex Rx descriptor that required by VF,
legacy descriptor format will be negotiated to configure the hardware
queue.

The patch fixes the issue when an Rx data path that handle flexible
descriptor  (e.g.:
iavf_recv_scattered_pkts_vec_avx512_flex_rxd) is selected while the
actual hardware queues are configured as legacy due to above scenario,
which will cause following coredump.

> 
> > >
> > > Some kernel drivers return the capability
> > > VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC when
> IAVF_RXDID_COMMS_OVS_1
> > is not
> > > supported. This causes PMD to use rx_pkt_burst that handles the Flex
> > > Receive Descriptor format, but actually configures the RXDID into
> > > IAVF_RXDID_LEGACY_1, then the fields of rte_mbuf Will be filled with
> > > wrong values in rx_pkt_burst, which will eventually lead to coredump.
> > >
> > > This patch fixes mismatch between rx_pkt_burst and rx descriptor.
> > >
> > > Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata
> > > extraction")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
> >
> > Acked-by: Qi Zhang <qi.z.zhang@intel.com>
> >
> > Applied to dpdk-next-net-intel.
> >
> > Thanks
> > Qi

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

* [PATCH v2] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor
@ 2022-05-07 16:11 Yiding Zhou
  0 siblings, 0 replies; 7+ messages in thread
From: Yiding Zhou @ 2022-05-07 16:11 UTC (permalink / raw)
  To: dev, jingjing.wu, beilei.xing
  Cc: qiming.yang, qi.z.zhang, stable, ramamani.yeleswarapu

Some kernel drivers return the capability VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC
when IAVF_RXDID_COMMS_OVS_1 is not supported. This causes PMD to use
rx_pkt_burst that handles the Flex Receive Descriptor format, but actually
configures the RXDID into IAVF_RXDID_LEGACY_1, then the fields of rte_mbuf
Will be filled with wrong values in rx_pkt_burst, which will eventually
lead to coredump.

This patch fixes mismatch between rx_pkt_burst and rx descriptor.

Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")
Cc: stable@dpdk.org

Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
---
 drivers/net/iavf/iavf_rxtx.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 345f6aeebc..ed8d51dbb2 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2899,14 +2899,23 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+	int i;
+	struct iavf_rx_queue *rxq;
+	bool use_flex = true;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq->rxdid <= IAVF_RXDID_LEGACY_1 ||
+			!(vf->supported_rxdid & BIT(rxq->rxdid))) {
+			use_flex = false;
+			break;
+		}
+	}
 
 #ifdef RTE_ARCH_X86
-	struct iavf_rx_queue *rxq;
-	int i;
 	int check_ret;
 	bool use_avx2 = false;
 	bool use_avx512 = false;
-	bool use_flex = false;
 
 	check_ret = iavf_rx_vec_dev_check(dev);
 	if (check_ret >= 0 &&
@@ -2923,10 +2932,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 			use_avx512 = true;
 #endif
 
-		if (vf->vf_res->vf_cap_flags &
-			VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
-			use_flex = true;
-
 		for (i = 0; i < dev->data->nb_rx_queues; i++) {
 			rxq = dev->data->rx_queues[i];
 			(void)iavf_rxq_vec_setup(rxq);
@@ -3030,7 +3035,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	if (dev->data->scattered_rx) {
 		PMD_DRV_LOG(DEBUG, "Using a Scattered Rx callback (port=%d).",
 			    dev->data->port_id);
-		if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+		if (use_flex)
 			dev->rx_pkt_burst = iavf_recv_scattered_pkts_flex_rxd;
 		else
 			dev->rx_pkt_burst = iavf_recv_scattered_pkts;
@@ -3041,7 +3046,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 	} else {
 		PMD_DRV_LOG(DEBUG, "Using Basic Rx callback (port=%d).",
 			    dev->data->port_id);
-		if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+		if (use_flex)
 			dev->rx_pkt_burst = iavf_recv_pkts_flex_rxd;
 		else
 			dev->rx_pkt_burst = iavf_recv_pkts;
-- 
2.25.1


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

end of thread, other threads:[~2022-05-17  0:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-07  9:36 [PATCH] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor Yiding Zhou
2022-05-07 16:15 ` [PATCH v2] " Yiding Zhou
2022-05-07 19:52 ` Yiding Zhou
2022-05-09  2:05   ` Zhang, Qi Z
2022-05-11  0:04     ` Zhang, Qi Z
2022-05-17  0:57       ` Zhang, Qi Z
2022-05-07 16:11 Yiding Zhou

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