From: Muhammad Falak R Wani <falakreyaz@gmail.com>
To: 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>, Yonghong Song <yhs@fb.com>,
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,
Muhammad Falak R Wani <falakreyaz@gmail.com>
Subject: [PATCH] samples: bpf: xdp1: remove duplicate code to find protocol
Date: Sun, 8 Aug 2021 17:54:11 +0530 [thread overview]
Message-ID: <20210808122411.10980-1-falakreyaz@gmail.com> (raw)
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;
- }
if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
struct vlan_hdr *vhdr;
--
2.17.1
next reply other threads:[~2021-08-08 12:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-08 12:24 Muhammad Falak R Wani [this message]
2021-08-08 16:53 ` [PATCH] samples: bpf: xdp1: remove duplicate code to find protocol Yonghong Song
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=20210808122411.10980-1-falakreyaz@gmail.com \
--to=falakreyaz@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--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 \
--cc=yhs@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).