On Tue, 6 Jan 2026 17:45:54 +0200
Gregory Etelson <[email protected]> wrote:

> In some cases application does not need to receive entire packet
> from port hardware.
> If application could receive required Rx data only and safely discard
> the rest of Rx packet data, that could improve port performance by
> reducing PCI bandwidth and application memory consumption.
> 
> Selective Rx data allows application to receive
> only pre-configured packet segments and discard the rest.
> For example:
> - Deliver the first N bytes only.
> - Deliver the last N bytes only.
> - Deliver N1 bytes from offset Off1 and N2 bytes from offset Off2.
> 
> Selective Rx data is implemented on-top of the existing Rx
> BUFFER_SPLIT functionality:
> - The rte_eth_rxseg_split will use the NULL mempool for data segments
> that should be discarded.
> - PMD will not create MBUF segments if no data was read.
> 
> For example: Deliver Ethernet header only
> 
> Rx queue segments configuration:
> struct rte_eth_rxseg_split split[2] = {
>     {
>         .mp = <some mempool>,
>         .length = sizeof(struct rte_ether_hdr)
>     },
>     {
>         .mp = NULL, /* discard data */
>         .length = <MTU>
>     }
> };
> 
> Received MBUF configuration:
> mbuf[0].pkt_len = <original packet length>;
> mbuf[0].data_len = sizeof(struct rte_ether_hdr);
> mbuf[0].next = NULL; /* The next segment did not deliver data */
> 
> A PMD activates the selective Rx data capability by setting the
> rte_eth_rxseg_capa.selective_read bit.
> 
> Signed-off-by: Gregory Etelson <[email protected]>
> ---
> v3: Change the selective_read bit location.
> ---
>  lib/ethdev/rte_ethdev.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index a66c2abbdb..84769d3d26 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -1121,7 +1121,11 @@ struct rte_eth_txmode {
>   *   The rest will be put into the last valid pool.
>   */
>  struct rte_eth_rxseg_split {
> -     struct rte_mempool *mp; /**< Memory pool to allocate segment from. */
> +     /**
> +      * Memory pool to allocate segment from.
> +      * NULL means skipped segment in selective Rx data. @see selective_read.
> +      */
> +     struct rte_mempool *mp;
>       uint16_t length; /**< Segment data length, configures split point. */
>       uint16_t offset; /**< Data offset from beginning of mbuf data buffer. */
>       /**
> @@ -1758,6 +1762,7 @@ struct rte_eth_rxseg_capa {
>       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. */
> +     uint32_t selective_read:1; /**< Supports selective read. */
>       uint16_t max_nseg; /**< Maximum amount of segments to split. */
>       uint16_t reserved; /**< Reserved field. */
>  };

Will need testpmd extension and a driver (ideally multiple) that support it.

Reply via email to