#ifndef __NET_TCX_H
#define __NET_TCX_H
#include <linux/bpf.h>
#include <linux/bpf_mprog.h>
#include <net/sch_generic.h>
struct mini_Qdisc;
struct tcx_entry { … };
struct tcx_link { … };
static inline void tcx_set_ingress(struct sk_buff *skb, bool ingress)
{ … }
#ifdef CONFIG_NET_XGRESS
static inline struct tcx_entry *tcx_entry(struct bpf_mprog_entry *entry)
{ … }
static inline struct tcx_link *tcx_link(const struct bpf_link *link)
{ … }
void tcx_inc(void);
void tcx_dec(void);
static inline void tcx_entry_sync(void)
{ … }
static inline void
tcx_entry_update(struct net_device *dev, struct bpf_mprog_entry *entry,
bool ingress)
{ … }
static inline struct bpf_mprog_entry *
tcx_entry_fetch(struct net_device *dev, bool ingress)
{ … }
static inline struct bpf_mprog_entry *tcx_entry_create_noprof(void)
{ … }
#define tcx_entry_create(...) …
static inline void tcx_entry_free(struct bpf_mprog_entry *entry)
{ … }
static inline struct bpf_mprog_entry *
tcx_entry_fetch_or_create(struct net_device *dev, bool ingress, bool *created)
{ … }
static inline void tcx_skeys_inc(bool ingress)
{ … }
static inline void tcx_skeys_dec(bool ingress)
{ … }
static inline void tcx_miniq_inc(struct bpf_mprog_entry *entry)
{ … }
static inline void tcx_miniq_dec(struct bpf_mprog_entry *entry)
{ … }
static inline bool tcx_entry_is_active(struct bpf_mprog_entry *entry)
{ … }
static inline enum tcx_action_base tcx_action_code(struct sk_buff *skb,
int code)
{ … }
#endif
#if defined(CONFIG_NET_XGRESS) && defined(CONFIG_BPF_SYSCALL)
int tcx_prog_attach(const union bpf_attr *attr, struct bpf_prog *prog);
int tcx_link_attach(const union bpf_attr *attr, struct bpf_prog *prog);
int tcx_prog_detach(const union bpf_attr *attr, struct bpf_prog *prog);
void tcx_uninstall(struct net_device *dev, bool ingress);
int tcx_prog_query(const union bpf_attr *attr,
union bpf_attr __user *uattr);
static inline void dev_tcx_uninstall(struct net_device *dev)
{ … }
#else
static inline int tcx_prog_attach(const union bpf_attr *attr,
struct bpf_prog *prog)
{
return -EINVAL;
}
static inline int tcx_link_attach(const union bpf_attr *attr,
struct bpf_prog *prog)
{
return -EINVAL;
}
static inline int tcx_prog_detach(const union bpf_attr *attr,
struct bpf_prog *prog)
{
return -EINVAL;
}
static inline int tcx_prog_query(const union bpf_attr *attr,
union bpf_attr __user *uattr)
{
return -EINVAL;
}
static inline void dev_tcx_uninstall(struct net_device *dev)
{
}
#endif
#endif