ice: Block switchdev mode when ADQ is acvite and vice versa
Subsystems (3)
PATCH 1/1 ice: Block switchdev mode when ADQ is acvite and vice versa
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.
--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 5 +++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++++ 2 files changed, 11 insertions(+)
drivers/net/ethernet/intel/ice/ice_eswitch.c +5 -0
@@ -538,6 +538,11 @@ 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),"switchdev cannot be configured - ADQ is active. Delete ADQ configs using TC and try again\n" ); +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" );
drivers/net/ethernet/intel/ice/ice_main.c +6 -0
@@ -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);
Signature · 1 line
2.41.0
Quoted 6 lines · Marcin Szycik
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.
Quoted 7 lines
Fixes fbc7b27af0f9 ("ice: enable ndo_setup_tc support for mqprio_qdisc")Signed-off-by Marcin Szycik <[email protected]>--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 5 +++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++++ 2 files changed, 11 insertions(+)
Quoted 18 lines · Marcin Szycik
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 <[email protected]>--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 5 +++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++++ 2 files changed, 11 insertions(+)drivers/net/ethernet/intel/ice/ice_eswitch.c +0
-0
drivers/net/ethernet/intel/ice/ice_eswitch.c ice_eswitch_mode_set(struct devlink *devlink, u16 mode, · line 542
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c +2
-0@@ -538,6 +538,11 @@ 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),"switchdev cannot be configured - ADQ is active. Delete ADQ configs using TC and try again\n" );
It needs to be reported through netlink extack.
drivers/net/ethernet/intel/ice/ice_eswitch.c ice_eswitch_mode_set(struct devlink *devlink, u16 mode, · line 548
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c +3
-0+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" );
Thanks
Quoted 14 lines · Thu, Aug 03, 2023 at 03:11:26PM CEST, [email protected] wrote:
Quoted 13 lines · Marcin Szycik
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 <[email protected]>--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 5 +++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++++ 2 files changed, 11 insertions(+)
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c ice_eswitch_mode_set(struct devlink *devlink, u16 mode, · line 542
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c +2
-0@@ -538,6 +538,11 @@ 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),"switchdev cannot be configured - ADQ is active. Delete ADQ configs using TC and try again\n" );
Does this provide sufficient hint to the user? I mean, what's ADQ and how it is related to TC objects? Please be more precise.
Quoted 12 lines
It needs to be reported through netlink extack.
drivers/net/ethernet/intel/ice/ice_eswitch.c ice_eswitch_mode_set(struct devlink *devlink, u16 mode, · line 548
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c +3
-0+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" );Thanks
Quoted 14 lines · Leon Romanovsky
Quoted 13 lines · Marcin Szycik
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 <[email protected]>--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 5 +++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++++ 2 files changed, 11 insertions(+)
Quoted 12 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c ice_eswitch_mode_set(struct devlink *devlink, u16 mode, · line 542
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c +2
-0@@ -538,6 +538,11 @@ 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),"switchdev cannot be configured - ADQ is active. Delete ADQ configs using TC and try again\n" );It needs to be reported through netlink extack.
Will do, thanks!
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c ice_eswitch_mode_set(struct devlink *devlink, u16 mode, · line 548
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c +3
-0+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" );Thanks
Quoted 15 lines · Jiri Pirko
Quoted 14 lines · Thu, Aug 03, 2023 at 03:11:26PM CEST, [email protected] wrote:
Quoted 13 lines · Marcin Szycik
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 <[email protected]>--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 5 +++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++++ 2 files changed, 11 insertions(+)
Quoted 13 lines
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c ice_eswitch_mode_set(struct devlink *devlink, u16 mode, · line 542
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c +2
-0@@ -538,6 +538,11 @@ 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),"switchdev cannot be configured - ADQ is active. Delete ADQ configs using TC and try again\n" );Does this provide sufficient hint to the user? I mean, what's ADQ and how it is related to TC objects? Please be more precise.
Application Device Queues, a conflicting feature unrelated to switchdev. If it's enabled, there's a good chance the user knows what it is because they configured it.
Could you suggest a better error message?
Quoted 5 lines
Quoted 5 lines
It needs to be reported through netlink extack.
Quoted 10 lines
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c ice_eswitch_mode_set(struct devlink *devlink, u16 mode, · line 548
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c +3
-0+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" );Thanks
Regards,
Marcin
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 32 lines · Thu, Aug 03, 2023 at 05:11:16PM CEST, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
Quoted 14 lines · Thu, Aug 03, 2023 at 03:11:26PM CEST, [email protected] wrote:
Quoted 13 lines · Marcin Szycik
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 <[email protected]>--- drivers/net/ethernet/intel/ice/ice_eswitch.c | 5 +++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++++ 2 files changed, 11 insertions(+)Quoted 13 lines
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c ice_eswitch_mode_set(struct devlink *devlink, u16 mode, · line 542
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c +2
-0@@ -538,6 +538,11 @@ 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),"switchdev cannot be configured - ADQ is active. Delete ADQ configs using TC and try again\n" );Does this provide sufficient hint to the user? I mean, what's ADQ and how it is related to TC objects? Please be more precise.
Quoted 5 lines
Application Device Queues, a conflicting feature unrelated to switchdev. If it's enabled, there's a good chance the user knows what it is because they configured it.
Could you suggest a better error message?
The user would need to know what he needs to do in order to make this work. So it would be nice to hint what rules need to be removed.
Quoted 19 lines
Quoted 6 lines
Quoted 6 lines
It needs to be reported through netlink extack.
Quoted 10 lines
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c ice_eswitch_mode_set(struct devlink *devlink, u16 mode, · line 548
Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_eswitch.c +3
-0+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" );Thanks
Regards,
Marcin