Mass conversion to light mlx5 command interface
Subsystems (7)
cover Mass conversion to light mlx5 command interface
From: Leon Romanovsky <[email protected]>
Hi,
This is a followup to "net/mlx5: Provide simplified command interfaces" [1] patch with conversion of everything in mlx5_core.
The patch separation is done by file to simplify bisection and they are all similar, but of course, I can squash it to one mega patch if it is necessary.
Thanks
[1] https://lore.kernel.org/linux-rdma/[email protected]
Leon Romanovsky (24):
net/mlx5: Update vport.c to new cmd interface net/mlx5: Update cq.c to new cmd interface net/mlx5: Update debugfs.c to new cmd interface net/mlx5: Update ecpf.c to new cmd interface net/mlx5: Update eq.c to new cmd interface net/mlx5: Update statistics to new cmd interface net/mlx5: Update eswitch to new cmd interface net/mlx5: Update FPGA to new cmd interface net/mlx5: Update fs_core new cmd interface net/mlx5: Update fw.c new cmd interface net/mlx5: Update lag.c new cmd interface net/mlx5: Update gid.c new cmd interface net/mlx5: Update mpfs.c new cmd interface net/mlx5: Update vxlan.c new cmd interface net/mlx5: Update main.c new cmd interface net/mlx5: Update mcg.c new cmd interface net/mlx5: Update mr.c new cmd interface net/mlx5: Update pagealloc.c new cmd interface net/mlx5: Update pd.c new cmd interface net/mlx5: Update uar.c new cmd interface net/mlx5: Update rl.c new cmd interface net/mlx5: Update port.c new cmd interface net/mlx5: Update SW steering new cmd interface net/mlx5: Update transobj.c new cmd interface
drivers/infiniband/hw/mlx5/ib_virt.c | 2 +- drivers/infiniband/hw/mlx5/mad.c | 4 +- drivers/infiniband/hw/mlx5/qp.c | 32 ++-- drivers/net/ethernet/mellanox/mlx5/core/cq.c | 24 ++- .../net/ethernet/mellanox/mlx5/core/debugfs.c | 17 +-- .../net/ethernet/mellanox/mlx5/core/ecpf.c | 30 +--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 +- .../ethernet/mellanox/mlx5/core/en/health.c | 2 +- .../mellanox/mlx5/core/en/monitor_stats.c | 46 ++---- .../ethernet/mellanox/mlx5/core/en_common.c | 7 +- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 2 +- .../mellanox/mlx5/core/en_fs_ethtool.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 29 ++-- .../ethernet/mellanox/mlx5/core/en_stats.c | 17 +-- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 5 +- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 38 ++--- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 6 +- .../mellanox/mlx5/core/eswitch_offloads.c | 18 +-- .../ethernet/mellanox/mlx5/core/fpga/cmd.c | 28 ++-- .../net/ethernet/mellanox/mlx5/core/fs_cmd.c | 80 ++++------ drivers/net/ethernet/mellanox/mlx5/core/fw.c | 33 ++-- drivers/net/ethernet/mellanox/mlx5/core/lag.c | 52 +++---- .../net/ethernet/mellanox/mlx5/core/lib/gid.c | 5 +- .../ethernet/mellanox/mlx5/core/lib/mpfs.c | 10 +- .../ethernet/mellanox/mlx5/core/lib/vxlan.c | 10 +- .../net/ethernet/mellanox/mlx5/core/main.c | 35 ++--- drivers/net/ethernet/mellanox/mlx5/core/mcg.c | 10 +- drivers/net/ethernet/mellanox/mlx5/core/mr.c | 20 ++- .../ethernet/mellanox/mlx5/core/pagealloc.c | 13 +- drivers/net/ethernet/mellanox/mlx5/core/pd.c | 11 +- .../net/ethernet/mellanox/mlx5/core/port.c | 11 +- drivers/net/ethernet/mellanox/mlx5/core/rl.c | 21 ++- .../mellanox/mlx5/core/steering/dr_cmd.c | 33 ++-- .../ethernet/mellanox/mlx5/core/transobj.c | 113 +++++--------- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 11 +- .../net/ethernet/mellanox/mlx5/core/vport.c | 142 +++++++++--------- include/linux/mlx5/cq.h | 2 +- include/linux/mlx5/transobj.h | 19 +-- include/linux/mlx5/vport.h | 3 +- 40 files changed, 373 insertions(+), 582 deletions(-)
--
2.25.2
PATCH 1/24 net/mlx5: Update vport.c to new cmd interface
From: Leon Romanovsky <[email protected]>
Do mass update of vport.c to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- drivers/infiniband/hw/mlx5/ib_virt.c | 2 +- drivers/infiniband/hw/mlx5/mad.c | 4 +- .../net/ethernet/mellanox/mlx5/core/vport.c | 142 +++++++++--------- include/linux/mlx5/vport.h | 3 +- 4 files changed, 71 insertions(+), 80 deletions(-)
drivers/infiniband/hw/mlx5/ib_virt.c +1 -1
@@ -134,7 +134,7 @@ int mlx5_ib_get_vf_stats(struct ib_device *device, int vf,if (!out)return -ENOMEM ; - err =mlx5_core_query_vport_counter (mdev, true, vf, port, out, out_sz); + err =mlx5_core_query_vport_counter (mdev, true, vf, port, out);if (err) goto ex;
drivers/infiniband/hw/mlx5/mad.c +2 -2
@@ -187,8 +187,8 @@ static int process_pma_cmd(struct mlx5_ib_dev *dev, u8 port_num, goto done; } - err =mlx5_core_query_vport_counter (mdev,0 ,0 , - mdev_port_num, out_cnt, sz); + err =mlx5_core_query_vport_counter (mdev,0 ,0 , mdev_port_num, + out_cnt);if (!err)pma_cnt_ext_assign (pma_cnt_ext, out_cnt); }else {
drivers/net/ethernet/mellanox/mlx5/core/vport.c +67 -75
388 lines not on this page · raw message
include/linux/mlx5/vport.h +1 -2
@@ -127,8 +127,7 @@ int mlx5_query_vport_down_stats(struct mlx5_core_dev *mdev, u16 vport, u8 other_vport, u64 *rx_discard_vport_down, u64 *tx_discard_vport_down);int mlx5_core_query_vport_counter (struct mlx5_core_dev *dev,u8 other_vport, -int vf,u8 port_num,void *out, -size_t out_sz); +int vf,u8 port_num,void *out); int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev, u8 other_vport, u8 port_num, int vf,
Signature · 1 line
2.25.2
PATCH 2/24 net/mlx5: Update cq.c to new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of cq.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/cq.c | 24 +++++++------------ .../net/ethernet/mellanox/mlx5/core/debugfs.c | 2 +- .../ethernet/mellanox/mlx5/core/en/health.c | 2 +- include/linux/mlx5/cq.h | 2 +- 4 files changed, 12 insertions(+), 18 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cq.c +9 -15
@@ -90,8 +90,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, u32 *in, int inlen, u32 *out, int outlen) { int eqn = MLX5_GET(cqc, MLX5_ADDR_OF(create_cq_in, in, cq_context), c_eqn); -u32 dout[MLX5_ST_SZ_DW (destroy_cq_out)]; -u32 din[MLX5_ST_SZ_DW (destroy_cq_in)]; +u32 din[MLX5_ST_SZ_DW (destroy_cq_in)] = {};struct mlx5_eq_comp *eq;int err;
@@ -141,20 +140,17 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, err_cq_add:mlx5_eq_del_cq (&eq->core, cq); err_cmd: -memset (din,0 ,sizeof (din)); -memset (dout,0 ,sizeof (dout));MLX5_SET (destroy_cq_in, din, opcode,MLX5_CMD_OP_DESTROY_CQ );MLX5_SET (destroy_cq_in, din, cqn, cq->cqn);MLX5_SET (destroy_cq_in, din, uid, cq->uid); -mlx5_cmd_exec (dev, din,sizeof (din), dout,sizeof (dout)); +mlx5_cmd_exec_in (dev, destroy_cq, din);return err; }EXPORT_SYMBOL (mlx5_core_create_cq);int mlx5_core_destroy_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq) { -u32 out[MLX5_ST_SZ_DW (destroy_cq_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (destroy_cq_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (destroy_cq_in)] = {};int err;mlx5_eq_del_cq (mlx5_get_async_eq (dev), cq);
@@ -163,7 +159,7 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq)MLX5_SET (destroy_cq_in, in, opcode,MLX5_CMD_OP_DESTROY_CQ );MLX5_SET (destroy_cq_in, in, cqn, cq->cqn);MLX5_SET (destroy_cq_in, in, uid, cq->uid); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_in (dev, destroy_cq, in);if (err)return err;
@@ -178,24 +174,22 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq)EXPORT_SYMBOL (mlx5_core_destroy_cq);int mlx5_core_query_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq, -u32 *out,int outlen) +u32 *out) { -u32 in[MLX5_ST_SZ_DW (query_cq_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (query_cq_in)] = {};MLX5_SET (query_cq_in, in, opcode,MLX5_CMD_OP_QUERY_CQ );MLX5_SET (query_cq_in, in, cqn, cq->cqn); -return mlx5_cmd_exec (dev, in,sizeof (in), out, outlen); +return mlx5_cmd_exec_inout (dev, query_cq, in, out); }EXPORT_SYMBOL (mlx5_core_query_cq);int mlx5_core_modify_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq,u32 *in,int inlen) { -u32 out[MLX5_ST_SZ_DW (modify_cq_out)] = {0 }; -MLX5_SET (modify_cq_in, in, opcode,MLX5_CMD_OP_MODIFY_CQ );MLX5_SET (modify_cq_in, in, uid, cq->uid); -return mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); +return mlx5_cmd_exec_in (dev, modify_cq, in); }EXPORT_SYMBOL (mlx5_core_modify_cq);
@@ -204,7 +198,7 @@ int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev, u16 cq_period, u16 cq_max_count) { -u32 in[MLX5_ST_SZ_DW (modify_cq_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (modify_cq_in)] = {};void *cqc;MLX5_SET (modify_cq_in, in, cqn, cq->cqn);
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +1 -1
@@ -333,7 +333,7 @@ static u64 cq_read_field(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,if (!out)return param; - err =mlx5_core_query_cq (dev, cq, out, outlen); + err =mlx5_core_query_cq (dev, cq, out);if (err) {mlx5_core_warn (dev,"failed to query cq\n" ); goto out;
drivers/net/ethernet/mellanox/mlx5/core/en/health.c +1 -1
@@ -43,7 +43,7 @@ int mlx5e_reporter_cq_diagnose(struct mlx5e_cq *cq, struct devlink_fmsg *fmsg)void *cqc;int err; - err =mlx5_core_query_cq (priv->mdev, &cq->mcq, out,sizeof (out)); + err =mlx5_core_query_cq (priv->mdev, &cq->mcq, out);if (err)return err;
include/linux/mlx5/cq.h +1 -1
@@ -188,7 +188,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, u32 *in, int inlen, u32 *out, int outlen);int mlx5_core_destroy_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq);int mlx5_core_query_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq, -u32 *out,int outlen); +u32 *out);int mlx5_core_modify_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq,u32 *in,int inlen); int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev,
Signature · 1 line
2.25.2
PATCH 4/24 net/mlx5: Update ecpf.c to new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of ecpf.c to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- .../net/ethernet/mellanox/mlx5/core/ecpf.c | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/ecpf.c +6 -24
@@ -8,33 +8,13 @@ bool mlx5_read_embedded_cpu(struct mlx5_core_dev *dev)return (ioread32be (&dev->iseg->initializing) >>MLX5_ECPU_BIT_NUM ) &1 ; } -static int mlx5_peer_pf_enable_hca (struct mlx5_core_dev *dev) -{ -u32 out[MLX5_ST_SZ_DW (enable_hca_out)] = {}; -u32 in[MLX5_ST_SZ_DW (enable_hca_in)] = {}; - -MLX5_SET (enable_hca_in, in, opcode,MLX5_CMD_OP_ENABLE_HCA ); -MLX5_SET (enable_hca_in, in, function_id,0 ); -MLX5_SET (enable_hca_in, in, embedded_cpu_function,0 ); -return mlx5_cmd_exec (dev, &in,sizeof (in), &out,sizeof (out)); -} - -static int mlx5_peer_pf_disable_hca (struct mlx5_core_dev *dev) -{ -u32 out[MLX5_ST_SZ_DW (disable_hca_out)] = {}; -u32 in[MLX5_ST_SZ_DW (disable_hca_in)] = {}; - -MLX5_SET (disable_hca_in, in, opcode,MLX5_CMD_OP_DISABLE_HCA ); -MLX5_SET (disable_hca_in, in, function_id,0 ); -MLX5_SET (disable_hca_in, in, embedded_cpu_function,0 ); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); -} -static int mlx5_peer_pf_init (struct mlx5_core_dev *dev) { +u32 in[MLX5_ST_SZ_DW (enable_hca_in)] = {};int err; - err =mlx5_peer_pf_enable_hca (dev); +MLX5_SET (enable_hca_in, in, opcode,MLX5_CMD_OP_ENABLE_HCA ); + err =mlx5_cmd_exec_in (dev, enable_hca, in);if (err)mlx5_core_err (dev,"Failed to enable peer PF HCA err(%d)\n" , err);
@@ -44,9 +24,11 @@ static int mlx5_peer_pf_init(struct mlx5_core_dev *dev)static void mlx5_peer_pf_cleanup (struct mlx5_core_dev *dev) { +u32 in[MLX5_ST_SZ_DW (disable_hca_in)] = {};int err; - err =mlx5_peer_pf_disable_hca (dev); +MLX5_SET (disable_hca_in, in, opcode,MLX5_CMD_OP_DISABLE_HCA ); + err =mlx5_cmd_exec_in (dev, disable_hca, in);if (err) {mlx5_core_err (dev,"Failed to disable peer PF HCA err(%d)\n" , err);
Signature · 1 line
2.25.2
PATCH 5/24 net/mlx5: Update eq.c to new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of eq.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eq.c +2 -3
@@ -101,12 +101,11 @@ struct mlx5_eq_table {static int mlx5_cmd_destroy_eq (struct mlx5_core_dev *dev,u8 eqn) { -u32 out[MLX5_ST_SZ_DW (destroy_eq_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (destroy_eq_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (destroy_eq_in)] = {};MLX5_SET (destroy_eq_in, in, opcode,MLX5_CMD_OP_DESTROY_EQ );MLX5_SET (destroy_eq_in, in, eq_number, eqn); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, destroy_eq, in); }/* caller must eventually call mlx5_cq_put on the returned cq */
Signature · 1 line
2.25.2
PATCH 6/24 net/mlx5: Update statistics to new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of statistics to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- .../mellanox/mlx5/core/en/monitor_stats.c | 46 ++++++------------- .../ethernet/mellanox/mlx5/core/en_stats.c | 17 ++----- 2 files changed, 19 insertions(+), 44 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/monitor_stats.c +14 -32
@@ -38,12 +38,11 @@ int mlx5e_monitor_counter_supported(struct mlx5e_priv *priv)void mlx5e_monitor_counter_arm (struct mlx5e_priv *priv) { -u32 in[MLX5_ST_SZ_DW (arm_monitor_counter_in)] = {}; -u32 out[MLX5_ST_SZ_DW (arm_monitor_counter_out)] = {}; +u32 in[MLX5_ST_SZ_DW (arm_monitor_counter_in)] = {};MLX5_SET (arm_monitor_counter_in, in, opcode,MLX5_CMD_OP_ARM_MONITOR_COUNTER ); -mlx5_cmd_exec (priv->mdev, in,sizeof (in), out,sizeof (out)); +mlx5_cmd_exec_in (priv->mdev, arm_monitor_counter, in); }static void mlx5e_monitor_counters_work (struct work_struct *work)
@@ -66,19 +65,6 @@ static int mlx5e_monitor_event_handler(struct notifier_block *nb,return NOTIFY_OK ; } -static void mlx5e_monitor_counter_start (struct mlx5e_priv *priv) -{ -MLX5_NB_INIT (&priv->monitor_counters_nb, mlx5e_monitor_event_handler, -MONITOR_COUNTER ); -mlx5_eq_notifier_register (priv->mdev, &priv->monitor_counters_nb); -} - -static void mlx5e_monitor_counter_stop (struct mlx5e_priv *priv) -{ -mlx5_eq_notifier_unregister (priv->mdev, &priv->monitor_counters_nb); -cancel_work_sync (&priv->monitor_counters_work); -} -static int fill_monitor_counter_ppcnt_set1 (int cnt,u32 *in) {enum mlx5_monitor_counter_ppcnt ppcnt_cnt;
@@ -118,8 +104,7 @@ static void mlx5e_set_monitor_counter(struct mlx5e_priv *priv)int num_q_counters =MLX5_CAP_GEN (mdev, num_q_monitor_counters);int num_ppcnt_counters = !MLX5_CAP_PCAM_REG (mdev, ppcnt) ?0 :MLX5_CAP_GEN (mdev, num_ppcnt_monitor_counters); -u32 in[MLX5_ST_SZ_DW (set_monitor_counter_in)] = {}; -u32 out[MLX5_ST_SZ_DW (set_monitor_counter_out)] = {}; +u32 in[MLX5_ST_SZ_DW (set_monitor_counter_in)] = {};int q_counter = priv->q_counter;int cnt =0 ;
@@ -136,34 +121,31 @@ static void mlx5e_set_monitor_counter(struct mlx5e_priv *priv)MLX5_SET (set_monitor_counter_in, in, opcode,MLX5_CMD_OP_SET_MONITOR_COUNTER ); -mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); +mlx5_cmd_exec_in (mdev, set_monitor_counter, in); }/* check if mlx5e_monitor_counter_supported before calling this function*/ void mlx5e_monitor_counter_init (struct mlx5e_priv *priv) {INIT_WORK (&priv->monitor_counters_work, mlx5e_monitor_counters_work); -mlx5e_monitor_counter_start (priv); +MLX5_NB_INIT (&priv->monitor_counters_nb, mlx5e_monitor_event_handler, +MONITOR_COUNTER ); +mlx5_eq_notifier_register (priv->mdev, &priv->monitor_counters_nb); +mlx5e_set_monitor_counter (priv);mlx5e_monitor_counter_arm (priv);queue_work (priv->wq, &priv->update_stats_work); } -static void mlx5e_monitor_counter_disable (struct mlx5e_priv *priv) +/* check if mlx5e_monitor_counter_supported before calling this function*/ +void mlx5e_monitor_counter_cleanup (struct mlx5e_priv *priv) { -u32 in[MLX5_ST_SZ_DW (set_monitor_counter_in)] = {}; -u32 out[MLX5_ST_SZ_DW (set_monitor_counter_out)] = {}; +u32 in[MLX5_ST_SZ_DW (set_monitor_counter_in)] = {}; -MLX5_SET (set_monitor_counter_in, in, num_of_counters,0 );MLX5_SET (set_monitor_counter_in, in, opcode,MLX5_CMD_OP_SET_MONITOR_COUNTER ); -mlx5_cmd_exec (priv->mdev, in,sizeof (in), out,sizeof (out)); -} - -/* check if mlx5e_monitor_counter_supported before calling this function*/ -void mlx5e_monitor_counter_cleanup (struct mlx5e_priv *priv) -{ -mlx5e_monitor_counter_disable (priv); -mlx5e_monitor_counter_stop (priv); +mlx5_cmd_exec_in (priv->mdev, set_monitor_counter, in); +mlx5_eq_notifier_unregister (priv->mdev, &priv->monitor_counters_nb); +cancel_work_sync (&priv->monitor_counters_work); }
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +5 -12
@@ -491,18 +491,14 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(vnic_env)static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS (vnic_env) {u32 *out = (u32 *)priv->stats.vnic.query_vnic_env_out; -int outlen =MLX5_ST_SZ_BYTES (query_vnic_env_out); -u32 in[MLX5_ST_SZ_DW (query_vnic_env_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (query_vnic_env_in)] = {};struct mlx5_core_dev *mdev = priv->mdev;if (!MLX5_CAP_GEN (priv->mdev, nic_receive_steering_discard))return ; -MLX5_SET (query_vnic_env_in, in, opcode, -MLX5_CMD_OP_QUERY_VNIC_ENV ); -MLX5_SET (query_vnic_env_in, in, op_mod,0 ); -MLX5_SET (query_vnic_env_in, in, other_vport,0 ); -mlx5_cmd_exec (mdev, in,sizeof (in), out, outlen); +MLX5_SET (query_vnic_env_in, in, opcode,MLX5_CMD_OP_QUERY_VNIC_ENV ); +mlx5_cmd_exec_inout (mdev, query_vnic_env, in, out); }#define VPORT_COUNTER_OFF (c) MLX5_BYTE_OFF(query_vport_counter_out, c)
@@ -577,15 +573,12 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(vport)static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS (vport) { -int outlen =MLX5_ST_SZ_BYTES (query_vport_counter_out);u32 *out = (u32 *)priv->stats.vport.query_vport_out; -u32 in[MLX5_ST_SZ_DW (query_vport_counter_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (query_vport_counter_in)] = {};struct mlx5_core_dev *mdev = priv->mdev;MLX5_SET (query_vport_counter_in, in, opcode,MLX5_CMD_OP_QUERY_VPORT_COUNTER ); -MLX5_SET (query_vport_counter_in, in, op_mod,0 ); -MLX5_SET (query_vport_counter_in, in, other_vport,0 ); -mlx5_cmd_exec (mdev, in,sizeof (in), out, outlen); +mlx5_cmd_exec_inout (mdev, query_vport_counter, in, out); }#define PPORT_802_3_OFF (c) \
Signature · 1 line
2.25.2
PATCH 7/24 net/mlx5: Update eswitch to new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of eswitch to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 38 +++++-------------- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 6 +-- .../mellanox/mlx5/core/eswitch_offloads.c | 18 ++++----- 3 files changed, 20 insertions(+), 42 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +10 -28
@@ -84,8 +84,7 @@ mlx5_eswitch_get_vport(struct mlx5_eswitch *esw, u16 vport_num)static int arm_vport_context_events_cmd (struct mlx5_core_dev *dev,u16 vport,u32 events_mask) { -int in[MLX5_ST_SZ_DW (modify_nic_vport_context_in)] = {0 }; -int out[MLX5_ST_SZ_DW (modify_nic_vport_context_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (modify_nic_vport_context_in)] = {};void *nic_vport_ctx; MLX5_SET(modify_nic_vport_context_in, in,
@@ -108,40 +107,24 @@ static int arm_vport_context_events_cmd(struct mlx5_core_dev *dev, u16 vport,MLX5_SET (nic_vport_context, nic_vport_ctx, event_on_promisc_change,1 ); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, modify_nic_vport_context, in); }/* E-Switch vport context HW commands */ int mlx5_eswitch_modify_esw_vport_context (struct mlx5_core_dev *dev,u16 vport, -bool other_vport, -void *in,int inlen) +bool other_vport,void *in) { -u32 out[MLX5_ST_SZ_DW (modify_esw_vport_context_out)] = {0 }; -MLX5_SET (modify_esw_vport_context_in, in, opcode,MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT );MLX5_SET (modify_esw_vport_context_in, in, vport_number, vport);MLX5_SET (modify_esw_vport_context_in, in, other_vport, other_vport); -return mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); -} - -int mlx5_eswitch_query_esw_vport_context (struct mlx5_core_dev *dev,u16 vport, -bool other_vport, -void *out,int outlen) -{ -u32 in[MLX5_ST_SZ_DW (query_esw_vport_context_in)] = {}; - -MLX5_SET (query_esw_vport_context_in, in, opcode, -MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT ); -MLX5_SET (modify_esw_vport_context_in, in, vport_number, vport); -MLX5_SET (modify_esw_vport_context_in, in, other_vport, other_vport); -return mlx5_cmd_exec (dev, in,sizeof (in), out, outlen); +return mlx5_cmd_exec_in (dev, modify_esw_vport_context, in); }static int modify_esw_vport_cvlan (struct mlx5_core_dev *dev,u16 vport,u16 vlan,u8 qos,u8 set_flags) { -u32 in[MLX5_ST_SZ_DW (modify_esw_vport_context_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (modify_esw_vport_context_in)] = {};if (!MLX5_CAP_ESW (dev, vport_cvlan_strip) || !MLX5_CAP_ESW (dev, vport_cvlan_insert_if_not_exist))
@@ -170,8 +153,7 @@ static int modify_esw_vport_cvlan(struct mlx5_core_dev *dev, u16 vport,MLX5_SET (modify_esw_vport_context_in, in, field_select.vport_cvlan_insert,1 ); -return mlx5_eswitch_modify_esw_vport_context (dev, vport, true, - in,sizeof (in)); +return mlx5_eswitch_modify_esw_vport_context (dev, vport, true, in); }/* E-Switch FDB */
@@ -1901,7 +1883,7 @@ const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev)MLX5_SET (query_esw_functions_in, in, opcode,MLX5_CMD_OP_QUERY_ESW_FUNCTIONS ); - err =mlx5_cmd_exec (dev, in,sizeof (in), out, outlen); + err =mlx5_cmd_exec_inout (dev, query_esw_functions, in, out);if (!err)return out;
@@ -2783,8 +2765,8 @@ int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw, {struct mlx5_vport *vport =mlx5_eswitch_get_vport (esw, vport_num);int outlen =MLX5_ST_SZ_BYTES (query_vport_counter_out); -u32 in[MLX5_ST_SZ_DW (query_vport_counter_in)] = {0 }; -struct mlx5_vport_drop_stats stats = {0 }; +u32 in[MLX5_ST_SZ_DW (query_vport_counter_in)] = {}; +struct mlx5_vport_drop_stats stats = {};int err =0 ;u32 *out;
@@ -2801,7 +2783,7 @@ int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,MLX5_SET (query_vport_counter_in, in, vport_number, vport->vport);MLX5_SET (query_vport_counter_in, in, other_vport,1 ); - err =mlx5_cmd_exec (esw->dev, in,sizeof (in), out, outlen); + err =mlx5_cmd_exec_inout (esw->dev, query_vport_counter, in, out);if (err) goto free_out;
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +1 -5
@@ -329,11 +329,7 @@ int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,void mlx5_eswitch_del_send_to_vport_rule (struct mlx5_flow_handle *rule);int mlx5_eswitch_modify_esw_vport_context (struct mlx5_core_dev *dev,u16 vport, -bool other_vport, -void *in,int inlen); -int mlx5_eswitch_query_esw_vport_context (struct mlx5_core_dev *dev,u16 vport, -bool other_vport, -void *out,int outlen); +bool other_vport,void *in);struct mlx5_flow_spec ;struct mlx5_esw_flow_attr ;
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +9 -9
@@ -790,7 +790,8 @@ static bool mlx5_eswitch_reg_c1_loopback_supported(struct mlx5_eswitch *esw)static int esw_set_passing_vport_metadata (struct mlx5_eswitch *esw,bool enable) {u32 out[MLX5_ST_SZ_DW (query_esw_vport_context_out)] = {}; -u32 in[MLX5_ST_SZ_DW (modify_esw_vport_context_in)] = {}; +u32 min[MLX5_ST_SZ_DW (modify_esw_vport_context_in)] = {}; +u32 in[MLX5_ST_SZ_DW (query_esw_vport_context_in)] = {};u8 curr, wanted;int err;
@@ -798,8 +799,9 @@ static int esw_set_passing_vport_metadata(struct mlx5_eswitch *esw, bool enable) !mlx5_eswitch_vport_match_metadata_enabled(esw))return 0 ; - err =mlx5_eswitch_query_esw_vport_context (esw->dev,0 , false, - out,sizeof (out)); +MLX5_SET (query_esw_vport_context_in, in, opcode, +MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT ); + err =mlx5_cmd_exec_inout (esw->dev, query_esw_vport_context, in, out);if (err)return err;
@@ -814,14 +816,12 @@ static int esw_set_passing_vport_metadata(struct mlx5_eswitch *esw, bool enable)else curr &= ~wanted; -MLX5_SET (modify_esw_vport_context_in, in, +MLX5_SET (modify_esw_vport_context_in, min, esw_vport_context.fdb_to_vport_reg_c_id, curr); - -MLX5_SET (modify_esw_vport_context_in, in, +MLX5_SET (modify_esw_vport_context_in, min, field_select.fdb_to_vport_reg_c_id,1 ); - err =mlx5_eswitch_modify_esw_vport_context (esw->dev,0 , false, in, -sizeof (in)); + err =mlx5_eswitch_modify_esw_vport_context (esw->dev,0 , false, min);if (!err) {if (enable && (curr &MLX5_FDB_TO_VPORT_REG_C_1 )) esw->flags |=MLX5_ESWITCH_REG_C1_LOOPBACK_ENABLED ;
@@ -1474,7 +1474,7 @@ static int mlx5_eswitch_inline_mode_get(const struct mlx5_eswitch *esw, u8 *mode out: *mode = mlx5_mode;return 0 ; -} +}static void esw_destroy_restore_table (struct mlx5_eswitch *esw) {
Signature · 1 line
2.25.2
PATCH 8/24 net/mlx5: Update FPGA to new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of FPGA to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- .../ethernet/mellanox/mlx5/core/fpga/cmd.c | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.c +13 -15
@@ -142,15 +142,15 @@ int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query)int mlx5_fpga_create_qp (struct mlx5_core_dev *dev,void *fpga_qpc,u32 *fpga_qpn) { -u32 in[MLX5_ST_SZ_DW (fpga_create_qp_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (fpga_create_qp_out)]; +u32 out[MLX5_ST_SZ_DW (fpga_create_qp_out)] = {}; +u32 in[MLX5_ST_SZ_DW (fpga_create_qp_in)] = {};int ret;MLX5_SET (fpga_create_qp_in, in, opcode,MLX5_CMD_OP_FPGA_CREATE_QP );memcpy (MLX5_ADDR_OF (fpga_create_qp_in, in, fpga_qpc), fpga_qpc,MLX5_FLD_SZ_BYTES (fpga_create_qp_in, fpga_qpc)); - ret =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + ret =mlx5_cmd_exec_inout (dev, fpga_create_qp, in, out);if (ret)return ret;
@@ -164,8 +164,7 @@ int mlx5_fpga_modify_qp(struct mlx5_core_dev *dev, u32 fpga_qpn,enum mlx5_fpga_qpc_field_select fields, void *fpga_qpc) { - u32 in[MLX5_ST_SZ_DW(fpga_modify_qp_in)] = {0}; -u32 out[MLX5_ST_SZ_DW (fpga_modify_qp_out)]; + u32 in[MLX5_ST_SZ_DW(fpga_modify_qp_in)] = {};MLX5_SET (fpga_modify_qp_in, in, opcode,MLX5_CMD_OP_FPGA_MODIFY_QP );MLX5_SET (fpga_modify_qp_in, in, field_select, fields);
@@ -173,20 +172,20 @@ int mlx5_fpga_modify_qp(struct mlx5_core_dev *dev, u32 fpga_qpn,memcpy (MLX5_ADDR_OF (fpga_modify_qp_in, in, fpga_qpc), fpga_qpc,MLX5_FLD_SZ_BYTES (fpga_modify_qp_in, fpga_qpc)); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, fpga_modify_qp, in); }int mlx5_fpga_query_qp (struct mlx5_core_dev *dev,u32 fpga_qpn,void *fpga_qpc) { -u32 in[MLX5_ST_SZ_DW (fpga_query_qp_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (fpga_query_qp_out)]; +u32 out[MLX5_ST_SZ_DW (fpga_query_qp_out)] = {}; +u32 in[MLX5_ST_SZ_DW (fpga_query_qp_in)] = {};int ret;MLX5_SET (fpga_query_qp_in, in, opcode,MLX5_CMD_OP_FPGA_QUERY_QP );MLX5_SET (fpga_query_qp_in, in, fpga_qpn, fpga_qpn); - ret =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + ret =mlx5_cmd_exec_inout (dev, fpga_query_qp, in, out);if (ret)return ret;
@@ -197,20 +196,19 @@ int mlx5_fpga_query_qp(struct mlx5_core_dev *dev,int mlx5_fpga_destroy_qp (struct mlx5_core_dev *dev,u32 fpga_qpn) { -u32 in[MLX5_ST_SZ_DW (fpga_destroy_qp_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (fpga_destroy_qp_out)]; +u32 in[MLX5_ST_SZ_DW (fpga_destroy_qp_in)] = {};MLX5_SET (fpga_destroy_qp_in, in, opcode,MLX5_CMD_OP_FPGA_DESTROY_QP );MLX5_SET (fpga_destroy_qp_in, in, fpga_qpn, fpga_qpn); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, fpga_destroy_qp, in); }int mlx5_fpga_query_qp_counters (struct mlx5_core_dev *dev,u32 fpga_qpn,bool clear,struct mlx5_fpga_qp_counters *data) { -u32 in[MLX5_ST_SZ_DW (fpga_query_qp_counters_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (fpga_query_qp_counters_out)]; +u32 out[MLX5_ST_SZ_DW (fpga_query_qp_counters_out)] = {}; +u32 in[MLX5_ST_SZ_DW (fpga_query_qp_counters_in)] = {};int ret; MLX5_SET(fpga_query_qp_counters_in, in, opcode,
@@ -218,7 +216,7 @@ int mlx5_fpga_query_qp_counters(struct mlx5_core_dev *dev, u32 fpga_qpn,MLX5_SET (fpga_query_qp_counters_in, in, clear, clear);MLX5_SET (fpga_query_qp_counters_in, in, fpga_qpn, fpga_qpn); - ret =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + ret =mlx5_cmd_exec_inout (dev, fpga_query_qp_counters, in, out);if (ret)return ret;
Signature · 1 line
2.25.2
PATCH 3/24 net/mlx5: Update debugfs.c to new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of debugfs.c to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +4 -11
@@ -273,20 +273,11 @@ static u64 qp_read_field(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp,return param; } -static int mlx5_core_eq_query (struct mlx5_core_dev *dev,struct mlx5_eq *eq, -u32 *out,int outlen) -{ -u32 in[MLX5_ST_SZ_DW (query_eq_in)] = {}; - -MLX5_SET (query_eq_in, in, opcode,MLX5_CMD_OP_QUERY_EQ ); -MLX5_SET (query_eq_in, in, eq_number, eq->eqn); -return mlx5_cmd_exec (dev, in,sizeof (in), out, outlen); -} -static u64 eq_read_field (struct mlx5_core_dev *dev,struct mlx5_eq *eq,int index) {int outlen =MLX5_ST_SZ_BYTES (query_eq_out); +u32 in[MLX5_ST_SZ_DW (query_eq_in)] = {};u64 param =0 ;void *ctx;u32 *out;
@@ -296,7 +287,9 @@ static u64 eq_read_field(struct mlx5_core_dev *dev, struct mlx5_eq *eq,if (!out)return param; - err =mlx5_core_eq_query (dev, eq, out, outlen); +MLX5_SET (query_eq_in, in, opcode,MLX5_CMD_OP_QUERY_EQ ); +MLX5_SET (query_eq_in, in, eq_number, eq->eqn); + err =mlx5_cmd_exec_inout (dev, query_eq, in, out);if (err) {mlx5_core_warn (dev,"failed to query eq\n" ); goto out;
Signature · 1 line
2.25.2
PATCH 10/24 net/mlx5: Update fw.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of fw.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/fw.c | 33 ++++++++------------ 1 file changed, 13 insertions(+), 20 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fw.c +13 -20
@@ -67,26 +67,19 @@ enum { MCQI_FW_STORED_VERSION = 1, }; -static int mlx5_cmd_query_adapter (struct mlx5_core_dev *dev,u32 *out, -int outlen) -{ -u32 in[MLX5_ST_SZ_DW (query_adapter_in)] = {0 }; - -MLX5_SET (query_adapter_in, in, opcode,MLX5_CMD_OP_QUERY_ADAPTER ); -return mlx5_cmd_exec (dev, in,sizeof (in), out, outlen); -} -int mlx5_query_board_id (struct mlx5_core_dev *dev) {u32 *out;int outlen =MLX5_ST_SZ_BYTES (query_adapter_out); +u32 in[MLX5_ST_SZ_DW (query_adapter_in)] = {};int err; out =kzalloc (outlen,GFP_KERNEL );if (!out)return -ENOMEM ; - err =mlx5_cmd_query_adapter (dev, out, outlen); +MLX5_SET (query_adapter_in, in, opcode,MLX5_CMD_OP_QUERY_ADAPTER ); + err =mlx5_cmd_exec_inout (dev, query_adapter, in, out);if (err) goto out;
@@ -105,13 +98,15 @@ int mlx5_core_query_vendor_id(struct mlx5_core_dev *mdev, u32 *vendor_id) {u32 *out;int outlen =MLX5_ST_SZ_BYTES (query_adapter_out); +u32 in[MLX5_ST_SZ_DW (query_adapter_in)] = {};int err; out =kzalloc (outlen,GFP_KERNEL );if (!out)return -ENOMEM ; - err =mlx5_cmd_query_adapter (mdev, out, outlen); +MLX5_SET (query_adapter_in, in, opcode,MLX5_CMD_OP_QUERY_ADAPTER ); + err =mlx5_cmd_exec_inout (mdev, query_adapter, in, out);if (err) goto out;
@@ -259,8 +254,7 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev)int mlx5_cmd_init_hca (struct mlx5_core_dev *dev,uint32_t *sw_owner_id) { -u32 out[MLX5_ST_SZ_DW (init_hca_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (init_hca_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (init_hca_in)] = {};int i;MLX5_SET (init_hca_in, in, opcode,MLX5_CMD_OP_INIT_HCA );
@@ -271,16 +265,15 @@ int mlx5_cmd_init_hca(struct mlx5_core_dev *dev, uint32_t *sw_owner_id) sw_owner_id[i]); } -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, init_hca, in); }int mlx5_cmd_teardown_hca (struct mlx5_core_dev *dev) { -u32 out[MLX5_ST_SZ_DW (teardown_hca_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (teardown_hca_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (teardown_hca_in)] = {};MLX5_SET (teardown_hca_in, in, opcode,MLX5_CMD_OP_TEARDOWN_HCA ); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, teardown_hca, in); }int mlx5_cmd_force_teardown_hca (struct mlx5_core_dev *dev)
@@ -315,8 +308,8 @@ int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev)int mlx5_cmd_fast_teardown_hca (struct mlx5_core_dev *dev) {unsigned long end, delay_ms =MLX5_FAST_TEARDOWN_WAIT_MS ; -u32 out[MLX5_ST_SZ_DW (teardown_hca_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (teardown_hca_in)] = {0 }; +u32 out[MLX5_ST_SZ_DW (teardown_hca_out)] = {}; +u32 in[MLX5_ST_SZ_DW (teardown_hca_in)] = {};int state;int ret;
@@ -329,7 +322,7 @@ int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev)MLX5_SET (teardown_hca_in, in, profile,MLX5_TEARDOWN_HCA_IN_PROFILE_PREPARE_FAST_TEARDOWN ); - ret =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + ret =mlx5_cmd_exec_inout (dev, teardown_hca, in, out);if (ret)return ret;
Signature · 1 line
2.25.2
PATCH 11/24 net/mlx5: Update lag.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of lag.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/lag.c | 52 ++++++------------- 1 file changed, 17 insertions(+), 35 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag.c +17 -35
@@ -47,8 +47,7 @@ static DEFINE_SPINLOCK(lag_lock);static int mlx5_cmd_create_lag (struct mlx5_core_dev *dev,u8 remap_port1,u8 remap_port2) { -u32 in[MLX5_ST_SZ_DW (create_lag_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (create_lag_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (create_lag_in)] = {};void *lag_ctx =MLX5_ADDR_OF (create_lag_in, in, ctx);MLX5_SET (create_lag_in, in, opcode,MLX5_CMD_OP_CREATE_LAG );
@@ -56,14 +55,13 @@ static int mlx5_cmd_create_lag(struct mlx5_core_dev *dev, u8 remap_port1,MLX5_SET (lagc, lag_ctx, tx_remap_affinity_1, remap_port1);MLX5_SET (lagc, lag_ctx, tx_remap_affinity_2, remap_port2); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, create_lag, in); }static int mlx5_cmd_modify_lag (struct mlx5_core_dev *dev,u8 remap_port1,u8 remap_port2) { -u32 in[MLX5_ST_SZ_DW (modify_lag_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (modify_lag_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (modify_lag_in)] = {};void *lag_ctx =MLX5_ADDR_OF (modify_lag_in, in, ctx);MLX5_SET (modify_lag_in, in, opcode,MLX5_CMD_OP_MODIFY_LAG );
@@ -72,52 +70,29 @@ static int mlx5_cmd_modify_lag(struct mlx5_core_dev *dev, u8 remap_port1,MLX5_SET (lagc, lag_ctx, tx_remap_affinity_1, remap_port1);MLX5_SET (lagc, lag_ctx, tx_remap_affinity_2, remap_port2); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); -} - -static int mlx5_cmd_destroy_lag (struct mlx5_core_dev *dev) -{ -u32 in[MLX5_ST_SZ_DW (destroy_lag_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (destroy_lag_out)] = {0 }; - -MLX5_SET (destroy_lag_in, in, opcode,MLX5_CMD_OP_DESTROY_LAG ); - -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, modify_lag, in); }int mlx5_cmd_create_vport_lag (struct mlx5_core_dev *dev) { -u32 in[MLX5_ST_SZ_DW (create_vport_lag_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (create_vport_lag_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (create_vport_lag_in)] = {};MLX5_SET (create_vport_lag_in, in, opcode,MLX5_CMD_OP_CREATE_VPORT_LAG ); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, create_vport_lag, in); }EXPORT_SYMBOL (mlx5_cmd_create_vport_lag);int mlx5_cmd_destroy_vport_lag (struct mlx5_core_dev *dev) { -u32 in[MLX5_ST_SZ_DW (destroy_vport_lag_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (destroy_vport_lag_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (destroy_vport_lag_in)] = {};MLX5_SET (destroy_vport_lag_in, in, opcode,MLX5_CMD_OP_DESTROY_VPORT_LAG ); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, destroy_vport_lag, in); }EXPORT_SYMBOL (mlx5_cmd_destroy_vport_lag); -static int mlx5_cmd_query_cong_counter (struct mlx5_core_dev *dev, -bool reset,void *out,int out_size) -{ -u32 in[MLX5_ST_SZ_DW (query_cong_statistics_in)] = { }; - -MLX5_SET (query_cong_statistics_in, in, opcode, -MLX5_CMD_OP_QUERY_CONG_STATISTICS ); -MLX5_SET (query_cong_statistics_in, in, clear, reset); -return mlx5_cmd_exec (dev, in,sizeof (in), out, out_size); -} -int mlx5_lag_dev_get_netdev_idx (struct mlx5_lag *ldev,struct net_device *ndev) {
@@ -232,12 +207,14 @@ int mlx5_activate_lag(struct mlx5_lag *ldev,static int mlx5_deactivate_lag (struct mlx5_lag *ldev) {struct mlx5_core_dev *dev0 = ldev->pf[MLX5_LAG_P1 ].dev; +u32 in[MLX5_ST_SZ_DW (destroy_lag_in)] = {};bool roce_lag =__mlx5_lag_is_roce (ldev);int err; ldev->flags &= ~MLX5_LAG_MODE_FLAGS ; - err =mlx5_cmd_destroy_lag (dev0); +MLX5_SET (destroy_lag_in, in, opcode,MLX5_CMD_OP_DESTROY_LAG ); + err =mlx5_cmd_exec_in (dev0, destroy_lag, in);if (err) {if (roce_lag) { mlx5_core_err(dev0,
@@ -783,7 +760,12 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,spin_unlock (&lag_lock);for (i =0 ; i < num_ports; ++i) { - ret =mlx5_cmd_query_cong_counter (mdev[i], false, out, outlen); +u32 in[MLX5_ST_SZ_DW (query_cong_statistics_in)] = {}; + +MLX5_SET (query_cong_statistics_in, in, opcode, +MLX5_CMD_OP_QUERY_CONG_STATISTICS ); + ret =mlx5_cmd_exec_inout (mdev[i], query_cong_statistics, in, + out);if (ret) goto free;
Signature · 1 line
2.25.2
PATCH 12/24 net/mlx5: Update gid.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of gid.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/lib/gid.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/gid.c +2 -3
@@ -124,8 +124,7 @@ int mlx5_core_roce_gid_set(struct mlx5_core_dev *dev, unsigned int index, const u8 *mac, bool vlan, u16 vlan_id, u8 port_num) { #define MLX5_SET_RA(p, f, v) MLX5_SET(roce_addr_layout, p, f, v) - u32 in[MLX5_ST_SZ_DW (set_roce_address_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (set_roce_address_out)] = {0 }; + u32 in[MLX5_ST_SZ_DW (set_roce_address_in)] = {};void *in_addr =MLX5_ADDR_OF (set_roce_address_in, in, roce_address);char *addr_l3_addr =MLX5_ADDR_OF (roce_addr_layout, in_addr, source_l3_address);
@@ -153,6 +152,6 @@ int mlx5_core_roce_gid_set(struct mlx5_core_dev *dev, unsigned int index,MLX5_SET (set_roce_address_in, in, roce_address_index, index);MLX5_SET (set_roce_address_in, in, opcode,MLX5_CMD_OP_SET_ROCE_ADDRESS ); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, set_roce_address, in); }EXPORT_SYMBOL (mlx5_core_roce_gid_set);
Signature · 1 line
2.25.2
PATCH 13/24 net/mlx5: Update mpfs.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of mpfs.c to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c +4 -6
@@ -40,8 +40,7 @@/* HW L2 Table (MPFS) management */ static int set_l2table_entry_cmd (struct mlx5_core_dev *dev,u32 index,u8 *mac) { -u32 in[MLX5_ST_SZ_DW (set_l2_table_entry_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (set_l2_table_entry_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (set_l2_table_entry_in)] = {};u8 *in_mac_addr;MLX5_SET (set_l2_table_entry_in, in, opcode,MLX5_CMD_OP_SET_L2_TABLE_ENTRY );
@@ -50,17 +49,16 @@ static int set_l2table_entry_cmd(struct mlx5_core_dev *dev, u32 index, u8 *mac) in_mac_addr =MLX5_ADDR_OF (set_l2_table_entry_in, in, mac_address);ether_addr_copy (&in_mac_addr[2 ], mac); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, set_l2_table_entry, in); }static int del_l2table_entry_cmd (struct mlx5_core_dev *dev,u32 index) { -u32 in[MLX5_ST_SZ_DW (delete_l2_table_entry_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (delete_l2_table_entry_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (delete_l2_table_entry_in)] = {};MLX5_SET (delete_l2_table_entry_in, in, opcode,MLX5_CMD_OP_DELETE_L2_TABLE_ENTRY );MLX5_SET (delete_l2_table_entry_in, in, table_index, index); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, delete_l2_table_entry, in); }/* UC L2 table hash node */
Signature · 1 line
2.25.2
PATCH 9/24 net/mlx5: Update fs_core new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of fs_core to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- .../net/ethernet/mellanox/mlx5/core/fs_cmd.c | 80 +++++++------------ 1 file changed, 31 insertions(+), 49 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +31 -49
@@ -155,8 +155,7 @@ static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns, struct mlx5_flow_table *ft, u32 underlay_qpn, bool disconnect) { - u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)] = {0}; -u32 out[MLX5_ST_SZ_DW (set_flow_table_root_out)] = {0 }; + u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)] = {};struct mlx5_core_dev *dev = ns->dev; if ((MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_IB) &&
@@ -167,13 +166,10 @@ static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns, MLX5_CMD_OP_SET_FLOW_TABLE_ROOT);MLX5_SET (set_flow_table_root_in, in, table_type, ft->type); -if (disconnect) { +if (disconnect)MLX5_SET (set_flow_table_root_in, in, op_mod,1 ); -MLX5_SET (set_flow_table_root_in, in, table_id,0 ); - }else { -MLX5_SET (set_flow_table_root_in, in, op_mod,0 ); +else MLX5_SET (set_flow_table_root_in, in, table_id, ft->id); - }MLX5_SET (set_flow_table_root_in, in, underlay_qpn, underlay_qpn);if (ft->vport) {
@@ -181,7 +177,7 @@ static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns,MLX5_SET (set_flow_table_root_in, in, other_vport,1 ); } -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, set_flow_table_root, in); } static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,
@@ -192,8 +188,8 @@ static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,int en_encap = !!(ft->flags &MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT );int en_decap = !!(ft->flags &MLX5_FLOW_TABLE_TUNNEL_EN_DECAP );int term = !!(ft->flags &MLX5_FLOW_TABLE_TERMINATION ); -u32 out[MLX5_ST_SZ_DW (create_flow_table_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (create_flow_table_in)] = {0 }; +u32 out[MLX5_ST_SZ_DW (create_flow_table_out)] = {}; +u32 in[MLX5_ST_SZ_DW (create_flow_table_in)] = {};struct mlx5_core_dev *dev = ns->dev;int err;
@@ -239,7 +235,7 @@ static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,break ; } - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (dev, create_flow_table, in, out);if (!err) ft->id =MLX5_GET (create_flow_table_out, out, table_id);
@@ -249,8 +245,7 @@ static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,static int mlx5_cmd_destroy_flow_table (struct mlx5_flow_root_namespace *ns,struct mlx5_flow_table *ft) { -u32 in[MLX5_ST_SZ_DW (destroy_flow_table_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (destroy_flow_table_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (destroy_flow_table_in)] = {};struct mlx5_core_dev *dev = ns->dev; MLX5_SET(destroy_flow_table_in, in, opcode,
@@ -262,15 +257,14 @@ static int mlx5_cmd_destroy_flow_table(struct mlx5_flow_root_namespace *ns,MLX5_SET (destroy_flow_table_in, in, other_vport,1 ); } -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, destroy_flow_table, in); }static int mlx5_cmd_modify_flow_table (struct mlx5_flow_root_namespace *ns,struct mlx5_flow_table *ft,struct mlx5_flow_table *next_ft) { -u32 in[MLX5_ST_SZ_DW (modify_flow_table_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (modify_flow_table_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (modify_flow_table_in)] = {};struct mlx5_core_dev *dev = ns->dev; MLX5_SET(modify_flow_table_in, in, opcode,
@@ -310,7 +304,7 @@ static int mlx5_cmd_modify_flow_table(struct mlx5_flow_root_namespace *ns, } } -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, modify_flow_table, in); } static int mlx5_cmd_create_flow_group(struct mlx5_flow_root_namespace *ns,
@@ -318,8 +312,7 @@ static int mlx5_cmd_create_flow_group(struct mlx5_flow_root_namespace *ns,u32 *in, struct mlx5_flow_group *fg) { - u32 out[MLX5_ST_SZ_DW(create_flow_group_out)] = {0}; -int inlen =MLX5_ST_SZ_BYTES (create_flow_group_in); + u32 out[MLX5_ST_SZ_DW(create_flow_group_out)] = {};struct mlx5_core_dev *dev = ns->dev;int err;
@@ -332,7 +325,7 @@ static int mlx5_cmd_create_flow_group(struct mlx5_flow_root_namespace *ns,MLX5_SET (create_flow_group_in, in, other_vport,1 ); } - err =mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); + err =mlx5_cmd_exec_inout (dev, create_flow_group, in, out);if (!err) fg->id =MLX5_GET (create_flow_group_out, out, group_id);
@@ -343,8 +336,7 @@ static int mlx5_cmd_destroy_flow_group(struct mlx5_flow_root_namespace *ns,struct mlx5_flow_table *ft, struct mlx5_flow_group *fg) { - u32 out[MLX5_ST_SZ_DW(destroy_flow_group_out)] = {0}; -u32 in[MLX5_ST_SZ_DW (destroy_flow_group_in)] = {0 }; + u32 in[MLX5_ST_SZ_DW(destroy_flow_group_in)] = {};struct mlx5_core_dev *dev = ns->dev; MLX5_SET(destroy_flow_group_in, in, opcode,
@@ -357,7 +349,7 @@ static int mlx5_cmd_destroy_flow_group(struct mlx5_flow_root_namespace *ns,MLX5_SET (destroy_flow_group_in, in, other_vport,1 ); } -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, destroy_flow_group, in); } static int mlx5_set_extended_dest(struct mlx5_core_dev *dev,
@@ -600,8 +592,7 @@ static int mlx5_cmd_delete_fte(struct mlx5_flow_root_namespace *ns,struct mlx5_flow_table *ft, struct fs_fte *fte) { - u32 out[MLX5_ST_SZ_DW(delete_fte_out)] = {0}; -u32 in[MLX5_ST_SZ_DW (delete_fte_in)] = {0 }; + u32 in[MLX5_ST_SZ_DW(delete_fte_in)] = {};struct mlx5_core_dev *dev = ns->dev;MLX5_SET (delete_fte_in, in, opcode,MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY );
@@ -613,22 +604,22 @@ static int mlx5_cmd_delete_fte(struct mlx5_flow_root_namespace *ns,MLX5_SET (delete_fte_in, in, other_vport,1 ); } -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, delete_fte, in); }int mlx5_cmd_fc_bulk_alloc (struct mlx5_core_dev *dev,enum mlx5_fc_bulk_alloc_bitmask alloc_bitmask,u32 *id) { -u32 in[MLX5_ST_SZ_DW (alloc_flow_counter_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (alloc_flow_counter_out)] = {0 }; +u32 out[MLX5_ST_SZ_DW (alloc_flow_counter_out)] = {}; +u32 in[MLX5_ST_SZ_DW (alloc_flow_counter_in)] = {};int err;MLX5_SET (alloc_flow_counter_in, in, opcode,MLX5_CMD_OP_ALLOC_FLOW_COUNTER );MLX5_SET (alloc_flow_counter_in, in, flow_counter_bulk, alloc_bitmask); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (dev, alloc_flow_counter, in, out);if (!err) *id =MLX5_GET (alloc_flow_counter_out, out, flow_counter_id);return err;
@@ -641,21 +632,20 @@ int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id)int mlx5_cmd_fc_free (struct mlx5_core_dev *dev,u32 id) { -u32 in[MLX5_ST_SZ_DW (dealloc_flow_counter_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (dealloc_flow_counter_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (dealloc_flow_counter_in)] = {};MLX5_SET (dealloc_flow_counter_in, in, opcode,MLX5_CMD_OP_DEALLOC_FLOW_COUNTER );MLX5_SET (dealloc_flow_counter_in, in, flow_counter_id, id); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, dealloc_flow_counter, in); }int mlx5_cmd_fc_query (struct mlx5_core_dev *dev,u32 id,u64 *packets,u64 *bytes) {u32 out[MLX5_ST_SZ_BYTES (query_flow_counter_out) + -MLX5_ST_SZ_BYTES (traffic_counter)] = {0 }; -u32 in[MLX5_ST_SZ_DW (query_flow_counter_in)] = {0 }; +MLX5_ST_SZ_BYTES (traffic_counter)] = {}; +u32 in[MLX5_ST_SZ_DW (query_flow_counter_in)] = {};void *stats;int err =0 ;
@@ -683,11 +673,10 @@ int mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, u32 base_id, int bulk_len, u32 *out) {int outlen =mlx5_cmd_fc_get_bulk_query_out_len (bulk_len); -u32 in[MLX5_ST_SZ_DW (query_flow_counter_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (query_flow_counter_in)] = {};MLX5_SET (query_flow_counter_in, in, opcode,MLX5_CMD_OP_QUERY_FLOW_COUNTER ); -MLX5_SET (query_flow_counter_in, in, op_mod,0 );MLX5_SET (query_flow_counter_in, in, flow_counter_id, base_id);MLX5_SET (query_flow_counter_in, in, num_of_counters, bulk_len);return mlx5_cmd_exec (dev, in,sizeof (in), out, outlen);
@@ -700,7 +689,7 @@ static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns,enum mlx5_flow_namespace_type namespace, struct mlx5_pkt_reformat *pkt_reformat) { - u32 out[MLX5_ST_SZ_DW(alloc_packet_reformat_context_out)]; + u32 out[MLX5_ST_SZ_DW(alloc_packet_reformat_context_out)] = {};struct mlx5_core_dev *dev = ns->dev;void *packet_reformat_context_in;int max_encap_size;
@@ -732,7 +721,6 @@ static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns, reformat_data); inlen = reformat - (void *)in + size; -memset (in,0 , inlen);MLX5_SET (alloc_packet_reformat_context_in, in, opcode,MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT ); MLX5_SET(packet_reformat_context_in, packet_reformat_context_in,
@@ -741,7 +729,6 @@ static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns, reformat_type, reformat_type);memcpy (reformat, reformat_data, size); -memset (out,0 ,sizeof (out)); err =mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); pkt_reformat->id = MLX5_GET(alloc_packet_reformat_context_out,
@@ -753,17 +740,15 @@ static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns,static void mlx5_cmd_packet_reformat_dealloc (struct mlx5_flow_root_namespace *ns,struct mlx5_pkt_reformat *pkt_reformat) { -u32 in[MLX5_ST_SZ_DW (dealloc_packet_reformat_context_in)]; -u32 out[MLX5_ST_SZ_DW (dealloc_packet_reformat_context_out)]; +u32 in[MLX5_ST_SZ_DW (dealloc_packet_reformat_context_in)] = {};struct mlx5_core_dev *dev = ns->dev; -memset (in,0 ,sizeof (in));MLX5_SET (dealloc_packet_reformat_context_in, in, opcode,MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT );MLX5_SET (dealloc_packet_reformat_context_in, in, packet_reformat_id, pkt_reformat->id); -mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +mlx5_cmd_exec_in (dev, dealloc_packet_reformat_context, in); } static int mlx5_cmd_modify_header_alloc(struct mlx5_flow_root_namespace *ns,
@@ -771,7 +756,7 @@ static int mlx5_cmd_modify_header_alloc(struct mlx5_flow_root_namespace *ns,void *modify_actions, struct mlx5_modify_hdr *modify_hdr) { - u32 out[MLX5_ST_SZ_DW(alloc_modify_header_context_out)]; + u32 out[MLX5_ST_SZ_DW(alloc_modify_header_context_out)] = {};int max_actions, actions_size, inlen, err;struct mlx5_core_dev *dev = ns->dev;void *actions_in;
@@ -821,7 +806,6 @@ static int mlx5_cmd_modify_header_alloc(struct mlx5_flow_root_namespace *ns, actions_in =MLX5_ADDR_OF (alloc_modify_header_context_in, in, actions);memcpy (actions_in, modify_actions, actions_size); -memset (out,0 ,sizeof (out)); err =mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); modify_hdr->id =MLX5_GET (alloc_modify_header_context_out, out, modify_header_id);
@@ -832,17 +816,15 @@ static int mlx5_cmd_modify_header_alloc(struct mlx5_flow_root_namespace *ns,static void mlx5_cmd_modify_header_dealloc (struct mlx5_flow_root_namespace *ns,struct mlx5_modify_hdr *modify_hdr) { -u32 in[MLX5_ST_SZ_DW (dealloc_modify_header_context_in)]; -u32 out[MLX5_ST_SZ_DW (dealloc_modify_header_context_out)]; +u32 in[MLX5_ST_SZ_DW (dealloc_modify_header_context_in)] = {};struct mlx5_core_dev *dev = ns->dev; -memset (in,0 ,sizeof (in));MLX5_SET (dealloc_modify_header_context_in, in, opcode,MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT );MLX5_SET (dealloc_modify_header_context_in, in, modify_header_id, modify_hdr->id); -mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +mlx5_cmd_exec_in (dev, dealloc_modify_header_context, in); }static const struct mlx5_flow_cmds mlx5_flow_cmds = {
Signature · 1 line
2.25.2
PATCH 15/24 net/mlx5: Update main.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of main.c to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- .../net/ethernet/mellanox/mlx5/core/main.c | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +13 -22
@@ -206,8 +206,7 @@ static void mlx5_set_driver_version(struct mlx5_core_dev *dev) {int driver_ver_sz =MLX5_FLD_SZ_BYTES (set_driver_version_in, driver_version); -u8 in[MLX5_ST_SZ_BYTES (set_driver_version_in)] = {0 }; -u8 out[MLX5_ST_SZ_BYTES (set_driver_version_out)] = {0 }; +u8 in[MLX5_ST_SZ_BYTES (set_driver_version_in)] = {};int remaining_size = driver_ver_sz;char *string;
@@ -234,7 +233,7 @@ static void mlx5_set_driver_version(struct mlx5_core_dev *dev)MLX5_SET (set_driver_version_in, in, opcode,MLX5_CMD_OP_SET_DRIVER_VERSION ); -mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +mlx5_cmd_exec_in (dev, set_driver_version, in); }static int set_dma_caps (struct pci_dev *pdev)
@@ -366,7 +365,7 @@ static int mlx5_core_get_caps_mode(struct mlx5_core_dev *dev,MLX5_SET (query_hca_cap_in, in, opcode,MLX5_CMD_OP_QUERY_HCA_CAP );MLX5_SET (query_hca_cap_in, in, op_mod, opmod); - err =mlx5_cmd_exec (dev, in,sizeof (in), out, out_sz); + err =mlx5_cmd_exec_inout (dev, query_hca_cap, in, out);if (err) { mlx5_core_warn(dev, "QUERY_HCA_CAP : type(%x) opmode(%x) Failed(%d)\n",
@@ -409,12 +408,9 @@ int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type)static int set_caps (struct mlx5_core_dev *dev,void *in,int opmod) { -u32 out[MLX5_ST_SZ_DW (set_hca_cap_out)] = {}; -MLX5_SET (set_hca_cap_in, in, opcode,MLX5_CMD_OP_SET_HCA_CAP );MLX5_SET (set_hca_cap_in, in, op_mod, opmod <<1 ); -return mlx5_cmd_exec (dev, in,MLX5_ST_SZ_BYTES (set_hca_cap_in), out, -sizeof (out)); +return mlx5_cmd_exec_in (dev, set_hca_cap, in); }static int handle_hca_cap_atomic (struct mlx5_core_dev *dev,void *set_ctx)
@@ -653,26 +649,24 @@ static int mlx5_core_set_hca_defaults(struct mlx5_core_dev *dev)int mlx5_core_enable_hca (struct mlx5_core_dev *dev,u16 func_id) { -u32 out[MLX5_ST_SZ_DW (enable_hca_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (enable_hca_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (enable_hca_in)] = {};MLX5_SET (enable_hca_in, in, opcode,MLX5_CMD_OP_ENABLE_HCA );MLX5_SET (enable_hca_in, in, function_id, func_id);MLX5_SET (enable_hca_in, in, embedded_cpu_function, dev->caps.embedded_cpu); -return mlx5_cmd_exec (dev, &in,sizeof (in), &out,sizeof (out)); +return mlx5_cmd_exec_in (dev, enable_hca, in); }int mlx5_core_disable_hca (struct mlx5_core_dev *dev,u16 func_id) { -u32 out[MLX5_ST_SZ_DW (disable_hca_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (disable_hca_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (disable_hca_in)] = {};MLX5_SET (disable_hca_in, in, opcode,MLX5_CMD_OP_DISABLE_HCA );MLX5_SET (disable_hca_in, in, function_id, func_id);MLX5_SET (enable_hca_in, in, embedded_cpu_function, dev->caps.embedded_cpu); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, disable_hca, in); } u64 mlx5_read_internal_timer(struct mlx5_core_dev *dev,
@@ -697,14 +691,13 @@ u64 mlx5_read_internal_timer(struct mlx5_core_dev *dev,static int mlx5_core_set_issi (struct mlx5_core_dev *dev) { -u32 query_in[MLX5_ST_SZ_DW (query_issi_in)] = {0 }; -u32 query_out[MLX5_ST_SZ_DW (query_issi_out)] = {0 }; +u32 query_out[MLX5_ST_SZ_DW (query_issi_out)] = {}; +u32 query_in[MLX5_ST_SZ_DW (query_issi_in)] = {};u32 sup_issi;int err;MLX5_SET (query_issi_in, query_in, opcode,MLX5_CMD_OP_QUERY_ISSI ); - err =mlx5_cmd_exec (dev, query_in,sizeof (query_in), - query_out,sizeof (query_out)); + err =mlx5_cmd_exec_inout (dev, query_issi, query_in, query_out);if (err) {u32 syndrome;u8 status;
@@ -724,13 +717,11 @@ static int mlx5_core_set_issi(struct mlx5_core_dev *dev) sup_issi =MLX5_GET (query_issi_out, query_out, supported_issi_dw0);if (sup_issi & (1 <<1 )) { -u32 set_in[MLX5_ST_SZ_DW (set_issi_in)] = {0 }; -u32 set_out[MLX5_ST_SZ_DW (set_issi_out)] = {0 }; +u32 set_in[MLX5_ST_SZ_DW (set_issi_in)] = {};MLX5_SET (set_issi_in, set_in, opcode,MLX5_CMD_OP_SET_ISSI );MLX5_SET (set_issi_in, set_in, current_issi,1 ); - err =mlx5_cmd_exec (dev, set_in,sizeof (set_in), - set_out,sizeof (set_out)); + err =mlx5_cmd_exec_in (dev, set_issi, set_in);if (err) {mlx5_core_err (dev,"Failed to set ISSI to 1 err(%d)\n" , err);
Signature · 1 line
2.25.2
PATCH 17/24 net/mlx5: Update mr.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of mr.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/mr.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/mr.c +9 -11
@@ -39,7 +39,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev,struct mlx5_core_mkey *mkey, u32 *in, int inlen) { - u32 lout[MLX5_ST_SZ_DW(create_mkey_out)] = {0}; + u32 lout[MLX5_ST_SZ_DW(create_mkey_out)] = {};u32 mkey_index;void *mkc;int err;
@@ -65,19 +65,18 @@ EXPORT_SYMBOL(mlx5_core_create_mkey);int mlx5_core_destroy_mkey (struct mlx5_core_dev *dev,struct mlx5_core_mkey *mkey) { -u32 out[MLX5_ST_SZ_DW (destroy_mkey_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (destroy_mkey_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (destroy_mkey_in)] = {};MLX5_SET (destroy_mkey_in, in, opcode,MLX5_CMD_OP_DESTROY_MKEY );MLX5_SET (destroy_mkey_in, in, mkey_index,mlx5_mkey_to_idx (mkey->key)); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, destroy_mkey, in); }EXPORT_SYMBOL (mlx5_core_destroy_mkey);int mlx5_core_query_mkey (struct mlx5_core_dev *dev,struct mlx5_core_mkey *mkey,u32 *out,int outlen) { -u32 in[MLX5_ST_SZ_DW (query_mkey_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (query_mkey_in)] = {};memset (out,0 , outlen);MLX5_SET (query_mkey_in, in, opcode,MLX5_CMD_OP_QUERY_MKEY );
@@ -99,8 +98,8 @@ static inline u32 mlx5_get_psv(u32 *out, int psv_index)int mlx5_core_create_psv (struct mlx5_core_dev *dev,u32 pdn,int npsvs,u32 *sig_index) { -u32 out[MLX5_ST_SZ_DW (create_psv_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (create_psv_in)] = {0 }; +u32 out[MLX5_ST_SZ_DW (create_psv_out)] = {}; +u32 in[MLX5_ST_SZ_DW (create_psv_in)] = {};int i, err;if (npsvs >MLX5_MAX_PSVS )
@@ -110,7 +109,7 @@ int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn,MLX5_SET (create_psv_in, in, pd, pdn);MLX5_SET (create_psv_in, in, num_psv, npsvs); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (dev, create_psv, in, out);if (err)return err;
@@ -123,11 +122,10 @@ EXPORT_SYMBOL(mlx5_core_create_psv);int mlx5_core_destroy_psv (struct mlx5_core_dev *dev,int psv_num) { -u32 out[MLX5_ST_SZ_DW (destroy_psv_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (destroy_psv_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (destroy_psv_in)] = {};MLX5_SET (destroy_psv_in, in, opcode,MLX5_CMD_OP_DESTROY_PSV );MLX5_SET (destroy_psv_in, in, psvn, psv_num); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, destroy_psv, in); }EXPORT_SYMBOL (mlx5_core_destroy_psv);
Signature · 1 line
2.25.2
PATCH 16/24 net/mlx5: Update mcg.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of mcg.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/mcg.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/mcg.c +4 -6
@@ -38,28 +38,26 @@int mlx5_core_attach_mcg (struct mlx5_core_dev *dev,union ib_gid *mgid,u32 qpn) { -u32 out[MLX5_ST_SZ_DW (attach_to_mcg_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (attach_to_mcg_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (attach_to_mcg_in)] = {};void *gid;MLX5_SET (attach_to_mcg_in, in, opcode,MLX5_CMD_OP_ATTACH_TO_MCG );MLX5_SET (attach_to_mcg_in, in, qpn, qpn); gid =MLX5_ADDR_OF (attach_to_mcg_in, in, multicast_gid);memcpy (gid, mgid,sizeof (*mgid)); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, attach_to_mcg, in); }EXPORT_SYMBOL (mlx5_core_attach_mcg);int mlx5_core_detach_mcg (struct mlx5_core_dev *dev,union ib_gid *mgid,u32 qpn) { -u32 out[MLX5_ST_SZ_DW (detach_from_mcg_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (detach_from_mcg_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (detach_from_mcg_in)] = {};void *gid;MLX5_SET (detach_from_mcg_in, in, opcode,MLX5_CMD_OP_DETACH_FROM_MCG );MLX5_SET (detach_from_mcg_in, in, qpn, qpn); gid =MLX5_ADDR_OF (detach_from_mcg_in, in, multicast_gid);memcpy (gid, mgid,sizeof (*mgid)); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, detach_from_mcg, in); }EXPORT_SYMBOL (mlx5_core_detach_mcg);
Signature · 1 line
2.25.2
PATCH 18/24 net/mlx5: Update pagealloc.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of pagealloc.c to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +6 -7
@@ -135,8 +135,8 @@ static struct fw_page *find_fw_page(struct mlx5_core_dev *dev, u64 addr)static int mlx5_cmd_query_pages (struct mlx5_core_dev *dev,u16 *func_id,s32 *npages,int boot) { -u32 out[MLX5_ST_SZ_DW (query_pages_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (query_pages_in)] = {0 }; +u32 out[MLX5_ST_SZ_DW (query_pages_out)] = {}; +u32 in[MLX5_ST_SZ_DW (query_pages_in)] = {};int err;MLX5_SET (query_pages_in, in, opcode,MLX5_CMD_OP_QUERY_PAGES );
@@ -145,7 +145,7 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, MLX5_QUERY_PAGES_IN_OP_MOD_INIT_PAGES);MLX5_SET (query_pages_in, in, embedded_cpu_function,mlx5_core_is_ecpf (dev)); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (dev, query_pages, in, out);if (err)return err;
@@ -256,8 +256,7 @@ static int alloc_system_page(struct mlx5_core_dev *dev, u16 func_id)static void page_notify_fail (struct mlx5_core_dev *dev,u16 func_id,bool ec_function) { -u32 out[MLX5_ST_SZ_DW (manage_pages_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (manage_pages_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (manage_pages_in)] = {};int err;MLX5_SET (manage_pages_in, in, opcode,MLX5_CMD_OP_MANAGE_PAGES );
@@ -265,7 +264,7 @@ static void page_notify_fail(struct mlx5_core_dev *dev, u16 func_id,MLX5_SET (manage_pages_in, in, function_id, func_id);MLX5_SET (manage_pages_in, in, embedded_cpu_function, ec_function); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_in (dev, manage_pages, in);if (err)mlx5_core_warn (dev,"page notify failed func_id(%d) err(%d)\n" , func_id, err);
@@ -373,7 +372,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, int *nclaimed, bool ec_function) { int outlen = MLX5_ST_SZ_BYTES(manage_pages_out); -u32 in[MLX5_ST_SZ_DW (manage_pages_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (manage_pages_in)] = {};int num_claimed;u32 *out;int err;
Signature · 1 line
2.25.2
PATCH 19/24 net/mlx5: Update pd.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of pd.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/pd.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/pd.c +5 -6
@@ -37,12 +37,12 @@int mlx5_core_alloc_pd (struct mlx5_core_dev *dev,u32 *pdn) { -u32 out[MLX5_ST_SZ_DW (alloc_pd_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (alloc_pd_in)] = {0 }; +u32 out[MLX5_ST_SZ_DW (alloc_pd_out)] = {}; +u32 in[MLX5_ST_SZ_DW (alloc_pd_in)] = {};int err;MLX5_SET (alloc_pd_in, in, opcode,MLX5_CMD_OP_ALLOC_PD ); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (dev, alloc_pd, in, out);if (!err) *pdn =MLX5_GET (alloc_pd_out, out, pd);return err;
@@ -51,11 +51,10 @@ EXPORT_SYMBOL(mlx5_core_alloc_pd);int mlx5_core_dealloc_pd (struct mlx5_core_dev *dev,u32 pdn) { -u32 out[MLX5_ST_SZ_DW (dealloc_pd_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (dealloc_pd_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (dealloc_pd_in)] = {};MLX5_SET (dealloc_pd_in, in, opcode,MLX5_CMD_OP_DEALLOC_PD );MLX5_SET (dealloc_pd_in, in, pd, pdn); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, dealloc_pd, in); }EXPORT_SYMBOL (mlx5_core_dealloc_pd);
Signature · 1 line
2.25.2
PATCH 14/24 net/mlx5: Update vxlan.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of vxlan.c to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/lib/vxlan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/vxlan.c +4 -6
@@ -60,24 +60,22 @@ static inline u8 mlx5_vxlan_max_udp_ports(struct mlx5_core_dev *mdev)static int mlx5_vxlan_core_add_port_cmd (struct mlx5_core_dev *mdev,u16 port) { -u32 in[MLX5_ST_SZ_DW (add_vxlan_udp_dport_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (add_vxlan_udp_dport_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (add_vxlan_udp_dport_in)] = {};MLX5_SET (add_vxlan_udp_dport_in, in, opcode,MLX5_CMD_OP_ADD_VXLAN_UDP_DPORT );MLX5_SET (add_vxlan_udp_dport_in, in, vxlan_udp_port, port); -return mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (mdev, add_vxlan_udp_dport, in); }static int mlx5_vxlan_core_del_port_cmd (struct mlx5_core_dev *mdev,u16 port) { -u32 in[MLX5_ST_SZ_DW (delete_vxlan_udp_dport_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (delete_vxlan_udp_dport_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (delete_vxlan_udp_dport_in)] = {};MLX5_SET (delete_vxlan_udp_dport_in, in, opcode,MLX5_CMD_OP_DELETE_VXLAN_UDP_DPORT );MLX5_SET (delete_vxlan_udp_dport_in, in, vxlan_udp_port, port); -return mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (mdev, delete_vxlan_udp_dport, in); } static struct mlx5_vxlan_port*
Signature · 1 line
2.25.2
PATCH 21/24 net/mlx5: Update rl.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of rl.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/rl.c | 21 +++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/rl.c +9 -12
@@ -39,8 +39,8 @@int mlx5_create_scheduling_element_cmd (struct mlx5_core_dev *dev,u8 hierarchy,void *ctx,u32 *element_id) { -u32 in[MLX5_ST_SZ_DW (create_scheduling_element_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (create_scheduling_element_in)] = {0 }; +u32 out[MLX5_ST_SZ_DW (create_scheduling_element_in)] = {}; +u32 in[MLX5_ST_SZ_DW (create_scheduling_element_in)] = {};void *schedc;int err;
@@ -52,7 +52,7 @@ int mlx5_create_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy, hierarchy);memcpy (schedc, ctx,MLX5_ST_SZ_BYTES (scheduling_context)); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (dev, create_scheduling_element, in, out);if (err)return err;
@@ -65,8 +65,7 @@ int mlx5_modify_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy, void *ctx, u32 element_id, u32 modify_bitmask) { - u32 in[MLX5_ST_SZ_DW(modify_scheduling_element_in)] = {0}; -u32 out[MLX5_ST_SZ_DW (modify_scheduling_element_in)] = {0 }; + u32 in[MLX5_ST_SZ_DW(modify_scheduling_element_in)] = {};void *schedc; schedc = MLX5_ADDR_OF(modify_scheduling_element_in, in,
@@ -81,14 +80,13 @@ int mlx5_modify_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy, hierarchy);memcpy (schedc, ctx,MLX5_ST_SZ_BYTES (scheduling_context)); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, modify_scheduling_element, in); }int mlx5_destroy_scheduling_element_cmd (struct mlx5_core_dev *dev,u8 hierarchy,u32 element_id) { -u32 in[MLX5_ST_SZ_DW (destroy_scheduling_element_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (destroy_scheduling_element_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (destroy_scheduling_element_in)] = {};MLX5_SET (destroy_scheduling_element_in, in, opcode,MLX5_CMD_OP_DESTROY_SCHEDULING_ELEMENT );
@@ -97,7 +95,7 @@ int mlx5_destroy_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,MLX5_SET (destroy_scheduling_element_in, in, scheduling_hierarchy, hierarchy); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, destroy_scheduling_element, in); } static bool mlx5_rl_are_equal_raw(struct mlx5_rl_entry *entry, void *rl_in,
@@ -144,8 +142,7 @@ static struct mlx5_rl_entry *find_rl_entry(struct mlx5_rl_table *table,static int mlx5_set_pp_rate_limit_cmd (struct mlx5_core_dev *dev,struct mlx5_rl_entry *entry,bool set) { -u32 in[MLX5_ST_SZ_DW (set_pp_rate_limit_in)] = {}; -u32 out[MLX5_ST_SZ_DW (set_pp_rate_limit_out)] = {}; +u32 in[MLX5_ST_SZ_DW (set_pp_rate_limit_in)] = {};void *pp_context; pp_context =MLX5_ADDR_OF (set_pp_rate_limit_in, in, ctx);
@@ -155,7 +152,7 @@ static int mlx5_set_pp_rate_limit_cmd(struct mlx5_core_dev *dev,MLX5_SET (set_pp_rate_limit_in, in, rate_limit_index, entry->index);if (set)memcpy (pp_context, entry->rl_raw,sizeof (entry->rl_raw)); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, set_pp_rate_limit, in); }bool mlx5_rl_is_in_range (struct mlx5_core_dev *dev,u32 rate)
Signature · 1 line
2.25.2
PATCH 22/24 net/mlx5: Update port.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of port.c to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/port.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/port.c +5 -6
@@ -763,24 +763,23 @@ EXPORT_SYMBOL_GPL(mlx5_query_port_ets_rate_limit);int mlx5_set_port_wol (struct mlx5_core_dev *mdev,u8 wol_mode) { -u32 in[MLX5_ST_SZ_DW (set_wol_rol_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (set_wol_rol_out)] = {0 }; +u32 in[MLX5_ST_SZ_DW (set_wol_rol_in)] = {};MLX5_SET (set_wol_rol_in, in, opcode,MLX5_CMD_OP_SET_WOL_ROL );MLX5_SET (set_wol_rol_in, in, wol_mode_valid,1 );MLX5_SET (set_wol_rol_in, in, wol_mode, wol_mode); -return mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (mdev, set_wol_rol, in); }EXPORT_SYMBOL_GPL (mlx5_set_port_wol);int mlx5_query_port_wol (struct mlx5_core_dev *mdev,u8 *wol_mode) { -u32 in[MLX5_ST_SZ_DW (query_wol_rol_in)] = {0 }; -u32 out[MLX5_ST_SZ_DW (query_wol_rol_out)] = {0 }; +u32 out[MLX5_ST_SZ_DW (query_wol_rol_out)] = {}; +u32 in[MLX5_ST_SZ_DW (query_wol_rol_in)] = {};int err;MLX5_SET (query_wol_rol_in, in, opcode,MLX5_CMD_OP_QUERY_WOL_ROL ); - err =mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (mdev, query_wol_rol, in, out);if (!err) *wol_mode =MLX5_GET (query_wol_rol_out, out, wol_mode);
Signature · 1 line
2.25.2
PATCH 23/24 net/mlx5: Update SW steering new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of SW steering to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- .../mellanox/mlx5/core/steering/dr_cmd.c | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c +14 -19
@@ -18,7 +18,7 @@ int mlx5dr_cmd_query_esw_vport_context(struct mlx5_core_dev *mdev,MLX5_SET (query_esw_vport_context_in, in, other_vport, other_vport);MLX5_SET (query_esw_vport_context_in, in, vport_number, vport_number); - err =mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (mdev, query_esw_vport_context, in, out);if (err)return err;
@@ -51,7 +51,7 @@ int mlx5dr_cmd_query_gvmi(struct mlx5_core_dev *mdev, bool other_vport,MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE <<1 | HCA_CAP_OPMOD_GET_CUR); - err =mlx5_cmd_exec (mdev, in,sizeof (in), out, out_size); + err =mlx5_cmd_exec_inout (mdev, query_hca_cap, in, out);if (err) {kfree (out);return err;
@@ -141,7 +141,7 @@ int mlx5dr_cmd_query_flow_table(struct mlx5_core_dev *dev,MLX5_SET (query_flow_table_in, in, table_type, type);MLX5_SET (query_flow_table_in, in, table_id, table_id); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (dev, query_flow_table, in, out);if (err)return err;
@@ -158,12 +158,11 @@ int mlx5dr_cmd_query_flow_table(struct mlx5_core_dev *dev,int mlx5dr_cmd_sync_steering (struct mlx5_core_dev *mdev) { -u32 out[MLX5_ST_SZ_DW (sync_steering_out)] = {};u32 in[MLX5_ST_SZ_DW (sync_steering_in)] = {};MLX5_SET (sync_steering_in, in, opcode,MLX5_CMD_OP_SYNC_STEERING ); -return mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (mdev, sync_steering, in); } int mlx5dr_cmd_set_fte_modify_and_vport(struct mlx5_core_dev *mdev,
@@ -214,14 +213,13 @@ int mlx5dr_cmd_del_flow_table_entry(struct mlx5_core_dev *mdev, u32 table_type, u32 table_id) { -u32 out[MLX5_ST_SZ_DW (delete_fte_out)] = {};u32 in[MLX5_ST_SZ_DW (delete_fte_in)] = {};MLX5_SET (delete_fte_in, in, opcode,MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY );MLX5_SET (delete_fte_in, in, table_type, table_type);MLX5_SET (delete_fte_in, in, table_id, table_id); -return mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (mdev, delete_fte, in); } int mlx5dr_cmd_alloc_modify_header(struct mlx5_core_dev *mdev,
@@ -263,7 +261,6 @@ int mlx5dr_cmd_alloc_modify_header(struct mlx5_core_dev *mdev,int mlx5dr_cmd_dealloc_modify_header (struct mlx5_core_dev *mdev,u32 modify_header_id) { -u32 out[MLX5_ST_SZ_DW (dealloc_modify_header_context_out)] = {};u32 in[MLX5_ST_SZ_DW (dealloc_modify_header_context_in)] = {}; MLX5_SET(dealloc_modify_header_context_in, in, opcode,
@@ -271,7 +268,7 @@ int mlx5dr_cmd_dealloc_modify_header(struct mlx5_core_dev *mdev,MLX5_SET (dealloc_modify_header_context_in, in, modify_header_id, modify_header_id); -return mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (mdev, dealloc_modify_header_context, in); } int mlx5dr_cmd_create_empty_flow_group(struct mlx5_core_dev *mdev,
@@ -292,7 +289,7 @@ int mlx5dr_cmd_create_empty_flow_group(struct mlx5_core_dev *mdev,MLX5_SET (create_flow_group_in, in, table_type, table_type);MLX5_SET (create_flow_group_in, in, table_id, table_id); - err =mlx5_cmd_exec (mdev, in, inlen, out,sizeof (out)); + err =mlx5_cmd_exec_inout (mdev, create_flow_group, in, out);if (err) goto out;
@@ -309,14 +306,14 @@ int mlx5dr_cmd_destroy_flow_group(struct mlx5_core_dev *mdev, u32 group_id) {u32 in[MLX5_ST_SZ_DW (destroy_flow_group_in)] = {}; -u32 out[MLX5_ST_SZ_DW (destroy_flow_group_out)] = {}; -MLX5_SET (create_flow_group_in, in, opcode,MLX5_CMD_OP_DESTROY_FLOW_GROUP ); +MLX5_SET (destroy_flow_group_in, in, opcode, +MLX5_CMD_OP_DESTROY_FLOW_GROUP );MLX5_SET (destroy_flow_group_in, in, table_type, table_type);MLX5_SET (destroy_flow_group_in, in, table_id, table_id);MLX5_SET (destroy_flow_group_in, in, group_id, group_id); -return mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (mdev, destroy_flow_group, in); } int mlx5dr_cmd_create_flow_table(struct mlx5_core_dev *mdev,
@@ -360,7 +357,7 @@ int mlx5dr_cmd_create_flow_table(struct mlx5_core_dev *mdev,MLX5_SET (create_flow_table_in, in, flow_table_context.reformat_en, attr->reformat_en); - err =mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (mdev, create_flow_table, in, out);if (err)return err;
@@ -379,7 +376,6 @@ int mlx5dr_cmd_destroy_flow_table(struct mlx5_core_dev *mdev, u32 table_id, u32 table_type) { -u32 out[MLX5_ST_SZ_DW (destroy_flow_table_out)] = {};u32 in[MLX5_ST_SZ_DW (destroy_flow_table_in)] = {}; MLX5_SET(destroy_flow_table_in, in, opcode,
@@ -387,7 +383,7 @@ int mlx5dr_cmd_destroy_flow_table(struct mlx5_core_dev *mdev,MLX5_SET (destroy_flow_table_in, in, table_type, table_type);MLX5_SET (destroy_flow_table_in, in, table_id, table_id); -return mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (mdev, destroy_flow_table, in); } int mlx5dr_cmd_create_reformat_ctx(struct mlx5_core_dev *mdev,
@@ -434,7 +430,6 @@ int mlx5dr_cmd_create_reformat_ctx(struct mlx5_core_dev *mdev,void mlx5dr_cmd_destroy_reformat_ctx (struct mlx5_core_dev *mdev,u32 reformat_id) { -u32 out[MLX5_ST_SZ_DW (dealloc_packet_reformat_context_out)] = {};u32 in[MLX5_ST_SZ_DW (dealloc_packet_reformat_context_in)] = {}; MLX5_SET(dealloc_packet_reformat_context_in, in, opcode,
@@ -442,7 +437,7 @@ void mlx5dr_cmd_destroy_reformat_ctx(struct mlx5_core_dev *mdev,MLX5_SET (dealloc_packet_reformat_context_in, in, packet_reformat_id, reformat_id); -mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); +mlx5_cmd_exec_in (mdev, dealloc_packet_reformat_context, in); } int mlx5dr_cmd_query_gid(struct mlx5_core_dev *mdev, u8 vhca_port_num,
@@ -458,7 +453,7 @@ int mlx5dr_cmd_query_gid(struct mlx5_core_dev *mdev, u8 vhca_port_num,MLX5_SET (query_roce_address_in, in, roce_address_index, index);MLX5_SET (query_roce_address_in, in, vhca_port_num, vhca_port_num); - err =mlx5_cmd_exec (mdev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (mdev, query_roce_address, in, out);if (err)return err;
Signature · 1 line
2.25.2
PATCH 20/24 net/mlx5: Update uar.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of uar.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
--- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/uar.c +5 -6
@@ -38,12 +38,12 @@int mlx5_cmd_alloc_uar (struct mlx5_core_dev *dev,u32 *uarn) { -u32 out[MLX5_ST_SZ_DW (alloc_uar_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (alloc_uar_in)] = {0 }; +u32 out[MLX5_ST_SZ_DW (alloc_uar_out)] = {}; +u32 in[MLX5_ST_SZ_DW (alloc_uar_in)] = {};int err;MLX5_SET (alloc_uar_in, in, opcode,MLX5_CMD_OP_ALLOC_UAR ); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_inout (dev, alloc_uar, in, out);if (!err) *uarn =MLX5_GET (alloc_uar_out, out, uar);return err;
@@ -52,12 +52,11 @@ EXPORT_SYMBOL(mlx5_cmd_alloc_uar);int mlx5_cmd_free_uar (struct mlx5_core_dev *dev,u32 uarn) { -u32 out[MLX5_ST_SZ_DW (dealloc_uar_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (dealloc_uar_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (dealloc_uar_in)] = {};MLX5_SET (dealloc_uar_in, in, opcode,MLX5_CMD_OP_DEALLOC_UAR );MLX5_SET (dealloc_uar_in, in, uar, uarn); -return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); +return mlx5_cmd_exec_in (dev, dealloc_uar, in); }EXPORT_SYMBOL (mlx5_cmd_free_uar);
Signature · 1 line
2.25.2
PATCH 24/24 net/mlx5: Update transobj.c new cmd interface
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Do mass update of transobj.c to reuse newly introduced mlx5_cmd_exec_in*() interfaces.
--- drivers/infiniband/hw/mlx5/qp.c | 32 +++-- drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 +- .../ethernet/mellanox/mlx5/core/en_common.c | 7 +- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 2 +- .../mellanox/mlx5/core/en_fs_ethtool.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 29 ++--- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 6 +- .../ethernet/mellanox/mlx5/core/transobj.c | 113 +++++++----------- include/linux/mlx5/transobj.h | 19 +-- 9 files changed, 85 insertions(+), 131 deletions(-)
drivers/infiniband/hw/mlx5/qp.c +15 -17
@@ -1255,7 +1255,7 @@ static int create_raw_packet_qp_tis(struct mlx5_ib_dev *dev, struct mlx5_ib_sq *sq, u32 tdn, struct ib_pd *pd) { - u32 in[MLX5_ST_SZ_DW(create_tis_in)] = {0}; + u32 in[MLX5_ST_SZ_DW(create_tis_in)] = {};void *tisc =MLX5_ADDR_OF (create_tis_in, in, ctx);MLX5_SET (create_tis_in, in, uid,to_mpd (pd)->uid);
@@ -1263,7 +1263,7 @@ static int create_raw_packet_qp_tis(struct mlx5_ib_dev *dev,if (qp->flags &MLX5_IB_QP_UNDERLAY )MLX5_SET (tisc, tisc, underlay_qpn, qp->underlay_qpn); -return mlx5_core_create_tis (dev->mdev, in,sizeof (in), &sq->tisn); +return mlx5_core_create_tis (dev->mdev, in, &sq->tisn); } static void destroy_raw_packet_qp_tis(struct mlx5_ib_dev *dev,
@@ -1460,9 +1460,8 @@ static void destroy_raw_packet_qp_tir(struct mlx5_ib_dev *dev,static int create_raw_packet_qp_tir (struct mlx5_ib_dev *dev,struct mlx5_ib_rq *rq,u32 tdn, -u32 *qp_flags_en, -struct ib_pd *pd, -u32 *out,int outlen) +u32 *qp_flags_en,struct ib_pd *pd, +u32 *out) {u8 lb_flag =0 ;u32 *in;
@@ -1495,9 +1494,8 @@ static int create_raw_packet_qp_tir(struct mlx5_ib_dev *dev, }MLX5_SET (tirc, tirc, self_lb_block, lb_flag); - - err =mlx5_core_create_tir_out (dev->mdev, in, inlen, out, outlen); - +MLX5_SET (create_tir_in, in, opcode,MLX5_CMD_OP_CREATE_TIR ); + err =mlx5_cmd_exec_inout (dev->mdev, create_tir, in, out); rq->tirn =MLX5_GET (create_tir_out, out, tirn);if (!err &&MLX5_GET (tirc, tirc, self_lb_block)) { err =mlx5_ib_enable_lb (dev, false, true);
@@ -1557,9 +1555,8 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,if (err) goto err_destroy_sq; - err =create_raw_packet_qp_tir ( - dev, rq, tdn, &qp->flags_en, pd, out, -MLX5_ST_SZ_BYTES (create_tir_out)); + err =create_raw_packet_qp_tir (dev, rq, tdn, &qp->flags_en, pd, + out);if (err) goto err_destroy_rq;
@@ -1854,7 +1851,8 @@ static int create_rss_raw_qp_tir(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,MLX5_SET (rx_hash_field_select, hfso, selected_fields, selected_fields); create_tir: - err =mlx5_core_create_tir_out (dev->mdev, in, inlen, out, outlen); +MLX5_SET (create_tir_in, in, opcode,MLX5_CMD_OP_CREATE_TIR ); + err =mlx5_cmd_exec_inout (dev->mdev, create_tir, in, out); qp->rss_qp.tirn =MLX5_GET (create_tir_out, out, tirn);if (!err &&MLX5_GET (tirc, tirc, self_lb_block)) {
@@ -2933,7 +2931,7 @@ static int modify_raw_packet_eth_prio(struct mlx5_core_dev *dev, tisc =MLX5_ADDR_OF (modify_tis_in, in, ctx);MLX5_SET (tisc, tisc, prio, ((sl &0x7 ) <<1 )); - err =mlx5_core_modify_tis (dev, sq->tisn, in, inlen); + err =mlx5_core_modify_tis (dev, sq->tisn, in);kvfree (in);
@@ -2960,7 +2958,7 @@ static int modify_raw_packet_tx_affinity(struct mlx5_core_dev *dev, tisc =MLX5_ADDR_OF (modify_tis_in, in, ctx);MLX5_SET (tisc, tisc, lag_tx_port_affinity, tx_affinity); - err =mlx5_core_modify_tis (dev, sq->tisn, in, inlen); + err =mlx5_core_modify_tis (dev, sq->tisn, in);kvfree (in);
@@ -3264,7 +3262,7 @@ static int modify_raw_packet_qp_rq( "RAW PACKET QP counters are not supported on current FW\n"); } - err =mlx5_core_modify_rq (dev->mdev, rq->base.mqp.qpn, in, inlen); + err =mlx5_core_modify_rq (dev->mdev, rq->base.mqp.qpn, in);if (err) goto out;
@@ -3327,7 +3325,7 @@ static int modify_raw_packet_qp_sq(MLX5_SET (sqc, sqc, packet_pacing_rate_limit_index, rl_index); } - err =mlx5_core_modify_sq (dev, sq->base.mqp.qpn, in, inlen); + err =mlx5_core_modify_sq (dev, sq->base.mqp.qpn, in);if (err) {/* Remove new rate from table if failed */ if (new_rate_added)
@@ -6497,7 +6495,7 @@ int mlx5_ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr, "Receive WQ counters are not supported on current FW\n"); } - err =mlx5_core_modify_rq (dev->mdev, rwq->core_qp.qpn, in, inlen); + err =mlx5_core_modify_rq (dev->mdev, rwq->core_qp.qpn, in);if (!err) rwq->ibwq.state = (wq_state ==MLX5_RQC_STATE_ERR ) ?IB_WQS_ERR : wq_state;
drivers/net/ethernet/mellanox/mlx5/core/en.h +3 -3
@@ -1012,7 +1012,7 @@ int mlx5e_redirect_rqt(struct mlx5e_priv *priv, u32 rqtn, int sz,void mlx5e_build_indir_tir_ctx_hash (struct mlx5e_rss_params *rss_params,const struct mlx5e_tirc_config *ttconfig,void *tirc,bool inner); -void mlx5e_modify_tirs_hash (struct mlx5e_priv *priv,void *in,int inlen); +void mlx5e_modify_tirs_hash (struct mlx5e_priv *priv,void *in);struct mlx5e_tirc_config mlx5e_tirc_get_default_config (enum mlx5e_traffic_types tt);struct mlx5e_xsk_param ;
@@ -1102,8 +1102,8 @@ void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv);void mlx5e_dcbnl_delete_app (struct mlx5e_priv *priv);#endif -int mlx5e_create_tir (struct mlx5_core_dev *mdev, -struct mlx5e_tir *tir,u32 *in,int inlen); +int mlx5e_create_tir (struct mlx5_core_dev *mdev,struct mlx5e_tir *tir, +u32 *in);void mlx5e_destroy_tir (struct mlx5_core_dev *mdev,struct mlx5e_tir *tir);int mlx5e_create_mdev_resources (struct mlx5_core_dev *mdev);
drivers/net/ethernet/mellanox/mlx5/core/en_common.c +3 -4
@@ -36,12 +36,11 @@* Global resources are common to all the netdevices crated on the same nic. */ -int mlx5e_create_tir (struct mlx5_core_dev *mdev, -struct mlx5e_tir *tir,u32 *in,int inlen) +int mlx5e_create_tir (struct mlx5_core_dev *mdev,struct mlx5e_tir *tir,u32 *in) {int err; - err =mlx5_core_create_tir (mdev, in, inlen, &tir->tirn); + err =mlx5_core_create_tir (mdev, in, &tir->tirn);if (err)return err;
@@ -167,7 +166,7 @@ int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb)mutex_lock (&mdev->mlx5e_res.td.list_lock);list_for_each_entry (tir, &mdev->mlx5e_res.td.tirs_list, list) { tirn = tir->tirn; - err =mlx5_core_modify_tir (mdev, tirn, in, inlen); + err =mlx5_core_modify_tir (mdev, tirn, in);if (err) goto out; }
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 -1
@@ -1204,7 +1204,7 @@ int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, }if (hash_changed) -mlx5e_modify_tirs_hash (priv, in, inlen); +mlx5e_modify_tirs_hash (priv, in);mutex_unlock (&priv->state_lock);
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c +1 -1
@@ -858,7 +858,7 @@ static int mlx5e_set_rss_hash_opt(struct mlx5e_priv *priv, goto out; priv->rss_params.rx_hash_fields[tt] = rx_hash_field; -mlx5e_modify_tirs_hash (priv, in, inlen); +mlx5e_modify_tirs_hash (priv, in); out:mutex_unlock (&priv->state_lock);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +13 -16
@@ -721,7 +721,7 @@ int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state, int next_state)MLX5_SET (modify_rq_in, in, rq_state, curr_state);MLX5_SET (rqc, rqc, state, next_state); - err =mlx5_core_modify_rq (mdev, rq->rqn, in, inlen); + err =mlx5_core_modify_rq (mdev, rq->rqn, in);kvfree (in);
@@ -752,7 +752,7 @@ static int mlx5e_modify_rq_scatter_fcs(struct mlx5e_rq *rq, bool enable)MLX5_SET (rqc, rqc, scatter_fcs, enable);MLX5_SET (rqc, rqc, state,MLX5_RQC_STATE_RDY ); - err =mlx5_core_modify_rq (mdev, rq->rqn, in, inlen); + err =mlx5_core_modify_rq (mdev, rq->rqn, in);kvfree (in);
@@ -781,7 +781,7 @@ static int mlx5e_modify_rq_vsd(struct mlx5e_rq *rq, bool vsd)MLX5_SET (rqc, rqc, vsd, vsd);MLX5_SET (rqc, rqc, state,MLX5_RQC_STATE_RDY ); - err =mlx5_core_modify_rq (mdev, rq->rqn, in, inlen); + err =mlx5_core_modify_rq (mdev, rq->rqn, in);kvfree (in);
@@ -1259,7 +1259,7 @@ int mlx5e_modify_sq(struct mlx5_core_dev *mdev, u32 sqn,MLX5_SET (sqc, sqc, packet_pacing_rate_limit_index, p->rl_index); } - err =mlx5_core_modify_sq (mdev, sqn, in, inlen); + err =mlx5_core_modify_sq (mdev, sqn, in);kvfree (in);
@@ -2698,7 +2698,7 @@ static void mlx5e_update_rx_hash_fields(struct mlx5e_tirc_config *ttconfig, ttconfig->rx_hash_fields = rx_hash_fields; } -void mlx5e_modify_tirs_hash (struct mlx5e_priv *priv,void *in,int inlen) +void mlx5e_modify_tirs_hash (struct mlx5e_priv *priv,void *in) {void *tirc =MLX5_ADDR_OF (modify_tir_in, in, ctx);struct mlx5e_rss_params *rss = &priv->rss_params;
@@ -2714,7 +2714,7 @@ void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen)mlx5e_update_rx_hash_fields (&ttconfig, tt, rss->rx_hash_fields[tt]);mlx5e_build_indir_tir_ctx_hash (rss, &ttconfig, tirc, false); -mlx5_core_modify_tir (mdev, priv->indir_tir[tt].tirn, in, inlen); +mlx5_core_modify_tir (mdev, priv->indir_tir[tt].tirn, in); }if (!mlx5e_tunnel_inner_ft_supported (priv->mdev))
@@ -2725,8 +2725,7 @@ void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen)mlx5e_update_rx_hash_fields (&ttconfig, tt, rss->rx_hash_fields[tt]);mlx5e_build_indir_tir_ctx_hash (rss, &ttconfig, tirc, true); -mlx5_core_modify_tir (mdev, priv->inner_indir_tir[tt].tirn, in, - inlen); +mlx5_core_modify_tir (mdev, priv->inner_indir_tir[tt].tirn, in); } }
@@ -2752,15 +2751,13 @@ static int mlx5e_modify_tirs_lro(struct mlx5e_priv *priv)mlx5e_build_tir_ctx_lro (&priv->channels.params, tirc);for (tt =0 ; tt <MLX5E_NUM_INDIR_TIRS ; tt++) { - err =mlx5_core_modify_tir (mdev, priv->indir_tir[tt].tirn, in, - inlen); + err =mlx5_core_modify_tir (mdev, priv->indir_tir[tt].tirn, in);if (err) goto free_in; }for (ix =0 ; ix < priv->max_nch; ix++) { - err =mlx5_core_modify_tir (mdev, priv->direct_tir[ix].tirn, - in, inlen); + err =mlx5_core_modify_tir (mdev, priv->direct_tir[ix].tirn, in);if (err) goto free_in; }
@@ -3214,7 +3211,7 @@ int mlx5e_create_tis(struct mlx5_core_dev *mdev, void *in, u32 *tisn)if (mlx5_lag_is_lacp_owner (mdev))MLX5_SET (tisc, tisc, strict_lag_tx_port_affinity,1 ); -return mlx5_core_create_tis (mdev, in,MLX5_ST_SZ_BYTES (create_tis_in), tisn); +return mlx5_core_create_tis (mdev, in, tisn); }void mlx5e_destroy_tis (struct mlx5_core_dev *mdev,u32 tisn)
@@ -3332,7 +3329,7 @@ int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc) tir = &priv->indir_tir[tt]; tirc =MLX5_ADDR_OF (create_tir_in, in, ctx);mlx5e_build_indir_tir_ctx (priv, tt, tirc); - err =mlx5e_create_tir (priv->mdev, tir, in, inlen); + err =mlx5e_create_tir (priv->mdev, tir, in);if (err) {mlx5_core_warn (priv->mdev,"create indirect tirs failed, %d\n" , err); goto err_destroy_inner_tirs;
@@ -3347,7 +3344,7 @@ int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc) tir = &priv->inner_indir_tir[i]; tirc =MLX5_ADDR_OF (create_tir_in, in, ctx);mlx5e_build_inner_indir_tir_ctx (priv, i, tirc); - err =mlx5e_create_tir (priv->mdev, tir, in, inlen); + err =mlx5e_create_tir (priv->mdev, tir, in);if (err) {mlx5_core_warn (priv->mdev,"create inner indirect tirs failed, %d\n" , err); goto err_destroy_inner_tirs;
@@ -3390,7 +3387,7 @@ int mlx5e_create_direct_tirs(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) tir = &tirs[ix]; tirc =MLX5_ADDR_OF (create_tir_in, in, ctx);mlx5e_build_direct_tir_ctx (priv, tir->rqt.rqtn, tirc); - err =mlx5e_create_tir (priv->mdev, tir, in, inlen); + err =mlx5e_create_tir (priv->mdev, tir, in);if (unlikely (err)) goto err_destroy_ch_tirs; }
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +3 -3
@@ -568,7 +568,7 @@ struct mlx5_core_dev *mlx5e_hairpin_get_mdev(struct net *net, int ifindex)static int mlx5e_hairpin_create_transport (struct mlx5e_hairpin *hp) { -u32 in[MLX5_ST_SZ_DW (create_tir_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (create_tir_in)] = {};void *tirc;int err;
@@ -582,7 +582,7 @@ static int mlx5e_hairpin_create_transport(struct mlx5e_hairpin *hp)MLX5_SET (tirc, tirc, inline_rqn, hp->pair->rqn[0 ]);MLX5_SET (tirc, tirc, transport_domain, hp->tdn); - err =mlx5_core_create_tir (hp->func_mdev, in,MLX5_ST_SZ_BYTES (create_tir_in), &hp->tirn); + err =mlx5_core_create_tir (hp->func_mdev, in, &hp->tirn);if (err) goto create_tir_err;
@@ -666,7 +666,7 @@ static int mlx5e_hairpin_create_indirect_tirs(struct mlx5e_hairpin *hp)mlx5e_build_indir_tir_ctx_hash (&priv->rss_params, &ttconfig, tirc, false); err =mlx5_core_create_tir (hp->func_mdev, in, -MLX5_ST_SZ_BYTES (create_tir_in), &hp->indir_tirn[tt]); + &hp->indir_tirn[tt]);if (err) {mlx5_core_warn (hp->func_mdev,"create indirect tirs failed, %d\n" , err); goto err_destroy_tirs;
drivers/net/ethernet/mellanox/mlx5/core/transobj.c +40 -73
285 lines not on this page · raw message
include/linux/mlx5/transobj.h +6 -13
@@ -39,27 +39,20 @@ int mlx5_core_alloc_transport_domain(struct mlx5_core_dev *dev, u32 *tdn);void mlx5_core_dealloc_transport_domain (struct mlx5_core_dev *dev,u32 tdn);int mlx5_core_create_rq (struct mlx5_core_dev *dev,u32 *in,int inlen,u32 *rqn); -int mlx5_core_modify_rq (struct mlx5_core_dev *dev,u32 rqn,u32 *in,int inlen); +int mlx5_core_modify_rq (struct mlx5_core_dev *dev,u32 rqn,u32 *in);void mlx5_core_destroy_rq (struct mlx5_core_dev *dev,u32 rqn);int mlx5_core_query_rq (struct mlx5_core_dev *dev,u32 rqn,u32 *out);int mlx5_core_create_sq (struct mlx5_core_dev *dev,u32 *in,int inlen,u32 *sqn); -int mlx5_core_modify_sq (struct mlx5_core_dev *dev,u32 sqn,u32 *in,int inlen); +int mlx5_core_modify_sq (struct mlx5_core_dev *dev,u32 sqn,u32 *in);void mlx5_core_destroy_sq (struct mlx5_core_dev *dev,u32 sqn);int mlx5_core_query_sq (struct mlx5_core_dev *dev,u32 sqn,u32 *out);int mlx5_core_query_sq_state (struct mlx5_core_dev *dev,u32 sqn,u8 *state); -int mlx5_core_create_tir (struct mlx5_core_dev *dev,u32 *in,int inlen, -u32 *tirn); -int mlx5_core_create_tir_out (struct mlx5_core_dev *dev, -u32 *in,int inlen, -u32 *out,int outlen); -int mlx5_core_modify_tir (struct mlx5_core_dev *dev,u32 tirn,u32 *in, -int inlen); +int mlx5_core_create_tir (struct mlx5_core_dev *dev,u32 *in,u32 *tirn); +int mlx5_core_modify_tir (struct mlx5_core_dev *dev,u32 tirn,u32 *in);void mlx5_core_destroy_tir (struct mlx5_core_dev *dev,u32 tirn); -int mlx5_core_create_tis (struct mlx5_core_dev *dev,u32 *in,int inlen, -u32 *tisn); -int mlx5_core_modify_tis (struct mlx5_core_dev *dev,u32 tisn,u32 *in, -int inlen); +int mlx5_core_create_tis (struct mlx5_core_dev *dev,u32 *in,u32 *tisn); +int mlx5_core_modify_tis (struct mlx5_core_dev *dev,u32 tisn,u32 *in);void mlx5_core_destroy_tis (struct mlx5_core_dev *dev,u32 tisn);int mlx5_core_create_rqt (struct mlx5_core_dev *dev,u32 *in,int inlen,u32 *rqtn);
Signature · 1 line
2.25.2
Re: [PATCH mlx5-next 02/24] net/mlx5: Update cq.c to new cmd interface
In reply to Leon RomanovskyQuoted 79 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Do mass update of
cq.cto reuse newly introduced
mlx5_cmd_exec_in*() interfaces.Reviewed-by Moshe Shemesh <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/cq.c | 24 +++++++------------ .../net/ethernet/mellanox/mlx5/core/debugfs.c | 2 +- .../ethernet/mellanox/mlx5/core/en/health.c | 2 +- include/linux/mlx5/cq.h | 2 +- 4 files changed, 12 insertions(+), 18 deletions(-)drivers/net/ethernet/mellanox/mlx5/core/cq.c +7
-11@@ -90,8 +90,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, u32 *in, int inlen, u32 *out, int outlen) { int eqn = MLX5_GET(cqc, MLX5_ADDR_OF(create_cq_in, in, cq_context), c_eqn); -u32 dout[MLX5_ST_SZ_DW (destroy_cq_out)]; -u32 din[MLX5_ST_SZ_DW (destroy_cq_in)]; +u32 din[MLX5_ST_SZ_DW (destroy_cq_in)] = {};struct mlx5_eq_comp *eq;int err;@@ -141,20 +140,17 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, err_cq_add:mlx5_eq_del_cq (&eq->core, cq); err_cmd: -memset (din,0 ,sizeof (din)); -memset (dout,0 ,sizeof (dout));MLX5_SET (destroy_cq_in, din, opcode,MLX5_CMD_OP_DESTROY_CQ );MLX5_SET (destroy_cq_in, din, cqn, cq->cqn);MLX5_SET (destroy_cq_in, din, uid, cq->uid); -mlx5_cmd_exec (dev, din,sizeof (din), dout,sizeof (dout)); +mlx5_cmd_exec_in (dev, destroy_cq, din);return err; }EXPORT_SYMBOL (mlx5_core_create_cq);int mlx5_core_destroy_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq) { -u32 out[MLX5_ST_SZ_DW (destroy_cq_out)] = {0 }; -u32 in[MLX5_ST_SZ_DW (destroy_cq_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (destroy_cq_in)] = {};int err;mlx5_eq_del_cq (mlx5_get_async_eq (dev), cq);@@ -163,7 +159,7 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq)MLX5_SET (destroy_cq_in, in, opcode,MLX5_CMD_OP_DESTROY_CQ );MLX5_SET (destroy_cq_in, in, cqn, cq->cqn);MLX5_SET (destroy_cq_in, in, uid, cq->uid); - err =mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); + err =mlx5_cmd_exec_in (dev, destroy_cq, in);if (err)return err;@@ -178,24 +174,22 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq)EXPORT_SYMBOL (mlx5_core_destroy_cq);int mlx5_core_query_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq, -u32 *out,int outlen) +u32 *out) { -u32 in[MLX5_ST_SZ_DW (query_cq_in)] = {0 }; +u32 in[MLX5_ST_SZ_DW (query_cq_in)] = {};MLX5_SET (query_cq_in, in, opcode,MLX5_CMD_OP_QUERY_CQ );MLX5_SET (query_cq_in, in, cqn, cq->cqn); -return mlx5_cmd_exec (dev, in,sizeof (in), out, outlen); +return mlx5_cmd_exec_inout (dev, query_cq, in, out); }EXPORT_SYMBOL (mlx5_core_query_cq);int mlx5_core_modify_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq,u32 *in,int inlen)
drivers/net/ethernet/mellanox/mlx5/core/cq.c int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq) · line 195
Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/cq.c +1
-3{ -u32 out[MLX5_ST_SZ_DW (modify_cq_out)] = {0 }; -MLX5_SET (modify_cq_in, in, opcode,MLX5_CMD_OP_MODIFY_CQ );MLX5_SET (modify_cq_in, in, uid, cq->uid); -return mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); +return mlx5_cmd_exec_in (dev, modify_cq, in); }EXPORT_SYMBOL (mlx5_core_modify_cq);
This hunk needs this fixup:
drivers/net/ethernet/mellanox/mlx5/core/cq.c +3 -1
@@ -187,9 +187,11 @@ EXPORT_SYMBOL(mlx5_core_query_cq);int mlx5_core_modify_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq,u32 *in,int inlen) { +u32 out[MLX5_ST_SZ_DW (modify_cq_out)] = {}; +MLX5_SET (modify_cq_in, in, opcode,MLX5_CMD_OP_MODIFY_CQ );MLX5_SET (modify_cq_in, in, uid, cq->uid); -return mlx5_cmd_exec_in (dev, modify_cq, in); +return mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); }EXPORT_SYMBOL (mlx5_core_modify_cq);
Thanks
Re: [PATCH mlx5-next 02/24] net/mlx5: Update cq.c to new cmd interface
Quoted 20 lines · Leon Romanovsky
drivers/net/ethernet/mellanox/mlx5/core/cq.c EXPORT_SYMBOL(mlx5_core_query_cq); · line 196
Quoted 12 lines
int mlx5_core_modify_cq(struct
mlx5_core_dev*dev, structmlx5_core_cq*cq,drivers/net/ethernet/mellanox/mlx5/core/cq.c +1
-3u32 *in, int inlen) { -u32 out[MLX5_ST_SZ_DW (modify_cq_out)] = {0 }; -MLX5_SET (modify_cq_in ,in ,opcode ,MLX5_CMD_OP_MODIFY_CQ );MLX5_SET (modify_cq_in, in, uid, cq->uid); -return mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); +return mlx5_cmd_exec_in (dev, modify_cq, in); }EXPORT_SYMBOL (mlx5_core_modify_cq);This hunk needs this fixup:
drivers/net/ethernet/mellanox/mlx5/core/cq.c +1
-0+++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c@@ -187,9 +187,11 @@ EXPORT_SYMBOL(mlx5_core_query_cq); int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
drivers/net/ethernet/mellanox/mlx5/core/cq.c EXPORT_SYMBOL(mlx5_core_query_cq); · line 196
Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/cq.c +3
-1u32 *in, int inlen) { +u32 out[MLX5_ST_SZ_DW (modify_cq_out)] = {}; +MLX5_SET (modify_cq_in, in, opcode,MLX5_CMD_OP_MODIFY_CQ );MLX5_SET (modify_cq_in, in, uid, cq->uid); -return mlx5_cmd_exec_in (dev, modify_cq, in); +return mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); }EXPORT_SYMBOL (mlx5_core_modify_cq);
Why doesn't this one work with the helper?
Jason
Re: [PATCH mlx5-next 02/24] net/mlx5: Update cq.c to new cmd interface
Quoted 25 lines · Jason Gunthorpe
Quoted 24 lines · Leon Romanovsky
drivers/net/ethernet/mellanox/mlx5/core/cq.c EXPORT_SYMBOL(mlx5_core_query_cq); · line 196
Quoted 12 lines
int mlx5_core_modify_cq(struct
mlx5_core_dev*dev, structmlx5_core_cq*cq,drivers/net/ethernet/mellanox/mlx5/core/cq.c +1
-3u32 *in, int inlen) { -u32 out[MLX5_ST_SZ_DW (modify_cq_out)] = {0 }; -MLX5_SET (modify_cq_in ,in ,opcode ,MLX5_CMD_OP_MODIFY_CQ );MLX5_SET (modify_cq_in, in, uid, cq->uid); -return mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); +return mlx5_cmd_exec_in (dev, modify_cq, in); }EXPORT_SYMBOL (mlx5_core_modify_cq);This hunk needs this fixup:
drivers/net/ethernet/mellanox/mlx5/core/cq.c +3
-0+++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c@@ -187,9 +187,11 @@ EXPORT_SYMBOL(mlx5_core_query_cq);int mlx5_core_modify_cq (struct mlx5_core_dev *dev,struct mlx5_core_cq *cq,u32 *in,int inlen) { +u32 out[MLX5_ST_SZ_DW (modify_cq_out)] = {}; +
Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/cq.c EXPORT_SYMBOL(mlx5_core_query_cq); · line 196
Quoted 6 lines
drivers/net/ethernet/mellanox/mlx5/core/cq.c +1
-1MLX5_SET (modify_cq_in, in, opcode,MLX5_CMD_OP_MODIFY_CQ );MLX5_SET (modify_cq_in, in, uid, cq->uid); -return mlx5_cmd_exec_in (dev, modify_cq, in); +return mlx5_cmd_exec (dev, in, inlen, out,sizeof (out)); }EXPORT_SYMBOL (mlx5_core_modify_cq);Why doesn't this one work with the helper?
In the mlx5_ib_resize_cq() function inlen is equal to
1290 inlen = MLX5_ST_SZ_BYTES(modify_cq_in) +
1291 MLX5_FLD_SZ_BYTES(modify_cq_in, pas[0]) * npas;
and not to MLX5_ST_SZ_BYTES(modify_cq_in) like helper assumes.
Thanks
Quoted 2 lines
Jason
Leon Romanovsky
AppliedQuoted 11 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Hi,
This is a followup to "net/mlx5: Provide simplified command interfaces" [1] patch with conversion of everything in
mlx5_core.The patch separation is done by file to simplify bisection and they are all similar, but of course, I can squash it to one mega patch if it is necessary.
Quoted 5 lines
Thanks
[1] https://lore.kernel.org/linux-rdma/[email protected]
Leon Romanovsky (24):
Thanks, applied to mlx5-next.