Message ID | 20230804142654.9729-1-marcin.szycik@linux.intel.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [iwl-net,v2] ice: Block switchdev mode when ADQ is active and vice versa | expand |
On 8/4/2023 7:26 AM, Marcin Szycik wrote: > 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: fbc7b27af0f9 ("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> > --- ... > @@ -8834,6 +8834,12 @@ ice_setup_tc(struct net_device *netdev, enum tc_setup_type type, > } > } > > + if (ice_is_eswitch_mode_switchdev(pf)) { > + netdev_err(netdev, "TC MQPRIO offload not supported, switchdev is enabled\n"); > + err = -EOPNOTSUPP; > + goto adev_unlock; Does this need to be checked under adev locks? > + } > + > /* setup traffic classifier for receive side */ > mutex_lock(&pf->tc_mutex); > err = ice_setup_tc_mqprio_qdisc(netdev, type_data);
On 08.08.2023 19:55, Tony Nguyen wrote: > On 8/4/2023 7:26 AM, Marcin Szycik wrote: >> 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: fbc7b27af0f9 ("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> >> --- > > ... > >> @@ -8834,6 +8834,12 @@ ice_setup_tc(struct net_device *netdev, enum tc_setup_type type, >> } >> } >> + if (ice_is_eswitch_mode_switchdev(pf)) { >> + netdev_err(netdev, "TC MQPRIO offload not supported, switchdev is enabled\n"); >> + err = -EOPNOTSUPP; >> + goto adev_unlock; > > Does this need to be checked under adev locks? It doesn't. I'll move it above. > >> + } >> + >> /* setup traffic classifier for receive side */ >> mutex_lock(&pf->tc_mutex); >> err = ice_setup_tc_mqprio_qdisc(netdev, type_data); Thank you for reviewing! Marcin
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c index ad0a007b7398..8f232c41a89e 100644 --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c @@ -538,6 +538,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"); diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index cf92c39467c8..2468b6018613 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -8834,6 +8834,12 @@ ice_setup_tc(struct net_device *netdev, enum tc_setup_type type, } } + if (ice_is_eswitch_mode_switchdev(pf)) { + netdev_err(netdev, "TC MQPRIO offload not supported, switchdev is enabled\n"); + err = -EOPNOTSUPP; + goto adev_unlock; + } + /* setup traffic classifier for receive side */ mutex_lock(&pf->tc_mutex); err = ice_setup_tc_mqprio_qdisc(netdev, type_data);