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