On 24 Feb 2026, at 12:59, Eelco Chaudron via dev wrote:

> This patch introduces a new API to the offload provider framework that
> allows hardware offload implementations to control hash value calculation
> for the OVS_ACTION_ATTR_HASH action.
>
> Background and Motivation
> ==========================
>
> The OVS hash action (OVS_ACTION_ATTR_HASH) is used to compute a hash value
> from packet header fields, primarily for load balancing across multiple
> paths using the select group action. The hash value is stored in the
> packet's metadata and used by subsequent actions to distribute flows
> across multiple output ports.
>
> However, hardware offload implementations may require different approaches
> to hash calculation:
>
> 1. Hardware NICs may use different hash functions or hash inputs than
>    the software datapath, which can lead to inconsistent load distribution
>    when mixing hardware and software paths.
>
> 2. Some hardware may support enhanced hashing mechanisms (e.g., using
>    symmetric hashing for bidirectional flows or hardware-specific hash
>    engines) that provide better load distribution than the default
>    software implementation.
>
> Design
> ======
>
> This patch adds a new optional callback to the dpif_offload_class:
>
>   bool (*netdev_get_dp_hash)(const struct dpif_offload *,
>                              const struct netdev *ingress_netdev,
>                              const struct dp_packet *,
>                              const struct ovs_action_hash *, uint32_t *hash);
>
> The callback is invoked during hash action execution when hardware offload
> is enabled and the original ingress port is known. It receives:
>   - ingress_netdev: The original ingress port where the packet was received
>   - packet: The packet to be hashed
>   - hash_action: The hash action parameters including algorithm and basis
>
> If the provider implements this callback and returns true, the returned
> hash value is used. Otherwise, OVS falls back to the standard hash
> calculation.
>
> NOTE: This patch needs to be applied on top of the patch series below:
>      https://patchwork.ozlabs.org/project/openvswitch/list/?series=491639
>      https://patchwork.ozlabs.org/project/openvswitch/list/?series=492976
>
> Signed-off-by: Eelco Chaudron <[email protected]>
> ---
>  lib/dpif-netdev.c           | 102 ++++++++++++++++++++++++++++++++----
>  lib/dpif-offload-dummy.c    |  98 ++++++++++++++++++++++++++++++++++
>  lib/dpif-offload-provider.h |  12 +++++
>  lib/dpif-offload.c          |  19 +++++++
>  lib/dpif-offload.h          |   4 ++
>  lib/dpif.c                  |   7 ++-
>  lib/odp-execute.c           |  15 ++++--
>  lib/odp-execute.h           |   2 +-
>  tests/dpif-netdev.at        |  47 +++++++++++++++++
>  9 files changed, 291 insertions(+), 15 deletions(-)
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 9384edcd96..c185031045 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -8514,7 +8514,28 @@ dp_execute_lb_output_action(struct 
> dp_netdev_pmd_thread *pmd,
>      }
>  }
>
> -static void
> +static inline bool
> +dp_hw_offload_hash(struct dp_netdev_pmd_thread *pmd,
> +                   const struct ovs_action_hash *hash_act,
> +                   struct dp_packet *packet, odp_port_t *cached_in_odpp,
> +                   struct netdev *cached_in_netdev)

Guess I forgot use ** cached_in_netdev() here. Will send a v2...

[...]

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

Reply via email to