linux/net/sched/cls_flower.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * net/sched/cls_flower.c		Flower classifier
 *
 * Copyright (c) 2015 Jiri Pirko <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/rhashtable.h>
#include <linux/workqueue.h>
#include <linux/refcount.h>
#include <linux/bitfield.h>

#include <linux/if_ether.h>
#include <linux/in6.h>
#include <linux/ip.h>
#include <linux/mpls.h>
#include <linux/ppp_defs.h>

#include <net/sch_generic.h>
#include <net/pkt_cls.h>
#include <net/pkt_sched.h>
#include <net/ip.h>
#include <net/flow_dissector.h>
#include <net/geneve.h>
#include <net/vxlan.h>
#include <net/erspan.h>
#include <net/gtp.h>
#include <net/pfcp.h>
#include <net/tc_wrapper.h>

#include <net/dst.h>
#include <net/dst_metadata.h>

#include <uapi/linux/netfilter/nf_conntrack_common.h>

#define TCA_FLOWER_KEY_CT_FLAGS_MAX
#define TCA_FLOWER_KEY_CT_FLAGS_MASK

#define TCA_FLOWER_KEY_FLAGS_POLICY_MASK

#define TCA_FLOWER_KEY_ENC_FLAGS_POLICY_MASK

struct fl_flow_key {} __aligned(); /* Ensure that we can do comparisons as longs. */

struct fl_flow_mask_range {};

struct fl_flow_mask {};

struct fl_flow_tmplt {};

struct cls_fl_head {};

struct cls_fl_filter {};

static const struct rhashtable_params mask_ht_params =;

static unsigned short int fl_mask_range(const struct fl_flow_mask *mask)
{}

static void fl_mask_update_range(struct fl_flow_mask *mask)
{}

static void *fl_key_get_start(struct fl_flow_key *key,
			      const struct fl_flow_mask *mask)
{}

static void fl_set_masked_key(struct fl_flow_key *mkey, struct fl_flow_key *key,
			      struct fl_flow_mask *mask)
{}

static bool fl_mask_fits_tmplt(struct fl_flow_tmplt *tmplt,
			       struct fl_flow_mask *mask)
{}

static void fl_clear_masked_range(struct fl_flow_key *key,
				  struct fl_flow_mask *mask)
{}

static bool fl_range_port_dst_cmp(struct cls_fl_filter *filter,
				  struct fl_flow_key *key,
				  struct fl_flow_key *mkey)
{}

static bool fl_range_port_src_cmp(struct cls_fl_filter *filter,
				  struct fl_flow_key *key,
				  struct fl_flow_key *mkey)
{}

static struct cls_fl_filter *__fl_lookup(struct fl_flow_mask *mask,
					 struct fl_flow_key *mkey)
{}

static struct cls_fl_filter *fl_lookup_range(struct fl_flow_mask *mask,
					     struct fl_flow_key *mkey,
					     struct fl_flow_key *key)
{}

static noinline_for_stack
struct cls_fl_filter *fl_mask_lookup(struct fl_flow_mask *mask, struct fl_flow_key *key)
{}

static u16 fl_ct_info_to_flower_map[] =;

TC_INDIRECT_SCOPE int fl_classify(struct sk_buff *skb,
				  const struct tcf_proto *tp,
				  struct tcf_result *res)
{}

static int fl_init(struct tcf_proto *tp)
{}

static void fl_mask_free(struct fl_flow_mask *mask, bool mask_init_done)
{}

static void fl_mask_free_work(struct work_struct *work)
{}

static void fl_uninit_mask_free_work(struct work_struct *work)
{}

static bool fl_mask_put(struct cls_fl_head *head, struct fl_flow_mask *mask)
{}

static struct cls_fl_head *fl_head_dereference(struct tcf_proto *tp)
{}

static void __fl_destroy_filter(struct cls_fl_filter *f)
{}

static void fl_destroy_filter_work(struct work_struct *work)
{}

static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f,
				 bool rtnl_held, struct netlink_ext_ack *extack)
{}

static int fl_hw_replace_filter(struct tcf_proto *tp,
				struct cls_fl_filter *f, bool rtnl_held,
				struct netlink_ext_ack *extack)
{}

static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f,
			       bool rtnl_held)
{}

static void __fl_put(struct cls_fl_filter *f)
{}

static struct cls_fl_filter *__fl_get(struct cls_fl_head *head, u32 handle)
{}

static struct tcf_exts *fl_get_exts(const struct tcf_proto *tp, u32 handle)
{}

static int __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f,
		       bool *last, bool rtnl_held,
		       struct netlink_ext_ack *extack)
{}

static void fl_destroy_sleepable(struct work_struct *work)
{}

static void fl_destroy(struct tcf_proto *tp, bool rtnl_held,
		       struct netlink_ext_ack *extack)
{}

static void fl_put(struct tcf_proto *tp, void *arg)
{}

static void *fl_get(struct tcf_proto *tp, u32 handle)
{}

static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] =;

static const struct nla_policy
enc_opts_policy[TCA_FLOWER_KEY_ENC_OPTS_MAX + 1] =;

static const struct nla_policy
geneve_opt_policy[TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX + 1] =;

static const struct nla_policy
vxlan_opt_policy[TCA_FLOWER_KEY_ENC_OPT_VXLAN_MAX + 1] =;

static const struct nla_policy
erspan_opt_policy[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_MAX + 1] =;

static const struct nla_policy
gtp_opt_policy[TCA_FLOWER_KEY_ENC_OPT_GTP_MAX + 1] =;

static const struct nla_policy
pfcp_opt_policy[TCA_FLOWER_KEY_ENC_OPT_PFCP_MAX + 1] =;

static const struct nla_policy
mpls_stack_entry_policy[TCA_FLOWER_KEY_MPLS_OPT_LSE_MAX + 1] =;

static const struct nla_policy
cfm_opt_policy[TCA_FLOWER_KEY_CFM_OPT_MAX + 1] =;

static void fl_set_key_val(struct nlattr **tb,
			   void *val, int val_type,
			   void *mask, int mask_type, int len)
{}

static int fl_set_key_spi(struct nlattr **tb, struct fl_flow_key *key,
			  struct fl_flow_key *mask,
			  struct netlink_ext_ack *extack)
{}

static int fl_set_key_port_range(struct nlattr **tb, struct fl_flow_key *key,
				 struct fl_flow_key *mask,
				 struct netlink_ext_ack *extack)
{}

static int fl_set_key_mpls_lse(const struct nlattr *nla_lse,
			       struct flow_dissector_key_mpls *key_val,
			       struct flow_dissector_key_mpls *key_mask,
			       struct netlink_ext_ack *extack)
{}

static int fl_set_key_mpls_opts(const struct nlattr *nla_mpls_opts,
				struct flow_dissector_key_mpls *key_val,
				struct flow_dissector_key_mpls *key_mask,
				struct netlink_ext_ack *extack)
{}

static int fl_set_key_mpls(struct nlattr **tb,
			   struct flow_dissector_key_mpls *key_val,
			   struct flow_dissector_key_mpls *key_mask,
			   struct netlink_ext_ack *extack)
{}

static void fl_set_key_vlan(struct nlattr **tb,
			    __be16 ethertype,
			    int vlan_id_key, int vlan_prio_key,
			    int vlan_next_eth_type_key,
			    struct flow_dissector_key_vlan *key_val,
			    struct flow_dissector_key_vlan *key_mask)
{}

static void fl_set_key_pppoe(struct nlattr **tb,
			     struct flow_dissector_key_pppoe *key_val,
			     struct flow_dissector_key_pppoe *key_mask,
			     struct fl_flow_key *key,
			     struct fl_flow_key *mask)
{}

static void fl_set_key_flag(u32 flower_key, u32 flower_mask,
			    u32 *dissector_key, u32 *dissector_mask,
			    u32 flower_flag_bit, u32 dissector_flag_bit)
{}

static int fl_set_key_flags(struct nlattr *tca_opts, struct nlattr **tb,
			    bool encap, u32 *flags_key, u32 *flags_mask,
			    struct netlink_ext_ack *extack)
{}

static void fl_set_key_ip(struct nlattr **tb, bool encap,
			  struct flow_dissector_key_ip *key,
			  struct flow_dissector_key_ip *mask)
{}

static int fl_set_geneve_opt(const struct nlattr *nla, struct fl_flow_key *key,
			     int depth, int option_len,
			     struct netlink_ext_ack *extack)
{}

static int fl_set_vxlan_opt(const struct nlattr *nla, struct fl_flow_key *key,
			    int depth, int option_len,
			    struct netlink_ext_ack *extack)
{}

static int fl_set_erspan_opt(const struct nlattr *nla, struct fl_flow_key *key,
			     int depth, int option_len,
			     struct netlink_ext_ack *extack)
{}

static int fl_set_gtp_opt(const struct nlattr *nla, struct fl_flow_key *key,
			  int depth, int option_len,
			  struct netlink_ext_ack *extack)
{}

static int fl_set_pfcp_opt(const struct nlattr *nla, struct fl_flow_key *key,
			   int depth, int option_len,
			   struct netlink_ext_ack *extack)
{}

static int fl_set_enc_opt(struct nlattr **tb, struct fl_flow_key *key,
			  struct fl_flow_key *mask,
			  struct netlink_ext_ack *extack)
{}

static int fl_validate_ct_state(u16 state, struct nlattr *tb,
				struct netlink_ext_ack *extack)
{}

static int fl_set_key_ct(struct nlattr **tb,
			 struct flow_dissector_key_ct *key,
			 struct flow_dissector_key_ct *mask,
			 struct netlink_ext_ack *extack)
{}

static bool is_vlan_key(struct nlattr *tb, __be16 *ethertype,
			struct fl_flow_key *key, struct fl_flow_key *mask,
			int vthresh)
{}

static void fl_set_key_cfm_md_level(struct nlattr **tb,
				    struct fl_flow_key *key,
				    struct fl_flow_key *mask,
				    struct netlink_ext_ack *extack)
{}

static void fl_set_key_cfm_opcode(struct nlattr **tb,
				  struct fl_flow_key *key,
				  struct fl_flow_key *mask,
				  struct netlink_ext_ack *extack)
{}

static int fl_set_key_cfm(struct nlattr **tb,
			  struct fl_flow_key *key,
			  struct fl_flow_key *mask,
			  struct netlink_ext_ack *extack)
{}

static int fl_set_key(struct net *net, struct nlattr *tca_opts,
		      struct nlattr **tb, struct fl_flow_key *key,
		      struct fl_flow_key *mask, struct netlink_ext_ack *extack)
{}

static void fl_mask_copy(struct fl_flow_mask *dst,
			 struct fl_flow_mask *src)
{}

static const struct rhashtable_params fl_ht_params =;

static int fl_init_mask_hashtable(struct fl_flow_mask *mask)
{}

#define FL_KEY_MEMBER_OFFSET(member)
#define FL_KEY_MEMBER_SIZE(member)

#define FL_KEY_IS_MASKED(mask, member)				\

#define FL_KEY_SET(keys, cnt, id, member)

#define FL_KEY_SET_IF_MASKED(mask, keys, cnt, id, member)

static void fl_init_dissector(struct flow_dissector *dissector,
			      struct fl_flow_key *mask)
{}

static struct fl_flow_mask *fl_create_new_mask(struct cls_fl_head *head,
					       struct fl_flow_mask *mask)
{}

static int fl_check_assign_mask(struct cls_fl_head *head,
				struct cls_fl_filter *fnew,
				struct cls_fl_filter *fold,
				struct fl_flow_mask *mask)
{}

static bool fl_needs_tc_skb_ext(const struct fl_flow_key *mask)
{}

static int fl_ht_insert_unique(struct cls_fl_filter *fnew,
			       struct cls_fl_filter *fold,
			       bool *in_ht)
{}

static int fl_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 fl_delete(struct tcf_proto *tp, void *arg, bool *last,
		     bool rtnl_held, struct netlink_ext_ack *extack)
{}

static void fl_walk(struct tcf_proto *tp, struct tcf_walker *arg,
		    bool rtnl_held)
{}

static struct cls_fl_filter *
fl_get_next_hw_filter(struct tcf_proto *tp, struct cls_fl_filter *f, bool add)
{}

static int fl_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb,
			void *cb_priv, struct netlink_ext_ack *extack)
{}

static void fl_hw_add(struct tcf_proto *tp, void *type_data)
{}

static void fl_hw_del(struct tcf_proto *tp, void *type_data)
{}

static int fl_hw_create_tmplt(struct tcf_chain *chain,
			      struct fl_flow_tmplt *tmplt)
{}

static void fl_hw_destroy_tmplt(struct tcf_chain *chain,
				struct fl_flow_tmplt *tmplt)
{}

static void *fl_tmplt_create(struct net *net, struct tcf_chain *chain,
			     struct nlattr **tca,
			     struct netlink_ext_ack *extack)
{}

static void fl_tmplt_destroy(void *tmplt_priv)
{}

static void fl_tmplt_reoffload(struct tcf_chain *chain, bool add,
			       flow_setup_cb_t *cb, void *cb_priv)
{}

static int fl_dump_key_val(struct sk_buff *skb,
			   void *val, int val_type,
			   void *mask, int mask_type, int len)
{}

static int fl_dump_key_port_range(struct sk_buff *skb, struct fl_flow_key *key,
				  struct fl_flow_key *mask)
{}

static int fl_dump_key_mpls_opt_lse(struct sk_buff *skb,
				    struct flow_dissector_key_mpls *mpls_key,
				    struct flow_dissector_key_mpls *mpls_mask,
				    u8 lse_index)
{}

static int fl_dump_key_mpls_opts(struct sk_buff *skb,
				 struct flow_dissector_key_mpls *mpls_key,
				 struct flow_dissector_key_mpls *mpls_mask)
{}

static int fl_dump_key_mpls(struct sk_buff *skb,
			    struct flow_dissector_key_mpls *mpls_key,
			    struct flow_dissector_key_mpls *mpls_mask)
{}

static int fl_dump_key_ip(struct sk_buff *skb, bool encap,
			  struct flow_dissector_key_ip *key,
			  struct flow_dissector_key_ip *mask)
{}

static int fl_dump_key_vlan(struct sk_buff *skb,
			    int vlan_id_key, int vlan_prio_key,
			    struct flow_dissector_key_vlan *vlan_key,
			    struct flow_dissector_key_vlan *vlan_mask)
{}

static void fl_get_key_flag(u32 dissector_key, u32 dissector_mask,
			    u32 *flower_key, u32 *flower_mask,
			    u32 flower_flag_bit, u32 dissector_flag_bit)
{}

static int fl_dump_key_flags(struct sk_buff *skb, bool encap,
			     u32 flags_key, u32 flags_mask)
{}

static int fl_dump_key_geneve_opt(struct sk_buff *skb,
				  struct flow_dissector_key_enc_opts *enc_opts)
{}

static int fl_dump_key_vxlan_opt(struct sk_buff *skb,
				 struct flow_dissector_key_enc_opts *enc_opts)
{}

static int fl_dump_key_erspan_opt(struct sk_buff *skb,
				  struct flow_dissector_key_enc_opts *enc_opts)
{}

static int fl_dump_key_gtp_opt(struct sk_buff *skb,
			       struct flow_dissector_key_enc_opts *enc_opts)

{}

static int fl_dump_key_pfcp_opt(struct sk_buff *skb,
				struct flow_dissector_key_enc_opts *enc_opts)
{}

static int fl_dump_key_ct(struct sk_buff *skb,
			  struct flow_dissector_key_ct *key,
			  struct flow_dissector_key_ct *mask)
{}

static int fl_dump_key_cfm(struct sk_buff *skb,
			   struct flow_dissector_key_cfm *key,
			   struct flow_dissector_key_cfm *mask)
{}

static int fl_dump_key_options(struct sk_buff *skb, int enc_opt_type,
			       struct flow_dissector_key_enc_opts *enc_opts)
{}

static int fl_dump_key_enc_opt(struct sk_buff *skb,
			       struct flow_dissector_key_enc_opts *key_opts,
			       struct flow_dissector_key_enc_opts *msk_opts)
{}

static int fl_dump_key(struct sk_buff *skb, struct net *net,
		       struct fl_flow_key *key, struct fl_flow_key *mask)
{}

static int fl_dump(struct net *net, struct tcf_proto *tp, void *fh,
		   struct sk_buff *skb, struct tcmsg *t, bool rtnl_held)
{}

static int fl_terse_dump(struct net *net, struct tcf_proto *tp, void *fh,
			 struct sk_buff *skb, struct tcmsg *t, bool rtnl_held)
{}

static int fl_tmplt_dump(struct sk_buff *skb, struct net *net, void *tmplt_priv)
{}

static void fl_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
			  unsigned long base)
{}

static bool fl_delete_empty(struct tcf_proto *tp)
{}

static struct tcf_proto_ops cls_fl_ops __read_mostly =;
MODULE_ALIAS_NET_CLS();

static int __init cls_fl_init(void)
{}

static void __exit cls_fl_exit(void)
{}

module_init();
module_exit(cls_fl_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();