[PATCH] samples: bpf: xdp1: remove duplicate code to find protocol

From: Muhammad Falak R Wani
Date: Sun Aug 08 2021 - 08:28:41 EST


The code to find h_vlan_encapsulated_proto is duplicated.
Remove the extra block.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@xxxxxxxxx>
---
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