From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by mail.toke.dk (Postfix) with ESMTPS id 1D449A323F3 for ; Tue, 17 Oct 2023 14:40:25 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=JZgq03Qh Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40684f53bfcso51035815e9.0 for ; Tue, 17 Oct 2023 05:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697546424; x=1698151224; darn=xdp-project.net; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=1go1+s1mgfonK9oITafKnNr2oyG8bY2MnLUtwcvNu/E=; b=JZgq03Qhzt3yLVlG6pmqMR1bekzboVo7fCOoRf6E3McsyTnt1PUaLZrmNfiyDWRjK6 mOXEkxIbGq2esunHigZ04Nr6QidQm5F5sRtQJ+bUWRLJykgZGukZIguuws9zeqFoeHfy QUO3NvFsV5E5aigiZtCIeGfVThjH7ELCjcRWrPixnLo/0J5xUJZCM6qdVzIQJPBqduh5 xSB4/eECgPoOBsbUz90eoQapZ7JMBN4so3J3zjasK9QglzqPrUr48L0GGK9qMnozBTSX 6Wqha6k8XdBKTLC6o5Uy2WJTSXq5IaPJ5pi20vtgK3iBIiJasEnUO5KSlWQz+c6aNq7H JyQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697546424; x=1698151224; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1go1+s1mgfonK9oITafKnNr2oyG8bY2MnLUtwcvNu/E=; b=Z/7p9Ifca0T74NcQ6FLjynkKAjkRNoQGgLOaonUtscGS5LWqiOMs0pSDW4N94ySB/b 8QGQBrk34pAH9SIwaChvd+aiQRQpxQBIZWMIlOoZvozJhou7G0c9f8JNuszm99+DJ4JO FEWod7LBw3GOSmxRGrcMR4VC8GKy4nekt8NgdHufDQWUJegNTYvVuYz9z5SlLFXMYYRO GIpihVEhT2+jDfukNEqqq7WPrCUGAhR/UQmwd9mLgOHvyCWAMFiiKIuHtn2dGnluDcIw 87//1cVkvS3S00ugqnQtsUtBOGo9jJocQ8vekfPJLLQl1nIWRRBmM5hpeLQlsIz7KlPI aoCw== X-Gm-Message-State: AOJu0YyOs5ovQgwbpc9KS9KGgnh7/LfDe6biVNHbOG7boC5QlSRNNDxe mWvDciTWiiQ7v/5atxhqexE= X-Google-Smtp-Source: AGHT+IFaACminfVZMAM6mi8DZGRoe9jf+PlS6ZoKsH1wa0bGwwiO0cZz0WNUKUK7Ha3vZTD7sQt0aQ== X-Received: by 2002:a05:600c:245:b0:405:82c0:d9d9 with SMTP id 5-20020a05600c024500b0040582c0d9d9mr1650932wmj.41.1697546424222; Tue, 17 Oct 2023 05:40:24 -0700 (PDT) Received: from [192.168.0.101] ([77.126.80.27]) by smtp.gmail.com with ESMTPSA id u18-20020a05600c211200b00401d8181f8bsm9599250wml.25.2023.10.17.05.40.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Oct 2023 05:40:23 -0700 (PDT) Message-ID: <3d82e9a0-bae2-48dd-9bd7-941570748076@gmail.com> Date: Tue, 17 Oct 2023 15:40:19 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Larysa Zaremba , bpf@vger.kernel.org References: <20231012170524.21085-1-larysa.zaremba@intel.com> <20231012170524.21085-15-larysa.zaremba@intel.com> From: Tariq Toukan In-Reply-To: <20231012170524.21085-15-larysa.zaremba@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: GRZ47UTYF7NFTV43RCHRAC2BLSO5DFJ7 X-Message-ID-Hash: GRZ47UTYF7NFTV43RCHRAC2BLSO5DFJ7 X-MailFrom: ttoukan.linux@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org, Willem de Bruijn , Alexei Starovoitov , Simon Horman , Tariq Toukan , Saeed Mahameed , Maciej Fijalkowski X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v6 14/18] mlx5: implement VLAN tag XDP hint List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 12/10/2023 20:05, Larysa Zaremba wrote: > Implement the newly added .xmo_rx_vlan_tag() hint function. > > Signed-off-by: Larysa Zaremba > --- > 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 > + 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; > }