@@ -462,42 +462,39 @@ static int set_hca_ctrl(struct mlx5_core_dev *dev)
462462 return err ;
463463}
464464
465- static int mlx5_core_enable_hca (struct mlx5_core_dev * dev )
465+ int mlx5_core_enable_hca (struct mlx5_core_dev * dev , u16 func_id )
466466{
467+ u32 out [MLX5_ST_SZ_DW (enable_hca_out )];
468+ u32 in [MLX5_ST_SZ_DW (enable_hca_in )];
467469 int err ;
468- struct mlx5_enable_hca_mbox_in in ;
469- struct mlx5_enable_hca_mbox_out out ;
470470
471- memset (& in , 0 , sizeof (in ));
472- memset (& out , 0 , sizeof (out ));
473- in .hdr .opcode = cpu_to_be16 (MLX5_CMD_OP_ENABLE_HCA );
471+ memset (in , 0 , sizeof (in ));
472+ MLX5_SET (enable_hca_in , in , opcode , MLX5_CMD_OP_ENABLE_HCA );
473+ MLX5_SET (enable_hca_in , in , function_id , func_id );
474+ memset (out , 0 , sizeof (out ));
475+
474476 err = mlx5_cmd_exec (dev , & in , sizeof (in ), & out , sizeof (out ));
475477 if (err )
476478 return err ;
477479
478- if (out .hdr .status )
479- return mlx5_cmd_status_to_err (& out .hdr );
480-
481- return 0 ;
480+ return mlx5_cmd_status_to_err_v2 (out );
482481}
483482
484- static int mlx5_core_disable_hca (struct mlx5_core_dev * dev )
483+ int mlx5_core_disable_hca (struct mlx5_core_dev * dev , u16 func_id )
485484{
485+ u32 out [MLX5_ST_SZ_DW (disable_hca_out )];
486+ u32 in [MLX5_ST_SZ_DW (disable_hca_in )];
486487 int err ;
487- struct mlx5_disable_hca_mbox_in in ;
488- struct mlx5_disable_hca_mbox_out out ;
489488
490- memset (& in , 0 , sizeof (in ));
491- memset (& out , 0 , sizeof (out ));
492- in .hdr .opcode = cpu_to_be16 (MLX5_CMD_OP_DISABLE_HCA );
493- err = mlx5_cmd_exec (dev , & in , sizeof (in ), & out , sizeof (out ));
489+ memset (in , 0 , sizeof (in ));
490+ MLX5_SET (disable_hca_in , in , opcode , MLX5_CMD_OP_DISABLE_HCA );
491+ MLX5_SET (disable_hca_in , in , function_id , func_id );
492+ memset (out , 0 , sizeof (out ));
493+ err = mlx5_cmd_exec (dev , in , sizeof (in ), out , sizeof (out ));
494494 if (err )
495495 return err ;
496496
497- if (out .hdr .status )
498- return mlx5_cmd_status_to_err (& out .hdr );
499-
500- return 0 ;
497+ return mlx5_cmd_status_to_err_v2 (out );
501498}
502499
503500static int mlx5_irq_set_affinity_hint (struct mlx5_core_dev * mdev , int i )
@@ -942,7 +939,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
942939
943940 mlx5_pagealloc_init (dev );
944941
945- err = mlx5_core_enable_hca (dev );
942+ err = mlx5_core_enable_hca (dev , 0 );
946943 if (err ) {
947944 dev_err (& pdev -> dev , "enable hca failed\n" );
948945 goto err_pagealloc_cleanup ;
@@ -1106,7 +1103,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
11061103 mlx5_reclaim_startup_pages (dev );
11071104
11081105err_disable_hca :
1109- mlx5_core_disable_hca (dev );
1106+ mlx5_core_disable_hca (dev , 0 );
11101107
11111108err_pagealloc_cleanup :
11121109 mlx5_pagealloc_cleanup (dev );
@@ -1149,7 +1146,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
11491146 }
11501147 mlx5_pagealloc_stop (dev );
11511148 mlx5_reclaim_startup_pages (dev );
1152- mlx5_core_disable_hca (dev );
1149+ mlx5_core_disable_hca (dev , 0 );
11531150 mlx5_pagealloc_cleanup (dev );
11541151 mlx5_cmd_cleanup (dev );
11551152
0 commit comments