| .. | .. |
|---|
| 7 | 7 | #include "spectrum.h" |
|---|
| 8 | 8 | #include "reg.h" |
|---|
| 9 | 9 | |
|---|
| 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; |
|---|
| 14 | 16 | }; |
|---|
| 15 | 17 | |
|---|
| 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 */ |
|---|
| 19 | 51 | }; |
|---|
| 20 | 52 | |
|---|
| 21 | 53 | struct mlxsw_sp_rif_ipip_lb; |
|---|
| .. | .. |
|---|
| 35 | 67 | struct mlxsw_sp_nexthop; |
|---|
| 36 | 68 | struct mlxsw_sp_ipip_entry; |
|---|
| 37 | 69 | |
|---|
| 38 | | -struct mlxsw_sp_rif *mlxsw_sp_rif_find_by_dev(const struct mlxsw_sp *mlxsw_sp, |
|---|
| 39 | | - const struct net_device *dev); |
|---|
| 40 | 70 | struct mlxsw_sp_rif *mlxsw_sp_rif_by_index(const struct mlxsw_sp *mlxsw_sp, |
|---|
| 41 | 71 | u16 rif_index); |
|---|
| 42 | 72 | u16 mlxsw_sp_rif_index(const struct mlxsw_sp_rif *rif); |
|---|
| 43 | 73 | u16 mlxsw_sp_ipip_lb_rif_index(const struct mlxsw_sp_rif_ipip_lb *rif); |
|---|
| 44 | 74 | 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); |
|---|
| 45 | 76 | u32 mlxsw_sp_ipip_dev_ul_tb_id(const struct net_device *ol_dev); |
|---|
| 46 | 77 | int mlxsw_sp_rif_dev_ifindex(const struct mlxsw_sp_rif *rif); |
|---|
| 47 | | -u8 mlxsw_sp_router_port(const struct mlxsw_sp *mlxsw_sp); |
|---|
| 48 | 78 | 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); |
|---|
| 50 | 79 | int mlxsw_sp_rif_counter_value_get(struct mlxsw_sp *mlxsw_sp, |
|---|
| 51 | 80 | struct mlxsw_sp_rif *rif, |
|---|
| 52 | 81 | enum mlxsw_sp_rif_counter_dir dir, |
|---|
| .. | .. |
|---|
| 118 | 147 | return !memcmp(addr1, addr2, sizeof(*addr1)); |
|---|
| 119 | 148 | } |
|---|
| 120 | 149 | |
|---|
| 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 | + |
|---|
| 121 | 153 | #endif /* _MLXSW_ROUTER_H_*/ |
|---|