Re: [xdp-hints] [PATCH bpf-next 2/2] mlx5: Support XDP RX metadata

Saeed Mahameed
2022-11-23T22:29:44Z

On 23 Nov 15:46, Toke Høiland-Jørgensen wrote:
>Support RX hash and timestamp metadata kfuncs. We need to pass in the cqe
>pointer to the mlx5e_skb_from* functions so it can be retrieved from the
>XDP ctx to do this.
>
>Cc: John Fastabend <john.fastabend@gmail.com>
>Cc: David Ahern <dsahern@gmail.com>
>Cc: Martin KaFai Lau <martin.lau@linux.dev>
>Cc: Jakub Kicinski <kuba@kernel.org>
>Cc: Willem de Bruijn <willemb@google.com>
>Cc: Jesper Dangaard Brouer <brouer@redhat.com>
>Cc: Anatoly Burakov <anatoly.burakov@intel.com>
>Cc: Alexander Lobakin <alexandr.lobakin@intel.com>
>Cc: Magnus Karlsson <magnus.karlsson@gmail.com>
>Cc: Maryam Tahhan <mtahhan@redhat.com>
>Cc: Stanislav Fomichev <sdf@google.com>
>Cc: xdp-hints@xdp-project.net
>Cc: netdev@vger.kernel.org
>Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>---
>This goes on top of Stanislav's series, obvioulsy. Verified that it works using
>the xdp_hw_metadata utility; going to do ome benchmarking and follow up with the
>results, but figured I'd send this out straight away in case others wanted to
>play with it.
>
>Stanislav, feel free to fold it into the next version of your series if you
>want!
>

[...]

> #endif /* __MLX5_EN_XSK_RX_H__ */
>diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>index 14bd86e368d5..015bfe891458 100644
>--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>@@ -4890,6 +4890,10 @@ const struct net_device_ops mlx5e_netdev_ops = {
> .ndo_tx_timeout = mlx5e_tx_timeout,
> .ndo_bpf = mlx5e_xdp,
> .ndo_xdp_xmit = mlx5e_xdp_xmit,
>+ .ndo_xdp_rx_timestamp_supported = mlx5e_xdp_rx_timestamp_supported,
>+ .ndo_xdp_rx_timestamp = mlx5e_xdp_rx_timestamp,
>+ .ndo_xdp_rx_hash_supported = mlx5e_xdp_rx_hash_supported,
>+ .ndo_xdp_rx_hash = mlx5e_xdp_rx_hash,

I hope i am not late to the party.
but I already expressed my feelings regarding using kfunc for xdp hints,
@LPC and @netdevconf.

I think it's wrong to use indirect calls, and for many usecases the
overhead will be higher than just calculating the metadata on the spot.

so you will need two indirect calls per packet per hint..
some would argue on some systems calculating the hash would be much faster.
and one major reason to have the hints is to accelerate xdp edge and
security programs with the hw provided hints.

what happened with just asking the driver to place the data in a specific
location on the headroom?