hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/net/ethernet/netronome/nfp/flower/cmsg.h
....@@ -1,35 +1,5 @@
1
-/*
2
- * Copyright (C) 2017 Netronome Systems, Inc.
3
- *
4
- * This software is dual licensed under the GNU General License Version 2,
5
- * June 1991 as shown in the file COPYING in the top-level directory of this
6
- * source tree or the BSD 2-Clause License provided below. You have the
7
- * option to license this software under the complete terms of either license.
8
- *
9
- * The BSD 2-Clause License:
10
- *
11
- * Redistribution and use in source and binary forms, with or
12
- * without modification, are permitted provided that the following
13
- * conditions are met:
14
- *
15
- * 1. Redistributions of source code must retain the above
16
- * copyright notice, this list of conditions and the following
17
- * disclaimer.
18
- *
19
- * 2. Redistributions in binary form must reproduce the above
20
- * copyright notice, this list of conditions and the following
21
- * disclaimer in the documentation and/or other materials
22
- * provided with the distribution.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- * SOFTWARE.
32
- */
1
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2
+/* Copyright (C) 2017-2018 Netronome Systems, Inc. */
333
344 #ifndef NFP_FLOWER_CMSG_H
355 #define NFP_FLOWER_CMSG_H
....@@ -38,6 +8,8 @@
388 #include <linux/skbuff.h>
399 #include <linux/types.h>
4010 #include <net/geneve.h>
11
+#include <net/gre.h>
12
+#include <net/vxlan.h>
4113
4214 #include "../nfp_app.h"
4315 #include "../nfpcore/nfp_cpp.h"
....@@ -51,8 +23,11 @@
5123 #define NFP_FLOWER_LAYER_CT BIT(6)
5224 #define NFP_FLOWER_LAYER_VXLAN BIT(7)
5325
26
+#define NFP_FLOWER_LAYER2_GRE BIT(0)
27
+#define NFP_FLOWER_LAYER2_QINQ BIT(4)
5428 #define NFP_FLOWER_LAYER2_GENEVE BIT(5)
5529 #define NFP_FLOWER_LAYER2_GENEVE_OP BIT(6)
30
+#define NFP_FLOWER_LAYER2_TUN_IPV6 BIT(7)
5631
5732 #define NFP_FLOWER_MASK_VLAN_PRIO GENMASK(15, 13)
5833 #define NFP_FLOWER_MASK_VLAN_PRESENT BIT(12)
....@@ -65,6 +40,9 @@
6540
6641 #define NFP_FL_IP_FRAG_FIRST BIT(7)
6742 #define NFP_FL_IP_FRAGMENTED BIT(6)
43
+
44
+/* GRE Tunnel flags */
45
+#define NFP_FL_GRE_FLAG_KEY BIT(2)
6846
6947 /* Compressed HW representation of TCP Flags */
7048 #define NFP_FL_TCP_FLAG_URG BIT(4)
....@@ -87,16 +65,22 @@
8765 #define NFP_FL_MAX_GENEVE_OPT_ACT 32
8866 #define NFP_FL_MAX_GENEVE_OPT_CNT 64
8967 #define NFP_FL_MAX_GENEVE_OPT_KEY 32
68
+#define NFP_FL_MAX_GENEVE_OPT_KEY_V6 8
9069
9170 /* Action opcodes */
9271 #define NFP_FL_ACTION_OPCODE_OUTPUT 0
9372 #define NFP_FL_ACTION_OPCODE_PUSH_VLAN 1
9473 #define NFP_FL_ACTION_OPCODE_POP_VLAN 2
95
-#define NFP_FL_ACTION_OPCODE_SET_IPV4_TUNNEL 6
74
+#define NFP_FL_ACTION_OPCODE_PUSH_MPLS 3
75
+#define NFP_FL_ACTION_OPCODE_POP_MPLS 4
76
+#define NFP_FL_ACTION_OPCODE_SET_TUNNEL 6
9677 #define NFP_FL_ACTION_OPCODE_SET_ETHERNET 7
78
+#define NFP_FL_ACTION_OPCODE_SET_MPLS 8
9779 #define NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS 9
80
+#define NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS 10
9881 #define NFP_FL_ACTION_OPCODE_SET_IPV6_SRC 11
9982 #define NFP_FL_ACTION_OPCODE_SET_IPV6_DST 12
83
+#define NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL 13
10084 #define NFP_FL_ACTION_OPCODE_SET_UDP 14
10185 #define NFP_FL_ACTION_OPCODE_SET_TCP 15
10286 #define NFP_FL_ACTION_OPCODE_PRE_LAG 16
....@@ -111,15 +95,20 @@
11195 #define NFP_FL_PUSH_VLAN_PRIO GENMASK(15, 13)
11296 #define NFP_FL_PUSH_VLAN_VID GENMASK(11, 0)
11397
98
+#define IPV6_FLOW_LABEL_MASK cpu_to_be32(0x000fffff)
99
+
114100 /* LAG ports */
115101 #define NFP_FL_LAG_OUT 0xC0DE0000
116102
117103 /* Tunnel ports */
118104 #define NFP_FL_PORT_TYPE_TUN 0x50000000
119
-#define NFP_FL_IPV4_TUNNEL_TYPE GENMASK(7, 4)
120
-#define NFP_FL_IPV4_PRE_TUN_INDEX GENMASK(2, 0)
105
+#define NFP_FL_TUNNEL_TYPE GENMASK(7, 4)
106
+#define NFP_FL_PRE_TUN_INDEX GENMASK(2, 0)
121107
122108 #define NFP_FLOWER_WORKQ_MAX_SKBS 30000
109
+
110
+/* Cmesg reply (empirical) timeout*/
111
+#define NFP_FL_REPLY_TIMEOUT msecs_to_jiffies(40)
123112
124113 #define nfp_flower_cmsg_warn(app, fmt, args...) \
125114 do { \
....@@ -129,6 +118,7 @@
129118
130119 enum nfp_flower_tun_type {
131120 NFP_FL_TUNNEL_NONE = 0,
121
+ NFP_FL_TUNNEL_GRE = 1,
132122 NFP_FL_TUNNEL_VXLAN = 2,
133123 NFP_FL_TUNNEL_GENEVE = 4,
134124 };
....@@ -152,6 +142,26 @@
152142 __be32 ipv4_src;
153143 __be32 ipv4_dst_mask;
154144 __be32 ipv4_dst;
145
+};
146
+
147
+struct nfp_fl_set_ip4_ttl_tos {
148
+ struct nfp_fl_act_head head;
149
+ u8 ipv4_ttl_mask;
150
+ u8 ipv4_tos_mask;
151
+ u8 ipv4_ttl;
152
+ u8 ipv4_tos;
153
+ __be16 reserved;
154
+};
155
+
156
+struct nfp_fl_set_ipv6_tc_hl_fl {
157
+ struct nfp_fl_act_head head;
158
+ u8 ipv6_tc_mask;
159
+ u8 ipv6_hop_limit_mask;
160
+ __be16 reserved;
161
+ u8 ipv6_tc;
162
+ u8 ipv6_hop_limit;
163
+ __be32 ipv6_label_mask;
164
+ __be32 ipv6_label;
155165 };
156166
157167 struct nfp_fl_set_ipv6_addr {
....@@ -199,13 +209,16 @@
199209
200210 struct nfp_fl_pre_tunnel {
201211 struct nfp_fl_act_head head;
202
- __be16 reserved;
203
- __be32 ipv4_dst;
204
- /* reserved for use with IPv6 addresses */
205
- __be32 extra[3];
212
+ __be16 flags;
213
+ union {
214
+ __be32 ipv4_dst;
215
+ struct in6_addr ipv6_dst;
216
+ };
206217 };
207218
208
-struct nfp_fl_set_ipv4_udp_tun {
219
+#define NFP_FL_PRE_TUN_IPV6 BIT(0)
220
+
221
+struct nfp_fl_set_tun {
209222 struct nfp_fl_act_head head;
210223 __be16 reserved;
211224 __be64 tun_id __packed;
....@@ -213,7 +226,8 @@
213226 __be16 tun_flags;
214227 u8 ttl;
215228 u8 tos;
216
- __be32 extra;
229
+ __be16 outer_vlan_tpid;
230
+ __be16 outer_vlan_tci;
217231 u8 tun_len;
218232 u8 res2;
219233 __be16 tun_proto;
....@@ -226,6 +240,24 @@
226240 u8 type;
227241 u8 length;
228242 u8 opt_data[];
243
+};
244
+
245
+struct nfp_fl_push_mpls {
246
+ struct nfp_fl_act_head head;
247
+ __be16 ethtype;
248
+ __be32 lse;
249
+};
250
+
251
+struct nfp_fl_pop_mpls {
252
+ struct nfp_fl_act_head head;
253
+ __be16 ethtype;
254
+};
255
+
256
+struct nfp_fl_set_mpls {
257
+ struct nfp_fl_act_head head;
258
+ __be16 reserved;
259
+ __be32 lse_mask;
260
+ __be32 lse;
229261 };
230262
231263 /* Metadata with L2 (1W/4B)
....@@ -286,6 +318,22 @@
286318 u8 mac_dst[6];
287319 u8 mac_src[6];
288320 __be32 mpls_lse;
321
+};
322
+
323
+/* VLAN details (2W/8B)
324
+ * 3 2 1
325
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
326
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
327
+ * | outer_tpid | outer_tci |
328
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
329
+ * | inner_tpid | inner_tci |
330
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
331
+ */
332
+struct nfp_flower_vlan {
333
+ __be16 outer_tpid;
334
+ __be16 outer_tci;
335
+ __be16 inner_tpid;
336
+ __be16 inner_tci;
289337 };
290338
291339 /* L4 ports (for UDP, TCP, SCTP) (1W/4B)
....@@ -356,6 +404,21 @@
356404 struct in6_addr ipv6_dst;
357405 };
358406
407
+struct nfp_flower_tun_ipv4 {
408
+ __be32 src;
409
+ __be32 dst;
410
+};
411
+
412
+struct nfp_flower_tun_ipv6 {
413
+ struct in6_addr src;
414
+ struct in6_addr dst;
415
+};
416
+
417
+struct nfp_flower_tun_ip_ext {
418
+ u8 tos;
419
+ u8 ttl;
420
+};
421
+
359422 /* Flow Frame IPv4 UDP TUNNEL --> Tunnel details (4W/16B)
360423 * -----------------------------------------------------------------
361424 * 3 2 1
....@@ -373,13 +436,116 @@
373436 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
374437 */
375438 struct nfp_flower_ipv4_udp_tun {
376
- __be32 ip_src;
377
- __be32 ip_dst;
439
+ struct nfp_flower_tun_ipv4 ipv4;
378440 __be16 reserved1;
379
- u8 tos;
380
- u8 ttl;
441
+ struct nfp_flower_tun_ip_ext ip_ext;
381442 __be32 reserved2;
382443 __be32 tun_id;
444
+};
445
+
446
+/* Flow Frame IPv6 UDP TUNNEL --> Tunnel details (11W/44B)
447
+ * -----------------------------------------------------------------
448
+ * 3 2 1
449
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
450
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
451
+ * | ipv6_addr_src, 31 - 0 |
452
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
453
+ * | ipv6_addr_src, 63 - 32 |
454
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
455
+ * | ipv6_addr_src, 95 - 64 |
456
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
457
+ * | ipv6_addr_src, 127 - 96 |
458
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
459
+ * | ipv6_addr_dst, 31 - 0 |
460
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
461
+ * | ipv6_addr_dst, 63 - 32 |
462
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
463
+ * | ipv6_addr_dst, 95 - 64 |
464
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
465
+ * | ipv6_addr_dst, 127 - 96 |
466
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
467
+ * | Reserved | tos | ttl |
468
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
469
+ * | Reserved |
470
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
471
+ * | VNI | Reserved |
472
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
473
+ */
474
+struct nfp_flower_ipv6_udp_tun {
475
+ struct nfp_flower_tun_ipv6 ipv6;
476
+ __be16 reserved1;
477
+ struct nfp_flower_tun_ip_ext ip_ext;
478
+ __be32 reserved2;
479
+ __be32 tun_id;
480
+};
481
+
482
+/* Flow Frame GRE TUNNEL --> Tunnel details (6W/24B)
483
+ * -----------------------------------------------------------------
484
+ * 3 2 1
485
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
486
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
487
+ * | ipv4_addr_src |
488
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
489
+ * | ipv4_addr_dst |
490
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
491
+ * | tun_flags | tos | ttl |
492
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
493
+ * | Reserved | Ethertype |
494
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
495
+ * | Key |
496
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
497
+ * | Reserved |
498
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
499
+ */
500
+
501
+struct nfp_flower_ipv4_gre_tun {
502
+ struct nfp_flower_tun_ipv4 ipv4;
503
+ __be16 tun_flags;
504
+ struct nfp_flower_tun_ip_ext ip_ext;
505
+ __be16 reserved1;
506
+ __be16 ethertype;
507
+ __be32 tun_key;
508
+ __be32 reserved2;
509
+};
510
+
511
+/* Flow Frame GRE TUNNEL V6 --> Tunnel details (12W/48B)
512
+ * -----------------------------------------------------------------
513
+ * 3 2 1
514
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
515
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
516
+ * | ipv6_addr_src, 31 - 0 |
517
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
518
+ * | ipv6_addr_src, 63 - 32 |
519
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
520
+ * | ipv6_addr_src, 95 - 64 |
521
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
522
+ * | ipv6_addr_src, 127 - 96 |
523
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
524
+ * | ipv6_addr_dst, 31 - 0 |
525
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
526
+ * | ipv6_addr_dst, 63 - 32 |
527
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
528
+ * | ipv6_addr_dst, 95 - 64 |
529
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
530
+ * | ipv6_addr_dst, 127 - 96 |
531
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
532
+ * | tun_flags | tos | ttl |
533
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
534
+ * | Reserved | Ethertype |
535
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
536
+ * | Key |
537
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
538
+ * | Reserved |
539
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
540
+ */
541
+struct nfp_flower_ipv6_gre_tun {
542
+ struct nfp_flower_tun_ipv6 ipv6;
543
+ __be16 tun_flags;
544
+ struct nfp_flower_tun_ip_ext ip_ext;
545
+ __be16 reserved1;
546
+ __be16 ethertype;
547
+ __be32 tun_key;
548
+ __be32 reserved2;
383549 };
384550
385551 struct nfp_flower_geneve_options {
....@@ -404,11 +570,13 @@
404570 /* Types defined for port related control messages */
405571 enum nfp_flower_cmsg_type_port {
406572 NFP_FLOWER_CMSG_TYPE_FLOW_ADD = 0,
573
+ NFP_FLOWER_CMSG_TYPE_FLOW_MOD = 1,
407574 NFP_FLOWER_CMSG_TYPE_FLOW_DEL = 2,
408575 NFP_FLOWER_CMSG_TYPE_LAG_CONFIG = 4,
409576 NFP_FLOWER_CMSG_TYPE_PORT_REIFY = 6,
410577 NFP_FLOWER_CMSG_TYPE_MAC_REPR = 7,
411578 NFP_FLOWER_CMSG_TYPE_PORT_MOD = 8,
579
+ NFP_FLOWER_CMSG_TYPE_MERGE_HINT = 9,
412580 NFP_FLOWER_CMSG_TYPE_NO_NEIGH = 10,
413581 NFP_FLOWER_CMSG_TYPE_TUN_MAC = 11,
414582 NFP_FLOWER_CMSG_TYPE_ACTIVE_TUNS = 12,
....@@ -416,6 +584,14 @@
416584 NFP_FLOWER_CMSG_TYPE_TUN_IPS = 14,
417585 NFP_FLOWER_CMSG_TYPE_FLOW_STATS = 15,
418586 NFP_FLOWER_CMSG_TYPE_PORT_ECHO = 16,
587
+ NFP_FLOWER_CMSG_TYPE_QOS_MOD = 18,
588
+ NFP_FLOWER_CMSG_TYPE_QOS_DEL = 19,
589
+ NFP_FLOWER_CMSG_TYPE_QOS_STATS = 20,
590
+ NFP_FLOWER_CMSG_TYPE_PRE_TUN_RULE = 21,
591
+ NFP_FLOWER_CMSG_TYPE_TUN_IPS_V6 = 22,
592
+ NFP_FLOWER_CMSG_TYPE_NO_NEIGH_V6 = 23,
593
+ NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6 = 24,
594
+ NFP_FLOWER_CMSG_TYPE_ACTIVE_TUNS_V6 = 25,
419595 NFP_FLOWER_CMSG_TYPE_MAX = 32,
420596 };
421597
....@@ -428,7 +604,7 @@
428604 u8 info;
429605 u8 nbi_port;
430606 u8 phys_port;
431
- } ports[0];
607
+ } ports[];
432608 };
433609
434610 #define NFP_FLOWER_CMSG_MAC_REPR_NBI GENMASK(1, 0)
....@@ -453,6 +629,16 @@
453629
454630 #define NFP_FLOWER_CMSG_PORTREIFY_INFO_EXIST BIT(0)
455631
632
+/* NFP_FLOWER_CMSG_TYPE_FLOW_MERGE_HINT */
633
+struct nfp_flower_cmsg_merge_hint {
634
+ u8 reserved[3];
635
+ u8 count;
636
+ struct {
637
+ __be32 host_ctx;
638
+ __be64 host_cookie;
639
+ } __packed flow[];
640
+};
641
+
456642 enum nfp_flower_cmsg_port_type {
457643 NFP_FLOWER_CMSG_PORT_TYPE_UNSPEC = 0x0,
458644 NFP_FLOWER_CMSG_PORT_TYPE_PHYS_PORT = 0x1,
....@@ -474,6 +660,13 @@
474660 #define NFP_FLOWER_CMSG_PORT_VNIC GENMASK(11, 6)
475661 #define NFP_FLOWER_CMSG_PORT_PCIE_Q GENMASK(5, 0)
476662 #define NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM GENMASK(7, 0)
663
+
664
+static inline u32 nfp_flower_internal_port_get_port_id(u8 internal_port)
665
+{
666
+ return FIELD_PREP(NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM, internal_port) |
667
+ FIELD_PREP(NFP_FLOWER_CMSG_PORT_TYPE,
668
+ NFP_FLOWER_CMSG_PORT_TYPE_OTHER_PORT);
669
+}
477670
478671 static inline u32 nfp_flower_cmsg_phys_port(u8 phys_port)
479672 {
....@@ -504,6 +697,36 @@
504697 return skb->len - NFP_FLOWER_CMSG_HLEN;
505698 }
506699
700
+static inline bool
701
+nfp_fl_netdev_is_tunnel_type(struct net_device *netdev,
702
+ enum nfp_flower_tun_type tun_type)
703
+{
704
+ if (netif_is_vxlan(netdev))
705
+ return tun_type == NFP_FL_TUNNEL_VXLAN;
706
+ if (netif_is_gretap(netdev))
707
+ return tun_type == NFP_FL_TUNNEL_GRE;
708
+ if (netif_is_geneve(netdev))
709
+ return tun_type == NFP_FL_TUNNEL_GENEVE;
710
+
711
+ return false;
712
+}
713
+
714
+static inline bool nfp_fl_is_netdev_to_offload(struct net_device *netdev)
715
+{
716
+ if (!netdev->rtnl_link_ops)
717
+ return false;
718
+ if (!strcmp(netdev->rtnl_link_ops->kind, "openvswitch"))
719
+ return true;
720
+ if (netif_is_vxlan(netdev))
721
+ return true;
722
+ if (netif_is_geneve(netdev))
723
+ return true;
724
+ if (netif_is_gretap(netdev))
725
+ return true;
726
+
727
+ return false;
728
+}
729
+
507730 struct sk_buff *
508731 nfp_flower_cmsg_mac_repr_start(struct nfp_app *app, unsigned int num_ports);
509732 void