Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
0002 /* Copyright (C) 2017-2018 Netronome Systems, Inc. */
0003 
0004 #ifndef __NFP_FLOWER_H__
0005 #define __NFP_FLOWER_H__ 1
0006 
0007 #include "cmsg.h"
0008 #include "../nfp_net.h"
0009 
0010 #include <linux/circ_buf.h>
0011 #include <linux/hashtable.h>
0012 #include <linux/rhashtable.h>
0013 #include <linux/time64.h>
0014 #include <linux/types.h>
0015 #include <net/flow_offload.h>
0016 #include <net/pkt_cls.h>
0017 #include <net/pkt_sched.h>
0018 #include <net/tcp.h>
0019 #include <linux/workqueue.h>
0020 #include <linux/idr.h>
0021 
0022 struct nfp_fl_pre_lag;
0023 struct net_device;
0024 struct nfp_app;
0025 
0026 #define NFP_FL_STAT_ID_MU_NUM       GENMASK(31, 22)
0027 #define NFP_FL_STAT_ID_STAT     GENMASK(21, 0)
0028 
0029 #define NFP_FL_STATS_ELEM_RS        sizeof_field(struct nfp_fl_stats_id, \
0030                              init_unalloc)
0031 #define NFP_FLOWER_MASK_ENTRY_RS    256
0032 #define NFP_FLOWER_MASK_ELEMENT_RS  1
0033 #define NFP_FLOWER_MASK_HASH_BITS   10
0034 
0035 #define NFP_FLOWER_KEY_MAX_LW       32
0036 
0037 #define NFP_FL_META_FLAG_MANAGE_MASK    BIT(7)
0038 
0039 #define NFP_FL_MASK_REUSE_TIME_NS   40000
0040 #define NFP_FL_MASK_ID_LOCATION     1
0041 
0042 /* Extra features bitmap. */
0043 #define NFP_FL_FEATS_GENEVE     BIT(0)
0044 #define NFP_FL_NBI_MTU_SETTING      BIT(1)
0045 #define NFP_FL_FEATS_GENEVE_OPT     BIT(2)
0046 #define NFP_FL_FEATS_VLAN_PCP       BIT(3)
0047 #define NFP_FL_FEATS_VF_RLIM        BIT(4)
0048 #define NFP_FL_FEATS_FLOW_MOD       BIT(5)
0049 #define NFP_FL_FEATS_PRE_TUN_RULES  BIT(6)
0050 #define NFP_FL_FEATS_IPV6_TUN       BIT(7)
0051 #define NFP_FL_FEATS_VLAN_QINQ      BIT(8)
0052 #define NFP_FL_FEATS_QOS_PPS        BIT(9)
0053 #define NFP_FL_FEATS_QOS_METER      BIT(10)
0054 #define NFP_FL_FEATS_DECAP_V2       BIT(11)
0055 #define NFP_FL_FEATS_HOST_ACK       BIT(31)
0056 
0057 #define NFP_FL_ENABLE_FLOW_MERGE    BIT(0)
0058 #define NFP_FL_ENABLE_LAG       BIT(1)
0059 
0060 #define NFP_FL_FEATS_HOST \
0061     (NFP_FL_FEATS_GENEVE | \
0062     NFP_FL_NBI_MTU_SETTING | \
0063     NFP_FL_FEATS_GENEVE_OPT | \
0064     NFP_FL_FEATS_VLAN_PCP | \
0065     NFP_FL_FEATS_VF_RLIM | \
0066     NFP_FL_FEATS_FLOW_MOD | \
0067     NFP_FL_FEATS_PRE_TUN_RULES | \
0068     NFP_FL_FEATS_IPV6_TUN | \
0069     NFP_FL_FEATS_VLAN_QINQ | \
0070     NFP_FL_FEATS_QOS_PPS | \
0071     NFP_FL_FEATS_QOS_METER | \
0072     NFP_FL_FEATS_DECAP_V2)
0073 
0074 struct nfp_fl_mask_id {
0075     struct circ_buf mask_id_free_list;
0076     ktime_t *last_used;
0077     u8 init_unallocated;
0078 };
0079 
0080 struct nfp_fl_stats_id {
0081     struct circ_buf free_list;
0082     u32 init_unalloc;
0083     u8 repeated_em_count;
0084 };
0085 
0086 /**
0087  * struct nfp_fl_tunnel_offloads - priv data for tunnel offloads
0088  * @offloaded_macs: Hashtable of the offloaded MAC addresses
0089  * @ipv4_off_list:  List of IPv4 addresses to offload
0090  * @ipv6_off_list:  List of IPv6 addresses to offload
0091  * @ipv4_off_lock:  Lock for the IPv4 address list
0092  * @ipv6_off_lock:  Lock for the IPv6 address list
0093  * @mac_off_ids:    IDA to manage id assignment for offloaded MACs
0094  * @neigh_nb:       Notifier to monitor neighbour state
0095  */
0096 struct nfp_fl_tunnel_offloads {
0097     struct rhashtable offloaded_macs;
0098     struct list_head ipv4_off_list;
0099     struct list_head ipv6_off_list;
0100     struct mutex ipv4_off_lock;
0101     struct mutex ipv6_off_lock;
0102     struct ida mac_off_ids;
0103     struct notifier_block neigh_nb;
0104 };
0105 
0106 /**
0107  * struct nfp_tun_neigh - basic neighbour data
0108  * @dst_addr:   Destination MAC address
0109  * @src_addr:   Source MAC address
0110  * @port_id:    NFP port to output packet on - associated with source IPv4
0111  */
0112 struct nfp_tun_neigh {
0113     u8 dst_addr[ETH_ALEN];
0114     u8 src_addr[ETH_ALEN];
0115     __be32 port_id;
0116 };
0117 
0118 /**
0119  * struct nfp_tun_neigh_ext - extended neighbour data
0120  * @vlan_tpid:  VLAN_TPID match field
0121  * @vlan_tci:   VLAN_TCI match field
0122  * @host_ctx:   Host context ID to be saved here
0123  */
0124 struct nfp_tun_neigh_ext {
0125     __be16 vlan_tpid;
0126     __be16 vlan_tci;
0127     __be32 host_ctx;
0128 };
0129 
0130 /**
0131  * struct nfp_tun_neigh_v4 - neighbour/route entry on the NFP for IPv4
0132  * @dst_ipv4:   Destination IPv4 address
0133  * @src_ipv4:   Source IPv4 address
0134  * @common: Neighbour/route common info
0135  * @ext:    Neighbour/route extended info
0136  */
0137 struct nfp_tun_neigh_v4 {
0138     __be32 dst_ipv4;
0139     __be32 src_ipv4;
0140     struct nfp_tun_neigh common;
0141     struct nfp_tun_neigh_ext ext;
0142 };
0143 
0144 /**
0145  * struct nfp_tun_neigh_v6 - neighbour/route entry on the NFP for IPv6
0146  * @dst_ipv6:   Destination IPv6 address
0147  * @src_ipv6:   Source IPv6 address
0148  * @common: Neighbour/route common info
0149  * @ext:    Neighbour/route extended info
0150  */
0151 struct nfp_tun_neigh_v6 {
0152     struct in6_addr dst_ipv6;
0153     struct in6_addr src_ipv6;
0154     struct nfp_tun_neigh common;
0155     struct nfp_tun_neigh_ext ext;
0156 };
0157 
0158 /**
0159  * struct nfp_neigh_entry
0160  * @neigh_cookie:   Cookie for hashtable lookup
0161  * @ht_node:        rhash_head entry for hashtable
0162  * @list_head:      Needed as member of linked_nn_entries list
0163  * @payload:        The neighbour info payload
0164  * @flow:       Linked flow rule
0165  * @is_ipv6:        Flag to indicate if payload is ipv6 or ipv4
0166  */
0167 struct nfp_neigh_entry {
0168     unsigned long neigh_cookie;
0169     struct rhash_head ht_node;
0170     struct list_head list_head;
0171     char *payload;
0172     struct nfp_predt_entry *flow;
0173     bool is_ipv6;
0174 };
0175 
0176 /**
0177  * struct nfp_predt_entry
0178  * @list_head:      List head to attach to predt_list
0179  * @flow_pay:       Direct link to flow_payload
0180  * @nn_list:        List of linked nfp_neigh_entries
0181  */
0182 struct nfp_predt_entry {
0183     struct list_head list_head;
0184     struct nfp_fl_payload *flow_pay;
0185     struct list_head nn_list;
0186 };
0187 
0188 /**
0189  * struct nfp_mtu_conf - manage MTU setting
0190  * @portnum:        NFP port number of repr with requested MTU change
0191  * @requested_val:  MTU value requested for repr
0192  * @ack:        Received ack that MTU has been correctly set
0193  * @wait_q:     Wait queue for MTU acknowledgements
0194  * @lock:       Lock for setting/reading MTU variables
0195  */
0196 struct nfp_mtu_conf {
0197     u32 portnum;
0198     unsigned int requested_val;
0199     bool ack;
0200     wait_queue_head_t wait_q;
0201     spinlock_t lock;
0202 };
0203 
0204 /**
0205  * struct nfp_fl_lag - Flower APP priv data for link aggregation
0206  * @work:       Work queue for writing configs to the HW
0207  * @lock:       Lock to protect lag_group_list
0208  * @group_list:     List of all master/slave groups offloaded
0209  * @ida_handle:     IDA to handle group ids
0210  * @pkt_num:        Incremented for each config packet sent
0211  * @batch_ver:      Incremented for each batch of config packets
0212  * @global_inst:    Instance allocator for groups
0213  * @rst_cfg:        Marker to reset HW LAG config
0214  * @retrans_skbs:   Cmsgs that could not be processed by HW and require
0215  *          retransmission
0216  */
0217 struct nfp_fl_lag {
0218     struct delayed_work work;
0219     struct mutex lock;
0220     struct list_head group_list;
0221     struct ida ida_handle;
0222     unsigned int pkt_num;
0223     unsigned int batch_ver;
0224     u8 global_inst;
0225     bool rst_cfg;
0226     struct sk_buff_head retrans_skbs;
0227 };
0228 
0229 /**
0230  * struct nfp_fl_internal_ports - Flower APP priv data for additional ports
0231  * @port_ids:   Assignment of ids to any additional ports
0232  * @lock:   Lock for extra ports list
0233  */
0234 struct nfp_fl_internal_ports {
0235     struct idr port_ids;
0236     spinlock_t lock;
0237 };
0238 
0239 /**
0240  * struct nfp_flower_priv - Flower APP per-vNIC priv data
0241  * @app:        Back pointer to app
0242  * @nn:         Pointer to vNIC
0243  * @mask_id_seed:   Seed used for mask hash table
0244  * @flower_version: HW version of flower
0245  * @flower_ext_feats:   Bitmap of extra features the HW supports
0246  * @flower_en_feats:    Bitmap of features enabled by HW
0247  * @stats_ids:      List of free stats ids
0248  * @mask_ids:       List of free mask ids
0249  * @mask_table:     Hash table used to store masks
0250  * @stats_ring_size:    Maximum number of allowed stats ids
0251  * @flow_table:     Hash table used to store flower rules
0252  * @stats:      Stored stats updates for flower rules
0253  * @stats_lock:     Lock for flower rule stats updates
0254  * @stats_ctx_table:    Hash table to map stats contexts to its flow rule
0255  * @cmsg_work:      Workqueue for control messages processing
0256  * @cmsg_skbs_high: List of higher priority skbs for control message
0257  *          processing
0258  * @cmsg_skbs_low:  List of lower priority skbs for control message
0259  *          processing
0260  * @tun:        Tunnel offload data
0261  * @reify_replies:  atomically stores the number of replies received
0262  *          from firmware for repr reify
0263  * @reify_wait_queue:   wait queue for repr reify response counting
0264  * @mtu_conf:       Configuration of repr MTU value
0265  * @nfp_lag:        Link aggregation data block
0266  * @indr_block_cb_priv: List of priv data passed to indirect block cbs
0267  * @non_repr_priv:  List of offloaded non-repr ports and their priv data
0268  * @active_mem_unit:    Current active memory unit for flower rules
0269  * @total_mem_units:    Total number of available memory units for flower rules
0270  * @internal_ports: Internal port ids used in offloaded rules
0271  * @qos_stats_work: Workqueue for qos stats processing
0272  * @qos_rate_limiters:  Current active qos rate limiters
0273  * @qos_stats_lock: Lock on qos stats updates
0274  * @meter_stats_lock:   Lock on meter stats updates
0275  * @meter_table:    Hash table used to store the meter table
0276  * @pre_tun_rule_cnt:   Number of pre-tunnel rules offloaded
0277  * @merge_table:    Hash table to store merged flows
0278  * @ct_zone_table:  Hash table used to store the different zones
0279  * @ct_zone_wc:     Special zone entry for wildcarded zone matches
0280  * @ct_map_table:   Hash table used to referennce ct flows
0281  * @predt_list:     List to keep track of decap pretun flows
0282  * @neigh_table:    Table to keep track of neighbor entries
0283  * @predt_lock:     Lock to serialise predt/neigh table updates
0284  */
0285 struct nfp_flower_priv {
0286     struct nfp_app *app;
0287     struct nfp_net *nn;
0288     u32 mask_id_seed;
0289     u64 flower_version;
0290     u64 flower_ext_feats;
0291     u8 flower_en_feats;
0292     struct nfp_fl_stats_id stats_ids;
0293     struct nfp_fl_mask_id mask_ids;
0294     DECLARE_HASHTABLE(mask_table, NFP_FLOWER_MASK_HASH_BITS);
0295     u32 stats_ring_size;
0296     struct rhashtable flow_table;
0297     struct nfp_fl_stats *stats;
0298     spinlock_t stats_lock; /* lock stats */
0299     struct rhashtable stats_ctx_table;
0300     struct work_struct cmsg_work;
0301     struct sk_buff_head cmsg_skbs_high;
0302     struct sk_buff_head cmsg_skbs_low;
0303     struct nfp_fl_tunnel_offloads tun;
0304     atomic_t reify_replies;
0305     wait_queue_head_t reify_wait_queue;
0306     struct nfp_mtu_conf mtu_conf;
0307     struct nfp_fl_lag nfp_lag;
0308     struct list_head indr_block_cb_priv;
0309     struct list_head non_repr_priv;
0310     unsigned int active_mem_unit;
0311     unsigned int total_mem_units;
0312     struct nfp_fl_internal_ports internal_ports;
0313     struct delayed_work qos_stats_work;
0314     unsigned int qos_rate_limiters;
0315     spinlock_t qos_stats_lock; /* Protect the qos stats */
0316     struct mutex meter_stats_lock; /* Protect the meter stats */
0317     struct rhashtable meter_table;
0318     int pre_tun_rule_cnt;
0319     struct rhashtable merge_table;
0320     struct rhashtable ct_zone_table;
0321     struct nfp_fl_ct_zone_entry *ct_zone_wc;
0322     struct rhashtable ct_map_table;
0323     struct list_head predt_list;
0324     struct rhashtable neigh_table;
0325     spinlock_t predt_lock; /* Lock to serialise predt/neigh table updates */
0326 };
0327 
0328 /**
0329  * struct nfp_fl_qos - Flower APP priv data for quality of service
0330  * @netdev_port_id: NFP port number of repr with qos info
0331  * @curr_stats:     Currently stored stats updates for qos info
0332  * @prev_stats:     Previously stored updates for qos info
0333  * @last_update:    Stored time when last stats were updated
0334  */
0335 struct nfp_fl_qos {
0336     u32 netdev_port_id;
0337     struct nfp_stat_pair curr_stats;
0338     struct nfp_stat_pair prev_stats;
0339     u64 last_update;
0340 };
0341 
0342 /**
0343  * struct nfp_flower_repr_priv - Flower APP per-repr priv data
0344  * @nfp_repr:       Back pointer to nfp_repr
0345  * @lag_port_flags: Extended port flags to record lag state of repr
0346  * @mac_offloaded:  Flag indicating a MAC address is offloaded for repr
0347  * @offloaded_mac_addr: MAC address that has been offloaded for repr
0348  * @block_shared:   Flag indicating if offload applies to shared blocks
0349  * @mac_list:       List entry of reprs that share the same offloaded MAC
0350  * @qos_table:      Stored info on filters implementing qos
0351  * @on_bridge:      Indicates if the repr is attached to a bridge
0352  */
0353 struct nfp_flower_repr_priv {
0354     struct nfp_repr *nfp_repr;
0355     unsigned long lag_port_flags;
0356     bool mac_offloaded;
0357     u8 offloaded_mac_addr[ETH_ALEN];
0358     bool block_shared;
0359     struct list_head mac_list;
0360     struct nfp_fl_qos qos_table;
0361     bool on_bridge;
0362 };
0363 
0364 /**
0365  * struct nfp_flower_non_repr_priv - Priv data for non-repr offloaded ports
0366  * @list:       List entry of offloaded reprs
0367  * @netdev:     Pointer to non-repr net_device
0368  * @ref_count:      Number of references held for this priv data
0369  * @mac_offloaded:  Flag indicating a MAC address is offloaded for device
0370  * @offloaded_mac_addr: MAC address that has been offloaded for dev
0371  */
0372 struct nfp_flower_non_repr_priv {
0373     struct list_head list;
0374     struct net_device *netdev;
0375     int ref_count;
0376     bool mac_offloaded;
0377     u8 offloaded_mac_addr[ETH_ALEN];
0378 };
0379 
0380 struct nfp_fl_key_ls {
0381     u32 key_layer_two;
0382     u8 key_layer;
0383     int key_size;
0384 };
0385 
0386 struct nfp_fl_rule_metadata {
0387     u8 key_len;
0388     u8 mask_len;
0389     u8 act_len;
0390     u8 flags;
0391     __be32 host_ctx_id;
0392     __be64 host_cookie __packed;
0393     __be64 flow_version __packed;
0394     __be32 shortcut;
0395 };
0396 
0397 struct nfp_fl_stats {
0398     u64 pkts;
0399     u64 bytes;
0400     u64 used;
0401 };
0402 
0403 /**
0404  * struct nfp_ipv6_addr_entry - cached IPv6 addresses
0405  * @ipv6_addr:  IP address
0406  * @ref_count:  number of rules currently using this IP
0407  * @list:   list pointer
0408  */
0409 struct nfp_ipv6_addr_entry {
0410     struct in6_addr ipv6_addr;
0411     int ref_count;
0412     struct list_head list;
0413 };
0414 
0415 struct nfp_fl_payload {
0416     struct nfp_fl_rule_metadata meta;
0417     unsigned long tc_flower_cookie;
0418     struct rhash_head fl_node;
0419     struct rcu_head rcu;
0420     __be32 nfp_tun_ipv4_addr;
0421     struct nfp_ipv6_addr_entry *nfp_tun_ipv6;
0422     struct net_device *ingress_dev;
0423     char *unmasked_data;
0424     char *mask_data;
0425     char *action_data;
0426     struct list_head linked_flows;
0427     bool in_hw;
0428     struct {
0429         struct nfp_predt_entry *predt;
0430         struct net_device *dev;
0431         __be16 vlan_tpid;
0432         __be16 vlan_tci;
0433         __be16 port_idx;
0434         u8 loc_mac[ETH_ALEN];
0435         u8 rem_mac[ETH_ALEN];
0436         bool is_ipv6;
0437     } pre_tun_rule;
0438 };
0439 
0440 struct nfp_fl_payload_link {
0441     /* A link contains a pointer to a merge flow and an associated sub_flow.
0442      * Each merge flow will feature in 2 links to its underlying sub_flows.
0443      * A sub_flow will have at least 1 link to a merge flow or more if it
0444      * has been used to create multiple merge flows.
0445      *
0446      * For a merge flow, 'linked_flows' in its nfp_fl_payload struct lists
0447      * all links to sub_flows (sub_flow.flow) via merge.list.
0448      * For a sub_flow, 'linked_flows' gives all links to merge flows it has
0449      * formed (merge_flow.flow) via sub_flow.list.
0450      */
0451     struct {
0452         struct list_head list;
0453         struct nfp_fl_payload *flow;
0454     } merge_flow, sub_flow;
0455 };
0456 
0457 extern const struct rhashtable_params nfp_flower_table_params;
0458 extern const struct rhashtable_params merge_table_params;
0459 extern const struct rhashtable_params neigh_table_params;
0460 
0461 struct nfp_merge_info {
0462     u64 parent_ctx;
0463     struct rhash_head ht_node;
0464 };
0465 
0466 struct nfp_fl_stats_frame {
0467     __be32 stats_con_id;
0468     __be32 pkt_count;
0469     __be64 byte_count;
0470     __be64 stats_cookie;
0471 };
0472 
0473 struct nfp_meter_stats_entry {
0474     u64 pkts;
0475     u64 bytes;
0476     u64 drops;
0477 };
0478 
0479 struct nfp_meter_entry {
0480     struct rhash_head ht_node;
0481     u32 meter_id;
0482     bool bps;
0483     u32 rate;
0484     u32 burst;
0485     u64 used;
0486     struct nfp_meter_stats {
0487         u64 update;
0488         struct nfp_meter_stats_entry curr;
0489         struct nfp_meter_stats_entry prev;
0490     } stats;
0491 };
0492 
0493 enum nfp_meter_op {
0494     NFP_METER_ADD,
0495     NFP_METER_DEL,
0496 };
0497 
0498 static inline bool
0499 nfp_flower_internal_port_can_offload(struct nfp_app *app,
0500                      struct net_device *netdev)
0501 {
0502     struct nfp_flower_priv *app_priv = app->priv;
0503 
0504     if (!(app_priv->flower_en_feats & NFP_FL_ENABLE_FLOW_MERGE))
0505         return false;
0506     if (!netdev->rtnl_link_ops)
0507         return false;
0508     if (!strcmp(netdev->rtnl_link_ops->kind, "openvswitch"))
0509         return true;
0510 
0511     return false;
0512 }
0513 
0514 /* The address of the merged flow acts as its cookie.
0515  * Cookies supplied to us by TC flower are also addresses to allocated
0516  * memory and thus this scheme should not generate any collisions.
0517  */
0518 static inline bool nfp_flower_is_merge_flow(struct nfp_fl_payload *flow_pay)
0519 {
0520     return flow_pay->tc_flower_cookie == (unsigned long)flow_pay;
0521 }
0522 
0523 static inline bool nfp_flower_is_supported_bridge(struct net_device *netdev)
0524 {
0525     return netif_is_ovs_master(netdev);
0526 }
0527 
0528 int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count,
0529                  unsigned int host_ctx_split);
0530 void nfp_flower_metadata_cleanup(struct nfp_app *app);
0531 
0532 int nfp_flower_setup_tc(struct nfp_app *app, struct net_device *netdev,
0533             enum tc_setup_type type, void *type_data);
0534 int nfp_flower_merge_offloaded_flows(struct nfp_app *app,
0535                      struct nfp_fl_payload *sub_flow1,
0536                      struct nfp_fl_payload *sub_flow2);
0537 void
0538 nfp_flower_compile_meta(struct nfp_flower_meta_tci *ext,
0539             struct nfp_flower_meta_tci *msk, u8 key_type);
0540 void
0541 nfp_flower_compile_tci(struct nfp_flower_meta_tci *ext,
0542                struct nfp_flower_meta_tci *msk,
0543                struct flow_rule *rule);
0544 void
0545 nfp_flower_compile_ext_meta(struct nfp_flower_ext_meta *frame, u32 key_ext);
0546 int
0547 nfp_flower_compile_port(struct nfp_flower_in_port *frame, u32 cmsg_port,
0548             bool mask_version, enum nfp_flower_tun_type tun_type,
0549             struct netlink_ext_ack *extack);
0550 void
0551 nfp_flower_compile_mac(struct nfp_flower_mac_mpls *ext,
0552                struct nfp_flower_mac_mpls *msk,
0553                struct flow_rule *rule);
0554 int
0555 nfp_flower_compile_mpls(struct nfp_flower_mac_mpls *ext,
0556             struct nfp_flower_mac_mpls *msk,
0557             struct flow_rule *rule,
0558             struct netlink_ext_ack *extack);
0559 void
0560 nfp_flower_compile_tport(struct nfp_flower_tp_ports *ext,
0561              struct nfp_flower_tp_ports *msk,
0562              struct flow_rule *rule);
0563 void
0564 nfp_flower_compile_vlan(struct nfp_flower_vlan *ext,
0565             struct nfp_flower_vlan *msk,
0566             struct flow_rule *rule);
0567 void
0568 nfp_flower_compile_ipv4(struct nfp_flower_ipv4 *ext,
0569             struct nfp_flower_ipv4 *msk, struct flow_rule *rule);
0570 void
0571 nfp_flower_compile_ipv6(struct nfp_flower_ipv6 *ext,
0572             struct nfp_flower_ipv6 *msk, struct flow_rule *rule);
0573 void
0574 nfp_flower_compile_geneve_opt(u8 *ext, u8 *msk, struct flow_rule *rule);
0575 void
0576 nfp_flower_compile_ipv4_gre_tun(struct nfp_flower_ipv4_gre_tun *ext,
0577                 struct nfp_flower_ipv4_gre_tun *msk,
0578                 struct flow_rule *rule);
0579 void
0580 nfp_flower_compile_ipv4_udp_tun(struct nfp_flower_ipv4_udp_tun *ext,
0581                 struct nfp_flower_ipv4_udp_tun *msk,
0582                 struct flow_rule *rule);
0583 void
0584 nfp_flower_compile_ipv6_udp_tun(struct nfp_flower_ipv6_udp_tun *ext,
0585                 struct nfp_flower_ipv6_udp_tun *msk,
0586                 struct flow_rule *rule);
0587 void
0588 nfp_flower_compile_ipv6_gre_tun(struct nfp_flower_ipv6_gre_tun *ext,
0589                 struct nfp_flower_ipv6_gre_tun *msk,
0590                 struct flow_rule *rule);
0591 int nfp_flower_compile_flow_match(struct nfp_app *app,
0592                   struct flow_rule *rule,
0593                   struct nfp_fl_key_ls *key_ls,
0594                   struct net_device *netdev,
0595                   struct nfp_fl_payload *nfp_flow,
0596                   enum nfp_flower_tun_type tun_type,
0597                   struct netlink_ext_ack *extack);
0598 int nfp_flower_compile_action(struct nfp_app *app,
0599                   struct flow_rule *rule,
0600                   struct net_device *netdev,
0601                   struct nfp_fl_payload *nfp_flow,
0602                   struct netlink_ext_ack *extack);
0603 int nfp_compile_flow_metadata(struct nfp_app *app, u32 cookie,
0604                   struct nfp_fl_payload *nfp_flow,
0605                   struct net_device *netdev,
0606                   struct netlink_ext_ack *extack);
0607 void __nfp_modify_flow_metadata(struct nfp_flower_priv *priv,
0608                 struct nfp_fl_payload *nfp_flow);
0609 int nfp_modify_flow_metadata(struct nfp_app *app,
0610                  struct nfp_fl_payload *nfp_flow);
0611 
0612 struct nfp_fl_payload *
0613 nfp_flower_search_fl_table(struct nfp_app *app, unsigned long tc_flower_cookie,
0614                struct net_device *netdev);
0615 struct nfp_fl_payload *
0616 nfp_flower_get_fl_payload_from_ctx(struct nfp_app *app, u32 ctx_id);
0617 struct nfp_fl_payload *
0618 nfp_flower_remove_fl_table(struct nfp_app *app, unsigned long tc_flower_cookie);
0619 
0620 void nfp_flower_rx_flow_stats(struct nfp_app *app, struct sk_buff *skb);
0621 
0622 int nfp_tunnel_config_start(struct nfp_app *app);
0623 void nfp_tunnel_config_stop(struct nfp_app *app);
0624 int nfp_tunnel_mac_event_handler(struct nfp_app *app,
0625                  struct net_device *netdev,
0626                  unsigned long event, void *ptr);
0627 void nfp_tunnel_del_ipv4_off(struct nfp_app *app, __be32 ipv4);
0628 void nfp_tunnel_add_ipv4_off(struct nfp_app *app, __be32 ipv4);
0629 void
0630 nfp_tunnel_put_ipv6_off(struct nfp_app *app, struct nfp_ipv6_addr_entry *entry);
0631 struct nfp_ipv6_addr_entry *
0632 nfp_tunnel_add_ipv6_off(struct nfp_app *app, struct in6_addr *ipv6);
0633 void nfp_tunnel_request_route_v4(struct nfp_app *app, struct sk_buff *skb);
0634 void nfp_tunnel_request_route_v6(struct nfp_app *app, struct sk_buff *skb);
0635 void nfp_tunnel_keep_alive(struct nfp_app *app, struct sk_buff *skb);
0636 void nfp_tunnel_keep_alive_v6(struct nfp_app *app, struct sk_buff *skb);
0637 void nfp_flower_lag_init(struct nfp_fl_lag *lag);
0638 void nfp_flower_lag_cleanup(struct nfp_fl_lag *lag);
0639 int nfp_flower_lag_reset(struct nfp_fl_lag *lag);
0640 int nfp_flower_lag_netdev_event(struct nfp_flower_priv *priv,
0641                 struct net_device *netdev,
0642                 unsigned long event, void *ptr);
0643 bool nfp_flower_lag_unprocessed_msg(struct nfp_app *app, struct sk_buff *skb);
0644 int nfp_flower_lag_populate_pre_action(struct nfp_app *app,
0645                        struct net_device *master,
0646                        struct nfp_fl_pre_lag *pre_act,
0647                        struct netlink_ext_ack *extack);
0648 int nfp_flower_lag_get_output_id(struct nfp_app *app,
0649                  struct net_device *master);
0650 void nfp_flower_qos_init(struct nfp_app *app);
0651 void nfp_flower_qos_cleanup(struct nfp_app *app);
0652 int nfp_flower_setup_qos_offload(struct nfp_app *app, struct net_device *netdev,
0653                  struct tc_cls_matchall_offload *flow);
0654 void nfp_flower_stats_rlim_reply(struct nfp_app *app, struct sk_buff *skb);
0655 int nfp_flower_indr_setup_tc_cb(struct net_device *netdev, struct Qdisc *sch, void *cb_priv,
0656                 enum tc_setup_type type, void *type_data,
0657                 void *data,
0658                 void (*cleanup)(struct flow_block_cb *block_cb));
0659 void nfp_flower_setup_indr_tc_release(void *cb_priv);
0660 
0661 void
0662 __nfp_flower_non_repr_priv_get(struct nfp_flower_non_repr_priv *non_repr_priv);
0663 struct nfp_flower_non_repr_priv *
0664 nfp_flower_non_repr_priv_get(struct nfp_app *app, struct net_device *netdev);
0665 void
0666 __nfp_flower_non_repr_priv_put(struct nfp_flower_non_repr_priv *non_repr_priv);
0667 void
0668 nfp_flower_non_repr_priv_put(struct nfp_app *app, struct net_device *netdev);
0669 u32 nfp_flower_get_port_id_from_netdev(struct nfp_app *app,
0670                        struct net_device *netdev);
0671 void nfp_tun_link_and_update_nn_entries(struct nfp_app *app,
0672                     struct nfp_predt_entry *predt);
0673 void nfp_tun_unlink_and_update_nn_entries(struct nfp_app *app,
0674                       struct nfp_predt_entry *predt);
0675 int nfp_flower_xmit_pre_tun_flow(struct nfp_app *app,
0676                  struct nfp_fl_payload *flow);
0677 int nfp_flower_xmit_pre_tun_del_flow(struct nfp_app *app,
0678                      struct nfp_fl_payload *flow);
0679 
0680 struct nfp_fl_payload *
0681 nfp_flower_allocate_new(struct nfp_fl_key_ls *key_layer);
0682 int nfp_flower_calculate_key_layers(struct nfp_app *app,
0683                     struct net_device *netdev,
0684                     struct nfp_fl_key_ls *ret_key_ls,
0685                     struct flow_rule *flow,
0686                     enum nfp_flower_tun_type *tun_type,
0687                     struct netlink_ext_ack *extack);
0688 void
0689 nfp_flower_del_linked_merge_flows(struct nfp_app *app,
0690                   struct nfp_fl_payload *sub_flow);
0691 int
0692 nfp_flower_xmit_flow(struct nfp_app *app, struct nfp_fl_payload *nfp_flow,
0693              u8 mtype);
0694 void
0695 nfp_flower_update_merge_stats(struct nfp_app *app,
0696                   struct nfp_fl_payload *sub_flow);
0697 
0698 int nfp_setup_tc_act_offload(struct nfp_app *app,
0699                  struct flow_offload_action *fl_act);
0700 int nfp_init_meter_table(struct nfp_app *app);
0701 void nfp_flower_stats_meter_request_all(struct nfp_flower_priv *fl_priv);
0702 void nfp_act_stats_reply(struct nfp_app *app, void *pmsg);
0703 int nfp_flower_offload_one_police(struct nfp_app *app, bool ingress,
0704                   bool pps, u32 id, u32 rate, u32 burst);
0705 int nfp_flower_setup_meter_entry(struct nfp_app *app,
0706                  const struct flow_action_entry *action,
0707                  enum nfp_meter_op op,
0708                  u32 meter_id);
0709 struct nfp_meter_entry *
0710 nfp_flower_search_meter_entry(struct nfp_app *app, u32 meter_id);
0711 #endif