On 6/24/26 5:45 PM, David Marchand wrote:
> Let's allow growing a dp_packet_batch.
> This will help for software GSO as we can define a helper that
> will segment all packets and return them in the input batch.
> 
> To limit heap allocations, keep an embedded array of packets
> in the batch structure, and switch to heap allocated packets
> array when reaching the NETDEV_MAX_BURST previous limit.
> 
> The refill API becomes simpler, as the only operation needed now is to
> reset the count of packets when starting a refill loop.
> 
> ipf and GSO software helper are left untouched (keeping the
> behavior of accumulating up to NETDEV_MAX_BURST packets) and are updated
> in next commits.
> 
> At this point in time, no part of OVS should grow batches. Add a check
> in OVS_VSWITCHD_STOP, with a macro to simplify testing later commits.
> 
> Signed-off-by: David Marchand <[email protected]>
> ---
> Changes since RFC v1:
> - renamed field as "capacity",
> 
> ---
>  lib/dp-packet-gso.c     |  6 ++--
>  lib/dp-packet.c         | 25 +++++++++++++++++
>  lib/dp-packet.h         | 61 +++++++++++++++--------------------------
>  lib/dpif-netdev.c       |  6 ++--
>  lib/ipf.c               | 15 +++++-----
>  lib/netdev-dpdk.c       |  4 +--
>  lib/netdev.c            |  6 ++--
>  lib/odp-execute.c       |  2 +-
>  tests/ofproto-macros.at | 10 +++++++
>  tests/test-conntrack.c  |  4 +--
>  10 files changed, 78 insertions(+), 61 deletions(-)

[...]

> diff --git a/tests/test-conntrack.c b/tests/test-conntrack.c
> index efc5d839f5..b3fbe0cc35 100644
> --- a/tests/test-conntrack.c
> +++ b/tests/test-conntrack.c
> @@ -154,9 +154,9 @@ prepare_packets(size_t n, bool change, unsigned tid, 
> ovs_be16 *dl_type)
>      struct dp_packet_batch *pkt_batch = xzalloc(sizeof *pkt_batch);
>      size_t i;
>  
> -    ovs_assert(n <= ARRAY_SIZE(pkt_batch->packets));
> -
>      dp_packet_batch_init(pkt_batch);
> +    ovs_assert(n <= pkt_batch->capacity);

Should probbaly introduce the access function in this patch, instead
of the next one.

> +
>      for (i = 0; i < n; i++) {
>          uint16_t udp_dst = change ? 2+1 : 2;
>          struct dp_packet *pkt = build_packet(1 + tid, udp_dst, dl_type);

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to