1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2021 Mellanox Technologies. */
3 
4 #ifndef _MLX5_ESW_BRIDGE_PRIVATE_
5 #define _MLX5_ESW_BRIDGE_PRIVATE_
6 
7 #include <linux/netdevice.h>
8 #include <linux/if_bridge.h>
9 #include <linux/if_vlan.h>
10 #include <linux/if_ether.h>
11 #include <linux/rhashtable.h>
12 #include <linux/xarray.h>
13 #include "fs_core.h"
14 
15 struct mlx5_esw_bridge_fdb_key {
16 	unsigned char addr[ETH_ALEN];
17 	u16 vid;
18 };
19 
20 enum {
21 	MLX5_ESW_BRIDGE_FLAG_ADDED_BY_USER = BIT(0),
22 	MLX5_ESW_BRIDGE_FLAG_PEER = BIT(1),
23 };
24 
25 enum {
26 	MLX5_ESW_BRIDGE_PORT_FLAG_PEER = BIT(0),
27 };
28 
29 struct mlx5_esw_bridge_fdb_entry {
30 	struct mlx5_esw_bridge_fdb_key key;
31 	struct rhash_head ht_node;
32 	struct net_device *dev;
33 	struct list_head list;
34 	struct list_head vlan_list;
35 	u16 vport_num;
36 	u16 esw_owner_vhca_id;
37 	u16 flags;
38 
39 	struct mlx5_flow_handle *ingress_handle;
40 	struct mlx5_fc *ingress_counter;
41 	unsigned long lastuse;
42 	struct mlx5_flow_handle *egress_handle;
43 	struct mlx5_flow_handle *filter_handle;
44 };
45 
46 struct mlx5_esw_bridge_vlan {
47 	u16 vid;
48 	u16 flags;
49 	struct list_head fdb_list;
50 	struct mlx5_pkt_reformat *pkt_reformat_push;
51 	struct mlx5_pkt_reformat *pkt_reformat_pop;
52 	struct mlx5_modify_hdr *pkt_mod_hdr_push_mark;
53 };
54 
55 struct mlx5_esw_bridge_port {
56 	u16 vport_num;
57 	u16 esw_owner_vhca_id;
58 	u16 flags;
59 	struct mlx5_esw_bridge *bridge;
60 	struct xarray vlans;
61 };
62 
63 #endif /* _MLX5_ESW_BRIDGE_PRIVATE_ */
64