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 };
23 
24 struct mlx5_esw_bridge_fdb_entry {
25 	struct mlx5_esw_bridge_fdb_key key;
26 	struct rhash_head ht_node;
27 	struct net_device *dev;
28 	struct list_head list;
29 	struct list_head vlan_list;
30 	u16 vport_num;
31 	u16 flags;
32 
33 	struct mlx5_flow_handle *ingress_handle;
34 	struct mlx5_fc *ingress_counter;
35 	unsigned long lastuse;
36 	struct mlx5_flow_handle *egress_handle;
37 	struct mlx5_flow_handle *filter_handle;
38 };
39 
40 struct mlx5_esw_bridge_vlan {
41 	u16 vid;
42 	u16 flags;
43 	struct list_head fdb_list;
44 	struct mlx5_pkt_reformat *pkt_reformat_push;
45 	struct mlx5_pkt_reformat *pkt_reformat_pop;
46 };
47 
48 struct mlx5_esw_bridge_port {
49 	u16 vport_num;
50 	struct xarray vlans;
51 };
52 
53 #endif /* _MLX5_ESW_BRIDGE_PRIVATE_ */
54