[PATCH 3/8] ethdev: add mbuf dynfield for incomplete IP reassembly
Ananyev, Konstantin
konstantin.ananyev at intel.com
Tue Jan 11 18:04:03 CET 2022
> Hardware IP reassembly may be incomplete for multiple reasons like
> reassembly timeout reached, duplicate fragments, etc.
> To save application cycles to process these packets again, a new
> mbuf ol_flag (RTE_MBUF_F_RX_IPREASSEMBLY_INCOMPLETE) is added to
> show that the mbuf received is not reassembled properly.
If we use dynfiled for data, why not use dynflag for RTE_MBUF_F_RX_IPREASSEMBLY_INCOMPLETE?
That way we can avoid introduced hardcoded (always defined) flags for that case.
>
> Now if this flag is set, application can retreive corresponding chain of
> mbufs using mbuf dynfield set by the PMD. Now, it will be upto
> application to either drop those fragments or wait for more time.
>
> Signed-off-by: Akhil Goyal <gakhil at marvell.com>
> ---
> lib/ethdev/ethdev_driver.h | 8 ++++++
> lib/ethdev/rte_ethdev.c | 16 +++++++++++
> lib/ethdev/rte_ethdev.h | 57 ++++++++++++++++++++++++++++++++++++++
> lib/ethdev/version.map | 2 ++
> lib/mbuf/rte_mbuf_core.h | 3 +-
> 5 files changed, 85 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index 0ed53c14f3..9a0bab9a61 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -1671,6 +1671,14 @@ int
> rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
> uint32_t direction);
>
> +/**
> + * @internal
> + * Register mbuf dynamic field for IP reassembly incomplete case.
> + */
> +__rte_internal
> +int
> +rte_eth_ip_reass_dynfield_register(void);
> +
>
> /*
> * Legacy ethdev API used internally by drivers.
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index ecc6c1fe37..d53ce4eaca 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -6503,6 +6503,22 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id,
> (*dev->dev_ops->ip_reassembly_conf_set)(dev, conf));
> }
>
> +#define RTE_ETH_IP_REASS_DYNFIELD_NAME "rte_eth_ip_reass_dynfield"
> +int rte_eth_ip_reass_dynfield_offset = -1;
> +
> +int
> +rte_eth_ip_reass_dynfield_register(void)
> +{
> + static const struct rte_mbuf_dynfield dynfield_desc = {
> + .name = RTE_ETH_IP_REASS_DYNFIELD_NAME,
> + .size = sizeof(rte_eth_ip_reass_dynfield_t),
> + .align = __alignof__(rte_eth_ip_reass_dynfield_t),
> + };
> + rte_eth_ip_reass_dynfield_offset =
> + rte_mbuf_dynfield_register(&dynfield_desc);
> + return rte_eth_ip_reass_dynfield_offset;
> +}
> +
> RTE_LOG_REGISTER_DEFAULT(rte_eth_dev_logtype, INFO);
>
> RTE_INIT(ethdev_init_telemetry)
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index 891f9a6e06..c4024d2265 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -5245,6 +5245,63 @@ __rte_experimental
> int rte_eth_ip_reassembly_conf_set(uint16_t port_id,
> struct rte_eth_ip_reass_params *conf);
>
> +/**
> + * In case of IP reassembly offload failure, ol_flags in mbuf will be set
> + * with RTE_MBUF_F_RX_IPREASSEMBLY_INCOMPLETE and packets will be returned
> + * without alteration. The application can retrieve the attached fragments
> + * using mbuf dynamic field.
> + */
> +typedef struct {
> + /**
> + * Next fragment packet. Application should fetch dynamic field of
> + * each fragment until a NULL is received and nb_frags is 0.
> + */
> + struct rte_mbuf *next_frag;
> + /** Time spent(in ms) by HW in waiting for further fragments. */
> + uint16_t time_spent;
> + /** Number of more fragments attached in mbuf dynamic fields. */
> + uint16_t nb_frags;
> +} rte_eth_ip_reass_dynfield_t;
Looks like a bit of overkill to me:
We do already have 'next' and 'nb_frags' fields inside mbuf,
why can't they be used here? Why a separate ones are necessary?
> +
> +extern int rte_eth_ip_reass_dynfield_offset;
> +
More information about the dev
mailing list