18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci// Copyright (c) 2019 Facebook 38c2ecf20Sopenharmony_ci#include <linux/bpf.h> 48c2ecf20Sopenharmony_ci#include <bpf/bpf_helpers.h> 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_cichar _license[] SEC("license") = "GPL"; 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ciSEC("socket") 98c2ecf20Sopenharmony_ciint combinations(volatile struct __sk_buff* skb) 108c2ecf20Sopenharmony_ci{ 118c2ecf20Sopenharmony_ci int ret = 0, i; 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#pragma nounroll 148c2ecf20Sopenharmony_ci for (i = 0; i < 20; i++) 158c2ecf20Sopenharmony_ci if (skb->len) 168c2ecf20Sopenharmony_ci ret |= 1 << i; 178c2ecf20Sopenharmony_ci return ret; 188c2ecf20Sopenharmony_ci} 19