[PATCH v4] mbuf: add raw free and alloc bulk functions
Thomas Monjalon
thomas at monjalon.net
Wed Feb 12 15:56:53 CET 2025
30/01/2025 15:49, Morten Brørup:
> When putting an mbuf back into its mempool, there are certain requirements
> to the mbuf. Specifically, some of its fields must be initialized.
>
> These requirements are in fact invariants about free mbufs, held in
> mempools, and thus also apply when allocating an mbuf from a mempool.
> With this in mind, the additional assertions in rte_mbuf_raw_free() were
> moved to __rte_mbuf_raw_sanity_check().
> Furthermore, the assertion regarding pinned external buffer was enhanced;
> it now also asserts that the referenced pinned external buffer has
> refcnt == 1.
>
> The description of RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE was updated to
> include the remaining requirements, which were missing here.
>
> And finally:
> A new rte_mbuf_raw_free_bulk() inline function was added for the
> benefit of ethdev drivers supporting fast release of mbufs.
> It asserts these requirements and that the mbufs belong to the specified
> mempool, and then calls rte_mempool_put_bulk().
>
> For symmetry, a new rte_mbuf_raw_alloc_bulk() inline function was also
> added.
>
> Signed-off-by: Morten Brørup <mb at smartsharesystems.com>
> Acked-by: Dengdui Huang <huangdengdui at huawei.com>
> Acked-by: Chengwen Feng <fengchengwen at huawei.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
> Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
Applied, thanks.
More information about the dev
mailing list