diff options
| author | Mark Brown <broonie@kernel.org> | 2026-09-30 13:13:36 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-09-30 13:13:36 +0100 |
| commit | 1d2642c1a986c32241604d53f259795e0bed8f35 (patch) | |
| tree | fa69d29714f4b6b72387132aacb20f3950edcc5b /samples | |
| parent | 88d6478ff3a017842c6fafba826a38752c13bc5f (diff) | |
| parent | acff58e305175df35985082b0e79103a2497f702 (diff) | |
| download | linux-next-1d2642c1a986c32241604d53f259795e0bed8f35.tar.gz linux-next-1d2642c1a986c32241604d53f259795e0bed8f35.zip | |
Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
# Conflicts:
# arch/arm64/net/bpf_jit_comp.c
# arch/x86/net/bpf_jit_comp.c
# mm/internal.h
Diffstat (limited to 'samples')
| -rw-r--r-- | samples/bpf/Makefile | 1 | ||||
| -rw-r--r-- | samples/bpf/hash_func01.h | 55 |
2 files changed, 1 insertions, 55 deletions
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 95a4fa1f1e44..c28e65046986 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -342,6 +342,7 @@ $(obj)/xdp_router_ipv4.bpf.o: $(obj)/xdp_sample.bpf.o $(obj)/%.bpf.o: $(src)/%.bpf.c $(obj)/vmlinux.h $(src)/xdp_sample.bpf.h $(src)/xdp_sample_shared.h @echo " CLANG-BPF " $@ $(Q)$(CLANG) -g -O2 --target=bpf -D__TARGET_ARCH_$(SRCARCH) \ + -fms-extensions -Wno-microsoft-anon-tag \ -Wno-compare-distinct-pointer-types -I$(srctree)/include \ -I$(srctree)/samples/bpf -I$(srctree)/tools/include \ -I$(LIBBPF_INCLUDE) $(CLANG_SYS_INCLUDES) \ diff --git a/samples/bpf/hash_func01.h b/samples/bpf/hash_func01.h deleted file mode 100644 index 38255812e376..000000000000 --- a/samples/bpf/hash_func01.h +++ /dev/null @@ -1,55 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1 - * - * Based on Paul Hsieh's (LGPG 2.1) hash function - * From: http://www.azillionmonkeys.com/qed/hash.html - */ - -#define get16bits(d) (*((const __u16 *) (d))) - -static __always_inline -__u32 SuperFastHash (const char *data, int len, __u32 initval) { - __u32 hash = initval; - __u32 tmp; - int rem; - - if (len <= 0 || data == NULL) return 0; - - rem = len & 3; - len >>= 2; - - /* Main loop */ -#pragma clang loop unroll(full) - for (;len > 0; len--) { - hash += get16bits (data); - tmp = (get16bits (data+2) << 11) ^ hash; - hash = (hash << 16) ^ tmp; - data += 2*sizeof (__u16); - hash += hash >> 11; - } - - /* Handle end cases */ - switch (rem) { - case 3: hash += get16bits (data); - hash ^= hash << 16; - hash ^= ((signed char)data[sizeof (__u16)]) << 18; - hash += hash >> 11; - break; - case 2: hash += get16bits (data); - hash ^= hash << 11; - hash += hash >> 17; - break; - case 1: hash += (signed char)*data; - hash ^= hash << 10; - hash += hash >> 1; - } - - /* Force "avalanching" of final 127 bits */ - hash ^= hash << 3; - hash += hash >> 5; - hash ^= hash << 4; - hash += hash >> 17; - hash ^= hash << 25; - hash += hash >> 6; - - return hash; -} |
