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