mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 23:27:06 +00:00
ice: Block switchdev mode when ADQ is active and vice versa
[ Upstream commit43d00e102d
] ADQ and switchdev are not supported simultaneously. Enabling both at the same time can result in nullptr dereference. To prevent this, check if ADQ is active when changing devlink mode to switchdev mode, and check if switchdev is active when enabling ADQ. Fixes:fbc7b27af0
("ice: enable ndo_setup_tc support for mqprio_qdisc") Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/r/20230816193405.1307580-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7d25579fb9
commit
24f0d69da3
2 changed files with 11 additions and 0 deletions
|
@ -568,6 +568,12 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
|
|||
break;
|
||||
case DEVLINK_ESWITCH_MODE_SWITCHDEV:
|
||||
{
|
||||
if (ice_is_adq_active(pf)) {
|
||||
dev_err(ice_pf_to_dev(pf), "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs and try again, e.g. tc qdisc del dev $PF root");
|
||||
NL_SET_ERR_MSG_MOD(extack, "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs and try again, e.g. tc qdisc del dev $PF root");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev",
|
||||
pf->hw.pf_id);
|
||||
NL_SET_ERR_MSG_MOD(extack, "Changed eswitch mode to switchdev");
|
||||
|
|
|
@ -9065,6 +9065,11 @@ ice_setup_tc(struct net_device *netdev, enum tc_setup_type type,
|
|||
ice_setup_tc_block_cb,
|
||||
np, np, true);
|
||||
case TC_SETUP_QDISC_MQPRIO:
|
||||
if (ice_is_eswitch_mode_switchdev(pf)) {
|
||||
netdev_err(netdev, "TC MQPRIO offload not supported, switchdev is enabled\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (pf->adev) {
|
||||
mutex_lock(&pf->adev_mutex);
|
||||
device_lock(&pf->adev->dev);
|
||||
|
|
Loading…
Reference in a new issue