[PATCH] app/test-pmd: fix L4 checksum with padding data
IEEE 802 packets may have a minimum size limit. The data fields should be padded when necessary. In some cases, the padding data is not zero. Testpmd does not trim these IP packets to the true length of the frame, so errors will occur when calculating TCP or UDP checksum. This commit fixes this issue by triming IP packets to the true length of the frame in testpmd. Fixes: 03d17e4d0179 ("app/testpmd: do not change IP addrs in checksum engine") Cc: sta...@dpdk.org Signed-off-by: Kaiwen Deng --- app/test-pmd/csumonly.c | 32 1 file changed, 32 insertions(+) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 7af635e3f7..58b72b714a 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -853,12 +853,14 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) uint16_t nb_rx; uint16_t nb_prep; uint16_t i; + uint16_t pad_len; uint64_t rx_ol_flags, tx_ol_flags; uint64_t tx_offloads; uint32_t rx_bad_ip_csum; uint32_t rx_bad_l4_csum; uint32_t rx_bad_outer_l4_csum; uint32_t rx_bad_outer_ip_csum; + uint32_t l3_off; struct testpmd_offload_info info; /* receive a burst of packet */ @@ -980,6 +982,36 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) l3_hdr = (char *)l3_hdr + info.outer_l3_len + info.l2_len; } + if (info.is_tunnel) { + l3_off = info.outer_l2_len + + info.outer_l3_len + + info.l2_len; + } else { + l3_off = info.l2_len; + } + switch (info.ethertype) { + case _htons(RTE_ETHER_TYPE_IPV4): + pad_len = rte_pktmbuf_data_len(m) - + (l3_off + + rte_be_to_cpu_16( + ((struct rte_ipv4_hdr *)l3_hdr)->total_length)); + break; + case _htons(RTE_ETHER_TYPE_IPV6): + pad_len = rte_pktmbuf_data_len(m) - + (l3_off + + rte_be_to_cpu_16( + ((struct rte_ipv6_hdr *)l3_hdr)->payload_len)); + break; + default: + pad_len = 0; + break; + } + + if (pad_len) { + rte_pktmbuf_data_len(m) = rte_pktmbuf_data_len(m) - pad_len; + rte_pktmbuf_pkt_len(m) = rte_pktmbuf_data_len(m); + } + /* step 2: depending on user command line configuration, * recompute checksum either in software or flag the * mbuf to offload the calculation to the NIC. If TSO -- 2.34.1
[PATCH v10 0/4] Recycle mbufs from Tx queue into Rx queue
Currently, the transmit side frees the buffers into the lcore cache and the receive side allocates buffers from the lcore cache. The transmit side typically frees 32 buffers resulting in 32*8=256B of stores to lcore cache. The receive side allocates 32 buffers and stores them in the receive side software ring, resulting in 32*8=256B of stores and 256B of load from the lcore cache. This patch proposes a mechanism to avoid freeing to/allocating from the lcore cache. i.e. the receive side will free the buffers from transmit side directly into its software ring. This will avoid the 256B of loads and stores introduced by the lcore cache. It also frees up the cache lines used by the lcore cache. And we can call this mode as mbufs recycle mode. In the latest version, mbufs recycle mode is packaged as a separate API. This allows for the users to change rxq/txq pairing in real time in data plane, according to the analysis of the packet flow by the application, for example: --- Step 1: upper application analyse the flow direction Step 2: recycle_rxq_info = rte_eth_recycle_rx_queue_info_get(rx_portid, rx_queueid) Step 3: rte_eth_recycle_mbufs(rx_portid, rx_queueid, tx_portid, tx_queueid, recycle_rxq_info); Step 4: rte_eth_rx_burst(rx_portid,rx_queueid); Step 5: rte_eth_tx_burst(tx_portid,tx_queueid); --- Above can support user to change rxq/txq pairing at run-time and user does not need to know the direction of flow in advance. This can effectively expand mbufs recycle mode's use scenarios. Furthermore, mbufs recycle mode is no longer limited to the same pmd, it can support moving mbufs between different vendor pmds, even can put the mbufs anywhere into your Rx mbuf ring as long as the address of the mbuf ring can be provided. In the latest version, we enable mbufs recycle mode in i40e pmd and ixgbe pmd, and also try to use i40e driver in Rx, ixgbe driver in Tx, and then achieve 7-9% performance improvement by mbufs recycle mode. Difference between mbuf recycle, ZC API used in mempool and general path For general path: Rx: 32 pkts memcpy from mempool cache to rx_sw_ring Tx: 32 pkts memcpy from tx_sw_ring to temporary variable + 32 pkts memcpy from temporary variable to mempool cache For ZC API used in mempool: Rx: 32 pkts memcpy from mempool cache to rx_sw_ring Tx: 32 pkts memcpy from tx_sw_ring to zero-copy mempool cache Refer link: http://patches.dpdk.org/project/dpdk/patch/20230221055205.22984-2-kamalakshitha.alig...@arm.com/ For mbufs recycle: Rx/Tx: 32 pkts memcpy from tx_sw_ring to rx_sw_ring Thus we can see in the one loop, compared to general path, mbufs recycle mode reduces 32+32=64 pkts memcpy; Compared to ZC API used in mempool, we can see mbufs recycle mode reduce 32 pkts memcpy in each loop. So, mbufs recycle has its own benefits. Testing status: (1) dpdk l3fwd test with multiple drivers: port 0: 82599 NIC port 1: XL710 NIC - Without fast free With fast free Thunderx2: +7.53% +13.54% - (2) dpdk l3fwd test with same driver: port 0 && 1: XL710 NIC - Without fast free With fast free Ampere altra: +12.61% +11.42% n1sdp: +8.30% +3.85% x86-sse:+8.43% +3.72% - (3) Performance comparison with ZC_mempool used port 0 && 1: XL710 NIC with fast free - With recycle buffer With zc_mempool Ampere altra: 11.42% 3.54% - Furthermore, we add recycle_mbuf engine in testpmd. Due to XL710 NIC has I/O bottleneck in testpmd in ampere altra, we can not see throughput change compared with I/O fwd engine. However, using record cmd in testpmd: '$set record-burst-stats on' we can see the ratio of 'Rx/Tx burst size of 32' is reduced. This indicate mbufs recycle can save CPU cycles. V2: 1. Use data-plane API to enable direct-rearm (Konstantin, Honnappa) 2. Add 'txq_data_get' API to get txq info for Rx (Konstantin) 3. Use input parameter to enable direct rearm in l3fwd (Konstantin) 4. Add condition detection for direct rearm API (Morten, Andrew Rybchenko) V3: 1. Seperate Rx and Tx operation with two APIs in direct-rearm (Konstantin) 2. Delete L3fwd change for direct rearm (Jerin) 3. enable direct rearm in ixgbe driver in Arm v4: 1. Rename direct-rearm as buffer recycle. Based on this, function name and variable name are changed to let this m
[PATCH v10 1/4] ethdev: add API for mbufs recycle mode
Add 'rte_eth_recycle_rx_queue_info_get' and 'rte_eth_recycle_mbufs' APIs to recycle used mbufs from a transmit queue of an Ethernet device, and move these mbufs into a mbuf ring for a receive queue of an Ethernet device. This can bypass mempool 'put/get' operations hence saving CPU cycles. For each recycling mbufs, the rte_eth_recycle_mbufs() function performs the following operations: - Copy used *rte_mbuf* buffer pointers from Tx mbuf ring into Rx mbuf ring. - Replenish the Rx descriptors with the recycling *rte_mbuf* mbufs freed from the Tx mbuf ring. Suggested-by: Honnappa Nagarahalli Suggested-by: Ruifeng Wang Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang Reviewed-by: Honnappa Nagarahalli Acked-by: Morten Brørup --- doc/guides/rel_notes/release_23_11.rst | 15 ++ lib/ethdev/ethdev_driver.h | 10 ++ lib/ethdev/ethdev_private.c| 2 + lib/ethdev/rte_ethdev.c| 31 + lib/ethdev/rte_ethdev.h| 181 + lib/ethdev/rte_ethdev_core.h | 23 +++- lib/ethdev/version.map | 3 + 7 files changed, 259 insertions(+), 6 deletions(-) diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index 6b4dd21fd0..fd16d267ae 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -55,6 +55,13 @@ New Features Also, make sure to start the actual text at the margin. === +* **Add mbufs recycling support. ** + + Added ``rte_eth_recycle_rx_queue_info_get`` and ``rte_eth_recycle_mbufs`` + APIs which allow the user to copy used mbufs from the Tx mbuf ring + into the Rx mbuf ring. This feature supports the case that the Rx Ethernet + device is different from the Tx Ethernet device with respective driver + callback functions in ``rte_eth_recycle_mbufs``. Removed Items - @@ -100,6 +107,14 @@ ABI Changes Also, make sure to start the actual text at the margin. === +* ethdev: Added ``recycle_tx_mbufs_reuse`` and ``recycle_rx_descriptors_refill`` + fields to ``rte_eth_dev`` structure. + +* ethdev: Structure ``rte_eth_fp_ops`` was affected to add + ``recycle_tx_mbufs_reuse`` and ``recycle_rx_descriptors_refill`` + fields, to move ``rxq`` and ``txq`` fields, to change the size of + ``reserved1`` and ``reserved2`` fields. + Known Issues diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index 980f837ab6..b0c55a8523 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -58,6 +58,10 @@ struct rte_eth_dev { eth_rx_descriptor_status_t rx_descriptor_status; /** Check the status of a Tx descriptor */ eth_tx_descriptor_status_t tx_descriptor_status; + /** Pointer to PMD transmit mbufs reuse function */ + eth_recycle_tx_mbufs_reuse_t recycle_tx_mbufs_reuse; + /** Pointer to PMD receive descriptors refill function */ + eth_recycle_rx_descriptors_refill_t recycle_rx_descriptors_refill; /** * Device data that is shared between primary and secondary processes @@ -507,6 +511,10 @@ typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev, typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev, uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo); +typedef void (*eth_recycle_rxq_info_get_t)(struct rte_eth_dev *dev, + uint16_t rx_queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info); + typedef int (*eth_burst_mode_get_t)(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_burst_mode *mode); @@ -1250,6 +1258,8 @@ struct eth_dev_ops { eth_rxq_info_get_t rxq_info_get; /** Retrieve Tx queue information */ eth_txq_info_get_t txq_info_get; + /** Retrieve mbufs recycle Rx queue information */ + eth_recycle_rxq_info_get_t recycle_rxq_info_get; eth_burst_mode_get_t rx_burst_mode_get; /**< Get Rx burst mode */ eth_burst_mode_get_t tx_burst_mode_get; /**< Get Tx burst mode */ eth_fw_version_get_t fw_version_get; /**< Get firmware version */ diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c index 14ec8c6ccf..f8ab64f195 100644 --- a/lib/ethdev/ethdev_private.c +++ b/lib/ethdev/ethdev_private.c @@ -277,6 +277,8 @@ eth_dev_fp_ops_setup(struct rte_eth_fp_ops *fpo, fpo->rx_queue_count = dev->rx_queue_count; fpo->rx_descriptor_status = dev->rx_descriptor_status; fpo->tx_descriptor_status = dev->tx_descriptor_status; + fpo->recycle_tx_mbufs_reuse = dev->recycle_tx_mbufs_reuse; + fpo->recycle_rx_descriptors_refill = dev->recycle_rx_descriptors_refill; fpo->rxq.data = dev->data->rx_queues; fpo->rxq.clbk = (void **)(uintptr_t)dev->post_rx_burst_cbs; diff --git a/lib/ethdev/rte_e
[PATCH v10 2/4] net/i40e: implement mbufs recycle mode
Define specific function implementation for i40e driver. Currently, mbufs recycle mode can support 128bit vector path and avx2 path. And can be enabled both in fast free and no fast free mode. Suggested-by: Honnappa Nagarahalli Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang Reviewed-by: Honnappa Nagarahalli --- drivers/net/i40e/i40e_ethdev.c| 1 + drivers/net/i40e/i40e_ethdev.h| 2 + .../net/i40e/i40e_recycle_mbufs_vec_common.c | 147 ++ drivers/net/i40e/i40e_rxtx.c | 32 drivers/net/i40e/i40e_rxtx.h | 4 + drivers/net/i40e/meson.build | 1 + 6 files changed, 187 insertions(+) create mode 100644 drivers/net/i40e/i40e_recycle_mbufs_vec_common.c diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 8271bbb394..50ba9aac94 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -496,6 +496,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .flow_ops_get = i40e_dev_flow_ops_get, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, + .recycle_rxq_info_get = i40e_recycle_rxq_info_get, .rx_burst_mode_get= i40e_rx_burst_mode_get, .tx_burst_mode_get= i40e_tx_burst_mode_get, .timesync_enable = i40e_timesync_enable, diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 6f65d5e0ac..af758798e1 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -1355,6 +1355,8 @@ void i40e_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo); void i40e_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo); +void i40e_recycle_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info); int i40e_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_burst_mode *mode); int i40e_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id, diff --git a/drivers/net/i40e/i40e_recycle_mbufs_vec_common.c b/drivers/net/i40e/i40e_recycle_mbufs_vec_common.c new file mode 100644 index 00..5663ecccde --- /dev/null +++ b/drivers/net/i40e/i40e_recycle_mbufs_vec_common.c @@ -0,0 +1,147 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2023 Arm Limited. + */ + +#include +#include + +#include "base/i40e_prototype.h" +#include "base/i40e_type.h" +#include "i40e_ethdev.h" +#include "i40e_rxtx.h" + +#pragma GCC diagnostic ignored "-Wcast-qual" + +void +i40e_recycle_rx_descriptors_refill_vec(void *rx_queue, uint16_t nb_mbufs) +{ + struct i40e_rx_queue *rxq = rx_queue; + struct i40e_rx_entry *rxep; + volatile union i40e_rx_desc *rxdp; + uint16_t rx_id; + uint64_t paddr; + uint64_t dma_addr; + uint16_t i; + + rxdp = rxq->rx_ring + rxq->rxrearm_start; + rxep = &rxq->sw_ring[rxq->rxrearm_start]; + + for (i = 0; i < nb_mbufs; i++) { + /* Initialize rxdp descs. */ + paddr = (rxep[i].mbuf)->buf_iova + RTE_PKTMBUF_HEADROOM; + dma_addr = rte_cpu_to_le_64(paddr); + /* flush desc with pa dma_addr */ + rxdp[i].read.hdr_addr = 0; + rxdp[i].read.pkt_addr = dma_addr; + } + + /* Update the descriptor initializer index */ + rxq->rxrearm_start += nb_mbufs; + rx_id = rxq->rxrearm_start - 1; + + if (unlikely(rxq->rxrearm_start >= rxq->nb_rx_desc)) { + rxq->rxrearm_start = 0; + rx_id = rxq->nb_rx_desc - 1; + } + + rxq->rxrearm_nb -= nb_mbufs; + + rte_io_wmb(); + /* Update the tail pointer on the NIC */ + I40E_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rx_id); +} + +uint16_t +i40e_recycle_tx_mbufs_reuse_vec(void *tx_queue, + struct rte_eth_recycle_rxq_info *recycle_rxq_info) +{ + struct i40e_tx_queue *txq = tx_queue; + struct i40e_tx_entry *txep; + struct rte_mbuf **rxep; + int i, n; + uint16_t nb_recycle_mbufs; + uint16_t avail = 0; + uint16_t mbuf_ring_size = recycle_rxq_info->mbuf_ring_size; + uint16_t mask = recycle_rxq_info->mbuf_ring_size - 1; + uint16_t refill_requirement = recycle_rxq_info->refill_requirement; + uint16_t refill_head = *recycle_rxq_info->refill_head; + uint16_t receive_tail = *recycle_rxq_info->receive_tail; + + /* Get available recycling Rx buffers. */ + avail = (mbuf_ring_size - (refill_head - receive_tail)) & mask; + + /* Check Tx free thresh and Rx available space. */ + if (txq->nb_tx_free > txq->tx_free_thresh || avail <= txq->tx_rs_thresh) + return 0; + + /* check DD bits on threshold descr
[PATCH v10 3/4] net/ixgbe: implement mbufs recycle mode
Define specific function implementation for ixgbe driver. Currently, recycle buffer mode can support 128bit vector path. And can be enabled both in fast free and no fast free mode. Suggested-by: Honnappa Nagarahalli Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang Reviewed-by: Honnappa Nagarahalli --- drivers/net/ixgbe/ixgbe_ethdev.c | 1 + drivers/net/ixgbe/ixgbe_ethdev.h | 3 + .../ixgbe/ixgbe_recycle_mbufs_vec_common.c| 143 ++ drivers/net/ixgbe/ixgbe_rxtx.c| 37 - drivers/net/ixgbe/ixgbe_rxtx.h| 4 + drivers/net/ixgbe/meson.build | 2 + 6 files changed, 188 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ixgbe/ixgbe_recycle_mbufs_vec_common.c diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 14a7d571e0..ea4c9dd561 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -543,6 +543,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .set_mc_addr_list = ixgbe_dev_set_mc_addr_list, .rxq_info_get = ixgbe_rxq_info_get, .txq_info_get = ixgbe_txq_info_get, + .recycle_rxq_info_get = ixgbe_recycle_rxq_info_get, .timesync_enable = ixgbe_timesync_enable, .timesync_disable = ixgbe_timesync_disable, .timesync_read_rx_timestamp = ixgbe_timesync_read_rx_timestamp, diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 1291e9099c..22fc3be3d8 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -626,6 +626,9 @@ void ixgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, void ixgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo); +void ixgbe_recycle_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_recycle_rxq_info *recycle_rxq_info); + int ixgbevf_dev_rx_init(struct rte_eth_dev *dev); void ixgbevf_dev_tx_init(struct rte_eth_dev *dev); diff --git a/drivers/net/ixgbe/ixgbe_recycle_mbufs_vec_common.c b/drivers/net/ixgbe/ixgbe_recycle_mbufs_vec_common.c new file mode 100644 index 00..9a8cc86954 --- /dev/null +++ b/drivers/net/ixgbe/ixgbe_recycle_mbufs_vec_common.c @@ -0,0 +1,143 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2023 Arm Limited. + */ + +#include +#include + +#include "ixgbe_ethdev.h" +#include "ixgbe_rxtx.h" + +#pragma GCC diagnostic ignored "-Wcast-qual" + +void +ixgbe_recycle_rx_descriptors_refill_vec(void *rx_queue, uint16_t nb_mbufs) +{ + struct ixgbe_rx_queue *rxq = rx_queue; + struct ixgbe_rx_entry *rxep; + volatile union ixgbe_adv_rx_desc *rxdp; + uint16_t rx_id; + uint64_t paddr; + uint64_t dma_addr; + uint16_t i; + + rxdp = rxq->rx_ring + rxq->rxrearm_start; + rxep = &rxq->sw_ring[rxq->rxrearm_start]; + + for (i = 0; i < nb_mbufs; i++) { + /* Initialize rxdp descs. */ + paddr = (rxep[i].mbuf)->buf_iova + RTE_PKTMBUF_HEADROOM; + dma_addr = rte_cpu_to_le_64(paddr); + /* Flush descriptors with pa dma_addr */ + rxdp[i].read.hdr_addr = 0; + rxdp[i].read.pkt_addr = dma_addr; + } + + /* Update the descriptor initializer index */ + rxq->rxrearm_start += nb_mbufs; + if (rxq->rxrearm_start >= rxq->nb_rx_desc) + rxq->rxrearm_start = 0; + + rxq->rxrearm_nb -= nb_mbufs; + + rx_id = (uint16_t)((rxq->rxrearm_start == 0) ? + (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); + + /* Update the tail pointer on the NIC */ + IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, rx_id); +} + +uint16_t +ixgbe_recycle_tx_mbufs_reuse_vec(void *tx_queue, + struct rte_eth_recycle_rxq_info *recycle_rxq_info) +{ + struct ixgbe_tx_queue *txq = tx_queue; + struct ixgbe_tx_entry *txep; + struct rte_mbuf **rxep; + int i, n; + uint32_t status; + uint16_t nb_recycle_mbufs; + uint16_t avail = 0; + uint16_t mbuf_ring_size = recycle_rxq_info->mbuf_ring_size; + uint16_t mask = recycle_rxq_info->mbuf_ring_size - 1; + uint16_t refill_requirement = recycle_rxq_info->refill_requirement; + uint16_t refill_head = *recycle_rxq_info->refill_head; + uint16_t receive_tail = *recycle_rxq_info->receive_tail; + + /* Get available recycling Rx buffers. */ + avail = (mbuf_ring_size - (refill_head - receive_tail)) & mask; + + /* Check Tx free thresh and Rx available space. */ + if (txq->nb_tx_free > txq->tx_free_thresh || avail <= txq->tx_rs_thresh) + return 0; + + /* check DD bits on threshold descriptor */ + status = txq->tx_ring[txq->tx_next_dd].wb.status; + if (!(status & IXGBE_ADVTXD_STAT_DD)) + return 0; +
[PATCH v10 4/4] app/testpmd: add recycle mbufs engine
Add recycle mbufs engine for testpmd. This engine forward pkts with I/O forward mode. But enable mbufs recycle feature to recycle used txq mbufs for rxq mbuf ring, which can bypass mempool path and save CPU cycles. Suggested-by: Jerin Jacob Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang --- app/test-pmd/meson.build| 1 + app/test-pmd/recycle_mbufs.c| 58 + app/test-pmd/testpmd.c | 1 + app/test-pmd/testpmd.h | 3 ++ doc/guides/testpmd_app_ug/run_app.rst | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +- 6 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 app/test-pmd/recycle_mbufs.c diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index d2e3f60892..6e5f067274 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -22,6 +22,7 @@ sources = files( 'macswap.c', 'noisy_vnf.c', 'parameters.c', + 'recycle_mbufs.c', 'rxonly.c', 'shared_rxq_fwd.c', 'testpmd.c', diff --git a/app/test-pmd/recycle_mbufs.c b/app/test-pmd/recycle_mbufs.c new file mode 100644 index 00..6e9e1c5eb6 --- /dev/null +++ b/app/test-pmd/recycle_mbufs.c @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2023 Arm Limited. + */ + +#include "testpmd.h" + +/* + * Forwarding of packets in I/O mode. + * Enable mbufs recycle mode to recycle txq used mbufs + * for rxq mbuf ring. This can bypass mempool path and + * save CPU cycles. + */ +static bool +pkt_burst_recycle_mbufs(struct fwd_stream *fs) +{ + struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; + uint16_t nb_rx; + + /* Recycle used mbufs from the txq, and move these mbufs into +* the rxq mbuf ring. +*/ + rte_eth_recycle_mbufs(fs->rx_port, fs->rx_queue, + fs->tx_port, fs->tx_queue, &(fs->recycle_rxq_info)); + + /* +* Receive a burst of packets and forward them. +*/ + nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst); + if (unlikely(nb_rx == 0)) + return false; + + common_fwd_stream_transmit(fs, pkts_burst, nb_rx); + + return true; +} + +static void +recycle_mbufs_stream_init(struct fwd_stream *fs) +{ + int rc; + + /* Retrieve information about given ports's Rx queue +* for recycling mbufs. +*/ + rc = rte_eth_recycle_rx_queue_info_get(fs->rx_port, + fs->rx_queue, &(fs->recycle_rxq_info)); + if (rc != 0) + TESTPMD_LOG(WARNING, + "Failed to get rx queue mbufs recycle info\n"); + + common_fwd_stream_init(fs); +} + +struct fwd_engine recycle_mbufs_engine = { + .fwd_mode_name = "recycle_mbufs", + .stream_init= recycle_mbufs_stream_init, + .packet_fwd = pkt_burst_recycle_mbufs, +}; diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 938ca035d4..5d0f9ca119 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -199,6 +199,7 @@ struct fwd_engine * fwd_engines[] = { &icmp_echo_engine, &noisy_vnf_engine, &five_tuple_swap_fwd_engine, + &recycle_mbufs_engine, #ifdef RTE_LIBRTE_IEEE1588 &ieee1588_fwd_engine, #endif diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index f1df6a8faf..0eb8d7883a 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -188,6 +188,8 @@ struct fwd_stream { struct pkt_burst_stats rx_burst_stats; struct pkt_burst_stats tx_burst_stats; struct fwd_lcore *lcore; /**< Lcore being scheduled. */ + /**< Rx queue information for recycling mbufs */ + struct rte_eth_recycle_rxq_info recycle_rxq_info; }; /** @@ -449,6 +451,7 @@ extern struct fwd_engine csum_fwd_engine; extern struct fwd_engine icmp_echo_engine; extern struct fwd_engine noisy_vnf_engine; extern struct fwd_engine five_tuple_swap_fwd_engine; +extern struct fwd_engine recycle_mbufs_engine; #ifdef RTE_LIBRTE_IEEE1588 extern struct fwd_engine ieee1588_fwd_engine; #endif diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 6e9c552e76..24a086401e 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -232,6 +232,7 @@ The command line options are: noisy 5tswap shared-rxq + recycle_mbufs * ``--rss-ip`` diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index a182479ab2..aef4de3e0e 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -318,7 +318,7 @@ set fwd Set the packet forwarding mode:: testpmd> set fwd (io|mac|macswap|flowgen| \ - rxonly|txonly|csum|icmpecho|noisy|5tswap|shared-rxq) (""|retry) + r
Re: [PATCH v3] doc: build manpages as well as html output
On Thu, Aug 3, 2023 at 6:44 PM Bruce Richardson wrote: > > Doxygen can produce manpage output as well as html output for the DPDK > APIs. However, we need to do this as a separate task as the manpage > output needs to be placed in a different location post-install to the > html output (/usr/local/share/man vs /usr/local/share/doc/). > > Changes required are: > * Add configurable options for manpage output and html output to the > doxygen config template. (Remove option for html output path as it's > always "html") > * Modify API meson.build file to configure two separate doxygen config > files, for HTML and manpages respectively. > * Change doxygen wrapper script to have separate output log files for > the manpage and HTML jobs, to avoid conflicts > * Add "custom_targets" to meson.build file to build the HTML pages and > the manpages, with individual install locations for each. > * Where supported by meson version, call "mandb" post-install to update > the man database to ensure the new manpages can be found. > > Signed-off-by: Bruce Richardson > Reviewed-by: David Marchand > > --- > > V3: don't use full file paths when generating manpages Nice! Thank you Bruce. -- David Marchand
Re: [PATCH v2 0/2] Remove disabled functionality
On Tue, Aug 1, 2023 at 6:05 PM Stephen Hemminger wrote: > > The KNI and flow_classify library were already marked disabled > in 23.11 release. > > Stephen Hemminger (2): > flow_classify: remove library > kni: remove deprecated kernel network interface > > MAINTAINERS | 17 - > app/test/meson.build | 6 - > app/test/test_flow_classify.c | 895 -- > app/test/test_flow_classify.h | 26 - > app/test/test_kni.c | 740 --- > doc/api/doxy-api-index.md | 3 - > doc/api/doxy-api.conf.in | 2 - > doc/guides/contributing/documentation.rst | 4 +- > doc/guides/freebsd_gsg/build_sample_apps.rst | 2 +- > doc/guides/freebsd_gsg/install_from_ports.rst | 2 +- > doc/guides/howto/flow_bifurcation.rst | 3 +- > doc/guides/nics/index.rst | 1 - > doc/guides/nics/kni.rst | 170 > doc/guides/nics/virtio.rst| 92 +- > .../prog_guide/env_abstraction_layer.rst | 2 - > doc/guides/prog_guide/flow_classify_lib.rst | 424 - > doc/guides/prog_guide/glossary.rst| 3 - > doc/guides/prog_guide/index.rst | 2 - > .../prog_guide/kernel_nic_interface.rst | 423 - > doc/guides/prog_guide/packet_framework.rst| 9 +- > doc/guides/rel_notes/deprecation.rst | 15 +- > doc/guides/rel_notes/release_23_11.rst| 4 + > doc/guides/sample_app_ug/flow_classify.rst| 242 - > doc/guides/sample_app_ug/index.rst| 1 - > doc/guides/sample_app_ug/ip_pipeline.rst | 22 - > drivers/net/cnxk/cnxk_ethdev.c| 2 +- > drivers/net/kni/meson.build | 11 - > drivers/net/kni/rte_eth_kni.c | 524 -- > drivers/net/meson.build | 1 - > examples/flow_classify/Makefile | 51 - > examples/flow_classify/flow_classify.c| 878 - > examples/flow_classify/ipv4_rules_file.txt| 14 - > examples/flow_classify/meson.build| 13 - > examples/ip_pipeline/Makefile | 1 - > examples/ip_pipeline/cli.c| 95 -- > examples/ip_pipeline/examples/kni.cli | 69 -- > examples/ip_pipeline/kni.c| 168 > examples/ip_pipeline/kni.h| 46 - > examples/ip_pipeline/main.c | 10 - > examples/ip_pipeline/meson.build | 1 - > examples/ip_pipeline/pipeline.c | 57 -- > examples/ip_pipeline/pipeline.h | 2 - > examples/meson.build | 1 - > kernel/linux/kni/Kbuild | 6 - > kernel/linux/kni/compat.h | 157 --- > kernel/linux/kni/kni_dev.h| 137 --- > kernel/linux/kni/kni_fifo.h | 87 -- > kernel/linux/kni/kni_misc.c | 719 -- > kernel/linux/kni/kni_net.c| 878 - > kernel/linux/kni/meson.build | 41 - > kernel/linux/meson.build | 2 +- > lib/eal/common/eal_common_log.c | 1 - > lib/eal/include/rte_log.h | 2 +- > lib/eal/linux/eal.c | 19 - > lib/flow_classify/meson.build | 12 - > lib/flow_classify/rte_flow_classify.c | 670 - > lib/flow_classify/rte_flow_classify.h | 284 -- > lib/flow_classify/rte_flow_classify_parse.c | 532 --- > lib/flow_classify/rte_flow_classify_parse.h | 58 -- > lib/flow_classify/version.map | 13 - > lib/kni/meson.build | 21 - > lib/kni/rte_kni.c | 843 - > lib/kni/rte_kni.h | 269 -- > lib/kni/rte_kni_common.h | 147 --- > lib/kni/rte_kni_fifo.h| 117 --- > lib/kni/version.map | 24 - > lib/meson.build | 9 - > lib/port/meson.build | 6 - > lib/port/rte_port_kni.c | 515 -- > lib/port/rte_port_kni.h | 63 -- > lib/port/version.map | 3 - > meson_options.txt | 2 +- > 72 files changed, 18 insertions(+), 10673 deletions(-) > delete mode 100644 app/test/test_flow_classify.c > delete mode 100644 app/test/test_flow_classify.h > delete mode 100644 app/test/test_kni.c > delete mode 100644 doc/guides/nics/kni.rst > delete mode 100644 doc/guides/prog_guide/flow_classify_lib.rst > delete mode 100644 doc/guides/prog_guide/kernel_nic_interface.rst > delete mode 100644 doc/guides/sample_app_ug/flow_classi
Re: [PATCH] eal: remove RTE_FUNC_PTR_* deprecated macros
On Thu, Aug 3, 2023 at 11:43 AM Bruce Richardson wrote: > > On Thu, Aug 03, 2023 at 11:41:18AM +0200, David Marchand wrote: > > The RTE_FUNC_PTR_OR_* macros were marked as deprecated in v22.11, we can > > remove them. > > > > Signed-off-by: David Marchand > > --- > Acked-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Tyler Retzlaff Applied, thanks. -- David Marchand
Re: [PATCH] ci: fix race on container image name
On Wed, Aug 2, 2023 at 2:44 PM Aaron Conole wrote: > David Marchand writes: > > > We had a race on the container image name when the prepare job was > > running a day before the build job was triggered. > > > > Example: > > - a prepare job generated image name on 2023/08/01: > > > > 2023-08-01T23:59:32.9711845Z ++ date -u +%Y-%m-%d > > 2023-08-01T23:59:32.9713485Z + echo image=image-fedora:37-2023-08-01 > > > > - a few seconds later, the build jobs tried to use a different > > image name on 2023/08/02: > > > > 2023-08-02T00:01:29.9103180Z ++ date -u +%Y-%m-%d > > 2023-08-02T00:01:29.9113486Z + echo image=image-fedora:37-2023-08-02 > > > > Fix this by directly reusing the prepare job output. > > > > Fixes: b35c4b0aa2bc ("ci: add Fedora 35 container in GHA") > > Cc: sta...@dpdk.org > > > > Signed-off-by: David Marchand > Acked-by: Aaron Conole Applied, thanks. -- David Marchand
RE: [PATCH v1] examples/l3fwd: relax the RSS/Offload requirement
Hi Tao, > HI Konstantin: > > I do understand your requirement on the SW support for the IPV4 cksum > verification, and I think it really can be added here later > some time when missing HW support. > Anyway, there is a "warning:" message had been sent out to notify the user > there is a lack of HW capability support for packets, and it > would enable this missing case can run smoothly for some urgent users which > really exist with our experiences. > On the other side, maybe another hint of "warning: no HW check for IPv4 > checksum" or something alike could be helpful to users > before the SW support added. As I already said, right now l3fwd relies on these HW features to provide essential part of its expected functionality. Removing these checks mean that l3fwd will start to behave differently (depending on the HW). To me it is sort of change in behavior and break of existing functionality. I am afraid that simply printing a warning message is not enough here. Till SW equivalent for reduced HW offloads in place, my vote is NACK for this patch. Konstantin P.S. as a side note - usually for dev mailing list, we use to put reply inline, not on top of the message. > Thanks, > > Best Regards, > > Zijin Tao(Trevor Tao, 陶孜谨) > ARM Electronic Technology (Shanghai) Co., Ltd > 安谋电子科技(上海)有限公司 > Building 11, Shanghai Busininess ParkⅢ , > No.1016 Tianlin Rd, Minhang District, Shanghai, 200233 China > 上海市闵行区田林路1016号科技绿洲三期2号楼10楼,200233 > Cell: +86-153 7109 6192 > > -Original Message- > From: Konstantin Ananyev > Sent: Friday, July 28, 2023 4:03 PM > To: Trevor Tao ; tho...@monjalon.net > Cc: dev@dpdk.org; nd ; sta...@dpdk.org; Ruifeng Wang > ; Feifei Wang > > Subject: RE: [PATCH v1] examples/l3fwd: relax the RSS/Offload requirement > > > > > Now the port Rx mq_mode had been set to RTE_ETH_MQ_RX_RSS, and offload > > mode set to RTE_ETH_RX_OFFLOAD_CHECKSUM by default, but some hardware > > and/or virtual interface does not support the RSS and offload mode > > presupposed, e.g., some virtio interfaces in the cloud don't support > > RSS and may only partly support RTE_ETH_RX_OFFLOAD_UDP_CKSUM/ > > RTE_ETH_RX_OFFLOAD_TCP_CKSUM, but not RTE_ETH_RX_OFFLOAD_IPV4_CKSUM, > > and the error msg here: > > Well, these HW offloads are there for the good reason - l3fwd app relies on > these HW features to provide functionality requested. > It relies on RTE_ETH_RX_OFFLOAD_IPV4_CKSUM to avoid checks of ip cksum in SW: > static inline int > is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { > /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ > /* > * 1. The packet length reported by the Link Layer must be large > * enough to hold the minimum length legal IP datagram (20 bytes). > */ > if (link_len < sizeof(struct rte_ipv4_hdr)) > return -1; > > /* 2. The IP checksum must be correct. */ > /* this is checked in H/W */ > > > By having RSS enabled it ensures that packets from the same 'flow' will be > processed and send out in order. Probably not a strict > requirement for l3fwd itself, but definitely nice to have feature that > majority of DPDK customers are interested in. > I do understand your desire to lower HW requirements for l3fwd, but then > probably shouldn't be just blind disable, but instead add > SW support for them when essential HW feature is missing. > > Konstantin > > > virtio_dev_configure(): RSS support requested but not supported by the > > device > > Port0 dev_configure = -95 > > > > and: > > Ethdev port_id=0 requested Rx offloads 0xe does not match Rx offloads > > capabilities 0x201d in rte_eth_dev_configure() > > > > So to enable the l3fwd running in that environment, the Rx mode > > requirement can be relaxed to reflect the hardware feature reality > > here, and the l3fwd can run smoothly then. > > A warning msg would be provided to user in case it happens here. > > > > Fixes: af75078fece3 ("first public release") > > Cc: sta...@dpdk.org > > > > Signed-off-by: Trevor Tao > > Reviewed-by: Ruifeng Wang > > Reviewed-by: Feifei Wang > > --- > > .mailmap | 1 + > > examples/l3fwd/main.c | 19 ++- > > 2 files changed, 19 insertions(+), 1 deletion(-) > > > > diff --git a/.mailmap b/.mailmap > > index 8e3940a253..602d8cbc6b 100644 > > --- a/.mailmap > > +++ b/.mailmap > > @@ -1403,6 +1403,7 @@ Tom Rix Tone Zhang > > Tonghao Zhang > > Tony Nguyen > > +Trevor Tao > > Tsotne Chakhvadze Tudor Brindus > > Tudor Cornea > > diff --git a/examples/l3fwd/main.c > > b/examples/l3fwd/main.c index a4f061537e..cec87d95d1 100644 > > --- a/examples/l3fwd/main.c > > +++ b/examples/l3fwd/main.c > > @@ -1233,8 +1233,12 @@ l3fwd_poll_resource_setup(void) > > local_port_conf.rx_adv_conf.rss_conf.rss_hf &= > > dev_info.flow_type_rss_offloads; > > > > - if (dev_info.max_rx_queues == 1) > > +
Re: [PATCH v2 2/2] kni: remove deprecated kernel network interface
Hello CI people, On Tue, Aug 1, 2023 at 6:05 PM Stephen Hemminger wrote: > kernel/linux/kni/Kbuild | 6 - > kernel/linux/kni/compat.h | 157 > kernel/linux/kni/kni_dev.h| 137 --- > kernel/linux/kni/kni_fifo.h | 87 -- > kernel/linux/kni/kni_misc.c | 719 -- > kernel/linux/kni/kni_net.c| 878 -- > kernel/linux/kni/meson.build | 41 - > kernel/linux/meson.build | 2 +- This is a heads up for KNI removal in the *main* branch. With this removal, there is no remaining out of tree Linux kernel module to compile/test in DPDK sources. This means that jobs (like the one in UNH lab that was compile-testing KNI against the latest Linux kernel sources) can be disabled. Important note: this mail does not ask for any change to LTS releases testing. If KNI was built and tested with LTS releases, you should continue to do so. -- David Marchand
Re: [PATCH v2 2/2] kni: remove deprecated kernel network interface
On Fri, Aug 04, 2023 at 03:19:43PM +0200, David Marchand wrote: > Hello CI people, > > On Tue, Aug 1, 2023 at 6:05 PM Stephen Hemminger > wrote: > > kernel/linux/kni/Kbuild | 6 - > > kernel/linux/kni/compat.h | 157 > > kernel/linux/kni/kni_dev.h| 137 --- > > kernel/linux/kni/kni_fifo.h | 87 -- > > kernel/linux/kni/kni_misc.c | 719 -- > > kernel/linux/kni/kni_net.c| 878 -- > > kernel/linux/kni/meson.build | 41 - > > kernel/linux/meson.build | 2 +- > > This is a heads up for KNI removal in the *main* branch. > > With this removal, there is no remaining out of tree Linux kernel module > to compile/test in DPDK sources. This means that jobs (like the one in > UNH lab that was compile-testing KNI against the latest Linux kernel > sources) can be disabled. > > Important note: this mail does not ask for any change to LTS releases > testing. If KNI was built and tested with LTS releases, you should > continue to do so. > Given that there are no linux modules left, can we consider changing the default setting of "enable_kmods" from "no" to "yes". For FreeBSD there are no in-tree modules that can support DPDK, so the kernel modules for that OS should always be built. The only reason for it being disabled was Linux, but that seems unnecessary now. Alternative: remove the option completely, and always build kernel modules for FreeBSD (and any for Windows in future). If in future we add in more Linux modules (which I can't see happening), add in an "enable_linux_kmods" option instead to control that. WDYT? /Bruce
Re: [PATCH v2 0/2] Remove disabled functionality
On Fri, 4 Aug 2023 15:02:23 +0200 David Marchand wrote: > It took some time to remove this code (especially the KNI bits). > Thanks to all who contributed to the effort. > > Series applied, thanks. Thanks, still waiting for the first user complaints about this. No one ever reads the release notes.
RE: [PATCH v2 0/5] bbdev: API extension for 23.11
Hi Maxime, Kind reminder to get a review on this series: https://patchwork.dpdk.org/project/dpdk/list/?series=28544 Thanks, Hernan > -Original Message- > From: Chautru, Nicolas > Sent: Monday, July 17, 2023 5:29 PM > To: dev@dpdk.org; maxime.coque...@redhat.com > Cc: Rix, Tom ; hemant.agra...@nxp.com; > david.march...@redhat.com; Vargas, Hernan > Subject: RE: [PATCH v2 0/5] bbdev: API extension for 23.11 > > Hi Maxime, Hemant, > Can I get some review/ack for this serie please. > Thanks > Nic > > > -Original Message- > > From: Chautru, Nicolas > > Sent: Thursday, June 15, 2023 9:49 AM > > To: dev@dpdk.org; maxime.coque...@redhat.com > > Cc: Rix, Tom ; hemant.agra...@nxp.com; > > david.march...@redhat.com; Vargas, Hernan ; > > Chautru, Nicolas > > Subject: [PATCH v2 0/5] bbdev: API extension for 23.11 > > > > v2: moving the new mld functions at the end of struct rte_bbdev to > > avoid ABI offset changes based on feedback with Maxime. > > Adding a commit to waive the FFT ABI warning since that experimental > > function could break ABI (let me know if preferred to be merged with > > the FFT commit causing the FFT change). > > > > > > Including v1 for extending the bbdev api for 23.11. > > The new MLD-TS is expected to be non ABI compatible, the other ones > > should not break ABI. > > I will send a deprecation notice in parallel. > > > > This introduces a new operation (on top of FEC and FFT) to support > > equalization for MLD-TS. There also more modular API extension for > > existing FFT and FEC operation. > > > > Thanks > > Nic > > > > > > Nicolas Chautru (5): > > bbdev: add operation type for MLDTS procession > > bbdev: add new capabilities for FFT processing > > bbdev: add new capability for FEC 5G UL processing > > bbdev: improving error handling for queue configuration > > devtools: ignore changes into bbdev experimental API > > > > devtools/libabigail.abignore| 4 +- > > doc/guides/prog_guide/bbdev.rst | 83 ++ > > lib/bbdev/rte_bbdev.c | 26 +++--- > > lib/bbdev/rte_bbdev.h | 76 + > > lib/bbdev/rte_bbdev_op.h| 143 > > +++- > > lib/bbdev/version.map | 5 ++ > > 6 files changed, 323 insertions(+), 14 deletions(-) > > > > -- > > 2.34.1
[PATCH] dumpcap: fix mbuf pool ring type
The ring used to store mbufs needs to be multiple producer, multiple consumer because multiple queues might on multiple cores might be allocating and same time (consume) and in case of ring full, the mbufs will be returned (multiple producer). Bugzilla ID: 1271 Fixes: cb2440fd77af ("dumpcap: fix mbuf pool ring type") Signed-off-by: Stephen Hemminger --- app/dumpcap/main.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index 64294bbfb3e6..991174e95022 100644 --- a/app/dumpcap/main.c +++ b/app/dumpcap/main.c @@ -691,10 +691,9 @@ static struct rte_mempool *create_mempool(void) data_size = mbuf_size; } - mp = rte_pktmbuf_pool_create_by_ops(pool_name, num_mbufs, - MBUF_POOL_CACHE_SIZE, 0, - data_size, - rte_socket_id(), "ring_mp_sc"); + mp = rte_pktmbuf_pool_create(pool_name, num_mbufs, +MBUF_POOL_CACHE_SIZE, 0, +data_size, rte_socket_id()); if (mp == NULL) rte_exit(EXIT_FAILURE, "Mempool (%s) creation failed: %s\n", pool_name, -- 2.39.2
RE: [PATCH] test/event: remove timer state check
> -Original Message- > From: pbhagavat...@marvell.com > Sent: Monday, July 31, 2023 8:29 AM > To: jer...@marvell.com; Carrillo, Erik G > Cc: dev@dpdk.org; Pavan Nikhilesh > Subject: [PATCH] test/event: remove timer state check > > From: Pavan Nikhilesh > > Remove checking if timer state is set to RTE_EVENT_TIMER_NOT_ARMED > after the timer has expired as certain timer device implementations might > not have access to the rte_event_timer handle of a timer event. > > Signed-off-by: Pavan Nikhilesh > --- Acked-by: Erik Gabriel Carrillo
[PATCH 1/2] app/test: remove unnecessary null check before free
No need to check for NULL pointer before calling these functions Found by cocci/nullfree.cocci. Signed-off-by: Stephen Hemminger --- app/test/test_cryptodev_asym.c | 3 +-- app/test/test_reassembly_perf.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index 0ef2642fdd2b..c43a063b8262 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -565,8 +565,7 @@ ut_teardown_asym(void) if (self->sess != NULL) rte_cryptodev_asym_session_free(dev_id, self->sess); - if (self->op != NULL) - rte_crypto_op_free(self->op); + rte_crypto_op_free(self->op); self->sess = NULL; self->op = NULL; self->result_op = NULL; diff --git a/app/test/test_reassembly_perf.c b/app/test/test_reassembly_perf.c index c11b65291fec..3af104b67348 100644 --- a/app/test/test_reassembly_perf.c +++ b/app/test/test_reassembly_perf.c @@ -81,8 +81,7 @@ reassembly_test_teardown(void) if (frag_tbl != NULL) rte_ip_frag_table_destroy(frag_tbl); - if (pkt_pool != NULL) - rte_mempool_free(pkt_pool); + rte_mempool_free(pkt_pool); } static void -- 2.39.2
[PATCH 2/2] net/bnxt: remove unnecessary check for null before free
No need to check for null pointer before calling rte_free(). Found by cocci/nullfree.cocci script. Signed-off-by: Stephen Hemminger --- drivers/net/bnxt/bnxt_ethdev.c | 3 +-- drivers/net/bnxt/bnxt_vnic.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index ee1552452a11..ec8e441a6d05 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -6002,8 +6002,7 @@ static void bnxt_free_ctx_mem_buf(struct bnxt_ctx_mem_buf_info *ctx) if (!ctx) return; - if (ctx->va) - rte_free(ctx->va); + rte_free(ctx->va); ctx->va = NULL; ctx->dma = RTE_BAD_IOVA; diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index 2be456956ddc..f86d27fd7965 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -847,8 +847,7 @@ bnxt_vnic_rss_hash_algo_update(struct bnxt *bp, int32_t bnxt_vnic_queue_db_deinit(struct bnxt *bp) { - if (bp->vnic_queue_db.rss_q_db != NULL) - rte_hash_free(bp->vnic_queue_db.rss_q_db); + rte_hash_free(bp->vnic_queue_db.rss_q_db); return 0; } -- 2.39.2
3SNIC roadmap for v23.11
Hi Ferruh, Please find below 3SNIC roadmap for v23.11 release: * Introduce sssnic PMD for 3SNIC's 9x0 serials Ethernet adapters. Features of sssnic PMD are: - Link status - Link status event - Queue start/stop - Rx interrupt - Scattered Rx - TSO - LRO - Promiscuous mode - Allmulticast mode - Unicast MAC filter - Multicast MAC filte - RSS hash - RSS key update - RSS reta update - Inner RSS - VLAN filter - VLAN offload - L3 checksum offload - L4 checksum offload - Inner L3 checksum - Inner L4 checksum - Basic stats - Extended stats - Stats per queue - Flow control - FW version - Generic flow API About 3SNIC: Shenzhen 3SNIC Information Technology Co., Ltd. was established in 2021, focusing on developing and manufacturing of smart cards including storage cards and NICs. The following 3SNIC's Ethernet adapters are avaliable: - 3S930 Dual 100GE/40GE ports, PCIE GEN4 x16, SR-IOV - 3S920 Quad 25GE/10GE ports, PCIE GEN4 x16, SR-IOV - 3S910 Dual 25GE/10GE ports, PCIE GEN3 x8, SR-IOV Learning more about 3SNIC's Ethernet adapters please see: https://www.3snic.com/products/SSSNIC Thanks Steven Song
[PATCH] net/mlx5: fix bond resource release
When a port is spawned on top of mlx5 bonding device, the following TIS objects are created: - TIS with index 0 - for default HW hash bonding mode, - TIS with index 1 - for sending packets on 1st physical port, - TIS with index 2 - for sending packets on 2nd physical port, - and so on. These TIS objects are used according to configured Tx queue affinity, which was set up using rte_eth_dev_map_aggr_tx_affinity() API. Before this patch, when DPDK was compiled in debug mode and RTE_LIBRTE_MLX5_DEBUG macro was declared, applications were asserting on failed call to destroy the TD object (on which TIS objects are dependent) during closing of the ports. Failure was caused by the fact that when TD object was destroyed, not all TIS objects were destroyed yet. This was caused by "off-by-one" issue in mlx5_free_shared_dev_ctx(). This function was releasing n TIS objects, but it should release n + 1 objects, where n is number of aggregated ports. (n + 1, because there are n TIS objects for each physical port and 1 TIS object for default HW hash mode). This patch fixes this issue in resource release of TIS objects. Fixes: ce306af6341b ("net/mlx5: enhance Tx queue affinity") Cc: jiaw...@nvidia.com Signed-off-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index b373306f98..7d044bcd75 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1720,7 +1720,7 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn, do { if (sh->tis[i]) claim_zero(mlx5_devx_cmd_destroy(sh->tis[i])); - } while (++i < (uint32_t)sh->bond.n_port); + } while (++i <= (uint32_t)sh->bond.n_port); if (sh->td) claim_zero(mlx5_devx_cmd_destroy(sh->td)); mlx5_free(sh); @@ -1864,7 +1864,7 @@ mlx5_free_shared_dev_ctx(struct mlx5_dev_ctx_shared *sh) do { if (sh->tis[i]) claim_zero(mlx5_devx_cmd_destroy(sh->tis[i])); - } while (++i < sh->bond.n_port); + } while (++i <= sh->bond.n_port); if (sh->td) claim_zero(mlx5_devx_cmd_destroy(sh->td)); #ifdef HAVE_MLX5_HWS_SUPPORT -- 2.25.1
RE: [RFC] ring: further performance improvements with C11
> -Original Message- > From: Konstantin Ananyev > Sent: Wednesday, August 2, 2023 4:43 AM > To: Wathsala Wathawana Vithanage ; > Honnappa Nagarahalli ; > konstantin.v.anan...@yandex.ru; tho...@monjalon.net; Ruifeng Wang > > Cc: dev@dpdk.org; nd ; Justin He > Subject: RE: [RFC] ring: further performance improvements with C11 > > > > > For improved performance over the current C11 based ring > > implementation following changes were made. > > (1) Replace tail store with RELEASE semantics in > > __rte_ring_update_tail with a RELEASE fence. Replace load of the tail > > with ACQUIRE semantics in __rte_ring_move_prod_head and > > __rte_ring_move_cons_head with ACQUIRE fences. > > (2) Remove ACQUIRE fences between load of the old_head and load of the > > cons_tail in __rte_ring_move_prod_head and __rte_ring_move_cons_head. > > These two fences are not required for the safety of the ring library. > > Hmm... with these changes, aren't we re-introducing the old bug fixed by this > commit: Cover letter explains why this barrier does not solve what it intends to solve and Why it should not matter. https://mails.dpdk.org/archives/dev/2023-June/270874.html > > commit 9bc2cbb007c0a3335c5582357ae9f6d37ea0b654 > Author: Jia He > Date: Fri Nov 10 03:30:42 2017 + > > ring: guarantee load/load order in enqueue and dequeue > > We watched a rte panic of mbuf_autotest in our qualcomm arm64 server > (Amberwing). > > Root cause: > In __rte_ring_move_cons_head() > ... > do { > /* Restore n as it may change every loop */ > n = max; > > *old_head = r->cons.head;//1st load > const uint32_t prod_tail = r->prod.tail; //2nd load > > In weak memory order architectures (powerpc,arm), the 2nd load might be > reodered before the 1st load, that makes *entries is bigger than we > wanted. > This nasty reording messed enque/deque up. > > ? > > > > > Signed-off-by: Wathsala Vithanage > > Reviewed-by: Honnappa Nagarahalli > > Reviewed-by: Ruifeng Wang > > --- > > .mailmap| 1 + > > lib/ring/rte_ring_c11_pvt.h | 35 --- > > 2 files changed, 21 insertions(+), 15 deletions(-) > > > > diff --git a/.mailmap b/.mailmap > > index 4018f0fc47..367115d134 100644 > > --- a/.mailmap > > +++ b/.mailmap > > @@ -1430,6 +1430,7 @@ Walter Heymans > > > Wang Sheng-Hui Wangyu (Eric) > > Waterman Cao > > +Wathsala Vithanage > > Weichun Chen Wei Dai > > Weifeng Li diff --git > > a/lib/ring/rte_ring_c11_pvt.h b/lib/ring/rte_ring_c11_pvt.h index > > f895950df4..63fe58ce9e 100644 > > --- a/lib/ring/rte_ring_c11_pvt.h > > +++ b/lib/ring/rte_ring_c11_pvt.h > > @@ -16,6 +16,13 @@ __rte_ring_update_tail(struct rte_ring_headtail *ht, > uint32_t old_val, > > uint32_t new_val, uint32_t single, uint32_t enqueue) { > > RTE_SET_USED(enqueue); > > + /* > > +* Updating of ht->tail cannot happen before elements are added to or > > +* removed from the ring, as it could result in data races between > > +* producer and consumer threads. Therefore we need a release > > +* barrier here. > > +*/ > > + rte_atomic_thread_fence(__ATOMIC_RELEASE); > > > > /* > > * If there are other enqueues/dequeues in progress that preceded > > us, @@ -24,7 +31,7 @@ __rte_ring_update_tail(struct rte_ring_headtail > *ht, uint32_t old_val, > > if (!single) > > rte_wait_until_equal_32(&ht->tail, old_val, > __ATOMIC_RELAXED); > > > > - __atomic_store_n(&ht->tail, new_val, __ATOMIC_RELEASE); > > + __atomic_store_n(&ht->tail, new_val, __ATOMIC_RELAXED); > > } > > > > /** > > @@ -66,14 +73,8 @@ __rte_ring_move_prod_head(struct rte_ring *r, > unsigned int is_sp, > > /* Reset n to the initial burst count */ > > n = max; > > > > - /* Ensure the head is read before tail */ > > - __atomic_thread_fence(__ATOMIC_ACQUIRE); > > - > > - /* load-acquire synchronize with store-release of ht->tail > > -* in update_tail. > > -*/ > > cons_tail = __atomic_load_n(&r->cons.tail, > > - __ATOMIC_ACQUIRE); > > + __ATOMIC_RELAXED); > > > > /* The subtraction is done between two unsigned 32bits value > > * (the result is always modulo 32 bits even if we have @@ - > 100,6 > > +101,11 @@ __rte_ring_move_prod_head(struct rte_ring *r, unsigned int > is_sp, > > 0, __ATOMIC_RELAXED, > > __ATOMIC_RELAXED); > > } while (unlikely(success == 0)); > > + /* > > +* Ensure that updates to the ring doesn't rise above > > +* load of the new_head in SP and MP cases. > > +*/ > > + rte_atomic_thread_fence(__ATOMIC_ACQUIRE); > > return n; > > } > > > > @@ -14