1139825Simp// SPDX-License-Identifier: GPL-2.0 21541Srgrimes// Copyright (c) 2019 Facebook 31541Srgrimes#include "vmlinux.h" 41541Srgrimes#include <bpf/bpf_helpers.h> 51541Srgrimes#define ATTR __always_inline 61541Srgrimes#include "test_jhash.h" 71541Srgrimes 81541SrgrimesSEC("tc") 91541Srgrimesint balancer_ingress(struct __sk_buff *ctx) 101541Srgrimes{ 111541Srgrimes void *data_end = (void *)(long)ctx->data_end; 121541Srgrimes void *data = (void *)(long)ctx->data; 13203964Simp void *ptr; 141541Srgrimes int nh_off, i = 0; 151541Srgrimes 161541Srgrimes nh_off = 14; 171541Srgrimes 181541Srgrimes /* pragma unroll doesn't work on large loops */ 191541Srgrimes 201541Srgrimes#define C do { \ 211541Srgrimes ptr = data + i; \ 221541Srgrimes if (ptr + nh_off > data_end) \ 231541Srgrimes break; \ 241541Srgrimes ctx->tc_index = jhash(ptr, nh_off, ctx->cb[0] + i++); \ 251541Srgrimes } while (0); 261541Srgrimes#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; 271541Srgrimes C30;C30;C30; /* 90 calls */ 281541Srgrimes return 0; 291541Srgrimes} 3050477Speterchar _license[] SEC("license") = "GPL"; 311541Srgrimes