Many mlx5_cmd_exec() callers are not interested in the output from that command or have standard in/out structures. Those callers simply allocate those structure on the stack and use sizeof() to provide in/out arguments. In this naive approach provide simplified versions of mlx5_cmd_exec().
Unified · Split
| @@ -903,6 +903,19 @@ int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size, · 902 unmodified lines | |||
| 903 | 903 | ||
| 904 | int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, | 904 | int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, |
| 905 | int out_size); | 905 | int out_size); |
| 906 | |||
| 907 | #define mlx5_cmd_exec_inout(dev, ifc_cmd, in, out) \ | ||
| 908 | ({ \ | ||
| 909 | mlx5_cmd_exec(dev, in, MLX5_ST_SZ_BYTES(ifc_cmd##_in), out, \ | ||
| 910 | MLX5_ST_SZ_BYTES(ifc_cmd##_out)); \ | ||
| 911 | }) | ||
| 912 | |||
| 913 | #define mlx5_cmd_exec_in(dev, ifc_cmd, in) \ | ||
| 914 | ({ \ | ||
| 915 | u32 _out[MLX5_ST_SZ_DW(ifc_cmd##_out)] = {}; \ | ||
| 916 | mlx5_cmd_exec_inout(dev, ifc_cmd, in, _out); \ | ||
| 917 | }) | ||
| 918 | |||
| 906 | int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size, | 919 | int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size, |
| 907 | void *out, int out_size); | 920 | void *out, int out_size); |
| 908 | void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome); | 921 | void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome); |