.. | .. |
---|
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. */ |
---|
33 | 3 | |
---|
34 | 4 | #ifndef NFP_FLOWER_CMSG_H |
---|
35 | 5 | #define NFP_FLOWER_CMSG_H |
---|
.. | .. |
---|
38 | 8 | #include <linux/skbuff.h> |
---|
39 | 9 | #include <linux/types.h> |
---|
40 | 10 | #include <net/geneve.h> |
---|
| 11 | +#include <net/gre.h> |
---|
| 12 | +#include <net/vxlan.h> |
---|
41 | 13 | |
---|
42 | 14 | #include "../nfp_app.h" |
---|
43 | 15 | #include "../nfpcore/nfp_cpp.h" |
---|
.. | .. |
---|
51 | 23 | #define NFP_FLOWER_LAYER_CT BIT(6) |
---|
52 | 24 | #define NFP_FLOWER_LAYER_VXLAN BIT(7) |
---|
53 | 25 | |
---|
| 26 | +#define NFP_FLOWER_LAYER2_GRE BIT(0) |
---|
| 27 | +#define NFP_FLOWER_LAYER2_QINQ BIT(4) |
---|
54 | 28 | #define NFP_FLOWER_LAYER2_GENEVE BIT(5) |
---|
55 | 29 | #define NFP_FLOWER_LAYER2_GENEVE_OP BIT(6) |
---|
| 30 | +#define NFP_FLOWER_LAYER2_TUN_IPV6 BIT(7) |
---|
56 | 31 | |
---|
57 | 32 | #define NFP_FLOWER_MASK_VLAN_PRIO GENMASK(15, 13) |
---|
58 | 33 | #define NFP_FLOWER_MASK_VLAN_PRESENT BIT(12) |
---|
.. | .. |
---|
65 | 40 | |
---|
66 | 41 | #define NFP_FL_IP_FRAG_FIRST BIT(7) |
---|
67 | 42 | #define NFP_FL_IP_FRAGMENTED BIT(6) |
---|
| 43 | + |
---|
| 44 | +/* GRE Tunnel flags */ |
---|
| 45 | +#define NFP_FL_GRE_FLAG_KEY BIT(2) |
---|
68 | 46 | |
---|
69 | 47 | /* Compressed HW representation of TCP Flags */ |
---|
70 | 48 | #define NFP_FL_TCP_FLAG_URG BIT(4) |
---|
.. | .. |
---|
87 | 65 | #define NFP_FL_MAX_GENEVE_OPT_ACT 32 |
---|
88 | 66 | #define NFP_FL_MAX_GENEVE_OPT_CNT 64 |
---|
89 | 67 | #define NFP_FL_MAX_GENEVE_OPT_KEY 32 |
---|
| 68 | +#define NFP_FL_MAX_GENEVE_OPT_KEY_V6 8 |
---|
90 | 69 | |
---|
91 | 70 | /* Action opcodes */ |
---|
92 | 71 | #define NFP_FL_ACTION_OPCODE_OUTPUT 0 |
---|
93 | 72 | #define NFP_FL_ACTION_OPCODE_PUSH_VLAN 1 |
---|
94 | 73 | #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 |
---|
96 | 77 | #define NFP_FL_ACTION_OPCODE_SET_ETHERNET 7 |
---|
| 78 | +#define NFP_FL_ACTION_OPCODE_SET_MPLS 8 |
---|
97 | 79 | #define NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS 9 |
---|
| 80 | +#define NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS 10 |
---|
98 | 81 | #define NFP_FL_ACTION_OPCODE_SET_IPV6_SRC 11 |
---|
99 | 82 | #define NFP_FL_ACTION_OPCODE_SET_IPV6_DST 12 |
---|
| 83 | +#define NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL 13 |
---|
100 | 84 | #define NFP_FL_ACTION_OPCODE_SET_UDP 14 |
---|
101 | 85 | #define NFP_FL_ACTION_OPCODE_SET_TCP 15 |
---|
102 | 86 | #define NFP_FL_ACTION_OPCODE_PRE_LAG 16 |
---|
.. | .. |
---|
111 | 95 | #define NFP_FL_PUSH_VLAN_PRIO GENMASK(15, 13) |
---|
112 | 96 | #define NFP_FL_PUSH_VLAN_VID GENMASK(11, 0) |
---|
113 | 97 | |
---|
| 98 | +#define IPV6_FLOW_LABEL_MASK cpu_to_be32(0x000fffff) |
---|
| 99 | + |
---|
114 | 100 | /* LAG ports */ |
---|
115 | 101 | #define NFP_FL_LAG_OUT 0xC0DE0000 |
---|
116 | 102 | |
---|
117 | 103 | /* Tunnel ports */ |
---|
118 | 104 | #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) |
---|
121 | 107 | |
---|
122 | 108 | #define NFP_FLOWER_WORKQ_MAX_SKBS 30000 |
---|
| 109 | + |
---|
| 110 | +/* Cmesg reply (empirical) timeout*/ |
---|
| 111 | +#define NFP_FL_REPLY_TIMEOUT msecs_to_jiffies(40) |
---|
123 | 112 | |
---|
124 | 113 | #define nfp_flower_cmsg_warn(app, fmt, args...) \ |
---|
125 | 114 | do { \ |
---|
.. | .. |
---|
129 | 118 | |
---|
130 | 119 | enum nfp_flower_tun_type { |
---|
131 | 120 | NFP_FL_TUNNEL_NONE = 0, |
---|
| 121 | + NFP_FL_TUNNEL_GRE = 1, |
---|
132 | 122 | NFP_FL_TUNNEL_VXLAN = 2, |
---|
133 | 123 | NFP_FL_TUNNEL_GENEVE = 4, |
---|
134 | 124 | }; |
---|
.. | .. |
---|
152 | 142 | __be32 ipv4_src; |
---|
153 | 143 | __be32 ipv4_dst_mask; |
---|
154 | 144 | __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; |
---|
155 | 165 | }; |
---|
156 | 166 | |
---|
157 | 167 | struct nfp_fl_set_ipv6_addr { |
---|
.. | .. |
---|
199 | 209 | |
---|
200 | 210 | struct nfp_fl_pre_tunnel { |
---|
201 | 211 | 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 | + }; |
---|
206 | 217 | }; |
---|
207 | 218 | |
---|
208 | | -struct nfp_fl_set_ipv4_udp_tun { |
---|
| 219 | +#define NFP_FL_PRE_TUN_IPV6 BIT(0) |
---|
| 220 | + |
---|
| 221 | +struct nfp_fl_set_tun { |
---|
209 | 222 | struct nfp_fl_act_head head; |
---|
210 | 223 | __be16 reserved; |
---|
211 | 224 | __be64 tun_id __packed; |
---|
.. | .. |
---|
213 | 226 | __be16 tun_flags; |
---|
214 | 227 | u8 ttl; |
---|
215 | 228 | u8 tos; |
---|
216 | | - __be32 extra; |
---|
| 229 | + __be16 outer_vlan_tpid; |
---|
| 230 | + __be16 outer_vlan_tci; |
---|
217 | 231 | u8 tun_len; |
---|
218 | 232 | u8 res2; |
---|
219 | 233 | __be16 tun_proto; |
---|
.. | .. |
---|
226 | 240 | u8 type; |
---|
227 | 241 | u8 length; |
---|
228 | 242 | 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; |
---|
229 | 261 | }; |
---|
230 | 262 | |
---|
231 | 263 | /* Metadata with L2 (1W/4B) |
---|
.. | .. |
---|
286 | 318 | u8 mac_dst[6]; |
---|
287 | 319 | u8 mac_src[6]; |
---|
288 | 320 | __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; |
---|
289 | 337 | }; |
---|
290 | 338 | |
---|
291 | 339 | /* L4 ports (for UDP, TCP, SCTP) (1W/4B) |
---|
.. | .. |
---|
356 | 404 | struct in6_addr ipv6_dst; |
---|
357 | 405 | }; |
---|
358 | 406 | |
---|
| 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 | + |
---|
359 | 422 | /* Flow Frame IPv4 UDP TUNNEL --> Tunnel details (4W/16B) |
---|
360 | 423 | * ----------------------------------------------------------------- |
---|
361 | 424 | * 3 2 1 |
---|
.. | .. |
---|
373 | 436 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
---|
374 | 437 | */ |
---|
375 | 438 | struct nfp_flower_ipv4_udp_tun { |
---|
376 | | - __be32 ip_src; |
---|
377 | | - __be32 ip_dst; |
---|
| 439 | + struct nfp_flower_tun_ipv4 ipv4; |
---|
378 | 440 | __be16 reserved1; |
---|
379 | | - u8 tos; |
---|
380 | | - u8 ttl; |
---|
| 441 | + struct nfp_flower_tun_ip_ext ip_ext; |
---|
381 | 442 | __be32 reserved2; |
---|
382 | 443 | __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; |
---|
383 | 549 | }; |
---|
384 | 550 | |
---|
385 | 551 | struct nfp_flower_geneve_options { |
---|
.. | .. |
---|
404 | 570 | /* Types defined for port related control messages */ |
---|
405 | 571 | enum nfp_flower_cmsg_type_port { |
---|
406 | 572 | NFP_FLOWER_CMSG_TYPE_FLOW_ADD = 0, |
---|
| 573 | + NFP_FLOWER_CMSG_TYPE_FLOW_MOD = 1, |
---|
407 | 574 | NFP_FLOWER_CMSG_TYPE_FLOW_DEL = 2, |
---|
408 | 575 | NFP_FLOWER_CMSG_TYPE_LAG_CONFIG = 4, |
---|
409 | 576 | NFP_FLOWER_CMSG_TYPE_PORT_REIFY = 6, |
---|
410 | 577 | NFP_FLOWER_CMSG_TYPE_MAC_REPR = 7, |
---|
411 | 578 | NFP_FLOWER_CMSG_TYPE_PORT_MOD = 8, |
---|
| 579 | + NFP_FLOWER_CMSG_TYPE_MERGE_HINT = 9, |
---|
412 | 580 | NFP_FLOWER_CMSG_TYPE_NO_NEIGH = 10, |
---|
413 | 581 | NFP_FLOWER_CMSG_TYPE_TUN_MAC = 11, |
---|
414 | 582 | NFP_FLOWER_CMSG_TYPE_ACTIVE_TUNS = 12, |
---|
.. | .. |
---|
416 | 584 | NFP_FLOWER_CMSG_TYPE_TUN_IPS = 14, |
---|
417 | 585 | NFP_FLOWER_CMSG_TYPE_FLOW_STATS = 15, |
---|
418 | 586 | 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, |
---|
419 | 595 | NFP_FLOWER_CMSG_TYPE_MAX = 32, |
---|
420 | 596 | }; |
---|
421 | 597 | |
---|
.. | .. |
---|
428 | 604 | u8 info; |
---|
429 | 605 | u8 nbi_port; |
---|
430 | 606 | u8 phys_port; |
---|
431 | | - } ports[0]; |
---|
| 607 | + } ports[]; |
---|
432 | 608 | }; |
---|
433 | 609 | |
---|
434 | 610 | #define NFP_FLOWER_CMSG_MAC_REPR_NBI GENMASK(1, 0) |
---|
.. | .. |
---|
453 | 629 | |
---|
454 | 630 | #define NFP_FLOWER_CMSG_PORTREIFY_INFO_EXIST BIT(0) |
---|
455 | 631 | |
---|
| 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 | + |
---|
456 | 642 | enum nfp_flower_cmsg_port_type { |
---|
457 | 643 | NFP_FLOWER_CMSG_PORT_TYPE_UNSPEC = 0x0, |
---|
458 | 644 | NFP_FLOWER_CMSG_PORT_TYPE_PHYS_PORT = 0x1, |
---|
.. | .. |
---|
474 | 660 | #define NFP_FLOWER_CMSG_PORT_VNIC GENMASK(11, 6) |
---|
475 | 661 | #define NFP_FLOWER_CMSG_PORT_PCIE_Q GENMASK(5, 0) |
---|
476 | 662 | #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 | +} |
---|
477 | 670 | |
---|
478 | 671 | static inline u32 nfp_flower_cmsg_phys_port(u8 phys_port) |
---|
479 | 672 | { |
---|
.. | .. |
---|
504 | 697 | return skb->len - NFP_FLOWER_CMSG_HLEN; |
---|
505 | 698 | } |
---|
506 | 699 | |
---|
| 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 | + |
---|
507 | 730 | struct sk_buff * |
---|
508 | 731 | nfp_flower_cmsg_mac_repr_start(struct nfp_app *app, unsigned int num_ports); |
---|
509 | 732 | void |
---|