1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ 2 /* Copyright (C) 2017-2018 Netronome Systems, Inc. */ 3 4 #ifndef __NFP_FLOWER_H__ 5 #define __NFP_FLOWER_H__ 1 6 7 #include "cmsg.h" 8 #include "../nfp_net.h" 9 10 #include <linux/circ_buf.h> 11 #include <linux/hashtable.h> 12 #include <linux/rhashtable.h> 13 #include <linux/time64.h> 14 #include <linux/types.h> 15 #include <net/flow_offload.h> 16 #include <net/pkt_cls.h> 17 #include <net/pkt_sched.h> 18 #include <net/tcp.h> 19 #include <linux/workqueue.h> 20 #include <linux/idr.h> 21 22 struct nfp_fl_pre_lag; 23 struct net_device; 24 struct nfp_app; 25 26 #define NFP_FL_STAT_ID_MU_NUM GENMASK(31, 22) 27 #define NFP_FL_STAT_ID_STAT GENMASK(21, 0) 28 29 #define NFP_FL_STATS_ELEM_RS sizeof_field(struct nfp_fl_stats_id, \ 30 init_unalloc) 31 #define NFP_FLOWER_MASK_ENTRY_RS 256 32 #define NFP_FLOWER_MASK_ELEMENT_RS 1 33 #define NFP_FLOWER_MASK_HASH_BITS 10 34 35 #define NFP_FLOWER_KEY_MAX_LW 32 36 37 #define NFP_FL_META_FLAG_MANAGE_MASK BIT(7) 38 39 #define NFP_FL_MASK_REUSE_TIME_NS 40000 40 #define NFP_FL_MASK_ID_LOCATION 1 41 42 /* Extra features bitmap. */ 43 #define NFP_FL_FEATS_GENEVE BIT(0) 44 #define NFP_FL_NBI_MTU_SETTING BIT(1) 45 #define NFP_FL_FEATS_GENEVE_OPT BIT(2) 46 #define NFP_FL_FEATS_VLAN_PCP BIT(3) 47 #define NFP_FL_FEATS_VF_RLIM BIT(4) 48 #define NFP_FL_FEATS_FLOW_MOD BIT(5) 49 #define NFP_FL_FEATS_PRE_TUN_RULES BIT(6) 50 #define NFP_FL_FEATS_IPV6_TUN BIT(7) 51 #define NFP_FL_FEATS_VLAN_QINQ BIT(8) 52 #define NFP_FL_FEATS_QOS_PPS BIT(9) 53 #define NFP_FL_FEATS_QOS_METER BIT(10) 54 #define NFP_FL_FEATS_HOST_ACK BIT(31) 55 56 #define NFP_FL_ENABLE_FLOW_MERGE BIT(0) 57 #define NFP_FL_ENABLE_LAG BIT(1) 58 59 #define NFP_FL_FEATS_HOST \ 60 (NFP_FL_FEATS_GENEVE | \ 61 NFP_FL_NBI_MTU_SETTING | \ 62 NFP_FL_FEATS_GENEVE_OPT | \ 63 NFP_FL_FEATS_VLAN_PCP | \ 64 NFP_FL_FEATS_VF_RLIM | \ 65 NFP_FL_FEATS_FLOW_MOD | \ 66 NFP_FL_FEATS_PRE_TUN_RULES | \ 67 NFP_FL_FEATS_IPV6_TUN | \ 68 NFP_FL_FEATS_VLAN_QINQ | \ 69 NFP_FL_FEATS_QOS_PPS | \ 70 NFP_FL_FEATS_QOS_METER) 71 72 struct nfp_fl_mask_id { 73 struct circ_buf mask_id_free_list; 74 ktime_t *last_used; 75 u8 init_unallocated; 76 }; 77 78 struct nfp_fl_stats_id { 79 struct circ_buf free_list; 80 u32 init_unalloc; 81 u8 repeated_em_count; 82 }; 83 84 /** 85 * struct nfp_fl_tunnel_offloads - priv data for tunnel offloads 86 * @offloaded_macs: Hashtable of the offloaded MAC addresses 87 * @ipv4_off_list: List of IPv4 addresses to offload 88 * @ipv6_off_list: List of IPv6 addresses to offload 89 * @neigh_off_list_v4: List of IPv4 neighbour offloads 90 * @neigh_off_list_v6: List of IPv6 neighbour offloads 91 * @ipv4_off_lock: Lock for the IPv4 address list 92 * @ipv6_off_lock: Lock for the IPv6 address list 93 * @neigh_off_lock_v4: Lock for the IPv4 neighbour address list 94 * @neigh_off_lock_v6: Lock for the IPv6 neighbour address list 95 * @mac_off_ids: IDA to manage id assignment for offloaded MACs 96 * @neigh_nb: Notifier to monitor neighbour state 97 */ 98 struct nfp_fl_tunnel_offloads { 99 struct rhashtable offloaded_macs; 100 struct list_head ipv4_off_list; 101 struct list_head ipv6_off_list; 102 struct list_head neigh_off_list_v4; 103 struct list_head neigh_off_list_v6; 104 struct mutex ipv4_off_lock; 105 struct mutex ipv6_off_lock; 106 spinlock_t neigh_off_lock_v4; 107 spinlock_t neigh_off_lock_v6; 108 struct ida mac_off_ids; 109 struct notifier_block neigh_nb; 110 }; 111 112 /** 113 * struct nfp_mtu_conf - manage MTU setting 114 * @portnum: NFP port number of repr with requested MTU change 115 * @requested_val: MTU value requested for repr 116 * @ack: Received ack that MTU has been correctly set 117 * @wait_q: Wait queue for MTU acknowledgements 118 * @lock: Lock for setting/reading MTU variables 119 */ 120 struct nfp_mtu_conf { 121 u32 portnum; 122 unsigned int requested_val; 123 bool ack; 124 wait_queue_head_t wait_q; 125 spinlock_t lock; 126 }; 127 128 /** 129 * struct nfp_fl_lag - Flower APP priv data for link aggregation 130 * @work: Work queue for writing configs to the HW 131 * @lock: Lock to protect lag_group_list 132 * @group_list: List of all master/slave groups offloaded 133 * @ida_handle: IDA to handle group ids 134 * @pkt_num: Incremented for each config packet sent 135 * @batch_ver: Incremented for each batch of config packets 136 * @global_inst: Instance allocator for groups 137 * @rst_cfg: Marker to reset HW LAG config 138 * @retrans_skbs: Cmsgs that could not be processed by HW and require 139 * retransmission 140 */ 141 struct nfp_fl_lag { 142 struct delayed_work work; 143 struct mutex lock; 144 struct list_head group_list; 145 struct ida ida_handle; 146 unsigned int pkt_num; 147 unsigned int batch_ver; 148 u8 global_inst; 149 bool rst_cfg; 150 struct sk_buff_head retrans_skbs; 151 }; 152 153 /** 154 * struct nfp_fl_internal_ports - Flower APP priv data for additional ports 155 * @port_ids: Assignment of ids to any additional ports 156 * @lock: Lock for extra ports list 157 */ 158 struct nfp_fl_internal_ports { 159 struct idr port_ids; 160 spinlock_t lock; 161 }; 162 163 /** 164 * struct nfp_flower_priv - Flower APP per-vNIC priv data 165 * @app: Back pointer to app 166 * @nn: Pointer to vNIC 167 * @mask_id_seed: Seed used for mask hash table 168 * @flower_version: HW version of flower 169 * @flower_ext_feats: Bitmap of extra features the HW supports 170 * @flower_en_feats: Bitmap of features enabled by HW 171 * @stats_ids: List of free stats ids 172 * @mask_ids: List of free mask ids 173 * @mask_table: Hash table used to store masks 174 * @stats_ring_size: Maximum number of allowed stats ids 175 * @flow_table: Hash table used to store flower rules 176 * @stats: Stored stats updates for flower rules 177 * @stats_lock: Lock for flower rule stats updates 178 * @stats_ctx_table: Hash table to map stats contexts to its flow rule 179 * @cmsg_work: Workqueue for control messages processing 180 * @cmsg_skbs_high: List of higher priority skbs for control message 181 * processing 182 * @cmsg_skbs_low: List of lower priority skbs for control message 183 * processing 184 * @tun: Tunnel offload data 185 * @reify_replies: atomically stores the number of replies received 186 * from firmware for repr reify 187 * @reify_wait_queue: wait queue for repr reify response counting 188 * @mtu_conf: Configuration of repr MTU value 189 * @nfp_lag: Link aggregation data block 190 * @indr_block_cb_priv: List of priv data passed to indirect block cbs 191 * @non_repr_priv: List of offloaded non-repr ports and their priv data 192 * @active_mem_unit: Current active memory unit for flower rules 193 * @total_mem_units: Total number of available memory units for flower rules 194 * @internal_ports: Internal port ids used in offloaded rules 195 * @qos_stats_work: Workqueue for qos stats processing 196 * @qos_rate_limiters: Current active qos rate limiters 197 * @qos_stats_lock: Lock on qos stats updates 198 * @meter_stats_lock: Lock on meter stats updates 199 * @meter_table: Hash table used to store the meter table 200 * @pre_tun_rule_cnt: Number of pre-tunnel rules offloaded 201 * @merge_table: Hash table to store merged flows 202 * @ct_zone_table: Hash table used to store the different zones 203 * @ct_zone_wc: Special zone entry for wildcarded zone matches 204 * @ct_map_table: Hash table used to referennce ct flows 205 */ 206 struct nfp_flower_priv { 207 struct nfp_app *app; 208 struct nfp_net *nn; 209 u32 mask_id_seed; 210 u64 flower_version; 211 u64 flower_ext_feats; 212 u8 flower_en_feats; 213 struct nfp_fl_stats_id stats_ids; 214 struct nfp_fl_mask_id mask_ids; 215 DECLARE_HASHTABLE(mask_table, NFP_FLOWER_MASK_HASH_BITS); 216 u32 stats_ring_size; 217 struct rhashtable flow_table; 218 struct nfp_fl_stats *stats; 219 spinlock_t stats_lock; /* lock stats */ 220 struct rhashtable stats_ctx_table; 221 struct work_struct cmsg_work; 222 struct sk_buff_head cmsg_skbs_high; 223 struct sk_buff_head cmsg_skbs_low; 224 struct nfp_fl_tunnel_offloads tun; 225 atomic_t reify_replies; 226 wait_queue_head_t reify_wait_queue; 227 struct nfp_mtu_conf mtu_conf; 228 struct nfp_fl_lag nfp_lag; 229 struct list_head indr_block_cb_priv; 230 struct list_head non_repr_priv; 231 unsigned int active_mem_unit; 232 unsigned int total_mem_units; 233 struct nfp_fl_internal_ports internal_ports; 234 struct delayed_work qos_stats_work; 235 unsigned int qos_rate_limiters; 236 spinlock_t qos_stats_lock; /* Protect the qos stats */ 237 struct mutex meter_stats_lock; /* Protect the meter stats */ 238 struct rhashtable meter_table; 239 int pre_tun_rule_cnt; 240 struct rhashtable merge_table; 241 struct rhashtable ct_zone_table; 242 struct nfp_fl_ct_zone_entry *ct_zone_wc; 243 struct rhashtable ct_map_table; 244 }; 245 246 /** 247 * struct nfp_fl_qos - Flower APP priv data for quality of service 248 * @netdev_port_id: NFP port number of repr with qos info 249 * @curr_stats: Currently stored stats updates for qos info 250 * @prev_stats: Previously stored updates for qos info 251 * @last_update: Stored time when last stats were updated 252 */ 253 struct nfp_fl_qos { 254 u32 netdev_port_id; 255 struct nfp_stat_pair curr_stats; 256 struct nfp_stat_pair prev_stats; 257 u64 last_update; 258 }; 259 260 /** 261 * struct nfp_flower_repr_priv - Flower APP per-repr priv data 262 * @nfp_repr: Back pointer to nfp_repr 263 * @lag_port_flags: Extended port flags to record lag state of repr 264 * @mac_offloaded: Flag indicating a MAC address is offloaded for repr 265 * @offloaded_mac_addr: MAC address that has been offloaded for repr 266 * @block_shared: Flag indicating if offload applies to shared blocks 267 * @mac_list: List entry of reprs that share the same offloaded MAC 268 * @qos_table: Stored info on filters implementing qos 269 * @on_bridge: Indicates if the repr is attached to a bridge 270 */ 271 struct nfp_flower_repr_priv { 272 struct nfp_repr *nfp_repr; 273 unsigned long lag_port_flags; 274 bool mac_offloaded; 275 u8 offloaded_mac_addr[ETH_ALEN]; 276 bool block_shared; 277 struct list_head mac_list; 278 struct nfp_fl_qos qos_table; 279 bool on_bridge; 280 }; 281 282 /** 283 * struct nfp_flower_non_repr_priv - Priv data for non-repr offloaded ports 284 * @list: List entry of offloaded reprs 285 * @netdev: Pointer to non-repr net_device 286 * @ref_count: Number of references held for this priv data 287 * @mac_offloaded: Flag indicating a MAC address is offloaded for device 288 * @offloaded_mac_addr: MAC address that has been offloaded for dev 289 */ 290 struct nfp_flower_non_repr_priv { 291 struct list_head list; 292 struct net_device *netdev; 293 int ref_count; 294 bool mac_offloaded; 295 u8 offloaded_mac_addr[ETH_ALEN]; 296 }; 297 298 struct nfp_fl_key_ls { 299 u32 key_layer_two; 300 u8 key_layer; 301 int key_size; 302 }; 303 304 struct nfp_fl_rule_metadata { 305 u8 key_len; 306 u8 mask_len; 307 u8 act_len; 308 u8 flags; 309 __be32 host_ctx_id; 310 __be64 host_cookie __packed; 311 __be64 flow_version __packed; 312 __be32 shortcut; 313 }; 314 315 struct nfp_fl_stats { 316 u64 pkts; 317 u64 bytes; 318 u64 used; 319 }; 320 321 /** 322 * struct nfp_ipv6_addr_entry - cached IPv6 addresses 323 * @ipv6_addr: IP address 324 * @ref_count: number of rules currently using this IP 325 * @list: list pointer 326 */ 327 struct nfp_ipv6_addr_entry { 328 struct in6_addr ipv6_addr; 329 int ref_count; 330 struct list_head list; 331 }; 332 333 struct nfp_fl_payload { 334 struct nfp_fl_rule_metadata meta; 335 unsigned long tc_flower_cookie; 336 struct rhash_head fl_node; 337 struct rcu_head rcu; 338 __be32 nfp_tun_ipv4_addr; 339 struct nfp_ipv6_addr_entry *nfp_tun_ipv6; 340 struct net_device *ingress_dev; 341 char *unmasked_data; 342 char *mask_data; 343 char *action_data; 344 struct list_head linked_flows; 345 bool in_hw; 346 struct { 347 struct net_device *dev; 348 __be16 vlan_tci; 349 __be16 port_idx; 350 } pre_tun_rule; 351 }; 352 353 struct nfp_fl_payload_link { 354 /* A link contains a pointer to a merge flow and an associated sub_flow. 355 * Each merge flow will feature in 2 links to its underlying sub_flows. 356 * A sub_flow will have at least 1 link to a merge flow or more if it 357 * has been used to create multiple merge flows. 358 * 359 * For a merge flow, 'linked_flows' in its nfp_fl_payload struct lists 360 * all links to sub_flows (sub_flow.flow) via merge.list. 361 * For a sub_flow, 'linked_flows' gives all links to merge flows it has 362 * formed (merge_flow.flow) via sub_flow.list. 363 */ 364 struct { 365 struct list_head list; 366 struct nfp_fl_payload *flow; 367 } merge_flow, sub_flow; 368 }; 369 370 extern const struct rhashtable_params nfp_flower_table_params; 371 extern const struct rhashtable_params merge_table_params; 372 373 struct nfp_merge_info { 374 u64 parent_ctx; 375 struct rhash_head ht_node; 376 }; 377 378 struct nfp_fl_stats_frame { 379 __be32 stats_con_id; 380 __be32 pkt_count; 381 __be64 byte_count; 382 __be64 stats_cookie; 383 }; 384 385 struct nfp_meter_stats_entry { 386 u64 pkts; 387 u64 bytes; 388 u64 drops; 389 }; 390 391 struct nfp_meter_entry { 392 struct rhash_head ht_node; 393 u32 meter_id; 394 bool bps; 395 u32 rate; 396 u32 burst; 397 u64 used; 398 struct nfp_meter_stats { 399 u64 update; 400 struct nfp_meter_stats_entry curr; 401 struct nfp_meter_stats_entry prev; 402 } stats; 403 }; 404 405 enum nfp_meter_op { 406 NFP_METER_ADD, 407 NFP_METER_DEL, 408 }; 409 410 static inline bool 411 nfp_flower_internal_port_can_offload(struct nfp_app *app, 412 struct net_device *netdev) 413 { 414 struct nfp_flower_priv *app_priv = app->priv; 415 416 if (!(app_priv->flower_en_feats & NFP_FL_ENABLE_FLOW_MERGE)) 417 return false; 418 if (!netdev->rtnl_link_ops) 419 return false; 420 if (!strcmp(netdev->rtnl_link_ops->kind, "openvswitch")) 421 return true; 422 423 return false; 424 } 425 426 /* The address of the merged flow acts as its cookie. 427 * Cookies supplied to us by TC flower are also addresses to allocated 428 * memory and thus this scheme should not generate any collisions. 429 */ 430 static inline bool nfp_flower_is_merge_flow(struct nfp_fl_payload *flow_pay) 431 { 432 return flow_pay->tc_flower_cookie == (unsigned long)flow_pay; 433 } 434 435 static inline bool nfp_flower_is_supported_bridge(struct net_device *netdev) 436 { 437 return netif_is_ovs_master(netdev); 438 } 439 440 int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, 441 unsigned int host_ctx_split); 442 void nfp_flower_metadata_cleanup(struct nfp_app *app); 443 444 int nfp_flower_setup_tc(struct nfp_app *app, struct net_device *netdev, 445 enum tc_setup_type type, void *type_data); 446 int nfp_flower_merge_offloaded_flows(struct nfp_app *app, 447 struct nfp_fl_payload *sub_flow1, 448 struct nfp_fl_payload *sub_flow2); 449 void 450 nfp_flower_compile_meta(struct nfp_flower_meta_tci *ext, 451 struct nfp_flower_meta_tci *msk, u8 key_type); 452 void 453 nfp_flower_compile_tci(struct nfp_flower_meta_tci *ext, 454 struct nfp_flower_meta_tci *msk, 455 struct flow_rule *rule); 456 void 457 nfp_flower_compile_ext_meta(struct nfp_flower_ext_meta *frame, u32 key_ext); 458 int 459 nfp_flower_compile_port(struct nfp_flower_in_port *frame, u32 cmsg_port, 460 bool mask_version, enum nfp_flower_tun_type tun_type, 461 struct netlink_ext_ack *extack); 462 void 463 nfp_flower_compile_mac(struct nfp_flower_mac_mpls *ext, 464 struct nfp_flower_mac_mpls *msk, 465 struct flow_rule *rule); 466 int 467 nfp_flower_compile_mpls(struct nfp_flower_mac_mpls *ext, 468 struct nfp_flower_mac_mpls *msk, 469 struct flow_rule *rule, 470 struct netlink_ext_ack *extack); 471 void 472 nfp_flower_compile_tport(struct nfp_flower_tp_ports *ext, 473 struct nfp_flower_tp_ports *msk, 474 struct flow_rule *rule); 475 void 476 nfp_flower_compile_vlan(struct nfp_flower_vlan *ext, 477 struct nfp_flower_vlan *msk, 478 struct flow_rule *rule); 479 void 480 nfp_flower_compile_ipv4(struct nfp_flower_ipv4 *ext, 481 struct nfp_flower_ipv4 *msk, struct flow_rule *rule); 482 void 483 nfp_flower_compile_ipv6(struct nfp_flower_ipv6 *ext, 484 struct nfp_flower_ipv6 *msk, struct flow_rule *rule); 485 void 486 nfp_flower_compile_geneve_opt(u8 *ext, u8 *msk, struct flow_rule *rule); 487 void 488 nfp_flower_compile_ipv4_gre_tun(struct nfp_flower_ipv4_gre_tun *ext, 489 struct nfp_flower_ipv4_gre_tun *msk, 490 struct flow_rule *rule); 491 void 492 nfp_flower_compile_ipv4_udp_tun(struct nfp_flower_ipv4_udp_tun *ext, 493 struct nfp_flower_ipv4_udp_tun *msk, 494 struct flow_rule *rule); 495 void 496 nfp_flower_compile_ipv6_udp_tun(struct nfp_flower_ipv6_udp_tun *ext, 497 struct nfp_flower_ipv6_udp_tun *msk, 498 struct flow_rule *rule); 499 void 500 nfp_flower_compile_ipv6_gre_tun(struct nfp_flower_ipv6_gre_tun *ext, 501 struct nfp_flower_ipv6_gre_tun *msk, 502 struct flow_rule *rule); 503 int nfp_flower_compile_flow_match(struct nfp_app *app, 504 struct flow_rule *rule, 505 struct nfp_fl_key_ls *key_ls, 506 struct net_device *netdev, 507 struct nfp_fl_payload *nfp_flow, 508 enum nfp_flower_tun_type tun_type, 509 struct netlink_ext_ack *extack); 510 int nfp_flower_compile_action(struct nfp_app *app, 511 struct flow_rule *rule, 512 struct net_device *netdev, 513 struct nfp_fl_payload *nfp_flow, 514 struct netlink_ext_ack *extack); 515 int nfp_compile_flow_metadata(struct nfp_app *app, u32 cookie, 516 struct nfp_fl_payload *nfp_flow, 517 struct net_device *netdev, 518 struct netlink_ext_ack *extack); 519 void __nfp_modify_flow_metadata(struct nfp_flower_priv *priv, 520 struct nfp_fl_payload *nfp_flow); 521 int nfp_modify_flow_metadata(struct nfp_app *app, 522 struct nfp_fl_payload *nfp_flow); 523 524 struct nfp_fl_payload * 525 nfp_flower_search_fl_table(struct nfp_app *app, unsigned long tc_flower_cookie, 526 struct net_device *netdev); 527 struct nfp_fl_payload * 528 nfp_flower_get_fl_payload_from_ctx(struct nfp_app *app, u32 ctx_id); 529 struct nfp_fl_payload * 530 nfp_flower_remove_fl_table(struct nfp_app *app, unsigned long tc_flower_cookie); 531 532 void nfp_flower_rx_flow_stats(struct nfp_app *app, struct sk_buff *skb); 533 534 int nfp_tunnel_config_start(struct nfp_app *app); 535 void nfp_tunnel_config_stop(struct nfp_app *app); 536 int nfp_tunnel_mac_event_handler(struct nfp_app *app, 537 struct net_device *netdev, 538 unsigned long event, void *ptr); 539 void nfp_tunnel_del_ipv4_off(struct nfp_app *app, __be32 ipv4); 540 void nfp_tunnel_add_ipv4_off(struct nfp_app *app, __be32 ipv4); 541 void 542 nfp_tunnel_put_ipv6_off(struct nfp_app *app, struct nfp_ipv6_addr_entry *entry); 543 struct nfp_ipv6_addr_entry * 544 nfp_tunnel_add_ipv6_off(struct nfp_app *app, struct in6_addr *ipv6); 545 void nfp_tunnel_request_route_v4(struct nfp_app *app, struct sk_buff *skb); 546 void nfp_tunnel_request_route_v6(struct nfp_app *app, struct sk_buff *skb); 547 void nfp_tunnel_keep_alive(struct nfp_app *app, struct sk_buff *skb); 548 void nfp_tunnel_keep_alive_v6(struct nfp_app *app, struct sk_buff *skb); 549 void nfp_flower_lag_init(struct nfp_fl_lag *lag); 550 void nfp_flower_lag_cleanup(struct nfp_fl_lag *lag); 551 int nfp_flower_lag_reset(struct nfp_fl_lag *lag); 552 int nfp_flower_lag_netdev_event(struct nfp_flower_priv *priv, 553 struct net_device *netdev, 554 unsigned long event, void *ptr); 555 bool nfp_flower_lag_unprocessed_msg(struct nfp_app *app, struct sk_buff *skb); 556 int nfp_flower_lag_populate_pre_action(struct nfp_app *app, 557 struct net_device *master, 558 struct nfp_fl_pre_lag *pre_act, 559 struct netlink_ext_ack *extack); 560 int nfp_flower_lag_get_output_id(struct nfp_app *app, 561 struct net_device *master); 562 void nfp_flower_qos_init(struct nfp_app *app); 563 void nfp_flower_qos_cleanup(struct nfp_app *app); 564 int nfp_flower_setup_qos_offload(struct nfp_app *app, struct net_device *netdev, 565 struct tc_cls_matchall_offload *flow); 566 void nfp_flower_stats_rlim_reply(struct nfp_app *app, struct sk_buff *skb); 567 int nfp_flower_indr_setup_tc_cb(struct net_device *netdev, struct Qdisc *sch, void *cb_priv, 568 enum tc_setup_type type, void *type_data, 569 void *data, 570 void (*cleanup)(struct flow_block_cb *block_cb)); 571 void nfp_flower_setup_indr_tc_release(void *cb_priv); 572 573 void 574 __nfp_flower_non_repr_priv_get(struct nfp_flower_non_repr_priv *non_repr_priv); 575 struct nfp_flower_non_repr_priv * 576 nfp_flower_non_repr_priv_get(struct nfp_app *app, struct net_device *netdev); 577 void 578 __nfp_flower_non_repr_priv_put(struct nfp_flower_non_repr_priv *non_repr_priv); 579 void 580 nfp_flower_non_repr_priv_put(struct nfp_app *app, struct net_device *netdev); 581 u32 nfp_flower_get_port_id_from_netdev(struct nfp_app *app, 582 struct net_device *netdev); 583 int nfp_flower_xmit_pre_tun_flow(struct nfp_app *app, 584 struct nfp_fl_payload *flow); 585 int nfp_flower_xmit_pre_tun_del_flow(struct nfp_app *app, 586 struct nfp_fl_payload *flow); 587 588 struct nfp_fl_payload * 589 nfp_flower_allocate_new(struct nfp_fl_key_ls *key_layer); 590 int nfp_flower_calculate_key_layers(struct nfp_app *app, 591 struct net_device *netdev, 592 struct nfp_fl_key_ls *ret_key_ls, 593 struct flow_rule *flow, 594 enum nfp_flower_tun_type *tun_type, 595 struct netlink_ext_ack *extack); 596 void 597 nfp_flower_del_linked_merge_flows(struct nfp_app *app, 598 struct nfp_fl_payload *sub_flow); 599 int 600 nfp_flower_xmit_flow(struct nfp_app *app, struct nfp_fl_payload *nfp_flow, 601 u8 mtype); 602 void 603 nfp_flower_update_merge_stats(struct nfp_app *app, 604 struct nfp_fl_payload *sub_flow); 605 606 int nfp_setup_tc_act_offload(struct nfp_app *app, 607 struct flow_offload_action *fl_act); 608 int nfp_init_meter_table(struct nfp_app *app); 609 void nfp_flower_stats_meter_request_all(struct nfp_flower_priv *fl_priv); 610 void nfp_act_stats_reply(struct nfp_app *app, void *pmsg); 611 int nfp_flower_offload_one_police(struct nfp_app *app, bool ingress, 612 bool pps, u32 id, u32 rate, u32 burst); 613 int nfp_flower_setup_meter_entry(struct nfp_app *app, 614 const struct flow_action_entry *action, 615 enum nfp_meter_op op, 616 u32 meter_id); 617 struct nfp_meter_entry * 618 nfp_flower_search_meter_entry(struct nfp_app *app, u32 meter_id); 619 #endif 620