mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-11 00:04:33 +08:00
d2f5bbbc35
The progs for bpf selftests use several different notations to force function inlining. Standardize to what most of them use, static __always_inline. Suggested-by: Song Liu <liu.song.a23@gmail.com> Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
31 lines
735 B
C
31 lines
735 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
// Copyright (c) 2019 Facebook
|
|
#include <linux/bpf.h>
|
|
#include "bpf_helpers.h"
|
|
#define ATTR __always_inline
|
|
#include "test_jhash.h"
|
|
|
|
SEC("scale90_inline")
|
|
int balancer_ingress(struct __sk_buff *ctx)
|
|
{
|
|
void *data_end = (void *)(long)ctx->data_end;
|
|
void *data = (void *)(long)ctx->data;
|
|
void *ptr;
|
|
int ret = 0, nh_off, i = 0;
|
|
|
|
nh_off = 14;
|
|
|
|
/* pragma unroll doesn't work on large loops */
|
|
|
|
#define C do { \
|
|
ptr = data + i; \
|
|
if (ptr + nh_off > data_end) \
|
|
break; \
|
|
ctx->tc_index = jhash(ptr, nh_off, ctx->cb[0] + i++); \
|
|
} while (0);
|
|
#define C30 C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;C;
|
|
C30;C30;C30; /* 90 calls */
|
|
return 0;
|
|
}
|
|
char _license[] SEC("license") = "GPL";
|