Skip to contentSkip to conversation

samples: bpf: xdp2: remove duplicate code to find protocol

PATCH New Muhammad Falak R Wani 1 participant 1 message Aug 8, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 samples: bpf: xdp2: remove duplicate code to find protocol

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

---
 samples/bpf/xdp2_kern.c | 9 ---------
 1 file changed, 9 deletions(-)
samples/bpf/xdp2_kern.c +0 -9
index c787f4b49646..be4b0c642a6b 100644
@@ -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;
 
Signature · 1 line
2.17.1