net/igc: fix segmentation fault in secondary dpdk-symmetric_mp
PATCH 1/1 net/igc: fix segmentation fault in secondary dpdk-symmetric_mp
From: Zhichao Zeng <[email protected]>
In the secondary dpdk-symmetric_mp process, the "smp_port_init" was skipped, which cause some function pointers not to be initialized, and a segmentation fault occurred when calling these function pointers.
This patch assigns initial values to rx_pkt_burst, tx_pkt_burst and tx_pkt_prepare pointers to avoid calling null function pointer.
--- drivers/net/igc/igc_ethdev.c | 3 +++ drivers/net/igc/igc_ethdev.h | 5 +++++ drivers/net/igc/igc_txrx.c | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-)
drivers/net/igc/igc_ethdev.c +3 -0
@@ -1234,6 +1234,9 @@ eth_igc_dev_init(struct rte_eth_dev *dev) dev->rx_queue_count = eth_igc_rx_queue_count; dev->rx_descriptor_status = eth_igc_rx_descriptor_status; dev->tx_descriptor_status = eth_igc_tx_descriptor_status; + dev->rx_pkt_burst = &igc_recv_pkts; + dev->tx_pkt_burst = &igc_xmit_pkts; + dev->tx_pkt_prepare = ð_igc_prep_pkts;/* * for secondary processes, we don't initialize any further as primary
drivers/net/igc/igc_ethdev.h +5 -0
@@ -263,6 +263,11 @@ struct igc_adapter {#define IGC_DEV_PRIVATE_FLOW_LIST (_dev) \ (&((struct igc_adapter *)(_dev)->data->dev_private)->flow_list) +uint16_t igc_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t igc_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t eth_igc_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts); +static inline void igc_read_reg_check_set_bits (struct igc_hw *hw,uint32_t reg,uint32_t bits) {
drivers/net/igc/igc_txrx.c +3 -3
@@ -345,7 +345,7 @@ rx_desc_get_pkt_info(struct igc_rx_queue *rxq, struct rte_mbuf *rxm, rxm->packet_type =rx_desc_pkt_info_to_pkt_type (pkt_info); } -static uint16_t +uint16_t igc_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts) {struct igc_rx_queue *const rxq = rx_queue;
@@ -1397,7 +1397,7 @@ eth_igc_rx_queue_setup(struct rte_eth_dev *dev, }/* prepare packets for transmit */ -static uint16_t +uint16_t eth_igc_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {
@@ -1604,7 +1604,7 @@ tx_desc_cksum_flags_to_olinfo(uint64_t ol_flags)return tmp; } -static uint16_t +uint16_t igc_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {struct igc_tx_queue *const txq = tx_queue;
Signature · 1 line
2.25.1
Quoted 35 lines
-----Original Message-----
From: Zeng, ZhichaoX <[email protected]>
Sent: Wednesday, June 15, 2022 15:39
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Zeng, ZhichaoX <[email protected]>; Guo, Junfeng <[email protected]>; Su, Simei <[email protected]>
Subject: [PATCH] net/igc: fix segmentation fault in secondary dpdk-symmetric_mpFrom: Zhichao Zeng <[email protected]>
In the secondary dpdk-symmetric_mp process, the "
smp_port_init" was skipped, which cause some function pointers not to be initialized, and a segmentation fault occurred when calling these function pointers.This patch assigns initial values to
rx_pkt_burst,tx_pkt_burstandtx_pkt_preparepointers to avoid calling null function pointer.Signed-off-by Zhichao Zeng <[email protected]>--- drivers/net/igc/igc_ethdev.c | 3 +++ drivers/net/igc/igc_ethdev.h | 5 +++++ drivers/net/igc/igc_txrx.c | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-)drivers/net/igc/igc_ethdev.c +0
-0
drivers/net/igc/igc_ethdev.c eth_igc_dev_init(struct rte_eth_dev *dev) · line 1239
Quoted 6 lines
drivers/net/igc/igc_ethdev.c +3
-0@@ -1234,6 +1234,9 @@ eth_igc_dev_init(struct rte_eth_dev *dev) dev->rx_queue_count = eth_igc_rx_queue_count; dev->rx_descriptor_status = eth_igc_rx_descriptor_status; dev->tx_descriptor_status = eth_igc_tx_descriptor_status; + dev->rx_pkt_burst = &igc_recv_pkts; + dev->tx_pkt_burst = &igc_xmit_pkts; + dev->tx_pkt_prepare = ð_igc_prep_pkts;
Maybe the parameter & are not needed here? you can double check for this when build.
Quoted 20 lines
drivers/net/igc/igc_ethdev.c +0
-0/* * for secondary processes, we don't initialize any further as primary
drivers/net/igc/igc_ethdev.h +4
-0@@ -263,6 +263,11 @@ struct igc_adapter {#define IGC_DEV_PRIVATE_FLOW_LIST (_dev) \ (&((struct igc_adapter *)(_dev)->data->dev_private)->flow_list) +uint16_t igc_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t igc_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t eth_igc_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);
Quoted 1 line
+
These functions are tx/rx related, it would be better to put them into igc_txrx.h.
Quoted 43 lines
static inline void
igc_read_reg_check_set_bits(structigc_hw*hw,uint32_treg,uint32_t
bits)
{drivers/net/igc/igc_txrx.c +1
-1@@ -345,7 +345,7 @@ rx_desc_get_pkt_info(struct igc_rx_queue *rxq,struct rte_mbuf *rxm, rxm->packet_type = rx_desc_pkt_info_to_pkt_type(pkt_info); } -static uint16_t +uint16_t igc_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts){
drivers/net/igc/igc_txrx.c +1
-1struct igc_rx_queue *const rxq = rx_queue;@@ -1397,7 +1397,7 @@ eth_igc_rx_queue_setup(struct rte_eth_dev *dev, }/* prepare packets for transmit */ -static uint16_t +uint16_t eth_igc_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,drivers/net/igc/igc_txrx.c +1
-1uint16_t nb_pkts) {@@ -1604,7 +1604,7 @@ tx_desc_cksum_flags_to_olinfo(uint64_t ol_flags)return tmp; } -static uint16_t +uint16_t igc_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts){
structigc_tx_queue* const txq =tx_queue;
--
2.25.1
PATCH v2 1/1 net/igc: fix segmentation fault in secondary dpdk-symmetric_mp
In reply to [email protected]From: Zhichao Zeng <[email protected]>
In the secondary dpdk-symmetric_mp process, the "smp_port_init" was skipped, which cause some function pointers not to be initialized, and a segmentation fault occurred when calling these function pointers.
This patch assigns initial values to rx_pkt_burst, tx_pkt_burst and tx_pkt_prepare pointers to avoid calling null function pointer.
---
v2:
remove unnecessary parameters, move declaration to relevant header file
--- drivers/net/igc/igc_ethdev.c | 3 +++ drivers/net/igc/igc_txrx.c | 6 +++--- drivers/net/igc/igc_txrx.h | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-)
drivers/net/igc/igc_ethdev.c +3 -0
@@ -1234,6 +1234,9 @@ eth_igc_dev_init(struct rte_eth_dev *dev) dev->rx_queue_count = eth_igc_rx_queue_count; dev->rx_descriptor_status = eth_igc_rx_descriptor_status; dev->tx_descriptor_status = eth_igc_tx_descriptor_status; + dev->rx_pkt_burst = igc_recv_pkts; + dev->tx_pkt_burst = igc_xmit_pkts; + dev->tx_pkt_prepare = eth_igc_prep_pkts;/* * for secondary processes, we don't initialize any further as primary
drivers/net/igc/igc_txrx.c +3 -3
@@ -345,7 +345,7 @@ rx_desc_get_pkt_info(struct igc_rx_queue *rxq, struct rte_mbuf *rxm, rxm->packet_type =rx_desc_pkt_info_to_pkt_type (pkt_info); } -static uint16_t +uint16_t igc_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts) {struct igc_rx_queue *const rxq = rx_queue;
@@ -1397,7 +1397,7 @@ eth_igc_rx_queue_setup(struct rte_eth_dev *dev, }/* prepare packets for transmit */ -static uint16_t +uint16_t eth_igc_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {
@@ -1604,7 +1604,7 @@ tx_desc_cksum_flags_to_olinfo(uint64_t ol_flags)return tmp; } -static uint16_t +uint16_t igc_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {struct igc_tx_queue *const txq = tx_queue;
drivers/net/igc/igc_txrx.h +4 -0
@@ -49,6 +49,10 @@ void eth_igc_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo);void eth_igc_vlan_strip_queue_set (struct rte_eth_dev *dev,uint16_t rx_queue_id,int on); +uint16_t igc_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t igc_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t eth_igc_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts); #ifdef __cplusplus }#endif
Signature · 1 line
2.25.1
Quoted 42 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Wednesday, June 22, 2022 6:49 PM
To: [email protected]
Cc: [email protected]; Yang, Qiming <[email protected]>; Zeng, ZhichaoX <[email protected]>; [email protected]; Guo, Junfeng <[email protected]>; Su, Simei <[email protected]>; Ferruh Yigit <[email protected]>
Subject: [PATCH v2] net/igc: fix segmentation fault in secondary dpdk-symmetric_mpFrom: Zhichao Zeng <[email protected]>
In the secondary dpdk-symmetric_mp process, the "
smp_port_init" was skipped, which cause some function pointers not to be initialized, and a segmentation fault occurred when calling these function pointers.This patch assigns initial values to
rx_pkt_burst,tx_pkt_burstandtx_pkt_preparepointers to avoid calling null function pointer.Signed-off-by Zhichao Zeng <[email protected]>---
v2:
remove unnecessary parameters, move declaration to relevant header file--- drivers/net/igc/igc_ethdev.c | 3 +++ drivers/net/igc/igc_txrx.c | 6 +++--- drivers/net/igc/igc_txrx.h | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-)drivers/net/igc/igc_ethdev.c index renamed from drivers/net/igc/igc_ethdev.c +0
-0
b9933b395d..25fb91bfec100644
drivers/net/igc/igc_ethdev.c eth_igc_dev_init(struct rte_eth_dev *dev) · line 1239
Quoted 6 lines
drivers/net/igc/igc_ethdev.c +3
-0@@ -1234,6 +1234,9 @@ eth_igc_dev_init(struct rte_eth_dev *dev) dev->rx_queue_count = eth_igc_rx_queue_count; dev->rx_descriptor_status = eth_igc_rx_descriptor_status; dev->tx_descriptor_status = eth_igc_tx_descriptor_status; + dev->rx_pkt_burst = igc_recv_pkts; + dev->tx_pkt_burst = igc_xmit_pkts; + dev->tx_pkt_prepare = eth_igc_prep_pkts;
If you already assign the function point in dev_init, you should remove the following redundant code.
PATCH v3 1/1 net/igc: move the initialization of data path into dev_init
In reply to [email protected]From: Zhichao Zeng <[email protected]>
The upper-layer application usually call the common interface "dev_init" to initialize the data path, but in the igc driver, the initialization of data path is in "igc_rx_init" and "eth_igc_tx_queue_setup", while in other drivers it is in "dev_init". So when upper-layer application calling these function pointers will occur segmentation faults.
This patch moves the initialization of data path into "eth_igc_dev_init" to avoid segmentation faults, which is consistent with other drivers.
---
v2:
remove unnecessary parameters, move declaration to relevant header file
---
v3:
remove redundant code, optimize commit log
--- drivers/net/igc/igc_ethdev.c | 3 +++ drivers/net/igc/igc_txrx.c | 10 +++------- drivers/net/igc/igc_txrx.h | 4 ++++ 3 files changed, 10 insertions(+), 7 deletions(-)
drivers/net/igc/igc_ethdev.c +3 -0
@@ -1234,6 +1234,9 @@ eth_igc_dev_init(struct rte_eth_dev *dev) dev->rx_queue_count = eth_igc_rx_queue_count; dev->rx_descriptor_status = eth_igc_rx_descriptor_status; dev->tx_descriptor_status = eth_igc_tx_descriptor_status; + dev->rx_pkt_burst = igc_recv_pkts; + dev->tx_pkt_burst = igc_xmit_pkts; + dev->tx_pkt_prepare = eth_igc_prep_pkts;/* * for secondary processes, we don't initialize any further as primary
drivers/net/igc/igc_txrx.c +3 -7
@@ -345,7 +345,7 @@ rx_desc_get_pkt_info(struct igc_rx_queue *rxq, struct rte_mbuf *rxm, rxm->packet_type =rx_desc_pkt_info_to_pkt_type (pkt_info); } -static uint16_t +uint16_t igc_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts) {struct igc_rx_queue *const rxq = rx_queue;
@@ -1071,8 +1071,6 @@ igc_rx_init(struct rte_eth_dev *dev)uint16_t i;int ret; - dev->rx_pkt_burst = igc_recv_pkts; -/* * Make sure receives are disabled while setting * up the descriptor ring.
@@ -1397,7 +1395,7 @@ eth_igc_rx_queue_setup(struct rte_eth_dev *dev, }/* prepare packets for transmit */ -static uint16_t +uint16_t eth_igc_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {
@@ -1604,7 +1602,7 @@ tx_desc_cksum_flags_to_olinfo(uint64_t ol_flags)return tmp; } -static uint16_t +uint16_t igc_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {struct igc_tx_queue *const txq = tx_queue;
@@ -2030,8 +2028,6 @@ int eth_igc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, txq->sw_ring, txq->tx_ring, txq->tx_ring_phys_addr);igc_reset_tx_queue (txq); - dev->tx_pkt_burst = igc_xmit_pkts; - dev->tx_pkt_prepare = ð_igc_prep_pkts; dev->data->tx_queues[queue_idx] = txq; txq->offloads = tx_conf->offloads;
drivers/net/igc/igc_txrx.h +4 -0
@@ -49,6 +49,10 @@ void eth_igc_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo);void eth_igc_vlan_strip_queue_set (struct rte_eth_dev *dev,uint16_t rx_queue_id,int on); +uint16_t igc_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t igc_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t eth_igc_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts); #ifdef __cplusplus }#endif
Signature · 1 line
2.25.1
RE: [PATCH v3] net/igc: move the initialization of data path into dev_init
Quoted 12 lines
-----Original Message-----
From: Zeng, ZhichaoX <[email protected]>
Sent: Tuesday, June 28, 2022 2:21 PM
To: [email protected]
Cc: [email protected]; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Zeng, ZhichaoX <[email protected]>; [email protected]; Guo, Junfeng <[email protected]>; Su, Simei <[email protected]>; Ferruh Yigit <[email protected]>
Subject: [PATCH v3] net/igc: move the initialization of data path intodev_init
Quoted 7 lines
From: Zhichao Zeng <[email protected]>
The upper-layer application usually call the common interface "
dev_init"
to initialize the data path, but in the igc driver, the initialization of data path is in "igc_rx_init" and "eth_igc_tx_queue_setup", while in other drivers it is in "dev_init". So when upper-layer application calling these function pointers will occur segmentation faults.
NO, for most intel PMD e.g.: i40e and ice, we don't initialize data path in dev_init.
Quoted 3 lines
This patch moves the initialization of data path into "
eth_igc_dev_init" to avoid segmentation faults, which is consistent with other drivers.
I saw dev->rx_pkt_burst can be overwritten in igc_rx_init, I assume the issue still be exist.
PATCH v4 1/1 net/igc: add support for secondary processes
In reply to [email protected]From: Zhichao Zeng <[email protected]>
The RX function was not specified in the secondary process, causing the secondary process to segfault in a multi-process environment.
This patch specify RX/TX functions in "dev_init" to support secondary processes.
---
v2:
remove unnecessary parameters, move declaration to relevant header file
---
v3:
remove redundant code, optimize commit log
---
v4:
rework patch
--- drivers/net/igc/igc_ethdev.c | 9 ++++++++- drivers/net/igc/igc_txrx.c | 8 ++++---- drivers/net/igc/igc_txrx.h | 6 ++++++ 3 files changed, 18 insertions(+), 5 deletions(-)
drivers/net/igc/igc_ethdev.c +8 -1
@@ -1240,8 +1240,15 @@ eth_igc_dev_init(struct rte_eth_dev *dev)* has already done this work. Only check we don't need a different * RX function. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { + dev->rx_pkt_burst = igc_recv_pkts; +if (dev->data->scattered_rx) + dev->rx_pkt_burst = igc_recv_scattered_pkts; + + dev->tx_pkt_burst = igc_xmit_pkts; + dev->tx_pkt_prepare = eth_igc_prep_pkts;return 0 ; + }rte_eth_copy_pci_info (dev, pci_dev); dev->data->dev_flags |=RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ;
drivers/net/igc/igc_txrx.c +4 -4
@@ -345,7 +345,7 @@ rx_desc_get_pkt_info(struct igc_rx_queue *rxq, struct rte_mbuf *rxm, rxm->packet_type =rx_desc_pkt_info_to_pkt_type (pkt_info); } -static uint16_t +uint16_t igc_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts) {struct igc_rx_queue *const rxq = rx_queue;
@@ -488,7 +488,7 @@ igc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)return nb_rx; } -static uint16_t +uint16_t igc_recv_scattered_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts) {
@@ -1397,7 +1397,7 @@ eth_igc_rx_queue_setup(struct rte_eth_dev *dev, }/* prepare packets for transmit */ -static uint16_t +uint16_t eth_igc_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {
@@ -1604,7 +1604,7 @@ tx_desc_cksum_flags_to_olinfo(uint64_t ol_flags)return tmp; } -static uint16_t +uint16_t igc_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {struct igc_tx_queue *const txq = tx_queue;
drivers/net/igc/igc_txrx.h +6 -0
@@ -49,6 +49,12 @@ void eth_igc_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo);void eth_igc_vlan_strip_queue_set (struct rte_eth_dev *dev,uint16_t rx_queue_id,int on); +uint16_t igc_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t igc_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t eth_igc_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts); +uint16_t igc_recv_scattered_pkts (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); #ifdef __cplusplus }#endif
Signature · 1 line
2.25.1
RE: [PATCH v4] net/igc: add support for secondary processes
Quoted 46 lines
-----Original Message-----
From: Zeng, ZhichaoX <[email protected]>
Sent: Thursday, June 30, 2022 7:04 PM
To: [email protected]
Cc: [email protected]; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Zeng, ZhichaoX <[email protected]>; [email protected]; Guo, Junfeng <[email protected]>; Su, Simei <[email protected]>; Burakov, Anatoly <[email protected]>; Ferruh Yigit <[email protected]>
Subject: [PATCH v4] net/igc: add support for secondary processesFrom: Zhichao Zeng <[email protected]>
The RX function was not specified in the secondary process, causing the secondary process to segfault in a multi-process environment.
This patch specify RX/TX functions in "
dev_init" to support secondary processes.Signed-off-by Zhichao Zeng <[email protected]>---
v2:
remove unnecessary parameters, move declaration to relevant header file
---
v3:
remove redundant code, optimize commit log
---
v4:
rework patch--- drivers/net/igc/igc_ethdev.c | 9 ++++++++- drivers/net/igc/igc_txrx.c | 8 ++++---- drivers/net/igc/igc_txrx.h | 6 ++++++ 3 files changed, 18 insertions(+), 5 deletions(-)drivers/net/igc/igc_ethdev.c index renamed from drivers/net/igc/igc_ethdev.c +0
-0
b9933b395d..7f221a5d34100644
drivers/net/igc/igc_ethdev.c eth_igc_dev_init(struct rte_eth_dev *dev) · line 1246
Quoted 8 lines
drivers/net/igc/igc_ethdev.c +4
-1@@ -1240,8 +1240,15 @@ eth_igc_dev_init(struct rte_eth_dev *dev)* has already done this work. Only check we don't need a different * RX function. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { + dev->rx_pkt_burst = igc_recv_pkts; +if (dev->data->scattered_rx) + dev->rx_pkt_burst = igc_recv_scattered_pkts;
Please removed the redundant code in igc_rx_init
RE: [PATCH v4] net/igc: add support for secondary processes
Quoted 27 lines
Quoted 27 lines
The RX function was not specified in the secondary process, causing the secondary process to segfault in a multi-process environment.
This patch specify RX/TX functions in "
dev_init" to support secondary processes.Signed-off-by Zhichao Zeng <[email protected]>---
v2:
remove unnecessary parameters, move declaration to relevant header file
---
v3:
remove redundant code, optimize commit log
---
v4:
rework patch--- drivers/net/igc/igc_ethdev.c | 9 ++++++++- drivers/net/igc/igc_txrx.c | 8 ++++---- drivers/net/igc/igc_txrx.h | 6 ++++++ 3 files changed, 18 insertions(+), 5 deletions(-)
Quoted 16 lines
Quoted 6 lines
(quoted diff) +0
-0
b/drivers/net/igc/igc_ethdev.cindexb9933b395d..7f221a5d34100644drivers/net/igc/igc_ethdev.c eth_igc_dev_init(struct rte_eth_dev *dev) · line 1246
Quoted 8 lines
drivers/net/igc/igc_ethdev.c +4
-1@@ -1240,8 +1240,15 @@ eth_igc_dev_init(struct rte_eth_dev *dev)* has already done this work. Only check we don't need a different * RX function. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { + dev->rx_pkt_burst = igc_recv_pkts; +if (dev->data->scattered_rx) + dev->rx_pkt_burst = igc_recv_scattered_pkts;Please removed the redundant code in
igc_rx_init
Only the main process will execute "igc_rx_init", and the secondary process will not execute it. So, the data path of the secondary process is not initialized.
The code that this patch adds to initialize the data path in "dev_init" will only be executed in the secondary process. The same code in "igc_rx_init" is not redundant.
May I ask if the commit log is confusing, and should I submit new patch to correct it?
Regards
Zhichao
RE: [PATCH v4] net/igc: add support for secondary processes
Quoted 57 lines
-----Original Message-----
From: Zeng, ZhichaoX <[email protected]>
Sent: Friday, July 1, 2022 11:13 AM
To: Zhang, Qi Z <[email protected]>; [email protected]
Cc: [email protected]; Yang, Qiming <[email protected]>; [email protected]; Guo, Junfeng <[email protected]>; Su, Simei <[email protected]>; Burakov, Anatoly <[email protected]>; Ferruh Yigit <[email protected]>
Subject: RE: [PATCH v4] net/igc: add support for secondary processesQuoted 4 lines
Quoted 4 lines
The RX function was not specified in the secondary process, causing the secondary process to segfault in a multi-process environment.
This patch specify RX/TX functions in "
dev_init" to support secondaryprocesses.
Quoted 23 lines
Quoted 23 lines
Signed-off-by Zhichao Zeng <[email protected]>---
v2:
remove unnecessary parameters, move declaration to relevant header file
---
v3:
remove redundant code, optimize commit log
---
v4:
rework patch--- drivers/net/igc/igc_ethdev.c | 9 ++++++++- drivers/net/igc/igc_txrx.c | 8 ++++---- drivers/net/igc/igc_txrx.h | 6 ++++++ 3 files changed, 18 insertions(+), 5 deletions(-)Quoted 16 lines
Quoted 6 lines
(quoted diff) +0
-0
b/drivers/net/igc/igc_ethdev.cindexb9933b395d..7f221a5d34100644drivers/net/igc/igc_ethdev.c eth_igc_dev_init(struct rte_eth_dev *dev) · line 1246
Quoted 8 lines
drivers/net/igc/igc_ethdev.c +4
-1@@ -1240,8 +1240,15 @@ eth_igc_dev_init(struct rte_eth_dev *dev)* has already done this work. Only check we don't need a different * RX function. */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { + dev->rx_pkt_burst = igc_recv_pkts; +if (dev->data->scattered_rx) + dev->rx_pkt_burst = igc_recv_scattered_pkts;Please removed the redundant code in
igc_rx_init
Quoted 7 lines
Only the main process will execute "
igc_rx_init", and the secondary process will not execute it.
So, the data path of the secondary process is not initialized.The code that this patch adds to initialize the data path in "
dev_init" will only be executed in the secondary process. The same code in "igc_rx_init" is not redundant.
Ok, I missed this point, the implementation is correct.
Applied to dpdk-next-net-intel.
Thanks
Qi
Quoted 6 lines
May I ask if the commit log is confusing, and should I submit new patch to correct it?
Regards
Zhichao