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

From: Saeed Mahameed <[email-masked]>
Date: Wed, 23 Nov 2022 14:29:37 -0800

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 <[email-masked]>
>Cc: David Ahern <[email-masked]>
>Cc: Martin KaFai Lau <[email-masked]>
>Cc: Jakub Kicinski <[email-masked]>
>Cc: Willem de Bruijn <[email-masked]>
>Cc: Jesper Dangaard Brouer <[email-masked]>
>Cc: Anatoly Burakov <[email-masked]>
>Cc: Alexander Lobakin <[email-masked]>
>Cc: Magnus Karlsson <[email-masked]>
>Cc: Maryam Tahhan <[email-masked]>
>Cc: Stanislav Fomichev <[email-masked]>
>Cc: [email-masked]
>Cc: [email-masked]
>Signed-off-by: Toke Høiland-Jørgensen <[email-masked]>
>---
>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?