@@ -2847,41 +2847,47 @@ static int mlx5e_modify_channels_vsd(struct mlx5e_channels *chs, bool vsd)
28472847 return 0 ;
28482848}
28492849
2850- static int mlx5e_setup_tc_mqprio (struct mlx5e_priv * priv ,
2851- struct tc_mqprio_qopt * mqprio )
2850+ static int mlx5e_setup_tc_mqprio_dcb (struct mlx5e_priv * priv ,
2851+ struct tc_mqprio_qopt * mqprio )
28522852{
28532853 struct mlx5e_params new_params ;
28542854 u8 tc = mqprio -> num_tc ;
2855- int err = 0 ;
2855+ int err ;
28562856
28572857 mqprio -> hw = TC_MQPRIO_HW_OFFLOAD_TCS ;
28582858
28592859 if (tc && tc != MLX5E_MAX_NUM_TC )
28602860 return - EINVAL ;
28612861
2862- mutex_lock (& priv -> state_lock );
2863-
2864- /* MQPRIO is another toplevel qdisc that can't be attached
2865- * simultaneously with the offloaded HTB.
2866- */
2867- if (WARN_ON (priv -> htb .maj_id )) {
2868- err = - EINVAL ;
2869- goto out ;
2870- }
2871-
28722862 new_params = priv -> channels .params ;
2863+ new_params .mqprio .mode = TC_MQPRIO_MODE_DCB ;
28732864 new_params .mqprio .num_tc = tc ? tc : 1 ;
28742865
28752866 err = mlx5e_safe_switch_params (priv , & new_params ,
28762867 mlx5e_num_channels_changed_ctx , NULL , true);
28772868
2878- out :
28792869 priv -> max_opened_tc = max_t (u8 , priv -> max_opened_tc ,
28802870 mlx5e_get_dcb_num_tc (& priv -> channels .params ));
2881- mutex_unlock (& priv -> state_lock );
28822871 return err ;
28832872}
28842873
2874+ static int mlx5e_setup_tc_mqprio (struct mlx5e_priv * priv ,
2875+ struct tc_mqprio_qopt_offload * mqprio )
2876+ {
2877+ /* MQPRIO is another toplevel qdisc that can't be attached
2878+ * simultaneously with the offloaded HTB.
2879+ */
2880+ if (WARN_ON (priv -> htb .maj_id ))
2881+ return - EINVAL ;
2882+
2883+ switch (mqprio -> mode ) {
2884+ case TC_MQPRIO_MODE_DCB :
2885+ return mlx5e_setup_tc_mqprio_dcb (priv , & mqprio -> qopt );
2886+ default :
2887+ return - EOPNOTSUPP ;
2888+ }
2889+ }
2890+
28852891static int mlx5e_setup_tc_htb (struct mlx5e_priv * priv , struct tc_htb_qopt_offload * htb )
28862892{
28872893 int res ;
@@ -2951,7 +2957,10 @@ static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
29512957 priv , priv , true);
29522958 }
29532959 case TC_SETUP_QDISC_MQPRIO :
2954- return mlx5e_setup_tc_mqprio (priv , type_data );
2960+ mutex_lock (& priv -> state_lock );
2961+ err = mlx5e_setup_tc_mqprio (priv , type_data );
2962+ mutex_unlock (& priv -> state_lock );
2963+ return err ;
29552964 case TC_SETUP_QDISC_HTB :
29562965 mutex_lock (& priv -> state_lock );
29572966 err = mlx5e_setup_tc_htb (priv , type_data );
0 commit comments