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