1121054Semax// SPDX-License-Identifier: GPL-2.0 2121054Semax// Copyright (c) 2019 Facebook 3121054Semax#include "vmlinux.h" 4121054Semax#include <bpf/bpf_helpers.h> 5121054Semax#define ATTR __always_inline 6121054Semax#include "test_jhash.h" 7121054Semax 8121054SemaxSEC("tc") 9121054Semaxint balancer_ingress(struct __sk_buff *ctx) 10121054Semax{ 11121054Semax void *data_end = (void *)(long)ctx->data_end; 12121054Semax void *data = (void *)(long)ctx->data; 13121054Semax void *ptr; 14121054Semax int nh_off, i = 0; 15121054Semax 16121054Semax nh_off = 14; 17121054Semax 18121054Semax /* pragma unroll doesn't work on large loops */ 19121054Semax 20121054Semax#define C do { \ 21121054Semax ptr = data + i; \ 22121054Semax if (ptr + nh_off > data_end) \ 23121054Semax break; \ 24121054Semax ctx->tc_index = jhash(ptr, nh_off, ctx->cb[0] + i++); \ 25121054Semax } while (0); 26121054Semax#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; 27121054Semax C30;C30;C30; /* 90 calls */ 28121054Semax return 0; 29121054Semax} 30121054Semaxchar _license[] SEC("license") = "GPL"; 31121054Semax