1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ 2 /* Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved */ 3 4 #ifndef _MLXSW_SPECTRUM_H 5 #define _MLXSW_SPECTRUM_H 6 7 #include <linux/types.h> 8 #include <linux/netdevice.h> 9 #include <linux/rhashtable.h> 10 #include <linux/bitops.h> 11 #include <linux/if_bridge.h> 12 #include <linux/if_vlan.h> 13 #include <linux/list.h> 14 #include <linux/dcbnl.h> 15 #include <linux/in6.h> 16 #include <linux/notifier.h> 17 #include <net/psample.h> 18 #include <net/pkt_cls.h> 19 #include <net/red.h> 20 #include <net/vxlan.h> 21 22 #include "port.h" 23 #include "core.h" 24 #include "core_acl_flex_keys.h" 25 #include "core_acl_flex_actions.h" 26 #include "reg.h" 27 28 #define MLXSW_SP_DEFAULT_VID (VLAN_N_VID - 1) 29 30 #define MLXSW_SP_FID_8021D_MAX 1024 31 32 #define MLXSW_SP_MID_MAX 7000 33 34 #define MLXSW_SP_PORTS_PER_CLUSTER_MAX 4 35 36 #define MLXSW_SP_PORT_BASE_SPEED 25000 /* Mb/s */ 37 38 #define MLXSW_SP_KVD_LINEAR_SIZE 98304 /* entries */ 39 #define MLXSW_SP_KVD_GRANULARITY 128 40 41 #define MLXSW_SP_RESOURCE_NAME_KVD "kvd" 42 #define MLXSW_SP_RESOURCE_NAME_KVD_LINEAR "linear" 43 #define MLXSW_SP_RESOURCE_NAME_KVD_HASH_SINGLE "hash_single" 44 #define MLXSW_SP_RESOURCE_NAME_KVD_HASH_DOUBLE "hash_double" 45 #define MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_SINGLES "singles" 46 #define MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_CHUNKS "chunks" 47 #define MLXSW_SP_RESOURCE_NAME_KVD_LINEAR_LARGE_CHUNKS "large_chunks" 48 49 enum mlxsw_sp_resource_id { 50 MLXSW_SP_RESOURCE_KVD = 1, 51 MLXSW_SP_RESOURCE_KVD_LINEAR, 52 MLXSW_SP_RESOURCE_KVD_HASH_SINGLE, 53 MLXSW_SP_RESOURCE_KVD_HASH_DOUBLE, 54 MLXSW_SP_RESOURCE_KVD_LINEAR_SINGLE, 55 MLXSW_SP_RESOURCE_KVD_LINEAR_CHUNKS, 56 MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS, 57 }; 58 59 struct mlxsw_sp_port; 60 struct mlxsw_sp_rif; 61 struct mlxsw_sp_span_entry; 62 enum mlxsw_sp_l3proto; 63 union mlxsw_sp_l3addr; 64 65 struct mlxsw_sp_upper { 66 struct net_device *dev; 67 unsigned int ref_count; 68 }; 69 70 enum mlxsw_sp_rif_type { 71 MLXSW_SP_RIF_TYPE_SUBPORT, 72 MLXSW_SP_RIF_TYPE_VLAN, 73 MLXSW_SP_RIF_TYPE_FID, 74 MLXSW_SP_RIF_TYPE_IPIP_LB, /* IP-in-IP loopback. */ 75 MLXSW_SP_RIF_TYPE_MAX, 76 }; 77 78 struct mlxsw_sp_rif_ops; 79 80 extern const struct mlxsw_sp_rif_ops *mlxsw_sp1_rif_ops_arr[]; 81 extern const struct mlxsw_sp_rif_ops *mlxsw_sp2_rif_ops_arr[]; 82 83 enum mlxsw_sp_fid_type { 84 MLXSW_SP_FID_TYPE_8021Q, 85 MLXSW_SP_FID_TYPE_8021D, 86 MLXSW_SP_FID_TYPE_RFID, 87 MLXSW_SP_FID_TYPE_DUMMY, 88 MLXSW_SP_FID_TYPE_MAX, 89 }; 90 91 enum mlxsw_sp_nve_type { 92 MLXSW_SP_NVE_TYPE_VXLAN, 93 }; 94 95 struct mlxsw_sp_mid { 96 struct list_head list; 97 unsigned char addr[ETH_ALEN]; 98 u16 fid; 99 u16 mid; 100 bool in_hw; 101 unsigned long *ports_in_mid; /* bits array */ 102 }; 103 104 enum mlxsw_sp_port_mall_action_type { 105 MLXSW_SP_PORT_MALL_MIRROR, 106 MLXSW_SP_PORT_MALL_SAMPLE, 107 }; 108 109 struct mlxsw_sp_port_mall_mirror_tc_entry { 110 int span_id; 111 bool ingress; 112 }; 113 114 struct mlxsw_sp_port_mall_tc_entry { 115 struct list_head list; 116 unsigned long cookie; 117 enum mlxsw_sp_port_mall_action_type type; 118 union { 119 struct mlxsw_sp_port_mall_mirror_tc_entry mirror; 120 }; 121 }; 122 123 struct mlxsw_sp_sb; 124 struct mlxsw_sp_bridge; 125 struct mlxsw_sp_router; 126 struct mlxsw_sp_mr; 127 struct mlxsw_sp_acl; 128 struct mlxsw_sp_counter_pool; 129 struct mlxsw_sp_fid_core; 130 struct mlxsw_sp_kvdl; 131 struct mlxsw_sp_nve; 132 struct mlxsw_sp_kvdl_ops; 133 struct mlxsw_sp_mr_tcam_ops; 134 struct mlxsw_sp_acl_tcam_ops; 135 struct mlxsw_sp_nve_ops; 136 137 struct mlxsw_sp { 138 struct mlxsw_sp_port **ports; 139 struct mlxsw_core *core; 140 const struct mlxsw_bus_info *bus_info; 141 unsigned char base_mac[ETH_ALEN]; 142 const unsigned char *mac_mask; 143 struct mlxsw_sp_upper *lags; 144 int *port_to_module; 145 struct mlxsw_sp_sb *sb; 146 struct mlxsw_sp_bridge *bridge; 147 struct mlxsw_sp_router *router; 148 struct mlxsw_sp_mr *mr; 149 struct mlxsw_afa *afa; 150 struct mlxsw_sp_acl *acl; 151 struct mlxsw_sp_fid_core *fid_core; 152 struct mlxsw_sp_kvdl *kvdl; 153 struct mlxsw_sp_nve *nve; 154 struct notifier_block netdevice_nb; 155 156 struct mlxsw_sp_counter_pool *counter_pool; 157 struct { 158 struct mlxsw_sp_span_entry *entries; 159 int entries_count; 160 } span; 161 const struct mlxsw_fw_rev *req_rev; 162 const char *fw_filename; 163 const struct mlxsw_sp_kvdl_ops *kvdl_ops; 164 const struct mlxsw_afa_ops *afa_ops; 165 const struct mlxsw_afk_ops *afk_ops; 166 const struct mlxsw_sp_mr_tcam_ops *mr_tcam_ops; 167 const struct mlxsw_sp_acl_tcam_ops *acl_tcam_ops; 168 const struct mlxsw_sp_nve_ops **nve_ops_arr; 169 const struct mlxsw_sp_rif_ops **rif_ops_arr; 170 }; 171 172 static inline struct mlxsw_sp_upper * 173 mlxsw_sp_lag_get(struct mlxsw_sp *mlxsw_sp, u16 lag_id) 174 { 175 return &mlxsw_sp->lags[lag_id]; 176 } 177 178 struct mlxsw_sp_port_pcpu_stats { 179 u64 rx_packets; 180 u64 rx_bytes; 181 u64 tx_packets; 182 u64 tx_bytes; 183 struct u64_stats_sync syncp; 184 u32 tx_dropped; 185 }; 186 187 struct mlxsw_sp_port_sample { 188 struct psample_group __rcu *psample_group; 189 u32 trunc_size; 190 u32 rate; 191 bool truncate; 192 }; 193 194 struct mlxsw_sp_bridge_port; 195 struct mlxsw_sp_fid; 196 197 struct mlxsw_sp_port_vlan { 198 struct list_head list; 199 struct mlxsw_sp_port *mlxsw_sp_port; 200 struct mlxsw_sp_fid *fid; 201 u16 vid; 202 struct mlxsw_sp_bridge_port *bridge_port; 203 struct list_head bridge_vlan_node; 204 }; 205 206 /* No need an internal lock; At worse - miss a single periodic iteration */ 207 struct mlxsw_sp_port_xstats { 208 u64 ecn; 209 u64 wred_drop[TC_MAX_QUEUE]; 210 u64 tail_drop[TC_MAX_QUEUE]; 211 u64 backlog[TC_MAX_QUEUE]; 212 u64 tx_bytes[IEEE_8021QAZ_MAX_TCS]; 213 u64 tx_packets[IEEE_8021QAZ_MAX_TCS]; 214 }; 215 216 struct mlxsw_sp_port { 217 struct net_device *dev; 218 struct mlxsw_sp_port_pcpu_stats __percpu *pcpu_stats; 219 struct mlxsw_sp *mlxsw_sp; 220 u8 local_port; 221 u8 lagged:1, 222 split:1; 223 u16 pvid; 224 u16 lag_id; 225 struct { 226 u8 tx_pause:1, 227 rx_pause:1, 228 autoneg:1; 229 } link; 230 struct { 231 struct ieee_ets *ets; 232 struct ieee_maxrate *maxrate; 233 struct ieee_pfc *pfc; 234 enum mlxsw_reg_qpts_trust_state trust_state; 235 } dcb; 236 struct { 237 u8 module; 238 u8 width; 239 u8 lane; 240 } mapping; 241 /* TC handles */ 242 struct list_head mall_tc_list; 243 struct { 244 #define MLXSW_HW_STATS_UPDATE_TIME HZ 245 struct rtnl_link_stats64 stats; 246 struct mlxsw_sp_port_xstats xstats; 247 struct delayed_work update_dw; 248 } periodic_hw_stats; 249 struct mlxsw_sp_port_sample *sample; 250 struct list_head vlans_list; 251 struct mlxsw_sp_port_vlan *default_vlan; 252 struct mlxsw_sp_qdisc *root_qdisc; 253 struct mlxsw_sp_qdisc *tclass_qdiscs; 254 unsigned acl_rule_count; 255 struct mlxsw_sp_acl_block *ing_acl_block; 256 struct mlxsw_sp_acl_block *eg_acl_block; 257 }; 258 259 static inline struct net_device * 260 mlxsw_sp_bridge_vxlan_dev_find(struct net_device *br_dev) 261 { 262 struct net_device *dev; 263 struct list_head *iter; 264 265 netdev_for_each_lower_dev(br_dev, dev, iter) { 266 if (netif_is_vxlan(dev)) 267 return dev; 268 } 269 270 return NULL; 271 } 272 273 static inline bool mlxsw_sp_bridge_has_vxlan(struct net_device *br_dev) 274 { 275 return !!mlxsw_sp_bridge_vxlan_dev_find(br_dev); 276 } 277 278 static inline int 279 mlxsw_sp_vxlan_mapped_vid(const struct net_device *vxlan_dev, u16 *p_vid) 280 { 281 struct bridge_vlan_info vinfo; 282 u16 vid = 0; 283 int err; 284 285 err = br_vlan_get_pvid(vxlan_dev, &vid); 286 if (err || !vid) 287 goto out; 288 289 err = br_vlan_get_info(vxlan_dev, vid, &vinfo); 290 if (err || !(vinfo.flags & BRIDGE_VLAN_INFO_UNTAGGED)) 291 vid = 0; 292 293 out: 294 *p_vid = vid; 295 return err; 296 } 297 298 static inline bool 299 mlxsw_sp_port_is_pause_en(const struct mlxsw_sp_port *mlxsw_sp_port) 300 { 301 return mlxsw_sp_port->link.tx_pause || mlxsw_sp_port->link.rx_pause; 302 } 303 304 static inline struct mlxsw_sp_port * 305 mlxsw_sp_port_lagged_get(struct mlxsw_sp *mlxsw_sp, u16 lag_id, u8 port_index) 306 { 307 struct mlxsw_sp_port *mlxsw_sp_port; 308 u8 local_port; 309 310 local_port = mlxsw_core_lag_mapping_get(mlxsw_sp->core, 311 lag_id, port_index); 312 mlxsw_sp_port = mlxsw_sp->ports[local_port]; 313 return mlxsw_sp_port && mlxsw_sp_port->lagged ? mlxsw_sp_port : NULL; 314 } 315 316 static inline struct mlxsw_sp_port_vlan * 317 mlxsw_sp_port_vlan_find_by_vid(const struct mlxsw_sp_port *mlxsw_sp_port, 318 u16 vid) 319 { 320 struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan; 321 322 list_for_each_entry(mlxsw_sp_port_vlan, &mlxsw_sp_port->vlans_list, 323 list) { 324 if (mlxsw_sp_port_vlan->vid == vid) 325 return mlxsw_sp_port_vlan; 326 } 327 328 return NULL; 329 } 330 331 enum mlxsw_sp_flood_type { 332 MLXSW_SP_FLOOD_TYPE_UC, 333 MLXSW_SP_FLOOD_TYPE_BC, 334 MLXSW_SP_FLOOD_TYPE_MC, 335 }; 336 337 /* spectrum_buffers.c */ 338 int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp); 339 void mlxsw_sp_buffers_fini(struct mlxsw_sp *mlxsw_sp); 340 int mlxsw_sp_port_buffers_init(struct mlxsw_sp_port *mlxsw_sp_port); 341 int mlxsw_sp_sb_pool_get(struct mlxsw_core *mlxsw_core, 342 unsigned int sb_index, u16 pool_index, 343 struct devlink_sb_pool_info *pool_info); 344 int mlxsw_sp_sb_pool_set(struct mlxsw_core *mlxsw_core, 345 unsigned int sb_index, u16 pool_index, u32 size, 346 enum devlink_sb_threshold_type threshold_type); 347 int mlxsw_sp_sb_port_pool_get(struct mlxsw_core_port *mlxsw_core_port, 348 unsigned int sb_index, u16 pool_index, 349 u32 *p_threshold); 350 int mlxsw_sp_sb_port_pool_set(struct mlxsw_core_port *mlxsw_core_port, 351 unsigned int sb_index, u16 pool_index, 352 u32 threshold); 353 int mlxsw_sp_sb_tc_pool_bind_get(struct mlxsw_core_port *mlxsw_core_port, 354 unsigned int sb_index, u16 tc_index, 355 enum devlink_sb_pool_type pool_type, 356 u16 *p_pool_index, u32 *p_threshold); 357 int mlxsw_sp_sb_tc_pool_bind_set(struct mlxsw_core_port *mlxsw_core_port, 358 unsigned int sb_index, u16 tc_index, 359 enum devlink_sb_pool_type pool_type, 360 u16 pool_index, u32 threshold); 361 int mlxsw_sp_sb_occ_snapshot(struct mlxsw_core *mlxsw_core, 362 unsigned int sb_index); 363 int mlxsw_sp_sb_occ_max_clear(struct mlxsw_core *mlxsw_core, 364 unsigned int sb_index); 365 int mlxsw_sp_sb_occ_port_pool_get(struct mlxsw_core_port *mlxsw_core_port, 366 unsigned int sb_index, u16 pool_index, 367 u32 *p_cur, u32 *p_max); 368 int mlxsw_sp_sb_occ_tc_port_bind_get(struct mlxsw_core_port *mlxsw_core_port, 369 unsigned int sb_index, u16 tc_index, 370 enum devlink_sb_pool_type pool_type, 371 u32 *p_cur, u32 *p_max); 372 u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells); 373 u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes); 374 375 /* spectrum_switchdev.c */ 376 int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp); 377 void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp); 378 void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port); 379 void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port); 380 int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, 381 bool adding); 382 void 383 mlxsw_sp_port_vlan_bridge_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan); 384 int mlxsw_sp_port_bridge_join(struct mlxsw_sp_port *mlxsw_sp_port, 385 struct net_device *brport_dev, 386 struct net_device *br_dev, 387 struct netlink_ext_ack *extack); 388 void mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port, 389 struct net_device *brport_dev, 390 struct net_device *br_dev); 391 bool mlxsw_sp_bridge_device_is_offloaded(const struct mlxsw_sp *mlxsw_sp, 392 const struct net_device *br_dev); 393 int mlxsw_sp_bridge_vxlan_join(struct mlxsw_sp *mlxsw_sp, 394 const struct net_device *br_dev, 395 const struct net_device *vxlan_dev, u16 vid, 396 struct netlink_ext_ack *extack); 397 void mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp, 398 const struct net_device *vxlan_dev); 399 struct mlxsw_sp_fid *mlxsw_sp_bridge_fid_get(struct mlxsw_sp *mlxsw_sp, 400 const struct net_device *br_dev, 401 u16 vid, 402 struct netlink_ext_ack *extack); 403 extern struct notifier_block mlxsw_sp_switchdev_notifier; 404 405 /* spectrum.c */ 406 int mlxsw_sp_port_ets_set(struct mlxsw_sp_port *mlxsw_sp_port, 407 enum mlxsw_reg_qeec_hr hr, u8 index, u8 next_index, 408 bool dwrr, u8 dwrr_weight); 409 int mlxsw_sp_port_prio_tc_set(struct mlxsw_sp_port *mlxsw_sp_port, 410 u8 switch_prio, u8 tclass); 411 int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu, 412 u8 *prio_tc, bool pause_en, 413 struct ieee_pfc *my_pfc); 414 int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port, 415 enum mlxsw_reg_qeec_hr hr, u8 index, 416 u8 next_index, u32 maxrate); 417 enum mlxsw_reg_spms_state mlxsw_sp_stp_spms_state(u8 stp_state); 418 int mlxsw_sp_port_vid_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid, 419 u8 state); 420 int mlxsw_sp_port_vp_mode_set(struct mlxsw_sp_port *mlxsw_sp_port, bool enable); 421 int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid, 422 bool learn_enable); 423 int mlxsw_sp_port_pvid_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid); 424 struct mlxsw_sp_port_vlan * 425 mlxsw_sp_port_vlan_create(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid); 426 void mlxsw_sp_port_vlan_destroy(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan); 427 int mlxsw_sp_port_vlan_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid_begin, 428 u16 vid_end, bool is_member, bool untagged); 429 int mlxsw_sp_flow_counter_get(struct mlxsw_sp *mlxsw_sp, 430 unsigned int counter_index, u64 *packets, 431 u64 *bytes); 432 int mlxsw_sp_flow_counter_alloc(struct mlxsw_sp *mlxsw_sp, 433 unsigned int *p_counter_index); 434 void mlxsw_sp_flow_counter_free(struct mlxsw_sp *mlxsw_sp, 435 unsigned int counter_index); 436 bool mlxsw_sp_port_dev_check(const struct net_device *dev); 437 struct mlxsw_sp *mlxsw_sp_lower_get(struct net_device *dev); 438 struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find(struct net_device *dev); 439 struct mlxsw_sp_port *mlxsw_sp_port_lower_dev_hold(struct net_device *dev); 440 void mlxsw_sp_port_dev_put(struct mlxsw_sp_port *mlxsw_sp_port); 441 struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find_rcu(struct net_device *dev); 442 443 /* spectrum_dcb.c */ 444 #ifdef CONFIG_MLXSW_SPECTRUM_DCB 445 int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port); 446 void mlxsw_sp_port_dcb_fini(struct mlxsw_sp_port *mlxsw_sp_port); 447 #else 448 static inline int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port) 449 { 450 return 0; 451 } 452 static inline void mlxsw_sp_port_dcb_fini(struct mlxsw_sp_port *mlxsw_sp_port) 453 {} 454 #endif 455 456 /* spectrum_router.c */ 457 enum mlxsw_sp_l3proto { 458 MLXSW_SP_L3_PROTO_IPV4, 459 MLXSW_SP_L3_PROTO_IPV6, 460 #define MLXSW_SP_L3_PROTO_MAX (MLXSW_SP_L3_PROTO_IPV6 + 1) 461 }; 462 463 union mlxsw_sp_l3addr { 464 __be32 addr4; 465 struct in6_addr addr6; 466 }; 467 468 int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp); 469 void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp); 470 int mlxsw_sp_netdevice_router_port_event(struct net_device *dev, 471 unsigned long event, void *ptr); 472 void mlxsw_sp_rif_macvlan_del(struct mlxsw_sp *mlxsw_sp, 473 const struct net_device *macvlan_dev); 474 int mlxsw_sp_inetaddr_valid_event(struct notifier_block *unused, 475 unsigned long event, void *ptr); 476 int mlxsw_sp_inet6addr_valid_event(struct notifier_block *unused, 477 unsigned long event, void *ptr); 478 int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event, 479 struct netdev_notifier_changeupper_info *info); 480 bool mlxsw_sp_netdev_is_ipip_ol(const struct mlxsw_sp *mlxsw_sp, 481 const struct net_device *dev); 482 bool mlxsw_sp_netdev_is_ipip_ul(const struct mlxsw_sp *mlxsw_sp, 483 const struct net_device *dev); 484 int mlxsw_sp_netdevice_ipip_ol_event(struct mlxsw_sp *mlxsw_sp, 485 struct net_device *l3_dev, 486 unsigned long event, 487 struct netdev_notifier_info *info); 488 int 489 mlxsw_sp_netdevice_ipip_ul_event(struct mlxsw_sp *mlxsw_sp, 490 struct net_device *l3_dev, 491 unsigned long event, 492 struct netdev_notifier_info *info); 493 void 494 mlxsw_sp_port_vlan_router_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan); 495 void mlxsw_sp_rif_destroy_by_dev(struct mlxsw_sp *mlxsw_sp, 496 struct net_device *dev); 497 struct mlxsw_sp_rif *mlxsw_sp_rif_find_by_dev(const struct mlxsw_sp *mlxsw_sp, 498 const struct net_device *dev); 499 u8 mlxsw_sp_router_port(const struct mlxsw_sp *mlxsw_sp); 500 struct mlxsw_sp_fid *mlxsw_sp_rif_fid(const struct mlxsw_sp_rif *rif); 501 int mlxsw_sp_router_nve_promote_decap(struct mlxsw_sp *mlxsw_sp, u32 ul_tb_id, 502 enum mlxsw_sp_l3proto ul_proto, 503 const union mlxsw_sp_l3addr *ul_sip, 504 u32 tunnel_index); 505 void mlxsw_sp_router_nve_demote_decap(struct mlxsw_sp *mlxsw_sp, u32 ul_tb_id, 506 enum mlxsw_sp_l3proto ul_proto, 507 const union mlxsw_sp_l3addr *ul_sip); 508 int mlxsw_sp_router_tb_id_vr_id(struct mlxsw_sp *mlxsw_sp, u32 tb_id, 509 u16 *vr_id); 510 int mlxsw_sp_router_ul_rif_get(struct mlxsw_sp *mlxsw_sp, u32 ul_tb_id, 511 u16 *ul_rif_index); 512 void mlxsw_sp_router_ul_rif_put(struct mlxsw_sp *mlxsw_sp, u16 ul_rif_index); 513 514 /* spectrum_kvdl.c */ 515 enum mlxsw_sp_kvdl_entry_type { 516 MLXSW_SP_KVDL_ENTRY_TYPE_ADJ, 517 MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET, 518 MLXSW_SP_KVDL_ENTRY_TYPE_PBS, 519 MLXSW_SP_KVDL_ENTRY_TYPE_MCRIGR, 520 MLXSW_SP_KVDL_ENTRY_TYPE_TNUMT, 521 }; 522 523 static inline unsigned int 524 mlxsw_sp_kvdl_entry_size(enum mlxsw_sp_kvdl_entry_type type) 525 { 526 switch (type) { 527 case MLXSW_SP_KVDL_ENTRY_TYPE_ADJ: /* fall through */ 528 case MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET: /* fall through */ 529 case MLXSW_SP_KVDL_ENTRY_TYPE_PBS: /* fall through */ 530 case MLXSW_SP_KVDL_ENTRY_TYPE_MCRIGR: /* fall through */ 531 case MLXSW_SP_KVDL_ENTRY_TYPE_TNUMT: /* fall through */ 532 default: 533 return 1; 534 } 535 } 536 537 struct mlxsw_sp_kvdl_ops { 538 size_t priv_size; 539 int (*init)(struct mlxsw_sp *mlxsw_sp, void *priv); 540 void (*fini)(struct mlxsw_sp *mlxsw_sp, void *priv); 541 int (*alloc)(struct mlxsw_sp *mlxsw_sp, void *priv, 542 enum mlxsw_sp_kvdl_entry_type type, 543 unsigned int entry_count, u32 *p_entry_index); 544 void (*free)(struct mlxsw_sp *mlxsw_sp, void *priv, 545 enum mlxsw_sp_kvdl_entry_type type, 546 unsigned int entry_count, int entry_index); 547 int (*alloc_size_query)(struct mlxsw_sp *mlxsw_sp, void *priv, 548 enum mlxsw_sp_kvdl_entry_type type, 549 unsigned int entry_count, 550 unsigned int *p_alloc_count); 551 int (*resources_register)(struct mlxsw_sp *mlxsw_sp, void *priv); 552 }; 553 554 int mlxsw_sp_kvdl_init(struct mlxsw_sp *mlxsw_sp); 555 void mlxsw_sp_kvdl_fini(struct mlxsw_sp *mlxsw_sp); 556 int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, 557 enum mlxsw_sp_kvdl_entry_type type, 558 unsigned int entry_count, u32 *p_entry_index); 559 void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, 560 enum mlxsw_sp_kvdl_entry_type type, 561 unsigned int entry_count, int entry_index); 562 int mlxsw_sp_kvdl_alloc_count_query(struct mlxsw_sp *mlxsw_sp, 563 enum mlxsw_sp_kvdl_entry_type type, 564 unsigned int entry_count, 565 unsigned int *p_alloc_count); 566 567 /* spectrum1_kvdl.c */ 568 extern const struct mlxsw_sp_kvdl_ops mlxsw_sp1_kvdl_ops; 569 int mlxsw_sp1_kvdl_resources_register(struct mlxsw_core *mlxsw_core); 570 571 /* spectrum2_kvdl.c */ 572 extern const struct mlxsw_sp_kvdl_ops mlxsw_sp2_kvdl_ops; 573 574 struct mlxsw_sp_acl_rule_info { 575 unsigned int priority; 576 struct mlxsw_afk_element_values values; 577 struct mlxsw_afa_block *act_block; 578 u8 action_created:1; 579 unsigned int counter_index; 580 }; 581 582 struct mlxsw_sp_acl_block; 583 struct mlxsw_sp_acl_ruleset; 584 585 /* spectrum_acl.c */ 586 enum mlxsw_sp_acl_profile { 587 MLXSW_SP_ACL_PROFILE_FLOWER, 588 MLXSW_SP_ACL_PROFILE_MR, 589 }; 590 591 struct mlxsw_afk *mlxsw_sp_acl_afk(struct mlxsw_sp_acl *acl); 592 struct mlxsw_sp *mlxsw_sp_acl_block_mlxsw_sp(struct mlxsw_sp_acl_block *block); 593 unsigned int mlxsw_sp_acl_block_rule_count(struct mlxsw_sp_acl_block *block); 594 void mlxsw_sp_acl_block_disable_inc(struct mlxsw_sp_acl_block *block); 595 void mlxsw_sp_acl_block_disable_dec(struct mlxsw_sp_acl_block *block); 596 bool mlxsw_sp_acl_block_disabled(struct mlxsw_sp_acl_block *block); 597 struct mlxsw_sp_acl_block *mlxsw_sp_acl_block_create(struct mlxsw_sp *mlxsw_sp, 598 struct net *net); 599 void mlxsw_sp_acl_block_destroy(struct mlxsw_sp_acl_block *block); 600 int mlxsw_sp_acl_block_bind(struct mlxsw_sp *mlxsw_sp, 601 struct mlxsw_sp_acl_block *block, 602 struct mlxsw_sp_port *mlxsw_sp_port, 603 bool ingress); 604 int mlxsw_sp_acl_block_unbind(struct mlxsw_sp *mlxsw_sp, 605 struct mlxsw_sp_acl_block *block, 606 struct mlxsw_sp_port *mlxsw_sp_port, 607 bool ingress); 608 bool mlxsw_sp_acl_block_is_egress_bound(struct mlxsw_sp_acl_block *block); 609 struct mlxsw_sp_acl_ruleset * 610 mlxsw_sp_acl_ruleset_lookup(struct mlxsw_sp *mlxsw_sp, 611 struct mlxsw_sp_acl_block *block, u32 chain_index, 612 enum mlxsw_sp_acl_profile profile); 613 struct mlxsw_sp_acl_ruleset * 614 mlxsw_sp_acl_ruleset_get(struct mlxsw_sp *mlxsw_sp, 615 struct mlxsw_sp_acl_block *block, u32 chain_index, 616 enum mlxsw_sp_acl_profile profile, 617 struct mlxsw_afk_element_usage *tmplt_elusage); 618 void mlxsw_sp_acl_ruleset_put(struct mlxsw_sp *mlxsw_sp, 619 struct mlxsw_sp_acl_ruleset *ruleset); 620 u16 mlxsw_sp_acl_ruleset_group_id(struct mlxsw_sp_acl_ruleset *ruleset); 621 622 struct mlxsw_sp_acl_rule_info * 623 mlxsw_sp_acl_rulei_create(struct mlxsw_sp_acl *acl, 624 struct mlxsw_afa_block *afa_block); 625 void mlxsw_sp_acl_rulei_destroy(struct mlxsw_sp_acl_rule_info *rulei); 626 int mlxsw_sp_acl_rulei_commit(struct mlxsw_sp_acl_rule_info *rulei); 627 void mlxsw_sp_acl_rulei_priority(struct mlxsw_sp_acl_rule_info *rulei, 628 unsigned int priority); 629 void mlxsw_sp_acl_rulei_keymask_u32(struct mlxsw_sp_acl_rule_info *rulei, 630 enum mlxsw_afk_element element, 631 u32 key_value, u32 mask_value); 632 void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei, 633 enum mlxsw_afk_element element, 634 const char *key_value, 635 const char *mask_value, unsigned int len); 636 int mlxsw_sp_acl_rulei_act_continue(struct mlxsw_sp_acl_rule_info *rulei); 637 int mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei, 638 u16 group_id); 639 int mlxsw_sp_acl_rulei_act_terminate(struct mlxsw_sp_acl_rule_info *rulei); 640 int mlxsw_sp_acl_rulei_act_drop(struct mlxsw_sp_acl_rule_info *rulei); 641 int mlxsw_sp_acl_rulei_act_trap(struct mlxsw_sp_acl_rule_info *rulei); 642 int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp, 643 struct mlxsw_sp_acl_rule_info *rulei, 644 struct mlxsw_sp_acl_block *block, 645 struct net_device *out_dev, 646 struct netlink_ext_ack *extack); 647 int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp, 648 struct mlxsw_sp_acl_rule_info *rulei, 649 struct net_device *out_dev, 650 struct netlink_ext_ack *extack); 651 int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp, 652 struct mlxsw_sp_acl_rule_info *rulei, 653 u32 action, u16 vid, u16 proto, u8 prio, 654 struct netlink_ext_ack *extack); 655 int mlxsw_sp_acl_rulei_act_count(struct mlxsw_sp *mlxsw_sp, 656 struct mlxsw_sp_acl_rule_info *rulei, 657 struct netlink_ext_ack *extack); 658 int mlxsw_sp_acl_rulei_act_fid_set(struct mlxsw_sp *mlxsw_sp, 659 struct mlxsw_sp_acl_rule_info *rulei, 660 u16 fid, struct netlink_ext_ack *extack); 661 662 struct mlxsw_sp_acl_rule; 663 664 struct mlxsw_sp_acl_rule * 665 mlxsw_sp_acl_rule_create(struct mlxsw_sp *mlxsw_sp, 666 struct mlxsw_sp_acl_ruleset *ruleset, 667 unsigned long cookie, 668 struct mlxsw_afa_block *afa_block, 669 struct netlink_ext_ack *extack); 670 void mlxsw_sp_acl_rule_destroy(struct mlxsw_sp *mlxsw_sp, 671 struct mlxsw_sp_acl_rule *rule); 672 int mlxsw_sp_acl_rule_add(struct mlxsw_sp *mlxsw_sp, 673 struct mlxsw_sp_acl_rule *rule); 674 void mlxsw_sp_acl_rule_del(struct mlxsw_sp *mlxsw_sp, 675 struct mlxsw_sp_acl_rule *rule); 676 int mlxsw_sp_acl_rule_action_replace(struct mlxsw_sp *mlxsw_sp, 677 struct mlxsw_sp_acl_rule *rule, 678 struct mlxsw_afa_block *afa_block); 679 struct mlxsw_sp_acl_rule * 680 mlxsw_sp_acl_rule_lookup(struct mlxsw_sp *mlxsw_sp, 681 struct mlxsw_sp_acl_ruleset *ruleset, 682 unsigned long cookie); 683 struct mlxsw_sp_acl_rule_info * 684 mlxsw_sp_acl_rule_rulei(struct mlxsw_sp_acl_rule *rule); 685 int mlxsw_sp_acl_rule_get_stats(struct mlxsw_sp *mlxsw_sp, 686 struct mlxsw_sp_acl_rule *rule, 687 u64 *packets, u64 *bytes, u64 *last_use); 688 689 struct mlxsw_sp_fid *mlxsw_sp_acl_dummy_fid(struct mlxsw_sp *mlxsw_sp); 690 691 int mlxsw_sp_acl_init(struct mlxsw_sp *mlxsw_sp); 692 void mlxsw_sp_acl_fini(struct mlxsw_sp *mlxsw_sp); 693 694 /* spectrum_acl_tcam.c */ 695 struct mlxsw_sp_acl_tcam; 696 struct mlxsw_sp_acl_tcam_region; 697 698 struct mlxsw_sp_acl_tcam_ops { 699 enum mlxsw_reg_ptar_key_type key_type; 700 size_t priv_size; 701 int (*init)(struct mlxsw_sp *mlxsw_sp, void *priv, 702 struct mlxsw_sp_acl_tcam *tcam); 703 void (*fini)(struct mlxsw_sp *mlxsw_sp, void *priv); 704 size_t region_priv_size; 705 int (*region_init)(struct mlxsw_sp *mlxsw_sp, void *region_priv, 706 void *tcam_priv, 707 struct mlxsw_sp_acl_tcam_region *region); 708 void (*region_fini)(struct mlxsw_sp *mlxsw_sp, void *region_priv); 709 int (*region_associate)(struct mlxsw_sp *mlxsw_sp, 710 struct mlxsw_sp_acl_tcam_region *region); 711 size_t chunk_priv_size; 712 void (*chunk_init)(void *region_priv, void *chunk_priv, 713 unsigned int priority); 714 void (*chunk_fini)(void *chunk_priv); 715 size_t entry_priv_size; 716 int (*entry_add)(struct mlxsw_sp *mlxsw_sp, 717 void *region_priv, void *chunk_priv, 718 void *entry_priv, 719 struct mlxsw_sp_acl_rule_info *rulei); 720 void (*entry_del)(struct mlxsw_sp *mlxsw_sp, 721 void *region_priv, void *chunk_priv, 722 void *entry_priv); 723 int (*entry_action_replace)(struct mlxsw_sp *mlxsw_sp, 724 void *region_priv, void *entry_priv, 725 struct mlxsw_sp_acl_rule_info *rulei); 726 int (*entry_activity_get)(struct mlxsw_sp *mlxsw_sp, 727 void *region_priv, void *entry_priv, 728 bool *activity); 729 }; 730 731 /* spectrum1_acl_tcam.c */ 732 extern const struct mlxsw_sp_acl_tcam_ops mlxsw_sp1_acl_tcam_ops; 733 734 /* spectrum2_acl_tcam.c */ 735 extern const struct mlxsw_sp_acl_tcam_ops mlxsw_sp2_acl_tcam_ops; 736 737 /* spectrum_acl_flex_actions.c */ 738 extern const struct mlxsw_afa_ops mlxsw_sp1_act_afa_ops; 739 extern const struct mlxsw_afa_ops mlxsw_sp2_act_afa_ops; 740 741 /* spectrum_acl_flex_keys.c */ 742 extern const struct mlxsw_afk_ops mlxsw_sp1_afk_ops; 743 extern const struct mlxsw_afk_ops mlxsw_sp2_afk_ops; 744 745 /* spectrum_flower.c */ 746 int mlxsw_sp_flower_replace(struct mlxsw_sp *mlxsw_sp, 747 struct mlxsw_sp_acl_block *block, 748 struct tc_cls_flower_offload *f); 749 void mlxsw_sp_flower_destroy(struct mlxsw_sp *mlxsw_sp, 750 struct mlxsw_sp_acl_block *block, 751 struct tc_cls_flower_offload *f); 752 int mlxsw_sp_flower_stats(struct mlxsw_sp *mlxsw_sp, 753 struct mlxsw_sp_acl_block *block, 754 struct tc_cls_flower_offload *f); 755 int mlxsw_sp_flower_tmplt_create(struct mlxsw_sp *mlxsw_sp, 756 struct mlxsw_sp_acl_block *block, 757 struct tc_cls_flower_offload *f); 758 void mlxsw_sp_flower_tmplt_destroy(struct mlxsw_sp *mlxsw_sp, 759 struct mlxsw_sp_acl_block *block, 760 struct tc_cls_flower_offload *f); 761 762 /* spectrum_qdisc.c */ 763 int mlxsw_sp_tc_qdisc_init(struct mlxsw_sp_port *mlxsw_sp_port); 764 void mlxsw_sp_tc_qdisc_fini(struct mlxsw_sp_port *mlxsw_sp_port); 765 int mlxsw_sp_setup_tc_red(struct mlxsw_sp_port *mlxsw_sp_port, 766 struct tc_red_qopt_offload *p); 767 int mlxsw_sp_setup_tc_prio(struct mlxsw_sp_port *mlxsw_sp_port, 768 struct tc_prio_qopt_offload *p); 769 770 /* spectrum_fid.c */ 771 bool mlxsw_sp_fid_lag_vid_valid(const struct mlxsw_sp_fid *fid); 772 struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_index(struct mlxsw_sp *mlxsw_sp, 773 u16 fid_index); 774 int mlxsw_sp_fid_nve_ifindex(const struct mlxsw_sp_fid *fid, int *nve_ifindex); 775 int mlxsw_sp_fid_nve_type(const struct mlxsw_sp_fid *fid, 776 enum mlxsw_sp_nve_type *p_type); 777 struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_vni(struct mlxsw_sp *mlxsw_sp, 778 __be32 vni); 779 int mlxsw_sp_fid_vni(const struct mlxsw_sp_fid *fid, __be32 *vni); 780 int mlxsw_sp_fid_nve_flood_index_set(struct mlxsw_sp_fid *fid, 781 u32 nve_flood_index); 782 void mlxsw_sp_fid_nve_flood_index_clear(struct mlxsw_sp_fid *fid); 783 bool mlxsw_sp_fid_nve_flood_index_is_set(const struct mlxsw_sp_fid *fid); 784 int mlxsw_sp_fid_vni_set(struct mlxsw_sp_fid *fid, enum mlxsw_sp_nve_type type, 785 __be32 vni, int nve_ifindex); 786 void mlxsw_sp_fid_vni_clear(struct mlxsw_sp_fid *fid); 787 bool mlxsw_sp_fid_vni_is_set(const struct mlxsw_sp_fid *fid); 788 void mlxsw_sp_fid_fdb_clear_offload(const struct mlxsw_sp_fid *fid, 789 const struct net_device *nve_dev); 790 int mlxsw_sp_fid_flood_set(struct mlxsw_sp_fid *fid, 791 enum mlxsw_sp_flood_type packet_type, u8 local_port, 792 bool member); 793 int mlxsw_sp_fid_port_vid_map(struct mlxsw_sp_fid *fid, 794 struct mlxsw_sp_port *mlxsw_sp_port, u16 vid); 795 void mlxsw_sp_fid_port_vid_unmap(struct mlxsw_sp_fid *fid, 796 struct mlxsw_sp_port *mlxsw_sp_port, u16 vid); 797 u16 mlxsw_sp_fid_index(const struct mlxsw_sp_fid *fid); 798 enum mlxsw_sp_fid_type mlxsw_sp_fid_type(const struct mlxsw_sp_fid *fid); 799 void mlxsw_sp_fid_rif_set(struct mlxsw_sp_fid *fid, struct mlxsw_sp_rif *rif); 800 struct mlxsw_sp_rif *mlxsw_sp_fid_rif(const struct mlxsw_sp_fid *fid); 801 enum mlxsw_sp_rif_type 802 mlxsw_sp_fid_type_rif_type(const struct mlxsw_sp *mlxsw_sp, 803 enum mlxsw_sp_fid_type type); 804 u16 mlxsw_sp_fid_8021q_vid(const struct mlxsw_sp_fid *fid); 805 struct mlxsw_sp_fid *mlxsw_sp_fid_8021q_get(struct mlxsw_sp *mlxsw_sp, u16 vid); 806 struct mlxsw_sp_fid *mlxsw_sp_fid_8021d_get(struct mlxsw_sp *mlxsw_sp, 807 int br_ifindex); 808 struct mlxsw_sp_fid *mlxsw_sp_fid_8021q_lookup(struct mlxsw_sp *mlxsw_sp, 809 u16 vid); 810 struct mlxsw_sp_fid *mlxsw_sp_fid_8021d_lookup(struct mlxsw_sp *mlxsw_sp, 811 int br_ifindex); 812 struct mlxsw_sp_fid *mlxsw_sp_fid_rfid_get(struct mlxsw_sp *mlxsw_sp, 813 u16 rif_index); 814 struct mlxsw_sp_fid *mlxsw_sp_fid_dummy_get(struct mlxsw_sp *mlxsw_sp); 815 void mlxsw_sp_fid_put(struct mlxsw_sp_fid *fid); 816 int mlxsw_sp_port_fids_init(struct mlxsw_sp_port *mlxsw_sp_port); 817 void mlxsw_sp_port_fids_fini(struct mlxsw_sp_port *mlxsw_sp_port); 818 int mlxsw_sp_fids_init(struct mlxsw_sp *mlxsw_sp); 819 void mlxsw_sp_fids_fini(struct mlxsw_sp *mlxsw_sp); 820 821 /* spectrum_mr.c */ 822 enum mlxsw_sp_mr_route_prio { 823 MLXSW_SP_MR_ROUTE_PRIO_SG, 824 MLXSW_SP_MR_ROUTE_PRIO_STARG, 825 MLXSW_SP_MR_ROUTE_PRIO_CATCHALL, 826 __MLXSW_SP_MR_ROUTE_PRIO_MAX 827 }; 828 829 #define MLXSW_SP_MR_ROUTE_PRIO_MAX (__MLXSW_SP_MR_ROUTE_PRIO_MAX - 1) 830 831 struct mlxsw_sp_mr_route_key; 832 833 struct mlxsw_sp_mr_tcam_ops { 834 size_t priv_size; 835 int (*init)(struct mlxsw_sp *mlxsw_sp, void *priv); 836 void (*fini)(void *priv); 837 size_t route_priv_size; 838 int (*route_create)(struct mlxsw_sp *mlxsw_sp, void *priv, 839 void *route_priv, 840 struct mlxsw_sp_mr_route_key *key, 841 struct mlxsw_afa_block *afa_block, 842 enum mlxsw_sp_mr_route_prio prio); 843 void (*route_destroy)(struct mlxsw_sp *mlxsw_sp, void *priv, 844 void *route_priv, 845 struct mlxsw_sp_mr_route_key *key); 846 int (*route_update)(struct mlxsw_sp *mlxsw_sp, void *route_priv, 847 struct mlxsw_sp_mr_route_key *key, 848 struct mlxsw_afa_block *afa_block); 849 }; 850 851 /* spectrum1_mr_tcam.c */ 852 extern const struct mlxsw_sp_mr_tcam_ops mlxsw_sp1_mr_tcam_ops; 853 854 /* spectrum2_mr_tcam.c */ 855 extern const struct mlxsw_sp_mr_tcam_ops mlxsw_sp2_mr_tcam_ops; 856 857 /* spectrum_nve.c */ 858 struct mlxsw_sp_nve_params { 859 enum mlxsw_sp_nve_type type; 860 __be32 vni; 861 const struct net_device *dev; 862 }; 863 864 extern const struct mlxsw_sp_nve_ops *mlxsw_sp1_nve_ops_arr[]; 865 extern const struct mlxsw_sp_nve_ops *mlxsw_sp2_nve_ops_arr[]; 866 867 int mlxsw_sp_nve_learned_ip_resolve(struct mlxsw_sp *mlxsw_sp, u32 uip, 868 enum mlxsw_sp_l3proto proto, 869 union mlxsw_sp_l3addr *addr); 870 int mlxsw_sp_nve_flood_ip_add(struct mlxsw_sp *mlxsw_sp, 871 struct mlxsw_sp_fid *fid, 872 enum mlxsw_sp_l3proto proto, 873 union mlxsw_sp_l3addr *addr); 874 void mlxsw_sp_nve_flood_ip_del(struct mlxsw_sp *mlxsw_sp, 875 struct mlxsw_sp_fid *fid, 876 enum mlxsw_sp_l3proto proto, 877 union mlxsw_sp_l3addr *addr); 878 u32 mlxsw_sp_nve_decap_tunnel_index_get(const struct mlxsw_sp *mlxsw_sp); 879 bool mlxsw_sp_nve_ipv4_route_is_decap(const struct mlxsw_sp *mlxsw_sp, 880 u32 tb_id, __be32 addr); 881 int mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid, 882 struct mlxsw_sp_nve_params *params, 883 struct netlink_ext_ack *extack); 884 void mlxsw_sp_nve_fid_disable(struct mlxsw_sp *mlxsw_sp, 885 struct mlxsw_sp_fid *fid); 886 int mlxsw_sp_port_nve_init(struct mlxsw_sp_port *mlxsw_sp_port); 887 void mlxsw_sp_port_nve_fini(struct mlxsw_sp_port *mlxsw_sp_port); 888 int mlxsw_sp_nve_init(struct mlxsw_sp *mlxsw_sp); 889 void mlxsw_sp_nve_fini(struct mlxsw_sp *mlxsw_sp); 890 891 #endif 892