mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-28 05:24:47 +08:00
mlxsw: spectrum_router: Add support for setting counters on IPv6 neighbors
Add support for setting counters on IPv6 neighbors based on dpipe's host6 table counter status. Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
410774bde1
commit
1ed5574c6d
@ -1008,21 +1008,33 @@ mlxsw_sp_neigh_entry_remove(struct mlxsw_sp *mlxsw_sp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
mlxsw_sp_neigh4_counter_should_alloc(struct mlxsw_sp *mlxsw_sp)
|
mlxsw_sp_neigh_counter_should_alloc(struct mlxsw_sp *mlxsw_sp,
|
||||||
|
struct mlxsw_sp_neigh_entry *neigh_entry)
|
||||||
{
|
{
|
||||||
struct devlink *devlink;
|
struct devlink *devlink;
|
||||||
|
const char *table_name;
|
||||||
|
|
||||||
|
switch (mlxsw_sp_neigh_entry_type(neigh_entry)) {
|
||||||
|
case AF_INET:
|
||||||
|
table_name = MLXSW_SP_DPIPE_TABLE_NAME_HOST4;
|
||||||
|
break;
|
||||||
|
case AF_INET6:
|
||||||
|
table_name = MLXSW_SP_DPIPE_TABLE_NAME_HOST6;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
WARN_ON(1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
devlink = priv_to_devlink(mlxsw_sp->core);
|
devlink = priv_to_devlink(mlxsw_sp->core);
|
||||||
return devlink_dpipe_table_counter_enabled(devlink,
|
return devlink_dpipe_table_counter_enabled(devlink, table_name);
|
||||||
MLXSW_SP_DPIPE_TABLE_NAME_HOST4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mlxsw_sp_neigh_counter_alloc(struct mlxsw_sp *mlxsw_sp,
|
mlxsw_sp_neigh_counter_alloc(struct mlxsw_sp *mlxsw_sp,
|
||||||
struct mlxsw_sp_neigh_entry *neigh_entry)
|
struct mlxsw_sp_neigh_entry *neigh_entry)
|
||||||
{
|
{
|
||||||
if (mlxsw_sp_neigh_entry_type(neigh_entry) != AF_INET ||
|
if (!mlxsw_sp_neigh_counter_should_alloc(mlxsw_sp, neigh_entry))
|
||||||
!mlxsw_sp_neigh4_counter_should_alloc(mlxsw_sp))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mlxsw_sp_flow_counter_alloc(mlxsw_sp, &neigh_entry->counter_index))
|
if (mlxsw_sp_flow_counter_alloc(mlxsw_sp, &neigh_entry->counter_index))
|
||||||
|
Loading…
Reference in New Issue
Block a user