netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] samples: bpf: xdp2: remove duplicate code to find protocol
@ 2021-08-08 12:34 Muhammad Falak R Wani
  0 siblings, 0 replies; only message in thread
From: Muhammad Falak R Wani @ 2021-08-08 12:34 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, netdev, KP Singh, Yonghong Song, Song Liu, Martin KaFai Lau,
	John Fastabend, Jesper Dangaard Brouer, Jakub Kicinski,
	David S . Miller, linux-kernel, Muhammad Falak R Wani

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/xdp2_kern.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/samples/bpf/xdp2_kern.c b/samples/bpf/xdp2_kern.c
index c787f4b49646..be4b0c642a6b 100644
--- a/samples/bpf/xdp2_kern.c
+++ b/samples/bpf/xdp2_kern.c
@@ -73,15 +73,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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-08 12:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-08 12:34 [PATCH] samples: bpf: xdp2: remove duplicate code to find protocol Muhammad Falak R Wani

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).