@@ -816,24 +816,29 @@ static int esw_offloads_start(struct mlx5_eswitch *esw,
816816 int err , err1 , num_vfs = esw -> dev -> priv .sriov .num_vfs ;
817817
818818 if (esw -> mode != SRIOV_LEGACY ) {
819- esw_warn (esw -> dev , "Can't set offloads mode, SRIOV legacy not enabled\n" );
819+ NL_SET_ERR_MSG_MOD (extack ,
820+ "Can't set offloads mode, SRIOV legacy not enabled" );
820821 return - EINVAL ;
821822 }
822823
823824 mlx5_eswitch_disable_sriov (esw );
824825 err = mlx5_eswitch_enable_sriov (esw , num_vfs , SRIOV_OFFLOADS );
825826 if (err ) {
826- esw_warn (esw -> dev , "Failed setting eswitch to offloads, err %d\n" , err );
827+ NL_SET_ERR_MSG_MOD (extack ,
828+ "Failed setting eswitch to offloads" );
827829 err1 = mlx5_eswitch_enable_sriov (esw , num_vfs , SRIOV_LEGACY );
828- if (err1 )
829- esw_warn (esw -> dev , "Failed setting eswitch back to legacy, err %d\n" , err1 );
830+ if (err1 ) {
831+ NL_SET_ERR_MSG_MOD (extack ,
832+ "Failed setting eswitch back to legacy" );
833+ }
830834 }
831835 if (esw -> offloads .inline_mode == MLX5_INLINE_MODE_NONE ) {
832836 if (mlx5_eswitch_inline_mode_get (esw ,
833837 num_vfs ,
834838 & esw -> offloads .inline_mode )) {
835839 esw -> offloads .inline_mode = MLX5_INLINE_MODE_L2 ;
836- esw_warn (esw -> dev , "Inline mode is different between vports\n" );
840+ NL_SET_ERR_MSG_MOD (extack ,
841+ "Inline mode is different between vports" );
837842 }
838843 }
839844 return err ;
@@ -982,10 +987,12 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw,
982987 mlx5_eswitch_disable_sriov (esw );
983988 err = mlx5_eswitch_enable_sriov (esw , num_vfs , SRIOV_LEGACY );
984989 if (err ) {
985- esw_warn ( esw -> dev , "Failed setting eswitch to legacy, err %d\n" , err );
990+ NL_SET_ERR_MSG_MOD ( extack , "Failed setting eswitch to legacy" );
986991 err1 = mlx5_eswitch_enable_sriov (esw , num_vfs , SRIOV_OFFLOADS );
987- if (err1 )
988- esw_warn (esw -> dev , "Failed setting eswitch back to offloads, err %d\n" , err );
992+ if (err1 ) {
993+ NL_SET_ERR_MSG_MOD (extack ,
994+ "Failed setting eswitch back to offloads" );
995+ }
989996 }
990997
991998 /* enable back PF RoCE */
@@ -1151,14 +1158,15 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode,
11511158 return 0 ;
11521159 /* fall through */
11531160 case MLX5_CAP_INLINE_MODE_L2 :
1154- esw_warn ( dev , "Inline mode can't be set\n " );
1161+ NL_SET_ERR_MSG_MOD ( extack , "Inline mode can't be set" );
11551162 return - EOPNOTSUPP ;
11561163 case MLX5_CAP_INLINE_MODE_VPORT_CONTEXT :
11571164 break ;
11581165 }
11591166
11601167 if (esw -> offloads .num_flows > 0 ) {
1161- esw_warn (dev , "Can't set inline mode when flows are configured\n" );
1168+ NL_SET_ERR_MSG_MOD (extack ,
1169+ "Can't set inline mode when flows are configured" );
11621170 return - EOPNOTSUPP ;
11631171 }
11641172
@@ -1169,8 +1177,8 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode,
11691177 for (vport = 1 ; vport < esw -> enabled_vports ; vport ++ ) {
11701178 err = mlx5_modify_nic_vport_min_inline (dev , vport , mlx5_mode );
11711179 if (err ) {
1172- esw_warn ( dev , "Failed to set min inline on vport %d\n" ,
1173- vport );
1180+ NL_SET_ERR_MSG_MOD ( extack ,
1181+ "Failed to set min inline on vport" );
11741182 goto revert_inline_mode ;
11751183 }
11761184 }
@@ -1264,7 +1272,8 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8 encap,
12641272 return 0 ;
12651273
12661274 if (esw -> offloads .num_flows > 0 ) {
1267- esw_warn (dev , "Can't set encapsulation when flows are configured\n" );
1275+ NL_SET_ERR_MSG_MOD (extack ,
1276+ "Can't set encapsulation when flows are configured" );
12681277 return - EOPNOTSUPP ;
12691278 }
12701279
@@ -1273,7 +1282,8 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8 encap,
12731282 esw -> offloads .encap = encap ;
12741283 err = esw_create_offloads_fast_fdb_table (esw );
12751284 if (err ) {
1276- esw_warn (esw -> dev , "Failed re-creating fast FDB table, err %d\n" , err );
1285+ NL_SET_ERR_MSG_MOD (extack ,
1286+ "Failed re-creating fast FDB table" );
12771287 esw -> offloads .encap = !encap ;
12781288 (void )esw_create_offloads_fast_fdb_table (esw );
12791289 }
0 commit comments