aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum.h')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index 958e821ce845..ef4ac8987a2a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -39,6 +39,7 @@
39 39
40#include <linux/types.h> 40#include <linux/types.h>
41#include <linux/netdevice.h> 41#include <linux/netdevice.h>
42#include <linux/rhashtable.h>
42#include <linux/bitops.h> 43#include <linux/bitops.h>
43#include <linux/if_vlan.h> 44#include <linux/if_vlan.h>
44#include <linux/list.h> 45#include <linux/list.h>
@@ -75,6 +76,10 @@
75#define MLXSW_SP_BYTES_TO_CELLS(b) DIV_ROUND_UP(b, MLXSW_SP_BYTES_PER_CELL) 76#define MLXSW_SP_BYTES_TO_CELLS(b) DIV_ROUND_UP(b, MLXSW_SP_BYTES_PER_CELL)
76#define MLXSW_SP_CELLS_TO_BYTES(c) (c * MLXSW_SP_BYTES_PER_CELL) 77#define MLXSW_SP_CELLS_TO_BYTES(c) (c * MLXSW_SP_BYTES_PER_CELL)
77 78
79#define MLXSW_SP_KVD_LINEAR_SIZE 65536 /* entries */
80#define MLXSW_SP_KVD_HASH_SINGLE_SIZE 163840 /* entries */
81#define MLXSW_SP_KVD_HASH_DOUBLE_SIZE 32768 /* entries */
82
78/* Maximum delay buffer needed in case of PAUSE frames, in cells. 83/* Maximum delay buffer needed in case of PAUSE frames, in cells.
79 * Assumes 100m cable and maximum MTU. 84 * Assumes 100m cable and maximum MTU.
80 */ 85 */
@@ -212,6 +217,15 @@ struct mlxsw_sp_vr {
212struct mlxsw_sp_router { 217struct mlxsw_sp_router {
213 struct mlxsw_sp_lpm_tree lpm_trees[MLXSW_SP_LPM_TREE_COUNT]; 218 struct mlxsw_sp_lpm_tree lpm_trees[MLXSW_SP_LPM_TREE_COUNT];
214 struct mlxsw_sp_vr vrs[MLXSW_SP_VIRTUAL_ROUTER_MAX]; 219 struct mlxsw_sp_vr vrs[MLXSW_SP_VIRTUAL_ROUTER_MAX];
220 struct rhashtable neigh_ht;
221 struct {
222 struct delayed_work dw;
223 unsigned long interval; /* ms */
224 } neighs_update;
225 struct delayed_work nexthop_probe_dw;
226#define MLXSW_SP_UNRESOLVED_NH_PROBE_INTERVAL 5000 /* ms */
227 struct list_head nexthop_group_list;
228 struct list_head nexthop_neighs_list;
215}; 229};
216 230
217struct mlxsw_sp { 231struct mlxsw_sp {
@@ -243,6 +257,9 @@ struct mlxsw_sp {
243 u8 port_to_module[MLXSW_PORT_MAX_PORTS]; 257 u8 port_to_module[MLXSW_PORT_MAX_PORTS];
244 struct mlxsw_sp_sb sb; 258 struct mlxsw_sp_sb sb;
245 struct mlxsw_sp_router router; 259 struct mlxsw_sp_router router;
260 struct {
261 DECLARE_BITMAP(usage, MLXSW_SP_KVD_LINEAR_SIZE);
262 } kvdl;
246}; 263};
247 264
248static inline struct mlxsw_sp_upper * 265static inline struct mlxsw_sp_upper *
@@ -524,5 +541,12 @@ int mlxsw_sp_router_fib4_add(struct mlxsw_sp_port *mlxsw_sp_port,
524 struct switchdev_trans *trans); 541 struct switchdev_trans *trans);
525int mlxsw_sp_router_fib4_del(struct mlxsw_sp_port *mlxsw_sp_port, 542int mlxsw_sp_router_fib4_del(struct mlxsw_sp_port *mlxsw_sp_port,
526 const struct switchdev_obj_ipv4_fib *fib4); 543 const struct switchdev_obj_ipv4_fib *fib4);
544int mlxsw_sp_router_neigh_construct(struct net_device *dev,
545 struct neighbour *n);
546void mlxsw_sp_router_neigh_destroy(struct net_device *dev,
547 struct neighbour *n);
548
549int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count);
550void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index);
527 551
528#endif 552#endif