mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
mlxsw: spectrum_router: Handle sysctl_ip_fwd_update_priority
This sysctl setting controls whether packet priority should be updated after forwarding. Configure RGCR.usp accordingly so that the device is in sync with the kernel handling. Note that RGCR doesn't allow changing arbitrary parameters mid-operation, however "usp" is exempt and can be reconfigured. Also react to NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE notifications that signify change in this configuration. Signed-off-by: Petr Machata <petrm@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1f65a33fc7
commit
6495342365
1 changed files with 17 additions and 1 deletions
|
@ -2436,6 +2436,18 @@ static void mlxsw_sp_router_mp_hash_event_work(struct work_struct *work)
|
||||||
kfree(net_work);
|
kfree(net_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp);
|
||||||
|
|
||||||
|
static void mlxsw_sp_router_update_priority_work(struct work_struct *work)
|
||||||
|
{
|
||||||
|
struct mlxsw_sp_netevent_work *net_work =
|
||||||
|
container_of(work, struct mlxsw_sp_netevent_work, work);
|
||||||
|
struct mlxsw_sp *mlxsw_sp = net_work->mlxsw_sp;
|
||||||
|
|
||||||
|
__mlxsw_sp_router_init(mlxsw_sp);
|
||||||
|
kfree(net_work);
|
||||||
|
}
|
||||||
|
|
||||||
static int mlxsw_sp_router_schedule_work(struct net *net,
|
static int mlxsw_sp_router_schedule_work(struct net *net,
|
||||||
struct notifier_block *nb,
|
struct notifier_block *nb,
|
||||||
void (*cb)(struct work_struct *))
|
void (*cb)(struct work_struct *))
|
||||||
|
@ -2522,6 +2534,9 @@ static int mlxsw_sp_router_netevent_event(struct notifier_block *nb,
|
||||||
return mlxsw_sp_router_schedule_work(ptr, nb,
|
return mlxsw_sp_router_schedule_work(ptr, nb,
|
||||||
mlxsw_sp_router_mp_hash_event_work);
|
mlxsw_sp_router_mp_hash_event_work);
|
||||||
|
|
||||||
|
case NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE:
|
||||||
|
return mlxsw_sp_router_schedule_work(ptr, nb,
|
||||||
|
mlxsw_sp_router_update_priority_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NOTIFY_DONE;
|
return NOTIFY_DONE;
|
||||||
|
@ -7390,6 +7405,7 @@ static int mlxsw_sp_dscp_init(struct mlxsw_sp *mlxsw_sp)
|
||||||
|
|
||||||
static int __mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp)
|
static int __mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp)
|
||||||
{
|
{
|
||||||
|
bool usp = init_net.ipv4.sysctl_ip_fwd_update_priority;
|
||||||
char rgcr_pl[MLXSW_REG_RGCR_LEN];
|
char rgcr_pl[MLXSW_REG_RGCR_LEN];
|
||||||
u64 max_rifs;
|
u64 max_rifs;
|
||||||
int err;
|
int err;
|
||||||
|
@ -7400,7 +7416,7 @@ static int __mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp)
|
||||||
|
|
||||||
mlxsw_reg_rgcr_pack(rgcr_pl, true, true);
|
mlxsw_reg_rgcr_pack(rgcr_pl, true, true);
|
||||||
mlxsw_reg_rgcr_max_router_interfaces_set(rgcr_pl, max_rifs);
|
mlxsw_reg_rgcr_max_router_interfaces_set(rgcr_pl, max_rifs);
|
||||||
mlxsw_reg_rgcr_usp_set(rgcr_pl, true);
|
mlxsw_reg_rgcr_usp_set(rgcr_pl, usp);
|
||||||
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rgcr), rgcr_pl);
|
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rgcr), rgcr_pl);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in a new issue