[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3d82e9a0-bae2-48dd-9bd7-941570748076@gmail.com>
Date: Tue, 17 Oct 2023 15:40:19 +0300
From: Tariq Toukan <ttoukan.linux@...il.com>
To: Larysa Zaremba <larysa.zaremba@...el.com>, bpf@...r.kernel.org
Cc: ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
martin.lau@...ux.dev, song@...nel.org, yhs@...com, john.fastabend@...il.com,
kpsingh@...nel.org, sdf@...gle.com, haoluo@...gle.com, jolsa@...nel.org,
David Ahern <dsahern@...il.com>, Jakub Kicinski <kuba@...nel.org>,
Willem de Bruijn <willemb@...gle.com>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Anatoly Burakov <anatoly.burakov@...el.com>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Magnus Karlsson <magnus.karlsson@...il.com>,
Maryam Tahhan <mtahhan@...hat.com>, xdp-hints@...-project.net,
netdev@...r.kernel.org, Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Simon Horman <simon.horman@...igine.com>, Tariq Toukan
<tariqt@...lanox.com>, Saeed Mahameed <saeedm@...lanox.com>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>
Subject: Re: [PATCH bpf-next v6 14/18] mlx5: implement VLAN tag XDP hint
On 12/10/2023 20:05, Larysa Zaremba wrote:
> Implement the newly added .xmo_rx_vlan_tag() hint function.
>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@...el.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 15 +++++++++++++++
> include/linux/mlx5/device.h | 2 +-
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
> index 12f56d0db0af..d7cd14687ce8 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
> @@ -256,9 +256,24 @@ static int mlx5e_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash,
> return 0;
> }
>
> +static int mlx5e_xdp_rx_vlan_tag(const struct xdp_md *ctx, __be16 *vlan_proto,
> + u16 *vlan_tci)
> +{
> + const struct mlx5e_xdp_buff *_ctx = (void *)ctx;
> + const struct mlx5_cqe64 *cqe = _ctx->cqe;
> +
I see inconsistency in using/not using "const" between the different
drivers.
Other than that, patch LGTM.
Reviewed-by: Tariq Toukan <tariqt@...dia.com>
> + if (!cqe_has_vlan(cqe))
> + return -ENODATA;
> +
> + *vlan_proto = htons(ETH_P_8021Q);
> + *vlan_tci = be16_to_cpu(cqe->vlan_info);
> + return 0;
> +}
> +
> const struct xdp_metadata_ops mlx5e_xdp_metadata_ops = {
> .xmo_rx_timestamp = mlx5e_xdp_rx_timestamp,
> .xmo_rx_hash = mlx5e_xdp_rx_hash,
> + .xmo_rx_vlan_tag = mlx5e_xdp_rx_vlan_tag,
> };
>
> /* returns true if packet was consumed by xdp */
> diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
> index 8fbe22de16ef..0805f8231452 100644
> --- a/include/linux/mlx5/device.h
> +++ b/include/linux/mlx5/device.h
> @@ -916,7 +916,7 @@ static inline u8 get_cqe_tls_offload(struct mlx5_cqe64 *cqe)
> return (cqe->tls_outer_l3_tunneled >> 3) & 0x3;
> }
>
> -static inline bool cqe_has_vlan(struct mlx5_cqe64 *cqe)
> +static inline bool cqe_has_vlan(const struct mlx5_cqe64 *cqe)
> {
> return cqe->l4_l3_hdr_type & 0x1;
> }
Powered by blists - more mailing lists