diff mbox series

[bpf-next,2/2] selftests/bpf: Remove unnecessary codes for updating h_proto of ethhdr

Message ID 678786447908dad330bb02e7124ea73938c366e1.1691639830.git.william.xuanziyang@huawei.com (mailing list archive)
State Rejected
Delegated to: BPF
Headers show
Series bpf: Update h_proto of ethhdr when the outer protocol changed | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ${{ matrix.test }} on ${{ matrix.arch }} with ${{ matrix.toolchain_full }}
bpf/vmtest-bpf-next-VM_Test-2 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-3 fail Logs for build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-4 fail Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-5 fail Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-6 fail Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-7 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-8 success Logs for veristat
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers warning 4 maintainers not CCed: willemb@google.com mykolal@fb.com shuah@kernel.org linux-kselftest@vger.kernel.org
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ziyang Xuan (William) Aug. 10, 2023, 6:25 a.m. UTC
Since updating h_proto of ethhdr in kernel, remove the codes
in user bpf program.

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
 .../selftests/bpf/progs/test_tc_tunnel.c       | 18 ------------------
 1 file changed, 18 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
index e6e678aa9874..a33be22a2dc4 100644
--- a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
+++ b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
@@ -236,17 +236,6 @@  static __always_inline int __encap_ipv4(struct __sk_buff *skb, __u8 encap_proto,
 				BPF_F_INVALIDATE_HASH) < 0)
 		return TC_ACT_SHOT;
 
-	/* if changing outer proto type, update eth->h_proto */
-	if (encap_proto == IPPROTO_IPV6) {
-		struct ethhdr eth;
-
-		if (bpf_skb_load_bytes(skb, 0, &eth, sizeof(eth)) < 0)
-			return TC_ACT_SHOT;
-		eth.h_proto = bpf_htons(ETH_P_IP);
-		if (bpf_skb_store_bytes(skb, 0, &eth, sizeof(eth), 0) < 0)
-			return TC_ACT_SHOT;
-	}
-
 	return TC_ACT_OK;
 }
 
@@ -412,13 +401,6 @@  static int encap_ipv6_ipip6(struct __sk_buff *skb)
 				BPF_F_INVALIDATE_HASH) < 0)
 		return TC_ACT_SHOT;
 
-	/* update eth->h_proto */
-	if (bpf_skb_load_bytes(skb, 0, &eth, sizeof(eth)) < 0)
-		return TC_ACT_SHOT;
-	eth.h_proto = bpf_htons(ETH_P_IPV6);
-	if (bpf_skb_store_bytes(skb, 0, &eth, sizeof(eth), 0) < 0)
-		return TC_ACT_SHOT;
-
 	return TC_ACT_OK;
 }