On 6/24/26 5:45 PM, David Marchand wrote:
> Next commit will introduce the possibility to grow dp_packet_batch.
> As some memory will be allocated when growing the batch, split
> dp_packet_batch handling with new helpers for initialising, resetting
> (before reuse) and destroying.
> 
> Some special care must be taken to init/destroy xmemdup'd dp_packet_batch
> objects.
> 
> Signed-off-by: David Marchand <[email protected]>
> ---
> Changes since RFC:
> - rebased (dropped AVX512),
> - fixed one leak in dp_netdev_pmd_clear_ports,
> 
> ---
>  lib/dp-packet.h        | 15 ++++++++--
>  lib/dpif-netdev.c      | 67 +++++++++++++++++++++++++++++++++++++++---
>  lib/dpif.c             |  1 +
>  lib/netdev-afxdp.c     |  2 +-
>  lib/netdev-bsd.c       |  3 +-
>  lib/netdev-dummy.c     |  3 +-
>  lib/netdev-linux.c     |  2 +-
>  lib/netdev.c           |  1 +
>  lib/odp-execute.c      |  3 ++
>  tests/test-conntrack.c |  6 +++-
>  10 files changed, 92 insertions(+), 11 deletions(-)
> 
> diff --git a/lib/dp-packet.h b/lib/dp-packet.h
> index 16b9afbc36..2540534cc3 100644
> --- a/lib/dp-packet.h
> +++ b/lib/dp-packet.h
> @@ -866,12 +866,18 @@ struct dp_packet_batch {
>  };
>  
>  static inline void
> -dp_packet_batch_init(struct dp_packet_batch *batch)
> +dp_packet_batch_reset_metadata(struct dp_packet_batch *batch)

I wonder if this should be just dp_packet_batch_reset, since the
'count' is not really a metadata?

>  {
>      batch->count = 0;
>      batch->trunc = false;
>  }
>  
> +static inline void
> +dp_packet_batch_init(struct dp_packet_batch *batch)
> +{
> +    dp_packet_batch_reset_metadata(batch);
> +}
> +
>  static inline void
>  dp_packet_batch_add__(struct dp_packet_batch *batch,
>                        struct dp_packet *packet, size_t limit)
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to