From: Yonghong Song <yhs@fb.com>
To: Muhammad Falak R Wani <falakreyaz@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>
Cc: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>,
KP Singh <kpsingh@kernel.org>, Song Liu <songliubraving@fb.com>,
Martin KaFai Lau <kafai@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] samples: bpf: xdp1: remove duplicate code to find protocol
Date: Sun, 8 Aug 2021 09:53:41 -0700 [thread overview]
Message-ID: <be9121ef-cea7-d3f9-b1cf-edd9e4e1a756@fb.com> (raw)
In-Reply-To: <20210808122411.10980-1-falakreyaz@gmail.com>
On 8/8/21 5:24 AM, Muhammad Falak R Wani wrote:
> The code to find h_vlan_encapsulated_proto is duplicated.
> Remove the extra block.
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
> ---
> samples/bpf/xdp1_kern.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/samples/bpf/xdp1_kern.c b/samples/bpf/xdp1_kern.c
> index 34b64394ed9c..a35e064d7726 100644
> --- a/samples/bpf/xdp1_kern.c
> +++ b/samples/bpf/xdp1_kern.c
> @@ -57,15 +57,6 @@ int xdp_prog1(struct xdp_md *ctx)
>
> h_proto = eth->h_proto;
>
> - if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
> - struct vlan_hdr *vhdr;
> -
> - vhdr = data + nh_off;
> - nh_off += sizeof(struct vlan_hdr);
> - if (data + nh_off > data_end)
> - return rc;
> - h_proto = vhdr->h_vlan_encapsulated_proto;
No. This is not a duplicate. The h_proto in the above line will be used
in the below "if" condition.
> - }
> if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
> struct vlan_hdr *vhdr;
>
>
next prev parent reply other threads:[~2021-08-08 16:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-08 12:24 [PATCH] samples: bpf: xdp1: remove duplicate code to find protocol Muhammad Falak R Wani
2021-08-08 16:53 ` Yonghong Song [this message]
2021-08-08 17:19 ` Muhammad Falak Reyaz
2021-08-09 0:01 ` Yonghong Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=be9121ef-cea7-d3f9-b1cf-edd9e4e1a756@fb.com \
--to=yhs@fb.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=falakreyaz@gmail.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).