xref: /linux/drivers/net/ethernet/netronome/nfp/flower/cmsg.h (revision 83a37b3292f4aca799b355179ad6fbdd78a08e10)
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  */
33 
34 #ifndef NFP_FLOWER_CMSG_H
35 #define NFP_FLOWER_CMSG_H
36 
37 #include <linux/bitfield.h>
38 #include <linux/skbuff.h>
39 #include <linux/types.h>
40 
41 #include "../nfp_app.h"
42 #include "../nfpcore/nfp_cpp.h"
43 
44 #define NFP_FLOWER_LAYER_META		BIT(0)
45 #define NFP_FLOWER_LAYER_PORT		BIT(1)
46 #define NFP_FLOWER_LAYER_MAC		BIT(2)
47 #define NFP_FLOWER_LAYER_TP		BIT(3)
48 #define NFP_FLOWER_LAYER_IPV4		BIT(4)
49 #define NFP_FLOWER_LAYER_IPV6		BIT(5)
50 #define NFP_FLOWER_LAYER_CT		BIT(6)
51 #define NFP_FLOWER_LAYER_VXLAN		BIT(7)
52 
53 #define NFP_FLOWER_LAYER_ETHER		BIT(3)
54 #define NFP_FLOWER_LAYER_ARP		BIT(4)
55 
56 #define NFP_FLOWER_MASK_VLAN_PRIO	GENMASK(15, 13)
57 #define NFP_FLOWER_MASK_VLAN_CFI	BIT(12)
58 #define NFP_FLOWER_MASK_VLAN_VID	GENMASK(11, 0)
59 
60 #define NFP_FLOWER_MASK_MPLS_LB		GENMASK(31, 12)
61 #define NFP_FLOWER_MASK_MPLS_TC		GENMASK(11, 9)
62 #define NFP_FLOWER_MASK_MPLS_BOS	BIT(8)
63 #define NFP_FLOWER_MASK_MPLS_Q		BIT(0)
64 
65 #define NFP_FL_SC_ACT_DROP		0x80000000
66 #define NFP_FL_SC_ACT_USER		0x7D000000
67 #define NFP_FL_SC_ACT_POPV		0x6A000000
68 #define NFP_FL_SC_ACT_NULL		0x00000000
69 
70 /* The maximum action list size (in bytes) supported by the NFP.
71  */
72 #define NFP_FL_MAX_A_SIZ		1216
73 #define NFP_FL_LW_SIZ			2
74 
75 /* Action opcodes */
76 #define NFP_FL_ACTION_OPCODE_OUTPUT		0
77 #define NFP_FL_ACTION_OPCODE_PUSH_VLAN		1
78 #define NFP_FL_ACTION_OPCODE_POP_VLAN		2
79 #define NFP_FL_ACTION_OPCODE_SET_IPV4_TUNNEL	6
80 #define NFP_FL_ACTION_OPCODE_SET_ETHERNET	7
81 #define NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS	9
82 #define NFP_FL_ACTION_OPCODE_SET_IPV6_SRC	11
83 #define NFP_FL_ACTION_OPCODE_SET_IPV6_DST	12
84 #define NFP_FL_ACTION_OPCODE_SET_UDP		14
85 #define NFP_FL_ACTION_OPCODE_SET_TCP		15
86 #define NFP_FL_ACTION_OPCODE_PRE_TUNNEL		17
87 #define NFP_FL_ACTION_OPCODE_NUM		32
88 
89 #define NFP_FL_ACT_JMP_ID		GENMASK(15, 8)
90 #define NFP_FL_ACT_LEN_LW		GENMASK(7, 0)
91 
92 #define NFP_FL_OUT_FLAGS_LAST		BIT(15)
93 #define NFP_FL_OUT_FLAGS_USE_TUN	BIT(4)
94 #define NFP_FL_OUT_FLAGS_TYPE_IDX	GENMASK(2, 0)
95 
96 #define NFP_FL_PUSH_VLAN_PRIO		GENMASK(15, 13)
97 #define NFP_FL_PUSH_VLAN_CFI		BIT(12)
98 #define NFP_FL_PUSH_VLAN_VID		GENMASK(11, 0)
99 
100 /* Tunnel ports */
101 #define NFP_FL_PORT_TYPE_TUN		0x50000000
102 #define NFP_FL_IPV4_TUNNEL_TYPE		GENMASK(7, 4)
103 #define NFP_FL_IPV4_PRE_TUN_INDEX	GENMASK(2, 0)
104 
105 #define nfp_flower_cmsg_warn(app, fmt, args...)                         \
106 	do {                                                            \
107 		if (net_ratelimit())                                    \
108 			nfp_warn((app)->cpp, fmt, ## args);             \
109 	} while (0)
110 
111 enum nfp_flower_tun_type {
112 	NFP_FL_TUNNEL_NONE =	0,
113 	NFP_FL_TUNNEL_VXLAN =	2,
114 };
115 
116 struct nfp_fl_set_eth {
117 	__be16 a_op;
118 	__be16 reserved;
119 	u8 eth_addr_mask[ETH_ALEN * 2];
120 	u8 eth_addr_val[ETH_ALEN * 2];
121 };
122 
123 struct nfp_fl_set_ip4_addrs {
124 	__be16 a_op;
125 	__be16 reserved;
126 	__be32 ipv4_src_mask;
127 	__be32 ipv4_src;
128 	__be32 ipv4_dst_mask;
129 	__be32 ipv4_dst;
130 };
131 
132 struct nfp_fl_set_ipv6_addr {
133 	__be16 a_op;
134 	__be16 reserved;
135 	struct {
136 		__be32 mask;
137 		__be32 exact;
138 	} ipv6[4];
139 };
140 
141 struct nfp_fl_set_tport {
142 	__be16 a_op;
143 	__be16 reserved;
144 	u8 tp_port_mask[4];
145 	u8 tp_port_val[4];
146 };
147 
148 struct nfp_fl_output {
149 	__be16 a_op;
150 	__be16 flags;
151 	__be32 port;
152 };
153 
154 struct nfp_fl_push_vlan {
155 	__be16 a_op;
156 	__be16 reserved;
157 	__be16 vlan_tpid;
158 	__be16 vlan_tci;
159 };
160 
161 struct nfp_fl_pop_vlan {
162 	__be16 a_op;
163 	__be16 reserved;
164 };
165 
166 /* Metadata without L2 (1W/4B)
167  * ----------------------------------------------------------------
168  *    3                   2                   1
169  *  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
170  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
171  * |  key_layers   |    mask_id    |           reserved            |
172  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
173  */
174 struct nfp_flower_meta_one {
175 	u8 nfp_flow_key_layer;
176 	u8 mask_id;
177 	u16 reserved;
178 };
179 
180 struct nfp_fl_pre_tunnel {
181 	__be16 a_op;
182 	__be16 reserved;
183 	__be32 ipv4_dst;
184 	/* reserved for use with IPv6 addresses */
185 	__be32 extra[3];
186 };
187 
188 struct nfp_fl_set_vxlan {
189 	__be16 a_op;
190 	__be16 reserved;
191 	__be64 tun_id;
192 	__be32 tun_type_index;
193 	__be16 tun_flags;
194 	u8 ipv4_ttl;
195 	u8 ipv4_tos;
196 	__be32 extra[2];
197 } __packed;
198 
199 /* Metadata with L2 (1W/4B)
200  * ----------------------------------------------------------------
201  *    3                   2                   1
202  *  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
203  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
204  * |    key_type   |    mask_id    | PCP |p|   vlan outermost VID  |
205  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
206  *                                 ^                               ^
207  *                           NOTE: |             TCI               |
208  *                                 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
209  */
210 struct nfp_flower_meta_two {
211 	u8 nfp_flow_key_layer;
212 	u8 mask_id;
213 	__be16 tci;
214 };
215 
216 /* Port details (1W/4B)
217  * ----------------------------------------------------------------
218  *    3                   2                   1
219  *  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
220  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
221  * |                         port_ingress                          |
222  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
223  */
224 struct nfp_flower_in_port {
225 	__be32 in_port;
226 };
227 
228 /* L2 details (4W/16B)
229  *    3                   2                   1
230  *  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
231  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
232  * |                     mac_addr_dst, 31 - 0                      |
233  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
234  * |      mac_addr_dst, 47 - 32    |     mac_addr_src, 15 - 0      |
235  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
236  * |                     mac_addr_src, 47 - 16                     |
237  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
238  * |       mpls outermost label            |  TC |B|   reserved  |q|
239  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
240  */
241 struct nfp_flower_mac_mpls {
242 	u8 mac_dst[6];
243 	u8 mac_src[6];
244 	__be32 mpls_lse;
245 };
246 
247 /* L4 ports (for UDP, TCP, SCTP) (1W/4B)
248  *    3                   2                   1
249  *  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
250  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
251  * |            port_src           |           port_dst            |
252  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
253  */
254 struct nfp_flower_tp_ports {
255 	__be16 port_src;
256 	__be16 port_dst;
257 };
258 
259 /* L3 IPv4 details (3W/12B)
260  *    3                   2                   1
261  *  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
262  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
263  * |    DSCP   |ECN|   protocol    |           reserved            |
264  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
265  * |                        ipv4_addr_src                          |
266  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
267  * |                        ipv4_addr_dst                          |
268  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
269  */
270 struct nfp_flower_ipv4 {
271 	u8 tos;
272 	u8 proto;
273 	u8 ttl;
274 	u8 reserved;
275 	__be32 ipv4_src;
276 	__be32 ipv4_dst;
277 };
278 
279 /* L3 IPv6 details (10W/40B)
280  *    3                   2                   1
281  *  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
282  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
283  * |    DSCP   |ECN|   protocol    |          reserved             |
284  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
285  * |   ipv6_exthdr   | res |            ipv6_flow_label            |
286  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
287  * |                  ipv6_addr_src,   31 - 0                      |
288  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
289  * |                  ipv6_addr_src,  63 - 32                      |
290  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
291  * |                  ipv6_addr_src,  95 - 64                      |
292  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
293  * |                  ipv6_addr_src, 127 - 96                      |
294  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
295  * |                  ipv6_addr_dst,   31 - 0                      |
296  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
297  * |                  ipv6_addr_dst,  63 - 32                      |
298  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
299  * |                  ipv6_addr_dst,  95 - 64                      |
300  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
301  * |                  ipv6_addr_dst, 127 - 96                      |
302  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
303  */
304 struct nfp_flower_ipv6 {
305 	u8 tos;
306 	u8 proto;
307 	u8 ttl;
308 	u8 reserved;
309 	__be32 ipv6_flow_label_exthdr;
310 	struct in6_addr ipv6_src;
311 	struct in6_addr ipv6_dst;
312 };
313 
314 /* Flow Frame VXLAN --> Tunnel details (4W/16B)
315  * -----------------------------------------------------------------
316  *    3                   2                   1
317  *  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
318  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
319  * |                         ipv4_addr_src                         |
320  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
321  * |                         ipv4_addr_dst                         |
322  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
323  * |           tun_flags           |       tos     |       ttl     |
324  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
325  * |   gpe_flags   |            Reserved           | Next Protocol |
326  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
327  * |                     VNI                       |   Reserved    |
328  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
329  */
330 struct nfp_flower_vxlan {
331 	__be32 ip_src;
332 	__be32 ip_dst;
333 	__be16 tun_flags;
334 	u8 tos;
335 	u8 ttl;
336 	u8 gpe_flags;
337 	u8 reserved[2];
338 	u8 nxt_proto;
339 	__be32 tun_id;
340 };
341 
342 #define NFP_FL_TUN_VNI_OFFSET 8
343 
344 /* The base header for a control message packet.
345  * Defines an 8-bit version, and an 8-bit type, padded
346  * to a 32-bit word. Rest of the packet is type-specific.
347  */
348 struct nfp_flower_cmsg_hdr {
349 	__be16 pad;
350 	u8 type;
351 	u8 version;
352 };
353 
354 #define NFP_FLOWER_CMSG_HLEN		sizeof(struct nfp_flower_cmsg_hdr)
355 #define NFP_FLOWER_CMSG_VER1		1
356 
357 /* Types defined for port related control messages  */
358 enum nfp_flower_cmsg_type_port {
359 	NFP_FLOWER_CMSG_TYPE_FLOW_ADD =		0,
360 	NFP_FLOWER_CMSG_TYPE_FLOW_DEL =		2,
361 	NFP_FLOWER_CMSG_TYPE_MAC_REPR =		7,
362 	NFP_FLOWER_CMSG_TYPE_PORT_MOD =		8,
363 	NFP_FLOWER_CMSG_TYPE_NO_NEIGH =		10,
364 	NFP_FLOWER_CMSG_TYPE_TUN_MAC =		11,
365 	NFP_FLOWER_CMSG_TYPE_ACTIVE_TUNS =	12,
366 	NFP_FLOWER_CMSG_TYPE_TUN_NEIGH =	13,
367 	NFP_FLOWER_CMSG_TYPE_TUN_IPS =		14,
368 	NFP_FLOWER_CMSG_TYPE_FLOW_STATS =	15,
369 	NFP_FLOWER_CMSG_TYPE_PORT_ECHO =	16,
370 	NFP_FLOWER_CMSG_TYPE_MAX =		32,
371 };
372 
373 /* NFP_FLOWER_CMSG_TYPE_MAC_REPR */
374 struct nfp_flower_cmsg_mac_repr {
375 	u8 reserved[3];
376 	u8 num_ports;
377 	struct {
378 		u8 idx;
379 		u8 info;
380 		u8 nbi_port;
381 		u8 phys_port;
382 	} ports[0];
383 };
384 
385 #define NFP_FLOWER_CMSG_MAC_REPR_NBI		GENMASK(1, 0)
386 
387 /* NFP_FLOWER_CMSG_TYPE_PORT_MOD */
388 struct nfp_flower_cmsg_portmod {
389 	__be32 portnum;
390 	u8 reserved;
391 	u8 info;
392 	__be16 mtu;
393 };
394 
395 #define NFP_FLOWER_CMSG_PORTMOD_INFO_LINK	BIT(0)
396 
397 enum nfp_flower_cmsg_port_type {
398 	NFP_FLOWER_CMSG_PORT_TYPE_UNSPEC =	0x0,
399 	NFP_FLOWER_CMSG_PORT_TYPE_PHYS_PORT =	0x1,
400 	NFP_FLOWER_CMSG_PORT_TYPE_PCIE_PORT =	0x2,
401 	NFP_FLOWER_CMSG_PORT_TYPE_OTHER_PORT =  0x3,
402 };
403 
404 enum nfp_flower_cmsg_port_vnic_type {
405 	NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF =	0x0,
406 	NFP_FLOWER_CMSG_PORT_VNIC_TYPE_PF =	0x1,
407 	NFP_FLOWER_CMSG_PORT_VNIC_TYPE_CTRL =	0x2,
408 };
409 
410 #define NFP_FLOWER_CMSG_PORT_TYPE		GENMASK(31, 28)
411 #define NFP_FLOWER_CMSG_PORT_SYS_ID		GENMASK(27, 24)
412 #define NFP_FLOWER_CMSG_PORT_NFP_ID		GENMASK(23, 22)
413 #define NFP_FLOWER_CMSG_PORT_PCI		GENMASK(15, 14)
414 #define NFP_FLOWER_CMSG_PORT_VNIC_TYPE		GENMASK(13, 12)
415 #define NFP_FLOWER_CMSG_PORT_VNIC		GENMASK(11, 6)
416 #define NFP_FLOWER_CMSG_PORT_PCIE_Q		GENMASK(5, 0)
417 #define NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM	GENMASK(7, 0)
418 
419 static inline u32 nfp_flower_cmsg_phys_port(u8 phys_port)
420 {
421 	return FIELD_PREP(NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM, phys_port) |
422 		FIELD_PREP(NFP_FLOWER_CMSG_PORT_TYPE,
423 			   NFP_FLOWER_CMSG_PORT_TYPE_PHYS_PORT);
424 }
425 
426 static inline u32
427 nfp_flower_cmsg_pcie_port(u8 nfp_pcie, enum nfp_flower_cmsg_port_vnic_type type,
428 			  u8 vnic, u8 q)
429 {
430 	return FIELD_PREP(NFP_FLOWER_CMSG_PORT_PCI, nfp_pcie) |
431 		FIELD_PREP(NFP_FLOWER_CMSG_PORT_VNIC_TYPE, type) |
432 		FIELD_PREP(NFP_FLOWER_CMSG_PORT_VNIC, vnic) |
433 		FIELD_PREP(NFP_FLOWER_CMSG_PORT_PCIE_Q, q) |
434 		FIELD_PREP(NFP_FLOWER_CMSG_PORT_TYPE,
435 			   NFP_FLOWER_CMSG_PORT_TYPE_PCIE_PORT);
436 }
437 
438 static inline void *nfp_flower_cmsg_get_data(struct sk_buff *skb)
439 {
440 	return (unsigned char *)skb->data + NFP_FLOWER_CMSG_HLEN;
441 }
442 
443 static inline int nfp_flower_cmsg_get_data_len(struct sk_buff *skb)
444 {
445 	return skb->len - NFP_FLOWER_CMSG_HLEN;
446 }
447 
448 struct sk_buff *
449 nfp_flower_cmsg_mac_repr_start(struct nfp_app *app, unsigned int num_ports);
450 void
451 nfp_flower_cmsg_mac_repr_add(struct sk_buff *skb, unsigned int idx,
452 			     unsigned int nbi, unsigned int nbi_port,
453 			     unsigned int phys_port);
454 int nfp_flower_cmsg_portmod(struct nfp_repr *repr, bool carrier_ok);
455 void nfp_flower_cmsg_process_rx(struct work_struct *work);
456 void nfp_flower_cmsg_rx(struct nfp_app *app, struct sk_buff *skb);
457 struct sk_buff *
458 nfp_flower_cmsg_alloc(struct nfp_app *app, unsigned int size,
459 		      enum nfp_flower_cmsg_type_port type);
460 
461 #endif
462