ethdev: introduce Rx buffer split
Quoted 124 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The following structure is introduced to specify the Rx packet segment:
struct
rte_eth_rxseg{
structrte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length,
configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specifiy Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuraion, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.If the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array:
- the first network buffer will be allocated from the memory pool, specified in the first segment description element, the second network buffer - from the pool in the second segment description element and so on. If there is no enough elements to describe the buffer for entire packet of maximal length the pool from the last valid element will be used to allocate the buffers from for the rest of segments
- the offsets from the segment description elements will provide the data offset from the buffer beginning except the first mbuf - for this one the offset is added to the
RTE_PKTMBUF_HEADROOMto get actual offset from the buffer beginning. If there is no enough elements to describe the buffer for entire packet of maximal length the offsets for the rest of segment will be supposed to be zero.- the data length being received to each segment is limited by the length specified in the segment description element. The data receiving starts with filling up the first mbuf data buffer, if the specified maximal segment length is reached and there are data remaining (packet is longer than buffer in the first mbuf) the following data will be pushed to the next segment up to its own maximal length. If the first two segments is not enough to store all the packet remaining data the next (third) segment will be engaged and so on. If the length in the segment description element is zero the actual buffer size will be deduced from the appropriate memory pool properties. If there is no enough elements to describe the buffer for entire packet of maximal length the buffer size will be deduced from the pool of the last valid element for the remaining segments.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2 seg1 - pool1, len1=20B, off1=128B seg2 - pool2, len2=20B, off2=0B seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Quoted 1 line
Signed-off-by Viacheslav Ovsiienko <[email protected]>
Quoted 322 lines
--- doc/guides/nics/features.rst | 15 +++++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 +++ lib/librte_ethdev/rte_ethdev.c | 111 +++++++++++++++++++++++++-------- lib/librte_ethdev/rte_ethdev.h | 62 +++++++++++++++++- 5 files changed, 171 insertions(+), 31 deletions(-)doc/guides/nics/features.rst +15
-0@@ -185,6 +185,21 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[provides] eth_dev_ops**: ``rxq_info_get:buffer_split``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LROdoc/guides/rel_notes/deprecation.rst +0
-5@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``doc/guides/rel_notes/release_20_11.rst +9
-0@@ -60,6 +60,12 @@ New Features Added the FEC API which provides functions for query FEC capabilities and current FEC mode from device. Also, API for configuring FEC mode is also provided. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:@@ -253,6 +259,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functionslib/librte_ethdev/rte_ethdev.c +86
-25@@ -105,6 +105,9 @@ struct rte_eth_xstats_name_off {#define RTE_RX_OFFLOAD_BIT2STR (_name) \ { DEV_RX_OFFLOAD_##_name, #_name } +#define RTE_ETH_RX_OFFLOAD_BIT2STR (_name) \ + { RTE_ETH_RX_OFFLOAD_##_name, #_name } + static const struct { uint64_t offload; const char *name;@@ -128,9 +131,11 @@ struct rte_eth_xstats_name_off {RTE_RX_OFFLOAD_BIT2STR (SCTP_CKSUM ),RTE_RX_OFFLOAD_BIT2STR (OUTER_UDP_CKSUM ),RTE_RX_OFFLOAD_BIT2STR (RSS_HASH ), + RTE_ETH_RX_OFFLOAD_BIT2STR(BUFFER_SPLIT), };#undef RTE_RX_OFFLOAD_BIT2STR +#undef RTE_ETH_RX_OFFLOAD_BIT2STR#define RTE_TX_OFFLOAD_BIT2STR (_name) \ { DEV_TX_OFFLOAD_##_name, #_name }@@ -1784,38 +1789,94 @@ struct rte_eth_dev *return -EINVAL ; } -if (mp ==NULL ) { -RTE_ETHDEV_LOG (ERR ,"Invalid null mempool pointer\n" ); -return -EINVAL ; - } -RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rx_queue_setup, -ENOTSUP ); -/* -* Check the size of the mbuf data buffer. -* This value must be provided in the private data of the memory pool. -* First check that the memory pool has a valid private data. -*/ ret =rte_eth_dev_info_get (port_id, &dev_info);if (ret !=0 )return ret; -if (mp->private_data_size <sizeof (struct rte_pktmbuf_pool_private )) { -RTE_ETHDEV_LOG (ERR ,"%s private_data_size %d < %d\n" , - mp->name, (int )mp->private_data_size, - (int )sizeof (struct rte_pktmbuf_pool_private )); -return -ENOSPC ; - } - mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mp) { +/* Single pool configuration check. */ +if (rx_conf->rx_seg || rx_conf->rx_nseg) { +RTE_ETHDEV_LOG (ERR , +"Ambiguous segment configuration\n" ); +return -EINVAL ; + } +/* +* Check the size of the mbuf data buffer, this value +* must be provided in the private data of the memory pool. +* First check that the memory pool(s) has a valid private data. +*/ +if (mp->private_data_size < +sizeof (struct rte_pktmbuf_pool_private )) { +RTE_ETHDEV_LOG (ERR ,"%s private_data_size %u < %u\n" , + mp->name, mp->private_data_size, + (unsigned int ) +sizeof (struct rte_pktmbuf_pool_private )); +return -ENOSPC ; + } + mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mbp_buf_size < dev_info.min_rx_bufsize + +RTE_PKTMBUF_HEADROOM ) { +RTE_ETHDEV_LOG (ERR , +"%s mbuf_data_room_size %u < %u" +" (RTE_PKTMBUF_HEADROOM=%u +" +" min_rx_bufsize(dev)=%u)\n" , + mp->name, mbp_buf_size, +RTE_PKTMBUF_HEADROOM + + dev_info.min_rx_bufsize, +RTE_PKTMBUF_HEADROOM , + dev_info.min_rx_bufsize); +return -EINVAL ; + } + }else { +const struct rte_eth_rxseg *rx_seg = rx_conf->rx_seg; +uint16_t n_seg = rx_conf->rx_nseg; +uint16_t seg_idx; -if (mbp_buf_size < dev_info.min_rx_bufsize +RTE_PKTMBUF_HEADROOM ) { -RTE_ETHDEV_LOG (ERR , -"%s mbuf_data_room_size %d < %d (RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)=%d)\n" , - mp->name, (int )mbp_buf_size, - (int )(RTE_PKTMBUF_HEADROOM + dev_info.min_rx_bufsize), - (int )RTE_PKTMBUF_HEADROOM , - (int )dev_info.min_rx_bufsize); -return -EINVAL ; +/* Extended multi-segment configuration check. */ +if (!rx_conf->rx_seg || !rx_conf->rx_nseg) { +RTE_ETHDEV_LOG (ERR , +"Memory pool is null and no" +" extended configuration provided\n" ); +return -EINVAL ; + } +/* +* Check the sizes and offsets against buffer sizes +* for each segment specified in extended configuration. +*/ +for (seg_idx =0 ; seg_idx < n_seg; seg_idx++) { +struct rte_mempool *mpl = rx_seg[seg_idx].mp; +uint32_t length = rx_seg[seg_idx].length; +uint32_t offset = rx_seg[seg_idx].offset; +uint32_t head_room = seg_idx ?0 :RTE_PKTMBUF_HEADROOM ; + +if (mpl ==NULL ) { +RTE_ETHDEV_LOG (ERR ,"null mempool pointer\n" ); +return -EINVAL ; + } +if (mpl->private_data_size < +sizeof (struct rte_pktmbuf_pool_private )) { +RTE_ETHDEV_LOG (ERR , +"%s private_data_size %u < %u\n" , + mpl->name, + mpl->private_data_size, + (unsigned int )sizeof (struct +rte_pktmbuf_pool_private )); +return -ENOSPC ; + } + mbp_buf_size =rte_pktmbuf_data_room_size (mpl); + length = length ? length : (mbp_buf_size - head_room); +if (mbp_buf_size < length + offset + head_room) { +RTE_ETHDEV_LOG (ERR , +"%s mbuf_data_room_size %u < %u" +" (segment length=%u +" +" segment offset=%u)\n" , + mpl->name, mbp_buf_size, + length + offset, length, offset); +return -EINVAL ; + } + } }/* Use default specified by driver, if nb_rx_desc is zero */ lib/librte_ethdev/rte_ethdev.h +61
-2@@ -970,6 +970,16 @@ struct rte_eth_txmode { };/** +* A structure used to configure an RX packet segment to split. +*/ +struct rte_eth_rxseg { +struct rte_mempool *mp;/**< Memory pool to allocate segment from. */ +uint16_t length;/**< Segment data length, configures split point. */ +uint16_t offset;/**< Data offset from beginning of mbuf data buffer. */ +uint32_t reserved;/**< Reserved field. */ +}; + +/** * A structure used to configure an RX ring of an Ethernet port. */ struct rte_eth_rxconf {@@ -977,6 +987,43 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */ uint8_t rx_deferred_start;/**< Do not start queue with rte_eth_dev_start(). */ +uint16_t rx_nseg;/**< Number of descriptions in rx_seg array. */ +/** +* Points to the array of segment descriptions. Each array element +* describes the properties for each segment in the receiving +* buffer. +* +* If RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag is set in offloads field, +* the PMD will split the received packets into multiple segments +* according to the specification in the description array: +* +* - the first network buffer will be allocated from the memory pool, +* specified in the first array element, the second buffer, from the +* pool in the second element, and so on. +* +* - the offsets from the segment description elements specify +* the data offset from the buffer beginning except the first mbuf. +* For this one the offset is added with RTE_PKTMBUF_HEADROOM. +* +* - the lengthes in the elements define the maximal data amount +* being received to each segment. The receiving starts with filling +* up the first mbuf data buffer up to specified length. If the +* there are data remaining (packet is longer than buffer in the first +* mbuf) the following data will be pushed to the next segment +* up to its own length, and so on. +* +* - If the length in the segment description element is zero +* the actual buffer size will be deduced from the appropriate +* memory pool properties. +* +* - if there is not enough elements to describe the buffer for entire +* packet of maximal length the following parameters will be used +* for the all remaining segments: +* - pool from the last valid element +* - the buffer size from this pool +* - zero offset +*/ +struct rte_eth_rxseg *rx_seg;/** * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. * Only offloads set on rx_queue_offload_capa or rx_offload_capa @@ -1260,6 +1307,7 @@ struct rte_eth_conf {#define DEV_RX_OFFLOAD_SCTP_CKSUM 0x00020000#define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000#define DEV_RX_OFFLOAD_RSS_HASH 0x00080000 +#define RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT 0x00100000#define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \@@ -2027,9 +2075,21 @@ int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue,* No need to repeat any bit in rx_conf->offloads which has already been * enabled in rte_eth_dev_configure() at port level. An offloading enabled * at port level can't be disabled at queue level. +* The configuration structure also contains the pointer to the array +* of the receiving buffer segment descriptions, see rx_seg and rx_nseg +* fields, this extended configuration might be used by split offloads like +* RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT. If mp_pool is not NULL, +* the extended configuration fields must be set to NULL and zero. * @param mb_pool * The pointer to the memory pool from which to allocate *rte_mbuf* network -* memory buffers to populate each descriptor of the receive ring. +* memory buffers to populate each descriptor of the receive ring. There are +* two options to provide Rx buffer configuration: +* - single pool: +* mb_pool is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is 0. +* - multiple segments description: +* mb_pool is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not 0. +* Taken only if flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT is set in offloads. +* * @return * - 0: Success, receive queue correctly set up. * - -EIO: if device is removed. -- 1.8.3.1
Quoted 245 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The following structure is introduced to specify the Rx packet segment:
struct
rte_eth_rxseg{
structrte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length,
configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specifiy Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuraion, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.If the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array:
- the first network buffer will be allocated from the memory pool, specified in the first segment description element, the second network buffer - from the pool in the second segment description element and so on. If there is no enough elements to describe the buffer for entire packet of maximal length the pool from the last valid element will be used to allocate the buffers from for the rest of segments
- the offsets from the segment description elements will provide the data offset from the buffer beginning except the first mbuf - for this one the offset is added to the
RTE_PKTMBUF_HEADROOMto get actual offset from the buffer beginning. If there is no enough elements to describe the buffer for entire packet of maximal length the offsets for the rest of segment will be supposed to be zero.- the data length being received to each segment is limited by the length specified in the segment description element. The data receiving starts with filling up the first mbuf data buffer, if the specified maximal segment length is reached and there are data remaining (packet is longer than buffer in the first mbuf) the following data will be pushed to the next segment up to its own maximal length. If the first two segments is not enough to store all the packet remaining data the next (third) segment will be engaged and so on. If the length in the segment description element is zero the actual buffer size will be deduced from the appropriate memory pool properties. If there is no enough elements to describe the buffer for entire packet of maximal length the buffer size will be deduced from the pool of the last valid element for the remaining segments.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2 seg1 - pool1, len1=20B, off1=128B seg2 - pool2, len2=20B, off2=0B seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Signed-off-by Viacheslav Ovsiienko <[email protected]>--- doc/guides/nics/features.rst | 15 +++++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 +++ lib/librte_ethdev/rte_ethdev.c | 111 +++++++++++++++++++++++++-------- lib/librte_ethdev/rte_ethdev.h | 62 +++++++++++++++++- 5 files changed, 171 insertions(+), 31 deletions(-)doc/guides/nics/features.rst +15
-0@@ -185,6 +185,21 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[provides] eth_dev_ops**: ``rxq_info_get:buffer_split``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LROdoc/guides/rel_notes/deprecation.rst +0
-5@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``doc/guides/rel_notes/release_20_11.rst +9
-0@@ -60,6 +60,12 @@ New Features Added the FEC API which provides functions for query FEC capabilities and current FEC mode from device. Also, API for configuring FEC mode is also provided. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:@@ -253,6 +259,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functionslib/librte_ethdev/rte_ethdev.c +5
-10@@ -105,6 +105,9 @@ struct rte_eth_xstats_name_off {#define RTE_RX_OFFLOAD_BIT2STR (_name) \ { DEV_RX_OFFLOAD_##_name, #_name } +#define RTE_ETH_RX_OFFLOAD_BIT2STR (_name) \ + { RTE_ETH_RX_OFFLOAD_##_name, #_name } + static const struct { uint64_t offload; const char *name;@@ -128,9 +131,11 @@ struct rte_eth_xstats_name_off {RTE_RX_OFFLOAD_BIT2STR (SCTP_CKSUM ),RTE_RX_OFFLOAD_BIT2STR (OUTER_UDP_CKSUM ),RTE_RX_OFFLOAD_BIT2STR (RSS_HASH ), + RTE_ETH_RX_OFFLOAD_BIT2STR(BUFFER_SPLIT), };#undef RTE_RX_OFFLOAD_BIT2STR +#undef RTE_ETH_RX_OFFLOAD_BIT2STR#define RTE_TX_OFFLOAD_BIT2STR (_name) \ { DEV_TX_OFFLOAD_##_name, #_name }@@ -1784,38 +1789,94 @@ struct rte_eth_dev *return -EINVAL ; } -if (mp ==NULL ) { -RTE_ETHDEV_LOG (ERR ,"Invalid null mempool pointer\n" ); -return -EINVAL ; - } -RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rx_queue_setup, -ENOTSUP ); -/* -* Check the size of the mbuf data buffer. -* This value must be provided in the private data of the memory pool. -* First check that the memory pool has a valid private data. -*/ ret =rte_eth_dev_info_get (port_id, &dev_info);if (ret !=0 )
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1798
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +1
-7return ret; -if (mp->private_data_size <sizeof (struct rte_pktmbuf_pool_private )) { -RTE_ETHDEV_LOG (ERR ,"%s private_data_size %d < %d\n" , - mp->name, (int )mp->private_data_size, - (int )sizeof (struct rte_pktmbuf_pool_private )); -return -ENOSPC ; - } - mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mp) {
Please, compare vs NULL [1]
[1] https://doc.dpdk.org/guides/contributing/coding_style.html#null-pointers
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1800
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+/* Single pool configuration check. */ +if (rx_conf->rx_seg || rx_conf->rx_nseg) {
Please, compare vs NULL and 0. IMHO, rx_nsegs check is sufficient. If it is 0, nobody cares what is in rx_seg.
Quoted 14 lines
lib/librte_ethdev/rte_ethdev.c +14
-0+RTE_ETHDEV_LOG (ERR , +"Ambiguous segment configuration\n" ); +return -EINVAL ; + } +/* +* Check the size of the mbuf data buffer, this value +* must be provided in the private data of the memory pool. +* First check that the memory pool(s) has a valid private data. +*/ +if (mp->private_data_size < +sizeof (struct rte_pktmbuf_pool_private )) { + RTE_ETHDEV_LOG(ERR, "%s private_data_size %u < %u\n", + mp->name, mp->private_data_size, + (unsigned int)
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1824
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ sizeof(struct rte_pktmbuf_pool_private)); +return -ENOSPC ; + } + mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mbp_buf_size < dev_info.min_rx_bufsize + +RTE_PKTMBUF_HEADROOM ) { + RTE_ETHDEV_LOG(ERR, + "%s mbuf_data_room_size %u < %u" + " (RTE_PKTMBUF_HEADROOM=%u +" + " min_rx_bufsize(dev)=%u)\n",
Do not split format string. It is not a problem that it is long.
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.c +11
-0+ mp->name, mbp_buf_size, +RTE_PKTMBUF_HEADROOM + + dev_info.min_rx_bufsize, +RTE_PKTMBUF_HEADROOM , + dev_info.min_rx_bufsize); +return -EINVAL ; + } + }else { +const struct rte_eth_rxseg *rx_seg = rx_conf->rx_seg; +uint16_t n_seg = rx_conf->rx_nseg; +uint16_t seg_idx;
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1838
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +2
-8-if (mbp_buf_size < dev_info.min_rx_bufsize +RTE_PKTMBUF_HEADROOM ) { -RTE_ETHDEV_LOG (ERR , -"%s mbuf_data_room_size %d < %d (RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)=%d)\n" , - mp->name, (int )mbp_buf_size, - (int )(RTE_PKTMBUF_HEADROOM + dev_info.min_rx_bufsize), - (int )RTE_PKTMBUF_HEADROOM , - (int )dev_info.min_rx_bufsize); -return -EINVAL ; +/* Extended multi-segment configuration check. */ +if (!rx_conf->rx_seg || !rx_conf->rx_nseg) {
Please, compare vs NULL and 0
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1841
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +3
-0+RTE_ETHDEV_LOG (ERR , +"Memory pool is null and no" +" extended configuration provided\n" );
Do not split format string. It is not a problem that it is long.
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1852
Quoted 11 lines
lib/librte_ethdev/rte_ethdev.c +11
-0+return -EINVAL ; + } +/* +* Check the sizes and offsets against buffer sizes +* for each segment specified in extended configuration. +*/ +for (seg_idx =0 ; seg_idx < n_seg; seg_idx++) { +struct rte_mempool *mpl = rx_seg[seg_idx].mp; +uint32_t length = rx_seg[seg_idx].length; +uint32_t offset = rx_seg[seg_idx].offset; +uint32_t head_room = seg_idx ?0 :RTE_PKTMBUF_HEADROOM ;
Why? Shouldn't it be in offset? IMHO too many offsets this way.
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c +7
-0+ +if (mpl ==NULL ) { +RTE_ETHDEV_LOG (ERR ,"null mempool pointer\n" ); +return -EINVAL ; + } +if (mpl->private_data_size < +sizeof (struct rte_pktmbuf_pool_private )) {
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1869
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+RTE_ETHDEV_LOG (ERR , +"%s private_data_size %u < %u\n" , + mpl->name, + mpl->private_data_size, + (unsigned int )sizeof (struct +rte_pktmbuf_pool_private )); +return -ENOSPC ; + } + mbp_buf_size =rte_pktmbuf_data_room_size (mpl); + length = length ? length : (mbp_buf_size - head_room);
Compare length with 0.
What does ensure that mbp_buf_size is greater or equal to head_room size?
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1874
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +5
-0+if (mbp_buf_size < length + offset + head_room) { + RTE_ETHDEV_LOG(ERR, + "%s mbuf_data_room_size %u < %u" + " (segment length=%u +" + " segment offset=%u)\n",
Do not split format string. It is not a problem that it is long.
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.c +5
-0+ mpl->name, mbp_buf_size, + length + offset, length, offset); +return -EINVAL ; + } + } }/* Use default specified by driver, if nb_rx_desc is zero */ lib/librte_ethdev/rte_ethdev.h +0
-0
lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 973
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +1
-0@@ -970,6 +970,16 @@ struct rte_eth_txmode { };/** +* A structure used to configure an RX packet segment to split.
RX -> Rx
Quoted 88 lines
lib/librte_ethdev/rte_ethdev.h +60
-1+*/ +struct rte_eth_rxseg { +struct rte_mempool *mp;/**< Memory pool to allocate segment from. */ +uint16_t length;/**< Segment data length, configures split point. */ +uint16_t offset;/**< Data offset from beginning of mbuf data buffer. */ +uint32_t reserved;/**< Reserved field. */ +}; + +/** * A structure used to configure an RX ring of an Ethernet port. */ struct rte_eth_rxconf {@@ -977,6 +987,43 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */ uint8_t rx_deferred_start;/**< Do not start queue with rte_eth_dev_start(). */ +uint16_t rx_nseg;/**< Number of descriptions in rx_seg array. */ +/** +* Points to the array of segment descriptions. Each array element +* describes the properties for each segment in the receiving +* buffer. +* +* If RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag is set in offloads field, +* the PMD will split the received packets into multiple segments +* according to the specification in the description array: +* +* - the first network buffer will be allocated from the memory pool, +* specified in the first array element, the second buffer, from the +* pool in the second element, and so on. +* +* - the offsets from the segment description elements specify +* the data offset from the buffer beginning except the first mbuf. +* For this one the offset is added with RTE_PKTMBUF_HEADROOM. +* +* - the lengthes in the elements define the maximal data amount +* being received to each segment. The receiving starts with filling +* up the first mbuf data buffer up to specified length. If the +* there are data remaining (packet is longer than buffer in the first +* mbuf) the following data will be pushed to the next segment +* up to its own length, and so on. +* +* - If the length in the segment description element is zero +* the actual buffer size will be deduced from the appropriate +* memory pool properties. +* +* - if there is not enough elements to describe the buffer for entire +* packet of maximal length the following parameters will be used +* for the all remaining segments: +* - pool from the last valid element +* - the buffer size from this pool +* - zero offset +*/ +struct rte_eth_rxseg *rx_seg;/** * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. * Only offloads set on rx_queue_offload_capa or rx_offload_capa @@ -1260,6 +1307,7 @@ struct rte_eth_conf {#define DEV_RX_OFFLOAD_SCTP_CKSUM 0x00020000#define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000#define DEV_RX_OFFLOAD_RSS_HASH 0x00080000 +#define RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT 0x00100000#define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \@@ -2027,9 +2075,21 @@ int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue,* No need to repeat any bit in rx_conf->offloads which has already been * enabled in rte_eth_dev_configure() at port level. An offloading enabled * at port level can't be disabled at queue level. +* The configuration structure also contains the pointer to the array +* of the receiving buffer segment descriptions, see rx_seg and rx_nseg +* fields, this extended configuration might be used by split offloads like +* RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT. If mp_pool is not NULL, +* the extended configuration fields must be set to NULL and zero. * @param mb_pool * The pointer to the memory pool from which to allocate *rte_mbuf* network -* memory buffers to populate each descriptor of the receive ring. +* memory buffers to populate each descriptor of the receive ring. There are +* two options to provide Rx buffer configuration: +* - single pool: +* mb_pool is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is 0. +* - multiple segments description: +* mb_pool is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not 0. +* Taken only if flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT is set in offloads. +* * @return * - 0: Success, receive queue correctly set up. * - -EIO: if device is removed.
15/10/2020 12:11, Andrew Rybchenko:
Quoted 6 lines · Viacheslav Ovsiienko
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1800
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+/* Single pool configuration check. */ +if (rx_conf->rx_seg || rx_conf->rx_nseg) {Please, compare vs NULL and 0. IMHO,
rx_nsegscheck is sufficient. If it is 0, nobody cares what is inrx_seg.
Yes the pointer should not be a criteria.
Having more than zero items is enough to check.
[...]
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1824
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +4
-0+ RTE_ETHDEV_LOG(ERR, + "%s mbuf_data_room_size %u < %u" + " (RTE_PKTMBUF_HEADROOM=%u +" + " min_rx_bufsize(dev)=%u)\n",Do not split format string. It is not a problem that it is long.
The benefit of keeping format string on the same line is for "grepping" the source code. But after a format specifier, I think we can split. Who is grepping "< %u (RTE_PKTMBUF_HEADROOM" ?
I would just change the split on the second line after the %u.
PATCH v6 2/6 app/testpmd: add multiple pools per core creation
In reply to Viacheslav OvsiienkoThe command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with rte_the_dev_rx_queue_setup_ex().
The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
--- app/test-pmd/bpf_cmd.c | 4 +-- app/test-pmd/cmdline.c | 2 +- app/test-pmd/config.c | 6 ++-- app/test-pmd/parameters.c | 24 +++++++++---- app/test-pmd/testpmd.c | 63 +++++++++++++++++++---------------- app/test-pmd/testpmd.h | 24 ++++++++++--- doc/guides/testpmd_app_ug/run_app.rst | 7 ++-- 7 files changed, 83 insertions(+), 47 deletions(-)
app/test-pmd/bpf_cmd.c +2 -2
@@ -69,7 +69,7 @@ struct cmd_bpf_ld_result { *flags =RTE_BPF_ETH_F_NONE ; arg->type =RTE_BPF_ARG_PTR ; - arg->size = mbuf_data_size; + arg->size = mbuf_data_size[0 ];for (i =0 ; str[i] !=0 ; i++) { v =toupper (str[i]);
@@ -78,7 +78,7 @@ struct cmd_bpf_ld_result {else if (v =='M' ) { arg->type =RTE_BPF_ARG_PTR_MBUF ; arg->size =sizeof (struct rte_mbuf ); - arg->buf_size = mbuf_data_size; + arg->buf_size = mbuf_data_size[0 ]; }else if (v =='-' )continue ;else
app/test-pmd/cmdline.c +1 -1
@@ -2907,7 +2907,7 @@ struct cmd_setup_rxtx_queue {if (!numa_support || socket_id ==NUMA_NO_CONFIG ) socket_id = port->socket_id; - mp =mbuf_pool_find (socket_id); + mp =mbuf_pool_find (socket_id,0 );if (mp ==NULL ) {printf ("Failed to setup RX queue: " "No mempool allocation"
app/test-pmd/config.c +3 -3
@@ -690,7 +690,7 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("\nConnect to socket: %u" , port->socket_id);if (port_numa[port_id] !=NUMA_NO_CONFIG ) { - mp =mbuf_pool_find (port_numa[port_id]); + mp =mbuf_pool_find (port_numa[port_id],0 );if (mp)printf ("\nmemory allocation on the socket: %d" , port_numa[port_id]);
@@ -3352,9 +3352,9 @@ struct igb_ring_desc_16_bytes {*/ tx_pkt_len =0 ;for (i =0 ; i < nb_segs; i++) { -if (seg_lengths[i] > (unsigned ) mbuf_data_size) { +if (seg_lengths[i] > mbuf_data_size[0 ]) {printf ("length[%u]=%u > mbuf_data_size=%u - give up\n" , - i, seg_lengths[i], (unsigned ) mbuf_data_size); + i, seg_lengths[i], mbuf_data_size[0 ]);return ; } tx_pkt_len = (uint16_t )(tx_pkt_len + seg_lengths[i]);
app/test-pmd/parameters.c +18 -6
@@ -106,7 +106,9 @@ "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");printf (" --socket-num=N: set socket from which all memory is allocated " "in NUMA mode.\n" ); -printf (" --mbuf-size=N: set the data size of mbuf to N bytes.\n" ); +printf (" --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to " +"N bytes. If multiple numbers are specified the extra pools " +"will be created to receive with packet split features\n" );printf (" --total-num-mbufs=N: set the number of mbufs to be allocated " "in mbuf pools.\n" );printf (" --max-pkt-len=N: set the maximum size of packet to N bytes.\n" );
@@ -892,12 +894,22 @@ } }if (!strcmp (lgopts[opt_idx].name,"mbuf-size" )) { - n =atoi (optarg); -if (n >0 && n <=0xFFFF ) - mbuf_data_size = (uint16_t ) n; -else +unsigned int mb_sz[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs, i; + + nb_segs =parse_item_list (optarg,"mbuf-size" , +MAX_SEGS_BUFFER_SPLIT , mb_sz,0 ); +if (nb_segs <=0 )rte_exit (EXIT_FAILURE , -"mbuf-size should be > 0 and < 65536\n" ); +"bad mbuf-size\n" ); +for (i =0 ; i < nb_segs; i++) { +if (mb_sz[i] <=0 || mb_sz[i] >0xFFFF ) +rte_exit (EXIT_FAILURE , +"mbuf-size should be " +"> 0 and < 65536\n" ); + mbuf_data_size[i] = (uint16_t ) mb_sz[i]; + } + mbuf_data_size_n = nb_segs; }if (!strcmp (lgopts[opt_idx].name,"total-num-mbufs" )) { n =atoi (optarg);
app/test-pmd/testpmd.c +35 -28
145 lines not on this page · raw message
app/test-pmd/testpmd.h +19 -5
@@ -42,6 +42,13 @@*/ #define RTE_MAX_SEGS_PER_PKT 255/**< nb_segs is a 8-bit unsigned char. */ +/* +* The maximum number of segments per packet is used to configure +* buffer split feature, also specifies the maximum amount of +* optional Rx pools to allocate mbufs to split. +*/ +#define MAX_SEGS_BUFFER_SPLIT 8/**< nb_segs is a 8-bit unsigned char. */ +#define MAX_PKT_BURST 512#define DEF_PKT_BURST 32
@@ -393,7 +400,9 @@ struct queue_stats_mappings {extern uint8_t dcb_config;extern uint8_t dcb_test; -extern uint16_t mbuf_data_size;/**< Mbuf data space size. */ +extern uint32_t mbuf_data_size_n; +extern uint16_t mbuf_data_size[MAX_SEGS_BUFFER_SPLIT ]; +/**< Mbuf data space size. */ extern uint32_t param_total_num_mbufs;extern uint16_t stats_period;
@@ -605,17 +614,22 @@ struct mplsoudp_decap_conf {/* Mbuf Pools */ static inline void -mbuf_poolname_build (unsigned int sock_id,char * mp_name,int name_size) +mbuf_poolname_build (unsigned int sock_id,char *mp_name, +int name_size,unsigned int idx) { -snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +if (!idx) +snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +else +snprintf (mp_name, name_size,"mbuf_pool_socket_%u_%u" , + sock_id, idx); }static inline struct rte_mempool * -mbuf_pool_find (unsigned int sock_id) +mbuf_pool_find (unsigned int sock_id,unsigned int idx) {char pool_name[RTE_MEMPOOL_NAMESIZE ]; -mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name)); +mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name), idx);return rte_mempool_lookup ((const char *)pool_name); }
doc/guides/testpmd_app_ug/run_app.rst +5 -2
@@ -107,9 +107,12 @@ The command line options are: Set the socket from which all memory is allocated in NUMA mode, where 0 <= N < number of sockets on the board. -* ``--mbuf-size=N`` +* ``--mbuf-size=N[,N1[,...Nn]`` - Set the data size of the mbufs used to N bytes, where N < 65536. The default value is 2048. + Set the data size of the mbufs used to N bytes, where N < 65536. + The default value is 2048. If multiple mbuf-size values are specified the + extra memory pools will be created for allocating mbufs to receive packets + with buffer splittling features. * ``--total-num-mbufs=N``
Signature · 1 line
1.8.3.1
PATCH v6 3/6 app/testpmd: add buffer split offload configuration
In reply to Viacheslav OvsiienkoThis patch add support for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT providing per queue configuration for this offload.
--- app/test-pmd/cmdline.c | 21 +++++++++++---------- app/test-pmd/config.c | 9 +++++++++ 2 files changed, 20 insertions(+), 10 deletions(-)
app/test-pmd/cmdline.c +11 -10
@@ -883,16 +883,16 @@ static void cmd_help_long_parsed(void *parsed_result,"port config <port_id> rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per port Rx offloading" " on all Rx queues of a port\n\n" "port (port_id) rxq (queue_id) rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per queue Rx offloading" " only on a specific Rx queue\n\n"
@@ -18417,7 +18417,8 @@ struct cmd_config_per_port_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc#rss_hash"); +"scatter#buffer_split#timestamp#security#" + "keep_crc#rss_hash");cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result,
@@ -18497,8 +18498,8 @@ struct cmd_config_per_port_rx_offload_result { .help_str = "port config <port_id> rx_offload vlan_strip|ipv4_cksum|""udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc|rss_hash " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc|rss_hash on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, (void *)&cmd_config_per_port_rx_offload_result_config,
@@ -18547,7 +18548,7 @@ struct cmd_config_per_queue_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc"); + "scatter#buffer_split#timestamp#security#keep_crc");cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result,
@@ -18603,8 +18604,8 @@ struct cmd_config_per_queue_rx_offload_result {"vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, (void *)&cmd_config_per_queue_rx_offload_result_port_id,
app/test-pmd/config.c +9 -0
@@ -1092,6 +1092,15 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("off\n" ); } +if (dev_info.rx_offload_capa &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { +printf ("RX offload buffer split: " ); +if (ports[port_id].dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) +printf ("on\n" ); +else +printf ("off\n" ); + } +if (dev_info.tx_offload_capa &DEV_TX_OFFLOAD_VLAN_INSERT ) {printf ("VLAN insert: " ); if (ports[port_id].dev_conf.txmode.offloads &
Signature · 1 line
1.8.3.1
PATCH v6 4/6 app/testpmd: add rxpkts commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxpkts=X[,Y]
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command:
testpmd> set rxpkts (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only). Optionally the multiple memory pools can be specified with --mbuf-size command line parameter and the mbufs to receive will be allocated sequentially from these extra memory pools.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 48 ++++++++++++++++++++++- app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 7 ++++ app/test-pmd/testpmd.h | 11 +++++- doc/guides/testpmd_app_ug/run_app.rst | 9 +++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 +++++++++- 7 files changed, 165 insertions(+), 7 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|txpkts)\n" +"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxpkts (x[,y]*)\n" +" Set the length of each segment to scatter" +" packets on receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set txpkts (x[,y]*)\n" " Set the length of each segment of TXONLY" " and optionally CSUM packets.\n\n"
@@ -3889,6 +3895,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxpkts_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxpkts; +cmdline_fixed_string_t seg_lengths; +}; + +static void +cmd_set_rxpkts_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxpkts_result *res; +unsigned int seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_lengths,"segment lengths" , +MAX_SEGS_BUFFER_SPLIT , seg_lengths,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_lengths, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxpkts_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxpkts_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + rxpkts,"rxpkts" ); +cmdline_parse_token_string_t cmd_set_rxpkts_lengths = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + seg_lengths,NULL ); + +cmdline_parse_inst_t cmd_set_rxpkts = { + .f = cmd_set_rxpkts_parsed, + .data =NULL , + .help_str ="set rxpkts <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxpkts_keyword, + (void *)&cmd_set_rxpkts_name, + (void *)&cmd_set_rxpkts_lengths, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */ struct cmd_set_txpkts_result {
@@ -7517,6 +7569,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxpkts")) +show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))show_tx_pkt_segments (); else if (!strcmp(res->what, "txtimes"))
@@ -7529,12 +7583,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#txpkts#txtimes" ); +"rxtx#cores#fwd#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19807,6 +19861,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit, (cmdline_parse_inst_t *)&cmd_set_txtimes,
app/test-pmd/config.c +46 -2
62 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );printf (" --txonly-multi-flow: generate multiple flows in txonly mode\n" );
@@ -662,6 +663,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 }, { "disable-link-check", 0, 0, 0 },
@@ -1272,6 +1274,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) { +unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + nb_segs =parse_item_list + (optarg,"rxpkt segments" , +MAX_SEGS_BUFFER_SPLIT , + seg_len,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_len, nb_segs); +else +rte_exit (EXIT_FAILURE ,"bad rxpkts\n" ); + }if (!strcmp (lgopts[opt_idx].name,"txpkts" )) {unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +7 -0
@@ -210,6 +210,13 @@ struct fwd_engine * fwd_engines[] = {uint8_t f_quit;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ uint16_t tx_pkt_length =TXONLY_DEF_PACKET_LEN ;/**< TXONLY packet length. */
app/test-pmd/testpmd.h +10 -1
@@ -420,6 +420,13 @@ struct queue_stats_mappings {extern struct rte_fdir_conf fdir_conf;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ #define TXONLY_DEF_PACKET_LEN 64
@@ -816,7 +823,9 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_record_core_cycles (uint8_t on_off);void set_record_burst_stats (uint8_t on_off);void set_verbose_level (uint16_t vb_level); -void set_tx_pkt_segments (unsigned *seg_lengths,unsigned nb_segs); +void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs); +void show_rx_pkt_segments (void ); +void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);void show_tx_pkt_times (void );
doc/guides/testpmd_app_ug/run_app.rst +9 -0
@@ -361,6 +361,15 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxpkts=X[,Y]`` + + Set the length of segments to scatter packets on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + Optionally the multiple memory pools can be specified with --mbuf-size + command line parameter and the mbufs to receive will be allocated + sequentially from these extra memory pools. + * ``--txpkts=X[,Y]`` Set TX segment sizes or total packet length. Valid for ``tx-only``
doc/guides/testpmd_app_ug/testpmd_funcs.rst +20 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxpkts``: Packets to RX split configuration. + * ``txpkts``: Packets to TX configuration. * ``txtimes``: Burst time pattern for Tx only mode.
@@ -774,6 +776,23 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxpkts +~~~~~~~~~~ + +Set the length of segments to scatter packets on receiving if split +feature is engaged. Affects only the queues configured with split offloads +(currently BUFFER_SPLIT is supported only). Optionally the multiple memory +pools can be specified with --mbuf-size command line parameter and the mbufs +to receive will be allocated sequentially from these extra memory pools (the +mbuf for the first segment is allocated from the first pool, the second one +from the second pool, and so on, if segment number is greater then pool's the +mbuf for remaining segments will be allocated from the last valid pool). + + testpmd> set rxpkts (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. Zero value +means to use the corresponding memory pool data buffer size. + set txpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v6 5/6 app/testpmd: add rxoffs commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxoffs=X[,Y]
Sets the offsets of packet segments from the beginning of the receiving buffer if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command, providing the same:
testpmd> set rxoffs (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 44 +++++++++++++++++++++ app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 2 + app/test-pmd/testpmd.h | 4 ++ doc/guides/testpmd_app_ug/run_app.rst | 6 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 17 +++++++- 7 files changed, 145 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" +"show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxoffs (x[,y]*)\n" +" Set the offset of each packet segment on" +" receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set rxpkts (x[,y]*)\n" " Set the length of each segment to scatter" " packets on receiving if split feature is engaged."
@@ -3895,6 +3901,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT OFFSETS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxoffs_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxoffs; +cmdline_fixed_string_t seg_offsets; +}; + +static void +cmd_set_rxoffs_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxoffs_result *res; +unsigned int seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_offsets,"segment offsets" , +MAX_SEGS_BUFFER_SPLIT , seg_offsets,0 ); +if (nb_segs >0 ) +set_rx_pkt_offsets (seg_offsets, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxoffs_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxoffs_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + rxoffs,"rxoffs" ); +cmdline_parse_token_string_t cmd_set_rxoffs_offsets = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + seg_offsets,NULL ); + +cmdline_parse_inst_t cmd_set_rxoffs = { + .f = cmd_set_rxoffs_parsed, + .data =NULL , + .help_str ="set rxoffs <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxoffs_keyword, + (void *)&cmd_set_rxoffs_name, + (void *)&cmd_set_rxoffs_offsets, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ struct cmd_set_rxpkts_result {
@@ -7569,6 +7621,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxoffs")) +show_rx_pkt_offsets (); else if (!strcmp(res->what, "rxpkts"))show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))
@@ -7583,12 +7637,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#rxpkts#txpkts#txtimes" ); +"rxtx#cores#fwd#rxoffs#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19861,6 +19915,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxoffs, (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit,
app/test-pmd/config.c +44 -0
50 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxoffs=X[,Y]*: set RX segment offsets for split.\n" );printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );
@@ -663,6 +664,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxoffs", 1, 0, 0 }, { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 },
@@ -1274,6 +1276,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxoffs" )) { +unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_offs; + + nb_offs =parse_item_list + (optarg,"rxpkt offsets" , +MAX_SEGS_BUFFER_SPLIT , + seg_off,0 ); +if (nb_offs >0 ) +set_rx_pkt_offsets (seg_off, nb_offs); +else +rte_exit (EXIT_FAILURE ,"bad rxoffs\n" ); + }if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) {unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +2 -0
@@ -215,6 +215,8 @@ struct fwd_engine * fwd_engines[] = {*/ uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
app/test-pmd/testpmd.h +4 -0
@@ -425,6 +425,8 @@ struct queue_stats_mappings {*/ extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
@@ -825,6 +827,8 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_verbose_level (uint16_t vb_level);void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_rx_pkt_segments (void ); +void set_rx_pkt_offsets (unsigned int *seg_offsets,unsigned int nb_offs); +void show_rx_pkt_offsets (void );void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);
doc/guides/testpmd_app_ug/run_app.rst +6 -0
@@ -361,6 +361,12 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxoffs=X[,Y]`` + + Set the offsets of packet segments on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + * ``--rxpkts=X[,Y]`` Set the length of segments to scatter packets on receiving if split
doc/guides/testpmd_app_ug/testpmd_funcs.rst +16 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxoffs``: Packet offsets for RX split. + * ``rxpkts``: Packets to RX split configuration. * ``txpkts``: Packets to TX configuration.
@@ -776,6 +778,19 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxoffs +~~~~~~~~~~ + +Set the offsets of segments relating to the data buffer beginning on receiving +if split feature is engaged. Affects only the queues configured with split +offloads (currently BUFFER_SPLIT is supported only). + + testpmd> set rxoffs (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. If the list +of offsets is shorter than the list of segments the zero offsets will be used +for the remaining segments. + set rxpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v6 6/6 app/testpmd: add extended Rx queue setup
In reply to Viacheslav OvsiienkoIf Rx queue is configured with split feature the extended setup with specified segment sizes and pool will be performed.
--- app/test-pmd/cmdline.c | 12 ++++++------ app/test-pmd/testpmd.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- app/test-pmd/testpmd.h | 5 +++++ 3 files changed, 57 insertions(+), 8 deletions(-)
app/test-pmd/cmdline.c +6 -6
@@ -2927,12 +2927,12 @@ struct cmd_setup_rxtx_queue { rxring_numa[res->portid]);return ; } - ret =rte_eth_rx_queue_setup (res->portid, - res->qid, - port->nb_rx_desc[res->qid], - socket_id, - &port->rx_conf[res->qid], - mp); + ret =rx_queue_setup (res->portid, + res->qid, + port->nb_rx_desc[res->qid], + socket_id, + &port->rx_conf[res->qid], + mp);if (ret)printf ("Failed to setup RX queue\n" ); }else {
app/test-pmd/testpmd.c +46 -2
66 lines not on this page · raw message
app/test-pmd/testpmd.h +5 -0
@@ -876,6 +876,11 @@ void port_rss_reta_info(portid_t port_id,void set_vf_traffic (portid_t port_id,uint8_t is_rx,uint16_t vf,uint8_t on); +int +rx_queue_setup (uint16_t port_id,uint16_t rx_queue_id, +uint16_t nb_rx_desc,unsigned int socket_id, +struct rte_eth_rxconf *rx_conf,struct rte_mempool *mp); +int set_queue_rate_limit (portid_t port_id,uint16_t queue_idx,uint16_t rate);int set_vf_rate_limit (portid_t port_id,uint16_t vf,uint16_t rate,uint64_t q_msk);
Signature · 1 line
1.8.3.1
PATCH v2 1/1 eal/rte_malloc: add alloc_size() attribute to allocation functions
In reply to Slava OvsiienkoBy using the alloc_size() attribute the compiler can optimize better and detect errors at compile time.
For example, Gcc will fail one of the invalid allocation examples in app/test/test_malloc.c because the allocation is outside the limits of memory.
---
v2 - rebase onto correct branch (main)
app/test/test_malloc.c | 5 ++++- lib/librte_eal/include/rte_common.h | 12 ++++++++++++ lib/librte_eal/include/rte_malloc.h | 24 ++++++++++++++++-------- 3 files changed, 32 insertions(+), 9 deletions(-)
app/test/test_malloc.c +4 -1
@@ -846,6 +846,9 @@ test_malloc_bad_params(void)if (bad_ptr !=NULL ) goto err_return; +#if defined(RTE_CC_GCC ) || defined(RTE_CC_CLANG ) +/* this test can not be built, will get trapped at compile time! */ +#else /* rte_malloc expected to return null with size will cause overflow */ align =RTE_CACHE_LINE_SIZE ; size = (size_t )-8 ;
@@ -857,7 +860,7 @@ test_malloc_bad_params(void) bad_ptr =rte_realloc (NULL , size, align);if (bad_ptr !=NULL ) goto err_return; - +#endif return 0 ; err_return:
lib/librte_eal/include/rte_common.h +12 -0
@@ -134,6 +134,18 @@ typedef uint16_t unaligned_uint16_t; __attribute__((format(printf, format_index, first_arg)))#endif +/** +* Tells compiler that the function returns a value that points to +* memory, where the size is given by the one or two arguments. +* Used by compiler to validate object size. +*/ +#if defined(RTE_CC_GCC ) || defined(RTE_CC_CLANG ) +#define __rte_alloc_size (...) \ + __attribute__((alloc_size(__VA_ARGS__))) +#else +#define __rte_alloc_size (...) +#endif +#define RTE_PRIORITY_LOG 101#define RTE_PRIORITY_BUS 110#define RTE_PRIORITY_CLASS 120
lib/librte_eal/include/rte_malloc.h +16 -8
@@ -54,7 +54,8 @@ struct rte_malloc_socket_stats {* - Otherwise, the pointer to the allocated object. */ void * -rte_malloc (const char *type,size_t size,unsigned align); +rte_malloc (const char *type,size_t size,unsigned align) +__rte_alloc_size (2 );/** * Allocate zero'ed memory from the heap.
@@ -80,7 +81,8 @@ rte_malloc(const char *type, size_t size, unsigned align);* - Otherwise, the pointer to the allocated object. */ void * -rte_zmalloc (const char *type,size_t size,unsigned align); +rte_zmalloc (const char *type,size_t size,unsigned align) +__rte_alloc_size (2 );/** * Replacement function for calloc(), using huge-page memory. Memory area is
@@ -106,7 +108,8 @@ rte_zmalloc(const char *type, size_t size, unsigned align);* - Otherwise, the pointer to the allocated object. */ void * -rte_calloc (const char *type,size_t num,size_t size,unsigned align); +rte_calloc (const char *type,size_t num,size_t size,unsigned align) +__rte_alloc_size (2 ,3 );/** * Replacement function for realloc(), using huge-page memory. Reserved area
@@ -129,7 +132,8 @@ rte_calloc(const char *type, size_t num, size_t size, unsigned align);* - Otherwise, the pointer to the reallocated memory. */ void * -rte_realloc (void *ptr,size_t size,unsigned int align); +rte_realloc (void *ptr,size_t size,unsigned int align) +__rte_alloc_size (2 );/** * Replacement function for realloc(), using huge-page memory. Reserved area
@@ -155,7 +159,8 @@ rte_realloc(void *ptr, size_t size, unsigned int align);*/ __rte_experimental void * -rte_realloc_socket (void *ptr,size_t size,unsigned int align,int socket); +rte_realloc_socket (void *ptr,size_t size,unsigned int align,int socket) +__rte_alloc_size (2 ,3 );/** * This function allocates memory from the huge-page area of memory. The memory
@@ -181,7 +186,8 @@ rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket);* - Otherwise, the pointer to the allocated object. */ void * -rte_malloc_socket (const char *type,size_t size,unsigned align,int socket); +rte_malloc_socket (const char *type,size_t size,unsigned align,int socket) +__rte_alloc_size (2 );/** * Allocate zero'ed memory from the heap.
@@ -209,7 +215,8 @@ rte_malloc_socket(const char *type, size_t size, unsigned align, int socket);* - Otherwise, the pointer to the allocated object. */ void * -rte_zmalloc_socket (const char *type,size_t size,unsigned align,int socket); +rte_zmalloc_socket (const char *type,size_t size,unsigned align,int socket) +__rte_alloc_size (2 );/** * Replacement function for calloc(), using huge-page memory. Memory area is
@@ -237,7 +244,8 @@ rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket);* - Otherwise, the pointer to the allocated object. */ void * -rte_calloc_socket (const char *type,size_t num,size_t size,unsigned align,int socket); +rte_calloc_socket (const char *type,size_t num,size_t size,unsigned align,int socket) +__rte_alloc_size (2 ,3 );/** * Frees the memory space pointed to by the provided pointer.
Signature · 1 line
2.27.0
Re: [dpdk-dev] [PATCH v2] eal/rte_malloc: add alloc_size() attribute to allocation functions
15/10/2020 02:55, Stephen Hemminger:
Quoted 10 lines
By using the
alloc_size()attribute the compiler can optimize better and detect errors at compile time.For example, Gcc will fail one of the invalid allocation examples in
app/test/test_malloc.cbecause the allocation is outside the limits of memory.Signed-off-by Stephen Hemminger <[email protected]>---
v2 - rebase onto correct branch (main)
[...]
lib/librte_eal/include/rte_common.h typedef uint16_t unaligned_uint16_t; · line 147
Quoted 11 lines
lib/librte_eal/include/rte_common.h +11
-0+/** +* Tells compiler that the function returns a value that points to +* memory, where the size is given by the one or two arguments. +* Used by compiler to validate object size. +*/ +#if defined(RTE_CC_GCC ) || defined(RTE_CC_CLANG ) +#define __rte_alloc_size (...) \ + __attribute__((alloc_size(__VA_ARGS__))) +#else +#define __rte_alloc_size (...) +#endif
Not sure about the rebase: RTE_CC_GCC and RTE_CC_CLANG don't exist.
Thomas Monjalon
AppliedRe: [dpdk-dev] [PATCH v2] eal/rte_malloc: add alloc_size() attribute to allocation functions
19/10/2020 16:13, Thomas Monjalon:
Quoted 12 lines
15/10/2020 02:55, Stephen Hemminger:
Quoted 10 lines
By using the
alloc_size()attribute the compiler can optimize better and detect errors at compile time.For example, Gcc will fail one of the invalid allocation examples in
app/test/test_malloc.cbecause the allocation is outside the limits of memory.Signed-off-by Stephen Hemminger <[email protected]>---
v2 - rebase onto correct branch (main)[...]
Quoted 13 lines
lib/librte_eal/include/rte_common.h typedef uint16_t unaligned_uint16_t; · line 147
Quoted 11 lines
lib/librte_eal/include/rte_common.h +11
-0+/** +* Tells compiler that the function returns a value that points to +* memory, where the size is given by the one or two arguments. +* Used by compiler to validate object size. +*/ +#if defined(RTE_CC_GCC ) || defined(RTE_CC_CLANG ) +#define __rte_alloc_size (...) \ + __attribute__((alloc_size(__VA_ARGS__))) +#else +#define __rte_alloc_size (...) +#endif Not sure about the rebase:
RTE_CC_GCCandRTE_CC_CLANGdon't exist.
Actually no, I forgot my 7-month old patch introducing them.
Applied, thanks
v7 cover ethdev: introduce Rx buffer split
In reply to Slava OvsiienkoThe DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
---
v1: http://patches.dpdk.org/patch/79594/
v2: http://patches.dpdk.org/patch/79893/
- add feature support to mlx5 PMD
v3: http://patches.dpdk.org/patch/80389/
- rte_eth_rx_queue_setup_ex is renamed to rte_eth_rxseg_queue_setup
- DEV_RX_OFFLOAD_BUFFER_SPLIT is renamed to RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT
- commit message update
- documentaion provided
- release notes update
- minor bug fixes in testpmd related part
v4: http://patches.dpdk.org/patch/80401/
- common part of rx_queue_setup/rxseg_queue_setup
v5: http://patches.dpdk.org/patch/80609/
- refactored to approach of providing split configuration in the rte_eth_rxconf structure instead of introducing the new API routine
- added support for rxoffs command to testpmd to provide segment offsets for complete testing of split configurations
- patchset is split into two parts - PMD part will be presented as separate series
v6: http://patches.dpdk.org/patch/80785/
- wordy comments rephrased
- typos fixed
- rte_eth_rx_queue_setup configuration check isolated for two main options
- the rest of comments addressed
v7: - description as union of feature dedicated segment split description
- the split limitations reported in the rte_eth_dev_info->rx_seg_capa
- comments made less wordy
Viacheslav Ovsiienko (6):
ethdev: introduce Rx buffer split app/testpmd: add multiple pools per core creation app/testpmd: add buffer split offload configuration app/testpmd: add rxpkts commands and parameters app/testpmd: add rxoffs commands and parameters app/testpmd: add extended Rx queue setup
app/test-pmd/bpf_cmd.c | 4 +- app/test-pmd/cmdline.c | 151 +++++++++++++++++++++++---- app/test-pmd/config.c | 107 +++++++++++++++++++- app/test-pmd/parameters.c | 54 ++++++++-- app/test-pmd/testpmd.c | 120 ++++++++++++++++------ app/test-pmd/testpmd.h | 44 ++++++-- doc/guides/nics/features.rst | 15 +++ doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_20_11.rst | 9 ++ doc/guides/testpmd_app_ug/run_app.rst | 22 +++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 36 ++++++- lib/librte_ethdev/rte_ethdev.c | 152 +++++++++++++++++++++++----- lib/librte_ethdev/rte_ethdev.h | 87 +++++++++++++++- 13 files changed, 703 insertions(+), 103 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v7 1/6 ethdev: introduce Rx buffer split
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
--- doc/guides/nics/features.rst | 15 ++++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 ++ lib/librte_ethdev/rte_ethdev.c | 152 +++++++++++++++++++++++++++------ lib/librte_ethdev/rte_ethdev.h | 87 ++++++++++++++++++- 5 files changed, 237 insertions(+), 31 deletions(-)
doc/guides/nics/features.rst +15 -0
@@ -185,6 +185,21 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[provides] eth_dev_ops**: ``rxq_info_get:buffer_split``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LRO
doc/guides/rel_notes/deprecation.rst +0 -5
@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``
doc/guides/rel_notes/release_20_11.rst +9 -0
@@ -60,6 +60,12 @@ New Features Added the FEC API which provides functions for query FEC capabilities and current FEC mode from device. Also, API for configuring FEC mode is also provided. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:
@@ -253,6 +259,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functions
lib/librte_ethdev/rte_ethdev.c +127 -25
186 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev.h +86 -1
125 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 98 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.The following structure is introduced to specify the Rx packet segment for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLIToffload:struct
rte_eth_rxseg_split{struct
rte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length,
configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2 seg1 - pool1, len1=20B, off1=128B seg2 - pool2, len2=20B, off2=0B seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The split limitations imposed by underlying PMD is reported in the new introduced
rte_eth_dev_info->rx_seg_capafield.The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Quoted 1 line
Signed-off-by Viacheslav Ovsiienko <[email protected]>
LGTM,
Quoted 409 lines
--- doc/guides/nics/features.rst | 15 ++++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 ++ lib/librte_ethdev/rte_ethdev.c | 152 +++++++++++++++++++++++++++------ lib/librte_ethdev/rte_ethdev.h | 87 ++++++++++++++++++- 5 files changed, 237 insertions(+), 31 deletions(-)doc/guides/nics/features.rst +15
-0@@ -185,6 +185,21 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[provides] eth_dev_ops**: ``rxq_info_get:buffer_split``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LROdoc/guides/rel_notes/deprecation.rst +0
-5@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``doc/guides/rel_notes/release_20_11.rst +9
-0@@ -60,6 +60,12 @@ New Features Added the FEC API which provides functions for query FEC capabilities and current FEC mode from device. Also, API for configuring FEC mode is also provided. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:@@ -253,6 +259,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functionslib/librte_ethdev/rte_ethdev.c +127
-25@@ -105,6 +105,9 @@ struct rte_eth_xstats_name_off {#define RTE_RX_OFFLOAD_BIT2STR (_name) \ { DEV_RX_OFFLOAD_##_name, #_name } +#define RTE_ETH_RX_OFFLOAD_BIT2STR (_name) \ + { RTE_ETH_RX_OFFLOAD_##_name, #_name } + static const struct { uint64_t offload; const char *name;@@ -128,9 +131,11 @@ struct rte_eth_xstats_name_off {RTE_RX_OFFLOAD_BIT2STR (SCTP_CKSUM ),RTE_RX_OFFLOAD_BIT2STR (OUTER_UDP_CKSUM ),RTE_RX_OFFLOAD_BIT2STR (RSS_HASH ), + RTE_ETH_RX_OFFLOAD_BIT2STR(BUFFER_SPLIT), };#undef RTE_RX_OFFLOAD_BIT2STR +#undef RTE_ETH_RX_OFFLOAD_BIT2STR#define RTE_TX_OFFLOAD_BIT2STR (_name) \ { DEV_TX_OFFLOAD_##_name, #_name }@@ -1763,6 +1768,77 @@ struct rte_eth_dev *return ret; } +static int +rte_eth_rx_queue_check_split (const struct rte_eth_rxseg *rx_seg, +uint16_t n_seg,uint32_t *mbp_buf_size, +const struct rte_eth_dev_info *dev_info) +{ +const struct rte_eth_rxseg_capa *seg_capa = &dev_info->rx_seg_capa; +struct rte_mempool *mp_first; +uint32_t offset_mask; +uint16_t seg_idx; + +if (n_seg > seg_capa->max_seg) { +RTE_ETHDEV_LOG (ERR , +"Requested Rx segments %u exceed supported %u\n" , + n_seg, seg_capa->max_seg); +return -EINVAL ; + } +/* +* Check the sizes and offsets against buffer sizes +* for each segment specified in extended configuration. +*/ + mp_first = rx_seg[0 ].split.mp; + offset_mask = (1u << seg_capa->offset_align_log2) -1 ; +for (seg_idx =0 ; seg_idx < n_seg; seg_idx++) { +struct rte_mempool *mpl = rx_seg[seg_idx].split.mp; +uint32_t length = rx_seg[seg_idx].split.length; +uint32_t offset = rx_seg[seg_idx].split.offset; + +if (mpl ==NULL ) { +RTE_ETHDEV_LOG (ERR ,"null mempool pointer\n" ); +return -EINVAL ; + } +if (seg_idx !=0 && mp_first != mpl && + seg_capa->multi_pools ==0 ) { +RTE_ETHDEV_LOG (ERR ,"Receiving to multiple pools is not supported\n" ); +return -ENOTSUP ; + } +if (offset !=0 ) { +if (seg_capa->offset_allowed ==0 ) { +RTE_ETHDEV_LOG (ERR ,"Rx segmentation with offset is not supported\n" ); +return -ENOTSUP ; + } +if (offset & offset_mask) { +RTE_ETHDEV_LOG (ERR ,"Rx segmentat invalid offset alignment %u, %u\n" , + offset, + seg_capa->offset_align_log2); +return -EINVAL ; + } + } +if (mpl->private_data_size < +sizeof (struct rte_pktmbuf_pool_private )) { +RTE_ETHDEV_LOG (ERR , +"%s private_data_size %u < %u\n" , + mpl->name, mpl->private_data_size, + (unsigned int )sizeof + (struct rte_pktmbuf_pool_private )); +return -ENOSPC ; + } + offset += seg_idx !=0 ?0 :RTE_PKTMBUF_HEADROOM ; + *mbp_buf_size =rte_pktmbuf_data_room_size (mpl); + length = length !=0 ? length : *mbp_buf_size; +if (*mbp_buf_size < length + offset) { +RTE_ETHDEV_LOG (ERR , +"%s mbuf_data_room_size %u < %u (segment length=%u + segment offset=%u)\n" , + mpl->name, *mbp_buf_size, + length + offset, length, offset); +return -EINVAL ; + } + } +return 0 ; +} + int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id,@@ -1784,38 +1860,64 @@ struct rte_eth_dev *return -EINVAL ; } -if (mp ==NULL ) { -RTE_ETHDEV_LOG (ERR ,"Invalid null mempool pointer\n" ); -return -EINVAL ; - } -RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rx_queue_setup, -ENOTSUP ); -/* -* Check the size of the mbuf data buffer. -* This value must be provided in the private data of the memory pool. -* First check that the memory pool has a valid private data. -*/ ret =rte_eth_dev_info_get (port_id, &dev_info);if (ret !=0 )return ret; -if (mp->private_data_size <sizeof (struct rte_pktmbuf_pool_private )) { -RTE_ETHDEV_LOG (ERR ,"%s private_data_size %d < %d\n" , - mp->name, (int )mp->private_data_size, - (int )sizeof (struct rte_pktmbuf_pool_private )); -return -ENOSPC ; - } - mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mp !=NULL ) { +/* Single pool configuration check. */ +if (rx_conf->rx_nseg !=0 ) { +RTE_ETHDEV_LOG (ERR , +"Ambiguous segment configuration\n" ); +return -EINVAL ; + } +/* +* Check the size of the mbuf data buffer, this value +* must be provided in the private data of the memory pool. +* First check that the memory pool(s) has a valid private data. +*/ +if (mp->private_data_size < +sizeof (struct rte_pktmbuf_pool_private )) { +RTE_ETHDEV_LOG (ERR ,"%s private_data_size %u < %u\n" , + mp->name, mp->private_data_size, + (unsigned int ) +sizeof (struct rte_pktmbuf_pool_private )); +return -ENOSPC ; + } + mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mbp_buf_size < dev_info.min_rx_bufsize + +RTE_PKTMBUF_HEADROOM ) { +RTE_ETHDEV_LOG (ERR , +"%s mbuf_data_room_size %u < %u (RTE_PKTMBUF_HEADROOM=%u + min_rx_bufsize(dev)=%u)\n" , + mp->name, mbp_buf_size, +RTE_PKTMBUF_HEADROOM + + dev_info.min_rx_bufsize, +RTE_PKTMBUF_HEADROOM , + dev_info.min_rx_bufsize); +return -EINVAL ; + } + }else { +const struct rte_eth_rxseg *rx_seg = rx_conf->rx_seg; +uint16_t n_seg = rx_conf->rx_nseg; -if (mbp_buf_size < dev_info.min_rx_bufsize +RTE_PKTMBUF_HEADROOM ) { -RTE_ETHDEV_LOG (ERR , -"%s mbuf_data_room_size %d < %d (RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)=%d)\n" , - mp->name, (int )mbp_buf_size, - (int )(RTE_PKTMBUF_HEADROOM + dev_info.min_rx_bufsize), - (int )RTE_PKTMBUF_HEADROOM , - (int )dev_info.min_rx_bufsize); -return -EINVAL ; +/* Extended multi-segment configuration check. */ +if (rx_conf->rx_seg ==NULL || rx_conf->rx_nseg ==0 ) { +RTE_ETHDEV_LOG (ERR , +"Memory pool is null and no extended configuration provided\n" ); +return -EINVAL ; + } +if (rx_conf->offloads &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { + ret =rte_eth_rx_queue_check_split (rx_seg, n_seg, + &mbp_buf_size, + &dev_info); +if (ret !=0 ) +return ret; + }else { +RTE_ETHDEV_LOG (ERR ,"No Rx segmentation offload configured\n" ); +return -EINVAL ; + } }/* Use default specified by driver, if nb_rx_desc is zero */ lib/librte_ethdev/rte_ethdev.h +86
-2@@ -970,6 +970,27 @@ struct rte_eth_txmode { };/** +* A structure used to configure an Rx packet segment to split. +*/ +struct rte_eth_rxseg_split { +struct rte_mempool *mp;/**< Memory pool to allocate segment from. */ +uint16_t length;/**< Segment data length, configures split point. */ +uint16_t offset;/**< Data offset from beginning of mbuf data buffer. */ +uint32_t reserved;/**< Reserved field. */ +}; + +/** +* A common structure used to describe Rx packet segment properties. +*/ +struct rte_eth_rxseg { +union { +/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split; +/* The other features settings should be added here. */ + }; +}; + +/** * A structure used to configure an RX ring of an Ethernet port. */ struct rte_eth_rxconf {@@ -977,6 +998,46 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */ uint8_t rx_deferred_start;/**< Do not start queue with rte_eth_dev_start(). */ +uint16_t rx_nseg;/**< Number of descriptions in rx_seg array. */ +/** +* Points to the array of segment descriptions. Each array element +* describes the properties for each segment in the receiving +* buffer according to feature descripting structure. +* +* The supported capabilties of receiving segmentation is reported +* in rte_eth_dev_info ->rx_seg_capa field. +* +* If RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag is set in offloads field, +* the PMD will split the received packets into multiple segments +* according to the specification in the description array: +* +* - the first network buffer will be allocated from the memory pool, +* specified in the first array element, the second buffer, from the +* pool in the second element, and so on. +* +* - the offsets from the segment description elements specify +* the data offset from the buffer beginning except the first mbuf. +* For this one the offset is added with RTE_PKTMBUF_HEADROOM. +* +* - the lengths in the elements define the maximal data amount +* being received to each segment. The receiving starts with filling +* up the first mbuf data buffer up to specified length. If the +* there are data remaining (packet is longer than buffer in the first +* mbuf) the following data will be pushed to the next segment +* up to its own length, and so on. +* +* - If the length in the segment description element is zero +* the actual buffer size will be deduced from the appropriate +* memory pool properties. +* +* - if there is not enough elements to describe the buffer for entire +* packet of maximal length the following parameters will be used +* for the all remaining segments: +* - pool from the last valid element +* - the buffer size from this pool +* - zero offset +*/ +struct rte_eth_rxseg *rx_seg;/** * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. * Only offloads set on rx_queue_offload_capa or rx_offload_capa @@ -1260,6 +1321,7 @@ struct rte_eth_conf {#define DEV_RX_OFFLOAD_SCTP_CKSUM 0x00020000#define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000#define DEV_RX_OFFLOAD_RSS_HASH 0x00080000 +#define RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT 0x00100000#define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \@@ -1376,6 +1438,16 @@ struct rte_eth_switch_info { };/** +* Ethernet device Rx buffer segmentation capabilities. +*/ +struct rte_eth_rxseg_capa { +uint16_t max_seg;/**< Maximum amount of segments to split. */ +uint8_t multi_pools;/**< Supports receiving to multiple pools.*/ +uint8_t offset_allowed;/**< Supports buffer offsets. */ +uint8_t offset_align_log2;/**< Required offset alignment. */ +}; + +/** * Ethernet device information */ @@ -1403,6 +1475,7 @@ struct rte_eth_dev_info {/** Maximum number of hash MAC addresses for MTA and UTA. */ uint16_t max_vfs;/**< Maximum number of VFs. */ uint16_t max_vmdq_pools;/**< Maximum number of VMDq pools. */ +struct rte_eth_rxseg_capa rx_seg_capa;/**< Segmentation capability.*/ uint64_t rx_offload_capa;/**< All RX offload capabilities including all per-queue ones */ uint64_t tx_offload_capa;@@ -2027,9 +2100,21 @@ int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue,* No need to repeat any bit in rx_conf->offloads which has already been * enabled in rte_eth_dev_configure() at port level. An offloading enabled * at port level can't be disabled at queue level. +* The configuration structure also contains the pointer to the array +* of the receiving buffer segment descriptions, see rx_seg and rx_nseg +* fields, this extended configuration might be used by split offloads like +* RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT. If mp_pool is not NULL, +* the extended configuration fields must be set to NULL and zero. * @param mb_pool * The pointer to the memory pool from which to allocate *rte_mbuf* network -* memory buffers to populate each descriptor of the receive ring. +* memory buffers to populate each descriptor of the receive ring. There are +* two options to provide Rx buffer configuration: +* - single pool: +* mb_pool is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is 0. +* - multiple segments description: +* mb_pool is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not 0. +* Taken only if flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT is set in offloads. +* * @return * - 0: Success, receive queue correctly set up. * - -EIO: if device is removed. -- 1.8.3.1
15/10/2020 22:17, Viacheslav Ovsiienko:
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1448
Quoted 9 lines
/**
+ * Ethernet device Rx buffer segmentation capabilities.
+ */lib/librte_ethdev/rte_ethdev.h +6
-0+struct rte_eth_rxseg_capa { +uint16_t max_seg;/**< Maximum amount of segments to split. */ +uint8_t multi_pools;/**< Supports receiving to multiple pools.*/ +uint8_t offset_allowed;/**< Supports buffer offsets. */ +uint8_t offset_align_log2;/**< Required offset alignment. */ +};
Why not having bit fields for these last three?
Quoted 13 lines · Thomas Monjalon
15/10/2020 22:17, Viacheslav Ovsiienko:
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1448
Quoted 9 lines
/**
+ * Ethernet device Rx buffer segmentation capabilities.
+ */lib/librte_ethdev/rte_ethdev.h +6
-0+struct rte_eth_rxseg_capa { +uint16_t max_seg;/**< Maximum amount of segments to split. */ +uint8_t multi_pools;/**< Supports receiving to multiple pools.*/ +uint8_t offset_allowed;/**< Supports buffer offsets. */ +uint8_t offset_align_log2;/**< Required offset alignment. */ +};Why not having bit fields for these last three?
+1
Quoted 3 lines
PATCH v7 2/6 app/testpmd: add multiple pools per core creation
In reply to Viacheslav OvsiienkoThe command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with rte_the_dev_rx_queue_setup_ex().
The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
--- app/test-pmd/bpf_cmd.c | 4 +-- app/test-pmd/cmdline.c | 2 +- app/test-pmd/config.c | 6 ++-- app/test-pmd/parameters.c | 24 +++++++++---- app/test-pmd/testpmd.c | 63 +++++++++++++++++++---------------- app/test-pmd/testpmd.h | 24 ++++++++++--- doc/guides/testpmd_app_ug/run_app.rst | 7 ++-- 7 files changed, 83 insertions(+), 47 deletions(-)
app/test-pmd/bpf_cmd.c +2 -2
@@ -69,7 +69,7 @@ struct cmd_bpf_ld_result { *flags =RTE_BPF_ETH_F_NONE ; arg->type =RTE_BPF_ARG_PTR ; - arg->size = mbuf_data_size; + arg->size = mbuf_data_size[0 ];for (i =0 ; str[i] !=0 ; i++) { v =toupper (str[i]);
@@ -78,7 +78,7 @@ struct cmd_bpf_ld_result {else if (v =='M' ) { arg->type =RTE_BPF_ARG_PTR_MBUF ; arg->size =sizeof (struct rte_mbuf ); - arg->buf_size = mbuf_data_size; + arg->buf_size = mbuf_data_size[0 ]; }else if (v =='-' )continue ;else
app/test-pmd/cmdline.c +1 -1
@@ -2907,7 +2907,7 @@ struct cmd_setup_rxtx_queue {if (!numa_support || socket_id ==NUMA_NO_CONFIG ) socket_id = port->socket_id; - mp =mbuf_pool_find (socket_id); + mp =mbuf_pool_find (socket_id,0 );if (mp ==NULL ) {printf ("Failed to setup RX queue: " "No mempool allocation"
app/test-pmd/config.c +3 -3
@@ -690,7 +690,7 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("\nConnect to socket: %u" , port->socket_id);if (port_numa[port_id] !=NUMA_NO_CONFIG ) { - mp =mbuf_pool_find (port_numa[port_id]); + mp =mbuf_pool_find (port_numa[port_id],0 );if (mp)printf ("\nmemory allocation on the socket: %d" , port_numa[port_id]);
@@ -3352,9 +3352,9 @@ struct igb_ring_desc_16_bytes {*/ tx_pkt_len =0 ;for (i =0 ; i < nb_segs; i++) { -if (seg_lengths[i] > (unsigned ) mbuf_data_size) { +if (seg_lengths[i] > mbuf_data_size[0 ]) {printf ("length[%u]=%u > mbuf_data_size=%u - give up\n" , - i, seg_lengths[i], (unsigned ) mbuf_data_size); + i, seg_lengths[i], mbuf_data_size[0 ]);return ; } tx_pkt_len = (uint16_t )(tx_pkt_len + seg_lengths[i]);
app/test-pmd/parameters.c +18 -6
@@ -106,7 +106,9 @@ "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");printf (" --socket-num=N: set socket from which all memory is allocated " "in NUMA mode.\n" ); -printf (" --mbuf-size=N: set the data size of mbuf to N bytes.\n" ); +printf (" --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to " +"N bytes. If multiple numbers are specified the extra pools " +"will be created to receive with packet split features\n" );printf (" --total-num-mbufs=N: set the number of mbufs to be allocated " "in mbuf pools.\n" );printf (" --max-pkt-len=N: set the maximum size of packet to N bytes.\n" );
@@ -892,12 +894,22 @@ } }if (!strcmp (lgopts[opt_idx].name,"mbuf-size" )) { - n =atoi (optarg); -if (n >0 && n <=0xFFFF ) - mbuf_data_size = (uint16_t ) n; -else +unsigned int mb_sz[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs, i; + + nb_segs =parse_item_list (optarg,"mbuf-size" , +MAX_SEGS_BUFFER_SPLIT , mb_sz,0 ); +if (nb_segs <=0 )rte_exit (EXIT_FAILURE , -"mbuf-size should be > 0 and < 65536\n" ); +"bad mbuf-size\n" ); +for (i =0 ; i < nb_segs; i++) { +if (mb_sz[i] <=0 || mb_sz[i] >0xFFFF ) +rte_exit (EXIT_FAILURE , +"mbuf-size should be " +"> 0 and < 65536\n" ); + mbuf_data_size[i] = (uint16_t ) mb_sz[i]; + } + mbuf_data_size_n = nb_segs; }if (!strcmp (lgopts[opt_idx].name,"total-num-mbufs" )) { n =atoi (optarg);
app/test-pmd/testpmd.c +35 -28
145 lines not on this page · raw message
app/test-pmd/testpmd.h +19 -5
@@ -42,6 +42,13 @@*/ #define RTE_MAX_SEGS_PER_PKT 255/**< nb_segs is a 8-bit unsigned char. */ +/* +* The maximum number of segments per packet is used to configure +* buffer split feature, also specifies the maximum amount of +* optional Rx pools to allocate mbufs to split. +*/ +#define MAX_SEGS_BUFFER_SPLIT 8/**< nb_segs is a 8-bit unsigned char. */ +#define MAX_PKT_BURST 512#define DEF_PKT_BURST 32
@@ -393,7 +400,9 @@ struct queue_stats_mappings {extern uint8_t dcb_config;extern uint8_t dcb_test; -extern uint16_t mbuf_data_size;/**< Mbuf data space size. */ +extern uint32_t mbuf_data_size_n; +extern uint16_t mbuf_data_size[MAX_SEGS_BUFFER_SPLIT ]; +/**< Mbuf data space size. */ extern uint32_t param_total_num_mbufs;extern uint16_t stats_period;
@@ -605,17 +614,22 @@ struct mplsoudp_decap_conf {/* Mbuf Pools */ static inline void -mbuf_poolname_build (unsigned int sock_id,char * mp_name,int name_size) +mbuf_poolname_build (unsigned int sock_id,char *mp_name, +int name_size,unsigned int idx) { -snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +if (!idx) +snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +else +snprintf (mp_name, name_size,"mbuf_pool_socket_%u_%u" , + sock_id, idx); }static inline struct rte_mempool * -mbuf_pool_find (unsigned int sock_id) +mbuf_pool_find (unsigned int sock_id,unsigned int idx) {char pool_name[RTE_MEMPOOL_NAMESIZE ]; -mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name)); +mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name), idx);return rte_mempool_lookup ((const char *)pool_name); }
doc/guides/testpmd_app_ug/run_app.rst +5 -2
@@ -107,9 +107,12 @@ The command line options are: Set the socket from which all memory is allocated in NUMA mode, where 0 <= N < number of sockets on the board. -* ``--mbuf-size=N`` +* ``--mbuf-size=N[,N1[,...Nn]`` - Set the data size of the mbufs used to N bytes, where N < 65536. The default value is 2048. + Set the data size of the mbufs used to N bytes, where N < 65536. + The default value is 2048. If multiple mbuf-size values are specified the + extra memory pools will be created for allocating mbufs to receive packets + with buffer splittling features. * ``--total-num-mbufs=N``
Signature · 1 line
1.8.3.1
PATCH v7 3/6 app/testpmd: add buffer split offload configuration
In reply to Viacheslav OvsiienkoThis patch add support for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT providing per queue configuration for this offload.
--- app/test-pmd/cmdline.c | 21 +++++++++++---------- app/test-pmd/config.c | 9 +++++++++ 2 files changed, 20 insertions(+), 10 deletions(-)
app/test-pmd/cmdline.c +11 -10
@@ -883,16 +883,16 @@ static void cmd_help_long_parsed(void *parsed_result,"port config <port_id> rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per port Rx offloading" " on all Rx queues of a port\n\n" "port (port_id) rxq (queue_id) rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per queue Rx offloading" " only on a specific Rx queue\n\n"
@@ -18417,7 +18417,8 @@ struct cmd_config_per_port_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc#rss_hash"); +"scatter#buffer_split#timestamp#security#" + "keep_crc#rss_hash");cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result,
@@ -18497,8 +18498,8 @@ struct cmd_config_per_port_rx_offload_result { .help_str = "port config <port_id> rx_offload vlan_strip|ipv4_cksum|""udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc|rss_hash " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc|rss_hash on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, (void *)&cmd_config_per_port_rx_offload_result_config,
@@ -18547,7 +18548,7 @@ struct cmd_config_per_queue_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc"); + "scatter#buffer_split#timestamp#security#keep_crc");cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result,
@@ -18603,8 +18604,8 @@ struct cmd_config_per_queue_rx_offload_result {"vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, (void *)&cmd_config_per_queue_rx_offload_result_port_id,
app/test-pmd/config.c +9 -0
@@ -1092,6 +1092,15 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("off\n" ); } +if (dev_info.rx_offload_capa &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { +printf ("RX offload buffer split: " ); +if (ports[port_id].dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) +printf ("on\n" ); +else +printf ("off\n" ); + } +if (dev_info.tx_offload_capa &DEV_TX_OFFLOAD_VLAN_INSERT ) {printf ("VLAN insert: " ); if (ports[port_id].dev_conf.txmode.offloads &
Signature · 1 line
1.8.3.1
PATCH v7 4/6 app/testpmd: add rxpkts commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxpkts=X[,Y]
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command:
testpmd> set rxpkts (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only). Optionally the multiple memory pools can be specified with --mbuf-size command line parameter and the mbufs to receive will be allocated sequentially from these extra memory pools.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 48 ++++++++++++++++++++++- app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 7 ++++ app/test-pmd/testpmd.h | 11 +++++- doc/guides/testpmd_app_ug/run_app.rst | 9 +++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 +++++++++- 7 files changed, 165 insertions(+), 7 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|txpkts)\n" +"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxpkts (x[,y]*)\n" +" Set the length of each segment to scatter" +" packets on receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set txpkts (x[,y]*)\n" " Set the length of each segment of TXONLY" " and optionally CSUM packets.\n\n"
@@ -3889,6 +3895,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxpkts_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxpkts; +cmdline_fixed_string_t seg_lengths; +}; + +static void +cmd_set_rxpkts_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxpkts_result *res; +unsigned int seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_lengths,"segment lengths" , +MAX_SEGS_BUFFER_SPLIT , seg_lengths,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_lengths, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxpkts_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxpkts_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + rxpkts,"rxpkts" ); +cmdline_parse_token_string_t cmd_set_rxpkts_lengths = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + seg_lengths,NULL ); + +cmdline_parse_inst_t cmd_set_rxpkts = { + .f = cmd_set_rxpkts_parsed, + .data =NULL , + .help_str ="set rxpkts <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxpkts_keyword, + (void *)&cmd_set_rxpkts_name, + (void *)&cmd_set_rxpkts_lengths, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */ struct cmd_set_txpkts_result {
@@ -7517,6 +7569,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxpkts")) +show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))show_tx_pkt_segments (); else if (!strcmp(res->what, "txtimes"))
@@ -7529,12 +7583,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#txpkts#txtimes" ); +"rxtx#cores#fwd#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19807,6 +19861,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit, (cmdline_parse_inst_t *)&cmd_set_txtimes,
app/test-pmd/config.c +46 -2
62 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );printf (" --txonly-multi-flow: generate multiple flows in txonly mode\n" );
@@ -662,6 +663,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 }, { "disable-link-check", 0, 0, 0 },
@@ -1272,6 +1274,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) { +unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + nb_segs =parse_item_list + (optarg,"rxpkt segments" , +MAX_SEGS_BUFFER_SPLIT , + seg_len,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_len, nb_segs); +else +rte_exit (EXIT_FAILURE ,"bad rxpkts\n" ); + }if (!strcmp (lgopts[opt_idx].name,"txpkts" )) {unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +7 -0
@@ -210,6 +210,13 @@ struct fwd_engine * fwd_engines[] = {uint8_t f_quit;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ uint16_t tx_pkt_length =TXONLY_DEF_PACKET_LEN ;/**< TXONLY packet length. */
app/test-pmd/testpmd.h +10 -1
@@ -420,6 +420,13 @@ struct queue_stats_mappings {extern struct rte_fdir_conf fdir_conf;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ #define TXONLY_DEF_PACKET_LEN 64
@@ -816,7 +823,9 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_record_core_cycles (uint8_t on_off);void set_record_burst_stats (uint8_t on_off);void set_verbose_level (uint16_t vb_level); -void set_tx_pkt_segments (unsigned *seg_lengths,unsigned nb_segs); +void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs); +void show_rx_pkt_segments (void ); +void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);void show_tx_pkt_times (void );
doc/guides/testpmd_app_ug/run_app.rst +9 -0
@@ -361,6 +361,15 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxpkts=X[,Y]`` + + Set the length of segments to scatter packets on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + Optionally the multiple memory pools can be specified with --mbuf-size + command line parameter and the mbufs to receive will be allocated + sequentially from these extra memory pools. + * ``--txpkts=X[,Y]`` Set TX segment sizes or total packet length. Valid for ``tx-only``
doc/guides/testpmd_app_ug/testpmd_funcs.rst +20 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxpkts``: Packets to RX split configuration. + * ``txpkts``: Packets to TX configuration. * ``txtimes``: Burst time pattern for Tx only mode.
@@ -774,6 +776,23 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxpkts +~~~~~~~~~~ + +Set the length of segments to scatter packets on receiving if split +feature is engaged. Affects only the queues configured with split offloads +(currently BUFFER_SPLIT is supported only). Optionally the multiple memory +pools can be specified with --mbuf-size command line parameter and the mbufs +to receive will be allocated sequentially from these extra memory pools (the +mbuf for the first segment is allocated from the first pool, the second one +from the second pool, and so on, if segment number is greater then pool's the +mbuf for remaining segments will be allocated from the last valid pool). + + testpmd> set rxpkts (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. Zero value +means to use the corresponding memory pool data buffer size. + set txpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v7 5/6 app/testpmd: add rxoffs commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxoffs=X[,Y]
Sets the offsets of packet segments from the beginning of the receiving buffer if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command, providing the same:
testpmd> set rxoffs (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 44 +++++++++++++++++++++ app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 2 + app/test-pmd/testpmd.h | 4 ++ doc/guides/testpmd_app_ug/run_app.rst | 6 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 17 +++++++- 7 files changed, 145 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" +"show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxoffs (x[,y]*)\n" +" Set the offset of each packet segment on" +" receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set rxpkts (x[,y]*)\n" " Set the length of each segment to scatter" " packets on receiving if split feature is engaged."
@@ -3895,6 +3901,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT OFFSETS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxoffs_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxoffs; +cmdline_fixed_string_t seg_offsets; +}; + +static void +cmd_set_rxoffs_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxoffs_result *res; +unsigned int seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_offsets,"segment offsets" , +MAX_SEGS_BUFFER_SPLIT , seg_offsets,0 ); +if (nb_segs >0 ) +set_rx_pkt_offsets (seg_offsets, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxoffs_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxoffs_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + rxoffs,"rxoffs" ); +cmdline_parse_token_string_t cmd_set_rxoffs_offsets = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + seg_offsets,NULL ); + +cmdline_parse_inst_t cmd_set_rxoffs = { + .f = cmd_set_rxoffs_parsed, + .data =NULL , + .help_str ="set rxoffs <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxoffs_keyword, + (void *)&cmd_set_rxoffs_name, + (void *)&cmd_set_rxoffs_offsets, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ struct cmd_set_rxpkts_result {
@@ -7569,6 +7621,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxoffs")) +show_rx_pkt_offsets (); else if (!strcmp(res->what, "rxpkts"))show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))
@@ -7583,12 +7637,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#rxpkts#txpkts#txtimes" ); +"rxtx#cores#fwd#rxoffs#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19861,6 +19915,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxoffs, (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit,
app/test-pmd/config.c +44 -0
50 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxoffs=X[,Y]*: set RX segment offsets for split.\n" );printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );
@@ -663,6 +664,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxoffs", 1, 0, 0 }, { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 },
@@ -1274,6 +1276,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxoffs" )) { +unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_offs; + + nb_offs =parse_item_list + (optarg,"rxpkt offsets" , +MAX_SEGS_BUFFER_SPLIT , + seg_off,0 ); +if (nb_offs >0 ) +set_rx_pkt_offsets (seg_off, nb_offs); +else +rte_exit (EXIT_FAILURE ,"bad rxoffs\n" ); + }if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) {unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +2 -0
@@ -215,6 +215,8 @@ struct fwd_engine * fwd_engines[] = {*/ uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
app/test-pmd/testpmd.h +4 -0
@@ -425,6 +425,8 @@ struct queue_stats_mappings {*/ extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
@@ -825,6 +827,8 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_verbose_level (uint16_t vb_level);void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_rx_pkt_segments (void ); +void set_rx_pkt_offsets (unsigned int *seg_offsets,unsigned int nb_offs); +void show_rx_pkt_offsets (void );void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);
doc/guides/testpmd_app_ug/run_app.rst +6 -0
@@ -361,6 +361,12 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxoffs=X[,Y]`` + + Set the offsets of packet segments on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + * ``--rxpkts=X[,Y]`` Set the length of segments to scatter packets on receiving if split
doc/guides/testpmd_app_ug/testpmd_funcs.rst +16 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxoffs``: Packet offsets for RX split. + * ``rxpkts``: Packets to RX split configuration. * ``txpkts``: Packets to TX configuration.
@@ -776,6 +778,19 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxoffs +~~~~~~~~~~ + +Set the offsets of segments relating to the data buffer beginning on receiving +if split feature is engaged. Affects only the queues configured with split +offloads (currently BUFFER_SPLIT is supported only). + + testpmd> set rxoffs (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. If the list +of offsets is shorter than the list of segments the zero offsets will be used +for the remaining segments. + set rxpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v7 6/6 app/testpmd: add extended Rx queue setup
In reply to Viacheslav OvsiienkoIf Rx queue is configured with split feature the extended setup with specified segment sizes and pool will be performed.
--- app/test-pmd/cmdline.c | 12 ++++++------ app/test-pmd/testpmd.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- app/test-pmd/testpmd.h | 5 +++++ 3 files changed, 57 insertions(+), 8 deletions(-)
app/test-pmd/cmdline.c +6 -6
@@ -2927,12 +2927,12 @@ struct cmd_setup_rxtx_queue { rxring_numa[res->portid]);return ; } - ret =rte_eth_rx_queue_setup (res->portid, - res->qid, - port->nb_rx_desc[res->qid], - socket_id, - &port->rx_conf[res->qid], - mp); + ret =rx_queue_setup (res->portid, + res->qid, + port->nb_rx_desc[res->qid], + socket_id, + &port->rx_conf[res->qid], + mp);if (ret)printf ("Failed to setup RX queue\n" ); }else {
app/test-pmd/testpmd.c +46 -2
66 lines not on this page · raw message
app/test-pmd/testpmd.h +5 -0
@@ -876,6 +876,11 @@ void port_rss_reta_info(portid_t port_id,void set_vf_traffic (portid_t port_id,uint8_t is_rx,uint16_t vf,uint8_t on); +int +rx_queue_setup (uint16_t port_id,uint16_t rx_queue_id, +uint16_t nb_rx_desc,unsigned int socket_id, +struct rte_eth_rxconf *rx_conf,struct rte_mempool *mp); +int set_queue_rate_limit (portid_t port_id,uint16_t queue_idx,uint16_t rate);int set_vf_rate_limit (portid_t port_id,uint16_t vf,uint16_t rate,uint64_t q_msk);
Signature · 1 line
1.8.3.1
v8 cover ethdev: introduce Rx buffer split
In reply to Slava OvsiienkoThe DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
---
v1: http://patches.dpdk.org/patch/79594/
v2: http://patches.dpdk.org/patch/79893/
- add feature support to mlx5 PMD
v3: http://patches.dpdk.org/patch/80389/
- rte_eth_rx_queue_setup_ex is renamed to rte_eth_rxseg_queue_setup
- DEV_RX_OFFLOAD_BUFFER_SPLIT is renamed to RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT
- commit message update
- documentaion provided
- release notes update
- minor bug fixes in testpmd related part
v4: http://patches.dpdk.org/patch/80401/
- common part of rx_queue_setup/rxseg_queue_setup
v5: http://patches.dpdk.org/patch/80609/
- refactored to approach of providing split configuration in the rte_eth_rxconf structure instead of introducing the new API routine
- added support for rxoffs command to testpmd to provide segment offsets for complete testing of split configurations
- patchset is split into two parts - PMD part will be presented as separate series
v6: http://patches.dpdk.org/patch/80785/
- wordy comments rephrased
- typos fixed
- rte_eth_rx_queue_setup configuration check isolated for two main options
- the rest of comments addressed
v7: http://patches.dpdk.org/patch/80978/
- description as union of feature dedicated segment split description
- the split limitations reported in the rte_eth_dev_info->rx_seg_capa
- comments made less wordy
v8: - bitfield instead of uint8;
- named union to avoid warinings;
- typos fixed*** SUBJECT HERE ***
---
Viacheslav Ovsiienko (6):
ethdev: introduce Rx buffer split app/testpmd: add multiple pools per core creation app/testpmd: add buffer split offload configuration app/testpmd: add rxpkts commands and parameters app/testpmd: add rxoffs commands and parameters app/testpmd: add extended Rx queue setup
app/test-pmd/bpf_cmd.c | 4 +- app/test-pmd/cmdline.c | 151 +++++++++++++++++++++++---- app/test-pmd/config.c | 107 +++++++++++++++++++- app/test-pmd/parameters.c | 54 ++++++++-- app/test-pmd/testpmd.c | 120 ++++++++++++++++------ app/test-pmd/testpmd.h | 44 ++++++-- doc/guides/nics/features.rst | 15 +++ doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_20_11.rst | 9 ++ doc/guides/testpmd_app_ug/run_app.rst | 22 +++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 36 ++++++- lib/librte_ethdev/rte_ethdev.c | 152 +++++++++++++++++++++++----- lib/librte_ethdev/rte_ethdev.h | 88 +++++++++++++++- 13 files changed, 704 insertions(+), 103 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v8 1/6 ethdev: introduce Rx buffer split
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
--- doc/guides/nics/features.rst | 15 ++++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 ++ lib/librte_ethdev/rte_ethdev.c | 152 +++++++++++++++++++++++++++------ lib/librte_ethdev/rte_ethdev.h | 88 ++++++++++++++++++- 5 files changed, 238 insertions(+), 31 deletions(-)
doc/guides/nics/features.rst +15 -0
@@ -185,6 +185,21 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[provides] eth_dev_ops**: ``rxq_info_get:buffer_split``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LRO
doc/guides/rel_notes/deprecation.rst +0 -5
@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``
doc/guides/rel_notes/release_20_11.rst +9 -0
@@ -60,6 +60,12 @@ New Features Added the FEC API which provides functions for query FEC capabilities and current FEC mode from device. Also, API for configuring FEC mode is also provided. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:
@@ -253,6 +259,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functions
lib/librte_ethdev/rte_ethdev.c +127 -25
186 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev.h +87 -1
126 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 383 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.The following structure is introduced to specify the Rx packet segment for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLIToffload:struct
rte_eth_rxseg_split{struct
rte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length,
configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2 seg1 - pool1, len1=20B, off1=128B seg2 - pool2, len2=20B, off2=0B seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The split limitations imposed by underlying PMD is reported in the new introduced
rte_eth_dev_info->rx_seg_capafield.The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Jerin Jacob <[email protected]>--- doc/guides/nics/features.rst | 15 ++++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 ++ lib/librte_ethdev/rte_ethdev.c | 152 +++++++++++++++++++++++++++------ lib/librte_ethdev/rte_ethdev.h | 88 ++++++++++++++++++- 5 files changed, 238 insertions(+), 31 deletions(-)doc/guides/nics/features.rst +15
-0@@ -185,6 +185,21 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[provides] eth_dev_ops**: ``rxq_info_get:buffer_split``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LROdoc/guides/rel_notes/deprecation.rst +0
-5@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``doc/guides/rel_notes/release_20_11.rst +9
-0@@ -60,6 +60,12 @@ New Features Added the FEC API which provides functions for query FEC capabilities and current FEC mode from device. Also, API for configuring FEC mode is also provided. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:@@ -253,6 +259,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functionslib/librte_ethdev/rte_ethdev.c +127
-25@@ -105,6 +105,9 @@ struct rte_eth_xstats_name_off {#define RTE_RX_OFFLOAD_BIT2STR (_name) \ { DEV_RX_OFFLOAD_##_name, #_name } +#define RTE_ETH_RX_OFFLOAD_BIT2STR (_name) \ + { RTE_ETH_RX_OFFLOAD_##_name, #_name } + static const struct { uint64_t offload; const char *name;@@ -128,9 +131,11 @@ struct rte_eth_xstats_name_off {RTE_RX_OFFLOAD_BIT2STR (SCTP_CKSUM ),RTE_RX_OFFLOAD_BIT2STR (OUTER_UDP_CKSUM ),RTE_RX_OFFLOAD_BIT2STR (RSS_HASH ), + RTE_ETH_RX_OFFLOAD_BIT2STR(BUFFER_SPLIT), };#undef RTE_RX_OFFLOAD_BIT2STR +#undef RTE_ETH_RX_OFFLOAD_BIT2STR#define RTE_TX_OFFLOAD_BIT2STR (_name) \ { DEV_TX_OFFLOAD_##_name, #_name }@@ -1763,6 +1768,77 @@ struct rte_eth_dev *return ret; } +static int +rte_eth_rx_queue_check_split (const struct rte_eth_rxseg *rx_seg, +uint16_t n_seg,uint32_t *mbp_buf_size, +const struct rte_eth_dev_info *dev_info) +{ +const struct rte_eth_rxseg_capa *seg_capa = &dev_info->rx_seg_capa; +struct rte_mempool *mp_first; +uint32_t offset_mask; +uint16_t seg_idx; + +if (n_seg > seg_capa->max_seg) { +RTE_ETHDEV_LOG (ERR , +"Requested Rx segments %u exceed supported %u\n" , + n_seg, seg_capa->max_seg); +return -EINVAL ; + } +/* +* Check the sizes and offsets against buffer sizes +* for each segment specified in extended configuration. +*/ + mp_first = rx_seg[0 ].conf.split.mp; + offset_mask = (1u << seg_capa->offset_align_log2) -1 ; +for (seg_idx =0 ; seg_idx < n_seg; seg_idx++) { +struct rte_mempool *mpl = rx_seg[seg_idx].conf.split.mp; +uint32_t length = rx_seg[seg_idx].conf.split.length; +uint32_t offset = rx_seg[seg_idx].conf.split.offset; + +if (mpl ==NULL ) { +RTE_ETHDEV_LOG (ERR ,"null mempool pointer\n" ); +return -EINVAL ; + } +if (seg_idx !=0 && mp_first != mpl && + seg_capa->multi_pools ==0 ) { +RTE_ETHDEV_LOG (ERR ,"Receiving to multiple pools is not supported\n" ); +return -ENOTSUP ; + } +if (offset !=0 ) { +if (seg_capa->offset_allowed ==0 ) { +RTE_ETHDEV_LOG (ERR ,"Rx segmentation with offset is not supported\n" ); +return -ENOTSUP ; + } +if (offset & offset_mask) { +RTE_ETHDEV_LOG (ERR ,"Rx segmentat invalid offset alignment %u, %u\n" , + offset, + seg_capa->offset_align_log2); +return -EINVAL ; + } + } +if (mpl->private_data_size < +sizeof (struct rte_pktmbuf_pool_private )) { +RTE_ETHDEV_LOG (ERR , +"%s private_data_size %u < %u\n" , + mpl->name, mpl->private_data_size, + (unsigned int )sizeof + (struct rte_pktmbuf_pool_private )); +return -ENOSPC ; + } + offset += seg_idx !=0 ?0 :RTE_PKTMBUF_HEADROOM ; + *mbp_buf_size =rte_pktmbuf_data_room_size (mpl); + length = length !=0 ? length : *mbp_buf_size; +if (*mbp_buf_size < length + offset) { +RTE_ETHDEV_LOG (ERR , +"%s mbuf_data_room_size %u < %u (segment length=%u + segment offset=%u)\n" , + mpl->name, *mbp_buf_size, + length + offset, length, offset); +return -EINVAL ; + } + } +return 0 ; +} + int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id,@@ -1784,38 +1860,64 @@ struct rte_eth_dev *return -EINVAL ; } -if (mp ==NULL ) { -RTE_ETHDEV_LOG (ERR ,"Invalid null mempool pointer\n" ); -return -EINVAL ; - } -RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rx_queue_setup, -ENOTSUP ); -/* -* Check the size of the mbuf data buffer. -* This value must be provided in the private data of the memory pool. -* First check that the memory pool has a valid private data. -*/ ret =rte_eth_dev_info_get (port_id, &dev_info);if (ret !=0 )return ret; -if (mp->private_data_size <sizeof (struct rte_pktmbuf_pool_private )) { -RTE_ETHDEV_LOG (ERR ,"%s private_data_size %d < %d\n" , - mp->name, (int )mp->private_data_size, - (int )sizeof (struct rte_pktmbuf_pool_private )); -return -ENOSPC ; - } - mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mp !=NULL ) { +/* Single pool configuration check. */ +if (rx_conf->rx_nseg !=0 ) { +RTE_ETHDEV_LOG (ERR , +"Ambiguous segment configuration\n" ); +return -EINVAL ; + } +/* +* Check the size of the mbuf data buffer, this value +* must be provided in the private data of the memory pool. +* First check that the memory pool(s) has a valid private data. +*/ +if (mp->private_data_size < +sizeof (struct rte_pktmbuf_pool_private )) { +RTE_ETHDEV_LOG (ERR ,"%s private_data_size %u < %u\n" , + mp->name, mp->private_data_size, + (unsigned int ) +sizeof (struct rte_pktmbuf_pool_private )); +return -ENOSPC ; + } + mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mbp_buf_size < dev_info.min_rx_bufsize + +RTE_PKTMBUF_HEADROOM ) { +RTE_ETHDEV_LOG (ERR , +"%s mbuf_data_room_size %u < %u (RTE_PKTMBUF_HEADROOM=%u + min_rx_bufsize(dev)=%u)\n" , + mp->name, mbp_buf_size, +RTE_PKTMBUF_HEADROOM + + dev_info.min_rx_bufsize, +RTE_PKTMBUF_HEADROOM , + dev_info.min_rx_bufsize); +return -EINVAL ; + } + }else { +const struct rte_eth_rxseg *rx_seg = rx_conf->rx_seg; +uint16_t n_seg = rx_conf->rx_nseg; -if (mbp_buf_size < dev_info.min_rx_bufsize +RTE_PKTMBUF_HEADROOM ) { -RTE_ETHDEV_LOG (ERR , -"%s mbuf_data_room_size %d < %d (RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)=%d)\n" , - mp->name, (int )mbp_buf_size, - (int )(RTE_PKTMBUF_HEADROOM + dev_info.min_rx_bufsize), - (int )RTE_PKTMBUF_HEADROOM , - (int )dev_info.min_rx_bufsize); -return -EINVAL ; +/* Extended multi-segment configuration check. */ +if (rx_conf->rx_seg ==NULL || rx_conf->rx_nseg ==0 ) { +RTE_ETHDEV_LOG (ERR , +"Memory pool is null and no extended configuration provided\n" ); +return -EINVAL ; + } +if (rx_conf->offloads &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { + ret =rte_eth_rx_queue_check_split (rx_seg, n_seg, + &mbp_buf_size, + &dev_info); +if (ret !=0 ) +return ret; + }else { +RTE_ETHDEV_LOG (ERR ,"No Rx segmentation offload configured\n" ); +return -EINVAL ; + } }/* Use default specified by driver, if nb_rx_desc is zero */ lib/librte_ethdev/rte_ethdev.h +4
-0@@ -970,6 +970,27 @@ struct rte_eth_txmode { };/** +* A structure used to configure an Rx packet segment to split. +*/ +struct rte_eth_rxseg_split { +struct rte_mempool *mp;/**< Memory pool to allocate segment from. */
lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 986
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+uint16_t length;/**< Segment data length, configures split point. */ +uint16_t offset;/**< Data offset from beginning of mbuf data buffer. */ +uint32_t reserved;/**< Reserved field. */ +}; + +/** +* A common structure used to describe Rx packet segment properties. +*/ +struct rte_eth_rxseg { + union {
Why not just 'union rte_eth_rxseg' ?
lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 988
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split;
Pointer to a split table must be here. I.e. struct rte_eth_rxseg_split *split;
Also it must be specified how the array is terminated. We need either a number of define last item condition (mp == NULL ?)
Quoted 45 lines
lib/librte_ethdev/rte_ethdev.h +5
-0+/* The other features settings should be added here. */ + } conf; +}; + +/** * A structure used to configure an RX ring of an Ethernet port. */
structrte_eth_rxconf{lib/librte_ethdev/rte_ethdev.h +30
-0@@ -977,6 +998,46 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */ uint8_t rx_deferred_start;/**< Do not start queue with rte_eth_dev_start(). */ +uint16_t rx_nseg;/**< Number of descriptions in rx_seg array. */ +/** +* Points to the array of segment descriptions. Each array element +* describes the properties for each segment in the receiving +* buffer according to feature descripting structure. +* +* The supported capabilities of receiving segmentation is reported +* in rte_eth_dev_info ->rx_seg_capa field. +* +* If RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag is set in offloads field, +* the PMD will split the received packets into multiple segments +* according to the specification in the description array: +* +* - the first network buffer will be allocated from the memory pool, +* specified in the first array element, the second buffer, from the +* pool in the second element, and so on. +* +* - the offsets from the segment description elements specify +* the data offset from the buffer beginning except the first mbuf. +* For this one the offset is added with RTE_PKTMBUF_HEADROOM. +* +* - the lengths in the elements define the maximal data amount +* being received to each segment. The receiving starts with filling +* up the first mbuf data buffer up to specified length. If the +* there are data remaining (packet is longer than buffer in the first +* mbuf) the following data will be pushed to the next segment +* up to its own length, and so on. +* +* - If the length in the segment description element is zero +* the actual buffer size will be deduced from the appropriate
lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1040
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+* memory pool properties. +* +* - if there is not enough elements to describe the buffer for entire +* packet of maximal length the following parameters will be used +* for the all remaining segments: +* - pool from the last valid element +* - the buffer size from this pool +* - zero offset +*/ +struct rte_eth_rxseg *rx_seg;
It must not be a pointer. It looks really strange this way taking into account that it is a union in fact. Also, why is it put here in the middle of exsiting structure? IMHO it should be added after offlaods.
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.h +1
-0/** * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. * Only offloads set on rx_queue_offload_capa or rx_offload_capa @@ -1260,6 +1321,7 @@ struct rte_eth_conf {#define DEV_RX_OFFLOAD_SCTP_CKSUM 0x00020000#define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000#define DEV_RX_OFFLOAD_RSS_HASH 0x00080000 +#define RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT 0x00100000#define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1445
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +5
-0@@ -1376,6 +1438,17 @@ struct rte_eth_switch_info { };/** +* Ethernet device Rx buffer segmentation capabilities. +*/ +__extension__ +struct rte_eth_rxseg_capa { + uint16_t max_seg; /**< Maximum amount of segments to split. */
May be 'max_segs' to avoid confusing vs maximum segment length.
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1448
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +3
-0+ uint16_t multi_pools:1; /**< Supports receiving to multiple pools.*/ + uint16_t offset_allowed:1; /**< Supports buffer offsets. */ + uint16_t offset_align_log2:4; /**< Required offset alignment. */
4 bits are even insufficient to specify cache-line alignment. IMHO at least 8 bits are required.
Consider to put 32 width bit-fields at start of the structure. Than, max_segs (16), offset_align_log2 (8), plus reserved (8).
lib/librte_ethdev/rte_ethdev.h struct rte_eth_dev_info { · line 1479
Quoted 11 lines
lib/librte_ethdev/rte_ethdev.h +4
-0+}; + +/** * Ethernet device information */ @@ -1403,6 +1476,7 @@ struct rte_eth_dev_info {/** Maximum number of hash MAC addresses for MTA and UTA. */ uint16_t max_vfs;/**< Maximum number of VFs. */ uint16_t max_vmdq_pools;/**< Maximum number of VMDq pools. */ +struct rte_eth_rxseg_capa rx_seg_capa;/**< Segmentation capability.*/
Why is it put in the middle of existing structure?
Quoted 27 lines
lib/librte_ethdev/rte_ethdev.h +13
-1uint64_t rx_offload_capa;/**< All RX offload capabilities including all per-queue ones */ uint64_t tx_offload_capa;@@ -2027,9 +2101,21 @@ int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue,* No need to repeat any bit in rx_conf->offloads which has already been * enabled in rte_eth_dev_configure() at port level. An offloading enabled * at port level can't be disabled at queue level. +* The configuration structure also contains the pointer to the array +* of the receiving buffer segment descriptions, see rx_seg and rx_nseg +* fields, this extended configuration might be used by split offloads like +* RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT. If mp_pool is not NULL, +* the extended configuration fields must be set to NULL and zero. * @param mb_pool * The pointer to the memory pool from which to allocate *rte_mbuf* network -* memory buffers to populate each descriptor of the receive ring. +* memory buffers to populate each descriptor of the receive ring. There are +* two options to provide Rx buffer configuration: +* - single pool: +* mb_pool is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is 0. +* - multiple segments description: +* mb_pool is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not 0. +* Taken only if flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT is set in offloads. +* * @return * - 0: Success, receive queue correctly set up. * - -EIO: if device is removed.
Andrew Rybchenko
Reviewed-byQuoted 98 lines · Andrew Rybchenko
Quoted 97 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.The following structure is introduced to specify the Rx packet segment for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLIToffload:struct
rte_eth_rxseg_split{struct
rte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length,
configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2 seg1 - pool1, len1=20B, off1=128B seg2 - pool2, len2=20B, off2=0B seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The split limitations imposed by underlying PMD is reported in the new introduced
rte_eth_dev_info->rx_seg_capafield.The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Quoted 3 lines
Quoted 3 lines
Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Jerin Jacob <[email protected]>
With below review notes processed:
Quoted 441 lines
Quoted 283 lines
--- doc/guides/nics/features.rst | 15 ++++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 ++ lib/librte_ethdev/rte_ethdev.c | 152 +++++++++++++++++++++++++++------ lib/librte_ethdev/rte_ethdev.h | 88 ++++++++++++++++++- 5 files changed, 238 insertions(+), 31 deletions(-)doc/guides/nics/features.rst +15
-0@@ -185,6 +185,21 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[provides] eth_dev_ops**: ``rxq_info_get:buffer_split``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LROdoc/guides/rel_notes/deprecation.rst +0
-5@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``doc/guides/rel_notes/release_20_11.rst +9
-0@@ -60,6 +60,12 @@ New Features Added the FEC API which provides functions for query FEC capabilities and current FEC mode from device. Also, API for configuring FEC mode is also provided. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:@@ -253,6 +259,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functionslib/librte_ethdev/rte_ethdev.c +127
-25@@ -105,6 +105,9 @@ struct rte_eth_xstats_name_off {#define RTE_RX_OFFLOAD_BIT2STR (_name) \ { DEV_RX_OFFLOAD_##_name, #_name } +#define RTE_ETH_RX_OFFLOAD_BIT2STR (_name) \ + { RTE_ETH_RX_OFFLOAD_##_name, #_name } + static const struct { uint64_t offload; const char *name;@@ -128,9 +131,11 @@ struct rte_eth_xstats_name_off {RTE_RX_OFFLOAD_BIT2STR (SCTP_CKSUM ),RTE_RX_OFFLOAD_BIT2STR (OUTER_UDP_CKSUM ),RTE_RX_OFFLOAD_BIT2STR (RSS_HASH ), + RTE_ETH_RX_OFFLOAD_BIT2STR(BUFFER_SPLIT), };#undef RTE_RX_OFFLOAD_BIT2STR +#undef RTE_ETH_RX_OFFLOAD_BIT2STR#define RTE_TX_OFFLOAD_BIT2STR (_name) \ { DEV_TX_OFFLOAD_##_name, #_name }@@ -1763,6 +1768,77 @@ struct rte_eth_dev *return ret; } +static int +rte_eth_rx_queue_check_split (const struct rte_eth_rxseg *rx_seg, +uint16_t n_seg,uint32_t *mbp_buf_size, +const struct rte_eth_dev_info *dev_info) +{ +const struct rte_eth_rxseg_capa *seg_capa = &dev_info->rx_seg_capa; +struct rte_mempool *mp_first; +uint32_t offset_mask; +uint16_t seg_idx; + +if (n_seg > seg_capa->max_seg) { +RTE_ETHDEV_LOG (ERR , +"Requested Rx segments %u exceed supported %u\n" , + n_seg, seg_capa->max_seg); +return -EINVAL ; + } +/* +* Check the sizes and offsets against buffer sizes +* for each segment specified in extended configuration. +*/ + mp_first = rx_seg[0 ].conf.split.mp; + offset_mask = (1u << seg_capa->offset_align_log2) -1 ; +for (seg_idx =0 ; seg_idx < n_seg; seg_idx++) { +struct rte_mempool *mpl = rx_seg[seg_idx].conf.split.mp; +uint32_t length = rx_seg[seg_idx].conf.split.length; +uint32_t offset = rx_seg[seg_idx].conf.split.offset; + +if (mpl ==NULL ) { +RTE_ETHDEV_LOG (ERR ,"null mempool pointer\n" ); +return -EINVAL ; + } +if (seg_idx !=0 && mp_first != mpl && + seg_capa->multi_pools ==0 ) { +RTE_ETHDEV_LOG (ERR ,"Receiving to multiple pools is not supported\n" ); +return -ENOTSUP ; + } +if (offset !=0 ) { +if (seg_capa->offset_allowed ==0 ) { +RTE_ETHDEV_LOG (ERR ,"Rx segmentation with offset is not supported\n" ); +return -ENOTSUP ; + } +if (offset & offset_mask) { +RTE_ETHDEV_LOG (ERR ,"Rx segmentat invalid offset alignment %u, %u\n" , + offset, + seg_capa->offset_align_log2); +return -EINVAL ; + } + } +if (mpl->private_data_size < +sizeof (struct rte_pktmbuf_pool_private )) { +RTE_ETHDEV_LOG (ERR , +"%s private_data_size %u < %u\n" , + mpl->name, mpl->private_data_size, + (unsigned int )sizeof + (struct rte_pktmbuf_pool_private )); +return -ENOSPC ; + } + offset += seg_idx !=0 ?0 :RTE_PKTMBUF_HEADROOM ; + *mbp_buf_size =rte_pktmbuf_data_room_size (mpl); + length = length !=0 ? length : *mbp_buf_size; +if (*mbp_buf_size < length + offset) { +RTE_ETHDEV_LOG (ERR , +"%s mbuf_data_room_size %u < %u (segment length=%u + segment offset=%u)\n" , + mpl->name, *mbp_buf_size, + length + offset, length, offset); +return -EINVAL ; + } + } +return 0 ; +} + int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id,@@ -1784,38 +1860,64 @@ struct rte_eth_dev *return -EINVAL ; } -if (mp ==NULL ) { -RTE_ETHDEV_LOG (ERR ,"Invalid null mempool pointer\n" ); -return -EINVAL ; - } -RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->rx_queue_setup, -ENOTSUP ); -/* -* Check the size of the mbuf data buffer. -* This value must be provided in the private data of the memory pool. -* First check that the memory pool has a valid private data. -*/ ret =rte_eth_dev_info_get (port_id, &dev_info);if (ret !=0 )return ret; -if (mp->private_data_size <sizeof (struct rte_pktmbuf_pool_private )) { -RTE_ETHDEV_LOG (ERR ,"%s private_data_size %d < %d\n" , - mp->name, (int )mp->private_data_size, - (int )sizeof (struct rte_pktmbuf_pool_private )); -return -ENOSPC ; - } - mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mp !=NULL ) { +/* Single pool configuration check. */ +if (rx_conf->rx_nseg !=0 ) { +RTE_ETHDEV_LOG (ERR , +"Ambiguous segment configuration\n" ); +return -EINVAL ; + } +/* +* Check the size of the mbuf data buffer, this value +* must be provided in the private data of the memory pool. +* First check that the memory pool(s) has a valid private data. +*/ +if (mp->private_data_size < +sizeof (struct rte_pktmbuf_pool_private )) { +RTE_ETHDEV_LOG (ERR ,"%s private_data_size %u < %u\n" , + mp->name, mp->private_data_size, + (unsigned int ) +sizeof (struct rte_pktmbuf_pool_private )); +return -ENOSPC ; + } + mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mbp_buf_size < dev_info.min_rx_bufsize + +RTE_PKTMBUF_HEADROOM ) { +RTE_ETHDEV_LOG (ERR , +"%s mbuf_data_room_size %u < %u (RTE_PKTMBUF_HEADROOM=%u + min_rx_bufsize(dev)=%u)\n" , + mp->name, mbp_buf_size, +RTE_PKTMBUF_HEADROOM + + dev_info.min_rx_bufsize, +RTE_PKTMBUF_HEADROOM , + dev_info.min_rx_bufsize); +return -EINVAL ; + } + }else { +const struct rte_eth_rxseg *rx_seg = rx_conf->rx_seg; +uint16_t n_seg = rx_conf->rx_nseg; -if (mbp_buf_size < dev_info.min_rx_bufsize +RTE_PKTMBUF_HEADROOM ) { -RTE_ETHDEV_LOG (ERR , -"%s mbuf_data_room_size %d < %d (RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)=%d)\n" , - mp->name, (int )mbp_buf_size, - (int )(RTE_PKTMBUF_HEADROOM + dev_info.min_rx_bufsize), - (int )RTE_PKTMBUF_HEADROOM , - (int )dev_info.min_rx_bufsize); -return -EINVAL ; +/* Extended multi-segment configuration check. */ +if (rx_conf->rx_seg ==NULL || rx_conf->rx_nseg ==0 ) { +RTE_ETHDEV_LOG (ERR , +"Memory pool is null and no extended configuration provided\n" ); +return -EINVAL ; + } +if (rx_conf->offloads &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { + ret =rte_eth_rx_queue_check_split (rx_seg, n_seg, + &mbp_buf_size, + &dev_info); +if (ret !=0 ) +return ret; + }else { +RTE_ETHDEV_LOG (ERR ,"No Rx segmentation offload configured\n" ); +return -EINVAL ; + } }/* Use default specified by driver, if nb_rx_desc is zero */ lib/librte_ethdev/rte_ethdev.h +4
-0@@ -970,6 +970,27 @@ struct rte_eth_txmode { };/** +* A structure used to configure an Rx packet segment to split. +*/ +struct rte_eth_rxseg_split { +struct rte_mempool *mp;/**< Memory pool to allocate segment from. */ lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 986
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+uint16_t length;/**< Segment data length, configures split point. */ +uint16_t offset;/**< Data offset from beginning of mbuf data buffer. */ +uint32_t reserved;/**< Reserved field. */ +}; + +/** +* A common structure used to describe Rx packet segment properties. +*/ +struct rte_eth_rxseg { + union {Why not just 'union
rte_eth_rxseg' ?lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 988
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split;Pointer to a split table must be here. I.e. struct
rte_eth_rxseg_split*split;
Also it must be specified how the array is terminated. We need either a number of define last item condition (mp == NULL ?)Quoted 45 lines
lib/librte_ethdev/rte_ethdev.h +5
-0+/* The other features settings should be added here. */ + } conf; +}; + +/** * A structure used to configure an RX ring of an Ethernet port. */
structrte_eth_rxconf{lib/librte_ethdev/rte_ethdev.h +30
-0@@ -977,6 +998,46 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */ uint8_t rx_deferred_start;/**< Do not start queue with rte_eth_dev_start(). */ +uint16_t rx_nseg;/**< Number of descriptions in rx_seg array. */ +/** +* Points to the array of segment descriptions. Each array element +* describes the properties for each segment in the receiving +* buffer according to feature descripting structure. +* +* The supported capabilities of receiving segmentation is reported +* in rte_eth_dev_info ->rx_seg_capa field. +* +* If RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag is set in offloads field, +* the PMD will split the received packets into multiple segments +* according to the specification in the description array: +* +* - the first network buffer will be allocated from the memory pool, +* specified in the first array element, the second buffer, from the +* pool in the second element, and so on. +* +* - the offsets from the segment description elements specify +* the data offset from the buffer beginning except the first mbuf. +* For this one the offset is added with RTE_PKTMBUF_HEADROOM. +* +* - the lengths in the elements define the maximal data amount +* being received to each segment. The receiving starts with filling +* up the first mbuf data buffer up to specified length. If the +* there are data remaining (packet is longer than buffer in the first +* mbuf) the following data will be pushed to the next segment +* up to its own length, and so on. +* +* - If the length in the segment description element is zero +* the actual buffer size will be deduced from the appropriate lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1040
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+* memory pool properties. +* +* - if there is not enough elements to describe the buffer for entire +* packet of maximal length the following parameters will be used +* for the all remaining segments: +* - pool from the last valid element +* - the buffer size from this pool +* - zero offset +*/ +struct rte_eth_rxseg *rx_seg;It must not be a pointer. It looks really strange this way taking into account that it is a union in fact. Also, why is it put here in the middle of exsiting structure? IMHO it should be added after offlaods.
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.h +1
-0/** * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. * Only offloads set on rx_queue_offload_capa or rx_offload_capa @@ -1260,6 +1321,7 @@ struct rte_eth_conf {#define DEV_RX_OFFLOAD_SCTP_CKSUM 0x00020000#define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000#define DEV_RX_OFFLOAD_RSS_HASH 0x00080000 +#define RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT 0x00100000#define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1445
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +5
-0@@ -1376,6 +1438,17 @@ struct rte_eth_switch_info { };/** +* Ethernet device Rx buffer segmentation capabilities. +*/ +__extension__ +struct rte_eth_rxseg_capa { + uint16_t max_seg; /**< Maximum amount of segments to split. */May be '
max_segs' to avoid confusing vs maximum segment length.lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1448
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +3
-0+ uint16_t multi_pools:1; /**< Supports receiving to multiple pools.*/ + uint16_t offset_allowed:1; /**< Supports buffer offsets. */ + uint16_t offset_align_log2:4; /**< Required offset alignment. */4 bits are even insufficient to specify cache-line alignment. IMHO at least 8 bits are required.
Consider to put 32 width bit-fields at start of the structure. Than,
max_segs(16),offset_align_log2(8), plus reserved (8).lib/librte_ethdev/rte_ethdev.h struct rte_eth_dev_info { · line 1479
Quoted 11 lines
lib/librte_ethdev/rte_ethdev.h +4
-0+}; + +/** * Ethernet device information */ @@ -1403,6 +1476,7 @@ struct rte_eth_dev_info {/** Maximum number of hash MAC addresses for MTA and UTA. */ uint16_t max_vfs;/**< Maximum number of VFs. */ uint16_t max_vmdq_pools;/**< Maximum number of VMDq pools. */ +struct rte_eth_rxseg_capa rx_seg_capa;/**< Segmentation capability.*/ Why is it put in the middle of existing structure?
Quoted 27 lines
lib/librte_ethdev/rte_ethdev.h +13
-1uint64_t rx_offload_capa;/**< All RX offload capabilities including all per-queue ones */ uint64_t tx_offload_capa;@@ -2027,9 +2101,21 @@ int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue,* No need to repeat any bit in rx_conf->offloads which has already been * enabled in rte_eth_dev_configure() at port level. An offloading enabled * at port level can't be disabled at queue level. +* The configuration structure also contains the pointer to the array +* of the receiving buffer segment descriptions, see rx_seg and rx_nseg +* fields, this extended configuration might be used by split offloads like +* RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT. If mp_pool is not NULL, +* the extended configuration fields must be set to NULL and zero. * @param mb_pool * The pointer to the memory pool from which to allocate *rte_mbuf* network -* memory buffers to populate each descriptor of the receive ring. +* memory buffers to populate each descriptor of the receive ring. There are +* two options to provide Rx buffer configuration: +* - single pool: +* mb_pool is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is 0. +* - multiple segments description: +* mb_pool is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not 0. +* Taken only if flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT is set in offloads. +* * @return * - 0: Success, receive queue correctly set up. * - -EIO: if device is removed.
Hi, Andrew
Quoted 17 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, October 16, 2020 11:52
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v8 1/6] ethdev: introduce Rx buffer splitQuoted 6 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
[snip]
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 986
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+struct rte_eth_rxseg { + union {Why not just 'union
rte_eth_rxseg' ?lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 988
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split;Pointer to a split table must be here. I.e.
structrte_eth_rxseg_split*split;
OK, will try to simplify with that, thanks.
Quoted 2 lines
Also it must be specified how the array is terminated.
We need either a number of define last item condition (mp == NULL ?)
We have one, please see: "rte_eth_rxconf->rx_nseg"
Quoted 16 lines
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.h +5
-0+/* The other features settings should be added here. */ + } conf; +}; + +/** * A structure used to configure an RX ring of an Ethernet port. */ struct rte_eth_rxconf {lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 999
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +0
-0@@ -977,6 +998,46 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1040
Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1
-0+struct rte_eth_rxseg *rx_seg;It must not be a pointer. It looks really strange this way taking into account that it is a union in fact.
Also, why is it put here in the middle of exsiting structure? IMHO it should be added after offlaods.
OK, agree, will move.
Quoted 14 lines
Quoted 14 lines
lib/librte_ethdev/rte_ethdev.h +1
-1/** * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. * Only offloads set on rx_queue_offload_capa or rx_offload_capa @@ -1260,6 +1321,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_SCTP_CKSUM 0x00020000 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000 #define DEV_RX_OFFLOAD_RSS_HASH 0x00080000 +#define RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT 0x00100000 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \ @@ -1376,6 +1438,17 @@ struct rte_eth_switch_info { };
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1445
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h +5
-0/** +* Ethernet device Rx buffer segmentation capabilities. +*/ +__extension__ +struct rte_eth_rxseg_capa { + uint16_t max_seg; /**< Maximum amount of segments to split. */May be '
max_segs' to avoid confusing vs maximum segment length.
OK, max_nseg would be more appropriate.
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1448
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +3
-0+ uint16_t multi_pools:1; /**< Supports receiving to multiple pools.*/ + uint16_t offset_allowed:1; /**< Supports buffer offsets. */ + uint16_t offset_align_log2:4; /**< Required offset alignment. */4 bits are even insufficient to specify cache-line alignment. IMHO at least 8 bits are required.
4 bits seems to be quite sufficient. It is a log2, tells how many lsbs in offset should be zeroes. 2^15 is 32K, it covers all reasonable alignments for uint16_t type.
Quoted 3 lines
Consider to put 32 width bit-fields at start of the structure. Than,
max_segs(16),offset_align_log2(8), plus reserved (8).
OK, np.
With best regards, Slava
Quoted 30 lines · Slava Ovsiienko
Hi, Andrew
Quoted 17 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, October 16, 2020 11:52
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v8 1/6] ethdev: introduce Rx buffer splitQuoted 6 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
[snip]
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 986
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+struct rte_eth_rxseg { + union {Why not just 'union
rte_eth_rxseg' ?lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 988
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split;Pointer to a split table must be here. I.e.
structrte_eth_rxseg_split*split;
Quoted 6 lines
OK, will try to simplify with that, thanks.
Quoted 2 lines
Also it must be specified how the array is terminated.
We need either a number of define last item condition (mp == NULL ?)We have one, please see: "
rte_eth_rxconf->rx_nseg"
A bit confusing to have it outside of union far from split but may be acceptable for the experimental API... If there are better ideas - welcome.
Quoted 47 lines
Quoted 16 lines
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.h +5
-0+/* The other features settings should be added here. */ + } conf; +}; + +/** * A structure used to configure an RX ring of an Ethernet port. */ struct rte_eth_rxconf {lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 999
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +0
-0@@ -977,6 +998,46 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1040
Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1
-0+struct rte_eth_rxseg *rx_seg;It must not be a pointer. It looks really strange this way taking into account that it is a union in fact.
Also, why is it put here in the middle of exsiting structure? IMHO it should be added after offlaods.OK, agree, will move.
Quoted 14 lines
Quoted 14 lines
lib/librte_ethdev/rte_ethdev.h +1
-1/** * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. * Only offloads set on rx_queue_offload_capa or rx_offload_capa @@ -1260,6 +1321,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_SCTP_CKSUM 0x00020000 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000 #define DEV_RX_OFFLOAD_RSS_HASH 0x00080000 +#define RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT 0x00100000 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \ @@ -1376,6 +1438,17 @@ struct rte_eth_switch_info { };Quoted 9 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1445
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h +5
-0/** +* Ethernet device Rx buffer segmentation capabilities. +*/ +__extension__ +struct rte_eth_rxseg_capa { + uint16_t max_seg; /**< Maximum amount of segments to split. */May be '
max_segs' to avoid confusing vs maximum segment length.
Quoted 1 line
OK,
max_nsegwould be more appropriate.
Agreed.
Quoted 18 lines
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1448
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +3
-0+ uint16_t multi_pools:1; /**< Supports receiving to multiple pools.*/ + uint16_t offset_allowed:1; /**< Supports buffer offsets. */ + uint16_t offset_align_log2:4; /**< Required offset alignment. */4 bits are even insufficient to specify cache-line alignment. IMHO at least 8 bits are required.
4 bits seems to be quite sufficient. It is a log2, tells how many lsbs in offset should be zeroes. 2^15 is 32K, it covers all reasonable alignments for
uint16_ttype.Quoted 3 lines
Consider to put 32 width bit-fields at start of the structure. Than,
max_segs(16),offset_align_log2(8), plus reserved (8).OK, np.
With best regards, Slava
Quoted 43 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, October 16, 2020 12:28
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v8 1/6] ethdev: introduce Rx buffer splitQuoted 32 lines · Slava Ovsiienko
Hi, Andrew
Quoted 17 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, October 16, 2020 11:52
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v8 1/6] ethdev: introduce Rx buffer splitQuoted 6 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
[snip]
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 986
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+struct rte_eth_rxseg { + union {Why not just 'union
rte_eth_rxseg' ?lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 988
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split;Pointer to a split table must be here. I.e.
structrte_eth_rxseg_split*split;OK, will try to simplify with that, thanks.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Also it must be specified how the array is terminated.
We need either a number of define last item condition (mp == NULL ?)We have one, please see: "
rte_eth_rxconf->rx_nseg"A bit confusing to have it outside of union far from split but may be acceptable for the experimental API...
If there are better ideas - welcome.
It can't be inside union - it does not share the memory layout with descriptors itself.
It can't be inside the descriptor structure either - rx_nseg describes the size of array, not segment property. It is uint16_t rx_nseg and is placed before offload to save some space due to rte_eth_rxconf members alignment. Will mark rte_eth_rxseg_split as experimental, nice clue, thanks.
With best regards, Slava
16/10/2020 11:15, Slava Ovsiienko:
Quoted 20 lines
From: Andrew Rybchenko <[email protected]>
Quoted 10 lines · Viacheslav Ovsiienko
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1445
Quoted 6 lines
/**
+ * Ethernet device Rx buffer segmentation capabilities.
+ */lib/librte_ethdev/rte_ethdev.h +3
-0+__extension__ +struct rte_eth_rxseg_capa { + uint16_t max_seg; /**< Maximum amount of segments to split. */May be '
max_segs' to avoid confusing vs maximum segment length.OK,
max_nsegwould be more appropriate.Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1448
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +3
-0+ uint16_t multi_pools:1; /**< Supports receiving to multiple pools.*/ + uint16_t offset_allowed:1; /**< Supports buffer offsets. */ + uint16_t offset_align_log2:4; /**< Required offset alignment. */4 bits are even insufficient to specify cache-line alignment. IMHO at least 8 bits are required.
Quoted 2 lines
4 bits seems to be quite sufficient. It is a log2, tells how many lsbs in offset should be zeroes. 2^15 is 32K, it covers all reasonable alignments for
uint16_ttype.
bitfields with uint16_t is not standard I think,
we could experience build issues.
If I remember well uint32_t is safer.
Quoted 31 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, October 16, 2020 12:37
To: Andrew Rybchenko <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v8 1/6] ethdev: introduce Rx buffer split16/10/2020 11:15, Slava Ovsiienko:
Quoted 20 lines
From: Andrew Rybchenko <[email protected]>
Quoted 10 lines · Viacheslav Ovsiienko
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1445
Quoted 6 lines
/**
+ * Ethernet device Rx buffer segmentation capabilities.
+ */lib/librte_ethdev/rte_ethdev.h +3
-0+__extension__ +struct rte_eth_rxseg_capa { + uint16_t max_seg; /**< Maximum amount of segments to split. */May be '
max_segs' to avoid confusing vs maximum segment length.OK,
max_nsegwould be more appropriate.Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1448
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +3
-0+ uint16_t multi_pools:1; /**< Supports receiving to multiple pools.*/ + uint16_t offset_allowed:1; /**< Supports buffer offsets. */ + uint16_t offset_align_log2:4; /**< Required offset alignment. */4 bits are even insufficient to specify cache-line alignment. IMHO at least 8 bits are required.
Quoted 7 lines
Quoted 1 line
4 bits seems to be quite sufficient. It is a log2, tells how many lsbs in offset
should be zeroes.
Quoted 1 line
2^15 is 32K, it covers all reasonable alignments for
uint16_ttype.bitfields with
uint16_tis not standard I think, we could experience build issues. If I remember welluint32_tis safer.
Agree, it is being replaced with uint32_t and embraces max_nseg as well.
Quoted 100 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.The following structure is introduced to specify the Rx packet segment for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLIToffload:struct
rte_eth_rxseg_split{struct
rte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length,
configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf.
This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2 seg1 - pool1, len1=20B, off1=128B seg2 - pool2, len2=20B, off2=0B seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The split limitations imposed by underlying PMD is reported in the new introduced
rte_eth_dev_info->rx_seg_capafield.The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Jerin Jacob <[email protected]>
<...>
Quoted 38 lines
lib/librte_ethdev/rte_ethdev.h +31
-0+/** * A structure used to configure an RX ring of an Ethernet port. */ struct rte_eth_rxconf {@@ -977,6 +998,46 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */ uint8_t rx_deferred_start;/**< Do not start queue with rte_eth_dev_start(). */ +uint16_t rx_nseg;/**< Number of descriptions in rx_seg array. */ +/** +* Points to the array of segment descriptions. Each array element +* describes the properties for each segment in the receiving +* buffer according to feature descripting structure. +* +* The supported capabilities of receiving segmentation is reported +* in rte_eth_dev_info ->rx_seg_capa field. +* +* If RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag is set in offloads field, +* the PMD will split the received packets into multiple segments +* according to the specification in the description array: +* +* - the first network buffer will be allocated from the memory pool, +* specified in the first array element, the second buffer, from the +* pool in the second element, and so on. +* +* - the offsets from the segment description elements specify +* the data offset from the buffer beginning except the first mbuf. +* For this one the offset is added with RTE_PKTMBUF_HEADROOM. +* +* - the lengths in the elements define the maximal data amount +* being received to each segment. The receiving starts with filling +* up the first mbuf data buffer up to specified length. If the +* there are data remaining (packet is longer than buffer in the first +* mbuf) the following data will be pushed to the next segment +* up to its own length, and so on. +* +* - If the length in the segment description element is zero +* the actual buffer size will be deduced from the appropriate
lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1040
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+* memory pool properties. +* +* - if there is not enough elements to describe the buffer for entire +* packet of maximal length the following parameters will be used +* for the all remaining segments: +* - pool from the last valid element +* - the buffer size from this pool +* - zero offset +*/ +struct rte_eth_rxseg *rx_seg;
"struct rte_eth_rxconf" is very commonly used, I think all applications does the 'rte_eth_rx_queue_setup()', but "buffer split" is not a common usage,
I am against the "struct rte_eth_rxseg *rx_seg;" field creating this much noise in the "struct rte_eth_rxconf" documentation.
As mentioned before, can you please move the above detailed documentation to where "struct rte_eth_rxseg" defined, and in this struct put a single comment for "struct rte_eth_rxseg *rx_seg" ?
Quoted 166 lines · Ferruh Yigit
Quoted 100 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.The following structure is introduced to specify the Rx packet segment for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLIToffload:struct
rte_eth_rxseg_split{struct
rte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length, configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The split limitations imposed by underlying PMD is reported in the new introduced
rte_eth_dev_info->rx_seg_capafield.The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Jerin Jacob <[email protected]><...>
Quoted 49 lines
+/**
* A structure used to configure an RX ring of an Ethernet port. */
structrte_eth_rxconf{(quoted diff) +0
-0@@ -977,6 +998,46 @@ struct rte_eth_rxconf {
uint16_trx_free_thresh; /**< Drives the freeing of RX descriptors. */
uint8_trx_drop_en; /**< Drop packets if no descriptors are available. */
uint8_trx_deferred_start; /**< Do not start queue withrte_eth_dev_start(). */
+uint16_trx_nseg; /**< Number of descriptions inrx_segarray. */ + /**
+ * Points to the array of segment descriptions. Each array element + * describes the properties for each segment in the receiving + * buffer according to feature descripting structure.
+ *
+ * The supported capabilities of receiving segmentation is reported + * inrte_eth_dev_info->rx_seg_capa field.
+ *
+ * IfRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag is set in offloads field, + * the PMD will split the received packets into multiple segments + * according to the specification in the description array:
+ *
+ * - the first network buffer will be allocated from the memory pool,
+ * specified in the first array element, the second buffer, from the
+ * pool in the second element, and so on.
+ *
+ * - the offsets from the segment description elements specify + * the data offset from the buffer beginning except the first mbuf.
+ * For this one the offset is added withRTE_PKTMBUF_HEADROOM. + *
+ * - the lengths in the elements define the maximal data amount + * being received to each segment. The receiving starts with filling
+ * up the first mbuf data buffer up to specified length. If the + * there are data remaining (packet is longer than buffer in the first
+ * mbuf) the following data will be pushed to the next segment + * up to its own length, and so on.
+ *
+ * - If the length in the segment description element is zero + * the actual buffer size will be deduced from the appropriate + * memory pool properties.
+ *
+ * - if there is not enough elements to describe the buffer forQuoted 8 lines
entire
+ * packet of maximal length the following parameters will be used + * for the all remaining segments:
+ * - pool from the last valid element
+ * - the buffer size from this pool
+ * - zero offset
+ */
+ structrte_eth_rxseg*rx_seg;"struct
rte_eth_rxconf" is very commonly used, I think all applications does the 'rte_eth_rx_queue_setup()', but "buffer split" is not a common usage,
Quoted 5 lines
I am against the "struct
rte_eth_rxseg*rx_seg;" field creating this much noise in the "structrte_eth_rxconf" documentation. As mentioned before, can you please move the above detailed documentation to where "structrte_eth_rxseg" defined, and in this struct put a single comment for "structrte_eth_rxseg*rx_seg" ?
+1
Quoted 166 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 16, 2020 12:19
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v8 1/6] ethdev: introduce Rx buffer splitQuoted 77 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.The following structure is introduced to specify the Rx packet segment for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLIToffload:struct
rte_eth_rxseg_split{struct
rte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length,
configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */ };The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf.
This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2 seg1 - pool1, len1=20B, off1=128B seg2 - pool2, len2=20B, off2=0B seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3Quoted 1 line
The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present andconfigured
Quoted 19 lines
to support new buffer split feature (if
rx_nsegis greater than one).The split limitations imposed by underlying PMD is reported in the new introduced
rte_eth_dev_info->rx_seg_capafield.The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Jerin Jacob <[email protected]><...>
lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 999
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +1
-0+/** * A structure used to configure an RX ring of an Ethernet port. */ struct rte_eth_rxconf {@@ -977,6 +998,46 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */
Quoted 32 lines
(quoted diff) +0
-0uint8_t rx_deferred_start; /**< Do not start queue with
rte_eth_dev_start(). */lib/librte_ethdev/rte_ethdev.h +30
-0+uint16_t rx_nseg;/**< Number of descriptions in rx_seg array. */ +/** +* Points to the array of segment descriptions. Each array element +* describes the properties for each segment in the receiving +* buffer according to feature descripting structure. +* +* The supported capabilities of receiving segmentation is reported +* in rte_eth_dev_info ->rx_seg_capa field. +* +* If RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag is set in offloads field, +* the PMD will split the received packets into multiple segments +* according to the specification in the description array: +* +* - the first network buffer will be allocated from the memory pool, +* specified in the first array element, the second buffer, from the +* pool in the second element, and so on. +* +* - the offsets from the segment description elements specify +* the data offset from the buffer beginning except the first mbuf. +* For this one the offset is added with RTE_PKTMBUF_HEADROOM. +* +* - the lengths in the elements define the maximal data amount +* being received to each segment. The receiving starts with filling +* up the first mbuf data buffer up to specified length. If the +* there are data remaining (packet is longer than buffer in the first +* mbuf) the following data will be pushed to the next segment +* up to its own length, and so on. +* +* - If the length in the segment description element is zero +* the actual buffer size will be deduced from the appropriate lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1040
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+* memory pool properties. +* +* - if there is not enough elements to describe the buffer for entire +* packet of maximal length the following parameters will be used +* for the all remaining segments: +* - pool from the last valid element +* - the buffer size from this pool +* - zero offset +*/ +struct rte_eth_rxseg *rx_seg;"struct
rte_eth_rxconf" is very commonly used, I think all applications does the 'rte_eth_rx_queue_setup()', but "buffer split" is not a common usage,
Quoted 5 lines
I am against the "struct
rte_eth_rxseg*rx_seg;" field creating this much noise in the "structrte_eth_rxconf" documentation.
As mentioned before, can you please move the above detailed documentation to where "structrte_eth_rxseg" defined, and in this struct put a single comment for "structrte_eth_rxseg*rx_seg" ?
Sure, we had doubts about putting this wordy comment to the rxconf structure either. Now we can move the comment to the rte_eth_rxseg_split declaration.
With best regards, Slava
PATCH v8 2/6 app/testpmd: add multiple pools per core creation
In reply to Viacheslav OvsiienkoThe command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with rte_the_dev_rx_queue_setup_ex().
The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
--- app/test-pmd/bpf_cmd.c | 4 +-- app/test-pmd/cmdline.c | 2 +- app/test-pmd/config.c | 6 ++-- app/test-pmd/parameters.c | 24 +++++++++---- app/test-pmd/testpmd.c | 63 +++++++++++++++++++---------------- app/test-pmd/testpmd.h | 24 ++++++++++--- doc/guides/testpmd_app_ug/run_app.rst | 7 ++-- 7 files changed, 83 insertions(+), 47 deletions(-)
app/test-pmd/bpf_cmd.c +2 -2
@@ -69,7 +69,7 @@ struct cmd_bpf_ld_result { *flags =RTE_BPF_ETH_F_NONE ; arg->type =RTE_BPF_ARG_PTR ; - arg->size = mbuf_data_size; + arg->size = mbuf_data_size[0 ];for (i =0 ; str[i] !=0 ; i++) { v =toupper (str[i]);
@@ -78,7 +78,7 @@ struct cmd_bpf_ld_result {else if (v =='M' ) { arg->type =RTE_BPF_ARG_PTR_MBUF ; arg->size =sizeof (struct rte_mbuf ); - arg->buf_size = mbuf_data_size; + arg->buf_size = mbuf_data_size[0 ]; }else if (v =='-' )continue ;else
app/test-pmd/cmdline.c +1 -1
@@ -2907,7 +2907,7 @@ struct cmd_setup_rxtx_queue {if (!numa_support || socket_id ==NUMA_NO_CONFIG ) socket_id = port->socket_id; - mp =mbuf_pool_find (socket_id); + mp =mbuf_pool_find (socket_id,0 );if (mp ==NULL ) {printf ("Failed to setup RX queue: " "No mempool allocation"
app/test-pmd/config.c +3 -3
@@ -690,7 +690,7 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("\nConnect to socket: %u" , port->socket_id);if (port_numa[port_id] !=NUMA_NO_CONFIG ) { - mp =mbuf_pool_find (port_numa[port_id]); + mp =mbuf_pool_find (port_numa[port_id],0 );if (mp)printf ("\nmemory allocation on the socket: %d" , port_numa[port_id]);
@@ -3352,9 +3352,9 @@ struct igb_ring_desc_16_bytes {*/ tx_pkt_len =0 ;for (i =0 ; i < nb_segs; i++) { -if (seg_lengths[i] > (unsigned ) mbuf_data_size) { +if (seg_lengths[i] > mbuf_data_size[0 ]) {printf ("length[%u]=%u > mbuf_data_size=%u - give up\n" , - i, seg_lengths[i], (unsigned ) mbuf_data_size); + i, seg_lengths[i], mbuf_data_size[0 ]);return ; } tx_pkt_len = (uint16_t )(tx_pkt_len + seg_lengths[i]);
app/test-pmd/parameters.c +18 -6
@@ -106,7 +106,9 @@ "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");printf (" --socket-num=N: set socket from which all memory is allocated " "in NUMA mode.\n" ); -printf (" --mbuf-size=N: set the data size of mbuf to N bytes.\n" ); +printf (" --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to " +"N bytes. If multiple numbers are specified the extra pools " +"will be created to receive with packet split features\n" );printf (" --total-num-mbufs=N: set the number of mbufs to be allocated " "in mbuf pools.\n" );printf (" --max-pkt-len=N: set the maximum size of packet to N bytes.\n" );
@@ -892,12 +894,22 @@ } }if (!strcmp (lgopts[opt_idx].name,"mbuf-size" )) { - n =atoi (optarg); -if (n >0 && n <=0xFFFF ) - mbuf_data_size = (uint16_t ) n; -else +unsigned int mb_sz[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs, i; + + nb_segs =parse_item_list (optarg,"mbuf-size" , +MAX_SEGS_BUFFER_SPLIT , mb_sz,0 ); +if (nb_segs <=0 )rte_exit (EXIT_FAILURE , -"mbuf-size should be > 0 and < 65536\n" ); +"bad mbuf-size\n" ); +for (i =0 ; i < nb_segs; i++) { +if (mb_sz[i] <=0 || mb_sz[i] >0xFFFF ) +rte_exit (EXIT_FAILURE , +"mbuf-size should be " +"> 0 and < 65536\n" ); + mbuf_data_size[i] = (uint16_t ) mb_sz[i]; + } + mbuf_data_size_n = nb_segs; }if (!strcmp (lgopts[opt_idx].name,"total-num-mbufs" )) { n =atoi (optarg);
app/test-pmd/testpmd.c +35 -28
145 lines not on this page · raw message
app/test-pmd/testpmd.h +19 -5
@@ -42,6 +42,13 @@*/ #define RTE_MAX_SEGS_PER_PKT 255/**< nb_segs is a 8-bit unsigned char. */ +/* +* The maximum number of segments per packet is used to configure +* buffer split feature, also specifies the maximum amount of +* optional Rx pools to allocate mbufs to split. +*/ +#define MAX_SEGS_BUFFER_SPLIT 8/**< nb_segs is a 8-bit unsigned char. */ +#define MAX_PKT_BURST 512#define DEF_PKT_BURST 32
@@ -393,7 +400,9 @@ struct queue_stats_mappings {extern uint8_t dcb_config;extern uint8_t dcb_test; -extern uint16_t mbuf_data_size;/**< Mbuf data space size. */ +extern uint32_t mbuf_data_size_n; +extern uint16_t mbuf_data_size[MAX_SEGS_BUFFER_SPLIT ]; +/**< Mbuf data space size. */ extern uint32_t param_total_num_mbufs;extern uint16_t stats_period;
@@ -605,17 +614,22 @@ struct mplsoudp_decap_conf {/* Mbuf Pools */ static inline void -mbuf_poolname_build (unsigned int sock_id,char * mp_name,int name_size) +mbuf_poolname_build (unsigned int sock_id,char *mp_name, +int name_size,unsigned int idx) { -snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +if (!idx) +snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +else +snprintf (mp_name, name_size,"mbuf_pool_socket_%u_%u" , + sock_id, idx); }static inline struct rte_mempool * -mbuf_pool_find (unsigned int sock_id) +mbuf_pool_find (unsigned int sock_id,unsigned int idx) {char pool_name[RTE_MEMPOOL_NAMESIZE ]; -mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name)); +mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name), idx);return rte_mempool_lookup ((const char *)pool_name); }
doc/guides/testpmd_app_ug/run_app.rst +5 -2
@@ -107,9 +107,12 @@ The command line options are: Set the socket from which all memory is allocated in NUMA mode, where 0 <= N < number of sockets on the board. -* ``--mbuf-size=N`` +* ``--mbuf-size=N[,N1[,...Nn]`` - Set the data size of the mbufs used to N bytes, where N < 65536. The default value is 2048. + Set the data size of the mbufs used to N bytes, where N < 65536. + The default value is 2048. If multiple mbuf-size values are specified the + extra memory pools will be created for allocating mbufs to receive packets + with buffer splittling features. * ``--total-num-mbufs=N``
Signature · 1 line
1.8.3.1
PATCH v8 3/6 app/testpmd: add buffer split offload configuration
In reply to Viacheslav OvsiienkoThis patch add support for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT providing per queue configuration for this offload.
--- app/test-pmd/cmdline.c | 21 +++++++++++---------- app/test-pmd/config.c | 9 +++++++++ 2 files changed, 20 insertions(+), 10 deletions(-)
app/test-pmd/cmdline.c +11 -10
@@ -883,16 +883,16 @@ static void cmd_help_long_parsed(void *parsed_result,"port config <port_id> rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per port Rx offloading" " on all Rx queues of a port\n\n" "port (port_id) rxq (queue_id) rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per queue Rx offloading" " only on a specific Rx queue\n\n"
@@ -18417,7 +18417,8 @@ struct cmd_config_per_port_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc#rss_hash"); +"scatter#buffer_split#timestamp#security#" + "keep_crc#rss_hash");cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result,
@@ -18497,8 +18498,8 @@ struct cmd_config_per_port_rx_offload_result { .help_str = "port config <port_id> rx_offload vlan_strip|ipv4_cksum|""udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc|rss_hash " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc|rss_hash on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, (void *)&cmd_config_per_port_rx_offload_result_config,
@@ -18547,7 +18548,7 @@ struct cmd_config_per_queue_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc"); + "scatter#buffer_split#timestamp#security#keep_crc");cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result,
@@ -18603,8 +18604,8 @@ struct cmd_config_per_queue_rx_offload_result {"vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, (void *)&cmd_config_per_queue_rx_offload_result_port_id,
app/test-pmd/config.c +9 -0
@@ -1092,6 +1092,15 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("off\n" ); } +if (dev_info.rx_offload_capa &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { +printf ("RX offload buffer split: " ); +if (ports[port_id].dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) +printf ("on\n" ); +else +printf ("off\n" ); + } +if (dev_info.tx_offload_capa &DEV_TX_OFFLOAD_VLAN_INSERT ) {printf ("VLAN insert: " ); if (ports[port_id].dev_conf.txmode.offloads &
Signature · 1 line
1.8.3.1
PATCH v8 4/6 app/testpmd: add rxpkts commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxpkts=X[,Y]
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command:
testpmd> set rxpkts (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only). Optionally the multiple memory pools can be specified with --mbuf-size command line parameter and the mbufs to receive will be allocated sequentially from these extra memory pools.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 48 ++++++++++++++++++++++- app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 7 ++++ app/test-pmd/testpmd.h | 11 +++++- doc/guides/testpmd_app_ug/run_app.rst | 9 +++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 +++++++++- 7 files changed, 165 insertions(+), 7 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|txpkts)\n" +"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxpkts (x[,y]*)\n" +" Set the length of each segment to scatter" +" packets on receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set txpkts (x[,y]*)\n" " Set the length of each segment of TXONLY" " and optionally CSUM packets.\n\n"
@@ -3889,6 +3895,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxpkts_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxpkts; +cmdline_fixed_string_t seg_lengths; +}; + +static void +cmd_set_rxpkts_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxpkts_result *res; +unsigned int seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_lengths,"segment lengths" , +MAX_SEGS_BUFFER_SPLIT , seg_lengths,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_lengths, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxpkts_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxpkts_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + rxpkts,"rxpkts" ); +cmdline_parse_token_string_t cmd_set_rxpkts_lengths = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + seg_lengths,NULL ); + +cmdline_parse_inst_t cmd_set_rxpkts = { + .f = cmd_set_rxpkts_parsed, + .data =NULL , + .help_str ="set rxpkts <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxpkts_keyword, + (void *)&cmd_set_rxpkts_name, + (void *)&cmd_set_rxpkts_lengths, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */ struct cmd_set_txpkts_result {
@@ -7517,6 +7569,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxpkts")) +show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))show_tx_pkt_segments (); else if (!strcmp(res->what, "txtimes"))
@@ -7529,12 +7583,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#txpkts#txtimes" ); +"rxtx#cores#fwd#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19807,6 +19861,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit, (cmdline_parse_inst_t *)&cmd_set_txtimes,
app/test-pmd/config.c +46 -2
62 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );printf (" --txonly-multi-flow: generate multiple flows in txonly mode\n" );
@@ -662,6 +663,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 }, { "disable-link-check", 0, 0, 0 },
@@ -1272,6 +1274,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) { +unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + nb_segs =parse_item_list + (optarg,"rxpkt segments" , +MAX_SEGS_BUFFER_SPLIT , + seg_len,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_len, nb_segs); +else +rte_exit (EXIT_FAILURE ,"bad rxpkts\n" ); + }if (!strcmp (lgopts[opt_idx].name,"txpkts" )) {unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +7 -0
@@ -210,6 +210,13 @@ struct fwd_engine * fwd_engines[] = {uint8_t f_quit;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ uint16_t tx_pkt_length =TXONLY_DEF_PACKET_LEN ;/**< TXONLY packet length. */
app/test-pmd/testpmd.h +10 -1
@@ -420,6 +420,13 @@ struct queue_stats_mappings {extern struct rte_fdir_conf fdir_conf;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ #define TXONLY_DEF_PACKET_LEN 64
@@ -816,7 +823,9 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_record_core_cycles (uint8_t on_off);void set_record_burst_stats (uint8_t on_off);void set_verbose_level (uint16_t vb_level); -void set_tx_pkt_segments (unsigned *seg_lengths,unsigned nb_segs); +void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs); +void show_rx_pkt_segments (void ); +void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);void show_tx_pkt_times (void );
doc/guides/testpmd_app_ug/run_app.rst +9 -0
@@ -361,6 +361,15 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxpkts=X[,Y]`` + + Set the length of segments to scatter packets on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + Optionally the multiple memory pools can be specified with --mbuf-size + command line parameter and the mbufs to receive will be allocated + sequentially from these extra memory pools. + * ``--txpkts=X[,Y]`` Set TX segment sizes or total packet length. Valid for ``tx-only``
doc/guides/testpmd_app_ug/testpmd_funcs.rst +20 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxpkts``: Packets to RX split configuration. + * ``txpkts``: Packets to TX configuration. * ``txtimes``: Burst time pattern for Tx only mode.
@@ -774,6 +776,23 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxpkts +~~~~~~~~~~ + +Set the length of segments to scatter packets on receiving if split +feature is engaged. Affects only the queues configured with split offloads +(currently BUFFER_SPLIT is supported only). Optionally the multiple memory +pools can be specified with --mbuf-size command line parameter and the mbufs +to receive will be allocated sequentially from these extra memory pools (the +mbuf for the first segment is allocated from the first pool, the second one +from the second pool, and so on, if segment number is greater then pool's the +mbuf for remaining segments will be allocated from the last valid pool). + + testpmd> set rxpkts (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. Zero value +means to use the corresponding memory pool data buffer size. + set txpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v8 5/6 app/testpmd: add rxoffs commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxoffs=X[,Y]
Sets the offsets of packet segments from the beginning of the receiving buffer if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command, providing the same:
testpmd> set rxoffs (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 44 +++++++++++++++++++++ app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 2 + app/test-pmd/testpmd.h | 4 ++ doc/guides/testpmd_app_ug/run_app.rst | 6 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 17 +++++++- 7 files changed, 145 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" +"show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxoffs (x[,y]*)\n" +" Set the offset of each packet segment on" +" receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set rxpkts (x[,y]*)\n" " Set the length of each segment to scatter" " packets on receiving if split feature is engaged."
@@ -3895,6 +3901,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT OFFSETS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxoffs_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxoffs; +cmdline_fixed_string_t seg_offsets; +}; + +static void +cmd_set_rxoffs_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxoffs_result *res; +unsigned int seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_offsets,"segment offsets" , +MAX_SEGS_BUFFER_SPLIT , seg_offsets,0 ); +if (nb_segs >0 ) +set_rx_pkt_offsets (seg_offsets, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxoffs_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxoffs_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + rxoffs,"rxoffs" ); +cmdline_parse_token_string_t cmd_set_rxoffs_offsets = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + seg_offsets,NULL ); + +cmdline_parse_inst_t cmd_set_rxoffs = { + .f = cmd_set_rxoffs_parsed, + .data =NULL , + .help_str ="set rxoffs <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxoffs_keyword, + (void *)&cmd_set_rxoffs_name, + (void *)&cmd_set_rxoffs_offsets, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ struct cmd_set_rxpkts_result {
@@ -7569,6 +7621,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxoffs")) +show_rx_pkt_offsets (); else if (!strcmp(res->what, "rxpkts"))show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))
@@ -7583,12 +7637,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#rxpkts#txpkts#txtimes" ); +"rxtx#cores#fwd#rxoffs#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19861,6 +19915,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxoffs, (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit,
app/test-pmd/config.c +44 -0
50 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxoffs=X[,Y]*: set RX segment offsets for split.\n" );printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );
@@ -663,6 +664,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxoffs", 1, 0, 0 }, { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 },
@@ -1274,6 +1276,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxoffs" )) { +unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_offs; + + nb_offs =parse_item_list + (optarg,"rxpkt offsets" , +MAX_SEGS_BUFFER_SPLIT , + seg_off,0 ); +if (nb_offs >0 ) +set_rx_pkt_offsets (seg_off, nb_offs); +else +rte_exit (EXIT_FAILURE ,"bad rxoffs\n" ); + }if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) {unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +2 -0
@@ -215,6 +215,8 @@ struct fwd_engine * fwd_engines[] = {*/ uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
app/test-pmd/testpmd.h +4 -0
@@ -425,6 +425,8 @@ struct queue_stats_mappings {*/ extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
@@ -825,6 +827,8 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_verbose_level (uint16_t vb_level);void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_rx_pkt_segments (void ); +void set_rx_pkt_offsets (unsigned int *seg_offsets,unsigned int nb_offs); +void show_rx_pkt_offsets (void );void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);
doc/guides/testpmd_app_ug/run_app.rst +6 -0
@@ -361,6 +361,12 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxoffs=X[,Y]`` + + Set the offsets of packet segments on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + * ``--rxpkts=X[,Y]`` Set the length of segments to scatter packets on receiving if split
doc/guides/testpmd_app_ug/testpmd_funcs.rst +16 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxoffs``: Packet offsets for RX split. + * ``rxpkts``: Packets to RX split configuration. * ``txpkts``: Packets to TX configuration.
@@ -776,6 +778,19 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxoffs +~~~~~~~~~~ + +Set the offsets of segments relating to the data buffer beginning on receiving +if split feature is engaged. Affects only the queues configured with split +offloads (currently BUFFER_SPLIT is supported only). + + testpmd> set rxoffs (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. If the list +of offsets is shorter than the list of segments the zero offsets will be used +for the remaining segments. + set rxpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v8 6/6 app/testpmd: add extended Rx queue setup
In reply to Viacheslav OvsiienkoIf Rx queue is configured with split feature the extended setup with specified segment sizes and pool will be performed.
--- app/test-pmd/cmdline.c | 12 ++++++------ app/test-pmd/testpmd.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- app/test-pmd/testpmd.h | 5 +++++ 3 files changed, 57 insertions(+), 8 deletions(-)
app/test-pmd/cmdline.c +6 -6
@@ -2927,12 +2927,12 @@ struct cmd_setup_rxtx_queue { rxring_numa[res->portid]);return ; } - ret =rte_eth_rx_queue_setup (res->portid, - res->qid, - port->nb_rx_desc[res->qid], - socket_id, - &port->rx_conf[res->qid], - mp); + ret =rx_queue_setup (res->portid, + res->qid, + port->nb_rx_desc[res->qid], + socket_id, + &port->rx_conf[res->qid], + mp);if (ret)printf ("Failed to setup RX queue\n" ); }else {
app/test-pmd/testpmd.c +46 -2
66 lines not on this page · raw message
app/test-pmd/testpmd.h +5 -0
@@ -876,6 +876,11 @@ void port_rss_reta_info(portid_t port_id,void set_vf_traffic (portid_t port_id,uint8_t is_rx,uint16_t vf,uint8_t on); +int +rx_queue_setup (uint16_t port_id,uint16_t rx_queue_id, +uint16_t nb_rx_desc,unsigned int socket_id, +struct rte_eth_rxconf *rx_conf,struct rte_mempool *mp); +int set_queue_rate_limit (portid_t port_id,uint16_t queue_idx,uint16_t rate);int set_vf_rate_limit (portid_t port_id,uint16_t vf,uint16_t rate,uint64_t q_msk);
Signature · 1 line
1.8.3.1
v9 cover ethdev: introduce Rx buffer split
In reply to Slava OvsiienkoThe DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
---
v1: http://patches.dpdk.org/patch/79594/
v2: http://patches.dpdk.org/patch/79893/
- add feature support to mlx5 PMD
v3: http://patches.dpdk.org/patch/80389/
- rte_eth_rx_queue_setup_ex is renamed to rte_eth_rxseg_queue_setup
- DEV_RX_OFFLOAD_BUFFER_SPLIT is renamed to RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT
- commit message update
- documentaion provided
- release notes update
- minor bug fixes in testpmd related part
v4: http://patches.dpdk.org/patch/80401/
- common part of rx_queue_setup/rxseg_queue_setup
v5: http://patches.dpdk.org/patch/80609/
- refactored to approach of providing split configuration in the rte_eth_rxconf structure instead of introducing the new API routine
- added support for rxoffs command to testpmd to provide segment offsets for complete testing of split configurations
- patchset is split into two parts - PMD part will be presented as separate series
v6: http://patches.dpdk.org/patch/80785/
- wordy comments rephrased
- typos fixed
- rte_eth_rx_queue_setup configuration check isolated for two main options
- the rest of comments addressed
v7: http://patches.dpdk.org/patch/80978/
- description as union of feature dedicated segment split description
- the split limitations reported in the rte_eth_dev_info->rx_seg_capa
- comments made less wordy
v8: http://patches.dpdk.org/patch/81038/
- bitfield instead of uint8;
- named union to avoid warinings;
- typos fixed
v9: - simplified rte_eth_rxseg union
- moved out wordy comment from rte_eth_rxconf
- rte_eth_rxseg_capa uint32 bitfield and naming
- added experimental tags
---
Viacheslav Ovsiienko (6):
ethdev: introduce Rx buffer split app/testpmd: add multiple pools per core creation app/testpmd: add buffer split offload configuration app/testpmd: add rxpkts commands and parameters app/testpmd: add rxoffs commands and parameters app/testpmd: add extended Rx queue setup
app/test-pmd/bpf_cmd.c | 4 +- app/test-pmd/cmdline.c | 151 +++++++++++++++++++++++---- app/test-pmd/config.c | 107 ++++++++++++++++++- app/test-pmd/parameters.c | 54 ++++++++-- app/test-pmd/testpmd.c | 121 ++++++++++++++++------ app/test-pmd/testpmd.h | 44 ++++++-- doc/guides/nics/features.rst | 15 +++ doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_20_11.rst | 9 ++ doc/guides/testpmd_app_ug/run_app.rst | 22 +++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 36 ++++++- lib/librte_ethdev/rte_ethdev.c | 153 +++++++++++++++++++++++----- lib/librte_ethdev/rte_ethdev.h | 89 +++++++++++++++- 13 files changed, 707 insertions(+), 103 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v9 1/6 ethdev: introduce Rx buffer split
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
--- doc/guides/nics/features.rst | 15 ++++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 ++ lib/librte_ethdev/rte_ethdev.c | 153 +++++++++++++++++++++++++++------ lib/librte_ethdev/rte_ethdev.h | 89 ++++++++++++++++++- 5 files changed, 240 insertions(+), 31 deletions(-)
doc/guides/nics/features.rst +15 -0
@@ -185,6 +185,21 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[provides] eth_dev_ops**: ``rxq_info_get:buffer_split``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LRO
doc/guides/rel_notes/deprecation.rst +0 -5
@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``
doc/guides/rel_notes/release_20_11.rst +9 -0
@@ -89,6 +89,12 @@ New Features as flow action. * Added new flow APIs to create/update/destroy/query shared action. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:
@@ -321,6 +327,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functions
lib/librte_ethdev/rte_ethdev.c +128 -25
187 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev.h +88 -1
133 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 101 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.The following structure is introduced to specify the Rx packet segment for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLIToffload:struct
rte_eth_rxseg_split{struct
rte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length,
configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf.
This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2 seg1 - pool1, len1=20B, off1=128B seg2 - pool2, len2=20B, off2=0B seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The split limitations imposed by underlying PMD is reported in the new introduced
rte_eth_dev_info->rx_seg_capafield.The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Jerin Jacob <[email protected]>Reviewed-by Andrew Rybchenko <[email protected]>
<...>
doc/guides/nics/features.rst Supports receiving segmented mbufs. · line 199
Quoted 12 lines
+..
_nic_features_buffer_split:doc/guides/nics/features.rst +11
-0+ +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[provides] eth_dev_ops**: ``rxq_info_get:buffer_split``.
Previously you mentioned this is because 'rxq_info_get()' can provide buffer_split information, but with current implementation it doesn't and there is no filed in the struct to report such.
I suggest either add it now, while you can :) [with a techboard approval], or remove above documentation of it.
<...>
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info { · line 1450
Quoted 11 lines
/**
+ * Ethernet device Rx buffer segmentation capabilities.
+ */lib/librte_ethdev/rte_ethdev.h +8
-0+__rte_experimental +struct rte_eth_rxseg_capa { + __extension__ + uint32_t max_nseg:16; /**< Maximum amount of segments to split. */ + uint32_t multi_pools:1; /**< Supports receiving to multiple pools.*/ + uint32_t offset_allowed:1; /**< Supports buffer offsets. */ + uint32_t offset_align_log2:4; /**< Required offset alignment. */ +};
Now we are fiddling details, but,
I am not fun of the bitfields [1], but I assumed Thomas' request was to enable expanding capabilities later without breaking the ABI, which makes senses and suits to this kind of capability struct, if this is correct why made the 'max_nseg' a bitfield too?
Why not,uint16_t max_nseg;uint16_t multi_pools:1uint16_t offset_allowed:1;uint16_t offset_align_log2:4;
< This still leaves 10 bits to expand without ABI break>
[1]
unles very space critical use case, otherwise they just add more code to extract the same value, and not as simple as a simple variable :)
Quoted 17 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 16, 2020 14:21
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v9 1/6] ethdev: introduce Rx buffer splitQuoted 6 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
[snip]
Quoted 9 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ +* **[uses] rte_eth_rxconf,rte_eth_rxmode**:``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``.
doc/guides/nics/features.rst Supports receiving segmented mbufs.
Quoted 3 lines
doc/guides/nics/features.rst +3
-0+* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**:``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``.
Quoted 1 line
+* **[provides] eth_dev_ops**: ``rxq_info_get:buffer_split``.
Quoted 9 lines
Previously you mentioned this is because '
rxq_info_get()' can providebuffer_splitinformation, but with current implementation it doesn't and there is no filed in the struct to report such.I suggest either add it now, while you can :) [with a techboard approval], or remove above documentation of it.
<...>
Mmm, I messed up with rx_burst_mode_get(). Will fix, thanks.
Quoted 25 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_switch_info {
Quoted 10 lines
/**
+ * Ethernet device Rx buffer segmentation capabilities.
+ */lib/librte_ethdev/rte_ethdev.h +7
-0+__rte_experimental +struct rte_eth_rxseg_capa { + __extension__ + uint32_t max_nseg:16; /**< Maximum amount of segments to split. */ + uint32_t multi_pools:1; /**< Supports receiving to multiple pools.*/ + uint32_t offset_allowed:1; /**< Supports buffer offsets. */ + uint32_t offset_align_log2:4; /**< Required offset alignment. */ };Now we are fiddling details, but,
I am not fun of the bitfields [1], but I assumed Thomas' request was to enable expanding capabilities later without breaking the ABI, which makes senses and suits to this kind of capability struct, if this is correct why made the '
max_nseg' a bitfield too?Why not,
uint16_tmax_nseg;uint16_tmulti_pools:1uint16_toffset_allowed:1;uint16_toffset_align_log2:4;
< This still leaves 10 bits to expand without ABI break>
Quoted 3 lines
[1]
unles very space critical use case, otherwise they just add more code to extract the same value, and not as simple as a simple variable :)
It seems not to be the case, there is the listing of the rte_eth_rx_queue_check_split():
8963 4b67 440FB784 movzwl 188(%rsp),%r8d ; [SO] max_nseg is fetched as regular uint16_t
8963 24BC0000
8963 00
8964 4b70 664539C1 cmpw %r8w,%r9w
8965 4b74 0F87A402 ja .L1749
8965 0000
I would prefer to keep uint32_t - it is more generic, IMO.
With best regards, Slava
PATCH v9 2/6 app/testpmd: add multiple pools per core creation
In reply to Viacheslav OvsiienkoThe command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with rte_the_dev_rx_queue_setup_ex().
The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
--- app/test-pmd/bpf_cmd.c | 4 +-- app/test-pmd/cmdline.c | 2 +- app/test-pmd/config.c | 6 ++-- app/test-pmd/parameters.c | 24 +++++++++---- app/test-pmd/testpmd.c | 63 +++++++++++++++++++---------------- app/test-pmd/testpmd.h | 24 ++++++++++--- doc/guides/testpmd_app_ug/run_app.rst | 7 ++-- 7 files changed, 83 insertions(+), 47 deletions(-)
app/test-pmd/bpf_cmd.c +2 -2
@@ -69,7 +69,7 @@ struct cmd_bpf_ld_result { *flags =RTE_BPF_ETH_F_NONE ; arg->type =RTE_BPF_ARG_PTR ; - arg->size = mbuf_data_size; + arg->size = mbuf_data_size[0 ];for (i =0 ; str[i] !=0 ; i++) { v =toupper (str[i]);
@@ -78,7 +78,7 @@ struct cmd_bpf_ld_result {else if (v =='M' ) { arg->type =RTE_BPF_ARG_PTR_MBUF ; arg->size =sizeof (struct rte_mbuf ); - arg->buf_size = mbuf_data_size; + arg->buf_size = mbuf_data_size[0 ]; }else if (v =='-' )continue ;else
app/test-pmd/cmdline.c +1 -1
@@ -2925,7 +2925,7 @@ struct cmd_setup_rxtx_queue {if (!numa_support || socket_id ==NUMA_NO_CONFIG ) socket_id = port->socket_id; - mp =mbuf_pool_find (socket_id); + mp =mbuf_pool_find (socket_id,0 );if (mp ==NULL ) {printf ("Failed to setup RX queue: " "No mempool allocation"
app/test-pmd/config.c +3 -3
@@ -690,7 +690,7 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("\nConnect to socket: %u" , port->socket_id);if (port_numa[port_id] !=NUMA_NO_CONFIG ) { - mp =mbuf_pool_find (port_numa[port_id]); + mp =mbuf_pool_find (port_numa[port_id],0 );if (mp)printf ("\nmemory allocation on the socket: %d" , port_numa[port_id]);
@@ -3580,9 +3580,9 @@ struct igb_ring_desc_16_bytes {*/ tx_pkt_len =0 ;for (i =0 ; i < nb_segs; i++) { -if (seg_lengths[i] > (unsigned ) mbuf_data_size) { +if (seg_lengths[i] > mbuf_data_size[0 ]) {printf ("length[%u]=%u > mbuf_data_size=%u - give up\n" , - i, seg_lengths[i], (unsigned ) mbuf_data_size); + i, seg_lengths[i], mbuf_data_size[0 ]);return ; } tx_pkt_len = (uint16_t )(tx_pkt_len + seg_lengths[i]);
app/test-pmd/parameters.c +18 -6
@@ -106,7 +106,9 @@ "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");printf (" --socket-num=N: set socket from which all memory is allocated " "in NUMA mode.\n" ); -printf (" --mbuf-size=N: set the data size of mbuf to N bytes.\n" ); +printf (" --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to " +"N bytes. If multiple numbers are specified the extra pools " +"will be created to receive with packet split features\n" );printf (" --total-num-mbufs=N: set the number of mbufs to be allocated " "in mbuf pools.\n" );printf (" --max-pkt-len=N: set the maximum size of packet to N bytes.\n" );
@@ -892,12 +894,22 @@ } }if (!strcmp (lgopts[opt_idx].name,"mbuf-size" )) { - n =atoi (optarg); -if (n >0 && n <=0xFFFF ) - mbuf_data_size = (uint16_t ) n; -else +unsigned int mb_sz[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs, i; + + nb_segs =parse_item_list (optarg,"mbuf-size" , +MAX_SEGS_BUFFER_SPLIT , mb_sz,0 ); +if (nb_segs <=0 )rte_exit (EXIT_FAILURE , -"mbuf-size should be > 0 and < 65536\n" ); +"bad mbuf-size\n" ); +for (i =0 ; i < nb_segs; i++) { +if (mb_sz[i] <=0 || mb_sz[i] >0xFFFF ) +rte_exit (EXIT_FAILURE , +"mbuf-size should be " +"> 0 and < 65536\n" ); + mbuf_data_size[i] = (uint16_t ) mb_sz[i]; + } + mbuf_data_size_n = nb_segs; }if (!strcmp (lgopts[opt_idx].name,"total-num-mbufs" )) { n =atoi (optarg);
app/test-pmd/testpmd.c +35 -28
145 lines not on this page · raw message
app/test-pmd/testpmd.h +19 -5
@@ -42,6 +42,13 @@*/ #define RTE_MAX_SEGS_PER_PKT 255/**< nb_segs is a 8-bit unsigned char. */ +/* +* The maximum number of segments per packet is used to configure +* buffer split feature, also specifies the maximum amount of +* optional Rx pools to allocate mbufs to split. +*/ +#define MAX_SEGS_BUFFER_SPLIT 8/**< nb_segs is a 8-bit unsigned char. */ +#define MAX_PKT_BURST 512#define DEF_PKT_BURST 32
@@ -403,7 +410,9 @@ struct queue_stats_mappings {extern uint8_t dcb_config;extern uint8_t dcb_test; -extern uint16_t mbuf_data_size;/**< Mbuf data space size. */ +extern uint32_t mbuf_data_size_n; +extern uint16_t mbuf_data_size[MAX_SEGS_BUFFER_SPLIT ]; +/**< Mbuf data space size. */ extern uint32_t param_total_num_mbufs;extern uint16_t stats_period;
@@ -615,17 +624,22 @@ struct mplsoudp_decap_conf {/* Mbuf Pools */ static inline void -mbuf_poolname_build (unsigned int sock_id,char * mp_name,int name_size) +mbuf_poolname_build (unsigned int sock_id,char *mp_name, +int name_size,unsigned int idx) { -snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +if (!idx) +snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +else +snprintf (mp_name, name_size,"mbuf_pool_socket_%u_%u" , + sock_id, idx); }static inline struct rte_mempool * -mbuf_pool_find (unsigned int sock_id) +mbuf_pool_find (unsigned int sock_id,unsigned int idx) {char pool_name[RTE_MEMPOOL_NAMESIZE ]; -mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name)); +mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name), idx);return rte_mempool_lookup ((const char *)pool_name); }
doc/guides/testpmd_app_ug/run_app.rst +5 -2
@@ -107,9 +107,12 @@ The command line options are: Set the socket from which all memory is allocated in NUMA mode, where 0 <= N < number of sockets on the board. -* ``--mbuf-size=N`` +* ``--mbuf-size=N[,N1[,...Nn]`` - Set the data size of the mbufs used to N bytes, where N < 65536. The default value is 2048. + Set the data size of the mbufs used to N bytes, where N < 65536. + The default value is 2048. If multiple mbuf-size values are specified the + extra memory pools will be created for allocating mbufs to receive packets + with buffer splittling features. * ``--total-num-mbufs=N``
Signature · 1 line
1.8.3.1
PATCH v9 3/6 app/testpmd: add buffer split offload configuration
In reply to Viacheslav OvsiienkoThis patch add support for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT providing per queue configuration for this offload.
--- app/test-pmd/cmdline.c | 21 +++++++++++---------- app/test-pmd/config.c | 9 +++++++++ 2 files changed, 20 insertions(+), 10 deletions(-)
app/test-pmd/cmdline.c +11 -10
@@ -883,16 +883,16 @@ static void cmd_help_long_parsed(void *parsed_result,"port config <port_id> rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per port Rx offloading" " on all Rx queues of a port\n\n" "port (port_id) rxq (queue_id) rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per queue Rx offloading" " only on a specific Rx queue\n\n"
@@ -18435,7 +18435,8 @@ struct cmd_config_per_port_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc#rss_hash"); +"scatter#buffer_split#timestamp#security#" + "keep_crc#rss_hash");cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result,
@@ -18515,8 +18516,8 @@ struct cmd_config_per_port_rx_offload_result { .help_str = "port config <port_id> rx_offload vlan_strip|ipv4_cksum|""udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc|rss_hash " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc|rss_hash on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, (void *)&cmd_config_per_port_rx_offload_result_config,
@@ -18565,7 +18566,7 @@ struct cmd_config_per_queue_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc"); + "scatter#buffer_split#timestamp#security#keep_crc");cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result,
@@ -18621,8 +18622,8 @@ struct cmd_config_per_queue_rx_offload_result {"vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, (void *)&cmd_config_per_queue_rx_offload_result_port_id,
app/test-pmd/config.c +9 -0
@@ -1092,6 +1092,15 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("off\n" ); } +if (dev_info.rx_offload_capa &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { +printf ("RX offload buffer split: " ); +if (ports[port_id].dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) +printf ("on\n" ); +else +printf ("off\n" ); + } +if (dev_info.tx_offload_capa &DEV_TX_OFFLOAD_VLAN_INSERT ) {printf ("VLAN insert: " ); if (ports[port_id].dev_conf.txmode.offloads &
Signature · 1 line
1.8.3.1
PATCH v9 4/6 app/testpmd: add rxpkts commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxpkts=X[,Y]
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command:
testpmd> set rxpkts (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only). Optionally the multiple memory pools can be specified with --mbuf-size command line parameter and the mbufs to receive will be allocated sequentially from these extra memory pools.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 48 ++++++++++++++++++++++- app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 7 ++++ app/test-pmd/testpmd.h | 11 +++++- doc/guides/testpmd_app_ug/run_app.rst | 9 +++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 +++++++++- 7 files changed, 165 insertions(+), 7 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|txpkts)\n" +"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxpkts (x[,y]*)\n" +" Set the length of each segment to scatter" +" packets on receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set txpkts (x[,y]*)\n" " Set the length of each segment of TXONLY" " and optionally CSUM packets.\n\n"
@@ -3907,6 +3913,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxpkts_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxpkts; +cmdline_fixed_string_t seg_lengths; +}; + +static void +cmd_set_rxpkts_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxpkts_result *res; +unsigned int seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_lengths,"segment lengths" , +MAX_SEGS_BUFFER_SPLIT , seg_lengths,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_lengths, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxpkts_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxpkts_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + rxpkts,"rxpkts" ); +cmdline_parse_token_string_t cmd_set_rxpkts_lengths = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + seg_lengths,NULL ); + +cmdline_parse_inst_t cmd_set_rxpkts = { + .f = cmd_set_rxpkts_parsed, + .data =NULL , + .help_str ="set rxpkts <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxpkts_keyword, + (void *)&cmd_set_rxpkts_name, + (void *)&cmd_set_rxpkts_lengths, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */ struct cmd_set_txpkts_result {
@@ -7535,6 +7587,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxpkts")) +show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))show_tx_pkt_segments (); else if (!strcmp(res->what, "txtimes"))
@@ -7547,12 +7601,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#txpkts#txtimes" ); +"rxtx#cores#fwd#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19825,6 +19879,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit, (cmdline_parse_inst_t *)&cmd_set_txtimes,
app/test-pmd/config.c +46 -2
62 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );printf (" --txonly-multi-flow: generate multiple flows in txonly mode\n" );
@@ -662,6 +663,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 }, { "disable-link-check", 0, 0, 0 },
@@ -1272,6 +1274,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) { +unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + nb_segs =parse_item_list + (optarg,"rxpkt segments" , +MAX_SEGS_BUFFER_SPLIT , + seg_len,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_len, nb_segs); +else +rte_exit (EXIT_FAILURE ,"bad rxpkts\n" ); + }if (!strcmp (lgopts[opt_idx].name,"txpkts" )) {unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +7 -0
@@ -210,6 +210,13 @@ struct fwd_engine * fwd_engines[] = {uint8_t f_quit;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ uint16_t tx_pkt_length =TXONLY_DEF_PACKET_LEN ;/**< TXONLY packet length. */
app/test-pmd/testpmd.h +10 -1
@@ -430,6 +430,13 @@ struct queue_stats_mappings {extern struct rte_fdir_conf fdir_conf;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ #define TXONLY_DEF_PACKET_LEN 64
@@ -836,7 +843,9 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_record_core_cycles (uint8_t on_off);void set_record_burst_stats (uint8_t on_off);void set_verbose_level (uint16_t vb_level); -void set_tx_pkt_segments (unsigned *seg_lengths,unsigned nb_segs); +void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs); +void show_rx_pkt_segments (void ); +void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);void show_tx_pkt_times (void );
doc/guides/testpmd_app_ug/run_app.rst +9 -0
@@ -361,6 +361,15 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxpkts=X[,Y]`` + + Set the length of segments to scatter packets on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + Optionally the multiple memory pools can be specified with --mbuf-size + command line parameter and the mbufs to receive will be allocated + sequentially from these extra memory pools. + * ``--txpkts=X[,Y]`` Set TX segment sizes or total packet length. Valid for ``tx-only``
doc/guides/testpmd_app_ug/testpmd_funcs.rst +20 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxpkts``: Packets to RX split configuration. + * ``txpkts``: Packets to TX configuration. * ``txtimes``: Burst time pattern for Tx only mode.
@@ -774,6 +776,23 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxpkts +~~~~~~~~~~ + +Set the length of segments to scatter packets on receiving if split +feature is engaged. Affects only the queues configured with split offloads +(currently BUFFER_SPLIT is supported only). Optionally the multiple memory +pools can be specified with --mbuf-size command line parameter and the mbufs +to receive will be allocated sequentially from these extra memory pools (the +mbuf for the first segment is allocated from the first pool, the second one +from the second pool, and so on, if segment number is greater then pool's the +mbuf for remaining segments will be allocated from the last valid pool). + + testpmd> set rxpkts (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. Zero value +means to use the corresponding memory pool data buffer size. + set txpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v9 5/6 app/testpmd: add rxoffs commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxoffs=X[,Y]
Sets the offsets of packet segments from the beginning of the receiving buffer if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command, providing the same:
testpmd> set rxoffs (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 44 +++++++++++++++++++++ app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 2 + app/test-pmd/testpmd.h | 4 ++ doc/guides/testpmd_app_ug/run_app.rst | 6 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 17 +++++++- 7 files changed, 145 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" +"show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxoffs (x[,y]*)\n" +" Set the offset of each packet segment on" +" receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set rxpkts (x[,y]*)\n" " Set the length of each segment to scatter" " packets on receiving if split feature is engaged."
@@ -3913,6 +3919,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT OFFSETS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxoffs_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxoffs; +cmdline_fixed_string_t seg_offsets; +}; + +static void +cmd_set_rxoffs_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxoffs_result *res; +unsigned int seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_offsets,"segment offsets" , +MAX_SEGS_BUFFER_SPLIT , seg_offsets,0 ); +if (nb_segs >0 ) +set_rx_pkt_offsets (seg_offsets, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxoffs_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxoffs_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + rxoffs,"rxoffs" ); +cmdline_parse_token_string_t cmd_set_rxoffs_offsets = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + seg_offsets,NULL ); + +cmdline_parse_inst_t cmd_set_rxoffs = { + .f = cmd_set_rxoffs_parsed, + .data =NULL , + .help_str ="set rxoffs <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxoffs_keyword, + (void *)&cmd_set_rxoffs_name, + (void *)&cmd_set_rxoffs_offsets, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ struct cmd_set_rxpkts_result {
@@ -7587,6 +7639,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxoffs")) +show_rx_pkt_offsets (); else if (!strcmp(res->what, "rxpkts"))show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))
@@ -7601,12 +7655,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#rxpkts#txpkts#txtimes" ); +"rxtx#cores#fwd#rxoffs#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19879,6 +19933,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxoffs, (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit,
app/test-pmd/config.c +44 -0
50 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxoffs=X[,Y]*: set RX segment offsets for split.\n" );printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );
@@ -663,6 +664,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxoffs", 1, 0, 0 }, { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 },
@@ -1274,6 +1276,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxoffs" )) { +unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_offs; + + nb_offs =parse_item_list + (optarg,"rxpkt offsets" , +MAX_SEGS_BUFFER_SPLIT , + seg_off,0 ); +if (nb_offs >0 ) +set_rx_pkt_offsets (seg_off, nb_offs); +else +rte_exit (EXIT_FAILURE ,"bad rxoffs\n" ); + }if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) {unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +2 -0
@@ -215,6 +215,8 @@ struct fwd_engine * fwd_engines[] = {*/ uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
app/test-pmd/testpmd.h +4 -0
@@ -435,6 +435,8 @@ struct queue_stats_mappings {*/ extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
@@ -845,6 +847,8 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_verbose_level (uint16_t vb_level);void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_rx_pkt_segments (void ); +void set_rx_pkt_offsets (unsigned int *seg_offsets,unsigned int nb_offs); +void show_rx_pkt_offsets (void );void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);
doc/guides/testpmd_app_ug/run_app.rst +6 -0
@@ -361,6 +361,12 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxoffs=X[,Y]`` + + Set the offsets of packet segments on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + * ``--rxpkts=X[,Y]`` Set the length of segments to scatter packets on receiving if split
doc/guides/testpmd_app_ug/testpmd_funcs.rst +16 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxoffs``: Packet offsets for RX split. + * ``rxpkts``: Packets to RX split configuration. * ``txpkts``: Packets to TX configuration.
@@ -776,6 +778,19 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxoffs +~~~~~~~~~~ + +Set the offsets of segments relating to the data buffer beginning on receiving +if split feature is engaged. Affects only the queues configured with split +offloads (currently BUFFER_SPLIT is supported only). + + testpmd> set rxoffs (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. If the list +of offsets is shorter than the list of segments the zero offsets will be used +for the remaining segments. + set rxpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v9 6/6 app/testpmd: add extended Rx queue setup
In reply to Viacheslav OvsiienkoIf Rx queue is configured with split feature the extended setup with specified segment sizes and pool will be performed.
--- app/test-pmd/cmdline.c | 12 ++++++------ app/test-pmd/testpmd.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- app/test-pmd/testpmd.h | 5 +++++ 3 files changed, 58 insertions(+), 8 deletions(-)
app/test-pmd/cmdline.c +6 -6
@@ -2945,12 +2945,12 @@ struct cmd_setup_rxtx_queue { rxring_numa[res->portid]);return ; } - ret =rte_eth_rx_queue_setup (res->portid, - res->qid, - port->nb_rx_desc[res->qid], - socket_id, - &port->rx_conf[res->qid], - mp); + ret =rx_queue_setup (res->portid, + res->qid, + port->nb_rx_desc[res->qid], + socket_id, + &port->rx_conf[res->qid], + mp);if (ret)printf ("Failed to setup RX queue\n" ); }else {
app/test-pmd/testpmd.c +47 -2
67 lines not on this page · raw message
app/test-pmd/testpmd.h +5 -0
@@ -896,6 +896,11 @@ void port_rss_reta_info(portid_t port_id,void set_vf_traffic (portid_t port_id,uint8_t is_rx,uint16_t vf,uint8_t on); +int +rx_queue_setup (uint16_t port_id,uint16_t rx_queue_id, +uint16_t nb_rx_desc,unsigned int socket_id, +struct rte_eth_rxconf *rx_conf,struct rte_mempool *mp); +int set_queue_rate_limit (portid_t port_id,uint16_t queue_idx,uint16_t rate);int set_vf_rate_limit (portid_t port_id,uint16_t vf,uint16_t rate,uint64_t q_msk);
Signature · 1 line
1.8.3.1
v10 cover ethdev: introduce Rx buffer split
In reply to Slava OvsiienkoThe DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
---
v1: http://patches.dpdk.org/patch/79594/
v2: http://patches.dpdk.org/patch/79893/
- add feature support to mlx5 PMD
v3: http://patches.dpdk.org/patch/80389/
- rte_eth_rx_queue_setup_ex is renamed to rte_eth_rxseg_queue_setup
- DEV_RX_OFFLOAD_BUFFER_SPLIT is renamed to RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT
- commit message update
- documentaion provided
- release notes update
- minor bug fixes in testpmd related part
v4: http://patches.dpdk.org/patch/80401/
- common part of rx_queue_setup/rxseg_queue_setup
v5: http://patches.dpdk.org/patch/80609/
- refactored to approach of providing split configuration in the rte_eth_rxconf structure instead of introducing the new API routine
- added support for rxoffs command to testpmd to provide segment offsets for complete testing of split configurations
- patchset is split into two parts - PMD part will be presented as separate series
v6: http://patches.dpdk.org/patch/80785/
- wordy comments rephrased
- typos fixed
- rte_eth_rx_queue_setup configuration check isolated for two main options
- the rest of comments addressed
v7: http://patches.dpdk.org/patch/80978/
- description as union of feature dedicated segment split description
- the split limitations reported in the rte_eth_dev_info->rx_seg_capa
- comments made less wordy
v8: - bitfield instead of uint8;
- named union to avoid warinings;
- typos fixed
v9: http://patches.dpdk.org/patch/81080/
- simplified rte_eth_rxseg union
- moved out wordy comment from rte_eth_rxconf
- rte_eth_rxseg_capa uint32 bitfield and naming
- added experimental tags
v10: - documentation clenup (removed rxq_info_get mention)
---
Viacheslav Ovsiienko (6):
ethdev: introduce Rx buffer split app/testpmd: add multiple pools per core creation app/testpmd: add buffer split offload configuration app/testpmd: add rxpkts commands and parameters app/testpmd: add rxoffs commands and parameters app/testpmd: add extended Rx queue setup
app/test-pmd/bpf_cmd.c | 4 +- app/test-pmd/cmdline.c | 151 +++++++++++++++++++++++---- app/test-pmd/config.c | 107 ++++++++++++++++++- app/test-pmd/parameters.c | 54 ++++++++-- app/test-pmd/testpmd.c | 121 ++++++++++++++++------ app/test-pmd/testpmd.h | 44 ++++++-- doc/guides/nics/features.rst | 14 +++ doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_20_11.rst | 9 ++ doc/guides/testpmd_app_ug/run_app.rst | 22 +++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 36 ++++++- lib/librte_ethdev/rte_ethdev.c | 153 +++++++++++++++++++++++----- lib/librte_ethdev/rte_ethdev.h | 89 +++++++++++++++- 13 files changed, 706 insertions(+), 103 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v10 1/6 ethdev: introduce Rx buffer split
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
--- doc/guides/nics/features.rst | 14 +++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 ++ lib/librte_ethdev/rte_ethdev.c | 153 +++++++++++++++++++++++++++------ lib/librte_ethdev/rte_ethdev.h | 89 ++++++++++++++++++- 5 files changed, 239 insertions(+), 31 deletions(-)
doc/guides/nics/features.rst +14 -0
@@ -185,6 +185,20 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LRO
doc/guides/rel_notes/deprecation.rst +0 -5
@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``
doc/guides/rel_notes/release_20_11.rst +9 -0
@@ -89,6 +89,12 @@ New Features as flow action. * Added new flow APIs to create/update/destroy/query shared action. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:
@@ -321,6 +327,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functions
lib/librte_ethdev/rte_ethdev.c +128 -25
187 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev.h +88 -1
133 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v10 2/6 app/testpmd: add multiple pools per core creation
In reply to Viacheslav OvsiienkoThe command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with rte_the_dev_rx_queue_setup_ex().
The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
--- app/test-pmd/bpf_cmd.c | 4 +-- app/test-pmd/cmdline.c | 2 +- app/test-pmd/config.c | 6 ++-- app/test-pmd/parameters.c | 24 +++++++++---- app/test-pmd/testpmd.c | 63 +++++++++++++++++++---------------- app/test-pmd/testpmd.h | 24 ++++++++++--- doc/guides/testpmd_app_ug/run_app.rst | 7 ++-- 7 files changed, 83 insertions(+), 47 deletions(-)
app/test-pmd/bpf_cmd.c +2 -2
@@ -69,7 +69,7 @@ struct cmd_bpf_ld_result { *flags =RTE_BPF_ETH_F_NONE ; arg->type =RTE_BPF_ARG_PTR ; - arg->size = mbuf_data_size; + arg->size = mbuf_data_size[0 ];for (i =0 ; str[i] !=0 ; i++) { v =toupper (str[i]);
@@ -78,7 +78,7 @@ struct cmd_bpf_ld_result {else if (v =='M' ) { arg->type =RTE_BPF_ARG_PTR_MBUF ; arg->size =sizeof (struct rte_mbuf ); - arg->buf_size = mbuf_data_size; + arg->buf_size = mbuf_data_size[0 ]; }else if (v =='-' )continue ;else
app/test-pmd/cmdline.c +1 -1
@@ -2925,7 +2925,7 @@ struct cmd_setup_rxtx_queue {if (!numa_support || socket_id ==NUMA_NO_CONFIG ) socket_id = port->socket_id; - mp =mbuf_pool_find (socket_id); + mp =mbuf_pool_find (socket_id,0 );if (mp ==NULL ) {printf ("Failed to setup RX queue: " "No mempool allocation"
app/test-pmd/config.c +3 -3
@@ -690,7 +690,7 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("\nConnect to socket: %u" , port->socket_id);if (port_numa[port_id] !=NUMA_NO_CONFIG ) { - mp =mbuf_pool_find (port_numa[port_id]); + mp =mbuf_pool_find (port_numa[port_id],0 );if (mp)printf ("\nmemory allocation on the socket: %d" , port_numa[port_id]);
@@ -3580,9 +3580,9 @@ struct igb_ring_desc_16_bytes {*/ tx_pkt_len =0 ;for (i =0 ; i < nb_segs; i++) { -if (seg_lengths[i] > (unsigned ) mbuf_data_size) { +if (seg_lengths[i] > mbuf_data_size[0 ]) {printf ("length[%u]=%u > mbuf_data_size=%u - give up\n" , - i, seg_lengths[i], (unsigned ) mbuf_data_size); + i, seg_lengths[i], mbuf_data_size[0 ]);return ; } tx_pkt_len = (uint16_t )(tx_pkt_len + seg_lengths[i]);
app/test-pmd/parameters.c +18 -6
@@ -106,7 +106,9 @@ "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");printf (" --socket-num=N: set socket from which all memory is allocated " "in NUMA mode.\n" ); -printf (" --mbuf-size=N: set the data size of mbuf to N bytes.\n" ); +printf (" --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to " +"N bytes. If multiple numbers are specified the extra pools " +"will be created to receive with packet split features\n" );printf (" --total-num-mbufs=N: set the number of mbufs to be allocated " "in mbuf pools.\n" );printf (" --max-pkt-len=N: set the maximum size of packet to N bytes.\n" );
@@ -892,12 +894,22 @@ } }if (!strcmp (lgopts[opt_idx].name,"mbuf-size" )) { - n =atoi (optarg); -if (n >0 && n <=0xFFFF ) - mbuf_data_size = (uint16_t ) n; -else +unsigned int mb_sz[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs, i; + + nb_segs =parse_item_list (optarg,"mbuf-size" , +MAX_SEGS_BUFFER_SPLIT , mb_sz,0 ); +if (nb_segs <=0 )rte_exit (EXIT_FAILURE , -"mbuf-size should be > 0 and < 65536\n" ); +"bad mbuf-size\n" ); +for (i =0 ; i < nb_segs; i++) { +if (mb_sz[i] <=0 || mb_sz[i] >0xFFFF ) +rte_exit (EXIT_FAILURE , +"mbuf-size should be " +"> 0 and < 65536\n" ); + mbuf_data_size[i] = (uint16_t ) mb_sz[i]; + } + mbuf_data_size_n = nb_segs; }if (!strcmp (lgopts[opt_idx].name,"total-num-mbufs" )) { n =atoi (optarg);
app/test-pmd/testpmd.c +35 -28
145 lines not on this page · raw message
app/test-pmd/testpmd.h +19 -5
@@ -42,6 +42,13 @@*/ #define RTE_MAX_SEGS_PER_PKT 255/**< nb_segs is a 8-bit unsigned char. */ +/* +* The maximum number of segments per packet is used to configure +* buffer split feature, also specifies the maximum amount of +* optional Rx pools to allocate mbufs to split. +*/ +#define MAX_SEGS_BUFFER_SPLIT 8/**< nb_segs is a 8-bit unsigned char. */ +#define MAX_PKT_BURST 512#define DEF_PKT_BURST 32
@@ -403,7 +410,9 @@ struct queue_stats_mappings {extern uint8_t dcb_config;extern uint8_t dcb_test; -extern uint16_t mbuf_data_size;/**< Mbuf data space size. */ +extern uint32_t mbuf_data_size_n; +extern uint16_t mbuf_data_size[MAX_SEGS_BUFFER_SPLIT ]; +/**< Mbuf data space size. */ extern uint32_t param_total_num_mbufs;extern uint16_t stats_period;
@@ -615,17 +624,22 @@ struct mplsoudp_decap_conf {/* Mbuf Pools */ static inline void -mbuf_poolname_build (unsigned int sock_id,char * mp_name,int name_size) +mbuf_poolname_build (unsigned int sock_id,char *mp_name, +int name_size,unsigned int idx) { -snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +if (!idx) +snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +else +snprintf (mp_name, name_size,"mbuf_pool_socket_%u_%u" , + sock_id, idx); }static inline struct rte_mempool * -mbuf_pool_find (unsigned int sock_id) +mbuf_pool_find (unsigned int sock_id,unsigned int idx) {char pool_name[RTE_MEMPOOL_NAMESIZE ]; -mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name)); +mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name), idx);return rte_mempool_lookup ((const char *)pool_name); }
doc/guides/testpmd_app_ug/run_app.rst +5 -2
@@ -107,9 +107,12 @@ The command line options are: Set the socket from which all memory is allocated in NUMA mode, where 0 <= N < number of sockets on the board. -* ``--mbuf-size=N`` +* ``--mbuf-size=N[,N1[,...Nn]`` - Set the data size of the mbufs used to N bytes, where N < 65536. The default value is 2048. + Set the data size of the mbufs used to N bytes, where N < 65536. + The default value is 2048. If multiple mbuf-size values are specified the + extra memory pools will be created for allocating mbufs to receive packets + with buffer splittling features. * ``--total-num-mbufs=N``
Signature · 1 line
1.8.3.1
PATCH v10 3/6 app/testpmd: add buffer split offload configuration
In reply to Viacheslav OvsiienkoThis patch add support for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT providing per queue configuration for this offload.
--- app/test-pmd/cmdline.c | 21 +++++++++++---------- app/test-pmd/config.c | 9 +++++++++ 2 files changed, 20 insertions(+), 10 deletions(-)
app/test-pmd/cmdline.c +11 -10
@@ -883,16 +883,16 @@ static void cmd_help_long_parsed(void *parsed_result,"port config <port_id> rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per port Rx offloading" " on all Rx queues of a port\n\n" "port (port_id) rxq (queue_id) rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per queue Rx offloading" " only on a specific Rx queue\n\n"
@@ -18435,7 +18435,8 @@ struct cmd_config_per_port_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc#rss_hash"); +"scatter#buffer_split#timestamp#security#" + "keep_crc#rss_hash");cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result,
@@ -18515,8 +18516,8 @@ struct cmd_config_per_port_rx_offload_result { .help_str = "port config <port_id> rx_offload vlan_strip|ipv4_cksum|""udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc|rss_hash " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc|rss_hash on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, (void *)&cmd_config_per_port_rx_offload_result_config,
@@ -18565,7 +18566,7 @@ struct cmd_config_per_queue_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc"); + "scatter#buffer_split#timestamp#security#keep_crc");cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result,
@@ -18621,8 +18622,8 @@ struct cmd_config_per_queue_rx_offload_result {"vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, (void *)&cmd_config_per_queue_rx_offload_result_port_id,
app/test-pmd/config.c +9 -0
@@ -1092,6 +1092,15 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("off\n" ); } +if (dev_info.rx_offload_capa &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { +printf ("RX offload buffer split: " ); +if (ports[port_id].dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) +printf ("on\n" ); +else +printf ("off\n" ); + } +if (dev_info.tx_offload_capa &DEV_TX_OFFLOAD_VLAN_INSERT ) {printf ("VLAN insert: " ); if (ports[port_id].dev_conf.txmode.offloads &
Signature · 1 line
1.8.3.1
PATCH v10 4/6 app/testpmd: add rxpkts commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxpkts=X[,Y]
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command:
testpmd> set rxpkts (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only). Optionally the multiple memory pools can be specified with --mbuf-size command line parameter and the mbufs to receive will be allocated sequentially from these extra memory pools.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 48 ++++++++++++++++++++++- app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 7 ++++ app/test-pmd/testpmd.h | 11 +++++- doc/guides/testpmd_app_ug/run_app.rst | 9 +++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 +++++++++- 7 files changed, 165 insertions(+), 7 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|txpkts)\n" +"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxpkts (x[,y]*)\n" +" Set the length of each segment to scatter" +" packets on receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set txpkts (x[,y]*)\n" " Set the length of each segment of TXONLY" " and optionally CSUM packets.\n\n"
@@ -3907,6 +3913,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxpkts_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxpkts; +cmdline_fixed_string_t seg_lengths; +}; + +static void +cmd_set_rxpkts_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxpkts_result *res; +unsigned int seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_lengths,"segment lengths" , +MAX_SEGS_BUFFER_SPLIT , seg_lengths,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_lengths, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxpkts_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxpkts_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + rxpkts,"rxpkts" ); +cmdline_parse_token_string_t cmd_set_rxpkts_lengths = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + seg_lengths,NULL ); + +cmdline_parse_inst_t cmd_set_rxpkts = { + .f = cmd_set_rxpkts_parsed, + .data =NULL , + .help_str ="set rxpkts <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxpkts_keyword, + (void *)&cmd_set_rxpkts_name, + (void *)&cmd_set_rxpkts_lengths, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */ struct cmd_set_txpkts_result {
@@ -7535,6 +7587,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxpkts")) +show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))show_tx_pkt_segments (); else if (!strcmp(res->what, "txtimes"))
@@ -7547,12 +7601,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#txpkts#txtimes" ); +"rxtx#cores#fwd#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19825,6 +19879,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit, (cmdline_parse_inst_t *)&cmd_set_txtimes,
app/test-pmd/config.c +46 -2
62 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );printf (" --txonly-multi-flow: generate multiple flows in txonly mode\n" );
@@ -662,6 +663,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 }, { "disable-link-check", 0, 0, 0 },
@@ -1272,6 +1274,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) { +unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + nb_segs =parse_item_list + (optarg,"rxpkt segments" , +MAX_SEGS_BUFFER_SPLIT , + seg_len,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_len, nb_segs); +else +rte_exit (EXIT_FAILURE ,"bad rxpkts\n" ); + }if (!strcmp (lgopts[opt_idx].name,"txpkts" )) {unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +7 -0
@@ -210,6 +210,13 @@ struct fwd_engine * fwd_engines[] = {uint8_t f_quit;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ uint16_t tx_pkt_length =TXONLY_DEF_PACKET_LEN ;/**< TXONLY packet length. */
app/test-pmd/testpmd.h +10 -1
@@ -430,6 +430,13 @@ struct queue_stats_mappings {extern struct rte_fdir_conf fdir_conf;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ #define TXONLY_DEF_PACKET_LEN 64
@@ -836,7 +843,9 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_record_core_cycles (uint8_t on_off);void set_record_burst_stats (uint8_t on_off);void set_verbose_level (uint16_t vb_level); -void set_tx_pkt_segments (unsigned *seg_lengths,unsigned nb_segs); +void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs); +void show_rx_pkt_segments (void ); +void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);void show_tx_pkt_times (void );
doc/guides/testpmd_app_ug/run_app.rst +9 -0
@@ -361,6 +361,15 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxpkts=X[,Y]`` + + Set the length of segments to scatter packets on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + Optionally the multiple memory pools can be specified with --mbuf-size + command line parameter and the mbufs to receive will be allocated + sequentially from these extra memory pools. + * ``--txpkts=X[,Y]`` Set TX segment sizes or total packet length. Valid for ``tx-only``
doc/guides/testpmd_app_ug/testpmd_funcs.rst +20 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxpkts``: Packets to RX split configuration. + * ``txpkts``: Packets to TX configuration. * ``txtimes``: Burst time pattern for Tx only mode.
@@ -774,6 +776,23 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxpkts +~~~~~~~~~~ + +Set the length of segments to scatter packets on receiving if split +feature is engaged. Affects only the queues configured with split offloads +(currently BUFFER_SPLIT is supported only). Optionally the multiple memory +pools can be specified with --mbuf-size command line parameter and the mbufs +to receive will be allocated sequentially from these extra memory pools (the +mbuf for the first segment is allocated from the first pool, the second one +from the second pool, and so on, if segment number is greater then pool's the +mbuf for remaining segments will be allocated from the last valid pool). + + testpmd> set rxpkts (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. Zero value +means to use the corresponding memory pool data buffer size. + set txpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v10 5/6 app/testpmd: add rxoffs commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxoffs=X[,Y]
Sets the offsets of packet segments from the beginning of the receiving buffer if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command, providing the same:
testpmd> set rxoffs (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 44 +++++++++++++++++++++ app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 2 + app/test-pmd/testpmd.h | 4 ++ doc/guides/testpmd_app_ug/run_app.rst | 6 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 17 +++++++- 7 files changed, 145 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" +"show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxoffs (x[,y]*)\n" +" Set the offset of each packet segment on" +" receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set rxpkts (x[,y]*)\n" " Set the length of each segment to scatter" " packets on receiving if split feature is engaged."
@@ -3913,6 +3919,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT OFFSETS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxoffs_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxoffs; +cmdline_fixed_string_t seg_offsets; +}; + +static void +cmd_set_rxoffs_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxoffs_result *res; +unsigned int seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_offsets,"segment offsets" , +MAX_SEGS_BUFFER_SPLIT , seg_offsets,0 ); +if (nb_segs >0 ) +set_rx_pkt_offsets (seg_offsets, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxoffs_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxoffs_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + rxoffs,"rxoffs" ); +cmdline_parse_token_string_t cmd_set_rxoffs_offsets = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + seg_offsets,NULL ); + +cmdline_parse_inst_t cmd_set_rxoffs = { + .f = cmd_set_rxoffs_parsed, + .data =NULL , + .help_str ="set rxoffs <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxoffs_keyword, + (void *)&cmd_set_rxoffs_name, + (void *)&cmd_set_rxoffs_offsets, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ struct cmd_set_rxpkts_result {
@@ -7587,6 +7639,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxoffs")) +show_rx_pkt_offsets (); else if (!strcmp(res->what, "rxpkts"))show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))
@@ -7601,12 +7655,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#rxpkts#txpkts#txtimes" ); +"rxtx#cores#fwd#rxoffs#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19879,6 +19933,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxoffs, (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit,
app/test-pmd/config.c +44 -0
50 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxoffs=X[,Y]*: set RX segment offsets for split.\n" );printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );
@@ -663,6 +664,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxoffs", 1, 0, 0 }, { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 },
@@ -1274,6 +1276,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxoffs" )) { +unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_offs; + + nb_offs =parse_item_list + (optarg,"rxpkt offsets" , +MAX_SEGS_BUFFER_SPLIT , + seg_off,0 ); +if (nb_offs >0 ) +set_rx_pkt_offsets (seg_off, nb_offs); +else +rte_exit (EXIT_FAILURE ,"bad rxoffs\n" ); + }if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) {unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +2 -0
@@ -215,6 +215,8 @@ struct fwd_engine * fwd_engines[] = {*/ uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
app/test-pmd/testpmd.h +4 -0
@@ -435,6 +435,8 @@ struct queue_stats_mappings {*/ extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
@@ -845,6 +847,8 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_verbose_level (uint16_t vb_level);void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_rx_pkt_segments (void ); +void set_rx_pkt_offsets (unsigned int *seg_offsets,unsigned int nb_offs); +void show_rx_pkt_offsets (void );void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);
doc/guides/testpmd_app_ug/run_app.rst +6 -0
@@ -361,6 +361,12 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxoffs=X[,Y]`` + + Set the offsets of packet segments on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + * ``--rxpkts=X[,Y]`` Set the length of segments to scatter packets on receiving if split
doc/guides/testpmd_app_ug/testpmd_funcs.rst +16 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxoffs``: Packet offsets for RX split. + * ``rxpkts``: Packets to RX split configuration. * ``txpkts``: Packets to TX configuration.
@@ -776,6 +778,19 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxoffs +~~~~~~~~~~ + +Set the offsets of segments relating to the data buffer beginning on receiving +if split feature is engaged. Affects only the queues configured with split +offloads (currently BUFFER_SPLIT is supported only). + + testpmd> set rxoffs (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. If the list +of offsets is shorter than the list of segments the zero offsets will be used +for the remaining segments. + set rxpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v10 6/6 app/testpmd: add extended Rx queue setup
In reply to Viacheslav OvsiienkoIf Rx queue is configured with split feature the extended setup with specified segment sizes and pool will be performed.
--- app/test-pmd/cmdline.c | 12 ++++++------ app/test-pmd/testpmd.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- app/test-pmd/testpmd.h | 5 +++++ 3 files changed, 58 insertions(+), 8 deletions(-)
app/test-pmd/cmdline.c +6 -6
@@ -2945,12 +2945,12 @@ struct cmd_setup_rxtx_queue { rxring_numa[res->portid]);return ; } - ret =rte_eth_rx_queue_setup (res->portid, - res->qid, - port->nb_rx_desc[res->qid], - socket_id, - &port->rx_conf[res->qid], - mp); + ret =rx_queue_setup (res->portid, + res->qid, + port->nb_rx_desc[res->qid], + socket_id, + &port->rx_conf[res->qid], + mp);if (ret)printf ("Failed to setup RX queue\n" ); }else {
app/test-pmd/testpmd.c +47 -2
67 lines not on this page · raw message
app/test-pmd/testpmd.h +5 -0
@@ -896,6 +896,11 @@ void port_rss_reta_info(portid_t port_id,void set_vf_traffic (portid_t port_id,uint8_t is_rx,uint16_t vf,uint8_t on); +int +rx_queue_setup (uint16_t port_id,uint16_t rx_queue_id, +uint16_t nb_rx_desc,unsigned int socket_id, +struct rte_eth_rxconf *rx_conf,struct rte_mempool *mp); +int set_queue_rate_limit (portid_t port_id,uint16_t queue_idx,uint16_t rate);int set_vf_rate_limit (portid_t port_id,uint16_t vf,uint16_t rate,uint64_t q_msk);
Signature · 1 line
1.8.3.1
v11 cover ethdev: introduce Rx buffer split
In reply to Slava OvsiienkoThe DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
---
v1: http://patches.dpdk.org/patch/79594/
v2: http://patches.dpdk.org/patch/79893/
- add feature support to mlx5 PMD
v3: http://patches.dpdk.org/patch/80389/
- rte_eth_rx_queue_setup_ex is renamed to rte_eth_rxseg_queue_setup
- DEV_RX_OFFLOAD_BUFFER_SPLIT is renamed to RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT
- commit message update
- documentaion provided
- release notes update
- minor bug fixes in testpmd related part
v4: http://patches.dpdk.org/patch/80401/
- common part of rx_queue_setup/rxseg_queue_setup
v5: http://patches.dpdk.org/patch/80609/
- refactored to approach of providing split configuration in the rte_eth_rxconf structure instead of introducing the new API routine
- added support for rxoffs command to testpmd to provide segment offsets for complete testing of split configurations
- patchset is split into two parts - PMD part will be presented as separate series
v6: http://patches.dpdk.org/patch/80785/
- wordy comments rephrased
- typos fixed
- rte_eth_rx_queue_setup configuration check isolated for two main options
- the rest of comments addressed
v7: http://patches.dpdk.org/patch/80978/
- description as union of feature dedicated segment split description
- the split limitations reported in the rte_eth_dev_info->rx_seg_capa
- comments made less wordy
v8: - bitfield instead of uint8;
- named union to avoid warinings;
- typos fixed
v9: http://patches.dpdk.org/patch/81080/
- simplified rte_eth_rxseg union
- moved out wordy comment from rte_eth_rxconf
- rte_eth_rxseg_capa uint32 bitfield and naming
- added experimental tags
v10: - missed in mailing list, see v11 for changes
v11: - documentation cleanup (removed rxq_info_get mention)
- max_nseg moved from the recored and converted to uint16_t;
- reserved uint16_t is added to rte_eth_rxseg_capa;
---
Viacheslav Ovsiienko (6):
ethdev: introduce Rx buffer split app/testpmd: add multiple pools per core creation app/testpmd: add buffer split offload configuration app/testpmd: add rxpkts commands and parameters app/testpmd: add rxoffs commands and parameters app/testpmd: add extended Rx queue setup
app/test-pmd/bpf_cmd.c | 4 +- app/test-pmd/cmdline.c | 151 +++++++++++++++++++++++---- app/test-pmd/config.c | 107 ++++++++++++++++++- app/test-pmd/parameters.c | 54 ++++++++-- app/test-pmd/testpmd.c | 121 ++++++++++++++++------ app/test-pmd/testpmd.h | 44 ++++++-- doc/guides/nics/features.rst | 14 +++ doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_20_11.rst | 9 ++ doc/guides/testpmd_app_ug/run_app.rst | 22 +++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 36 ++++++- lib/librte_ethdev/rte_ethdev.c | 153 +++++++++++++++++++++++----- lib/librte_ethdev/rte_ethdev.h | 90 +++++++++++++++- 13 files changed, 707 insertions(+), 103 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v11 1/6 ethdev: introduce Rx buffer split
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
--- doc/guides/nics/features.rst | 14 +++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 ++ lib/librte_ethdev/rte_ethdev.c | 153 +++++++++++++++++++++++++++------ lib/librte_ethdev/rte_ethdev.h | 90 ++++++++++++++++++- 5 files changed, 240 insertions(+), 31 deletions(-)
doc/guides/nics/features.rst +14 -0
@@ -185,6 +185,20 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LRO
doc/guides/rel_notes/deprecation.rst +0 -5
@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``
doc/guides/rel_notes/release_20_11.rst +9 -0
@@ -89,6 +89,12 @@ New Features as flow action. * Added new flow APIs to create/update/destroy/query shared action. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:
@@ -321,6 +327,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functions
lib/librte_ethdev/rte_ethdev.c +128 -25
187 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev.h +89 -1
134 lines not on this page · raw message
Signature · 1 line
1.8.3.1
16/10/2020 15:39, Viacheslav Ovsiienko:
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1862
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c +7
-0+if (offset !=0 ) { +if (seg_capa->offset_allowed ==0 ) { +RTE_ETHDEV_LOG (ERR ,"Rx segmentation with offset is not supported\n" ); +return -ENOTSUP ; + } +if (offset & offset_mask) { + RTE_ETHDEV_LOG(ERR, "Rx segmentat invalid offset alignment %u, %u\n",
small typo: segmentat -> segmentation
[...]
Quoted 7 lines
/**
+ * A structure used to configure an Rx packet segment to split.
+ *
+ * IfRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag is set in offloads field,
+ * the PMD will split the received packets into multiple segments
+ * according to the specification in the description array:
+ *
Minor detail: below bullets should start with a capital letter.
Quoted 7 lines
+ * - the first network buffer will be allocated from the memory pool,
+ * specified in the first array element, the second buffer, from the
+ * pool in the second element, and so on.
+ *
+ * - the offsets from the segment description elements specify
+ * the data offset from the buffer beginning except the first mbuf.
+ * For this one the offset is added withRTE_PKTMBUF_HEADROOM.
"this one" -> "the first segment, "
Quoted 15 lines
+ *
+ * - the lengths in the elements define the maximal data amount+ * being received to each segment. The receiving starts with filling + * up the first mbuf data buffer up to specified length. If the + * there are data remaining (packet is longer than buffer in the first + * mbuf) the following data will be pushed to the next segment + * up to its own length, and so on.+ *
+ * - If the length in the segment description element is zero
+ * the actual buffer size will be deduced from the appropriate
+ * memory pool properties.
+ *
+ * - if there is not enough elements to describe the buffer for entire
+ * packet of maximal length the following parameters will be used
+ * for the all remaining segments:
Quoted 4 lines
+ * - pool from the last valid element + * - the buffer size from this pool + * - zero offset+ */
I think the description is precise enough, thanks.
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +7
-0+__rte_experimental +struct rte_eth_rxseg_split { +struct rte_mempool *mp;/**< Memory pool to allocate segment from. */ +uint16_t length;/**< Segment data length, configures split point. */ +uint16_t offset;/**< Data offset from beginning of mbuf data buffer. */ +uint32_t reserved;/**< Reserved field. */ +};
lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 1021
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+ +/** +* A common structure used to describe Rx packet segment properties. +*/ +__rte_experimental +union rte_eth_rxseg { +/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split; +/* The other features settings should be added here. */ +};
OK for having an union.
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +3
-0+ +/** * A structure used to configure an RX ring of an Ethernet port. */ struct rte_eth_rxconf {@@ -977,12 +1028,22 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */ uint8_t rx_deferred_start;/**< Do not start queue with rte_eth_dev_start(). */ +uint16_t rx_nseg;/**< Number of descriptions in rx_seg array. */
lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1041
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +4
-0/** * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. * Only offloads set on rx_queue_offload_capa or rx_offload_capa * fields on rte_eth_dev_info structure are allowed to be set. */ uint64_t offloads; +/** +* Points to the array of segment descriptions. Each array element +* describes the properties for each segment in the receiving +* buffer according to feature descripting structure.
Alternative (shorter) wording:
Points to the array of segment descriptions for an entire packet. Array elements are properties for consecutive Rx segments.
lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1044
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +3
-0+* +* The supported capabilities of receiving segmentation is reported +* in rte_eth_dev_info ->rx_seg_capa field.
Rx segmentation capabilities are reported in rte_eth_dev_info.rx_seg_capa.
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+*/ +union rte_eth_rxseg *rx_seg;
[...]
Quoted 11 lines
+ * The configuration structure also contains the pointer to the array + * of the receiving buffer segment descriptions, see rx_seg and rx_nseg + * fields, this extended configuration might be used by split offloads like + * RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT. If mp_pool is not NULL, + * the extended configuration fields must be set to NULL and zero. * @param mb_pool * The pointer to the memory pool from which to allocate *rte_mbuf* network - * memory buffers to populate each descriptor of the receive ring. + * memory buffers to populate each descriptor of the receive ring. There are + * two options to provide Rx buffer configuration: + * - single pool:
Quoted 4 lines
+ *
mb_poolis not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is 0.
+ * - multiple segments description:
+ *mb_poolis NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not 0.
+ * Taken only if flagRTE_ETH_RX_OFFLOAD_BUFFER_SPLITis set in offloads.
As said previously, I feel rx_conf.rx_seg does not need to be part of the requirements, as long as rx_conf.rx_nseg is defined.
All my comments are optional, this version is already very good.
Quoted 141 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, October 16, 2020 18:14
To: Slava Ovsiienko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v11 1/6] ethdev: introduce Rx buffer split16/10/2020 15:39, Viacheslav Ovsiienko:
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev *
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +3
-0+if (offset !=0 ) { +if (seg_capa->offset_allowed ==0 ) { + RTE_ETHDEV_LOG(ERR, "Rx segmentationwith offset is not supported\n");
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev *
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +4
-0+return -ENOTSUP ; + } +if (offset & offset_mask) { + RTE_ETHDEV_LOG(ERR, "Rx segmentat invalidoffset alignment %u,
Quoted 1 line
+%u\n",
small typo: segmentat -> segmentation
[...]
Quoted 7 lines
/**
+ * A structure used to configure an Rx packet segment to split.
+ *
+ * IfRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag is set in offloads field,
+ * the PMD will split the received packets into multiple segments
+ * according to the specification in the description array:
+ *Minor detail: below bullets should start with a capital letter.
Quoted 7 lines
+ * - the first network buffer will be allocated from the memory pool,
+ * specified in the first array element, the second buffer, from the
+ * pool in the second element, and so on.
+ *
+ * - the offsets from the segment description elements specify
+ * the data offset from the buffer beginning except the first mbuf.
+ * For this one the offset is added withRTE_PKTMBUF_HEADROOM."this one" -> "the first segment, "
Quoted 15 lines
+ *
+ * - the lengths in the elements define the maximal data amount+ * being received to each segment. The receiving starts with filling + * up the first mbuf data buffer up to specified length. If the + * there are data remaining (packet is longer than buffer in the first + * mbuf) the following data will be pushed to the next segment + * up to its own length, and so on.+ *
+ * - If the length in the segment description element is zero
+ * the actual buffer size will be deduced from the appropriate
+ * memory pool properties.
+ *
+ * - if there is not enough elements to describe the buffer for entire
+ * packet of maximal length the following parameters will be used
+ * for the all remaining segments:Quoted 4 lines
+ * - pool from the last valid element + * - the buffer size from this pool + * - zero offset+ */
I think the description is precise enough, thanks.
lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode {
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +3
-0+__rte_experimental +struct rte_eth_rxseg_split { +struct rte_mempool *mp;/**< Memory pool to allocate segment from. */
Review
Quoted 2 lines
(quoted diff) +2
-0+ uint16_t length; /**< Segment data length, configures split point. */ + uint16_t offset; /**< Data offset from beginning of mbuf data buffer.*/
lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode {
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+uint32_t reserved;/**< Reserved field. */ }; + +/** +* A common structure used to describe Rx packet segment properties. +*/ +__rte_experimental +union rte_eth_rxseg { +/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split; +/* The other features settings should be added here. */ };OK for having an union.
lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1029
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+ +/** * A structure used to configure an RX ring of an Ethernet port. */ struct rte_eth_rxconf {@@ -977,12 +1028,22 @@ struct rte_eth_rxconf {uint16_t rx_free_thresh;/**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en;/**< Drop packets if no descriptors are available. */
lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1041
Quoted 13 lines
(quoted diff) +0
-0uint8_t rx_deferred_start; /**< Do not start queue with
rte_eth_dev_start(). */lib/librte_ethdev/rte_ethdev.h +5
-0+uint16_t rx_nseg;/**< Number of descriptions in rx_seg array. */ /** * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. * Only offloads set on rx_queue_offload_capa or rx_offload_capa * fields on rte_eth_dev_info structure are allowed to be set. */ uint64_t offloads; +/** +* Points to the array of segment descriptions. Each array element +* describes the properties for each segment in the receiving +* buffer according to feature descripting structure. Alternative (shorter) wording:
Points to the array of segment descriptions for an entire packet. Array elements are properties for consecutive Rx segments.lib/librte_ethdev/rte_ethdev.h struct rte_eth_rxconf { · line 1044
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +3
-0+* +* The supported capabilities of receiving segmentation is reported +* in rte_eth_dev_info ->rx_seg_capa field. Rx segmentation capabilities are reported in rte_eth_dev_info.rx_seg_capa.
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2
-0+*/ +union rte_eth_rxseg *rx_seg;[...]
Quoted 7 lines
+ * The configuration structure also contains the pointer to the array + * of the receiving buffer segment descriptions, see rx_seg and rx_nseg + * fields, this extended configuration might be used by split offloads like + * RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT. If mp_pool is not NULL, + * the extended configuration fields must be set to NULL and zero.* @param
mb_pool
* The pointer to the memory pool from which to allocate *rte_mbuf*network
Quoted 2 lines
- * memory buffers to populate each descriptor of the receive ring.
+ * memory buffers to populate each descriptor of the receive ring. Thereare
Quoted 6 lines
+ * two options to provide Rx buffer configuration:
+ * - single pool:
+ *mb_poolis not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is 0.
+ * - multiple segments description:
+ *mb_poolis NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not 0.
+ * Taken only if flagRTE_ETH_RX_OFFLOAD_BUFFER_SPLITis set in
Quoted 7 lines
offloads.
As said previously, I feel rx_conf.rx_seg does not need to be part of the requirements, as long as rx_conf.rx_nseg is defined.
All my comments are optional, this version is already very good.
Acked-by Thomas Monjalon <[email protected]>
All comments are adopted (in coming v12), thank you.
With best regards, Slava
Quoted 101 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.The following structure is introduced to specify the Rx packet segment for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLIToffload:struct
rte_eth_rxseg_split{struct
rte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length,
configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf.
This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2 seg1 - pool1, len1=20B, off1=128B seg2 - pool2, len2=20B, off2=0B seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The split limitations imposed by underlying PMD is reported in the new introduced
rte_eth_dev_info->rx_seg_capafield.The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Jerin Jacob <[email protected]>Reviewed-by Andrew Rybchenko <[email protected]>
<...>
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +7
-0+__rte_experimental +struct rte_eth_rxseg_split { +struct rte_mempool *mp;/**< Memory pool to allocate segment from. */ +uint16_t length;/**< Segment data length, configures split point. */ +uint16_t offset;/**< Data offset from beginning of mbuf data buffer. */ +uint32_t reserved;/**< Reserved field. */ +};
lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 1021
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+ +/** +* A common structure used to describe Rx packet segment properties. +*/ +__rte_experimental +union rte_eth_rxseg { +/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split; +/* The other features settings should be added here. */ +};
Is the '__rte_experimental' on the data structs do anything other than documentation?
icc is complaining about them [1], if they are only for documenation, would it be OK to move it to the comment and remove the '__rte_experimental' tag?
[1]
../lib/librte_ethdev/rte_ethdev.h(1005): error #2651: attribute does not apply to any entity
__rte_experimental
^
16/10/2020 17:47, Ferruh Yigit:
Quoted 22 lines · Viacheslav Ovsiienko
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +7
-0+__rte_experimental +struct rte_eth_rxseg_split { +struct rte_mempool *mp;/**< Memory pool to allocate segment from. */ +uint16_t length;/**< Segment data length, configures split point. */ +uint16_t offset;/**< Data offset from beginning of mbuf data buffer. */ +uint32_t reserved;/**< Reserved field. */ +};lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 1021
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+ +/** +* A common structure used to describe Rx packet segment properties. +*/ +__rte_experimental +union rte_eth_rxseg { +/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split; +/* The other features settings should be added here. */ +};Is the '
__rte_experimental' on the data structs do anything other than documentation?
Quoted 8 lines
icc is complaining about them [1], if they are only for documenation, would it be OK to move it to the comment and remove the '
__rte_experimental' tag?[1]
../lib/librte_ethdev/rte_ethdev.h(1005): error #2651: attribute does not apply to any entity
__rte_experimental
^
Yes should be a comment.
Quoted 26 lines · Thomas Monjalon
16/10/2020 17:47, Ferruh Yigit:
Quoted 25 lines · Viacheslav Ovsiienko
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +7
-0+__rte_experimental +struct rte_eth_rxseg_split { +struct rte_mempool *mp;/**< Memory pool to allocate segment from. */ +uint16_t length;/**< Segment data length, configures split point. */ +uint16_t offset;/**< Data offset from beginning of mbuf data buffer. */ +uint32_t reserved;/**< Reserved field. */ +};lib/librte_ethdev/rte_ethdev.h struct rte_eth_txmode { · line 1021
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+ +/** +* A common structure used to describe Rx packet segment properties. +*/ +__rte_experimental +union rte_eth_rxseg { +/* The settings for buffer split offload. */ +struct rte_eth_rxseg_split split; +/* The other features settings should be added here. */ +};Is the '
__rte_experimental' on the data structs do anything other than documentation?icc is complaining about them [1], if they are only for documenation, would it be OK to move it to the comment and remove the '
__rte_experimental' tag?
Quoted 8 lines
Quoted 5 lines
[1]
../lib/librte_ethdev/rte_ethdev.h(1005): error #2651: attribute does not apply to any entity
__rte_experimental
^Yes should be a comment.
Following is a sample from rte_flow.h as comment:
https://git.dpdk.org/dpdk/tree/lib/librte_ethdev/rte_flow.h?h=v20.08#n1392
PATCH v11 2/6 app/testpmd: add multiple pools per core creation
In reply to Viacheslav OvsiienkoThe command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with rte_the_dev_rx_queue_setup_ex().
The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
--- app/test-pmd/bpf_cmd.c | 4 +-- app/test-pmd/cmdline.c | 2 +- app/test-pmd/config.c | 6 ++-- app/test-pmd/parameters.c | 24 +++++++++---- app/test-pmd/testpmd.c | 63 +++++++++++++++++++---------------- app/test-pmd/testpmd.h | 24 ++++++++++--- doc/guides/testpmd_app_ug/run_app.rst | 7 ++-- 7 files changed, 83 insertions(+), 47 deletions(-)
app/test-pmd/bpf_cmd.c +2 -2
@@ -69,7 +69,7 @@ struct cmd_bpf_ld_result { *flags =RTE_BPF_ETH_F_NONE ; arg->type =RTE_BPF_ARG_PTR ; - arg->size = mbuf_data_size; + arg->size = mbuf_data_size[0 ];for (i =0 ; str[i] !=0 ; i++) { v =toupper (str[i]);
@@ -78,7 +78,7 @@ struct cmd_bpf_ld_result {else if (v =='M' ) { arg->type =RTE_BPF_ARG_PTR_MBUF ; arg->size =sizeof (struct rte_mbuf ); - arg->buf_size = mbuf_data_size; + arg->buf_size = mbuf_data_size[0 ]; }else if (v =='-' )continue ;else
app/test-pmd/cmdline.c +1 -1
@@ -2925,7 +2925,7 @@ struct cmd_setup_rxtx_queue {if (!numa_support || socket_id ==NUMA_NO_CONFIG ) socket_id = port->socket_id; - mp =mbuf_pool_find (socket_id); + mp =mbuf_pool_find (socket_id,0 );if (mp ==NULL ) {printf ("Failed to setup RX queue: " "No mempool allocation"
app/test-pmd/config.c +3 -3
@@ -690,7 +690,7 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("\nConnect to socket: %u" , port->socket_id);if (port_numa[port_id] !=NUMA_NO_CONFIG ) { - mp =mbuf_pool_find (port_numa[port_id]); + mp =mbuf_pool_find (port_numa[port_id],0 );if (mp)printf ("\nmemory allocation on the socket: %d" , port_numa[port_id]);
@@ -3580,9 +3580,9 @@ struct igb_ring_desc_16_bytes {*/ tx_pkt_len =0 ;for (i =0 ; i < nb_segs; i++) { -if (seg_lengths[i] > (unsigned ) mbuf_data_size) { +if (seg_lengths[i] > mbuf_data_size[0 ]) {printf ("length[%u]=%u > mbuf_data_size=%u - give up\n" , - i, seg_lengths[i], (unsigned ) mbuf_data_size); + i, seg_lengths[i], mbuf_data_size[0 ]);return ; } tx_pkt_len = (uint16_t )(tx_pkt_len + seg_lengths[i]);
app/test-pmd/parameters.c +18 -6
@@ -106,7 +106,9 @@ "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");printf (" --socket-num=N: set socket from which all memory is allocated " "in NUMA mode.\n" ); -printf (" --mbuf-size=N: set the data size of mbuf to N bytes.\n" ); +printf (" --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to " +"N bytes. If multiple numbers are specified the extra pools " +"will be created to receive with packet split features\n" );printf (" --total-num-mbufs=N: set the number of mbufs to be allocated " "in mbuf pools.\n" );printf (" --max-pkt-len=N: set the maximum size of packet to N bytes.\n" );
@@ -892,12 +894,22 @@ } }if (!strcmp (lgopts[opt_idx].name,"mbuf-size" )) { - n =atoi (optarg); -if (n >0 && n <=0xFFFF ) - mbuf_data_size = (uint16_t ) n; -else +unsigned int mb_sz[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs, i; + + nb_segs =parse_item_list (optarg,"mbuf-size" , +MAX_SEGS_BUFFER_SPLIT , mb_sz,0 ); +if (nb_segs <=0 )rte_exit (EXIT_FAILURE , -"mbuf-size should be > 0 and < 65536\n" ); +"bad mbuf-size\n" ); +for (i =0 ; i < nb_segs; i++) { +if (mb_sz[i] <=0 || mb_sz[i] >0xFFFF ) +rte_exit (EXIT_FAILURE , +"mbuf-size should be " +"> 0 and < 65536\n" ); + mbuf_data_size[i] = (uint16_t ) mb_sz[i]; + } + mbuf_data_size_n = nb_segs; }if (!strcmp (lgopts[opt_idx].name,"total-num-mbufs" )) { n =atoi (optarg);
app/test-pmd/testpmd.c +35 -28
145 lines not on this page · raw message
app/test-pmd/testpmd.h +19 -5
@@ -42,6 +42,13 @@*/ #define RTE_MAX_SEGS_PER_PKT 255/**< nb_segs is a 8-bit unsigned char. */ +/* +* The maximum number of segments per packet is used to configure +* buffer split feature, also specifies the maximum amount of +* optional Rx pools to allocate mbufs to split. +*/ +#define MAX_SEGS_BUFFER_SPLIT 8/**< nb_segs is a 8-bit unsigned char. */ +#define MAX_PKT_BURST 512#define DEF_PKT_BURST 32
@@ -403,7 +410,9 @@ struct queue_stats_mappings {extern uint8_t dcb_config;extern uint8_t dcb_test; -extern uint16_t mbuf_data_size;/**< Mbuf data space size. */ +extern uint32_t mbuf_data_size_n; +extern uint16_t mbuf_data_size[MAX_SEGS_BUFFER_SPLIT ]; +/**< Mbuf data space size. */ extern uint32_t param_total_num_mbufs;extern uint16_t stats_period;
@@ -615,17 +624,22 @@ struct mplsoudp_decap_conf {/* Mbuf Pools */ static inline void -mbuf_poolname_build (unsigned int sock_id,char * mp_name,int name_size) +mbuf_poolname_build (unsigned int sock_id,char *mp_name, +int name_size,unsigned int idx) { -snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +if (!idx) +snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +else +snprintf (mp_name, name_size,"mbuf_pool_socket_%u_%u" , + sock_id, idx); }static inline struct rte_mempool * -mbuf_pool_find (unsigned int sock_id) +mbuf_pool_find (unsigned int sock_id,unsigned int idx) {char pool_name[RTE_MEMPOOL_NAMESIZE ]; -mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name)); +mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name), idx);return rte_mempool_lookup ((const char *)pool_name); }
doc/guides/testpmd_app_ug/run_app.rst +5 -2
@@ -107,9 +107,12 @@ The command line options are: Set the socket from which all memory is allocated in NUMA mode, where 0 <= N < number of sockets on the board. -* ``--mbuf-size=N`` +* ``--mbuf-size=N[,N1[,...Nn]`` - Set the data size of the mbufs used to N bytes, where N < 65536. The default value is 2048. + Set the data size of the mbufs used to N bytes, where N < 65536. + The default value is 2048. If multiple mbuf-size values are specified the + extra memory pools will be created for allocating mbufs to receive packets + with buffer splittling features. * ``--total-num-mbufs=N``
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creation
Quoted 16 lines · Viacheslav Ovsiienko
The command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with
rte_the_dev_rx_queue_setup_ex().The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
Signed-off-by Viacheslav Ovsiienko <[email protected]>
<...>
app/test-pmd/testpmd.h struct mplsoudp_decap_conf { · line 634
Quoted 12 lines
/* Mbuf Pools */
static inline voidapp/test-pmd/testpmd.h +7
-2-mbuf_poolname_build(unsigned int sock_id, char* mp_name, int name_size) +mbuf_poolname_build(unsigned int sock_id, char *mp_name, + int name_size, unsigned int idx) { - snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id); + if (!idx) + snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id); + else + snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u", + sock_id, idx);
'mp_name' can theoretically overflow and gives a compiler warning, although not sure if this truncation is a problem in practice.
../app/test-pmd/testpmd.c: In function ‘rx_queue_setup’:../app/test-pmd/testpmd.h:666:53: error: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
666 | snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u",
| ^~../app/test-pmd/testpmd.h:666:32: note: directive argument in the range [1, 4294967295]
666 | snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u",
| ^~~~~~~~~~~~~~~~~~~~~~~~
../app/test-pmd/testpmd.h:666:3: note: ‘snprintf’ output between 21 and 39 bytes into a destination of size 26
666 | snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
667 | sock_id, idx);
| ~~~~~~~~~~~~~Any suggestion for fix? Can we shorten the string above, is it used somewhere else? Or casting variables to a smaller size may work too..
Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creation
Quoted 48 lines · Ferruh Yigit
Quoted 16 lines · Viacheslav Ovsiienko
The command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with
rte_the_dev_rx_queue_setup_ex().The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
Signed-off-by Viacheslav Ovsiienko <[email protected]><...>
Quoted 5 lines
/* Mbuf Pools */
static inline voidapp/test-pmd/testpmd.h +2
-1-mbuf_poolname_build(unsigned int sock_id, char* mp_name, int name_size) +mbuf_poolname_build(unsigned int sock_id, char *mp_name, + int name_size, unsigned int idx)Quoted 7 lines
{
-snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id); + if (!idx)
+snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id); + else
+snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u", + sock_id, idx);'
mp_name' can theoretically overflow and gives a compiler warning, although not sure if this truncation is a problem in practice.
../app/test-pmd/testpmd.c: In function ‘rx_queue_setup’:../app/test-pmd/testpmd.h:666:53: error: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u",
| ^~../app/test-pmd/testpmd.h:666:32: note: directive argument in the range [1, 4294967295]
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u",
| ^~~~~~~~~~~~~~~~~~~~~~~~../app/test-pmd/testpmd.h:666:3: note: ‘snprintf’ output between 21 and 39 bytes into a destination of size 26
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
667 |sock_id, idx);
| ~~~~~~~~~~~~~
Quoted 1 line
Any suggestion for fix? Can we shorten the string above, is it used somewhere else? Or casting variables to a smaller size may work too..
What do you think to following:
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 4cd0f967f0..4ac1c1f86e 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -661,10 +661,11 @@ mbuf_poolname_build(unsigned int sock_id, char *mp_name,
int name_size, unsigned int idx)
{
if (!idx) - snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id);
+ snprintf(mp_name, name_size, "mbuf_pool_s%u",
+ (uint16_t)sock_id);
else
- snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u",
- sock_id, idx);
+ snprintf(mp_name, name_size, "mbuf_pool_s%u_%u",
+ (uint16_t)sock_id, (uint16_t)idx);
}
static inline struct rte_mempool *
Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creation
Quoted 91 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 16, 2020 18:39
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creationQuoted 55 lines · Ferruh Yigit
Quoted 16 lines · Viacheslav Ovsiienko
The command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with
rte_the_dev_rx_queue_setup_ex().The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
Signed-off-by Viacheslav Ovsiienko <[email protected]><...>
Quoted 6 lines
/* Mbuf Pools */
static inline void
-mbuf_poolname_build(unsigned intsock_id, char*mp_name, intname_size)
+mbuf_poolname_build(unsigned intsock_id, char*mp_name, + intname_size, unsigned int idx)Quoted 8 lines
{
-snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id); + if (!idx)
+snprintf(mp_name, name_size, "mbuf_pool_socket_%u", +sock_id);
+ else
+snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u", + sock_id, idx);'
mp_name' can theoretically overflow and gives a compiler warning, although not sure if this truncation is a problem in practice.
../app/test-pmd/testpmd.c: In function ‘rx_queue_setup’:../app/test-pmd/testpmd.h:666:53: error: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~../app/test-pmd/testpmd.h:666:32: note: directive argument in the range [1, 4294967295]
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~~~~~~~~~~~~~~~~~~~~~~~../app/test-pmd/testpmd.h:666:3: note: ‘snprintf’ output between 21 and 39 bytes into a destination of size 26
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 667 |sock_id, idx);
| ~~~~~~~~~~~~~Quoted 2 lines
Any suggestion for fix? Can we shorten the string above, is it used somewhere else? Or casting variables to a smaller size may work too..
What do you think to following:
diff --git
a/app/test-pmd/testpmd.hb/app/test-pmd/testpmd.hindex4cd0f967f0..4ac1c1f86e100644
---a/app/test-pmd/testpmd.h
+++b/app/test-pmd/testpmd.h
@@ -661,10 +661,11 @@ mbuf_poolname_build(unsigned intsock_id, char*mp_name,
intname_size, unsigned int idx){ if (!idx)-
snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id);
+ snprintf(mp_name,name_size, "mbuf_pool_s%u",
+ (uint16_t)sock_id);
else
- snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u",
-sock_id, idx);
+ snprintf(mp_name,name_size, "mbuf_pool_s%u_%u",
+ (uint16_t)sock_id, (uint16_t)idx);
}
Quoted 1 line
static inline struct
rte_mempool*
Testpmd build mbuf pool names with mbuf_poolname_build() routine only (invoked from mbuf_pool_find/mbuf_pool_create). I suppose it is safe to replace "mbuf_pool_socket_" prefix with shorter one.
Say something like this: #define TESTPMD_MBUF_POOL_PFX "mbuf"
Truncating idx to uint16_t is OK, let me update the types of routines. sock_id seems to be OK either. If you agree on both - please, let me update the patch.
With best regards, Slava
Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creation
Quoted 91 lines · Slava Ovsiienko
Quoted 91 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 16, 2020 18:39
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creationQuoted 55 lines · Ferruh Yigit
Quoted 16 lines · Viacheslav Ovsiienko
The command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with
rte_the_dev_rx_queue_setup_ex().The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
Signed-off-by Viacheslav Ovsiienko <[email protected]><...>
Quoted 4 lines
/* Mbuf Pools */
static inline void
-mbuf_poolname_build(unsigned intsock_id, char*mp_name, intname_size)app/test-pmd/testpmd.h struct mplsoudp_decap_conf { · line 634
Quoted 10 lines
app/test-pmd/testpmd.h +8
-1+mbuf_poolname_build(unsigned int sock_id, char *mp_name, + int name_size, unsigned int idx) { - snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id); + if (!idx) + snprintf(mp_name, name_size, "mbuf_pool_socket_%u", +sock_id); + else + snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u", + sock_id, idx);'
mp_name' can theoretically overflow and gives a compiler warning, although not sure if this truncation is a problem in practice.
../app/test-pmd/testpmd.c: In function ‘rx_queue_setup’:../app/test-pmd/testpmd.h:666:53: error: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~../app/test-pmd/testpmd.h:666:32: note: directive argument in the range [1, 4294967295]
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~~~~~~~~~~~~~~~~~~~~~~~../app/test-pmd/testpmd.h:666:3: note: ‘snprintf’ output between 21 and 39 bytes into a destination of size 26
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 667 |sock_id, idx);
| ~~~~~~~~~~~~~Quoted 2 lines
Any suggestion for fix? Can we shorten the string above, is it used somewhere else? Or casting variables to a smaller size may work too..
What do you think to following:
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 4cd0f967f0..4ac1c1f86e 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -661,10 +661,11 @@ mbuf_poolname_build(unsigned int sock_id, char *mp_name, int name_size, unsigned int idx) { if (!idx) - snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id); + snprintf(mp_name, name_size, "mbuf_pool_s%u", + (uint16_t)sock_id); else - snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u", - sock_id, idx); + snprintf(mp_name, name_size, "mbuf_pool_s%u_%u", + (uint16_t)sock_id, (uint16_t)idx); }
Quoted 8 lines
Quoted 1 line
static inline struct
rte_mempool*Testpmd build mbuf pool names with
mbuf_poolname_build()routine only (invoked from mbuf_pool_find/mbuf_pool_create). I suppose it is safe to replace "mbuf_pool_socket_" prefix with shorter one.Say something like this: #define
TESTPMD_MBUF_POOL_PFX"mbuf"
Just 'mbuf' may not give enough context in the logs, what about "mbuf_pool_%u_%u"?
Quoted 3 lines
Truncating idx to
uint16_tis OK, let me update the types of routines.sock_idseems to be OK either. If you agree on both - please, let me update the patch.
If variables are not truncated, it leaves very small place for prefix, 3 chars if I calculate correctly, so it seems we need to truncate it anyway.
Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creation
Quoted 111 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 16, 2020 18:52
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creationQuoted 73 lines · Slava Ovsiienko
Quoted 73 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 16, 2020 18:39
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creationQuoted 56 lines · Ferruh Yigit
Quoted 16 lines · Viacheslav Ovsiienko
The command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with
rte_the_dev_rx_queue_setup_ex().The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
Signed-off-by Viacheslav Ovsiienko <[email protected]><...>
Quoted 4 lines
/* Mbuf Pools */
static inline void
-mbuf_poolname_build(unsigned intsock_id, char*mp_name, intname_size)app/test-pmd/testpmd.h struct mplsoudp_decap_conf { · line 634
Quoted 10 lines
app/test-pmd/testpmd.h +8
-1+mbuf_poolname_build(unsigned int sock_id, char *mp_name, + int name_size, unsigned int idx) { - snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id); + if (!idx) + snprintf(mp_name, name_size, "mbuf_pool_socket_%u", +sock_id); + else + snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u", + sock_id, idx);'
mp_name' can theoretically overflow and gives a compiler warning, although not sure if this truncation is a problem in practice.
../app/test-pmd/testpmd.c: In function ‘rx_queue_setup’:../app/test-pmd/testpmd.h:666:53: error: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size between
0 and 7 [-Werror=format-truncation=]
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~../app/test-pmd/testpmd.h:666:32: note: directive argument in the range [1, 4294967295]
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~~~~~~~~~~~~~~~~~~~~~~~../app/test-pmd/testpmd.h:666:3: note: ‘snprintf’ output between 21 and 39 bytes into a destination of size 26
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 667 |sock_id, idx);
| ~~~~~~~~~~~~~Quoted 2 lines
Any suggestion for fix? Can we shorten the string above, is it used somewhere else? Or casting variables to a smaller size may work too..
What do you think to following:
Quoted 10 lines
Quoted 10 lines
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 4cd0f967f0..4ac1c1f86e 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -661,10 +661,11 @@ mbuf_poolname_build(unsigned int sock_id, char *mp_name, int name_size, unsigned int idx) { if (!idx)- snprintf(mp_name,
name_size, "mbuf_pool_socket_%u",
sock_id);Quoted 15 lines
Quoted 10 lines
+ snprintf(mp_name,
name_size, "mbuf_pool_s%u",
+ (uint16_t)sock_id);
else
- snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u",
-sock_id, idx);
+ snprintf(mp_name,name_size, "mbuf_pool_s%u_%u",
+ (uint16_t)sock_id, (uint16_t)idx);
}static inline struct
rte_mempool*Testpmd build mbuf pool names with
mbuf_poolname_build()routine only (invoked from mbuf_pool_find/mbuf_pool_create). I suppose it is safe to replace "mbuf_pool_socket_" prefix with shorter one.
Quoted 5 lines
Quoted 2 lines
Say something like this: #define
TESTPMD_MBUF_POOL_PFX"mbuf"Just 'mbuf' may not give enough context in the logs, what about "mbuf_pool_%u_%u"?
It is place in the pool structure, so it is an object name and tightly coupled with the pool. OK, let's try "mb_pool" ?
Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creation
Quoted 111 lines · Slava Ovsiienko
Quoted 111 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 16, 2020 18:52
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creationQuoted 73 lines · Slava Ovsiienko
Quoted 73 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 16, 2020 18:39
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v11 2/6] app/testpmd: add multiple pools per core creationQuoted 53 lines · Ferruh Yigit
Quoted 16 lines · Viacheslav Ovsiienko
The command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with
rte_the_dev_rx_queue_setup_ex().The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
Signed-off-by Viacheslav Ovsiienko <[email protected]><...>
Quoted 4 lines
/* Mbuf Pools */
static inline void
-mbuf_poolname_build(unsigned intsock_id, char*mp_name, intname_size)app/test-pmd/testpmd.h struct mplsoudp_decap_conf { · line 634
Quoted 10 lines
app/test-pmd/testpmd.h +8
-1+mbuf_poolname_build(unsigned int sock_id, char *mp_name, + int name_size, unsigned int idx) { - snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id); + if (!idx) + snprintf(mp_name, name_size, "mbuf_pool_socket_%u", +sock_id); + else + snprintf(mp_name, name_size, "mbuf_pool_socket_%u_%u", + sock_id, idx);'
mp_name' can theoretically overflow and gives a compiler warning, although not sure if this truncation is a problem in practice.
../app/test-pmd/testpmd.c: In function ‘rx_queue_setup’:../app/test-pmd/testpmd.h:666:53: error: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size between
0 and 7 [-Werror=format-truncation=]
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~../app/test-pmd/testpmd.h:666:32: note: directive argument in the range [1, 4294967295]
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~~~~~~~~~~~~~~~~~~~~~~~../app/test-pmd/testpmd.h:666:3: note: ‘snprintf’ output between 21 and 39 bytes into a destination of size 26
666 | snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Quoted 5 lines
667 | sock_id, idx); | ~~~~~~~~~~~~~Any suggestion for fix? Can we shorten the string above, is it used somewhere else? Or casting variables to a smaller size may work too..
What do you think to following:
Quoted 10 lines
Quoted 10 lines
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 4cd0f967f0..4ac1c1f86e 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -661,10 +661,11 @@ mbuf_poolname_build(unsigned int sock_id,char
*mp_name,
intname_size, unsigned int idx)
{
if (!idx)
- snprintf(mp_name,name_size, "mbuf_pool_socket_%u",
sock_id);Quoted 15 lines
Quoted 10 lines
+ snprintf(mp_name,
name_size, "mbuf_pool_s%u",
+ (uint16_t)sock_id);
else
- snprintf(mp_name,name_size, "mbuf_pool_socket_%u_%u",
-sock_id, idx);
+ snprintf(mp_name,name_size, "mbuf_pool_s%u_%u",
+ (uint16_t)sock_id, (uint16_t)idx);
}static inline struct
rte_mempool*Testpmd build mbuf pool names with
mbuf_poolname_build()routine only (invoked from mbuf_pool_find/mbuf_pool_create). I suppose it is safe to replace "mbuf_pool_socket_" prefix with shorter one.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Say something like this: #define
TESTPMD_MBUF_POOL_PFX"mbuf"Just 'mbuf' may not give enough context in the logs, what about "mbuf_pool_%u_%u"?
It is place in the pool structure, so it is an object name and tightly coupled with the pool. OK, let's try "
mb_pool" ?
sounds good
PATCH v11 3/6 app/testpmd: add buffer split offload configuration
In reply to Viacheslav OvsiienkoThis patch add support for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT providing per queue configuration for this offload.
--- app/test-pmd/cmdline.c | 21 +++++++++++---------- app/test-pmd/config.c | 9 +++++++++ 2 files changed, 20 insertions(+), 10 deletions(-)
app/test-pmd/cmdline.c +11 -10
@@ -883,16 +883,16 @@ static void cmd_help_long_parsed(void *parsed_result,"port config <port_id> rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per port Rx offloading" " on all Rx queues of a port\n\n" "port (port_id) rxq (queue_id) rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per queue Rx offloading" " only on a specific Rx queue\n\n"
@@ -18435,7 +18435,8 @@ struct cmd_config_per_port_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc#rss_hash"); +"scatter#buffer_split#timestamp#security#" + "keep_crc#rss_hash");cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result,
@@ -18515,8 +18516,8 @@ struct cmd_config_per_port_rx_offload_result { .help_str = "port config <port_id> rx_offload vlan_strip|ipv4_cksum|""udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc|rss_hash " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc|rss_hash on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, (void *)&cmd_config_per_port_rx_offload_result_config,
@@ -18565,7 +18566,7 @@ struct cmd_config_per_queue_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc"); + "scatter#buffer_split#timestamp#security#keep_crc");cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result,
@@ -18621,8 +18622,8 @@ struct cmd_config_per_queue_rx_offload_result {"vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, (void *)&cmd_config_per_queue_rx_offload_result_port_id,
app/test-pmd/config.c +9 -0
@@ -1092,6 +1092,15 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("off\n" ); } +if (dev_info.rx_offload_capa &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { +printf ("RX offload buffer split: " ); +if (ports[port_id].dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) +printf ("on\n" ); +else +printf ("off\n" ); + } +if (dev_info.tx_offload_capa &DEV_TX_OFFLOAD_VLAN_INSERT ) {printf ("VLAN insert: " ); if (ports[port_id].dev_conf.txmode.offloads &
Signature · 1 line
1.8.3.1
PATCH v11 4/6 app/testpmd: add rxpkts commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxpkts=X[,Y]
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command:
testpmd> set rxpkts (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only). Optionally the multiple memory pools can be specified with --mbuf-size command line parameter and the mbufs to receive will be allocated sequentially from these extra memory pools.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 48 ++++++++++++++++++++++- app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 7 ++++ app/test-pmd/testpmd.h | 11 +++++- doc/guides/testpmd_app_ug/run_app.rst | 9 +++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 +++++++++- 7 files changed, 165 insertions(+), 7 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|txpkts)\n" +"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxpkts (x[,y]*)\n" +" Set the length of each segment to scatter" +" packets on receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set txpkts (x[,y]*)\n" " Set the length of each segment of TXONLY" " and optionally CSUM packets.\n\n"
@@ -3907,6 +3913,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxpkts_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxpkts; +cmdline_fixed_string_t seg_lengths; +}; + +static void +cmd_set_rxpkts_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxpkts_result *res; +unsigned int seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_lengths,"segment lengths" , +MAX_SEGS_BUFFER_SPLIT , seg_lengths,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_lengths, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxpkts_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxpkts_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + rxpkts,"rxpkts" ); +cmdline_parse_token_string_t cmd_set_rxpkts_lengths = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result, + seg_lengths,NULL ); + +cmdline_parse_inst_t cmd_set_rxpkts = { + .f = cmd_set_rxpkts_parsed, + .data =NULL , + .help_str ="set rxpkts <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxpkts_keyword, + (void *)&cmd_set_rxpkts_name, + (void *)&cmd_set_rxpkts_lengths, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */ struct cmd_set_txpkts_result {
@@ -7535,6 +7587,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxpkts")) +show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))show_tx_pkt_segments (); else if (!strcmp(res->what, "txtimes"))
@@ -7547,12 +7601,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#txpkts#txtimes" ); +"rxtx#cores#fwd#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19825,6 +19879,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit, (cmdline_parse_inst_t *)&cmd_set_txtimes,
app/test-pmd/config.c +46 -2
62 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );printf (" --txonly-multi-flow: generate multiple flows in txonly mode\n" );
@@ -662,6 +663,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 }, { "disable-link-check", 0, 0, 0 },
@@ -1272,6 +1274,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) { +unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + nb_segs =parse_item_list + (optarg,"rxpkt segments" , +MAX_SEGS_BUFFER_SPLIT , + seg_len,0 ); +if (nb_segs >0 ) +set_rx_pkt_segments (seg_len, nb_segs); +else +rte_exit (EXIT_FAILURE ,"bad rxpkts\n" ); + }if (!strcmp (lgopts[opt_idx].name,"txpkts" )) {unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +7 -0
@@ -210,6 +210,13 @@ struct fwd_engine * fwd_engines[] = {uint8_t f_quit;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ uint16_t tx_pkt_length =TXONLY_DEF_PACKET_LEN ;/**< TXONLY packet length. */
app/test-pmd/testpmd.h +10 -1
@@ -430,6 +430,13 @@ struct queue_stats_mappings {extern struct rte_fdir_conf fdir_conf;/* +* Configuration of packet segments used to scatter received packets +* if some of split features is configured. +*/ +extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ + +/* * Configuration of packet segments used by the "txonly" processing engine. */ #define TXONLY_DEF_PACKET_LEN 64
@@ -836,7 +843,9 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_record_core_cycles (uint8_t on_off);void set_record_burst_stats (uint8_t on_off);void set_verbose_level (uint16_t vb_level); -void set_tx_pkt_segments (unsigned *seg_lengths,unsigned nb_segs); +void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs); +void show_rx_pkt_segments (void ); +void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);void show_tx_pkt_times (void );
doc/guides/testpmd_app_ug/run_app.rst +9 -0
@@ -361,6 +361,15 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxpkts=X[,Y]`` + + Set the length of segments to scatter packets on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + Optionally the multiple memory pools can be specified with --mbuf-size + command line parameter and the mbufs to receive will be allocated + sequentially from these extra memory pools. + * ``--txpkts=X[,Y]`` Set TX segment sizes or total packet length. Valid for ``tx-only``
doc/guides/testpmd_app_ug/testpmd_funcs.rst +20 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxpkts``: Packets to RX split configuration. + * ``txpkts``: Packets to TX configuration. * ``txtimes``: Burst time pattern for Tx only mode.
@@ -774,6 +776,23 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxpkts +~~~~~~~~~~ + +Set the length of segments to scatter packets on receiving if split +feature is engaged. Affects only the queues configured with split offloads +(currently BUFFER_SPLIT is supported only). Optionally the multiple memory +pools can be specified with --mbuf-size command line parameter and the mbufs +to receive will be allocated sequentially from these extra memory pools (the +mbuf for the first segment is allocated from the first pool, the second one +from the second pool, and so on, if segment number is greater then pool's the +mbuf for remaining segments will be allocated from the last valid pool). + + testpmd> set rxpkts (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. Zero value +means to use the corresponding memory pool data buffer size. + set txpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v11 5/6 app/testpmd: add rxoffs commands and parameters
In reply to Viacheslav OvsiienkoAdd command line parameter:
--rxoffs=X[,Y]
Sets the offsets of packet segments from the beginning of the receiving buffer if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).
Add interactive mode command, providing the same:
testpmd> set rxoffs (x[,y]*)
Where x[,y]* represents a CSV list of values, without white space.
--- app/test-pmd/cmdline.c | 61 +++++++++++++++++++++++++++-- app/test-pmd/config.c | 44 +++++++++++++++++++++ app/test-pmd/parameters.c | 15 +++++++ app/test-pmd/testpmd.c | 2 + app/test-pmd/testpmd.h | 4 ++ doc/guides/testpmd_app_ug/run_app.rst | 6 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 17 +++++++- 7 files changed, 145 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +58 -3
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,"show (rxq|txq) info (port_id) (queue_id)\n" " Display information for configured RX/TX queue.\n\n" -"show config (rxtx|cores|fwd|rxpkts|txpkts)\n" +"show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts)\n" " Display the given configuration.\n\n" "read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result," Set the transmit delay time and number of retries," " effective when retry is enabled.\n\n" +"set rxoffs (x[,y]*)\n" +" Set the offset of each packet segment on" +" receiving if split feature is engaged." +" Affects only the queues configured with split" +" offloads.\n\n" +"set rxpkts (x[,y]*)\n" " Set the length of each segment to scatter" " packets on receiving if split feature is engaged."
@@ -3913,6 +3919,52 @@ struct cmd_set_log_result { }, }; +/* *** SET SEGMENT OFFSETS OF RX PACKETS SPLIT *** */ + +struct cmd_set_rxoffs_result { +cmdline_fixed_string_t cmd_keyword; +cmdline_fixed_string_t rxoffs; +cmdline_fixed_string_t seg_offsets; +}; + +static void +cmd_set_rxoffs_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_rxoffs_result *res; +unsigned int seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs; + + res = parsed_result; + nb_segs =parse_item_list (res->seg_offsets,"segment offsets" , +MAX_SEGS_BUFFER_SPLIT , seg_offsets,0 ); +if (nb_segs >0 ) +set_rx_pkt_offsets (seg_offsets, nb_segs); +} + +cmdline_parse_token_string_t cmd_set_rxoffs_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + cmd_keyword,"set" ); +cmdline_parse_token_string_t cmd_set_rxoffs_name = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + rxoffs,"rxoffs" ); +cmdline_parse_token_string_t cmd_set_rxoffs_offsets = + TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result, + seg_offsets,NULL ); + +cmdline_parse_inst_t cmd_set_rxoffs = { + .f = cmd_set_rxoffs_parsed, + .data =NULL , + .help_str ="set rxoffs <len0[,len1]*>" , + .tokens = { + (void *)&cmd_set_rxoffs_keyword, + (void *)&cmd_set_rxoffs_name, + (void *)&cmd_set_rxoffs_offsets, +NULL , + }, +}; +/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */ struct cmd_set_rxpkts_result {
@@ -7587,6 +7639,8 @@ static void cmd_showcfg_parsed(void *parsed_result,fwd_lcores_config_display (); else if (!strcmp(res->what, "fwd"))pkt_fwd_config_display (&cur_fwd_config); + else if (!strcmp(res->what, "rxoffs")) +show_rx_pkt_offsets (); else if (!strcmp(res->what, "rxpkts"))show_rx_pkt_segments (); else if (!strcmp(res->what, "txpkts"))
@@ -7601,12 +7655,12 @@ static void cmd_showcfg_parsed(void *parsed_result, TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");cmdline_parse_token_string_t cmd_showcfg_what = TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what, -"rxtx#cores#fwd#rxpkts#txpkts#txtimes" ); +"rxtx#cores#fwd#rxoffs#rxpkts#txpkts#txtimes" );cmdline_parse_inst_t cmd_showcfg = { .f = cmd_showcfg_parsed, .data =NULL , - .help_str ="show config rxtx|cores|fwd|rxpkts|txpkts|txtimes" , + .help_str ="show config rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes" , .tokens = { (void *)&cmd_showcfg_show, (void *)&cmd_showcfg_port,
@@ -19879,6 +19933,7 @@ struct cmd_showport_macs_result { (cmdline_parse_inst_t *)&cmd_reset, (cmdline_parse_inst_t *)&cmd_set_numbers, (cmdline_parse_inst_t *)&cmd_set_log, + (cmdline_parse_inst_t *)&cmd_set_rxoffs, (cmdline_parse_inst_t *)&cmd_set_rxpkts, (cmdline_parse_inst_t *)&cmd_set_txpkts, (cmdline_parse_inst_t *)&cmd_set_txsplit,
app/test-pmd/config.c +44 -0
50 lines not on this page · raw message
app/test-pmd/parameters.c +15 -0
@@ -184,6 +184,7 @@ "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);printf (" --no-flush-rx: Don't flush RX streams before forwarding." " Used mainly with PCAP drivers.\n" ); +printf (" --rxoffs=X[,Y]*: set RX segment offsets for split.\n" );printf (" --rxpkts=X[,Y]*: set RX segment sizes to split.\n" );printf (" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n" );
@@ -663,6 +664,7 @@ { "rx-queue-stats-mapping", 1, 0, 0 }, { "no-flush-rx", 0, 0, 0 }, { "flow-isolate-all", 0, 0, 0 }, + { "rxoffs", 1, 0, 0 }, { "rxpkts", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 },
@@ -1274,6 +1276,19 @@ "invalid RX queue statistics mapping config entered\n"); } } +if (!strcmp (lgopts[opt_idx].name,"rxoffs" )) { +unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_offs; + + nb_offs =parse_item_list + (optarg,"rxpkt offsets" , +MAX_SEGS_BUFFER_SPLIT , + seg_off,0 ); +if (nb_offs >0 ) +set_rx_pkt_offsets (seg_off, nb_offs); +else +rte_exit (EXIT_FAILURE ,"bad rxoffs\n" ); + }if (!strcmp (lgopts[opt_idx].name,"rxpkts" )) {unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT ];unsigned int nb_segs;
app/test-pmd/testpmd.c +2 -0
@@ -215,6 +215,8 @@ struct fwd_engine * fwd_engines[] = {*/ uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
app/test-pmd/testpmd.h +4 -0
@@ -435,6 +435,8 @@ struct queue_stats_mappings {*/ extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT ];extern uint8_t rx_pkt_nb_segs;/**< Number of segments to split */ +extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT ]; +extern uint8_t rx_pkt_nb_offs;/**< Number of specified offsets */ /* * Configuration of packet segments used by the "txonly" processing engine.
@@ -845,6 +847,8 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,void set_verbose_level (uint16_t vb_level);void set_rx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_rx_pkt_segments (void ); +void set_rx_pkt_offsets (unsigned int *seg_offsets,unsigned int nb_offs); +void show_rx_pkt_offsets (void );void set_tx_pkt_segments (unsigned int *seg_lengths,unsigned int nb_segs);void show_tx_pkt_segments (void );void set_tx_pkt_times (unsigned int *tx_times);
doc/guides/testpmd_app_ug/run_app.rst +6 -0
@@ -361,6 +361,12 @@ The command line options are: Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD. +* ``--rxoffs=X[,Y]`` + + Set the offsets of packet segments on receiving if split + feature is engaged. Affects only the queues configured + with split offloads (currently BUFFER_SPLIT is supported only). + * ``--rxpkts=X[,Y]`` Set the length of segments to scatter packets on receiving if split
doc/guides/testpmd_app_ug/testpmd_funcs.rst +16 -1
@@ -273,7 +273,7 @@ show config Displays the configuration of the application. The configuration comes from the command-line, the runtime or the application defaults:: - testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes) + testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes) The available information categories are:
@@ -283,6 +283,8 @@ The available information categories are: * ``fwd``: Packet forwarding configuration. +* ``rxoffs``: Packet offsets for RX split. + * ``rxpkts``: Packets to RX split configuration. * ``txpkts``: Packets to TX configuration.
@@ -776,6 +778,19 @@ When retry is enabled, the transmit delay time and number of retries can also be testpmd> set burst tx delay (microseconds) retry (num) +set rxoffs +~~~~~~~~~~ + +Set the offsets of segments relating to the data buffer beginning on receiving +if split feature is engaged. Affects only the queues configured with split +offloads (currently BUFFER_SPLIT is supported only). + + testpmd> set rxoffs (x[,y]*) + +Where x[,y]* represents a CSV list of values, without white space. If the list +of offsets is shorter than the list of segments the zero offsets will be used +for the remaining segments. + set rxpkts ~~~~~~~~~~
Signature · 1 line
1.8.3.1
PATCH v11 6/6 app/testpmd: add extended Rx queue setup
In reply to Viacheslav OvsiienkoIf Rx queue is configured with split feature the extended setup with specified segment sizes and pool will be performed.
--- app/test-pmd/cmdline.c | 12 ++++++------ app/test-pmd/testpmd.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- app/test-pmd/testpmd.h | 5 +++++ 3 files changed, 58 insertions(+), 8 deletions(-)
app/test-pmd/cmdline.c +6 -6
@@ -2945,12 +2945,12 @@ struct cmd_setup_rxtx_queue { rxring_numa[res->portid]);return ; } - ret =rte_eth_rx_queue_setup (res->portid, - res->qid, - port->nb_rx_desc[res->qid], - socket_id, - &port->rx_conf[res->qid], - mp); + ret =rx_queue_setup (res->portid, + res->qid, + port->nb_rx_desc[res->qid], + socket_id, + &port->rx_conf[res->qid], + mp);if (ret)printf ("Failed to setup RX queue\n" ); }else {
app/test-pmd/testpmd.c +47 -2
67 lines not on this page · raw message
app/test-pmd/testpmd.h +5 -0
@@ -896,6 +896,11 @@ void port_rss_reta_info(portid_t port_id,void set_vf_traffic (portid_t port_id,uint8_t is_rx,uint16_t vf,uint8_t on); +int +rx_queue_setup (uint16_t port_id,uint16_t rx_queue_id, +uint16_t nb_rx_desc,unsigned int socket_id, +struct rte_eth_rxconf *rx_conf,struct rte_mempool *mp); +int set_queue_rate_limit (portid_t port_id,uint16_t queue_idx,uint16_t rate);int set_vf_rate_limit (portid_t port_id,uint16_t vf,uint16_t rate,uint64_t q_msk);
Signature · 1 line
1.8.3.1
v12 cover ethdev: introduce Rx buffer split
In reply to Slava OvsiienkoThe DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
---
v1: http://patches.dpdk.org/patch/79594/
v2: http://patches.dpdk.org/patch/79893/
- add feature support to mlx5 PMD
v3: http://patches.dpdk.org/patch/80389/
- rte_eth_rx_queue_setup_ex is renamed to rte_eth_rxseg_queue_setup
- DEV_RX_OFFLOAD_BUFFER_SPLIT is renamed to RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT
- commit message update
- documentaion provided
- release notes update
- minor bug fixes in testpmd related part
v4: http://patches.dpdk.org/patch/80401/
- common part of rx_queue_setup/rxseg_queue_setup
v5: http://patches.dpdk.org/patch/80609/
- refactored to approach of providing split configuration in the rte_eth_rxconf structure instead of introducing the new API routine
- added support for rxoffs command to testpmd to provide segment offsets for complete testing of split configurations
- patchset is split into two parts - PMD part will be presented as separate series
v6: http://patches.dpdk.org/patch/80785/
- wordy comments rephrased
- typos fixed
- rte_eth_rx_queue_setup configuration check isolated for two main options
- the rest of comments addressed
v7: http://patches.dpdk.org/patch/80978/
- description as union of feature dedicated segment split description
- the split limitations reported in the rte_eth_dev_info->rx_seg_capa
- comments made less wordy
v8: - bitfield instead of uint8;
- named union to avoid warinings;
- typos fixed
v9: http://patches.dpdk.org/patch/81080/
- simplified rte_eth_rxseg union
- moved out wordy comment from rte_eth_rxconf
- rte_eth_rxseg_capa uint32 bitfield and naming
- added experimental tags
v10: - missed in mailing list, see v11 for changes
v11: http://patches.dpdk.org/patch/81116/
- documentation cleanup (removed rxq_info_get mention)
- max_nseg moved from the recored and converted to uint16_t;
- reserved uint16_t is added to rte_eth_rxseg_capa;
v12: - __rte_experimental at structure declarations
converted to the tag in the comment
- testpmd pool names shortened, prefix provided
- comments reworded
---
Viacheslav Ovsiienko (6):
ethdev: introduce Rx buffer split app/testpmd: add multiple pools per core creation app/testpmd: add buffer split offload configuration app/testpmd: add rxpkts commands and parameters app/testpmd: add rxoffs commands and parameters app/testpmd: add extended Rx queue setup
app/test-pmd/bpf_cmd.c | 4 +- app/test-pmd/cmdline.c | 151 +++++++++++++++++++++++---- app/test-pmd/config.c | 107 ++++++++++++++++++- app/test-pmd/parameters.c | 54 ++++++++-- app/test-pmd/testpmd.c | 121 ++++++++++++++++------ app/test-pmd/testpmd.h | 48 +++++++-- doc/guides/nics/features.rst | 14 +++ doc/guides/rel_notes/deprecation.rst | 5 - doc/guides/rel_notes/release_20_11.rst | 9 ++ doc/guides/testpmd_app_ug/run_app.rst | 22 +++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 36 ++++++- lib/librte_ethdev/rte_ethdev.c | 153 +++++++++++++++++++++++----- lib/librte_ethdev/rte_ethdev.h | 95 ++++++++++++++++- 13 files changed, 716 insertions(+), 103 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v12 1/6 ethdev: introduce Rx buffer split
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.
The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:
struct rte_eth_rxseg_split {
struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};
The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array
If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.
There are two options to specify Rx buffer configuration:
- mp is not NULL, rrx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides the single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.
f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2
The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3
The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).
The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.
The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
--- doc/guides/nics/features.rst | 14 +++ doc/guides/rel_notes/deprecation.rst | 5 -- doc/guides/rel_notes/release_20_11.rst | 9 ++ lib/librte_ethdev/rte_ethdev.c | 153 +++++++++++++++++++++++++++------ lib/librte_ethdev/rte_ethdev.h | 95 +++++++++++++++++++- 5 files changed, 245 insertions(+), 31 deletions(-)
doc/guides/nics/features.rst +14 -0
@@ -185,6 +185,20 @@ Supports receiving segmented mbufs. * **[related] eth_dev_ops**: ``rx_pkt_burst``. +.. _nic_features_buffer_split: + +Buffer Split on Rx +------------------ + +Scatters the packets being received on specified boundaries to segmented mbufs. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[uses] rte_eth_rxconf**: ``rx_conf.rx_seg, rx_conf.rx_nseg``. +* **[implements] datapath**: ``Buffer Split functionality``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa:RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT``. +* **[related] API**: ``rte_eth_rx_queue_setup()``. + + .. _nic_features_lro: LRO
doc/guides/rel_notes/deprecation.rst +0 -5
@@ -138,11 +138,6 @@ Deprecation Notices In 19.11 PMDs will still update the field even when the offload is not enabled. -* ethdev: Add new fields to ``rte_eth_rxconf`` to configure the receiving - queues to split ingress packets into multiple segments according to the - specified lengths into the buffers allocated from the specified - memory pools. The backward compatibility to existing API is preserved. - * ethdev: ``rx_descriptor_done`` dev_ops and ``rte_eth_rx_descriptor_done`` will be removed in 21.11. Existing ``rte_eth_rx_descriptor_status`` and ``rte_eth_tx_descriptor_status``
doc/guides/rel_notes/release_20_11.rst +9 -0
@@ -89,6 +89,12 @@ New Features as flow action. * Added new flow APIs to create/update/destroy/query shared action. +* **Introduced extended buffer description for receiving.** + + Added the extended Rx buffer description for Rx queue setup routine + providing the individual settings for each Rx segment with maximal size, + buffer offset and memory pool to allocate data buffers from. + * **Updated Broadcom bnxt driver.** Updated the Broadcom bnxt driver with new features and improvements, including:
@@ -321,6 +327,9 @@ API Changes As the data of ``uint8_t`` will be truncated when queue number under a TC is greater than 256. +* ethdev: Added fields rx_seg and rx_nseg to rte_eth_rxconf structure + to provide extended description of the receiving buffer. + * vhost: Moved vDPA APIs from experimental to stable. * rawdev: Added a structure size parameter to the functions
lib/librte_ethdev/rte_ethdev.c +128 -25
187 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev.h +94 -1
139 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 102 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.The following structure is introduced to specify the Rx packet segment for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLIToffload:struct
rte_eth_rxseg_split{struct
rte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length,
configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf.
This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specify Rx buffer configuration:
- mp is not NULL, rrx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides the single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2 seg1 - pool1, len1=20B, off1=128B seg2 - pool2, len2=20B, off2=0B seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The split limitations imposed by underlying PMD is reported in the new introduced
rte_eth_dev_info->rx_seg_capafield.The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Jerin Jacob <[email protected]>Reviewed-by Andrew Rybchenko <[email protected]>Acked-by Thomas Monjalon <[email protected]>
<...>
lib/librte_ethdev/rte_ethdev.c struct rte_eth_dev * · line 1924
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c +7
-1- mbp_buf_size =rte_pktmbuf_data_room_size (mp); +if (mp !=NULL ) { +/* Single pool configuration check. */ +if (rx_conf->rx_nseg !=0 ) { +RTE_ETHDEV_LOG (ERR , +"Ambiguous segment configuration\n" ); +return -EINVAL ; + }
'rte_eth_rx_queue_setup()' accepts 'rx_conf' to be NULL, there is a NULL check for it somewhere below the function :)
Above will crash in that case, need to fix this, I am on it, any idea welcome.
Quoted 115 lines · Ferruh Yigit
Quoted 102 lines · Viacheslav Ovsiienko
The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.
In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.
The new offload flag
RTE_ETH_RX_OFFLOAD_BUFFER_SPLITin device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking therte_eth_rx_queue_setup()routine application should checkRTE_ETH_RX_OFFLOAD_BUFFER_SPLITflag.The following structure is introduced to specify the Rx packet segment for
RTE_ETH_RX_OFFLOAD_BUFFER_SPLIToffload:struct
rte_eth_rxseg_split{struct
rte_mempool*mp; /* memory pools to allocate segment from */uint16_tlength; /* segment maximal data length, configures "split point" */
uint16_toffset; /* data offset from beginning
of mbuf data buffer */
uint32_treserved; /* reserved field */
};The segment descriptions are added to the
rte_eth_rxconfstructure:
rx_seg- pointer the array of segment descriptions, each element describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf. This array allows to specify the different settings for each segment in individual fashion.
rx_nseg- number of elements in the arrayIf the extended segment descriptions is provided with these new fields the mp parameter of the
rte_eth_rx_queue_setupmust be specified as NULL to avoid ambiguity.There are two options to specify Rx buffer configuration:
- mp is not NULL, rrx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides the single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.
For example, let's suppose we configured the Rx queue with the following segments:
seg0 - pool0, len0=14B, off0=2
seg1 - pool1, len1=20B, off1=128B
seg2 - pool2, len2=20B, off2=0B
seg3 - pool3, len3=512B, off3=0BThe packet 46 bytes long will look like the following:
seg0 - 14B long @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2The packet 1500 bytes long will look like the following:
seg0 - 14B @RTE_PKTMBUF_HEADROOM+ 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3The offload
RTE_ETH_RX_OFFLOAD_SCATTERmust be present and configured to support new buffer split feature (ifrx_nsegis greater than one).The split limitations imposed by underlying PMD is reported in the new introduced
rte_eth_dev_info->rx_seg_capafield.The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.
Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Jerin Jacob <[email protected]>Reviewed-by Andrew Rybchenko <[email protected]>Acked-by Thomas Monjalon <[email protected]><...>
Quoted 8 lines
-
mbp_buf_size=rte_pktmbuf_data_room_size(mp); + if (mp != NULL) {
+ /* Single pool configuration check. */
+ if (rx_conf->rx_nseg!= 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Ambiguous segment configuration\n"); + return-EINVAL;
+ }
Quoted 3 lines
'
rte_eth_rx_queue_setup()' accepts 'rx_conf' to be NULL, there is a NULL check for it somewhere below the function :)Above will crash in that case, need to fix this, I am on it, any idea welcome.
adding additional checks as following in the next-net:
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 372a63bafa..ee2bc51671 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1947,7 +1947,7 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_trx_queue_id,
if (mp != NULL) {
/* Single pool configuration check. */
- if (rx_conf->rx_nseg != 0) {
+ if (rx_conf != NULL && rx_conf->rx_nseg != 0) {
RTE_ETHDEV_LOG(ERR,
"Ambiguous segment configuration\n");
return -EINVAL;
@@ -1983,7 +1983,7 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t
rx_queue_id,
uint16_t n_seg = rx_conf->rx_nseg;
/* Extended multi-segment configuration check. */ - if (rx_conf->rx_seg == NULL || rx_conf->rx_nseg == 0) {
+ if (rx_conf == NULL || rx_conf->rx_seg == NULL ||rx_conf->rx_nseg == 0) {
RTE_ETHDEV_LOG(ERR,
"Memory pool is null and no extended
configuration provided\n");
return -EINVAL;PATCH v12 2/6 app/testpmd: add multiple pools per core creation
In reply to Viacheslav OvsiienkoThe command line parameter --mbuf-size is updated, it can handle the multiple values like the following:
--mbuf-size=2176,512,768,4096
specifying the creation the extra memory pools with the requested mbuf data buffer sizes. If some buffer split feature is engaged the extra memory pools can be used to configure the Rx queues with rte_the_dev_rx_queue_setup_ex().
The extra pools are created with requested sizes, and pool names are assigned with appended index: mbuf_pool_socket_%socket_%index. Index zero is used to specify the first mandatory pool to maintain compatibility with existing code.
--- app/test-pmd/bpf_cmd.c | 4 +-- app/test-pmd/cmdline.c | 2 +- app/test-pmd/config.c | 6 ++-- app/test-pmd/parameters.c | 24 +++++++++---- app/test-pmd/testpmd.c | 63 +++++++++++++++++++---------------- app/test-pmd/testpmd.h | 28 +++++++++++++--- doc/guides/testpmd_app_ug/run_app.rst | 7 ++-- 7 files changed, 87 insertions(+), 47 deletions(-)
app/test-pmd/bpf_cmd.c +2 -2
@@ -69,7 +69,7 @@ struct cmd_bpf_ld_result { *flags =RTE_BPF_ETH_F_NONE ; arg->type =RTE_BPF_ARG_PTR ; - arg->size = mbuf_data_size; + arg->size = mbuf_data_size[0 ];for (i =0 ; str[i] !=0 ; i++) { v =toupper (str[i]);
@@ -78,7 +78,7 @@ struct cmd_bpf_ld_result {else if (v =='M' ) { arg->type =RTE_BPF_ARG_PTR_MBUF ; arg->size =sizeof (struct rte_mbuf ); - arg->buf_size = mbuf_data_size; + arg->buf_size = mbuf_data_size[0 ]; }else if (v =='-' )continue ;else
app/test-pmd/cmdline.c +1 -1
@@ -2925,7 +2925,7 @@ struct cmd_setup_rxtx_queue {if (!numa_support || socket_id ==NUMA_NO_CONFIG ) socket_id = port->socket_id; - mp =mbuf_pool_find (socket_id); + mp =mbuf_pool_find (socket_id,0 );if (mp ==NULL ) {printf ("Failed to setup RX queue: " "No mempool allocation"
app/test-pmd/config.c +3 -3
@@ -690,7 +690,7 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("\nConnect to socket: %u" , port->socket_id);if (port_numa[port_id] !=NUMA_NO_CONFIG ) { - mp =mbuf_pool_find (port_numa[port_id]); + mp =mbuf_pool_find (port_numa[port_id],0 );if (mp)printf ("\nmemory allocation on the socket: %d" , port_numa[port_id]);
@@ -3580,9 +3580,9 @@ struct igb_ring_desc_16_bytes {*/ tx_pkt_len =0 ;for (i =0 ; i < nb_segs; i++) { -if (seg_lengths[i] > (unsigned ) mbuf_data_size) { +if (seg_lengths[i] > mbuf_data_size[0 ]) {printf ("length[%u]=%u > mbuf_data_size=%u - give up\n" , - i, seg_lengths[i], (unsigned ) mbuf_data_size); + i, seg_lengths[i], mbuf_data_size[0 ]);return ; } tx_pkt_len = (uint16_t )(tx_pkt_len + seg_lengths[i]);
app/test-pmd/parameters.c +18 -6
@@ -106,7 +106,9 @@ "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");printf (" --socket-num=N: set socket from which all memory is allocated " "in NUMA mode.\n" ); -printf (" --mbuf-size=N: set the data size of mbuf to N bytes.\n" ); +printf (" --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to " +"N bytes. If multiple numbers are specified the extra pools " +"will be created to receive with packet split features\n" );printf (" --total-num-mbufs=N: set the number of mbufs to be allocated " "in mbuf pools.\n" );printf (" --max-pkt-len=N: set the maximum size of packet to N bytes.\n" );
@@ -892,12 +894,22 @@ } }if (!strcmp (lgopts[opt_idx].name,"mbuf-size" )) { - n =atoi (optarg); -if (n >0 && n <=0xFFFF ) - mbuf_data_size = (uint16_t ) n; -else +unsigned int mb_sz[MAX_SEGS_BUFFER_SPLIT ]; +unsigned int nb_segs, i; + + nb_segs =parse_item_list (optarg,"mbuf-size" , +MAX_SEGS_BUFFER_SPLIT , mb_sz,0 ); +if (nb_segs <=0 )rte_exit (EXIT_FAILURE , -"mbuf-size should be > 0 and < 65536\n" ); +"bad mbuf-size\n" ); +for (i =0 ; i < nb_segs; i++) { +if (mb_sz[i] <=0 || mb_sz[i] >0xFFFF ) +rte_exit (EXIT_FAILURE , +"mbuf-size should be " +"> 0 and < 65536\n" ); + mbuf_data_size[i] = (uint16_t ) mb_sz[i]; + } + mbuf_data_size_n = nb_segs; }if (!strcmp (lgopts[opt_idx].name,"total-num-mbufs" )) { n =atoi (optarg);
app/test-pmd/testpmd.c +35 -28
145 lines not on this page · raw message
app/test-pmd/testpmd.h +23 -5
@@ -42,6 +42,16 @@*/ #define RTE_MAX_SEGS_PER_PKT 255/**< nb_segs is a 8-bit unsigned char. */ +/* +* The maximum number of segments per packet is used to configure +* buffer split feature, also specifies the maximum amount of +* optional Rx pools to allocate mbufs to split. +*/ +#define MAX_SEGS_BUFFER_SPLIT 8/**< nb_segs is a 8-bit unsigned char. */ + +/* The prefix of the mbuf pool names created by the application. */ +#define MBUF_POOL_NAME_PFX "mb_pool" +#define MAX_PKT_BURST 512#define DEF_PKT_BURST 32
@@ -403,7 +413,9 @@ struct queue_stats_mappings {extern uint8_t dcb_config;extern uint8_t dcb_test; -extern uint16_t mbuf_data_size;/**< Mbuf data space size. */ +extern uint32_t mbuf_data_size_n; +extern uint16_t mbuf_data_size[MAX_SEGS_BUFFER_SPLIT ]; +/**< Mbuf data space size. */ extern uint32_t param_total_num_mbufs;extern uint16_t stats_period;
@@ -615,17 +627,23 @@ struct mplsoudp_decap_conf {/* Mbuf Pools */ static inline void -mbuf_poolname_build (unsigned int sock_id,char * mp_name,int name_size) +mbuf_poolname_build (unsigned int sock_id,char *mp_name, +int name_size,uint16_t idx) { -snprintf (mp_name, name_size,"mbuf_pool_socket_%u" , sock_id); +if (!idx) +snprintf (mp_name, name_size, +MBUF_POOL_NAME_PFX "_%u" , sock_id); +else +snprintf (mp_name, name_size, +MBUF_POOL_NAME_PFX "_%hu_%hu" , (uint16_t )sock_id, idx); }static inline struct rte_mempool * -mbuf_pool_find (unsigned int sock_id) +mbuf_pool_find (unsigned int sock_id,uint16_t idx) {char pool_name[RTE_MEMPOOL_NAMESIZE ]; -mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name)); +mbuf_poolname_build (sock_id, pool_name,sizeof (pool_name), idx);return rte_mempool_lookup ((const char *)pool_name); }
doc/guides/testpmd_app_ug/run_app.rst +5 -2
@@ -107,9 +107,12 @@ The command line options are: Set the socket from which all memory is allocated in NUMA mode, where 0 <= N < number of sockets on the board. -* ``--mbuf-size=N`` +* ``--mbuf-size=N[,N1[,...Nn]`` - Set the data size of the mbufs used to N bytes, where N < 65536. The default value is 2048. + Set the data size of the mbufs used to N bytes, where N < 65536. + The default value is 2048. If multiple mbuf-size values are specified the + extra memory pools will be created for allocating mbufs to receive packets + with buffer splittling features. * ``--total-num-mbufs=N``
Signature · 1 line
1.8.3.1
PATCH v12 3/6 app/testpmd: add buffer split offload configuration
In reply to Viacheslav OvsiienkoThis patch add support for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT providing per queue configuration for this offload.
--- app/test-pmd/cmdline.c | 21 +++++++++++---------- app/test-pmd/config.c | 9 +++++++++ 2 files changed, 20 insertions(+), 10 deletions(-)
app/test-pmd/cmdline.c +11 -10
@@ -883,16 +883,16 @@ static void cmd_help_long_parsed(void *parsed_result,"port config <port_id> rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per port Rx offloading" " on all Rx queues of a port\n\n" "port (port_id) rxq (queue_id) rx_offload vlan_strip|" "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" -"vlan_filter|vlan_extend|jumbo_frame|" -"scatter|timestamp|security|keep_crc on|off\n" +"vlan_filter|vlan_extend|jumbo_frame|scatter|" +"buffer_split|timestamp|security|keep_crc on|off\n" " Enable or disable a per queue Rx offloading" " only on a specific Rx queue\n\n"
@@ -18435,7 +18435,8 @@ struct cmd_config_per_port_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc#rss_hash"); +"scatter#buffer_split#timestamp#security#" + "keep_crc#rss_hash");cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result,
@@ -18515,8 +18516,8 @@ struct cmd_config_per_port_rx_offload_result { .help_str = "port config <port_id> rx_offload vlan_strip|ipv4_cksum|""udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc|rss_hash " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc|rss_hash on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, (void *)&cmd_config_per_port_rx_offload_result_config,
@@ -18565,7 +18566,7 @@ struct cmd_config_per_queue_rx_offload_result { offload,"vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "scatter#timestamp#security#keep_crc"); + "scatter#buffer_split#timestamp#security#keep_crc");cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off =TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result,
@@ -18621,8 +18622,8 @@ struct cmd_config_per_queue_rx_offload_result {"vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" -"jumbo_frame|scatter|timestamp|security|keep_crc " - "on|off", +"jumbo_frame|scatter|buffer_split|timestamp|security|" + "keep_crc on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, (void *)&cmd_config_per_queue_rx_offload_result_port_id,
app/test-pmd/config.c +9 -0
@@ -1092,6 +1092,15 @@ static int bus_match_all(const struct rte_bus *bus, const void *data)printf ("off\n" ); } +if (dev_info.rx_offload_capa &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { +printf ("RX offload buffer split: " ); +if (ports[port_id].dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) +printf ("on\n" ); +else +printf ("off\n" ); + } +if (dev_info.tx_offload_capa &DEV_TX_OFFLOAD_VLAN_INSERT ) {printf ("VLAN insert: " ); if (ports[port_id].dev_conf.txmode.offloads &
Signature · 1 line
1.8.3.1