#ifndef _NET_FLOW_OFFLOAD_H
#define _NET_FLOW_OFFLOAD_H
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/netlink.h>
#include <net/flow_dissector.h>
struct flow_match { … };
struct flow_match_meta { … };
struct flow_match_basic { … };
struct flow_match_control { … };
struct flow_match_eth_addrs { … };
struct flow_match_vlan { … };
struct flow_match_arp { … };
struct flow_match_ipv4_addrs { … };
struct flow_match_ipv6_addrs { … };
struct flow_match_ip { … };
struct flow_match_ports { … };
struct flow_match_ports_range { … };
struct flow_match_icmp { … };
struct flow_match_tcp { … };
struct flow_match_ipsec { … };
struct flow_match_mpls { … };
struct flow_match_enc_keyid { … };
struct flow_match_enc_opts { … };
struct flow_match_ct { … };
struct flow_match_pppoe { … };
struct flow_match_l2tpv3 { … };
struct flow_rule;
void flow_rule_match_meta(const struct flow_rule *rule,
struct flow_match_meta *out);
void flow_rule_match_basic(const struct flow_rule *rule,
struct flow_match_basic *out);
void flow_rule_match_control(const struct flow_rule *rule,
struct flow_match_control *out);
void flow_rule_match_eth_addrs(const struct flow_rule *rule,
struct flow_match_eth_addrs *out);
void flow_rule_match_vlan(const struct flow_rule *rule,
struct flow_match_vlan *out);
void flow_rule_match_cvlan(const struct flow_rule *rule,
struct flow_match_vlan *out);
void flow_rule_match_arp(const struct flow_rule *rule,
struct flow_match_arp *out);
void flow_rule_match_ipv4_addrs(const struct flow_rule *rule,
struct flow_match_ipv4_addrs *out);
void flow_rule_match_ipv6_addrs(const struct flow_rule *rule,
struct flow_match_ipv6_addrs *out);
void flow_rule_match_ip(const struct flow_rule *rule,
struct flow_match_ip *out);
void flow_rule_match_ports(const struct flow_rule *rule,
struct flow_match_ports *out);
void flow_rule_match_ports_range(const struct flow_rule *rule,
struct flow_match_ports_range *out);
void flow_rule_match_tcp(const struct flow_rule *rule,
struct flow_match_tcp *out);
void flow_rule_match_ipsec(const struct flow_rule *rule,
struct flow_match_ipsec *out);
void flow_rule_match_icmp(const struct flow_rule *rule,
struct flow_match_icmp *out);
void flow_rule_match_mpls(const struct flow_rule *rule,
struct flow_match_mpls *out);
void flow_rule_match_enc_control(const struct flow_rule *rule,
struct flow_match_control *out);
void flow_rule_match_enc_ipv4_addrs(const struct flow_rule *rule,
struct flow_match_ipv4_addrs *out);
void flow_rule_match_enc_ipv6_addrs(const struct flow_rule *rule,
struct flow_match_ipv6_addrs *out);
void flow_rule_match_enc_ip(const struct flow_rule *rule,
struct flow_match_ip *out);
void flow_rule_match_enc_ports(const struct flow_rule *rule,
struct flow_match_ports *out);
void flow_rule_match_enc_keyid(const struct flow_rule *rule,
struct flow_match_enc_keyid *out);
void flow_rule_match_enc_opts(const struct flow_rule *rule,
struct flow_match_enc_opts *out);
void flow_rule_match_ct(const struct flow_rule *rule,
struct flow_match_ct *out);
void flow_rule_match_pppoe(const struct flow_rule *rule,
struct flow_match_pppoe *out);
void flow_rule_match_l2tpv3(const struct flow_rule *rule,
struct flow_match_l2tpv3 *out);
enum flow_action_id { … };
enum flow_action_mangle_base { … };
enum flow_action_hw_stats_bit { … };
enum flow_action_hw_stats { … };
action_destr;
struct flow_action_cookie { … };
struct flow_action_cookie *flow_action_cookie_create(void *data,
unsigned int len,
gfp_t gfp);
void flow_action_cookie_destroy(struct flow_action_cookie *cookie);
struct flow_action_entry { … };
struct flow_action { … };
static inline bool flow_action_has_entries(const struct flow_action *action)
{ … }
static inline bool flow_offload_has_one_action(const struct flow_action *action)
{ … }
static inline bool flow_action_is_last_entry(const struct flow_action *action,
const struct flow_action_entry *entry)
{ … }
#define flow_action_for_each(__i, __act, __actions) …
static inline bool
flow_action_mixed_hw_stats_check(const struct flow_action *action,
struct netlink_ext_ack *extack)
{ … }
static inline const struct flow_action_entry *
flow_action_first_entry_get(const struct flow_action *action)
{ … }
static inline bool
__flow_action_hw_stats_check(const struct flow_action *action,
struct netlink_ext_ack *extack,
bool check_allow_bit,
enum flow_action_hw_stats_bit allow_bit)
{ … }
static inline bool
flow_action_hw_stats_check(const struct flow_action *action,
struct netlink_ext_ack *extack,
enum flow_action_hw_stats_bit allow_bit)
{ … }
static inline bool
flow_action_basic_hw_stats_check(const struct flow_action *action,
struct netlink_ext_ack *extack)
{ … }
struct flow_rule { … };
struct flow_rule *flow_rule_alloc(unsigned int num_actions);
static inline bool flow_rule_match_key(const struct flow_rule *rule,
enum flow_dissector_key_id key)
{ … }
static inline bool flow_rule_is_supp_control_flags(const u32 supp_flags,
const u32 ctrl_flags,
struct netlink_ext_ack *extack)
{ … }
static inline bool flow_rule_is_supp_enc_control_flags(const u32 supp_enc_flags,
const u32 enc_ctrl_flags,
struct netlink_ext_ack *extack)
{ … }
static inline bool flow_rule_has_control_flags(const u32 ctrl_flags,
struct netlink_ext_ack *extack)
{ … }
static inline bool flow_rule_has_enc_control_flags(const u32 enc_ctrl_flags,
struct netlink_ext_ack *extack)
{ … }
static inline bool flow_rule_match_has_control_flags(struct flow_rule *rule,
struct netlink_ext_ack *extack)
{ … }
struct flow_stats { … };
static inline void flow_stats_update(struct flow_stats *flow_stats,
u64 bytes, u64 pkts,
u64 drops, u64 lastused,
enum flow_action_hw_stats used_hw_stats)
{ … }
enum flow_block_command { … };
enum flow_block_binder_type { … };
struct flow_block { … };
struct netlink_ext_ack;
struct flow_block_offload { … };
enum tc_setup_type;
flow_setup_cb_t;
struct flow_block_cb;
struct flow_block_indr { … };
struct flow_block_cb { … };
struct flow_block_cb *flow_block_cb_alloc(flow_setup_cb_t *cb,
void *cb_ident, void *cb_priv,
void (*release)(void *cb_priv));
struct flow_block_cb *flow_indr_block_cb_alloc(flow_setup_cb_t *cb,
void *cb_ident, void *cb_priv,
void (*release)(void *cb_priv),
struct flow_block_offload *bo,
struct net_device *dev,
struct Qdisc *sch, void *data,
void *indr_cb_priv,
void (*cleanup)(struct flow_block_cb *block_cb));
void flow_block_cb_free(struct flow_block_cb *block_cb);
struct flow_block_cb *flow_block_cb_lookup(struct flow_block *block,
flow_setup_cb_t *cb, void *cb_ident);
void *flow_block_cb_priv(struct flow_block_cb *block_cb);
void flow_block_cb_incref(struct flow_block_cb *block_cb);
unsigned int flow_block_cb_decref(struct flow_block_cb *block_cb);
static inline void flow_block_cb_add(struct flow_block_cb *block_cb,
struct flow_block_offload *offload)
{ … }
static inline void flow_block_cb_remove(struct flow_block_cb *block_cb,
struct flow_block_offload *offload)
{ … }
static inline void flow_indr_block_cb_remove(struct flow_block_cb *block_cb,
struct flow_block_offload *offload)
{ … }
bool flow_block_cb_is_busy(flow_setup_cb_t *cb, void *cb_ident,
struct list_head *driver_block_list);
int flow_block_cb_setup_simple(struct flow_block_offload *f,
struct list_head *driver_list,
flow_setup_cb_t *cb,
void *cb_ident, void *cb_priv, bool ingress_only);
enum flow_cls_command { … };
struct flow_cls_common_offload { … };
struct flow_cls_offload { … };
enum offload_act_command { … };
struct flow_offload_action { … };
struct flow_offload_action *offload_action_alloc(unsigned int num_actions);
static inline struct flow_rule *
flow_cls_offload_flow_rule(struct flow_cls_offload *flow_cmd)
{ … }
static inline void flow_block_init(struct flow_block *flow_block)
{ … }
flow_indr_block_bind_cb_t;
int flow_indr_dev_register(flow_indr_block_bind_cb_t *cb, void *cb_priv);
void flow_indr_dev_unregister(flow_indr_block_bind_cb_t *cb, void *cb_priv,
void (*release)(void *cb_priv));
int flow_indr_dev_setup_offload(struct net_device *dev, struct Qdisc *sch,
enum tc_setup_type type, void *data,
struct flow_block_offload *bo,
void (*cleanup)(struct flow_block_cb *block_cb));
bool flow_indr_dev_exists(void);
#endif