Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 // Copyright (c) 2019 Facebook
0003 #include "vmlinux.h"
0004 #include <bpf/bpf_helpers.h>
0005 #define ATTR __always_inline
0006 #include "test_jhash.h"
0007 
0008 SEC("tc")
0009 int balancer_ingress(struct __sk_buff *ctx)
0010 {
0011     void *data_end = (void *)(long)ctx->data_end;
0012     void *data = (void *)(long)ctx->data;
0013     void *ptr;
0014     int ret = 0, nh_off, i = 0;
0015 
0016     nh_off = 14;
0017 
0018     /* pragma unroll doesn't work on large loops */
0019 
0020 #define C do { \
0021     ptr = data + i; \
0022     if (ptr + nh_off > data_end) \
0023         break; \
0024     ctx->tc_index = jhash(ptr, nh_off, ctx->cb[0] + i++); \
0025     } while (0);
0026 #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;
0027     C30;C30;C30; /* 90 calls */
0028     return 0;
0029 }
0030 char _license[] SEC("license") = "GPL";