#include <linux/module.h>
#include <linux/types.h>
#include <linux/skbuff.h>
#include <linux/filter.h>
#include <linux/bpf.h>
#include <linux/idr.h>
#include <net/rtnetlink.h>
#include <net/pkt_cls.h>
#include <net/sock.h>
#include <net/tc_wrapper.h>
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
#define CLS_BPF_NAME_LEN …
#define CLS_BPF_SUPPORTED_GEN_FLAGS …
struct cls_bpf_head { … };
struct cls_bpf_prog { … };
static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = …;
static int cls_bpf_exec_opcode(int code)
{ … }
TC_INDIRECT_SCOPE int cls_bpf_classify(struct sk_buff *skb,
const struct tcf_proto *tp,
struct tcf_result *res)
{ … }
static bool cls_bpf_is_ebpf(const struct cls_bpf_prog *prog)
{ … }
static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
struct cls_bpf_prog *oldprog,
struct netlink_ext_ack *extack)
{ … }
static u32 cls_bpf_flags(u32 flags)
{ … }
static int cls_bpf_offload(struct tcf_proto *tp, struct cls_bpf_prog *prog,
struct cls_bpf_prog *oldprog,
struct netlink_ext_ack *extack)
{ … }
static void cls_bpf_stop_offload(struct tcf_proto *tp,
struct cls_bpf_prog *prog,
struct netlink_ext_ack *extack)
{ … }
static void cls_bpf_offload_update_stats(struct tcf_proto *tp,
struct cls_bpf_prog *prog)
{ … }
static int cls_bpf_init(struct tcf_proto *tp)
{ … }
static void cls_bpf_free_parms(struct cls_bpf_prog *prog)
{ … }
static void __cls_bpf_delete_prog(struct cls_bpf_prog *prog)
{ … }
static void cls_bpf_delete_prog_work(struct work_struct *work)
{ … }
static void __cls_bpf_delete(struct tcf_proto *tp, struct cls_bpf_prog *prog,
struct netlink_ext_ack *extack)
{ … }
static int cls_bpf_delete(struct tcf_proto *tp, void *arg, bool *last,
bool rtnl_held, struct netlink_ext_ack *extack)
{ … }
static void cls_bpf_destroy(struct tcf_proto *tp, bool rtnl_held,
struct netlink_ext_ack *extack)
{ … }
static void *cls_bpf_get(struct tcf_proto *tp, u32 handle)
{ … }
static int cls_bpf_prog_from_ops(struct nlattr **tb, struct cls_bpf_prog *prog)
{ … }
static int cls_bpf_prog_from_efd(struct nlattr **tb, struct cls_bpf_prog *prog,
u32 gen_flags, const struct tcf_proto *tp)
{ … }
static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
struct tcf_proto *tp, unsigned long base,
u32 handle, struct nlattr **tca,
void **arg, u32 flags,
struct netlink_ext_ack *extack)
{ … }
static int cls_bpf_dump_bpf_info(const struct cls_bpf_prog *prog,
struct sk_buff *skb)
{ … }
static int cls_bpf_dump_ebpf_info(const struct cls_bpf_prog *prog,
struct sk_buff *skb)
{ … }
static int cls_bpf_dump(struct net *net, struct tcf_proto *tp, void *fh,
struct sk_buff *skb, struct tcmsg *tm, bool rtnl_held)
{ … }
static void cls_bpf_bind_class(void *fh, u32 classid, unsigned long cl,
void *q, unsigned long base)
{ … }
static void cls_bpf_walk(struct tcf_proto *tp, struct tcf_walker *arg,
bool rtnl_held)
{ … }
static int cls_bpf_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb,
void *cb_priv, struct netlink_ext_ack *extack)
{ … }
static struct tcf_proto_ops cls_bpf_ops __read_mostly = …;
MODULE_ALIAS_NET_CLS(…) …;
static int __init cls_bpf_init_mod(void)
{ … }
static void __exit cls_bpf_exit_mod(void)
{ … }
module_init(…) …;
module_exit(cls_bpf_exit_mod);