Commit 5d1c9a11 authored by Leon Romanovsky's avatar Leon Romanovsky

net/mlx5: Update vport.c to new cmd interface

Do mass update of vport.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
parent 59e9e8e4
...@@ -134,7 +134,7 @@ int mlx5_ib_get_vf_stats(struct ib_device *device, int vf, ...@@ -134,7 +134,7 @@ int mlx5_ib_get_vf_stats(struct ib_device *device, int vf,
if (!out) if (!out)
return -ENOMEM; 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) if (err)
goto ex; goto ex;
......
...@@ -187,8 +187,8 @@ static int process_pma_cmd(struct mlx5_ib_dev *dev, u8 port_num, ...@@ -187,8 +187,8 @@ static int process_pma_cmd(struct mlx5_ib_dev *dev, u8 port_num,
goto done; goto done;
} }
err = mlx5_core_query_vport_counter(mdev, 0, 0, err = mlx5_core_query_vport_counter(mdev, 0, 0, mdev_port_num,
mdev_port_num, out_cnt, sz); out_cnt);
if (!err) if (!err)
pma_cnt_ext_assign(pma_cnt_ext, out_cnt); pma_cnt_ext_assign(pma_cnt_ext, out_cnt);
} else { } else {
......
...@@ -40,10 +40,11 @@ ...@@ -40,10 +40,11 @@
/* Mutex to hold while enabling or disabling RoCE */ /* Mutex to hold while enabling or disabling RoCE */
static DEFINE_MUTEX(mlx5_roce_en_lock); static DEFINE_MUTEX(mlx5_roce_en_lock);
static int _mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport)
u16 vport, u32 *out, int outlen)
{ {
u32 in[MLX5_ST_SZ_DW(query_vport_state_in)] = {0}; u32 out[MLX5_ST_SZ_DW(query_vport_state_out)] = {};
u32 in[MLX5_ST_SZ_DW(query_vport_state_in)] = {};
int err;
MLX5_SET(query_vport_state_in, in, opcode, MLX5_SET(query_vport_state_in, in, opcode,
MLX5_CMD_OP_QUERY_VPORT_STATE); MLX5_CMD_OP_QUERY_VPORT_STATE);
...@@ -52,14 +53,9 @@ static int _mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, ...@@ -52,14 +53,9 @@ static int _mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod,
if (vport) if (vport)
MLX5_SET(query_vport_state_in, in, other_vport, 1); MLX5_SET(query_vport_state_in, in, other_vport, 1);
return mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen); err = mlx5_cmd_exec_inout(mdev, query_vport_state, in, out);
} if (err)
return 0;
u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport)
{
u32 out[MLX5_ST_SZ_DW(query_vport_state_out)] = {0};
_mlx5_query_vport_state(mdev, opmod, vport, out, sizeof(out));
return MLX5_GET(query_vport_state_out, out, state); return MLX5_GET(query_vport_state_out, out, state);
} }
...@@ -67,8 +63,7 @@ u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport) ...@@ -67,8 +63,7 @@ u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport)
int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
u16 vport, u8 other_vport, u8 state) u16 vport, u8 other_vport, u8 state)
{ {
u32 in[MLX5_ST_SZ_DW(modify_vport_state_in)] = {0}; u32 in[MLX5_ST_SZ_DW(modify_vport_state_in)] = {};
u32 out[MLX5_ST_SZ_DW(modify_vport_state_out)] = {0};
MLX5_SET(modify_vport_state_in, in, opcode, MLX5_SET(modify_vport_state_in, in, opcode,
MLX5_CMD_OP_MODIFY_VPORT_STATE); MLX5_CMD_OP_MODIFY_VPORT_STATE);
...@@ -77,13 +72,13 @@ int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, ...@@ -77,13 +72,13 @@ int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
MLX5_SET(modify_vport_state_in, in, other_vport, other_vport); MLX5_SET(modify_vport_state_in, in, other_vport, other_vport);
MLX5_SET(modify_vport_state_in, in, admin_state, state); MLX5_SET(modify_vport_state_in, in, admin_state, state);
return mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out)); return mlx5_cmd_exec_in(mdev, modify_vport_state, in);
} }
static int mlx5_query_nic_vport_context(struct mlx5_core_dev *mdev, u16 vport, static int mlx5_query_nic_vport_context(struct mlx5_core_dev *mdev, u16 vport,
u32 *out, int outlen) u32 *out)
{ {
u32 in[MLX5_ST_SZ_DW(query_nic_vport_context_in)] = {0}; u32 in[MLX5_ST_SZ_DW(query_nic_vport_context_in)] = {};
MLX5_SET(query_nic_vport_context_in, in, opcode, MLX5_SET(query_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT); MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT);
...@@ -91,26 +86,16 @@ static int mlx5_query_nic_vport_context(struct mlx5_core_dev *mdev, u16 vport, ...@@ -91,26 +86,16 @@ static int mlx5_query_nic_vport_context(struct mlx5_core_dev *mdev, u16 vport,
if (vport) if (vport)
MLX5_SET(query_nic_vport_context_in, in, other_vport, 1); MLX5_SET(query_nic_vport_context_in, in, other_vport, 1);
return mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen); return mlx5_cmd_exec_inout(mdev, query_nic_vport_context, in, out);
}
static int mlx5_modify_nic_vport_context(struct mlx5_core_dev *mdev, void *in,
int inlen)
{
u32 out[MLX5_ST_SZ_DW(modify_nic_vport_context_out)] = {0};
MLX5_SET(modify_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
return mlx5_cmd_exec(mdev, in, inlen, out, sizeof(out));
} }
int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev,
u16 vport, u8 *min_inline) u16 vport, u8 *min_inline)
{ {
u32 out[MLX5_ST_SZ_DW(query_nic_vport_context_out)] = {0}; u32 out[MLX5_ST_SZ_DW(query_nic_vport_context_out)] = {};
int err; int err;
err = mlx5_query_nic_vport_context(mdev, vport, out, sizeof(out)); err = mlx5_query_nic_vport_context(mdev, vport, out);
if (!err) if (!err)
*min_inline = MLX5_GET(query_nic_vport_context_out, out, *min_inline = MLX5_GET(query_nic_vport_context_out, out,
nic_vport_context.min_wqe_inline_mode); nic_vport_context.min_wqe_inline_mode);
...@@ -139,8 +124,7 @@ EXPORT_SYMBOL_GPL(mlx5_query_min_inline); ...@@ -139,8 +124,7 @@ EXPORT_SYMBOL_GPL(mlx5_query_min_inline);
int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev, int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev,
u16 vport, u8 min_inline) u16 vport, u8 min_inline)
{ {
u32 in[MLX5_ST_SZ_DW(modify_nic_vport_context_in)] = {0}; u32 in[MLX5_ST_SZ_DW(modify_nic_vport_context_in)] = {};
int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in);
void *nic_vport_ctx; void *nic_vport_ctx;
MLX5_SET(modify_nic_vport_context_in, in, MLX5_SET(modify_nic_vport_context_in, in,
...@@ -152,23 +136,20 @@ int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev, ...@@ -152,23 +136,20 @@ int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev,
in, nic_vport_context); in, nic_vport_context);
MLX5_SET(nic_vport_context, nic_vport_ctx, MLX5_SET(nic_vport_context, nic_vport_ctx,
min_wqe_inline_mode, min_inline); min_wqe_inline_mode, min_inline);
MLX5_SET(modify_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
return mlx5_modify_nic_vport_context(mdev, in, inlen); return mlx5_cmd_exec_in(mdev, modify_nic_vport_context, in);
} }
int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
u16 vport, bool other, u8 *addr) u16 vport, bool other, u8 *addr)
{ {
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out); u32 out[MLX5_ST_SZ_DW(query_nic_vport_context_out)] = {};
u32 in[MLX5_ST_SZ_DW(query_nic_vport_context_in)] = {}; u32 in[MLX5_ST_SZ_DW(query_nic_vport_context_in)] = {};
u8 *out_addr; u8 *out_addr;
u32 *out;
int err; int err;
out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;
out_addr = MLX5_ADDR_OF(query_nic_vport_context_out, out, out_addr = MLX5_ADDR_OF(query_nic_vport_context_out, out,
nic_vport_context.permanent_address); nic_vport_context.permanent_address);
...@@ -177,11 +158,10 @@ int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, ...@@ -177,11 +158,10 @@ int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
MLX5_SET(query_nic_vport_context_in, in, vport_number, vport); MLX5_SET(query_nic_vport_context_in, in, vport_number, vport);
MLX5_SET(query_nic_vport_context_in, in, other_vport, other); MLX5_SET(query_nic_vport_context_in, in, other_vport, other);
err = mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen); err = mlx5_cmd_exec_inout(mdev, query_nic_vport_context, in, out);
if (!err) if (!err)
ether_addr_copy(addr, &out_addr[2]); ether_addr_copy(addr, &out_addr[2]);
kvfree(out);
return err; return err;
} }
EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_mac_address); EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_mac_address);
...@@ -216,8 +196,10 @@ int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *mdev, ...@@ -216,8 +196,10 @@ int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *mdev,
permanent_address); permanent_address);
ether_addr_copy(&perm_mac[2], addr); ether_addr_copy(&perm_mac[2], addr);
MLX5_SET(modify_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
err = mlx5_modify_nic_vport_context(mdev, in, inlen); err = mlx5_cmd_exec_in(mdev, modify_nic_vport_context, in);
kvfree(in); kvfree(in);
...@@ -235,7 +217,7 @@ int mlx5_query_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 *mtu) ...@@ -235,7 +217,7 @@ int mlx5_query_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 *mtu)
if (!out) if (!out)
return -ENOMEM; return -ENOMEM;
err = mlx5_query_nic_vport_context(mdev, 0, out, outlen); err = mlx5_query_nic_vport_context(mdev, 0, out);
if (!err) if (!err)
*mtu = MLX5_GET(query_nic_vport_context_out, out, *mtu = MLX5_GET(query_nic_vport_context_out, out,
nic_vport_context.mtu); nic_vport_context.mtu);
...@@ -257,8 +239,10 @@ int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu) ...@@ -257,8 +239,10 @@ int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu)
MLX5_SET(modify_nic_vport_context_in, in, field_select.mtu, 1); MLX5_SET(modify_nic_vport_context_in, in, field_select.mtu, 1);
MLX5_SET(modify_nic_vport_context_in, in, nic_vport_context.mtu, mtu); MLX5_SET(modify_nic_vport_context_in, in, nic_vport_context.mtu, mtu);
MLX5_SET(modify_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
err = mlx5_modify_nic_vport_context(mdev, in, inlen); err = mlx5_cmd_exec_in(mdev, modify_nic_vport_context, in);
kvfree(in); kvfree(in);
return err; return err;
...@@ -292,7 +276,7 @@ int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev, ...@@ -292,7 +276,7 @@ int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev,
req_list_size = max_list_size; req_list_size = max_list_size;
} }
out_sz = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in) + out_sz = MLX5_ST_SZ_BYTES(query_nic_vport_context_in) +
req_list_size * MLX5_ST_SZ_BYTES(mac_address_layout); req_list_size * MLX5_ST_SZ_BYTES(mac_address_layout);
out = kzalloc(out_sz, GFP_KERNEL); out = kzalloc(out_sz, GFP_KERNEL);
...@@ -332,7 +316,7 @@ int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev, ...@@ -332,7 +316,7 @@ int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev,
u8 addr_list[][ETH_ALEN], u8 addr_list[][ETH_ALEN],
int list_size) int list_size)
{ {
u32 out[MLX5_ST_SZ_DW(modify_nic_vport_context_out)]; u32 out[MLX5_ST_SZ_DW(modify_nic_vport_context_out)] = {};
void *nic_vport_ctx; void *nic_vport_ctx;
int max_list_size; int max_list_size;
int in_sz; int in_sz;
...@@ -350,7 +334,6 @@ int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev, ...@@ -350,7 +334,6 @@ int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev,
in_sz = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in) + in_sz = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in) +
list_size * MLX5_ST_SZ_BYTES(mac_address_layout); list_size * MLX5_ST_SZ_BYTES(mac_address_layout);
memset(out, 0, sizeof(out));
in = kzalloc(in_sz, GFP_KERNEL); in = kzalloc(in_sz, GFP_KERNEL);
if (!in) if (!in)
return -ENOMEM; return -ENOMEM;
...@@ -442,7 +425,7 @@ int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, ...@@ -442,7 +425,7 @@ int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
if (!out) if (!out)
return -ENOMEM; return -ENOMEM;
mlx5_query_nic_vport_context(mdev, 0, out, outlen); mlx5_query_nic_vport_context(mdev, 0, out);
*system_image_guid = MLX5_GET64(query_nic_vport_context_out, out, *system_image_guid = MLX5_GET64(query_nic_vport_context_out, out,
nic_vport_context.system_image_guid); nic_vport_context.system_image_guid);
...@@ -462,7 +445,7 @@ int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid) ...@@ -462,7 +445,7 @@ int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid)
if (!out) if (!out)
return -ENOMEM; return -ENOMEM;
mlx5_query_nic_vport_context(mdev, 0, out, outlen); mlx5_query_nic_vport_context(mdev, 0, out);
*node_guid = MLX5_GET64(query_nic_vport_context_out, out, *node_guid = MLX5_GET64(query_nic_vport_context_out, out,
nic_vport_context.node_guid); nic_vport_context.node_guid);
...@@ -498,8 +481,10 @@ int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, ...@@ -498,8 +481,10 @@ int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev,
nic_vport_context = MLX5_ADDR_OF(modify_nic_vport_context_in, nic_vport_context = MLX5_ADDR_OF(modify_nic_vport_context_in,
in, nic_vport_context); in, nic_vport_context);
MLX5_SET64(nic_vport_context, nic_vport_context, node_guid, node_guid); MLX5_SET64(nic_vport_context, nic_vport_context, node_guid, node_guid);
MLX5_SET(modify_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
err = mlx5_modify_nic_vport_context(mdev, in, inlen); err = mlx5_cmd_exec_in(mdev, modify_nic_vport_context, in);
kvfree(in); kvfree(in);
...@@ -516,7 +501,7 @@ int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev, ...@@ -516,7 +501,7 @@ int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
if (!out) if (!out)
return -ENOMEM; return -ENOMEM;
mlx5_query_nic_vport_context(mdev, 0, out, outlen); mlx5_query_nic_vport_context(mdev, 0, out);
*qkey_viol_cntr = MLX5_GET(query_nic_vport_context_out, out, *qkey_viol_cntr = MLX5_GET(query_nic_vport_context_out, out,
nic_vport_context.qkey_violation_counter); nic_vport_context.qkey_violation_counter);
...@@ -664,7 +649,7 @@ int mlx5_query_hca_vport_context(struct mlx5_core_dev *dev, ...@@ -664,7 +649,7 @@ int mlx5_query_hca_vport_context(struct mlx5_core_dev *dev,
struct mlx5_hca_vport_context *rep) struct mlx5_hca_vport_context *rep)
{ {
int out_sz = MLX5_ST_SZ_BYTES(query_hca_vport_context_out); int out_sz = MLX5_ST_SZ_BYTES(query_hca_vport_context_out);
int in[MLX5_ST_SZ_DW(query_hca_vport_context_in)] = {0}; int in[MLX5_ST_SZ_DW(query_hca_vport_context_in)] = {};
int is_group_manager; int is_group_manager;
void *out; void *out;
void *ctx; void *ctx;
...@@ -691,7 +676,7 @@ int mlx5_query_hca_vport_context(struct mlx5_core_dev *dev, ...@@ -691,7 +676,7 @@ int mlx5_query_hca_vport_context(struct mlx5_core_dev *dev,
if (MLX5_CAP_GEN(dev, num_ports) == 2) if (MLX5_CAP_GEN(dev, num_ports) == 2)
MLX5_SET(query_hca_vport_context_in, in, port_num, port_num); MLX5_SET(query_hca_vport_context_in, in, port_num, port_num);
err = mlx5_cmd_exec(dev, in, sizeof(in), out, out_sz); err = mlx5_cmd_exec_inout(dev, query_hca_vport_context, in, out);
if (err) if (err)
goto ex; goto ex;
...@@ -788,7 +773,7 @@ int mlx5_query_nic_vport_promisc(struct mlx5_core_dev *mdev, ...@@ -788,7 +773,7 @@ int mlx5_query_nic_vport_promisc(struct mlx5_core_dev *mdev,
if (!out) if (!out)
return -ENOMEM; return -ENOMEM;
err = mlx5_query_nic_vport_context(mdev, vport, out, outlen); err = mlx5_query_nic_vport_context(mdev, vport, out);
if (err) if (err)
goto out; goto out;
...@@ -825,8 +810,10 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev, ...@@ -825,8 +810,10 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev,
nic_vport_context.promisc_mc, promisc_mc); nic_vport_context.promisc_mc, promisc_mc);
MLX5_SET(modify_nic_vport_context_in, in, MLX5_SET(modify_nic_vport_context_in, in,
nic_vport_context.promisc_all, promisc_all); nic_vport_context.promisc_all, promisc_all);
MLX5_SET(modify_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
err = mlx5_modify_nic_vport_context(mdev, in, inlen); err = mlx5_cmd_exec_in(mdev, modify_nic_vport_context, in);
kvfree(in); kvfree(in);
...@@ -865,8 +852,10 @@ int mlx5_nic_vport_update_local_lb(struct mlx5_core_dev *mdev, bool enable) ...@@ -865,8 +852,10 @@ int mlx5_nic_vport_update_local_lb(struct mlx5_core_dev *mdev, bool enable)
if (MLX5_CAP_GEN(mdev, disable_local_lb_uc)) if (MLX5_CAP_GEN(mdev, disable_local_lb_uc))
MLX5_SET(modify_nic_vport_context_in, in, MLX5_SET(modify_nic_vport_context_in, in,
field_select.disable_uc_local_lb, 1); field_select.disable_uc_local_lb, 1);
MLX5_SET(modify_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
err = mlx5_modify_nic_vport_context(mdev, in, inlen); err = mlx5_cmd_exec_in(mdev, modify_nic_vport_context, in);
if (!err) if (!err)
mlx5_core_dbg(mdev, "%s local_lb\n", mlx5_core_dbg(mdev, "%s local_lb\n",
...@@ -888,7 +877,7 @@ int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev, bool *status) ...@@ -888,7 +877,7 @@ int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev, bool *status)
if (!out) if (!out)
return -ENOMEM; return -ENOMEM;
err = mlx5_query_nic_vport_context(mdev, 0, out, outlen); err = mlx5_query_nic_vport_context(mdev, 0, out);
if (err) if (err)
goto out; goto out;
...@@ -925,8 +914,10 @@ static int mlx5_nic_vport_update_roce_state(struct mlx5_core_dev *mdev, ...@@ -925,8 +914,10 @@ static int mlx5_nic_vport_update_roce_state(struct mlx5_core_dev *mdev,
MLX5_SET(modify_nic_vport_context_in, in, field_select.roce_en, 1); MLX5_SET(modify_nic_vport_context_in, in, field_select.roce_en, 1);
MLX5_SET(modify_nic_vport_context_in, in, nic_vport_context.roce_en, MLX5_SET(modify_nic_vport_context_in, in, nic_vport_context.roce_en,
state); state);
MLX5_SET(modify_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
err = mlx5_modify_nic_vport_context(mdev, in, inlen); err = mlx5_cmd_exec_in(mdev, modify_nic_vport_context, in);
kvfree(in); kvfree(in);
...@@ -965,16 +956,15 @@ int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev) ...@@ -965,16 +956,15 @@ int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev)
mutex_unlock(&mlx5_roce_en_lock); mutex_unlock(&mlx5_roce_en_lock);
return err; return err;
} }
EXPORT_SYMBOL_GPL(mlx5_nic_vport_disable_roce); EXPORT_SYMBOL(mlx5_nic_vport_disable_roce);
int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport, int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport,
int vf, u8 port_num, void *out, int vf, u8 port_num, void *out)
size_t out_sz)
{ {
int in_sz = MLX5_ST_SZ_BYTES(query_vport_counter_in); int in_sz = MLX5_ST_SZ_BYTES(query_vport_counter_in);
int is_group_manager; int is_group_manager;
void *in; void *in;
int err; int err;
is_group_manager = MLX5_CAP_GEN(dev, vport_group_manager); is_group_manager = MLX5_CAP_GEN(dev, vport_group_manager);
in = kvzalloc(in_sz, GFP_KERNEL); in = kvzalloc(in_sz, GFP_KERNEL);
...@@ -997,7 +987,7 @@ int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport, ...@@ -997,7 +987,7 @@ int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport,
if (MLX5_CAP_GEN(dev, num_ports) == 2) if (MLX5_CAP_GEN(dev, num_ports) == 2)
MLX5_SET(query_vport_counter_in, in, port_num, port_num); MLX5_SET(query_vport_counter_in, in, port_num, port_num);
err = mlx5_cmd_exec(dev, in, in_sz, out, out_sz); err = mlx5_cmd_exec_inout(dev, query_vport_counter, in, out);
free: free:
kvfree(in); kvfree(in);
return err; return err;
...@@ -1008,8 +998,8 @@ int mlx5_query_vport_down_stats(struct mlx5_core_dev *mdev, u16 vport, ...@@ -1008,8 +998,8 @@ int mlx5_query_vport_down_stats(struct mlx5_core_dev *mdev, u16 vport,
u8 other_vport, u64 *rx_discard_vport_down, u8 other_vport, u64 *rx_discard_vport_down,
u64 *tx_discard_vport_down) u64 *tx_discard_vport_down)
{ {
u32 out[MLX5_ST_SZ_DW(query_vnic_env_out)] = {0}; u32 out[MLX5_ST_SZ_DW(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)] = {};
int err; int err;
MLX5_SET(query_vnic_env_in, in, opcode, MLX5_SET(query_vnic_env_in, in, opcode,
...@@ -1018,7 +1008,7 @@ int mlx5_query_vport_down_stats(struct mlx5_core_dev *mdev, u16 vport, ...@@ -1018,7 +1008,7 @@ int mlx5_query_vport_down_stats(struct mlx5_core_dev *mdev, u16 vport,
MLX5_SET(query_vnic_env_in, in, vport_number, vport); MLX5_SET(query_vnic_env_in, in, vport_number, vport);
MLX5_SET(query_vnic_env_in, in, other_vport, other_vport); MLX5_SET(query_vnic_env_in, in, other_vport, other_vport);
err = mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out)); err = mlx5_cmd_exec_inout(mdev, query_vnic_env, in, out);
if (err) if (err)
return err; return err;
...@@ -1035,11 +1025,10 @@ int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev, ...@@ -1035,11 +1025,10 @@ int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev,
struct mlx5_hca_vport_context *req) struct mlx5_hca_vport_context *req)
{ {
int in_sz = MLX5_ST_SZ_BYTES(modify_hca_vport_context_in); int in_sz = MLX5_ST_SZ_BYTES(modify_hca_vport_context_in);
u8 out[MLX5_ST_SZ_BYTES(modify_hca_vport_context_out)];
int is_group_manager; int is_group_manager;
void *ctx;
void *in; void *in;
int err; int err;
void *ctx;
mlx5_core_dbg(dev, "vf %d\n", vf); mlx5_core_dbg(dev, "vf %d\n", vf);
is_group_manager = MLX5_CAP_GEN(dev, vport_group_manager); is_group_manager = MLX5_CAP_GEN(dev, vport_group_manager);
...@@ -1047,7 +1036,6 @@ int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev, ...@@ -1047,7 +1036,6 @@ int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev,
if (!in) if (!in)
return -ENOMEM; return -ENOMEM;
memset(out, 0, sizeof(out));
MLX5_SET(modify_hca_vport_context_in, in, opcode, MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT); MLX5_SET(modify_hca_vport_context_in, in, opcode, MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT);
if (other_vport) { if (other_vport) {
if (is_group_manager) { if (is_group_manager) {
...@@ -1074,7 +1062,7 @@ int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev, ...@@ -1074,7 +1062,7 @@ int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev,
MLX5_SET(hca_vport_context, ctx, cap_mask1, req->cap_mask1); MLX5_SET(hca_vport_context, ctx, cap_mask1, req->cap_mask1);
MLX5_SET(hca_vport_context, ctx, cap_mask1_field_select, MLX5_SET(hca_vport_context, ctx, cap_mask1_field_select,
req->cap_mask1_perm); req->cap_mask1_perm);
err = mlx5_cmd_exec(dev, in, in_sz, out, sizeof(out)); err = mlx5_cmd_exec_in(dev, modify_hca_vport_context, in);
ex: ex:
kfree(in); kfree(in);
return err; return err;
...@@ -1103,8 +1091,10 @@ int mlx5_nic_vport_affiliate_multiport(struct mlx5_core_dev *master_mdev, ...@@ -1103,8 +1091,10 @@ int mlx5_nic_vport_affiliate_multiport(struct mlx5_core_dev *master_mdev,
MLX5_SET(modify_nic_vport_context_in, in, MLX5_SET(modify_nic_vport_context_in, in,
nic_vport_context.affiliation_criteria, nic_vport_context.affiliation_criteria,
MLX5_CAP_GEN(port_mdev, affiliate_nic_vport_criteria)); MLX5_CAP_GEN(port_mdev, affiliate_nic_vport_criteria));
MLX5_SET(modify_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
err = mlx5_modify_nic_vport_context(port_mdev, in, inlen); err = mlx5_cmd_exec_in(port_mdev, modify_nic_vport_context, in);
if (err) if (err)
mlx5_nic_vport_disable_roce(port_mdev); mlx5_nic_vport_disable_roce(port_mdev);
...@@ -1129,8 +1119,10 @@ int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev) ...@@ -1129,8 +1119,10 @@ int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev)
nic_vport_context.affiliated_vhca_id, 0); nic_vport_context.affiliated_vhca_id, 0);
MLX5_SET(modify_nic_vport_context_in, in, MLX5_SET(modify_nic_vport_context_in, in,
nic_vport_context.affiliation_criteria, 0); nic_vport_context.affiliation_criteria, 0);
MLX5_SET(modify_nic_vport_context_in, in, opcode,
MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
err = mlx5_modify_nic_vport_context(port_mdev, in, inlen); err = mlx5_cmd_exec_in(port_mdev, modify_nic_vport_context, in);
if (!err) if (!err)
mlx5_nic_vport_disable_roce(port_mdev); mlx5_nic_vport_disable_roce(port_mdev);
...@@ -1170,4 +1162,4 @@ u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev) ...@@ -1170,4 +1162,4 @@ u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev)
{ {
return MLX5_SPECIAL_VPORTS(dev) + mlx5_core_max_vfs(dev); return MLX5_SPECIAL_VPORTS(dev) + mlx5_core_max_vfs(dev);
} }
EXPORT_SYMBOL(mlx5_eswitch_get_total_vports); EXPORT_SYMBOL_GPL(mlx5_eswitch_get_total_vports);
...@@ -127,8 +127,7 @@ int mlx5_query_vport_down_stats(struct mlx5_core_dev *mdev, u16 vport, ...@@ -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, u8 other_vport, u64 *rx_discard_vport_down,
u64 *tx_discard_vport_down); u64 *tx_discard_vport_down);
int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport, int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport,
int vf, u8 port_num, void *out, int vf, u8 port_num, void *out);
size_t out_sz);
int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev, int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev,
u8 other_vport, u8 port_num, u8 other_vport, u8 port_num,
int vf, int vf,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment