net/idpf: fix crash when launching l3fwd
PATCH 1/1 net/idpf: fix crash when launching l3fwd
From: Beilei Xing <[email protected]>
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.
--- drivers/net/idpf/idpf_ethdev.c | 7 ------- drivers/net/idpf/idpf_vchnl.c | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/net/idpf/idpf_ethdev.c +0 -7
@@ -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);
drivers/net/idpf/idpf_vchnl.c +3 -0
@@ -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) +
Signature · 1 line
2.26.2
PATCH v2 1/1 net/idpf: fix crash when launching l3fwd
From: Beilei Xing <[email protected]>
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.
---
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(-)
drivers/net/idpf/idpf_ethdev.c +0 -7
@@ -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);
drivers/net/idpf/idpf_vchnl.c +3 -0
@@ -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) +
Signature · 1 line
2.26.2
Quoted 9 lines
drivers/net/idpf/idpf_ethdev.c +0
-1-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);drivers/net/idpf/idpf_vchnl.c +0
-0
drivers/net/idpf/idpf_vchnl.c idpf_vc_dealloc_vectors(struct idpf_vport *vport) · line 1202
Quoted 6 lines
drivers/net/idpf/idpf_vchnl.c +3
-0@@ -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?
Quoted 21 lines
-----Original Message-----
From: Wu, Jingjing <[email protected]>
Sent: Friday, November 18, 2022 2:24 PM
To: Xing, Beilei <[email protected]>
Cc: [email protected]; Peng, Yuan <[email protected]>
Subject: RE: [PATCH v2] net/idpf: fix crash when launching l3fwddrivers/net/idpf/idpf_ethdev.c idpf_dev_configure(struct rte_eth_dev *dev)
Quoted 3 lines
drivers/net/idpf/idpf_ethdev.c +0
-1-if (conf->txmode.mq_mode !=RTE_ETH_MQ_TX_NONE ) { PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is notsupported",
Quoted 8 lines
drivers/net/idpf/idpf_ethdev.c +0
-0conf->txmode.mq_mode);(quoted diff) +0
-0
b/drivers/net/idpf/idpf_vchnl.cindexac6486d4ef..88770447f8100644drivers/net/idpf/idpf_vchnl.c +0
-0@@ -1197,6 +1197,9 @@ idpf_vc_dealloc_vectors(struct idpf_vport *vport)int err, len;
Quoted 5 lines
drivers/net/idpf/idpf_vchnl.c idpf_vc_dealloc_vectors(struct idpf_vport *vport) · line 1202
Quoted 4 lines
drivers/net/idpf/idpf_vchnl.c +3
-0alloc_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.
PATCH v3 1/1 net/idpf: fix crash when launching l3fwd
In reply to [email protected]From: Beilei Xing <[email protected]>
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.
---
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(-)
drivers/net/idpf/idpf_ethdev.c +2 -8
@@ -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 ;
Signature · 1 line
2.26.2
Quoted 17 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, November 18, 2022 3:03 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; Peng, Yuan <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v3] net/idpf: fix crash when launching l3fwdFrom: Beilei Xing <[email protected]>
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 executingVIRTCHNL2_OP_DEALLOC_VECTORS.
Quoted 5 lines
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 <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi
Quoted 16 lines
-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Friday, November 18, 2022 3:03 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; Peng, Yuan <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v3] net/idpf: fix crash when launching l3fwdFrom: Beilei Xing <[email protected]>
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 executingVIRTCHNL2_OP_DEALLOC_VECTORS.
Quoted 5 lines
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 <[email protected]>