Skip to content

Commit fd1b9d4

Browse files
Arkadi Sharshevskydavem330
authored andcommitted
mlxsw: spectrum_router: Add rif helper functions
Add rif helper function to access the rif index and rif devices ifindex. This functions will be used by dpipe in order to dump the rif table. Signed-off-by: Arkadi Sharshevsky <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e0c0afd commit fd1b9d4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,6 +2932,16 @@ mlxsw_sp_rif_alloc(u16 rif_index, u16 vr_id, struct net_device *l3_dev,
29322932
return rif;
29332933
}
29342934

2935+
u16 mlxsw_sp_rif_index(const struct mlxsw_sp_rif *rif)
2936+
{
2937+
return rif->rif_index;
2938+
}
2939+
2940+
int mlxsw_sp_rif_dev_ifindex(const struct mlxsw_sp_rif *rif)
2941+
{
2942+
return rif->dev->ifindex;
2943+
}
2944+
29352945
static struct mlxsw_sp_rif *
29362946
mlxsw_sp_vport_rif_sp_create(struct mlxsw_sp_port *mlxsw_sp_vport,
29372947
struct net_device *l3_dev)

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ enum mlxsw_sp_rif_counter_dir {
4242
MLXSW_SP_RIF_COUNTER_EGRESS,
4343
};
4444

45+
u16 mlxsw_sp_rif_index(const struct mlxsw_sp_rif *rif);
46+
int mlxsw_sp_rif_dev_ifindex(const struct mlxsw_sp_rif *rif);
4547
int mlxsw_sp_rif_counter_value_get(struct mlxsw_sp *mlxsw_sp,
4648
struct mlxsw_sp_rif *rif,
4749
enum mlxsw_sp_rif_counter_dir dir,

0 commit comments

Comments
 (0)