DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/idpf: fix crash when launching l3fwd
@ 2022-11-17 10:00 beilei.xing
  2022-11-17 10:15 ` [PATCH v2] " beilei.xing
  0 siblings, 1 reply; 7+ messages in thread
From: beilei.xing @ 2022-11-17 10:00 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev, yuan.peng, Beilei Xing

From: Beilei Xing <beilei.xing@intel.com>

There's core dump when launching l3fwd with 1 queue 1 core. It's
because NULL pointer is used if fail to configure device.
This patch removes incorrect check during device configuration,
and checks NULL pointer when excuting VIRTCHNL2_OP_DEALLOC_VECTORS.

Fixes: 549343c25db8 ("net/idpf: support device initialization")
Fixes: 70675bcc3a57 ("net/idpf: support RSS")
Fixes: 37291a68fd78 ("net/idpf: support write back based on ITR expire")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/idpf/idpf_ethdev.c | 7 -------
 drivers/net/idpf/idpf_vchnl.c  | 3 +++
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 20f088eb80..51fc97bf7b 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -372,13 +372,6 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
-	if ((dev->data->nb_rx_queues == 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_NONE) ||
-	    (dev->data->nb_rx_queues > 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_RSS)) {
-		PMD_INIT_LOG(ERR, "Multi-queue packet distribution mode %d is not supported",
-			     conf->rxmode.mq_mode);
-		return -ENOTSUP;
-	}
-
 	if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
 		PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not supported",
 			     conf->txmode.mq_mode);
diff --git a/drivers/net/idpf/idpf_vchnl.c b/drivers/net/idpf/idpf_vchnl.c
index ac6486d4ef..88770447f8 100644
--- a/drivers/net/idpf/idpf_vchnl.c
+++ b/drivers/net/idpf/idpf_vchnl.c
@@ -1197,6 +1197,9 @@ idpf_vc_dealloc_vectors(struct idpf_vport *vport)
 	int err, len;
 
 	alloc_vec = vport->recv_vectors;
+	if (alloc_vec == NULL)
+		return -EINVAL;
+
 	vcs = &alloc_vec->vchunks;
 
 	len = sizeof(struct virtchnl2_vector_chunks) +
-- 
2.26.2


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

* [PATCH v2] net/idpf: fix crash when launching l3fwd
  2022-11-17 10:00 [PATCH] net/idpf: fix crash when launching l3fwd beilei.xing
@ 2022-11-17 10:15 ` beilei.xing
  2022-11-18  6:24   ` Wu, Jingjing
  2022-11-18  7:02   ` [PATCH v3] " beilei.xing
  0 siblings, 2 replies; 7+ messages in thread
From: beilei.xing @ 2022-11-17 10:15 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev, yuan.peng, Beilei Xing

From: Beilei Xing <beilei.xing@intel.com>

There's core dump when launching l3fwd with 1 queue 1 core. It's
because NULL pointer is used if fail to configure device.
This patch removes incorrect check during device configuration,
and checks NULL pointer when executing VIRTCHNL2_OP_DEALLOC_VECTORS.

Fixes: 549343c25db8 ("net/idpf: support device initialization")
Fixes: 70675bcc3a57 ("net/idpf: support RSS")
Fixes: 37291a68fd78 ("net/idpf: support write back based on ITR expire")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
v2 change: Fix typo.

 drivers/net/idpf/idpf_ethdev.c | 7 -------
 drivers/net/idpf/idpf_vchnl.c  | 3 +++
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 20f088eb80..51fc97bf7b 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -372,13 +372,6 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
-	if ((dev->data->nb_rx_queues == 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_NONE) ||
-	    (dev->data->nb_rx_queues > 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_RSS)) {
-		PMD_INIT_LOG(ERR, "Multi-queue packet distribution mode %d is not supported",
-			     conf->rxmode.mq_mode);
-		return -ENOTSUP;
-	}
-
 	if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
 		PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not supported",
 			     conf->txmode.mq_mode);
diff --git a/drivers/net/idpf/idpf_vchnl.c b/drivers/net/idpf/idpf_vchnl.c
index ac6486d4ef..88770447f8 100644
--- a/drivers/net/idpf/idpf_vchnl.c
+++ b/drivers/net/idpf/idpf_vchnl.c
@@ -1197,6 +1197,9 @@ idpf_vc_dealloc_vectors(struct idpf_vport *vport)
 	int err, len;
 
 	alloc_vec = vport->recv_vectors;
+	if (alloc_vec == NULL)
+		return -EINVAL;
+
 	vcs = &alloc_vec->vchunks;
 
 	len = sizeof(struct virtchnl2_vector_chunks) +
-- 
2.26.2


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

* RE: [PATCH v2] net/idpf: fix crash when launching l3fwd
  2022-11-17 10:15 ` [PATCH v2] " beilei.xing
@ 2022-11-18  6:24   ` Wu, Jingjing
  2022-11-18  7:05     ` Xing, Beilei
  2022-11-18  7:02   ` [PATCH v3] " beilei.xing
  1 sibling, 1 reply; 7+ messages in thread
From: Wu, Jingjing @ 2022-11-18  6:24 UTC (permalink / raw)
  To: Xing, Beilei; +Cc: dev, Peng, Yuan

> -
>  	if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
>  		PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not supported",
>  			     conf->txmode.mq_mode);
> diff --git a/drivers/net/idpf/idpf_vchnl.c b/drivers/net/idpf/idpf_vchnl.c
> index ac6486d4ef..88770447f8 100644
> --- a/drivers/net/idpf/idpf_vchnl.c
> +++ b/drivers/net/idpf/idpf_vchnl.c
> @@ -1197,6 +1197,9 @@ idpf_vc_dealloc_vectors(struct idpf_vport *vport)
>  	int err, len;
> 
>  	alloc_vec = vport->recv_vectors;
> +	if (alloc_vec == NULL)
> +		return -EINVAL;
> +
Would it be better to check before idpf_vc_dealloc_vectors?


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

* [PATCH v3] net/idpf: fix crash when launching l3fwd
  2022-11-17 10:15 ` [PATCH v2] " beilei.xing
  2022-11-18  6:24   ` Wu, Jingjing
@ 2022-11-18  7:02   ` beilei.xing
  2022-11-18  9:57     ` Zhang, Qi Z
  2022-11-18  9:59     ` Peng, Yuan
  1 sibling, 2 replies; 7+ messages in thread
From: beilei.xing @ 2022-11-18  7:02 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev, yuan.peng, Beilei Xing

From: Beilei Xing <beilei.xing@intel.com>

There's core dump when launching l3fwd with 1 queue 1 core. It's
because NULL pointer is used if fail to configure device.
This patch removes incorrect check during device configuration,
and checks NULL pointer when executing VIRTCHNL2_OP_DEALLOC_VECTORS.

Fixes: 549343c25db8 ("net/idpf: support device initialization")
Fixes: 70675bcc3a57 ("net/idpf: support RSS")
Fixes: 37291a68fd78 ("net/idpf: support write back based on ITR expire")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
v2 change: fix typo.
v3 change: check NULL pointer before virtual channel handling.

 drivers/net/idpf/idpf_ethdev.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 20f088eb80..491ef966a7 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -372,13 +372,6 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
-	if ((dev->data->nb_rx_queues == 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_NONE) ||
-	    (dev->data->nb_rx_queues > 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_RSS)) {
-		PMD_INIT_LOG(ERR, "Multi-queue packet distribution mode %d is not supported",
-			     conf->rxmode.mq_mode);
-		return -ENOTSUP;
-	}
-
 	if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
 		PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not supported",
 			     conf->txmode.mq_mode);
@@ -620,7 +613,8 @@ idpf_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_vc_config_irq_map_unmap(vport, false);
 
-	idpf_vc_dealloc_vectors(vport);
+	if (vport->recv_vectors != NULL)
+		idpf_vc_dealloc_vectors(vport);
 
 	vport->stopped = 1;
 
-- 
2.26.2


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

* RE: [PATCH v2] net/idpf: fix crash when launching l3fwd
  2022-11-18  6:24   ` Wu, Jingjing
@ 2022-11-18  7:05     ` Xing, Beilei
  0 siblings, 0 replies; 7+ messages in thread
From: Xing, Beilei @ 2022-11-18  7:05 UTC (permalink / raw)
  To: Wu, Jingjing; +Cc: dev, Peng, Yuan



> -----Original Message-----
> From: Wu, Jingjing <jingjing.wu@intel.com>
> Sent: Friday, November 18, 2022 2:24 PM
> To: Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Peng, Yuan <yuan.peng@intel.com>
> Subject: RE: [PATCH v2] net/idpf: fix crash when launching l3fwd
> 
> > -
> >  	if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
> >  		PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not
> supported",
> >  			     conf->txmode.mq_mode);
> > diff --git a/drivers/net/idpf/idpf_vchnl.c
> > b/drivers/net/idpf/idpf_vchnl.c index ac6486d4ef..88770447f8 100644
> > --- a/drivers/net/idpf/idpf_vchnl.c
> > +++ b/drivers/net/idpf/idpf_vchnl.c
> > @@ -1197,6 +1197,9 @@ idpf_vc_dealloc_vectors(struct idpf_vport *vport)
> >  	int err, len;
> >
> >  	alloc_vec = vport->recv_vectors;
> > +	if (alloc_vec == NULL)
> > +		return -EINVAL;
> > +
> Would it be better to check before idpf_vc_dealloc_vectors?
Make sense, will update in next version.

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

* RE: [PATCH v3] net/idpf: fix crash when launching l3fwd
  2022-11-18  7:02   ` [PATCH v3] " beilei.xing
@ 2022-11-18  9:57     ` Zhang, Qi Z
  2022-11-18  9:59     ` Peng, Yuan
  1 sibling, 0 replies; 7+ messages in thread
From: Zhang, Qi Z @ 2022-11-18  9:57 UTC (permalink / raw)
  To: Xing, Beilei, Wu, Jingjing; +Cc: dev, Peng, Yuan, Xing,  Beilei



> -----Original Message-----
> From: beilei.xing@intel.com <beilei.xing@intel.com>
> Sent: Friday, November 18, 2022 3:03 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Peng, Yuan <yuan.peng@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>
> Subject: [PATCH v3] net/idpf: fix crash when launching l3fwd
> 
> From: Beilei Xing <beilei.xing@intel.com>
> 
> There's core dump when launching l3fwd with 1 queue 1 core. It's because
> NULL pointer is used if fail to configure device.
> This patch removes incorrect check during device configuration, and checks
> NULL pointer when executing VIRTCHNL2_OP_DEALLOC_VECTORS.
> 
> Fixes: 549343c25db8 ("net/idpf: support device initialization")
> Fixes: 70675bcc3a57 ("net/idpf: support RSS")
> Fixes: 37291a68fd78 ("net/idpf: support write back based on ITR expire")
> 
> Signed-off-by: Beilei Xing <beilei.xing@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 v3] net/idpf: fix crash when launching l3fwd
  2022-11-18  7:02   ` [PATCH v3] " beilei.xing
  2022-11-18  9:57     ` Zhang, Qi Z
@ 2022-11-18  9:59     ` Peng, Yuan
  1 sibling, 0 replies; 7+ messages in thread
From: Peng, Yuan @ 2022-11-18  9:59 UTC (permalink / raw)
  To: Xing, Beilei, Wu, Jingjing; +Cc: dev


> -----Original Message-----
> From: Xing, Beilei <beilei.xing@intel.com>
> Sent: Friday, November 18, 2022 3:03 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Peng, Yuan <yuan.peng@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>
> Subject: [PATCH v3] net/idpf: fix crash when launching l3fwd
> 
> From: Beilei Xing <beilei.xing@intel.com>
> 
> There's core dump when launching l3fwd with 1 queue 1 core. It's because
> NULL pointer is used if fail to configure device.
> This patch removes incorrect check during device configuration, and checks
> NULL pointer when executing VIRTCHNL2_OP_DEALLOC_VECTORS.
> 
> Fixes: 549343c25db8 ("net/idpf: support device initialization")
> Fixes: 70675bcc3a57 ("net/idpf: support RSS")
> Fixes: 37291a68fd78 ("net/idpf: support write back based on ITR expire")
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>

Tested-by: Peng, Yuan <yuan.peng@intel.com>

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

end of thread, other threads:[~2022-11-18  9:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17 10:00 [PATCH] net/idpf: fix crash when launching l3fwd beilei.xing
2022-11-17 10:15 ` [PATCH v2] " beilei.xing
2022-11-18  6:24   ` Wu, Jingjing
2022-11-18  7:05     ` Xing, Beilei
2022-11-18  7:02   ` [PATCH v3] " beilei.xing
2022-11-18  9:57     ` Zhang, Qi Z
2022-11-18  9:59     ` Peng, Yuan

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