DPAA and DPAA2 driver changes
cover DPAA and DPAA2 driver changes
This series have list of patch for bug fixes and
some enhancements to DPAA1 and DPAA2 net drivers.
Apeksha Gupta (2):
net/enetfec: fix restart issue
net/enetfec: fix buffer leak issue
Gagandeep Singh (7):
net/dpaa: support ESP packet type in packet parsing net/dpaa2: use internal mempool for SG table net/dpaa2: fix buffer free on transmit SG packets net/dpaa: use internal mempool for SG table bus/dpaa: mempool ops registration change net/dpaa: fix buffer free on transmit SG packets net/dpaa: fix buffer free in slow path
Rohit Raj (3):
bus/fslmc: add timeout in MC send command API net/dpaa: fix Jumbo packet Rx in case of VSP bus/dpaa: pass interface name as a string instead of pointer
Vanshika Shukla (2):
bus/dpaa: use non-block mode for FD open net/dpaa2: fix dpdmux configuration for error behaviour
brick (1):
net/dpaa2: check free enqueue descriptors before Tx
drivers/bus/dpaa/base/qbman/process.c | 8 +- drivers/bus/dpaa/base/qbman/qman_driver.c | 6 +- drivers/bus/dpaa/dpaa_bus.c | 10 +- drivers/bus/fslmc/mc/mc_sys.c | 18 ++- drivers/event/dpaa2/dpaa2_eventdev.c | 8 +- drivers/net/dpaa/dpaa_ethdev.c | 20 ++- drivers/net/dpaa/dpaa_ethdev.h | 19 +++ drivers/net/dpaa/dpaa_flow.c | 13 +- drivers/net/dpaa/dpaa_flow.h | 5 +- drivers/net/dpaa/dpaa_rxtx.c | 97 +++++++----- drivers/net/dpaa/dpaa_rxtx.h | 6 + drivers/net/dpaa2/dpaa2_ethdev.c | 14 ++ drivers/net/dpaa2/dpaa2_ethdev.h | 21 +++ drivers/net/dpaa2/dpaa2_mux.c | 2 +- drivers/net/dpaa2/dpaa2_rxtx.c | 174 +++++++++++++++------- drivers/net/enetfec/enet_ethdev.c | 4 + drivers/net/enetfec/enet_rxtx.c | 29 ++-- 17 files changed, 315 insertions(+), 139 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/15 bus/dpaa: use non-block mode for FD open
From: Vanshika Shukla <[email protected]>
This patch sets qman portal file descriptors used for interrupts IO processing in non-blocking mode to avoid any unwanted blocks while IO operations over the FD.
--- drivers/bus/dpaa/base/qbman/qman_driver.c | 6 +++--- drivers/net/dpaa/dpaa_ethdev.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/bus/dpaa/base/qbman/qman_driver.c +3 -3
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2008-2016 Freescale Semiconductor Inc. -* Copyright 2017,2019 NXP +* Copyright 2017-2022 NXP * */
@@ -64,7 +64,7 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared) qpcfg.addr_virt[DPAA_PORTAL_CE ] = map.addr.cena; qpcfg.addr_virt[DPAA_PORTAL_CI ] = map.addr.cinh; - qmfd =open (QMAN_PORTAL_IRQ_PATH ,O_RDONLY ); + qmfd =open (QMAN_PORTAL_IRQ_PATH ,O_RDONLY |O_NONBLOCK );if (qmfd ==-1 ) {pr_err ("QMan irq init failed\n" );process_portal_unmap (&map.addr);
@@ -174,7 +174,7 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd) q_pcfg->addr_virt[DPAA_PORTAL_CE ] = q_map.addr.cena; q_pcfg->addr_virt[DPAA_PORTAL_CI ] = q_map.addr.cinh; - q_fd =open (QMAN_PORTAL_IRQ_PATH ,O_RDONLY ); + q_fd =open (QMAN_PORTAL_IRQ_PATH ,O_RDONLY |O_NONBLOCK );if (q_fd ==-1 ) {pr_err ("QMan irq init failed\n" ); goto err;
drivers/net/dpaa/dpaa_ethdev.c +1 -1
@@ -1496,7 +1496,7 @@ static int dpaa_dev_queue_intr_disable(struct rte_eth_dev *dev, temp1 =read (rxq->q_fd, &temp,sizeof (temp));if (temp1 !=sizeof (temp)) -DPAA_PMD_ERR ("irq read error" ); +DPAA_PMD_DEBUG ("read did not return anything" );qman_fq_portal_thread_irq (rxq->qp);
Signature · 1 line
2.25.1
PATCH 2/15 net/enetfec: fix restart issue
In reply to Gagandeep SinghFrom: Apeksha Gupta <[email protected]>
Queue reset is missing in restart because of which IO cannot work on device restart.
This patch fixes the issue by resetting the queues on device restart.
--- drivers/net/enetfec/enet_ethdev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/enetfec/enet_ethdev.c +4 -0
@@ -54,6 +54,7 @@ enetfec_restart(struct rte_eth_dev *dev)uint32_t rcntl =OPT_FRAME_SIZE |0x04 ;uint32_t ecntl =ENETFEC_ETHEREN ;uint32_t val; +int i;/* Clear any outstanding interrupt. */ writel (0xffffffff , (uint8_t *)fep->hw_baseaddr_v +ENETFEC_EIR );
@@ -149,6 +150,9 @@ enetfec_restart(struct rte_eth_dev *dev)/* And last, enable the transmit and receive processing */ rte_write32 (rte_cpu_to_le_32 (ecntl), (uint8_t *)fep->hw_baseaddr_v +ENETFEC_ECR ); + +for (i =0 ; i < fep->max_rx_queues; i++) +rte_write32 (0 , fep->rx_queues[i]->bd.active_reg_desc);rte_delay_us (10 ); }
Signature · 1 line
2.25.1
PATCH 3/15 net/enetfec: fix buffer leak issue
In reply to Gagandeep SinghFrom: Apeksha Gupta <[email protected]>
Driver has no proper handling to free unused allocated mbufs in case of error or when the rx processing complete because of which mempool can be empty after some time.
This patch fixes this issue by moving the buffer allocation code to the right place in driver.
--- drivers/net/enetfec/enet_rxtx.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/net/enetfec/enet_rxtx.c +16 -13
@@ -39,11 +39,6 @@ enetfec_recv_pkts(void *rxq1, struct rte_mbuf **rx_pkts,if (pkt_received >= nb_pkts)break ; - new_mbuf =rte_pktmbuf_alloc (pool); -if (unlikely (new_mbuf ==NULL )) { - stats->rx_nombuf++; -break ; - }/* Check for errors. */ status ^=RX_BD_LAST ; if (status & (RX_BD_LG | RX_BD_SH | RX_BD_NO |
@@ -72,6 +67,12 @@ enetfec_recv_pkts(void *rxq1, struct rte_mbuf **rx_pkts, goto rx_processing_done; } + new_mbuf =rte_pktmbuf_alloc (pool); +if (unlikely (new_mbuf ==NULL )) { + stats->rx_nombuf++; +break ; + } +/* Process the incoming frame. */ stats->ipackets++; pkt_len =rte_le_to_cpu_16 (rte_read16 (&bdp->bd_datlen));
@@ -193,7 +194,16 @@ enetfec_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) tx_st =0 ;break ; } + + mbuf = *(tx_pkts); +if (mbuf->nb_segs >1 ) { +ENETFEC_DP_LOG (DEBUG ,"SG not supported" ); +return pkt_transmitted; + } + + tx_pkts++; bdp = txq->bd.cur; +/* First clean the ring */ index =enet_get_bd_index (bdp, &txq->bd); status =rte_le_to_cpu_16 (rte_read16 (&bdp->bd_sc));
@@ -207,9 +217,6 @@ enetfec_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) txq->tx_mbuf[index] =NULL ; } - mbuf = *(tx_pkts); - tx_pkts++; -/* Fill in a Tx ring entry */ last_bdp = bdp; status &= ~TX_BD_STATS ;
@@ -219,10 +226,6 @@ enetfec_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) stats->opackets++; stats->obytes += buflen; -if (mbuf->nb_segs >1 ) { -ENETFEC_DP_LOG (DEBUG ,"SG not supported" ); -return -1 ; - } status |= (TX_BD_LAST ); data = rte_pktmbuf_mtod(mbuf, void *);for (i =0 ; i <= buflen; i +=RTE_CACHE_LINE_SIZE )
@@ -268,5 +271,5 @@ enetfec_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)*/ txq->bd.cur = bdp; } -return nb_pkts; +return pkt_transmitted; }
Signature · 1 line
2.25.1
PATCH 4/15 net/dpaa2: fix dpdmux configuration for error behaviour
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Driver is giving the wrong interface ID while setting the error behaviour.
This patch fixes the issue by passing the correct MAC interface index value to the API.
--- drivers/net/dpaa2/dpaa2_ethdev.h | 3 +++ drivers/net/dpaa2/dpaa2_mux.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_ethdev.h +3 -0
@@ -66,6 +66,9 @@/* Tx confirmation enabled */ #define DPAA2_TX_CONF_ENABLE 0x06 +/* DPDMUX index for DPMAC */ +#define DPAA2_DPDMUX_DPMAC_IDX 0 +/* HW loopback the egress traffic to self ingress*/ #define DPAA2_TX_MAC_LOOPBACK_MODE 0x20
drivers/net/dpaa2/dpaa2_mux.c +1 -1
@@ -336,7 +336,7 @@ dpaa2_create_dpdmux_device(int vdev_fd __rte_unused, ret =dpdmux_if_set_errors_behavior (&dpdmux_dev->dpdmux,CMD_PRI_LOW , - dpdmux_dev->token, dpdmux_id, + dpdmux_dev->token,DPAA2_DPDMUX_DPMAC_IDX , &mux_err_cfg);if (ret) { DPAA2_PMD_ERR("dpdmux_if_set_errors_behavior %s err %d",
Signature · 1 line
2.25.1
PATCH 5/15 net/dpaa2: check free enqueue descriptors before Tx
In reply to Gagandeep SinghFrom: brick <[email protected]>
Check if there exists free enqueue descriptors before enqueuing Tx packet. Also try to free enqueue descriptors in case they are not free.
--- drivers/event/dpaa2/dpaa2_eventdev.c | 8 ++--- drivers/net/dpaa2/dpaa2_rxtx.c | 50 +++++++++++++++++++--------- 2 files changed, 38 insertions(+), 20 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +3 -5
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2017,2019-2021 NXP +* Copyright 2017,2019-2022 NXP */ #include <assert.h>
@@ -175,7 +175,7 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],if (retry_count >DPAA2_EV_TX_RETRY_COUNT ) { num_tx += loop; nb_events -= loop; -return num_tx + loop; +return num_tx; } }else { loop += ret;
@@ -1015,9 +1015,7 @@ dpaa2_eventdev_txa_enqueue(void *port, txq[i] = rte_eth_devices[m[i]->port].data->tx_queues[qid]; } -dpaa2_dev_tx_multi_txq_ordered (txq, m, nb_events); - -return nb_events; +return dpaa2_dev_tx_multi_txq_ordered (txq, m, nb_events); }static struct eventdev_ops dpaa2_eventdev_ops = {
drivers/net/dpaa2/dpaa2_rxtx.c +35 -15
104 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH 05/15] net/dpaa2: check free enqueue descriptors before Tx
Quoted 10 lines · Gagandeep Singh
From: brick <[email protected]>
Check if there exists free enqueue descriptors before enqueuing Tx packet. Also try to free enqueue descriptors in case they are not free.
Fixes ed1cdbed6a15 ("net/dpaa2: support multiple Tx queues enqueue for ordered")Signed-off-by brick <[email protected]>
Can you please use name tag as "Name Surname <email lower case>", like
<...>
drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx_multi_txq_ordered(void **queue, · line 1571
Quoted 4 lines
drivers/net/dpaa2/dpaa2_rxtx.c +4
-0+DPAA2_PMD_DP_DEBUG ("===> eth_data =%p, fqid =%d\n" , + eth_data, dpaa2_q[loop]->fqid); + +/*Check if the queue is congested*/
syntax, more common to put space before/after '/* ' & ' */'
drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx_multi_txq_ordered(void **queue, · line 1580
Quoted 9 lines
drivers/net/dpaa2/dpaa2_rxtx.c +9
-0+ retry_count =0 ; +while (qbman_result_SCN_state (dpaa2_q[loop]->cscn)) { + retry_count++; +/* Retry for some time before giving up */ +if (retry_count >CONG_RETRY_COUNT ) + goto send_frames; + } + +/*Prepare enqueue descriptor*/
ditto
PATCH 6/15 net/dpaa: support ESP packet type in packet parsing
In reply to Gagandeep SinghAdd support of ESP packet type in packet receive path.
--- drivers/net/dpaa/dpaa_rxtx.c | 10 ++++++++++ drivers/net/dpaa/dpaa_rxtx.h | 6 ++++++ 2 files changed, 16 insertions(+)
drivers/net/dpaa/dpaa_rxtx.c +10 -0
@@ -178,6 +178,16 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) m->packet_type =RTE_PTYPE_L2_ETHER |RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ;break ; +case DPAA_PKT_TYPE_IPSEC_IPV4 : +if (*((uintptr_t *)&annot->parse) &DPAA_PARSE_ESP_MASK ) + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 |RTE_PTYPE_TUNNEL_ESP ; +break ; +case DPAA_PKT_TYPE_IPSEC_IPV6 : +if (*((uintptr_t *)&annot->parse) &DPAA_PARSE_ESP_MASK ) + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_TUNNEL_ESP ; +break ;case DPAA_PKT_TYPE_IPV4_EXT_UDP : m->packet_type =RTE_PTYPE_L2_ETHER |RTE_PTYPE_L3_IPV4_EXT |RTE_PTYPE_L4_UDP ;
drivers/net/dpaa/dpaa_rxtx.h +6 -0
@@ -47,6 +47,7 @@* L4R 0xE0 - * 0x20 - TCP * 0x40 - UDP +* 0x60 - IPsec * 0x80 - SCTP * L3R 0xEDC4 (in Big Endian) - * 0x8000 - IPv4
@@ -63,6 +64,7 @@*/ #define DPAA_PARSE_MASK 0x00F044EF00800000#define DPAA_PARSE_VLAN_MASK 0x0000000000700000 +#define DPAA_PARSE_ESP_MASK 0x0008000000000000/* Parsed values (Little Endian) */ #define DPAA_PKT_TYPE_NONE 0x0000000000000000
@@ -137,6 +139,10 @@ (0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_4_6)#define DPAA_PKT_TYPE_TUNNEL_6_4_TCP \ (0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_6_4) +#define DPAA_PKT_TYPE_IPSEC_IPV4 \ + (0x0060000000000000 | DPAA_PKT_TYPE_IPV4) +#define DPAA_PKT_TYPE_IPSEC_IPV6 \ + (0x0060000000000000 | DPAA_PKT_TYPE_IPV6)/* Checksum Errors */ #define DPAA_PKT_IP_CSUM_ERR 0x0000400200000000
Signature · 1 line
2.25.1
Re: [PATCH 06/15] net/dpaa: support ESP packet type in packet parsing
Quoted 19 lines · Gagandeep Singh
Add support of ESP packet type in packet receive path.
Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/dpaa/dpaa_rxtx.c | 10 ++++++++++ drivers/net/dpaa/dpaa_rxtx.h | 6 ++++++ 2 files changed, 16 insertions(+)drivers/net/dpaa/dpaa_rxtx.c +3
-0@@ -178,6 +178,16 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) m->packet_type =RTE_PTYPE_L2_ETHER |RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ;break ; +case DPAA_PKT_TYPE_IPSEC_IPV4 : +if (*((uintptr_t *)&annot->parse) &DPAA_PARSE_ESP_MASK ) + m->packet_type = RTE_PTYPE_L2_ETHER |
drivers/net/dpaa/dpaa_rxtx.c static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) · line 193
Quoted 10 lines
drivers/net/dpaa/dpaa_rxtx.c +7
-0+RTE_PTYPE_L3_IPV4 |RTE_PTYPE_TUNNEL_ESP ; +break ; +case DPAA_PKT_TYPE_IPSEC_IPV6 : +if (*((uintptr_t *)&annot->parse) &DPAA_PARSE_ESP_MASK ) + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_TUNNEL_ESP ; +break ;case DPAA_PKT_TYPE_IPV4_EXT_UDP : m->packet_type =RTE_PTYPE_L2_ETHER |RTE_PTYPE_L3_IPV4_EXT |RTE_PTYPE_L4_UDP ;
Shouldn't 'dpaa_supported_ptypes_get()' needs to be updated to notify host on the capability to report ESP types.
Quoted 31 lines
drivers/net/dpaa/dpaa_rxtx.h +6
-0@@ -47,6 +47,7 @@* L4R 0xE0 - * 0x20 - TCP * 0x40 - UDP +* 0x60 - IPsec * 0x80 - SCTP * L3R 0xEDC4 (in Big Endian) - * 0x8000 - IPv4 @@ -63,6 +64,7 @@*/ #define DPAA_PARSE_MASK 0x00F044EF00800000#define DPAA_PARSE_VLAN_MASK 0x0000000000700000 +#define DPAA_PARSE_ESP_MASK 0x0008000000000000/* Parsed values (Little Endian) */ #define DPAA_PKT_TYPE_NONE 0x0000000000000000@@ -137,6 +139,10 @@ (0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_4_6)#define DPAA_PKT_TYPE_TUNNEL_6_4_TCP \ (0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_6_4) +#define DPAA_PKT_TYPE_IPSEC_IPV4 \ + (0x0060000000000000 | DPAA_PKT_TYPE_IPV4) +#define DPAA_PKT_TYPE_IPSEC_IPV6 \ + (0x0060000000000000 | DPAA_PKT_TYPE_IPV6)/* Checksum Errors */ #define DPAA_PKT_IP_CSUM_ERR 0x0000400200000000
RE: [PATCH 06/15] net/dpaa: support ESP packet type in packet parsing
Hi
Quoted 37 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, October 5, 2022 7:51 PM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 06/15] net/dpaa: support ESP packet type in packet parsingdrivers/net/dpaa/dpaa_rxtx.c static inline void dpaa_eth_packet_info(struct
Quoted 13 lines · Gagandeep Singh
Add support of ESP packet type in packet receive path.
Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/dpaa/dpaa_rxtx.c | 10 ++++++++++ drivers/net/dpaa/dpaa_rxtx.h | 6 ++++++ 2 files changed, 16 insertions(+)(quoted diff) +0
-0
b/drivers/net/dpaa/dpaa_rxtx.cindex20b75efb63..22205cec30100644drivers/net/dpaa/dpaa_rxtx.c +0
-0@@ -178,6 +178,16 @@ static inline void dpaa_eth_packet_info(struct
rte_mbuf*m, void*fd_virt_addr)drivers/net/dpaa/dpaa_rxtx.c static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr)
Quoted 7 lines
drivers/net/dpaa/dpaa_rxtx.c +4
-0m->packet_type =RTE_PTYPE_L2_ETHER |RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ;break ; +case DPAA_PKT_TYPE_IPSEC_IPV4 : +if (*((uintptr_t *)&annot->parse) &DPAA_PARSE_ESP_MASK ) + m->packet_type =RTE_PTYPE_L2_ETHER | + RTE_PTYPE_L3_IPV4 |
RTE_PTYPE_TUNNEL_ESP;drivers/net/dpaa/dpaa_rxtx.c static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr)
Quoted 5 lines
drivers/net/dpaa/dpaa_rxtx.c +5
-0+break ; +case DPAA_PKT_TYPE_IPSEC_IPV6 : +if (*((uintptr_t *)&annot->parse) &DPAA_PARSE_ESP_MASK ) + m->packet_type =RTE_PTYPE_L2_ETHER | + RTE_PTYPE_L3_IPV6 |
RTE_PTYPE_TUNNEL_ESP;
Quoted 7 lines
drivers/net/dpaa/dpaa_rxtx.c static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) · line 193
Quoted 4 lines
drivers/net/dpaa/dpaa_rxtx.c +1
-0+break ;case DPAA_PKT_TYPE_IPV4_EXT_UDP : m->packet_type =RTE_PTYPE_L2_ETHER |RTE_PTYPE_L3_IPV4_EXT |RTE_PTYPE_L4_UDP ;Shouldn't '
dpaa_supported_ptypes_get()' needs to be updated to notify host on the capability to report ESP types.
Yes, I will update it in next version.
Quoted 35 lines
Quoted 22 lines
(quoted diff) +0
-0
b/drivers/net/dpaa/dpaa_rxtx.hindex99e09196e9..b2d7c0f2a3100644drivers/net/dpaa/dpaa_rxtx.h +2
-0@@ -47,6 +47,7 @@* L4R 0xE0 - * 0x20 - TCP * 0x40 - UDP +* 0x60 - IPsec * 0x80 - SCTP * L3R 0xEDC4 (in Big Endian) - * 0x8000 - IPv4 @@ -63,6 +64,7 @@*/ #define DPAA_PARSE_MASK 0x00F044EF00800000#define DPAA_PARSE_VLAN_MASK 0x0000000000700000 +#define DPAA_PARSE_ESP_MASK 0x0008000000000000/* Parsed values (Little Endian) */ #define DPAA_PKT_TYPE_NONE 0x0000000000000000drivers/net/dpaa/dpaa_rxtx.h line 139
Quoted 1 line
drivers/net/dpaa/dpaa_rxtx.h +0
-0@@ -137,6 +139,10 @@ (0x0020000000000000 |
DPAA_PKT_TYPE_TUNNEL_4_6)drivers/net/dpaa/dpaa_rxtx.h line 141
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.h +0
-0#define DPAA_PKT_TYPE_TUNNEL_6_4_TCP \ (0x0020000000000000 |
DPAA_PKT_TYPE_TUNNEL_6_4)drivers/net/dpaa/dpaa_rxtx.h line 143
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.h +2
-0+#define DPAA_PKT_TYPE_IPSEC_IPV4 \ + (0x0060000000000000 | DPAA_PKT_TYPE_IPV4)#define
Quoted 5 lines
drivers/net/dpaa/dpaa_rxtx.h +2
-0+DPAA_PKT_TYPE_IPSEC_IPV6 \ + (0x0060000000000000 |DPAA_PKT_TYPE_IPV6 ) /* Checksum Errors */#define DPAA_PKT_IP_CSUM_ERR 0x0000400200000000
PATCH 7/15 net/dpaa2: use internal mempool for SG table
In reply to Gagandeep SinghCreating and using driver's mempool for
allocating the SG table memory required for
FD creation instead of relying on user mempool.
--- drivers/net/dpaa2/dpaa2_ethdev.c | 14 ++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 9 +++++++++ drivers/net/dpaa2/dpaa2_rxtx.c | 13 ++++++------- 3 files changed, 29 insertions(+), 7 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.c +14 -0
@@ -78,6 +78,8 @@ bool dpaa2_enable_err_queue;#define MAX_NB_RX_DESC 11264int total_nb_rx_desc; +struct rte_mempool *dpaa2_tx_sg_pool; +struct rte_dpaa2_xstats_name_off {char name[RTE_ETH_XSTATS_NAME_SIZE ];uint8_t page_id;/* dpni statistics page id */
@@ -2907,6 +2909,18 @@ rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,/* Invoke PMD device initialization function */ diag =dpaa2_dev_init (eth_dev);if (diag ==0 ) { +if (!dpaa2_tx_sg_pool) { + dpaa2_tx_sg_pool = +rte_pktmbuf_pool_create ("dpaa2_mbuf_tx_sg_pool" , +DPAA2_POOL_SIZE , +DPAA2_POOL_CACHE_SIZE ,0 , +DPAA2_MAX_SGS *sizeof (struct qbman_sge ), +rte_socket_id ()); +if (dpaa2_tx_sg_pool ==NULL ) { +DPAA2_PMD_ERR ("SG pool creation failed\n" ); +return -ENOMEM ; + } + }rte_eth_dev_probing_finish (eth_dev);return 0 ; }
drivers/net/dpaa2/dpaa2_ethdev.h +9 -0
@@ -121,6 +121,15 @@#define DPAA2_PKT_TYPE_VLAN_1 0x0160#define DPAA2_PKT_TYPE_VLAN_2 0x0260 +/* Global pool used by driver for SG list TX */ +extern struct rte_mempool *dpaa2_tx_sg_pool; +/* Maximum SG segments */ +#define DPAA2_MAX_SGS 128 +/* SG pool size */ +#define DPAA2_POOL_SIZE 2048 +/* SG pool cache size */ +#define DPAA2_POOL_CACHE_SIZE 256 +/* enable timestamp in mbuf*/ extern bool dpaa2_enable_ts[];extern uint64_t dpaa2_timestamp_rx_dynflag;
drivers/net/dpaa2/dpaa2_rxtx.c +6 -7
@@ -403,7 +403,7 @@ eth_fd_to_mbuf(const struct qbman_fd *fd, static int __rte_noinline __rte_hoteth_mbuf_to_sg_fd (struct rte_mbuf *mbuf,struct qbman_fd *fd, -struct rte_mempool *mp,uint16_t bpid) +uint16_t bpid) {struct rte_mbuf *cur_seg = mbuf, *prev_seg, *mi, *temp;struct qbman_sge *sgt, *sge =NULL ;
@@ -433,12 +433,12 @@ eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, }DPAA2_SET_FD_OFFSET (fd, offset); }else { - temp =rte_pktmbuf_alloc (mp); + temp =rte_pktmbuf_alloc (dpaa2_tx_sg_pool);if (temp ==NULL ) {DPAA2_PMD_DP_DEBUG ("No memory to allocate S/G table\n" );return -ENOMEM ; } -DPAA2_SET_ONLY_FD_BPID (fd, bpid); +DPAA2_SET_ONLY_FD_BPID (fd,mempool_to_bpid (dpaa2_tx_sg_pool));DPAA2_SET_FD_OFFSET (fd, temp->data_off);#ifdef RTE_LIBRTE_MEMPOOL_DEBUG rte_mempool_check_cookies(rte_mempool_from_obj((void *)temp),
@@ -1321,9 +1321,10 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)if (unlikely (RTE_MBUF_HAS_EXTBUF (*bufs))) {if (unlikely ((*bufs)->nb_segs >1 )) { + mp = (*bufs)->pool;if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp,0 )) +mempool_to_bpid (mp))) goto send_n_return; }else { eth_mbuf_to_fd(*bufs,
@@ -1372,7 +1373,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) + bpid)) goto send_n_return; }else { eth_mbuf_to_fd(*bufs,
@@ -1646,7 +1647,6 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue,if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_frames; }else {
@@ -1810,7 +1810,6 @@ dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_n_return; }else {
Signature · 1 line
2.25.1
Re: [PATCH 07/15] net/dpaa2: use internal mempool for SG table
Quoted 4 lines · Gagandeep Singh
Creating and using driver's mempool for
allocating the SG table memory required for
FD creation instead of relying on user mempool.
As far as I can see this is in the Tx path, can you please explain why driver need an internal pktmbuf pool?
And shouldn't mempool needs to be freed on driver close and release.
Same comment applies for dpaa version of the patch (12/15).
Quoted 124 lines
Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/dpaa2/dpaa2_ethdev.c | 14 ++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 9 +++++++++ drivers/net/dpaa2/dpaa2_rxtx.c | 13 ++++++------- 3 files changed, 29 insertions(+), 7 deletions(-)drivers/net/dpaa2/dpaa2_ethdev.c +14
-0@@ -78,6 +78,8 @@ bool dpaa2_enable_err_queue;#define MAX_NB_RX_DESC 11264int total_nb_rx_desc; +struct rte_mempool *dpaa2_tx_sg_pool; +struct rte_dpaa2_xstats_name_off {char name[RTE_ETH_XSTATS_NAME_SIZE ];uint8_t page_id;/* dpni statistics page id */ @@ -2907,6 +2909,18 @@ rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,/* Invoke PMD device initialization function */ diag =dpaa2_dev_init (eth_dev);if (diag ==0 ) { +if (!dpaa2_tx_sg_pool) { + dpaa2_tx_sg_pool = +rte_pktmbuf_pool_create ("dpaa2_mbuf_tx_sg_pool" , +DPAA2_POOL_SIZE , +DPAA2_POOL_CACHE_SIZE ,0 , +DPAA2_MAX_SGS *sizeof (struct qbman_sge ), +rte_socket_id ()); +if (dpaa2_tx_sg_pool ==NULL ) { +DPAA2_PMD_ERR ("SG pool creation failed\n" ); +return -ENOMEM ; + } + }rte_eth_dev_probing_finish (eth_dev);return 0 ; }drivers/net/dpaa2/dpaa2_ethdev.h +9
-0@@ -121,6 +121,15 @@#define DPAA2_PKT_TYPE_VLAN_1 0x0160#define DPAA2_PKT_TYPE_VLAN_2 0x0260 +/* Global pool used by driver for SG list TX */ +extern struct rte_mempool *dpaa2_tx_sg_pool; +/* Maximum SG segments */ +#define DPAA2_MAX_SGS 128 +/* SG pool size */ +#define DPAA2_POOL_SIZE 2048 +/* SG pool cache size */ +#define DPAA2_POOL_CACHE_SIZE 256 +/* enable timestamp in mbuf*/ extern bool dpaa2_enable_ts[];extern uint64_t dpaa2_timestamp_rx_dynflag;drivers/net/dpaa2/dpaa2_rxtx.c +6
-7@@ -403,7 +403,7 @@ eth_fd_to_mbuf(const struct qbman_fd *fd, static int __rte_noinline __rte_hoteth_mbuf_to_sg_fd (struct rte_mbuf *mbuf,struct qbman_fd *fd, -struct rte_mempool *mp,uint16_t bpid) +uint16_t bpid) {struct rte_mbuf *cur_seg = mbuf, *prev_seg, *mi, *temp;struct qbman_sge *sgt, *sge =NULL ;@@ -433,12 +433,12 @@ eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, }DPAA2_SET_FD_OFFSET (fd, offset); }else { - temp =rte_pktmbuf_alloc (mp); + temp =rte_pktmbuf_alloc (dpaa2_tx_sg_pool);if (temp ==NULL ) {DPAA2_PMD_DP_DEBUG ("No memory to allocate S/G table\n" );return -ENOMEM ; } -DPAA2_SET_ONLY_FD_BPID (fd, bpid); +DPAA2_SET_ONLY_FD_BPID (fd,mempool_to_bpid (dpaa2_tx_sg_pool));DPAA2_SET_FD_OFFSET (fd, temp->data_off);#ifdef RTE_LIBRTE_MEMPOOL_DEBUG rte_mempool_check_cookies(rte_mempool_from_obj((void *)temp),@@ -1321,9 +1321,10 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)if (unlikely (RTE_MBUF_HAS_EXTBUF (*bufs))) {if (unlikely ((*bufs)->nb_segs >1 )) { + mp = (*bufs)->pool;if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp,0 )) +mempool_to_bpid (mp))) goto send_n_return; }else { eth_mbuf_to_fd(*bufs,@@ -1372,7 +1373,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) + bpid)) goto send_n_return; }else { eth_mbuf_to_fd(*bufs,@@ -1646,7 +1647,6 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue,if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_frames; }else {@@ -1810,7 +1810,6 @@ dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_n_return; }else {
RE: [PATCH 07/15] net/dpaa2: use internal mempool for SG table
Hi
Quoted 11 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, October 5, 2022 7:51 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Subject: Re: [PATCH 07/15] net/dpaa2: use internal mempool for SG tableQuoted 3 lines · Gagandeep Singh
Creating and using driver's mempool for allocating the SG table memory required for FD creation instead of relying on user mempool.
Quoted 7 lines
As far as I can see this is in the Tx path, can you please explain why driver need an internal pktmbuf pool?
And shouldn't mempool needs to be freed on driver close and release.
Same comment applies for dpaa version of the patch (12/15).
In TX path, in case of SG packets, driver need additional SG table memory to store the data of all segments to pass to HW. Earlier it was dependent on the user's pool to allocate memory which is wrong. so allocating the new pool in the driver for this purpose.
We are creating only one pool for all the DPAA net devices on first DPAA net device probe, so it can be free only on last device probe. So will it be worth to free the pool on last device probe as memory will be released on process kill as well?
Quoted 137 lines
Review
Quoted 8 lines
Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/dpaa2/dpaa2_ethdev.c | 14 ++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 9 +++++++++ drivers/net/dpaa2/dpaa2_rxtx.c | 13 ++++++------- 3 files changed, 29 insertions(+), 7 deletions(-)(quoted diff) +0
-0
b/drivers/net/dpaa2/dpaa2_ethdev.cdrivers/net/dpaa2/dpaa2_ethdev.c rte_dpaa2_probe(struct rte_dpaa2_driver
Quoted 13 lines
index
37a8b43114..c7aae70300100644drivers/net/dpaa2/dpaa2_ethdev.c +2
-0@@ -78,6 +78,8 @@ bool dpaa2_enable_err_queue;#define MAX_NB_RX_DESC 11264int total_nb_rx_desc; +struct rte_mempool *dpaa2_tx_sg_pool; +struct rte_dpaa2_xstats_name_off {char name[RTE_ETH_XSTATS_NAME_SIZE ];uint8_t page_id;/* dpni statistics page id */ @@ -2907,6 +2909,18 @@ rte_dpaa2_probe(struct rte_dpaa2_driver
*dpaa2_drv,drivers/net/dpaa2/dpaa2_ethdev.c rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
Quoted 6 lines
drivers/net/dpaa2/dpaa2_ethdev.c +3
-0/* Invoke PMD device initialization function */ diag =dpaa2_dev_init (eth_dev);if (diag ==0 ) { +if (!dpaa2_tx_sg_pool) { + dpaa2_tx_sg_pool = +rte_pktmbuf_pool_create("dpaa2_mbuf_tx_sg_pool",
drivers/net/dpaa2/dpaa2_ethdev.c rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
Quoted 6 lines
drivers/net/dpaa2/dpaa2_ethdev.c +6
-0+DPAA2_POOL_SIZE , +DPAA2_POOL_CACHE_SIZE ,0 , +DPAA2_MAX_SGS *sizeof (struct qbman_sge ), + rte_socket_id()); +if (dpaa2_tx_sg_pool ==NULL ) { + DPAA2_PMD_ERR("SG pool creationfailed\n");
Review
Quoted 7 lines
drivers/net/dpaa2/dpaa2_ethdev.c +3
-0+return -ENOMEM ; + } + }rte_eth_dev_probing_finish (eth_dev);return 0 ; }(quoted diff) +0
-0
b/drivers/net/dpaa2/dpaa2_ethdev.hReview
Quoted 20 lines
index
32ae762e4a..872dced517100644drivers/net/dpaa2/dpaa2_ethdev.h +9
-0@@ -121,6 +121,15 @@#define DPAA2_PKT_TYPE_VLAN_1 0x0160#define DPAA2_PKT_TYPE_VLAN_2 0x0260 +/* Global pool used by driver for SG list TX */ +extern struct rte_mempool *dpaa2_tx_sg_pool; +/* Maximum SG segments */ +#define DPAA2_MAX_SGS 128 +/* SG pool size */ +#define DPAA2_POOL_SIZE 2048 +/* SG pool cache size */ +#define DPAA2_POOL_CACHE_SIZE 256 +/* enable timestamp in mbuf*/ extern bool dpaa2_enable_ts[];extern uint64_t dpaa2_timestamp_rx_dynflag;(quoted diff) +0
-0
b/drivers/net/dpaa2/dpaa2_rxtx.cQuoted 13 lines
index
bc0e49b0d4..dcd86c4056100644drivers/net/dpaa2/dpaa2_rxtx.c +1
-1@@ -403,7 +403,7 @@ eth_fd_to_mbuf(const struct qbman_fd *fd, static int __rte_noinline __rte_hoteth_mbuf_to_sg_fd (struct rte_mbuf *mbuf,struct qbman_fd *fd, -struct rte_mempool *mp,uint16_t bpid) +uint16_t bpid) {struct rte_mbuf *cur_seg = mbuf, *prev_seg, *mi, *temp;struct qbman_sge *sgt, *sge =NULL ;drivers/net/dpaa2/dpaa2_rxtx.c eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, · line 438
Quoted 7 lines
drivers/net/dpaa2/dpaa2_rxtx.c +1
-1@@ -433,12 +433,12 @@ eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, }DPAA2_SET_FD_OFFSET (fd, offset); }else { - temp =rte_pktmbuf_alloc (mp); + temp =rte_pktmbuf_alloc (dpaa2_tx_sg_pool);if (temp ==NULL ) { DPAA2_PMD_DP_DEBUG("No memory to allocateS/G table\n");
drivers/net/dpaa2/dpaa2_rxtx.c eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,
Quoted 4 lines
drivers/net/dpaa2/dpaa2_rxtx.c +1
-1return -ENOMEM ; } -DPAA2_SET_ONLY_FD_BPID (fd, bpid); + DPAA2_SET_ONLY_FD_BPID(fd,
mempool_to_bpid(dpaa2_tx_sg_pool));drivers/net/dpaa2/dpaa2_rxtx.c eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,
Quoted 3 lines
drivers/net/dpaa2/dpaa2_rxtx.c +0
-0DPAA2_SET_FD_OFFSET (fd, temp->data_off);#ifdef RTE_LIBRTE_MEMPOOL_DEBUG rte_mempool_check_cookies(rte_mempool_from_obj((void*)temp),
drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx(void *queue, struct rte_mbuf
Quoted 1 line
drivers/net/dpaa2/dpaa2_rxtx.c +0
-0@@ -1321,9 +1321,10 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf**bufs,
uint16_tnb_pkts)drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
Quoted 8 lines
drivers/net/dpaa2/dpaa2_rxtx.c +2
-1if (unlikely (RTE_MBUF_HAS_EXTBUF (*bufs))) {if (unlikely ((*bufs)->nb_segs >1 )) { + mp = (*bufs)->pool; if (eth_mbuf_to_sg_fd(*bufs, &fd_arr[loop], - mp,0 )) +
mempool_to_bpid(mp)))drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx(void *queue, struct rte_mbuf
Quoted 4 lines
drivers/net/dpaa2/dpaa2_rxtx.c +0
-0goto send_n_return; }else { eth_mbuf_to_fd(*bufs,@@ -1372,7 +1373,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf**bufs,
uint16_tnb_pkts)drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx_ordered(void *queue, struct
Quoted 17 lines
drivers/net/dpaa2/dpaa2_rxtx.c +1
-2if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) + bpid)) goto send_n_return; }else { eth_mbuf_to_fd(*bufs,@@ -1646,7 +1647,6 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue,if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_frames; }else {@@ -1810,7 +1810,6 @@ dpaa2_dev_tx_ordered(void *queue, struct
rte_mbuf**bufs,uint16_tnb_pkts)Quoted 7 lines
drivers/net/dpaa2/dpaa2_rxtx.c +0
-1if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_n_return; }else {
Re: [PATCH 07/15] net/dpaa2: use internal mempool for SG table
Quoted 16 lines · Gagandeep Singh
Hi
Quoted 14 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, October 5, 2022 7:51 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Subject: Re: [PATCH 07/15] net/dpaa2: use internal mempool for SG tableQuoted 3 lines · Gagandeep Singh
Creating and using driver's mempool for allocating the SG table memory required for FD creation instead of relying on user mempool.
As far as I can see this is in the Tx path, can you please explain why driver need an internal pktmbuf pool?
Quoted 9 lines
Quoted 4 lines
And shouldn't mempool needs to be freed on driver close and release.
Same comment applies for dpaa version of the patch (12/15).
In TX path, in case of SG packets, driver need additional SG table memory to store the data of all segments to pass to HW. Earlier it was dependent on the user's pool to allocate memory which is wrong. so allocating the new pool in the driver for this purpose.
Agree to have driver internal mempool for driver internal requirements.
Quoted 4 lines
We are creating only one pool for all the DPAA net devices on first DPAA net device probe, so it can be free only on last device probe. So will it be worth to free the pool on last device probe as memory will be released on process kill as well?
Yes, it will be cleared but it is good discipline to free memory on quit/close.
What do you think to allocate one per-port, and store it in device private data, it makes easy to free it when port closed or released?
Quoted 138 lines
Quoted 137 lines
Review
Quoted 8 lines
Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/dpaa2/dpaa2_ethdev.c | 14 ++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 9 +++++++++ drivers/net/dpaa2/dpaa2_rxtx.c | 13 ++++++------- 3 files changed, 29 insertions(+), 7 deletions(-)(quoted diff) +0
-0
b/drivers/net/dpaa2/dpaa2_ethdev.cdrivers/net/dpaa2/dpaa2_ethdev.c rte_dpaa2_probe(struct rte_dpaa2_driver
Quoted 13 lines
index
37a8b43114..c7aae70300100644drivers/net/dpaa2/dpaa2_ethdev.c +2
-0@@ -78,6 +78,8 @@ bool dpaa2_enable_err_queue;#define MAX_NB_RX_DESC 11264int total_nb_rx_desc; +struct rte_mempool *dpaa2_tx_sg_pool; +struct rte_dpaa2_xstats_name_off {char name[RTE_ETH_XSTATS_NAME_SIZE ];uint8_t page_id;/* dpni statistics page id */ @@ -2907,6 +2909,18 @@ rte_dpaa2_probe(struct rte_dpaa2_driver
*dpaa2_drv,drivers/net/dpaa2/dpaa2_ethdev.c rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
Quoted 6 lines
drivers/net/dpaa2/dpaa2_ethdev.c +3
-0/* Invoke PMD device initialization function */ diag =dpaa2_dev_init (eth_dev);if (diag ==0 ) { +if (!dpaa2_tx_sg_pool) { + dpaa2_tx_sg_pool = +rte_pktmbuf_pool_create("dpaa2_mbuf_tx_sg_pool",
drivers/net/dpaa2/dpaa2_ethdev.c rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
Quoted 6 lines
drivers/net/dpaa2/dpaa2_ethdev.c +6
-0+DPAA2_POOL_SIZE , +DPAA2_POOL_CACHE_SIZE ,0 , +DPAA2_MAX_SGS *sizeof (struct qbman_sge ), + rte_socket_id()); +if (dpaa2_tx_sg_pool ==NULL ) { + DPAA2_PMD_ERR("SG pool creationfailed\n");
Review
Quoted 7 lines
drivers/net/dpaa2/dpaa2_ethdev.c +3
-0+return -ENOMEM ; + } + }rte_eth_dev_probing_finish (eth_dev);return 0 ; }(quoted diff) +0
-0
b/drivers/net/dpaa2/dpaa2_ethdev.hReview
Quoted 20 lines
index
32ae762e4a..872dced517100644drivers/net/dpaa2/dpaa2_ethdev.h +9
-0@@ -121,6 +121,15 @@#define DPAA2_PKT_TYPE_VLAN_1 0x0160#define DPAA2_PKT_TYPE_VLAN_2 0x0260 +/* Global pool used by driver for SG list TX */ +extern struct rte_mempool *dpaa2_tx_sg_pool; +/* Maximum SG segments */ +#define DPAA2_MAX_SGS 128 +/* SG pool size */ +#define DPAA2_POOL_SIZE 2048 +/* SG pool cache size */ +#define DPAA2_POOL_CACHE_SIZE 256 +/* enable timestamp in mbuf*/ extern bool dpaa2_enable_ts[];extern uint64_t dpaa2_timestamp_rx_dynflag;(quoted diff) +0
-0
b/drivers/net/dpaa2/dpaa2_rxtx.cQuoted 13 lines
index
bc0e49b0d4..dcd86c4056100644drivers/net/dpaa2/dpaa2_rxtx.c +1
-1@@ -403,7 +403,7 @@ eth_fd_to_mbuf(const struct qbman_fd *fd, static int __rte_noinline __rte_hoteth_mbuf_to_sg_fd (struct rte_mbuf *mbuf,struct qbman_fd *fd, -struct rte_mempool *mp,uint16_t bpid) +uint16_t bpid) {struct rte_mbuf *cur_seg = mbuf, *prev_seg, *mi, *temp;struct qbman_sge *sgt, *sge =NULL ;drivers/net/dpaa2/dpaa2_rxtx.c eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, · line 438
Quoted 7 lines
drivers/net/dpaa2/dpaa2_rxtx.c +1
-1@@ -433,12 +433,12 @@ eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, }DPAA2_SET_FD_OFFSET (fd, offset); }else { - temp =rte_pktmbuf_alloc (mp); + temp =rte_pktmbuf_alloc (dpaa2_tx_sg_pool);if (temp ==NULL ) { DPAA2_PMD_DP_DEBUG("No memory to allocateS/G table\n");
drivers/net/dpaa2/dpaa2_rxtx.c eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,
Quoted 4 lines
drivers/net/dpaa2/dpaa2_rxtx.c +1
-1return -ENOMEM ; } -DPAA2_SET_ONLY_FD_BPID (fd, bpid); + DPAA2_SET_ONLY_FD_BPID(fd,
mempool_to_bpid(dpaa2_tx_sg_pool));drivers/net/dpaa2/dpaa2_rxtx.c eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,
Quoted 3 lines
drivers/net/dpaa2/dpaa2_rxtx.c +0
-0DPAA2_SET_FD_OFFSET (fd, temp->data_off);#ifdef RTE_LIBRTE_MEMPOOL_DEBUG rte_mempool_check_cookies(rte_mempool_from_obj((void*)temp),
drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx(void *queue, struct rte_mbuf
Quoted 1 line
drivers/net/dpaa2/dpaa2_rxtx.c +0
-0@@ -1321,9 +1321,10 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf**bufs,
uint16_tnb_pkts)drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
Quoted 8 lines
drivers/net/dpaa2/dpaa2_rxtx.c +2
-1if (unlikely (RTE_MBUF_HAS_EXTBUF (*bufs))) {if (unlikely ((*bufs)->nb_segs >1 )) { + mp = (*bufs)->pool; if (eth_mbuf_to_sg_fd(*bufs, &fd_arr[loop], - mp,0 )) +
mempool_to_bpid(mp)))drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx(void *queue, struct rte_mbuf
Quoted 4 lines
drivers/net/dpaa2/dpaa2_rxtx.c +0
-0goto send_n_return; }else { eth_mbuf_to_fd(*bufs,@@ -1372,7 +1373,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf**bufs,
uint16_tnb_pkts)drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx_ordered(void *queue, struct
Quoted 17 lines
drivers/net/dpaa2/dpaa2_rxtx.c +1
-2if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) + bpid)) goto send_n_return; }else { eth_mbuf_to_fd(*bufs,@@ -1646,7 +1647,6 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue,if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_frames; }else {@@ -1810,7 +1810,6 @@ dpaa2_dev_tx_ordered(void *queue, struct
rte_mbuf**bufs,uint16_tnb_pkts)Quoted 7 lines
drivers/net/dpaa2/dpaa2_rxtx.c +0
-1if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_n_return; }else {
RE: [PATCH 07/15] net/dpaa2: use internal mempool for SG table
Quoted 42 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, October 6, 2022 3:08 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Subject: Re: [PATCH 07/15] net/dpaa2: use internal mempool for SG tableQuoted 17 lines · Gagandeep Singh
Hi
Quoted 15 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, October 5, 2022 7:51 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Subject: Re: [PATCH 07/15] net/dpaa2: use internal mempool for SG tableQuoted 3 lines · Gagandeep Singh
Creating and using driver's mempool for allocating the SG table memory required for FD creation instead of relying on user mempool.
As far as I can see this is in the Tx path, can you please explain why driver need an internal pktmbuf pool?
Quoted 8 lines
Quoted 4 lines
And shouldn't mempool needs to be freed on driver close and release.
Same comment applies for dpaa version of the patch (12/15).
In TX path, in case of SG packets, driver need additional SG table memory to store the data of all segments to pass to HW. Earlier it was dependent on the user's pool to allocate memory which is wrong. so
allocating the new pool in the driver for this purpose.
Quoted 1 line
Agree to have driver internal mempool for driver internal requirements.
Quoted 3 lines
We are creating only one pool for all the DPAA net devices on first DPAA net device probe, so it can be free only on last device probe. So will it be worth to free the pool on last device probe as memory will be
Quoted 7 lines
released on process kill as well?
Quoted 1 line
Yes, it will be cleared but it is good discipline to free memory on quit/close. What do you think to allocate one per-port, and store it in device private data, it makes easy to free it when port closed or released?
Yes It will be easy to have per device mempool, But due to limited number of HW pools we cannot allocate as many as eth devices number of pool for internal Uses.
Ok, I will free the pool on last eth device remove in next version.
Quoted 139 lines
Quoted 112 lines
Quoted 112 lines
Review
Quoted 8 lines
Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/dpaa2/dpaa2_ethdev.c | 14 ++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 9 +++++++++ drivers/net/dpaa2/dpaa2_rxtx.c | 13 ++++++------- 3 files changed, 29 insertions(+), 7 deletions(-)(quoted diff) +0
-0
b/drivers/net/dpaa2/dpaa2_ethdev.cdrivers/net/dpaa2/dpaa2_ethdev.c bool dpaa2_enable_err_queue;
Quoted 13 lines
index
37a8b43114..c7aae70300100644drivers/net/dpaa2/dpaa2_ethdev.c +3
-0@@ -78,6 +78,8 @@ bool dpaa2_enable_err_queue;#define MAX_NB_RX_DESC 11264int total_nb_rx_desc; +struct rte_mempool *dpaa2_tx_sg_pool; +struct rte_dpaa2_xstats_name_off {char name[RTE_ETH_XSTATS_NAME_SIZE ]; uint8_t page_id; /* dpni statistics page id */ @@ -2907,6 +2909,18 @@ rte_dpaa2_probe(struct rte_dpaa2_driver
*dpaa2_drv,drivers/net/dpaa2/dpaa2_ethdev.c rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
Quoted 6 lines
/* Invoke PMD device initialization function */ diag = dpaa2_dev_init(eth_dev); if (diag == 0) {drivers/net/dpaa2/dpaa2_ethdev.c +3
-0+if (!dpaa2_tx_sg_pool) { + dpaa2_tx_sg_pool = +rte_pktmbuf_pool_create("dpaa2_mbuf_tx_sg_pool",
drivers/net/dpaa2/dpaa2_ethdev.c rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
Quoted 6 lines
drivers/net/dpaa2/dpaa2_ethdev.c +6
-0+DPAA2_POOL_SIZE , +DPAA2_POOL_CACHE_SIZE ,0 , +DPAA2_MAX_SGS *sizeof (struct qbman_sge ), + rte_socket_id()); +if (dpaa2_tx_sg_pool ==NULL ) { + DPAA2_PMD_ERR("SG pool creationfailed\n");
Review
Quoted 7 lines
drivers/net/dpaa2/dpaa2_ethdev.c +3
-0+return -ENOMEM ; + } + }rte_eth_dev_probing_finish (eth_dev);return 0 ; }(quoted diff) +0
-0
b/drivers/net/dpaa2/dpaa2_ethdev.hQuoted 19 lines
index
32ae762e4a..872dced517100644drivers/net/dpaa2/dpaa2_ethdev.h +9
-0@@ -121,6 +121,15 @@#define DPAA2_PKT_TYPE_VLAN_1 0x0160#define DPAA2_PKT_TYPE_VLAN_2 0x0260 +/* Global pool used by driver for SG list TX */ extern struct +rte_mempool *dpaa2_tx_sg_pool; +/* Maximum SG segments */ +#define DPAA2_MAX_SGS 128 +/* SG pool size */ +#define DPAA2_POOL_SIZE 2048 +/* SG pool cache size */ +#define DPAA2_POOL_CACHE_SIZE 256 +/* enable timestamp in mbuf*/ extern bool dpaa2_enable_ts[]; extern uint64_t dpaa2_timestamp_rx_dynflag; diff --gitQuoted 1 line
a/drivers/net/dpaa2/dpaa2_rxtx.c
b/drivers/net/dpaa2/dpaa2_rxtx.cQuoted 16 lines
index
bc0e49b0d4..dcd86c4056100644drivers/net/dpaa2/dpaa2_rxtx.c +1
-1@@ -403,7 +403,7 @@ eth_fd_to_mbuf(const struct qbman_fd *fd, static int __rte_noinline __rte_hoteth_mbuf_to_sg_fd (struct rte_mbuf *mbuf,struct qbman_fd *fd, -struct rte_mempool *mp,uint16_t bpid) +uint16_t bpid) {struct rte_mbuf *cur_seg = mbuf, *prev_seg, *mi, *temp; struct qbman_sge *sgt, *sge = NULL; @@ -433,12 +433,12 @@eth_mbuf_to_sg_fd(struct
rte_mbuf*mbuf,
}DPAA2_SET_FD_OFFSET(fd, offset); } else {drivers/net/dpaa2/dpaa2_rxtx.c eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,
Quoted 4 lines
drivers/net/dpaa2/dpaa2_rxtx.c +1
-1- temp =rte_pktmbuf_alloc (mp); + temp =rte_pktmbuf_alloc (dpaa2_tx_sg_pool);if (temp ==NULL ) { DPAA2_PMD_DP_DEBUG("No memory to allocateS/G table\n");
drivers/net/dpaa2/dpaa2_rxtx.c
Quoted 4 lines
return -ENOMEM; }drivers/net/dpaa2/dpaa2_rxtx.c +1
-1-DPAA2_SET_ONLY_FD_BPID (fd, bpid); + DPAA2_SET_ONLY_FD_BPID(fd,
mempool_to_bpid(dpaa2_tx_sg_pool));Quoted 3 lines
DPAA2_SET_FD_OFFSET(fd, temp->data_off); #ifdef RTE_LIBRTE_MEMPOOL_DEBUG rte_mempool_check_cookies(rte_mempool_from_obj((void*)temp),
drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx(void *queue, struct rte_mbuf
Quoted 1 line
drivers/net/dpaa2/dpaa2_rxtx.c +0
-0@@ -1321,9 +1321,10 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf**bufs,
uint16_tnb_pkts)drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
Quoted 8 lines
drivers/net/dpaa2/dpaa2_rxtx.c +2
-1if (unlikely (RTE_MBUF_HAS_EXTBUF (*bufs))) {if (unlikely ((*bufs)->nb_segs >1 )) { + mp = (*bufs)->pool; if (eth_mbuf_to_sg_fd(*bufs, &fd_arr[loop], - mp,0 )) +
mempool_to_bpid(mp)))drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx(void *queue, struct rte_mbuf
Quoted 4 lines
drivers/net/dpaa2/dpaa2_rxtx.c +0
-0goto send_n_return; }else { eth_mbuf_to_fd(*bufs,@@ -1372,7 +1373,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf**bufs,
uint16_tnb_pkts)Quoted 9 lines
Quoted 9 lines
drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx_multi_txq_ordered(void
Quoted 9 lines
drivers/net/dpaa2/dpaa2_rxtx.c +1
-1if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) + bpid)) goto send_n_return; }else { eth_mbuf_to_fd(*bufs,@@ -1646,7 +1647,6 @@ dpaa2_dev_tx_multi_txq_ordered(void**queue,
Quoted 17 lines
Quoted 16 lines
drivers/net/dpaa2/dpaa2_rxtx.c dpaa2_dev_tx_ordered(void *queue, struct
Quoted 8 lines
drivers/net/dpaa2/dpaa2_rxtx.c +0
-1if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_frames; }else {@@ -1810,7 +1810,6 @@ dpaa2_dev_tx_ordered(void *queue, struct
rte_mbuf**bufs,uint16_tnb_pkts)Quoted 7 lines
drivers/net/dpaa2/dpaa2_rxtx.c +0
-1if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_n_return; }else {
PATCH 8/15 net/dpaa2: fix buffer free on transmit SG packets
In reply to Gagandeep SinghWhen using SG list to TX with external and direct buffers, HW free the direct buffers and driver free the external buffers.
Software scans the complete SG mbuf list to find the external buffers to free, but this is wrong as hardware can free the direct buffers if any present in the list and same can be re-allocated for other purpose in multi thread or high spead running traffic environment with new data in it. So the software which is scanning the SG mbuf list, if that list has any direct buffer present then that direct buffer's next pointor can give wrong pointer value, if already freed by hardware which can do the mempool corruption or memory leak.
In this patch instead of relying on user given SG mbuf list we are storing the buffers in an internal list which will be scanned by driver after transmit to free non-direct buffers.
This patch also fixes 2 more memory leak issues.
Driver is freeing complete SG list by checking external buffer flag in first segment only, but external buffer can be attached to any of the segment. Because of which driver either can double free buffers or there can be memory leak.
In case of indirect buffers, driver is modifying the original buffer list to free the indirect buffers but this orginal buffer list is being used even after transmit packets for software buffer cleanup. This can cause the buffer leak issue.
--- drivers/net/dpaa2/dpaa2_ethdev.h | 9 +++ drivers/net/dpaa2/dpaa2_rxtx.c | 111 +++++++++++++++++++++++-------- 2 files changed, 92 insertions(+), 28 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.h +9 -0
@@ -129,6 +129,15 @@ extern struct rte_mempool *dpaa2_tx_sg_pool;#define DPAA2_POOL_SIZE 2048/* SG pool cache size */ #define DPAA2_POOL_CACHE_SIZE 256 +/* structure to free external and indirect +* buffers. +*/ +struct sw_buf_free { +/* To which packet this segment belongs */ +uint16_t pkt_id; +/* The actual segment */ +struct rte_mbuf *seg; +};/* enable timestamp in mbuf*/ extern bool dpaa2_enable_ts[];
drivers/net/dpaa2/dpaa2_rxtx.c +83 -28
249 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH 08/15] net/dpaa2: fix buffer free on transmit SG packets
Quoted 7 lines · Gagandeep Singh
When using SG list to TX with external and direct buffers, HW free the direct buffers and driver free the external buffers.
Software scans the complete SG mbuf list to find the external buffers to free, but this is wrong as hardware can free the direct buffers if any present in the list and same can be re-allocated for other purpose in multi thread or high spead
s/spead/speed/
Quoted 3 lines
running traffic environment with new data in it. So the software which is scanning the SG mbuf list, if that list has any direct buffer present then that direct buffer's next pointor can give
s/pointor/pointer/
Quoted 10 lines
wrong pointer value, if already freed by hardware which can do the mempool corruption or memory leak.
In this patch instead of relying on user given SG mbuf list we are storing the buffers in an internal list which will be scanned by driver after transmit to free non-direct buffers.
This patch also fixes 2 more memory leak issues.
Quoted 7 lines
Driver is freeing complete SG list by checking external buffer flag in first segment only, but external buffer can be attached to any of the segment. Because of which driver either can double free buffers or there can be memory leak.
In case of indirect buffers, driver is modifying the original buffer list to free the indirect buffers but this orginal buffer
s/orginal/original/
same fixes needed for dpaa version of this patch, 14/15.
Quoted 7 lines
list is being used even after transmit packets for software buffer cleanup. This can cause the buffer leak issue.
Fixes 6bfbafe18d15 ("net/dpaa2: support external buffers in Tx")Signed-off-by Gagandeep Singh <[email protected]>
<...>
PATCH 9/15 bus/fslmc: add timeout in MC send command API
In reply to Gagandeep SinghFrom: Rohit Raj <[email protected]>
Adding one second timeout in MC send command API to ensure it doesn't gets stuck in case of failure.
--- drivers/bus/fslmc/mc/mc_sys.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/bus/fslmc/mc/mc_sys.c +12 -6
@@ -1,13 +1,14 @@/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2013-2015 Freescale Semiconductor Inc. -* Copyright 2017 NXP +* Copyright 2017,2022 NXP * */ #include <fsl_mc_sys.h> #include <fsl_mc_cmd.h> #include <rte_spinlock.h> +#include <rte_cycles.h> /** User space framework uses MC Portal in shared mode. Following change * introduces lock in MC FLIB
@@ -54,7 +55,7 @@ static int mc_status_to_error(enum mc_cmd_status status)int mc_send_command (struct fsl_mc_io *mc_io,struct mc_command *cmd) {enum mc_cmd_status status; -uint64_t response; +uint64_t response, start_time, total_time, time_to_wait;if (!mc_io || !mc_io->regs)return -EACCES ;
@@ -64,15 +65,20 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd)mc_write_command (mc_io->regs, cmd); +/* Wait for one second. rte_get_timer_hz() returns frequency of CPU */ + time_to_wait =rte_get_timer_hz (); + total_time =0 ; + start_time =rte_get_timer_cycles (); +/* Spin until status changes */ do { response =ioread64 (mc_io->regs); status =mc_cmd_read_status ((struct mc_command *)&response); + total_time =rte_get_timer_cycles () - start_time; + }while (status ==MC_CMD_STATUS_READY && total_time <= time_to_wait); -/* --- Call wait function here to prevent blocking --- -* Change the loop condition accordingly to exit on timeout. -*/ - }while (status ==MC_CMD_STATUS_READY ); +if (status ==MC_CMD_STATUS_READY ) +return mc_status_to_error (MC_CMD_STATUS_TIMEOUT );/* Read the response back into the command buffer */ mc_read_response (mc_io->regs, cmd);
Signature · 1 line
2.25.1
PATCH 10/15 net/dpaa: fix Jumbo packet Rx in case of VSP
In reply to Gagandeep SinghFrom: Rohit Raj <[email protected]>
For packet length of size more than 2K bytes, segmented packets were being received in DPDK even if mbuf size was greater than packet length. This is due to the configuration in VSP.
This patch fixes the issue by configurating the VSP according to the mbuf size configured during mempool configuration.
--- drivers/net/dpaa/dpaa_ethdev.c | 5 ++--- drivers/net/dpaa/dpaa_flow.c | 13 ++++++------- drivers/net/dpaa/dpaa_flow.h | 5 +++-- 3 files changed, 11 insertions(+), 12 deletions(-)
drivers/net/dpaa/dpaa_ethdev.c +2 -3
@@ -988,8 +988,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, }else {DPAA_PMD_WARN ("The requested maximum Rx packet size (%u) is" " larger than a single mbuf (%u) and scattered" -" mode has not been requested" , - max_rx_pktlen, buffsz -RTE_PKTMBUF_HEADROOM ); +" mode has not been requested" , max_rx_pktlen, buffsz); } dpaa_intf->bp_info =DPAA_MEMPOOL_TO_POOL_INFO (mp);
@@ -1004,7 +1003,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,if (vsp_id >=0 ) { ret =dpaa_port_vsp_update (dpaa_intf, fmc_q, vsp_id,DPAA_MEMPOOL_TO_POOL_INFO (mp)->bpid, - fif); + fif, buffsz +RTE_PKTMBUF_HEADROOM );if (ret) {DPAA_PMD_ERR ("dpaa_port_vsp_update failed" );return ret;
drivers/net/dpaa/dpaa_flow.c +6 -7
@@ -939,7 +939,7 @@ int dpaa_fm_term(void)static int dpaa_port_vsp_configure (struct dpaa_if *dpaa_intf,uint8_t vsp_id,t_handle fman_handle, -struct fman_if *fif) +struct fman_if *fif,u32 mbuf_data_room_size) {t_fm_vsp_params vsp_params;t_fm_buffer_prefix_content buf_prefix_cont;
@@ -976,10 +976,8 @@ static int dpaa_port_vsp_configure(struct dpaa_if *dpaa_intf,return -1 ; } vsp_params.ext_buf_pools.num_of_pools_used =1 ; - vsp_params.ext_buf_pools.ext_buf_pool[0 ].id = - dpaa_intf->vsp_bpid[vsp_id]; - vsp_params.ext_buf_pools.ext_buf_pool[0 ].size = -RTE_MBUF_DEFAULT_BUF_SIZE ; + vsp_params.ext_buf_pools.ext_buf_pool[0 ].id = dpaa_intf->vsp_bpid[vsp_id]; + vsp_params.ext_buf_pools.ext_buf_pool[0 ].size = mbuf_data_room_size; dpaa_intf->vsp_handle[vsp_id] =fm_vsp_config (&vsp_params);if (!dpaa_intf->vsp_handle[vsp_id]) {
@@ -1023,7 +1021,7 @@ static int dpaa_port_vsp_configure(struct dpaa_if *dpaa_intf,int dpaa_port_vsp_update (struct dpaa_if *dpaa_intf,bool fmc_mode,uint8_t vsp_id,uint32_t bpid, -struct fman_if *fif) +struct fman_if *fif,u32 mbuf_data_room_size) {int ret =0 ;t_handle fman_handle;
@@ -1054,7 +1052,8 @@ int dpaa_port_vsp_update(struct dpaa_if *dpaa_intf, dpaa_intf->vsp_bpid[vsp_id] = bpid; -return dpaa_port_vsp_configure (dpaa_intf, vsp_id, fman_handle, fif); +return dpaa_port_vsp_configure (dpaa_intf, vsp_id, fman_handle, fif, + mbuf_data_room_size); }int dpaa_port_vsp_cleanup (struct dpaa_if *dpaa_intf,struct fman_if *fif)
drivers/net/dpaa/dpaa_flow.h +3 -2
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2017,2019 NXP +* Copyright 2017,2019,2022 NXP */ #ifndef __DPAA_FLOW_H__
@@ -11,7 +11,8 @@ int dpaa_fm_config(struct rte_eth_dev *dev, uint64_t req_dist_set);int dpaa_fm_deconfig (struct dpaa_if *dpaa_intf,struct fman_if *fif);void dpaa_write_fm_config_to_file (void );int dpaa_port_vsp_update (struct dpaa_if *dpaa_intf, -bool fmc_mode,uint8_t vsp_id,uint32_t bpid,struct fman_if *fif); +bool fmc_mode,uint8_t vsp_id,uint32_t bpid,struct fman_if *fif, +u32 mbuf_data_room_size);int dpaa_port_vsp_cleanup (struct dpaa_if *dpaa_intf,struct fman_if *fif);int dpaa_port_fmc_init (struct fman_if *fif,uint32_t *fqids,int8_t *vspids,int max_nb_rxq);
Signature · 1 line
2.25.1
PATCH 11/15 bus/dpaa: pass interface name as a string instead of pointer
In reply to Gagandeep SinghFrom: Rohit Raj <[email protected]>
Due to change in latest kernel, passing the interface name to kernel through IOCTL as string instead of character pointer.
--- drivers/bus/dpaa/base/qbman/process.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/bus/dpaa/base/qbman/process.c +4 -4
@@ -302,7 +302,7 @@ int bman_free_raw_portal(struct dpaa_raw_portal *portal) _IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)#define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \ - _IOW(DPAA_IOCTL_MAGIC, 0x0F, char*) + _IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])int dpaa_intr_enable (char *if_name,int efd) {
@@ -330,7 +330,7 @@ int dpaa_intr_disable(char *if_name)if (ret)return ret; - ret =ioctl (fd,DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT , &if_name); + ret =ioctl (fd,DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT , if_name);if (ret) {if (errno ==EINVAL )printf ("Failed to disable interrupt: Not Supported\n" );
@@ -472,7 +472,7 @@ int dpaa_update_link_speed(char *if_name, int link_speed, int link_duplex) }#define DPAA_IOCTL_RESTART_LINK_AUTONEG \ - _IOW(DPAA_IOCTL_MAGIC, 0x13, char *) + _IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])int dpaa_restart_link_autoneg (char *if_name) {
@@ -481,7 +481,7 @@ int dpaa_restart_link_autoneg(char *if_name)if (ret)return ret; - ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , &if_name); + ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , if_name);if (ret) {if (errno ==EINVAL )printf ("Failed to restart autoneg: Not Supported\n" );
Signature · 1 line
2.25.1
Re: [PATCH 11/15] bus/dpaa: pass interface name as a string instead of pointer
Quoted 5 lines · Gagandeep Singh
From: Rohit Raj <[email protected]>
Due to change in latest kernel, passing the interface name to kernel through IOCTL as string instead of character pointer.
This kernel component is the one that is delivered part of SDK I assume, instead of an upstreamed one.
What is the way for user match kernel code and DPDK driver, like is there any matching version information documented?
Quoted 45 lines
Signed-off-by Rohit Raj <[email protected]>--- drivers/bus/dpaa/base/qbman/process.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/bus/dpaa/base/qbman/process.c +4
-4@@ -302,7 +302,7 @@ int bman_free_raw_portal(struct dpaa_raw_portal *portal) _IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)#define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \ - _IOW(DPAA_IOCTL_MAGIC, 0x0F, char*) + _IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])int dpaa_intr_enable (char *if_name,int efd) {@@ -330,7 +330,7 @@ int dpaa_intr_disable(char *if_name)if (ret)return ret; - ret =ioctl (fd,DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT , &if_name); + ret =ioctl (fd,DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT , if_name);if (ret) {if (errno ==EINVAL )printf ("Failed to disable interrupt: Not Supported\n" );@@ -472,7 +472,7 @@ int dpaa_update_link_speed(char *if_name, int link_speed, int link_duplex) }#define DPAA_IOCTL_RESTART_LINK_AUTONEG \ - _IOW(DPAA_IOCTL_MAGIC, 0x13, char *) + _IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])int dpaa_restart_link_autoneg (char *if_name) {@@ -481,7 +481,7 @@ int dpaa_restart_link_autoneg(char *if_name)if (ret)return ret; - ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , &if_name); + ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , if_name);if (ret) {if (errno ==EINVAL )printf ("Failed to restart autoneg: Not Supported\n" );
RE: [PATCH 11/15] bus/dpaa: pass interface name as a string instead of pointer
Quoted 17 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, October 5, 2022 7:52 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Cc: Rohit Raj <[email protected]>
Subject: Re: [PATCH 11/15] bus/dpaa: pass interface name as a string instead of pointerQuoted 5 lines · Gagandeep Singh
From: Rohit Raj <[email protected]>
Due to change in latest kernel, passing the interface name to kernel through IOCTL as string instead of character pointer.
Quoted 6 lines
This kernel component is the one that is delivered part of SDK I assume, instead of an upstreamed one.
What is the way for user match kernel code and DPDK driver, like is there any matching version information documented?
We share the version compatible information in our internal SDK release document.
Quoted 51 lines
drivers/bus/dpaa/base/qbman/process.c int bman_free_raw_portal(struct dpaa_raw_portal
Quoted 11 lines
Signed-off-by Rohit Raj <[email protected]>--- drivers/bus/dpaa/base/qbman/process.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/bus/dpaa/base/qbman/process.c +0
-0@@ -302,7 +302,7 @@ int bman_free_raw_portal(struct dpaa_raw_portal*portal)
drivers/bus/dpaa/base/qbman/process.c int dpaa_intr_disable(char *if_name) · line 333
Quoted 13 lines
drivers/bus/dpaa/base/qbman/process.c +1
-2_IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)#define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \ - _IOW(DPAA_IOCTL_MAGIC, 0x0F, char*) + _IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])int dpaa_intr_enable (char *if_name,int efd) {@@ -330,7 +330,7 @@ int dpaa_intr_disable(char *if_name)if (ret)return ret; - ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
&if_name);drivers/bus/dpaa/base/qbman/process.c int dpaa_intr_disable(char *if_name) · line 333
Quoted 1 line
drivers/bus/dpaa/base/qbman/process.c +1
-0+ ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
if_name);drivers/bus/dpaa/base/qbman/process.c int dpaa_intr_disable(char *if_name) · line 336
Quoted 3 lines
drivers/bus/dpaa/base/qbman/process.c +0
-0if (ret) {if (errno ==EINVAL )printf ("Failed to disable interrupt: Not Supported\n" );@@ -472,7
Quoted 1 line
+472,7 @@ int dpaa_update_link_speed(char
*if_name, intlink_speed, int
link_duplex)Quoted 17 lines
} #define DPAA_IOCTL_RESTART_LINK_AUTONEG \drivers/bus/dpaa/base/qbman/process.c +2
-2- _IOW(DPAA_IOCTL_MAGIC, 0x13, char *) + _IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])int dpaa_restart_link_autoneg (char *if_name) {@@ -481,7 +481,7 @@ int dpaa_restart_link_autoneg(char *if_name)if (ret)return ret; - ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , &if_name); + ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , if_name);if (ret) {if (errno ==EINVAL )printf ("Failed to restart autoneg: Not Supported\n" );
Re: [PATCH 11/15] bus/dpaa: pass interface name as a string instead of pointer
Quoted 17 lines · Gagandeep Singh
Quoted 17 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, October 5, 2022 7:52 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Cc: Rohit Raj <[email protected]>
Subject: Re: [PATCH 11/15] bus/dpaa: pass interface name as a string instead of pointerQuoted 5 lines · Gagandeep Singh
From: Rohit Raj <[email protected]>
Due to change in latest kernel, passing the interface name to kernel through IOCTL as string instead of character pointer.
Quoted 8 lines
Quoted 6 lines
This kernel component is the one that is delivered part of SDK I assume, instead of an upstreamed one.
What is the way for user match kernel code and DPDK driver, like is there any matching version information documented?
We share the version compatible information in our internal SDK release document.
That is what I thought, does it make sense to link to that information from DPDK documentation?
Quoted 52 lines
Quoted 51 lines
drivers/bus/dpaa/base/qbman/process.c int bman_free_raw_portal(struct dpaa_raw_portal
Quoted 11 lines
Signed-off-by Rohit Raj <[email protected]>--- drivers/bus/dpaa/base/qbman/process.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/bus/dpaa/base/qbman/process.c +0
-0@@ -302,7 +302,7 @@ int bman_free_raw_portal(struct dpaa_raw_portal*portal)
drivers/bus/dpaa/base/qbman/process.c int dpaa_intr_disable(char *if_name) · line 333
Quoted 13 lines
drivers/bus/dpaa/base/qbman/process.c +1
-2_IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)#define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \ - _IOW(DPAA_IOCTL_MAGIC, 0x0F, char*) + _IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])int dpaa_intr_enable (char *if_name,int efd) {@@ -330,7 +330,7 @@ int dpaa_intr_disable(char *if_name)if (ret)return ret; - ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
&if_name);drivers/bus/dpaa/base/qbman/process.c int dpaa_intr_disable(char *if_name) · line 333
Quoted 1 line
drivers/bus/dpaa/base/qbman/process.c +1
-0+ ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
if_name);drivers/bus/dpaa/base/qbman/process.c int dpaa_intr_disable(char *if_name) · line 336
Quoted 3 lines
drivers/bus/dpaa/base/qbman/process.c +0
-0if (ret) {if (errno ==EINVAL )printf ("Failed to disable interrupt: Not Supported\n" );@@ -472,7
Quoted 1 line
+472,7 @@ int dpaa_update_link_speed(char
*if_name, intlink_speed, int
link_duplex)Quoted 17 lines
} #define DPAA_IOCTL_RESTART_LINK_AUTONEG \drivers/bus/dpaa/base/qbman/process.c +2
-2- _IOW(DPAA_IOCTL_MAGIC, 0x13, char *) + _IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])int dpaa_restart_link_autoneg (char *if_name) {@@ -481,7 +481,7 @@ int dpaa_restart_link_autoneg(char *if_name)if (ret)return ret; - ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , &if_name); + ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , if_name);if (ret) {if (errno ==EINVAL )printf ("Failed to restart autoneg: Not Supported\n" );
RE: [PATCH 11/15] bus/dpaa: pass interface name as a string instead of pointer
Quoted 34 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, October 6, 2022 3:10 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Cc: Rohit Raj <[email protected]>
Subject: Re: [PATCH 11/15] bus/dpaa: pass interface name as a string instead of pointerQuoted 23 lines · Gagandeep Singh
Quoted 23 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, October 5, 2022 7:52 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Cc: Rohit Raj <[email protected]>
Subject: Re: [PATCH 11/15] bus/dpaa: pass interface name as a string instead of pointerQuoted 5 lines · Gagandeep Singh
From: Rohit Raj <[email protected]>
Due to change in latest kernel, passing the interface name to kernel through IOCTL as string instead of character pointer.
This kernel component is the one that is delivered part of SDK I assume, instead of an upstreamed one.
What is the way for user match kernel code and DPDK driver, like is there any matching version information documented?
Quoted 7 lines
Quoted 1 line
We share the version compatible information in our internal SDK release
document.
Quoted 1 line
That is what I thought, does it make sense to link to that information from DPDK documentation?
Sure, I will update the DPAA NIC guide for this.
Quoted 54 lines
Quoted 11 lines
Quoted 11 lines
drivers/bus/dpaa/base/qbman/process.c int bman_free_raw_portal(struct
Quoted 11 lines
Signed-off-by Rohit Raj <[email protected]>--- drivers/bus/dpaa/base/qbman/process.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/bus/dpaa/base/qbman/process.c +0
-0@@ -302,7 +302,7 @@ int bman_free_raw_portal(struct
dpaa_raw_portalQuoted 42 lines
Quoted 41 lines
*portal)
drivers/bus/dpaa/base/qbman/process.c int dpaa_intr_disable(char *if_name) · line 333
Quoted 13 lines
drivers/bus/dpaa/base/qbman/process.c +1
-2_IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)#define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \ - _IOW(DPAA_IOCTL_MAGIC, 0x0F, char*) + _IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])int dpaa_intr_enable (char *if_name,int efd) {@@ -330,7 +330,7 @@ int dpaa_intr_disable(char *if_name)if (ret)return ret; - ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
&if_name);drivers/bus/dpaa/base/qbman/process.c int dpaa_intr_disable(char *if_name) · line 333
Quoted 1 line
drivers/bus/dpaa/base/qbman/process.c +1
-0+ ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
if_name);drivers/bus/dpaa/base/qbman/process.c int dpaa_intr_disable(char *if_name) · line 336
Quoted 3 lines
drivers/bus/dpaa/base/qbman/process.c +0
-0if (ret) {if (errno ==EINVAL )printf ("Failed to disable interrupt: Not Supported\n" );@@ -472,7
Quoted 2 lines
+472,7 @@ int dpaa_update_link_speed(char
*if_name, intlink_speed, +int
link_duplex)Quoted 17 lines
} #define DPAA_IOCTL_RESTART_LINK_AUTONEG \drivers/bus/dpaa/base/qbman/process.c +2
-2- _IOW(DPAA_IOCTL_MAGIC, 0x13, char *) + _IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])int dpaa_restart_link_autoneg (char *if_name) {@@ -481,7 +481,7 @@ int dpaa_restart_link_autoneg(char *if_name)if (ret)return ret; - ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , &if_name); + ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , if_name);if (ret) {if (errno ==EINVAL )printf ("Failed to restart autoneg: Not Supported\n" );
PATCH 12/15 net/dpaa: use internal mempool for SG table
In reply to Gagandeep SinghCreating and using driver's mempool for
allocating the SG table memory required for
FD creation.
--- drivers/net/dpaa/dpaa_ethdev.c | 13 +++++++++++++ drivers/net/dpaa/dpaa_ethdev.h | 9 +++++++++ drivers/net/dpaa/dpaa_rxtx.c | 9 ++++----- 3 files changed, 26 insertions(+), 5 deletions(-)
drivers/net/dpaa/dpaa_ethdev.c +13 -0
@@ -133,6 +133,7 @@ static const struct rte_dpaa_xstats_name_off dpaa_xstats_strings[] = { };static struct rte_dpaa_driver rte_dpaa_pmd; +struct rte_mempool *dpaa_tx_sg_pool;static int dpaa_eth_dev_info (struct rte_eth_dev *dev,struct rte_eth_dev_info *dev_info);
@@ -2222,6 +2223,18 @@ rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv,/* Invoke PMD device initialization function */ diag =dpaa_dev_init (eth_dev);if (diag ==0 ) { +if (!dpaa_tx_sg_pool) { + dpaa_tx_sg_pool = +rte_pktmbuf_pool_create ("dpaa_mbuf_tx_sg_pool" , +DPAA_POOL_SIZE , +DPAA_POOL_CACHE_SIZE ,0 , +DPAA_MAX_SGS *sizeof (struct qm_sg_entry ), +rte_socket_id ()); +if (dpaa_tx_sg_pool ==NULL ) { +DPAA_PMD_ERR ("SG pool creation failed\n" ); +return -ENOMEM ; + } + }rte_eth_dev_probing_finish (eth_dev);return 0 ; }
drivers/net/dpaa/dpaa_ethdev.h +9 -0
@@ -33,6 +33,13 @@#define DPAA_SGT_MAX_ENTRIES 16/* maximum number of entries in SG Table */ +/* Maximum SG segments supported on all cores*/ +#define DPAA_MAX_SGS 128 +/* SG pool size */ +#define DPAA_POOL_SIZE 2048 +/* SG pool cache size */ +#define DPAA_POOL_CACHE_SIZE 256 +/* RX queue tail drop threshold (CGR Based) in frame count */ #define CGR_RX_PERFQ_THRESH 256#define CGR_TX_CGR_THRESH 512
@@ -103,6 +110,8 @@#define FMC_FILE "/tmp/fmc.bin" +extern struct rte_mempool *dpaa_tx_sg_pool; +/* Each network interface is represented by one of these */ struct dpaa_if {int valid;
drivers/net/dpaa/dpaa_rxtx.c +4 -5
@@ -803,8 +803,7 @@ uint16_t dpaa_eth_queue_rx(void *q,static int dpaa_eth_mbuf_to_sg_fd (struct rte_mbuf *mbuf, -struct qm_fd *fd, -struct dpaa_bp_info *bp_info) +struct qm_fd *fd) {struct rte_mbuf *cur_seg = mbuf, *prev_seg =NULL ;struct rte_mbuf *temp, *mi;
@@ -813,7 +812,7 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,DPAA_DP_LOG (DEBUG ,"Creating SG FD to transmit" ); - temp =rte_pktmbuf_alloc (bp_info->mp); + temp =rte_pktmbuf_alloc (dpaa_tx_sg_pool);if (!temp) {DPAA_PMD_ERR ("Failure in allocation of mbuf" );return -1 ;
@@ -849,7 +848,7 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, fd->format =QM_FD_SG ; fd->addr = temp->buf_iova; fd->offset = temp->data_off; - fd->bpid = bp_info ? bp_info->bpid :0xff ; + fd->bpid =DPAA_MEMPOOL_TO_BPID (dpaa_tx_sg_pool); fd->length20 = mbuf->pkt_len;while (i <DPAA_SGT_MAX_ENTRIES ) {
@@ -967,7 +966,7 @@ tx_on_dpaa_pool(struct rte_mbuf *mbuf,tx_on_dpaa_pool_unsegmented (mbuf, bp_info, fd_arr); }else if (mbuf->nb_segs >1 && mbuf->nb_segs <=DPAA_SGT_MAX_ENTRIES ) { -if (dpaa_eth_mbuf_to_sg_fd (mbuf, fd_arr, bp_info)) { +if (dpaa_eth_mbuf_to_sg_fd (mbuf, fd_arr)) {DPAA_PMD_DEBUG ("Unable to create Scatter Gather FD" );return 1 ; }
Signature · 1 line
2.25.1
PATCH 13/15 bus/dpaa: mempool ops registration change
In reply to Gagandeep Singhmoving the mempool ops registration before DPAA
devices probe so that device probe functions can
also be able to use mempool operations.
--- drivers/bus/dpaa/dpaa_bus.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/bus/dpaa/dpaa_bus.c +5 -5
@@ -655,6 +655,11 @@ rte_dpaa_bus_probe(void)if (TAILQ_EMPTY (&rte_dpaa_bus.device_list))return 0 ; +/* Register DPAA mempool ops only if any DPAA device has +* been detected. +*/ +rte_mbuf_set_platform_mempool_ops (DPAA_MEMPOOL_OPS_NAME ); + svr_file =fopen (DPAA_SOC_ID_FILE ,"r" );if (svr_file) {if (fscanf (svr_file,"svr:%x" , &svr_ver) >0 )
@@ -704,11 +709,6 @@ rte_dpaa_bus_probe(void) } } -/* Register DPAA mempool ops only if any DPAA device has -* been detected. -*/ -rte_mbuf_set_platform_mempool_ops (DPAA_MEMPOOL_OPS_NAME ); -return 0 ; }
Signature · 1 line
2.25.1
PATCH 14/15 net/dpaa: fix buffer free on transmit SG packets
In reply to Gagandeep SinghWhen using SG list to TX with external and direct buffers, HW free direct buffers and driver free external buffers.
Software scans the complete SG mbuf list to find the external buffers to free, but this is wrong as hardware can free the direct buffers if any present in the list and same can be re-allocated for other purpose in multi thread or high spead running traffic environment with new data in it. So the software which is scanning the SG mbuf list, if that list has any direct buffer present then that direct buffer's next pointor can give wrong pointer value, if already freed by hardware which can do the mempool corruption or memory leak.
In this patch instead of relying on user given SG mbuf list we are storing the buffers in an internal list which will be scanned by driver after transmit to free non-direct buffers.
This patch also fixes below issues.
Driver is freeing complete SG list by checking external buffer flag in first segment only, but external buffer can be attached to any of the segment. Because of this, driver either can double free buffers or there can be memory leak.
In case of indirect buffers, driver is modifying the original buffer list to free the indirect buffers but this orginal buffer list is being used by driver even after transmit packets for non-direct buffer cleanup. This can cause the buffer leak issue.
--- drivers/net/dpaa/dpaa_ethdev.h | 10 ++++++ drivers/net/dpaa/dpaa_rxtx.c | 61 ++++++++++++++++++++++------------ 2 files changed, 49 insertions(+), 22 deletions(-)
drivers/net/dpaa/dpaa_ethdev.h +10 -0
@@ -112,6 +112,16 @@extern struct rte_mempool *dpaa_tx_sg_pool; +/* structure to free external and indirect +* buffers. +*/ +struct dpaa_sw_buf_free { +/* To which packet this segment belongs */ +uint16_t pkt_id; +/* The actual segment */ +struct rte_mbuf *seg; +}; +/* Each network interface is represented by one of these */ struct dpaa_if {int valid;
drivers/net/dpaa/dpaa_rxtx.c +39 -22
132 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 15/15 net/dpaa: fix buffer free in slow path
In reply to Gagandeep SinghAdding a check in slow path to free those buffers
which are not external.
--- drivers/net/dpaa/dpaa_rxtx.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
drivers/net/dpaa/dpaa_rxtx.c +8 -15
@@ -455,7 +455,7 @@ dpaa_free_mbuf(const struct qm_fd *fd) bp_info =DPAA_BPID_TO_POOL_INFO (fd->bpid); format = (fd->opaque &DPAA_FD_FORMAT_MASK ) >>DPAA_FD_FORMAT_SHIFT ;if (unlikely (format == qm_fd_sg)) { -struct rte_mbuf *first_seg, *prev_seg, *cur_seg, *temp; +struct rte_mbuf *first_seg, *cur_seg;struct qm_sg_entry *sgt, *sg_temp;void *vaddr, *sg_vaddr;int i =0 ;
@@ -469,32 +469,25 @@ dpaa_free_mbuf(const struct qm_fd *fd) sgt = vaddr + fd_offset; sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - temp = (struct rte_mbuf *) - ((char *)vaddr - bp_info->meta_data_size); sg_vaddr =DPAA_MEMPOOL_PTOV (bp_info,qm_sg_entry_get64 (sg_temp)); - first_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); first_seg->nb_segs =1 ; - prev_seg = first_seg;while (i <DPAA_SGT_MAX_ENTRIES ) { sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - sg_vaddr =DPAA_MEMPOOL_PTOV (bp_info, +if (sg_temp->bpid !=0xFF ) { + bp_info =DPAA_BPID_TO_POOL_INFO (sg_temp->bpid); + sg_vaddr =DPAA_MEMPOOL_PTOV (bp_info,qm_sg_entry_get64 (sg_temp)); - cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - + cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); - first_seg->nb_segs +=1 ; - prev_seg->next = cur_seg; -if (sg_temp->final) { - cur_seg->next =NULL ; -break ; +rte_pktmbuf_free_seg (cur_seg); } - prev_seg = cur_seg; +if (sg_temp->final) +break ; } - -rte_pktmbuf_free_seg (temp);rte_pktmbuf_free_seg (first_seg);return 0 ; }
Signature · 1 line
2.25.1
Re: [PATCH 15/15] net/dpaa: fix buffer free in slow path
Quoted 3 lines · Gagandeep Singh
Adding a check in slow path to free those buffers
which are not external.
Can you please explain what was the error before fix, what was happening when you try to free all mbufs?
Also it seems previous logic was different, with 'prev_seg' etc, can you explain what/why changed there?
Quoted 61 lines
Fixes 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop")Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/dpaa/dpaa_rxtx.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)drivers/net/dpaa/dpaa_rxtx.c +8
-15@@ -455,7 +455,7 @@ dpaa_free_mbuf(const struct qm_fd *fd) bp_info =DPAA_BPID_TO_POOL_INFO (fd->bpid); format = (fd->opaque &DPAA_FD_FORMAT_MASK ) >>DPAA_FD_FORMAT_SHIFT ;if (unlikely (format == qm_fd_sg)) { -struct rte_mbuf *first_seg, *prev_seg, *cur_seg, *temp; +struct rte_mbuf *first_seg, *cur_seg;struct qm_sg_entry *sgt, *sg_temp;void *vaddr, *sg_vaddr;int i =0 ;@@ -469,32 +469,25 @@ dpaa_free_mbuf(const struct qm_fd *fd) sgt = vaddr + fd_offset; sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - temp = (struct rte_mbuf *) - ((char *)vaddr - bp_info->meta_data_size); sg_vaddr =DPAA_MEMPOOL_PTOV (bp_info,qm_sg_entry_get64 (sg_temp)); - first_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); first_seg->nb_segs =1 ; - prev_seg = first_seg;while (i <DPAA_SGT_MAX_ENTRIES ) { sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - sg_vaddr =DPAA_MEMPOOL_PTOV (bp_info, +if (sg_temp->bpid !=0xFF ) { + bp_info =DPAA_BPID_TO_POOL_INFO (sg_temp->bpid); + sg_vaddr =DPAA_MEMPOOL_PTOV (bp_info,qm_sg_entry_get64 (sg_temp)); - cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - + cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); - first_seg->nb_segs +=1 ; - prev_seg->next = cur_seg; -if (sg_temp->final) { - cur_seg->next =NULL ; -break ; +rte_pktmbuf_free_seg (cur_seg); } - prev_seg = cur_seg; +if (sg_temp->final) +break ; } - -rte_pktmbuf_free_seg (temp);rte_pktmbuf_free_seg (first_seg);return 0 ; }
RE: [PATCH 15/15] net/dpaa: fix buffer free in slow path
Hi,
Quoted 12 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, October 5, 2022 7:52 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [PATCH 15/15] net/dpaa: fix buffer free in slow pathQuoted 3 lines · Gagandeep Singh
Adding a check in slow path to free those buffers which are not external.
Quoted 6 lines
Can you please explain what was the error before fix, what was happening when you try to free all mbufs?
Also it seems previous logic was different, with '
prev_seg' etc, can you explain what/why changed there?
Actually, there were two issues, this function was converting all the segments present in HW frame descriptor to mbuf SG list by doing while on segments in FD (HW descriptor) and in the end it frees only one segment by calling the API rte_pktmbuf_free_seg(), so for other segments memory will be leaked.
Now in this change, doing the loop on each segment in FD and if the segment has a valid buffer pool id (HW pool id), freeing that segment in the loop itself without converting to a mbuf list. if we free all the buffers even those with invalid HW bpid (which will only be the external buffer case), then there can be double free because all the external buffer free handling is being done by the Xmit function.
Quoted 67 lines
Quoted 13 lines
Fixes 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop")Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/dpaa/dpaa_rxtx.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)(quoted diff) +0
-0
b/drivers/net/dpaa/dpaa_rxtx.cindex4d285b4f38..ce4f3d6c85100644drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 456
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.c +0
-0@@ -455,7 +455,7 @@ dpaa_free_mbuf(const struct qm_fd *fd) bp_info =DPAA_BPID_TO_POOL_INFO (fd->bpid); format = (fd->opaque & DPAA_FD_FORMAT_MASK) >>
DPAA_FD_FORMAT_SHIFT;Quoted 7 lines
drivers/net/dpaa/dpaa_rxtx.c +1
-1if (unlikely (format == qm_fd_sg)) { -struct rte_mbuf *first_seg, *prev_seg, *cur_seg, *temp; +struct rte_mbuf *first_seg, *cur_seg;struct qm_sg_entry *sgt, *sg_temp;void *vaddr, *sg_vaddr;int i =0 ;drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 473
Quoted 7 lines
drivers/net/dpaa/dpaa_rxtx.c +0
-2@@ -469,32 +469,25 @@ dpaa_free_mbuf(const struct qm_fd *fd) sgt = vaddr + fd_offset; sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - temp = (struct rte_mbuf *) - ((char *)vaddr - bp_info->meta_data_size); sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info,qm_sg_entry_get64(sg_temp));drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd)
Quoted 11 lines
drivers/net/dpaa/dpaa_rxtx.c +2
-3- first_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); first_seg->nb_segs =1 ; - prev_seg = first_seg;while (i <DPAA_SGT_MAX_ENTRIES ) { sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info, +if (sg_temp->bpid !=0xFF ) { + bp_info =
DPAA_BPID_TO_POOL_INFO(sg_temp->bpid);drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 483
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.c +1
-0+ sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info,qm_sg_entry_get64(sg_temp));drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 484
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.c +1
-1- cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - + cur_seg = (struct rte_mbuf *)((char*)sg_vaddr -
Quoted 18 lines
drivers/net/dpaa/dpaa_rxtx.c +3
-8bp_info- meta_data_size); - first_seg->nb_segs +=1 ; - prev_seg->next = cur_seg; -if (sg_temp->final) { - cur_seg->next =NULL ; -break ; +rte_pktmbuf_free_seg (cur_seg); } - prev_seg = cur_seg; +if (sg_temp->final) +break ; } - -rte_pktmbuf_free_seg (temp);rte_pktmbuf_free_seg (first_seg);return 0 ;}
Re: [PATCH 15/15] net/dpaa: fix buffer free in slow path
Quoted 17 lines · Gagandeep Singh
Hi,
Quoted 15 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, October 5, 2022 7:52 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [PATCH 15/15] net/dpaa: fix buffer free in slow pathQuoted 3 lines · Gagandeep Singh
Adding a check in slow path to free those buffers which are not external.
Can you please explain what was the error before fix, what was happening when you try to free all mbufs?
Quoted 8 lines
Quoted 3 lines
Also it seems previous logic was different, with '
prev_seg' etc, can you explain what/why changed there?Actually, there were two issues, this function was converting all the segments present in HW frame descriptor to mbuf SG list by doing while on segments in FD (HW descriptor) and in the end it frees only one segment by calling the API
rte_pktmbuf_free_seg(), so for other segments memory will be leaked.
ack
Quoted 6 lines
Now in this change, doing the loop on each segment in FD and if the segment has a valid buffer pool id (HW pool id), freeing that segment in the loop itself without converting to a mbuf list. if we free all the buffers even those with invalid HW bpid (which will only be the external buffer case), then there can be double free because all the external buffer free handling is being done by the Xmit function.
Got it, can you please give more information in the commit log as above, and can you please elaborate impact of possible double free, will it crash etc?
Quoted 68 lines
Quoted 67 lines
Quoted 13 lines
Fixes 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop")Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/dpaa/dpaa_rxtx.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)(quoted diff) +0
-0
b/drivers/net/dpaa/dpaa_rxtx.cindex4d285b4f38..ce4f3d6c85100644drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 456
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.c +0
-0@@ -455,7 +455,7 @@ dpaa_free_mbuf(const struct qm_fd *fd) bp_info =DPAA_BPID_TO_POOL_INFO (fd->bpid); format = (fd->opaque & DPAA_FD_FORMAT_MASK) >>
DPAA_FD_FORMAT_SHIFT;Quoted 7 lines
drivers/net/dpaa/dpaa_rxtx.c +1
-1if (unlikely (format == qm_fd_sg)) { -struct rte_mbuf *first_seg, *prev_seg, *cur_seg, *temp; +struct rte_mbuf *first_seg, *cur_seg;struct qm_sg_entry *sgt, *sg_temp;void *vaddr, *sg_vaddr;int i =0 ;drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 473
Quoted 7 lines
drivers/net/dpaa/dpaa_rxtx.c +0
-2@@ -469,32 +469,25 @@ dpaa_free_mbuf(const struct qm_fd *fd) sgt = vaddr + fd_offset; sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - temp = (struct rte_mbuf *) - ((char *)vaddr - bp_info->meta_data_size); sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info,qm_sg_entry_get64(sg_temp));drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd)
Quoted 11 lines
drivers/net/dpaa/dpaa_rxtx.c +2
-3- first_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); first_seg->nb_segs =1 ; - prev_seg = first_seg;while (i <DPAA_SGT_MAX_ENTRIES ) { sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info, +if (sg_temp->bpid !=0xFF ) { + bp_info =
DPAA_BPID_TO_POOL_INFO(sg_temp->bpid);drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 483
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.c +1
-0+ sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info,qm_sg_entry_get64(sg_temp));drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 484
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.c +1
-1- cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - + cur_seg = (struct rte_mbuf *)((char*)sg_vaddr -
Quoted 18 lines
drivers/net/dpaa/dpaa_rxtx.c +3
-8bp_info- meta_data_size); - first_seg->nb_segs +=1 ; - prev_seg->next = cur_seg; -if (sg_temp->final) { - cur_seg->next =NULL ; -break ; +rte_pktmbuf_free_seg (cur_seg); } - prev_seg = cur_seg; +if (sg_temp->final) +break ; } - -rte_pktmbuf_free_seg (temp);rte_pktmbuf_free_seg (first_seg);return 0 ;}
RE: [PATCH 15/15] net/dpaa: fix buffer free in slow path
Quoted 42 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, October 6, 2022 3:12 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [PATCH 15/15] net/dpaa: fix buffer free in slow pathQuoted 17 lines · Gagandeep Singh
Hi,
Quoted 15 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, October 5, 2022 7:52 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [PATCH 15/15] net/dpaa: fix buffer free in slow pathQuoted 3 lines · Gagandeep Singh
Adding a check in slow path to free those buffers which are not external.
Can you please explain what was the error before fix, what was happening when you try to free all mbufs?
Quoted 7 lines
Quoted 3 lines
Also it seems previous logic was different, with '
prev_seg' etc, can you explain what/why changed there?Actually, there were two issues, this function was converting all the segments present in HW frame descriptor to mbuf SG list by doing while on segments in FD (HW descriptor) and in the end it frees only one segment by calling the API
rte_pktmbuf_free_seg(), so for other segmentsmemory will be leaked.
Quoted 1 line
ack
Quoted 2 lines
Now in this change, doing the loop on each segment in FD and if the segment has a valid buffer pool id (HW pool id), freeing that segment in the
loop itself without converting to a mbuf list.
Quoted 9 lines
Quoted 3 lines
if we free all the buffers even those with invalid HW bpid (which will only be the external buffer case), then there can be double free because all the external buffer free handling is being done by the Xmit
function.
Quoted 1 line
Got it, can you please give more information in the commit log as above, and can you please elaborate impact of possible double free, will it crash etc?
Ok. I will update the commit message.
Quoted 68 lines
Quoted 68 lines
Quoted 67 lines
Quoted 13 lines
Fixes 9124e65dd3eb ("net/dpaa: enable Tx queue taildrop")Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/dpaa/dpaa_rxtx.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)(quoted diff) +0
-0
b/drivers/net/dpaa/dpaa_rxtx.cindex4d285b4f38..ce4f3d6c85100644drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 456
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.c +0
-0@@ -455,7 +455,7 @@ dpaa_free_mbuf(const struct qm_fd *fd) bp_info =DPAA_BPID_TO_POOL_INFO (fd->bpid); format = (fd->opaque & DPAA_FD_FORMAT_MASK) >>
DPAA_FD_FORMAT_SHIFT;Quoted 7 lines
drivers/net/dpaa/dpaa_rxtx.c +1
-1if (unlikely (format == qm_fd_sg)) { -struct rte_mbuf *first_seg, *prev_seg, *cur_seg, *temp; +struct rte_mbuf *first_seg, *cur_seg;struct qm_sg_entry *sgt, *sg_temp;void *vaddr, *sg_vaddr;int i =0 ;drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 473
Quoted 7 lines
drivers/net/dpaa/dpaa_rxtx.c +0
-2@@ -469,32 +469,25 @@ dpaa_free_mbuf(const struct qm_fd *fd) sgt = vaddr + fd_offset; sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - temp = (struct rte_mbuf *) - ((char *)vaddr - bp_info->meta_data_size); sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info,qm_sg_entry_get64(sg_temp));drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd)
Quoted 11 lines
drivers/net/dpaa/dpaa_rxtx.c +2
-3- first_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); first_seg->nb_segs =1 ; - prev_seg = first_seg;while (i <DPAA_SGT_MAX_ENTRIES ) { sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info, +if (sg_temp->bpid !=0xFF ) { + bp_info =
DPAA_BPID_TO_POOL_INFO(sg_temp->bpid);drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 483
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.c +1
-0+ sg_vaddr = DPAA_MEMPOOL_PTOV(bp_info,qm_sg_entry_get64(sg_temp));drivers/net/dpaa/dpaa_rxtx.c dpaa_free_mbuf(const struct qm_fd *fd) · line 484
Quoted 2 lines
drivers/net/dpaa/dpaa_rxtx.c +1
-1- cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - + cur_seg = (struct rte_mbuf *)((char*)sg_vaddr -
Quoted 18 lines
drivers/net/dpaa/dpaa_rxtx.c +3
-8bp_info- meta_data_size); - first_seg->nb_segs +=1 ; - prev_seg->next = cur_seg; -if (sg_temp->final) { - cur_seg->next =NULL ; -break ; +rte_pktmbuf_free_seg (cur_seg); } - prev_seg = cur_seg; +if (sg_temp->final) +break ; } - -rte_pktmbuf_free_seg (temp);rte_pktmbuf_free_seg (first_seg);return 0 ;}
Quoted 21 lines · Gagandeep Singh
This series have list of patch for bug fixes and
some enhancements to DPAA1 and DPAA2 net drivers.Apeksha Gupta (2):
net/enetfec: fix restart issue
net/enetfec: fix buffer leak issueGagandeep Singh (7):
net/dpaa: support ESP packet type in packet parsing net/dpaa2: use internal mempool for SG table net/dpaa2: fix buffer free on transmit SG packets net/dpaa: use internal mempool for SG table bus/dpaa: mempool ops registration change net/dpaa: fix buffer free on transmit SG packets net/dpaa: fix buffer free in slow pathRohit Raj (3):
bus/fslmc: add timeout in MC send command API net/dpaa: fix Jumbo packet Rx in case of VSP bus/dpaa: pass interface name as a string instead of pointer
Quoted 7 lines
Vanshika Shukla (2):
bus/dpaa: use non-block mode for FD open net/dpaa2: fix dpdmux configuration for error behaviourbrick (1):
net/dpaa2: check free enqueue descriptors before Tx
Hi Gagandeep,
I put some comments/questions to some patches, can you please check?
Also patches requires ack/review tag from their maintainer to proceed.
Series-
Quoted 56 lines
-----Original Message-----
From: Gagandeep Singh <[email protected]>
Sent: Wednesday, September 28, 2022 10:55 AM
To: [email protected]; [email protected]
Cc: Gagandeep Singh <[email protected]>
Subject: [PATCH 00/15] DPAA and DPAA2 driver changesThis series have list of patch for bug fixes and some enhancements to DPAA1 and DPAA2 net drivers.
Apeksha Gupta (2):
net/enetfec: fix restart issue
net/enetfec: fix buffer leak issueGagandeep Singh (7):
net/dpaa: support ESP packet type in packet parsing net/dpaa2: use internal mempool for SG table net/dpaa2: fix buffer free on transmit SG packets net/dpaa: use internal mempool for SG table bus/dpaa: mempool ops registration change net/dpaa: fix buffer free on transmit SG packets net/dpaa: fix buffer free in slow pathRohit Raj (3):
bus/fslmc: add timeout in MC send command API net/dpaa: fix Jumbo packet Rx in case of VSP bus/dpaa: pass interface name as a string instead of pointerVanshika Shukla (2):
bus/dpaa: use non-block mode for FD open net/dpaa2: fix dpdmux configuration for error behaviourbrick (1):
net/dpaa2: check free enqueue descriptors before Txdrivers/bus/dpaa/base/qbman/process.c | 8 +- drivers/bus/dpaa/base/qbman/qman_driver.c | 6 +- drivers/bus/dpaa/dpaa_bus.c | 10 +- drivers/bus/fslmc/mc/mc_sys.c | 18 ++- drivers/event/dpaa2/dpaa2_eventdev.c | 8 +- drivers/net/dpaa/dpaa_ethdev.c | 20 ++- drivers/net/dpaa/dpaa_ethdev.h | 19 +++ drivers/net/dpaa/dpaa_flow.c | 13 +- drivers/net/dpaa/dpaa_flow.h | 5 +- drivers/net/dpaa/dpaa_rxtx.c | 97 +++++++----- drivers/net/dpaa/dpaa_rxtx.h | 6 + drivers/net/dpaa2/dpaa2_ethdev.c | 14 ++ drivers/net/dpaa2/dpaa2_ethdev.h | 21 +++ drivers/net/dpaa2/dpaa2_mux.c | 2 +- drivers/net/dpaa2/dpaa2_rxtx.c | 174 +++++++++++++++------- drivers/net/enetfec/enet_ethdev.c | 4 + drivers/net/enetfec/enet_rxtx.c | 29 ++-- 17 files changed, 315 insertions(+), 139 deletions(-)--
2.25.1
v2 cover DPAA and DPAA2 driver changes
In reply to Gagandeep SinghThis series have list of patch for bug fixes and
some enhancements to DPAA1 and DPAA2 net drivers.
v2-change-log:
* update commit messages
* update DPAA NIC doc for kernel version matching
* update DPAA supported packet type info
* Freeing the internal pool on last device remove
* fixes syntax for some comments
Apeksha Gupta (2):
net/enetfec: fix restart issue
net/enetfec: fix buffer leak issue
Brick Yang (1):
net/dpaa2: check free enqueue descriptors before Tx
Gagandeep Singh (8):
net/dpaa: support ESP packet type in packet parsing net/dpaa2: use internal mempool for SG table net/dpaa2: fix buffer free on transmit SG packets
doc: add kernel version compatible information net/dpaa: use internal mempool for SG table bus/dpaa: mempool ops registration change net/dpaa: fix buffer free on transmit SG packets net/dpaa: fix buffer free in slow path
Rohit Raj (3):
bus/fslmc: add timeout in MC send command API net/dpaa: fix Jumbo packet Rx in case of VSP bus/dpaa: pass interface name as a string instead of pointer
Vanshika Shukla (2):
bus/dpaa: use non-block mode for FD open net/dpaa2: fix dpdmux configuration for error behaviour
doc/guides/nics/dpaa.rst | 4 + drivers/bus/dpaa/base/qbman/process.c | 8 +- drivers/bus/dpaa/base/qbman/qman_driver.c | 6 +- drivers/bus/dpaa/dpaa_bus.c | 10 +- drivers/bus/fslmc/mc/mc_sys.c | 18 ++- drivers/event/dpaa2/dpaa2_eventdev.c | 8 +- drivers/net/dpaa/dpaa_ethdev.c | 28 +++- drivers/net/dpaa/dpaa_ethdev.h | 19 +++ drivers/net/dpaa/dpaa_flow.c | 13 +- drivers/net/dpaa/dpaa_flow.h | 5 +- drivers/net/dpaa/dpaa_rxtx.c | 97 +++++++----- drivers/net/dpaa/dpaa_rxtx.h | 6 + drivers/net/dpaa2/dpaa2_ethdev.c | 19 +++ drivers/net/dpaa2/dpaa2_ethdev.h | 21 +++ drivers/net/dpaa2/dpaa2_mux.c | 2 +- drivers/net/dpaa2/dpaa2_rxtx.c | 174 +++++++++++++++------- drivers/net/enetfec/enet_ethdev.c | 4 + drivers/net/enetfec/enet_rxtx.c | 29 ++-- 18 files changed, 331 insertions(+), 140 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/16 bus/dpaa: use non-block mode for FD open
From: Vanshika Shukla <[email protected]>
This patch sets qman portal file descriptors used for interrupts IO processing in non-blocking mode to avoid any unwanted blocks while IO operations over the FD.
--- drivers/bus/dpaa/base/qbman/qman_driver.c | 6 +++--- drivers/net/dpaa/dpaa_ethdev.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/bus/dpaa/base/qbman/qman_driver.c +3 -3
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2008-2016 Freescale Semiconductor Inc. -* Copyright 2017,2019 NXP +* Copyright 2017-2022 NXP * */
@@ -64,7 +64,7 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared) qpcfg.addr_virt[DPAA_PORTAL_CE ] = map.addr.cena; qpcfg.addr_virt[DPAA_PORTAL_CI ] = map.addr.cinh; - qmfd =open (QMAN_PORTAL_IRQ_PATH ,O_RDONLY ); + qmfd =open (QMAN_PORTAL_IRQ_PATH ,O_RDONLY |O_NONBLOCK );if (qmfd ==-1 ) {pr_err ("QMan irq init failed\n" );process_portal_unmap (&map.addr);
@@ -174,7 +174,7 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd) q_pcfg->addr_virt[DPAA_PORTAL_CE ] = q_map.addr.cena; q_pcfg->addr_virt[DPAA_PORTAL_CI ] = q_map.addr.cinh; - q_fd =open (QMAN_PORTAL_IRQ_PATH ,O_RDONLY ); + q_fd =open (QMAN_PORTAL_IRQ_PATH ,O_RDONLY |O_NONBLOCK );if (q_fd ==-1 ) {pr_err ("QMan irq init failed\n" ); goto err;
drivers/net/dpaa/dpaa_ethdev.c +1 -1
@@ -1496,7 +1496,7 @@ static int dpaa_dev_queue_intr_disable(struct rte_eth_dev *dev, temp1 =read (rxq->q_fd, &temp,sizeof (temp));if (temp1 !=sizeof (temp)) -DPAA_PMD_ERR ("irq read error" ); +DPAA_PMD_DEBUG ("read did not return anything" );qman_fq_portal_thread_irq (rxq->qp);
Signature · 1 line
2.25.1
PATCH v2 2/16 net/enetfec: fix restart issue
In reply to Gagandeep SinghFrom: Apeksha Gupta <[email protected]>
Queue reset is missing in restart because of which IO cannot work on device restart.
This patch fixes the issue by resetting the queues on device restart.
--- drivers/net/enetfec/enet_ethdev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/enetfec/enet_ethdev.c +4 -0
@@ -54,6 +54,7 @@ enetfec_restart(struct rte_eth_dev *dev)uint32_t rcntl =OPT_FRAME_SIZE |0x04 ;uint32_t ecntl =ENETFEC_ETHEREN ;uint32_t val; +int i;/* Clear any outstanding interrupt. */ writel (0xffffffff , (uint8_t *)fep->hw_baseaddr_v +ENETFEC_EIR );
@@ -149,6 +150,9 @@ enetfec_restart(struct rte_eth_dev *dev)/* And last, enable the transmit and receive processing */ rte_write32 (rte_cpu_to_le_32 (ecntl), (uint8_t *)fep->hw_baseaddr_v +ENETFEC_ECR ); + +for (i =0 ; i < fep->max_rx_queues; i++) +rte_write32 (0 , fep->rx_queues[i]->bd.active_reg_desc);rte_delay_us (10 ); }
Signature · 1 line
2.25.1
PATCH v2 3/16 net/enetfec: fix buffer leak issue
In reply to Gagandeep SinghFrom: Apeksha Gupta <[email protected]>
Driver has no proper handling to free unused allocated mbufs in case of error or when the rx processing complete because of which mempool can be empty after some time.
This patch fixes this issue by moving the buffer allocation code to the right place in driver.
--- drivers/net/enetfec/enet_rxtx.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/net/enetfec/enet_rxtx.c +16 -13
@@ -39,11 +39,6 @@ enetfec_recv_pkts(void *rxq1, struct rte_mbuf **rx_pkts,if (pkt_received >= nb_pkts)break ; - new_mbuf =rte_pktmbuf_alloc (pool); -if (unlikely (new_mbuf ==NULL )) { - stats->rx_nombuf++; -break ; - }/* Check for errors. */ status ^=RX_BD_LAST ; if (status & (RX_BD_LG | RX_BD_SH | RX_BD_NO |
@@ -72,6 +67,12 @@ enetfec_recv_pkts(void *rxq1, struct rte_mbuf **rx_pkts, goto rx_processing_done; } + new_mbuf =rte_pktmbuf_alloc (pool); +if (unlikely (new_mbuf ==NULL )) { + stats->rx_nombuf++; +break ; + } +/* Process the incoming frame. */ stats->ipackets++; pkt_len =rte_le_to_cpu_16 (rte_read16 (&bdp->bd_datlen));
@@ -193,7 +194,16 @@ enetfec_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) tx_st =0 ;break ; } + + mbuf = *(tx_pkts); +if (mbuf->nb_segs >1 ) { +ENETFEC_DP_LOG (DEBUG ,"SG not supported" ); +return pkt_transmitted; + } + + tx_pkts++; bdp = txq->bd.cur; +/* First clean the ring */ index =enet_get_bd_index (bdp, &txq->bd); status =rte_le_to_cpu_16 (rte_read16 (&bdp->bd_sc));
@@ -207,9 +217,6 @@ enetfec_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) txq->tx_mbuf[index] =NULL ; } - mbuf = *(tx_pkts); - tx_pkts++; -/* Fill in a Tx ring entry */ last_bdp = bdp; status &= ~TX_BD_STATS ;
@@ -219,10 +226,6 @@ enetfec_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) stats->opackets++; stats->obytes += buflen; -if (mbuf->nb_segs >1 ) { -ENETFEC_DP_LOG (DEBUG ,"SG not supported" ); -return -1 ; - } status |= (TX_BD_LAST ); data = rte_pktmbuf_mtod(mbuf, void *);for (i =0 ; i <= buflen; i +=RTE_CACHE_LINE_SIZE )
@@ -268,5 +271,5 @@ enetfec_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)*/ txq->bd.cur = bdp; } -return nb_pkts; +return pkt_transmitted; }
Signature · 1 line
2.25.1
PATCH v2 4/16 net/dpaa2: fix dpdmux configuration for error behaviour
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Driver is giving the wrong interface ID while setting the error behaviour.
This patch fixes the issue by passing the correct MAC interface index value to the API.
--- drivers/net/dpaa2/dpaa2_ethdev.h | 3 +++ drivers/net/dpaa2/dpaa2_mux.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/dpaa2/dpaa2_ethdev.h +3 -0
@@ -66,6 +66,9 @@/* Tx confirmation enabled */ #define DPAA2_TX_CONF_ENABLE 0x06 +/* DPDMUX index for DPMAC */ +#define DPAA2_DPDMUX_DPMAC_IDX 0 +/* HW loopback the egress traffic to self ingress*/ #define DPAA2_TX_MAC_LOOPBACK_MODE 0x20
drivers/net/dpaa2/dpaa2_mux.c +1 -1
@@ -336,7 +336,7 @@ dpaa2_create_dpdmux_device(int vdev_fd __rte_unused, ret =dpdmux_if_set_errors_behavior (&dpdmux_dev->dpdmux,CMD_PRI_LOW , - dpdmux_dev->token, dpdmux_id, + dpdmux_dev->token,DPAA2_DPDMUX_DPMAC_IDX , &mux_err_cfg);if (ret) { DPAA2_PMD_ERR("dpdmux_if_set_errors_behavior %s err %d",
Signature · 1 line
2.25.1
PATCH v2 5/16 net/dpaa2: check free enqueue descriptors before Tx
In reply to Gagandeep SinghFrom: Brick Yang <[email protected]>
Check if there exists free enqueue descriptors before enqueuing Tx packet. Also try to free enqueue descriptors in case they are not free.
--- drivers/event/dpaa2/dpaa2_eventdev.c | 8 ++--- drivers/net/dpaa2/dpaa2_rxtx.c | 50 +++++++++++++++++++--------- 2 files changed, 38 insertions(+), 20 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +3 -5
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2017,2019-2021 NXP +* Copyright 2017,2019-2022 NXP */ #include <assert.h>
@@ -176,7 +176,7 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],if (retry_count >DPAA2_EV_TX_RETRY_COUNT ) { num_tx += loop; nb_events -= loop; -return num_tx + loop; +return num_tx; } }else { loop += ret;
@@ -1016,9 +1016,7 @@ dpaa2_eventdev_txa_enqueue(void *port, txq[i] = rte_eth_devices[m[i]->port].data->tx_queues[qid]; } -dpaa2_dev_tx_multi_txq_ordered (txq, m, nb_events); - -return nb_events; +return dpaa2_dev_tx_multi_txq_ordered (txq, m, nb_events); }static struct eventdev_ops dpaa2_eventdev_ops = {
drivers/net/dpaa2/dpaa2_rxtx.c +35 -15
104 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 6/16 net/dpaa: support ESP packet type in packet parsing
In reply to Gagandeep SinghAdd support of ESP packet type in packet receive path.
--- drivers/net/dpaa/dpaa_ethdev.c | 3 ++- drivers/net/dpaa/dpaa_rxtx.c | 10 ++++++++++ drivers/net/dpaa/dpaa_rxtx.h | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-)
drivers/net/dpaa/dpaa_ethdev.c +2 -1
@@ -360,7 +360,8 @@ dpaa_supported_ptypes_get(struct rte_eth_dev *dev)RTE_PTYPE_L4_FRAG ,RTE_PTYPE_L4_TCP ,RTE_PTYPE_L4_UDP , - RTE_PTYPE_L4_SCTP +RTE_PTYPE_L4_SCTP , + RTE_PTYPE_TUNNEL_ESP };PMD_INIT_FUNC_TRACE ();
drivers/net/dpaa/dpaa_rxtx.c +10 -0
@@ -178,6 +178,16 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) m->packet_type =RTE_PTYPE_L2_ETHER |RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ;break ; +case DPAA_PKT_TYPE_IPSEC_IPV4 : +if (*((uintptr_t *)&annot->parse) &DPAA_PARSE_ESP_MASK ) + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 |RTE_PTYPE_TUNNEL_ESP ; +break ; +case DPAA_PKT_TYPE_IPSEC_IPV6 : +if (*((uintptr_t *)&annot->parse) &DPAA_PARSE_ESP_MASK ) + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_TUNNEL_ESP ; +break ;case DPAA_PKT_TYPE_IPV4_EXT_UDP : m->packet_type =RTE_PTYPE_L2_ETHER |RTE_PTYPE_L3_IPV4_EXT |RTE_PTYPE_L4_UDP ;
drivers/net/dpaa/dpaa_rxtx.h +6 -0
@@ -47,6 +47,7 @@* L4R 0xE0 - * 0x20 - TCP * 0x40 - UDP +* 0x60 - IPsec * 0x80 - SCTP * L3R 0xEDC4 (in Big Endian) - * 0x8000 - IPv4
@@ -63,6 +64,7 @@*/ #define DPAA_PARSE_MASK 0x00F044EF00800000#define DPAA_PARSE_VLAN_MASK 0x0000000000700000 +#define DPAA_PARSE_ESP_MASK 0x0008000000000000/* Parsed values (Little Endian) */ #define DPAA_PKT_TYPE_NONE 0x0000000000000000
@@ -137,6 +139,10 @@ (0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_4_6)#define DPAA_PKT_TYPE_TUNNEL_6_4_TCP \ (0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_6_4) +#define DPAA_PKT_TYPE_IPSEC_IPV4 \ + (0x0060000000000000 | DPAA_PKT_TYPE_IPV4) +#define DPAA_PKT_TYPE_IPSEC_IPV6 \ + (0x0060000000000000 | DPAA_PKT_TYPE_IPV6)/* Checksum Errors */ #define DPAA_PKT_IP_CSUM_ERR 0x0000400200000000
Signature · 1 line
2.25.1
PATCH v2 7/16 net/dpaa2: use internal mempool for SG table
In reply to Gagandeep SinghCreating and using driver's mempool for allocating the SG table memory required for FD creation instead of relying on user mempool.
--- drivers/net/dpaa2/dpaa2_ethdev.c | 19 +++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 9 +++++++++ drivers/net/dpaa2/dpaa2_rxtx.c | 13 ++++++------- 3 files changed, 34 insertions(+), 7 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.c +19 -0
@@ -78,6 +78,9 @@ bool dpaa2_enable_err_queue;#define MAX_NB_RX_DESC 11264int total_nb_rx_desc; +int dpaa2_valid_dev; +struct rte_mempool *dpaa2_tx_sg_pool; +struct rte_dpaa2_xstats_name_off {char name[RTE_ETH_XSTATS_NAME_SIZE ];uint8_t page_id;/* dpni statistics page id */
@@ -2907,7 +2910,20 @@ rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,/* Invoke PMD device initialization function */ diag =dpaa2_dev_init (eth_dev);if (diag ==0 ) { +if (!dpaa2_tx_sg_pool) { + dpaa2_tx_sg_pool = +rte_pktmbuf_pool_create ("dpaa2_mbuf_tx_sg_pool" , +DPAA2_POOL_SIZE , +DPAA2_POOL_CACHE_SIZE ,0 , +DPAA2_MAX_SGS *sizeof (struct qbman_sge ), +rte_socket_id ()); +if (dpaa2_tx_sg_pool ==NULL ) { +DPAA2_PMD_ERR ("SG pool creation failed\n" ); +return -ENOMEM ; + } + }rte_eth_dev_probing_finish (eth_dev); + dpaa2_valid_dev++;return 0 ; }
@@ -2923,6 +2939,9 @@ rte_dpaa2_remove(struct rte_dpaa2_device *dpaa2_dev) eth_dev = dpaa2_dev->eth_dev;dpaa2_dev_close (eth_dev); + dpaa2_valid_dev--; +if (!dpaa2_valid_dev) +rte_mempool_free (dpaa2_tx_sg_pool); ret =rte_eth_dev_release_port (eth_dev);return ret;
drivers/net/dpaa2/dpaa2_ethdev.h +9 -0
@@ -121,6 +121,15 @@#define DPAA2_PKT_TYPE_VLAN_1 0x0160#define DPAA2_PKT_TYPE_VLAN_2 0x0260 +/* Global pool used by driver for SG list TX */ +extern struct rte_mempool *dpaa2_tx_sg_pool; +/* Maximum SG segments */ +#define DPAA2_MAX_SGS 128 +/* SG pool size */ +#define DPAA2_POOL_SIZE 2048 +/* SG pool cache size */ +#define DPAA2_POOL_CACHE_SIZE 256 +/* enable timestamp in mbuf*/ extern bool dpaa2_enable_ts[];extern uint64_t dpaa2_timestamp_rx_dynflag;
drivers/net/dpaa2/dpaa2_rxtx.c +6 -7
@@ -403,7 +403,7 @@ eth_fd_to_mbuf(const struct qbman_fd *fd, static int __rte_noinline __rte_hoteth_mbuf_to_sg_fd (struct rte_mbuf *mbuf,struct qbman_fd *fd, -struct rte_mempool *mp,uint16_t bpid) +uint16_t bpid) {struct rte_mbuf *cur_seg = mbuf, *prev_seg, *mi, *temp;struct qbman_sge *sgt, *sge =NULL ;
@@ -433,12 +433,12 @@ eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, }DPAA2_SET_FD_OFFSET (fd, offset); }else { - temp =rte_pktmbuf_alloc (mp); + temp =rte_pktmbuf_alloc (dpaa2_tx_sg_pool);if (temp ==NULL ) {DPAA2_PMD_DP_DEBUG ("No memory to allocate S/G table\n" );return -ENOMEM ; } -DPAA2_SET_ONLY_FD_BPID (fd, bpid); +DPAA2_SET_ONLY_FD_BPID (fd,mempool_to_bpid (dpaa2_tx_sg_pool));DPAA2_SET_FD_OFFSET (fd, temp->data_off);#ifdef RTE_LIBRTE_MEMPOOL_DEBUG rte_mempool_check_cookies(rte_mempool_from_obj((void *)temp),
@@ -1321,9 +1321,10 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)if (unlikely (RTE_MBUF_HAS_EXTBUF (*bufs))) {if (unlikely ((*bufs)->nb_segs >1 )) { + mp = (*bufs)->pool;if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp,0 )) +mempool_to_bpid (mp))) goto send_n_return; }else { eth_mbuf_to_fd(*bufs,
@@ -1372,7 +1373,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) + bpid)) goto send_n_return; }else { eth_mbuf_to_fd(*bufs,
@@ -1646,7 +1647,6 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue,if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_frames; }else {
@@ -1810,7 +1810,6 @@ dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)if (unlikely ((*bufs)->nb_segs >1 )) {if (eth_mbuf_to_sg_fd (*bufs, &fd_arr[loop], - mp, bpid)) goto send_n_return; }else {
Signature · 1 line
2.25.1
PATCH v2 8/16 net/dpaa2: fix buffer free on transmit SG packets
In reply to Gagandeep SinghWhen using SG list to TX with external and direct buffers, HW free the direct buffers and driver free the external buffers.
Software scans the complete SG mbuf list to find the external buffers to free, but this is wrong as hardware can free the direct buffers if any present in the list and same can be re-allocated for other purpose in multi thread or high speed running traffic environment with new data in it. So the software which is scanning the SG mbuf list, if that list has any direct buffer present then that direct buffer's next pointer can give wrong pointer value, if already freed by hardware which can do the mempool corruption or memory leak.
In this patch instead of relying on user given SG mbuf list we are storing the buffers in an internal list which will be scanned by driver after transmit to free non-direct buffers.
This patch also fixes 2 more memory leak issues.
Driver is freeing complete SG list by checking external buffer flag in first segment only, but external buffer can be attached to any of the segment. Because of which driver either can double free buffers or there can be memory leak.
In case of indirect buffers, driver is modifying the original buffer list to free the indirect buffers but this original buffer list is being used even after transmit packets for software buffer cleanup. This can cause the buffer leak issue.
--- drivers/net/dpaa2/dpaa2_ethdev.h | 9 +++ drivers/net/dpaa2/dpaa2_rxtx.c | 111 +++++++++++++++++++++++-------- 2 files changed, 92 insertions(+), 28 deletions(-)
drivers/net/dpaa2/dpaa2_ethdev.h +9 -0
@@ -129,6 +129,15 @@ extern struct rte_mempool *dpaa2_tx_sg_pool;#define DPAA2_POOL_SIZE 2048/* SG pool cache size */ #define DPAA2_POOL_CACHE_SIZE 256 +/* structure to free external and indirect +* buffers. +*/ +struct sw_buf_free { +/* To which packet this segment belongs */ +uint16_t pkt_id; +/* The actual segment */ +struct rte_mbuf *seg; +};/* enable timestamp in mbuf*/ extern bool dpaa2_enable_ts[];
drivers/net/dpaa2/dpaa2_rxtx.c +83 -28
249 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 9/16 bus/fslmc: add timeout in MC send command API
In reply to Gagandeep SinghFrom: Rohit Raj <[email protected]>
Adding one second timeout in MC send command API to ensure it doesn't gets stuck in case of failure.
--- drivers/bus/fslmc/mc/mc_sys.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/bus/fslmc/mc/mc_sys.c +12 -6
@@ -1,13 +1,14 @@/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2013-2015 Freescale Semiconductor Inc. -* Copyright 2017 NXP +* Copyright 2017,2022 NXP * */ #include <fsl_mc_sys.h> #include <fsl_mc_cmd.h> #include <rte_spinlock.h> +#include <rte_cycles.h> /** User space framework uses MC Portal in shared mode. Following change * introduces lock in MC FLIB
@@ -54,7 +55,7 @@ static int mc_status_to_error(enum mc_cmd_status status)int mc_send_command (struct fsl_mc_io *mc_io,struct mc_command *cmd) {enum mc_cmd_status status; -uint64_t response; +uint64_t response, start_time, total_time, time_to_wait;if (!mc_io || !mc_io->regs)return -EACCES ;
@@ -64,15 +65,20 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd)mc_write_command (mc_io->regs, cmd); +/* Wait for one second. rte_get_timer_hz() returns frequency of CPU */ + time_to_wait =rte_get_timer_hz (); + total_time =0 ; + start_time =rte_get_timer_cycles (); +/* Spin until status changes */ do { response =ioread64 (mc_io->regs); status =mc_cmd_read_status ((struct mc_command *)&response); + total_time =rte_get_timer_cycles () - start_time; + }while (status ==MC_CMD_STATUS_READY && total_time <= time_to_wait); -/* --- Call wait function here to prevent blocking --- -* Change the loop condition accordingly to exit on timeout. -*/ - }while (status ==MC_CMD_STATUS_READY ); +if (status ==MC_CMD_STATUS_READY ) +return mc_status_to_error (MC_CMD_STATUS_TIMEOUT );/* Read the response back into the command buffer */ mc_read_response (mc_io->regs, cmd);
Signature · 1 line
2.25.1
PATCH v2 10/16 net/dpaa: fix Jumbo packet Rx in case of VSP
In reply to Gagandeep SinghFrom: Rohit Raj <[email protected]>
For packet length of size more than 2K bytes, segmented packets were being received in DPDK even if mbuf size was greater than packet length. This is due to the configuration in VSP.
This patch fixes the issue by configuring the VSP according to the mbuf size configured during mempool configuration.
--- drivers/net/dpaa/dpaa_ethdev.c | 5 ++--- drivers/net/dpaa/dpaa_flow.c | 13 ++++++------- drivers/net/dpaa/dpaa_flow.h | 5 +++-- 3 files changed, 11 insertions(+), 12 deletions(-)
drivers/net/dpaa/dpaa_ethdev.c +2 -3
@@ -989,8 +989,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, }else {DPAA_PMD_WARN ("The requested maximum Rx packet size (%u) is" " larger than a single mbuf (%u) and scattered" -" mode has not been requested" , - max_rx_pktlen, buffsz -RTE_PKTMBUF_HEADROOM ); +" mode has not been requested" , max_rx_pktlen, buffsz); } dpaa_intf->bp_info =DPAA_MEMPOOL_TO_POOL_INFO (mp);
@@ -1005,7 +1004,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,if (vsp_id >=0 ) { ret =dpaa_port_vsp_update (dpaa_intf, fmc_q, vsp_id,DPAA_MEMPOOL_TO_POOL_INFO (mp)->bpid, - fif); + fif, buffsz +RTE_PKTMBUF_HEADROOM );if (ret) {DPAA_PMD_ERR ("dpaa_port_vsp_update failed" );return ret;
drivers/net/dpaa/dpaa_flow.c +6 -7
@@ -939,7 +939,7 @@ int dpaa_fm_term(void)static int dpaa_port_vsp_configure (struct dpaa_if *dpaa_intf,uint8_t vsp_id,t_handle fman_handle, -struct fman_if *fif) +struct fman_if *fif,u32 mbuf_data_room_size) {t_fm_vsp_params vsp_params;t_fm_buffer_prefix_content buf_prefix_cont;
@@ -976,10 +976,8 @@ static int dpaa_port_vsp_configure(struct dpaa_if *dpaa_intf,return -1 ; } vsp_params.ext_buf_pools.num_of_pools_used =1 ; - vsp_params.ext_buf_pools.ext_buf_pool[0 ].id = - dpaa_intf->vsp_bpid[vsp_id]; - vsp_params.ext_buf_pools.ext_buf_pool[0 ].size = -RTE_MBUF_DEFAULT_BUF_SIZE ; + vsp_params.ext_buf_pools.ext_buf_pool[0 ].id = dpaa_intf->vsp_bpid[vsp_id]; + vsp_params.ext_buf_pools.ext_buf_pool[0 ].size = mbuf_data_room_size; dpaa_intf->vsp_handle[vsp_id] =fm_vsp_config (&vsp_params);if (!dpaa_intf->vsp_handle[vsp_id]) {
@@ -1023,7 +1021,7 @@ static int dpaa_port_vsp_configure(struct dpaa_if *dpaa_intf,int dpaa_port_vsp_update (struct dpaa_if *dpaa_intf,bool fmc_mode,uint8_t vsp_id,uint32_t bpid, -struct fman_if *fif) +struct fman_if *fif,u32 mbuf_data_room_size) {int ret =0 ;t_handle fman_handle;
@@ -1054,7 +1052,8 @@ int dpaa_port_vsp_update(struct dpaa_if *dpaa_intf, dpaa_intf->vsp_bpid[vsp_id] = bpid; -return dpaa_port_vsp_configure (dpaa_intf, vsp_id, fman_handle, fif); +return dpaa_port_vsp_configure (dpaa_intf, vsp_id, fman_handle, fif, + mbuf_data_room_size); }int dpaa_port_vsp_cleanup (struct dpaa_if *dpaa_intf,struct fman_if *fif)
drivers/net/dpaa/dpaa_flow.h +3 -2
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2017,2019 NXP +* Copyright 2017,2019,2022 NXP */ #ifndef __DPAA_FLOW_H__
@@ -11,7 +11,8 @@ int dpaa_fm_config(struct rte_eth_dev *dev, uint64_t req_dist_set);int dpaa_fm_deconfig (struct dpaa_if *dpaa_intf,struct fman_if *fif);void dpaa_write_fm_config_to_file (void );int dpaa_port_vsp_update (struct dpaa_if *dpaa_intf, -bool fmc_mode,uint8_t vsp_id,uint32_t bpid,struct fman_if *fif); +bool fmc_mode,uint8_t vsp_id,uint32_t bpid,struct fman_if *fif, +u32 mbuf_data_room_size);int dpaa_port_vsp_cleanup (struct dpaa_if *dpaa_intf,struct fman_if *fif);int dpaa_port_fmc_init (struct fman_if *fif,uint32_t *fqids,int8_t *vspids,int max_nb_rxq);
Signature · 1 line
2.25.1
PATCH v2 11/16 doc: add kernel version compatible information
In reply to Gagandeep SinghDPAA driver has dependency on kernel to perform various functionalities. So kernel and DPDK version should be compatible for proper working.
This patch updates the DPAA guide with the information that user can refer to find the compatible kernel version.
--- doc/guides/nics/dpaa.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/nics/dpaa.rst +4 -0
@@ -187,6 +187,10 @@ See :doc:`../platform/dpaa` for setup information - Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. +- DPAA driver has dependency on kernel to perform various functionalities. + So kernel and DPDK version should be compatible for proper working. + Refer release notes of NXP SDK guide to match the versions `NXP LSDK GUIDE + <https://www.nxp.com/design/software/embedded-software/linux-software-and-development-tools/layerscape-software-development-kit-v21-08:LAYERSCAPE-SDK>`_. .. note::
Signature · 1 line
2.25.1
PATCH v2 12/16 bus/dpaa: pass interface name as a string instead of pointer
In reply to Gagandeep SinghFrom: Rohit Raj <[email protected]>
Due to change in latest kernel, passing the interface name to kernel through IOCTL as string instead of character pointer.
--- drivers/bus/dpaa/base/qbman/process.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/bus/dpaa/base/qbman/process.c +4 -4
@@ -302,7 +302,7 @@ int bman_free_raw_portal(struct dpaa_raw_portal *portal) _IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)#define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \ - _IOW(DPAA_IOCTL_MAGIC, 0x0F, char*) + _IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])int dpaa_intr_enable (char *if_name,int efd) {
@@ -330,7 +330,7 @@ int dpaa_intr_disable(char *if_name)if (ret)return ret; - ret =ioctl (fd,DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT , &if_name); + ret =ioctl (fd,DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT , if_name);if (ret) {if (errno ==EINVAL )printf ("Failed to disable interrupt: Not Supported\n" );
@@ -472,7 +472,7 @@ int dpaa_update_link_speed(char *if_name, int link_speed, int link_duplex) }#define DPAA_IOCTL_RESTART_LINK_AUTONEG \ - _IOW(DPAA_IOCTL_MAGIC, 0x13, char *) + _IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])int dpaa_restart_link_autoneg (char *if_name) {
@@ -481,7 +481,7 @@ int dpaa_restart_link_autoneg(char *if_name)if (ret)return ret; - ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , &if_name); + ret =ioctl (fd,DPAA_IOCTL_RESTART_LINK_AUTONEG , if_name);if (ret) {if (errno ==EINVAL )printf ("Failed to restart autoneg: Not Supported\n" );
Signature · 1 line
2.25.1
PATCH v2 13/16 net/dpaa: use internal mempool for SG table
In reply to Gagandeep SinghCreating and using driver's mempool for
allocating the SG table memory required for
FD creation.
--- drivers/net/dpaa/dpaa_ethdev.c | 18 ++++++++++++++++++ drivers/net/dpaa/dpaa_ethdev.h | 9 +++++++++ drivers/net/dpaa/dpaa_rxtx.c | 9 ++++----- 3 files changed, 31 insertions(+), 5 deletions(-)
drivers/net/dpaa/dpaa_ethdev.c +18 -0
@@ -133,6 +133,8 @@ static const struct rte_dpaa_xstats_name_off dpaa_xstats_strings[] = { };static struct rte_dpaa_driver rte_dpaa_pmd; +int dpaa_valid_dev; +struct rte_mempool *dpaa_tx_sg_pool;static int dpaa_eth_dev_info (struct rte_eth_dev *dev,struct rte_eth_dev_info *dev_info);
@@ -2223,7 +2225,20 @@ rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv,/* Invoke PMD device initialization function */ diag =dpaa_dev_init (eth_dev);if (diag ==0 ) { +if (!dpaa_tx_sg_pool) { + dpaa_tx_sg_pool = +rte_pktmbuf_pool_create ("dpaa_mbuf_tx_sg_pool" , +DPAA_POOL_SIZE , +DPAA_POOL_CACHE_SIZE ,0 , +DPAA_MAX_SGS *sizeof (struct qm_sg_entry ), +rte_socket_id ()); +if (dpaa_tx_sg_pool ==NULL ) { +DPAA_PMD_ERR ("SG pool creation failed\n" ); +return -ENOMEM ; + } + }rte_eth_dev_probing_finish (eth_dev); + dpaa_valid_dev++;return 0 ; }
@@ -2241,6 +2256,9 @@ rte_dpaa_remove(struct rte_dpaa_device *dpaa_dev) eth_dev = dpaa_dev->eth_dev;dpaa_eth_dev_close (eth_dev); + dpaa_valid_dev--; +if (!dpaa_valid_dev) +rte_mempool_free (dpaa_tx_sg_pool); ret =rte_eth_dev_release_port (eth_dev);return ret;
drivers/net/dpaa/dpaa_ethdev.h +9 -0
@@ -33,6 +33,13 @@#define DPAA_SGT_MAX_ENTRIES 16/* maximum number of entries in SG Table */ +/* Maximum SG segments supported on all cores*/ +#define DPAA_MAX_SGS 128 +/* SG pool size */ +#define DPAA_POOL_SIZE 2048 +/* SG pool cache size */ +#define DPAA_POOL_CACHE_SIZE 256 +/* RX queue tail drop threshold (CGR Based) in frame count */ #define CGR_RX_PERFQ_THRESH 256#define CGR_TX_CGR_THRESH 512
@@ -103,6 +110,8 @@#define FMC_FILE "/tmp/fmc.bin" +extern struct rte_mempool *dpaa_tx_sg_pool; +/* Each network interface is represented by one of these */ struct dpaa_if {int valid;
drivers/net/dpaa/dpaa_rxtx.c +4 -5
@@ -803,8 +803,7 @@ uint16_t dpaa_eth_queue_rx(void *q,static int dpaa_eth_mbuf_to_sg_fd (struct rte_mbuf *mbuf, -struct qm_fd *fd, -struct dpaa_bp_info *bp_info) +struct qm_fd *fd) {struct rte_mbuf *cur_seg = mbuf, *prev_seg =NULL ;struct rte_mbuf *temp, *mi;
@@ -813,7 +812,7 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,DPAA_DP_LOG (DEBUG ,"Creating SG FD to transmit" ); - temp =rte_pktmbuf_alloc (bp_info->mp); + temp =rte_pktmbuf_alloc (dpaa_tx_sg_pool);if (!temp) {DPAA_PMD_ERR ("Failure in allocation of mbuf" );return -1 ;
@@ -849,7 +848,7 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, fd->format =QM_FD_SG ; fd->addr = temp->buf_iova; fd->offset = temp->data_off; - fd->bpid = bp_info ? bp_info->bpid :0xff ; + fd->bpid =DPAA_MEMPOOL_TO_BPID (dpaa_tx_sg_pool); fd->length20 = mbuf->pkt_len;while (i <DPAA_SGT_MAX_ENTRIES ) {
@@ -967,7 +966,7 @@ tx_on_dpaa_pool(struct rte_mbuf *mbuf,tx_on_dpaa_pool_unsegmented (mbuf, bp_info, fd_arr); }else if (mbuf->nb_segs >1 && mbuf->nb_segs <=DPAA_SGT_MAX_ENTRIES ) { -if (dpaa_eth_mbuf_to_sg_fd (mbuf, fd_arr, bp_info)) { +if (dpaa_eth_mbuf_to_sg_fd (mbuf, fd_arr)) {DPAA_PMD_DEBUG ("Unable to create Scatter Gather FD" );return 1 ; }
Signature · 1 line
2.25.1
PATCH v2 14/16 bus/dpaa: mempool ops registration change
In reply to Gagandeep Singhmoving the mempool ops registration before DPAA devices probe so that device probe functions can also be able to use mempool operations.
--- drivers/bus/dpaa/dpaa_bus.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/bus/dpaa/dpaa_bus.c +5 -5
@@ -655,6 +655,11 @@ rte_dpaa_bus_probe(void)if (TAILQ_EMPTY (&rte_dpaa_bus.device_list))return 0 ; +/* Register DPAA mempool ops only if any DPAA device has +* been detected. +*/ +rte_mbuf_set_platform_mempool_ops (DPAA_MEMPOOL_OPS_NAME ); + svr_file =fopen (DPAA_SOC_ID_FILE ,"r" );if (svr_file) {if (fscanf (svr_file,"svr:%x" , &svr_ver) >0 )
@@ -704,11 +709,6 @@ rte_dpaa_bus_probe(void) } } -/* Register DPAA mempool ops only if any DPAA device has -* been detected. -*/ -rte_mbuf_set_platform_mempool_ops (DPAA_MEMPOOL_OPS_NAME ); -return 0 ; }
Signature · 1 line
2.25.1
PATCH v2 15/16 net/dpaa: fix buffer free on transmit SG packets
In reply to Gagandeep SinghWhen using SG list to TX with external and direct buffers, HW free direct buffers and driver free external buffers.
Software scans the complete SG mbuf list to find the external buffers to free, but this is wrong as hardware can free the direct buffers if any present in the list and same can be re-allocated for other purpose in multi thread or high speed running traffic environment with new data in it. So the software which is scanning the SG mbuf list, if that list has any direct buffer present then that direct buffer's next pointer can give wrong pointer value, if already freed by hardware which can do the mempool corruption or memory leak.
In this patch instead of relying on user given SG mbuf list we are storing the buffers in an internal list which will be scanned by driver after transmit to free non-direct buffers.
This patch also fixes below issues.
Driver is freeing complete SG list by checking external buffer flag in first segment only, but external buffer can be attached to any of the segment. Because of this, driver either can double free buffers or there can be memory leak.
In case of indirect buffers, driver is modifying the original buffer list to free the indirect buffers but this original buffer list is being used by driver even after transmit packets for non-direct buffer cleanup. This can cause the buffer leak issue.
--- drivers/net/dpaa/dpaa_ethdev.h | 10 ++++++ drivers/net/dpaa/dpaa_rxtx.c | 61 ++++++++++++++++++++++------------ 2 files changed, 49 insertions(+), 22 deletions(-)
drivers/net/dpaa/dpaa_ethdev.h +10 -0
@@ -112,6 +112,16 @@extern struct rte_mempool *dpaa_tx_sg_pool; +/* structure to free external and indirect +* buffers. +*/ +struct dpaa_sw_buf_free { +/* To which packet this segment belongs */ +uint16_t pkt_id; +/* The actual segment */ +struct rte_mbuf *seg; +}; +/* Each network interface is represented by one of these */ struct dpaa_if {int valid;
drivers/net/dpaa/dpaa_rxtx.c +39 -22
132 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 16/16 net/dpaa: fix buffer free in slow path
In reply to Gagandeep SinghIf there is any error in packet or taildrop feature is enabled, HW can reject those packets and put them in error queue. Driver poll this error queue to free the buffers.
DPAA driver has an issue while freeing these rejected buffers. In case of scatter gather packets, it is preparing the mbuf SG list by scanning the HW descriptors and once the mbuf SG list prepared, it free only first segment of the mbuf SG list by calling the API rte_pktmbuf_free_seg(), This will leak the memory of other segments and mempool can be empty.
Also there is one more issue, external buffer's memory may not belong to mempool so driver itself free the external buffer after successfully send the packet to HW to transmit instead of let the HW to free it. So transmit function free all the external buffers. But driver has no check for external buffers while freeing the rejected buffers and this can do double free the memory which can corrupt the user pool and crashes and undefined behaviour of system can be seen.
This patch fixes the above mentioned issue by checking each and every segment and freeing all the segments except external.
--- drivers/net/dpaa/dpaa_rxtx.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
drivers/net/dpaa/dpaa_rxtx.c +8 -15
@@ -455,7 +455,7 @@ dpaa_free_mbuf(const struct qm_fd *fd) bp_info =DPAA_BPID_TO_POOL_INFO (fd->bpid); format = (fd->opaque &DPAA_FD_FORMAT_MASK ) >>DPAA_FD_FORMAT_SHIFT ;if (unlikely (format == qm_fd_sg)) { -struct rte_mbuf *first_seg, *prev_seg, *cur_seg, *temp; +struct rte_mbuf *first_seg, *cur_seg;struct qm_sg_entry *sgt, *sg_temp;void *vaddr, *sg_vaddr;int i =0 ;
@@ -469,32 +469,25 @@ dpaa_free_mbuf(const struct qm_fd *fd) sgt = vaddr + fd_offset; sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - temp = (struct rte_mbuf *) - ((char *)vaddr - bp_info->meta_data_size); sg_vaddr =DPAA_MEMPOOL_PTOV (bp_info,qm_sg_entry_get64 (sg_temp)); - first_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); first_seg->nb_segs =1 ; - prev_seg = first_seg;while (i <DPAA_SGT_MAX_ENTRIES ) { sg_temp = &sgt[i++];hw_sg_to_cpu (sg_temp); - sg_vaddr =DPAA_MEMPOOL_PTOV (bp_info, +if (sg_temp->bpid !=0xFF ) { + bp_info =DPAA_BPID_TO_POOL_INFO (sg_temp->bpid); + sg_vaddr =DPAA_MEMPOOL_PTOV (bp_info,qm_sg_entry_get64 (sg_temp)); - cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - + cur_seg = (struct rte_mbuf *)((char *)sg_vaddr - bp_info->meta_data_size); - first_seg->nb_segs +=1 ; - prev_seg->next = cur_seg; -if (sg_temp->final) { - cur_seg->next =NULL ; -break ; +rte_pktmbuf_free_seg (cur_seg); } - prev_seg = cur_seg; +if (sg_temp->final) +break ; } - -rte_pktmbuf_free_seg (temp);rte_pktmbuf_free_seg (first_seg);return 0 ; }
Signature · 1 line
2.25.1
Quoted 27 lines · Gagandeep Singh
This series have list of patch for bug fixes and
some enhancements to DPAA1 and DPAA2 net drivers.v2-change-log:
* update commit messages
* update DPAA NIC doc for kernel version matching
* update DPAA supported packet type info
* Freeing the internal pool on last device remove
* fixes syntax for some commentsApeksha Gupta (2):
net/enetfec: fix restart issue
net/enetfec: fix buffer leak issueBrick Yang (1):
net/dpaa2: check free enqueue descriptors before TxGagandeep Singh (8):
net/dpaa: support ESP packet type in packet parsing net/dpaa2: use internal mempool for SG table net/dpaa2: fix buffer free on transmit SG packets
doc: add kernel version compatible information net/dpaa: use internal mempool for SG table bus/dpaa: mempool ops registration change net/dpaa: fix buffer free on transmit SG packets net/dpaa: fix buffer free in slow path
Quoted 9 lines
Rohit Raj (3):
bus/fslmc: add timeout in MC send command API net/dpaa: fix Jumbo packet Rx in case of VSP bus/dpaa: pass interface name as a string instead of pointerVanshika Shukla (2):
bus/dpaa: use non-block mode for FD open net/dpaa2: fix dpdmux configuration for error behaviour
Series applied to dpdk-next-net/main, thanks.