hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h
....@@ -7,15 +7,47 @@
77 #include "spectrum.h"
88 #include "reg.h"
99
10
-enum mlxsw_sp_l3proto {
11
- MLXSW_SP_L3_PROTO_IPV4,
12
- MLXSW_SP_L3_PROTO_IPV6,
13
-#define MLXSW_SP_L3_PROTO_MAX (MLXSW_SP_L3_PROTO_IPV6 + 1)
10
+struct mlxsw_sp_router_nve_decap {
11
+ u32 ul_tb_id;
12
+ u32 tunnel_index;
13
+ enum mlxsw_sp_l3proto ul_proto;
14
+ union mlxsw_sp_l3addr ul_sip;
15
+ u8 valid:1;
1416 };
1517
16
-union mlxsw_sp_l3addr {
17
- __be32 addr4;
18
- struct in6_addr addr6;
18
+struct mlxsw_sp_router {
19
+ struct mlxsw_sp *mlxsw_sp;
20
+ struct mlxsw_sp_rif **rifs;
21
+ struct mlxsw_sp_vr *vrs;
22
+ struct rhashtable neigh_ht;
23
+ struct rhashtable nexthop_group_ht;
24
+ struct rhashtable nexthop_ht;
25
+ struct list_head nexthop_list;
26
+ struct {
27
+ /* One tree for each protocol: IPv4 and IPv6 */
28
+ struct mlxsw_sp_lpm_tree *proto_trees[2];
29
+ struct mlxsw_sp_lpm_tree *trees;
30
+ unsigned int tree_count;
31
+ } lpm;
32
+ struct {
33
+ struct delayed_work dw;
34
+ unsigned long interval; /* ms */
35
+ } neighs_update;
36
+ struct delayed_work nexthop_probe_dw;
37
+#define MLXSW_SP_UNRESOLVED_NH_PROBE_INTERVAL 5000 /* ms */
38
+ struct list_head nexthop_neighs_list;
39
+ struct list_head ipip_list;
40
+ bool aborted;
41
+ struct notifier_block fib_nb;
42
+ struct notifier_block netevent_nb;
43
+ struct notifier_block inetaddr_nb;
44
+ struct notifier_block inet6addr_nb;
45
+ const struct mlxsw_sp_rif_ops **rif_ops_arr;
46
+ const struct mlxsw_sp_ipip_ops **ipip_ops_arr;
47
+ u32 adj_discard_index;
48
+ bool adj_discard_index_valid;
49
+ struct mlxsw_sp_router_nve_decap nve_decap_config;
50
+ struct mutex lock; /* Protects shared router resources */
1951 };
2052
2153 struct mlxsw_sp_rif_ipip_lb;
....@@ -35,18 +67,15 @@
3567 struct mlxsw_sp_nexthop;
3668 struct mlxsw_sp_ipip_entry;
3769
38
-struct mlxsw_sp_rif *mlxsw_sp_rif_find_by_dev(const struct mlxsw_sp *mlxsw_sp,
39
- const struct net_device *dev);
4070 struct mlxsw_sp_rif *mlxsw_sp_rif_by_index(const struct mlxsw_sp *mlxsw_sp,
4171 u16 rif_index);
4272 u16 mlxsw_sp_rif_index(const struct mlxsw_sp_rif *rif);
4373 u16 mlxsw_sp_ipip_lb_rif_index(const struct mlxsw_sp_rif_ipip_lb *rif);
4474 u16 mlxsw_sp_ipip_lb_ul_vr_id(const struct mlxsw_sp_rif_ipip_lb *rif);
75
+u16 mlxsw_sp_ipip_lb_ul_rif_id(const struct mlxsw_sp_rif_ipip_lb *lb_rif);
4576 u32 mlxsw_sp_ipip_dev_ul_tb_id(const struct net_device *ol_dev);
4677 int mlxsw_sp_rif_dev_ifindex(const struct mlxsw_sp_rif *rif);
47
-u8 mlxsw_sp_router_port(const struct mlxsw_sp *mlxsw_sp);
4878 const struct net_device *mlxsw_sp_rif_dev(const struct mlxsw_sp_rif *rif);
49
-struct mlxsw_sp_fid *mlxsw_sp_rif_fid(const struct mlxsw_sp_rif *rif);
5079 int mlxsw_sp_rif_counter_value_get(struct mlxsw_sp *mlxsw_sp,
5180 struct mlxsw_sp_rif *rif,
5281 enum mlxsw_sp_rif_counter_dir dir,
....@@ -118,4 +147,7 @@
118147 return !memcmp(addr1, addr2, sizeof(*addr1));
119148 }
120149
150
+int mlxsw_sp_ipip_ecn_encap_init(struct mlxsw_sp *mlxsw_sp);
151
+int mlxsw_sp_ipip_ecn_decap_init(struct mlxsw_sp *mlxsw_sp);
152
+
121153 #endif /* _MLXSW_ROUTER_H_*/