33 changes: 16 additions & 17 deletions drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Expand Up @@ -252,9 +252,9 @@ static void mlx5e_update_pport_counters(struct mlx5e_priv *priv)
void *out;
u32 *in;

in = mlx5_vzalloc(sz);
in = kvzalloc(sz, GFP_KERNEL);
if (!in)
goto free_out;
return;

MLX5_SET(ppcnt_reg, in, local_port, 1);

Expand Down Expand Up @@ -288,7 +288,6 @@ static void mlx5e_update_pport_counters(struct mlx5e_priv *priv)
MLX5_REG_PPCNT, 0, 0);
}

free_out:
kvfree(in);
}

Expand All @@ -314,7 +313,7 @@ static void mlx5e_update_pcie_counters(struct mlx5e_priv *priv)
if (!MLX5_CAP_MCAM_FEATURE(mdev, pcie_performance_group))
return;

in = mlx5_vzalloc(sz);
in = kvzalloc(sz, GFP_KERNEL);
if (!in)
return;

Expand Down Expand Up @@ -503,7 +502,7 @@ static int mlx5e_create_umr_mkey(struct mlx5_core_dev *mdev,
if (!MLX5E_VALID_NUM_MTTS(npages))
return -EINVAL;

in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -711,7 +710,7 @@ static int mlx5e_create_rq(struct mlx5e_rq *rq,

inlen = MLX5_ST_SZ_BYTES(create_rq_in) +
sizeof(u64) * rq->wq_ctrl.buf.npages;
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -748,7 +747,7 @@ static int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state,
int err;

inlen = MLX5_ST_SZ_BYTES(modify_rq_in);
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -776,7 +775,7 @@ static int mlx5e_modify_rq_scatter_fcs(struct mlx5e_rq *rq, bool enable)
int err;

inlen = MLX5_ST_SZ_BYTES(modify_rq_in);
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -805,7 +804,7 @@ static int mlx5e_modify_rq_vsd(struct mlx5e_rq *rq, bool vsd)
int err;

inlen = MLX5_ST_SZ_BYTES(modify_rq_in);
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -1134,7 +1133,7 @@ static int mlx5e_create_sq(struct mlx5_core_dev *mdev,

inlen = MLX5_ST_SZ_BYTES(create_sq_in) +
sizeof(u64) * csp->wq_ctrl->buf.npages;
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -1182,7 +1181,7 @@ static int mlx5e_modify_sq(struct mlx5_core_dev *mdev, u32 sqn,
int err;

inlen = MLX5_ST_SZ_BYTES(modify_sq_in);
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -1496,7 +1495,7 @@ static int mlx5e_create_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param)

inlen = MLX5_ST_SZ_BYTES(create_cq_in) +
sizeof(u64) * cq->wq_ctrl.frag_buf.npages;
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -2091,7 +2090,7 @@ mlx5e_create_rqt(struct mlx5e_priv *priv, int sz, struct mlx5e_rqt *rqt)
int i;

inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + sizeof(u32) * sz;
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -2210,7 +2209,7 @@ int mlx5e_redirect_rqt(struct mlx5e_priv *priv, u32 rqtn, int sz,
int err;

inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + sizeof(u32) * sz;
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -2433,7 +2432,7 @@ static int mlx5e_modify_tirs_lro(struct mlx5e_priv *priv)
int ix;

inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -2850,7 +2849,7 @@ int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv)
int tt;

inlen = MLX5_ST_SZ_BYTES(create_tir_in);
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -2889,7 +2888,7 @@ int mlx5e_create_direct_tirs(struct mlx5e_priv *priv)
int ix;

inlen = MLX5_ST_SZ_BYTES(create_tir_in);
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
Expand Up @@ -1738,7 +1738,7 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
}

flow = kzalloc(sizeof(*flow) + attr_size, GFP_KERNEL);
parse_attr = mlx5_vzalloc(sizeof(*parse_attr));
parse_attr = kvzalloc(sizeof(*parse_attr), GFP_KERNEL);
if (!parse_attr || !flow) {
err = -ENOMEM;
goto err_free;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/eq.c
Expand Up @@ -548,7 +548,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
inlen = MLX5_ST_SZ_BYTES(create_eq_in) +
MLX5_FLD_SZ_BYTES(create_eq_in, pas[0]) * eq->buf.npages;

in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in) {
err = -ENOMEM;
goto err_buf;
Expand Down
24 changes: 9 additions & 15 deletions drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
Expand Up @@ -248,11 +248,10 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule,
if (rx_rule)
match_header |= MLX5_MATCH_MISC_PARAMETERS;

spec = mlx5_vzalloc(sizeof(*spec));
if (!spec) {
esw_warn(esw->dev, "FDB: Failed to alloc match parameters\n");
spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
if (!spec)
return NULL;
}

dmac_v = MLX5_ADDR_OF(fte_match_param, spec->match_value,
outer_headers.dmac_47_16);
dmac_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria,
Expand Down Expand Up @@ -350,10 +349,9 @@ static int esw_create_legacy_fdb_table(struct mlx5_eswitch *esw, int nvports)
return -EOPNOTSUPP;
}

flow_group_in = mlx5_vzalloc(inlen);
flow_group_in = kvzalloc(inlen, GFP_KERNEL);
if (!flow_group_in)
return -ENOMEM;
memset(flow_group_in, 0, inlen);

table_size = BIT(MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size));

Expand Down Expand Up @@ -961,7 +959,7 @@ static int esw_vport_enable_egress_acl(struct mlx5_eswitch *esw,
return -EOPNOTSUPP;
}

flow_group_in = mlx5_vzalloc(inlen);
flow_group_in = kvzalloc(inlen, GFP_KERNEL);
if (!flow_group_in)
return -ENOMEM;

Expand Down Expand Up @@ -1078,7 +1076,7 @@ static int esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw,
return -EOPNOTSUPP;
}

flow_group_in = mlx5_vzalloc(inlen);
flow_group_in = kvzalloc(inlen, GFP_KERNEL);
if (!flow_group_in)
return -ENOMEM;

Expand Down Expand Up @@ -1241,11 +1239,9 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,
"vport[%d] configure ingress rules, vlan(%d) qos(%d)\n",
vport->vport, vport->info.vlan, vport->info.qos);

spec = mlx5_vzalloc(sizeof(*spec));
spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
if (!spec) {
err = -ENOMEM;
esw_warn(esw->dev, "vport[%d] configure ingress rules failed, err(%d)\n",
vport->vport, err);
goto out;
}

Expand Down Expand Up @@ -1322,11 +1318,9 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,
"vport[%d] configure egress rules, vlan(%d) qos(%d)\n",
vport->vport, vport->info.vlan, vport->info.qos);

spec = mlx5_vzalloc(sizeof(*spec));
spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
if (!spec) {
err = -ENOMEM;
esw_warn(esw->dev, "vport[%d] configure egress rules failed, err(%d)\n",
vport->vport, err);
goto out;
}

Expand Down Expand Up @@ -2158,7 +2152,7 @@ int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,
if (!LEGAL_VPORT(esw, vport))
return -EINVAL;

out = mlx5_vzalloc(outlen);
out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;

Expand Down
13 changes: 5 additions & 8 deletions drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
Expand Up @@ -311,9 +311,8 @@ mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, int vport, u32 sqn
struct mlx5_flow_spec *spec;
void *misc;

spec = mlx5_vzalloc(sizeof(*spec));
spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
if (!spec) {
esw_warn(esw->dev, "FDB: Failed to alloc match parameters\n");
flow_rule = ERR_PTR(-ENOMEM);
goto out;
}
Expand Down Expand Up @@ -401,9 +400,8 @@ static int esw_add_fdb_miss_rule(struct mlx5_eswitch *esw)
struct mlx5_flow_spec *spec;
int err = 0;

spec = mlx5_vzalloc(sizeof(*spec));
spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
if (!spec) {
esw_warn(esw->dev, "FDB: Failed to alloc match parameters\n");
err = -ENOMEM;
goto out;
}
Expand Down Expand Up @@ -488,7 +486,7 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports)
u32 *flow_group_in;

esw_debug(esw->dev, "Create offloads FDB Tables\n");
flow_group_in = mlx5_vzalloc(inlen);
flow_group_in = kvzalloc(inlen, GFP_KERNEL);
if (!flow_group_in)
return -ENOMEM;

Expand Down Expand Up @@ -631,7 +629,7 @@ static int esw_create_vport_rx_group(struct mlx5_eswitch *esw)
int err = 0;
int nvports = priv->sriov.num_vfs + 2;

flow_group_in = mlx5_vzalloc(inlen);
flow_group_in = kvzalloc(inlen, GFP_KERNEL);
if (!flow_group_in)
return -ENOMEM;

Expand Down Expand Up @@ -675,9 +673,8 @@ mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport, u32 tirn)
struct mlx5_flow_spec *spec;
void *misc;

spec = mlx5_vzalloc(sizeof(*spec));
spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
if (!spec) {
esw_warn(esw->dev, "Failed to alloc match parameters\n");
flow_rule = ERR_PTR(-ENOMEM);
goto out;
}
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
Expand Up @@ -235,11 +235,9 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
u32 *in;
int err;

in = mlx5_vzalloc(inlen);
if (!in) {
mlx5_core_warn(dev, "failed to allocate inbox\n");
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;
}

MLX5_SET(set_fte_in, in, opcode, MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY);
MLX5_SET(set_fte_in, in, op_mod, opmod);
Expand Down
10 changes: 4 additions & 6 deletions drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
Expand Up @@ -376,11 +376,9 @@ static void del_rule(struct fs_node *node)
int err;
bool update_fte = false;

match_value = mlx5_vzalloc(match_len);
if (!match_value) {
mlx5_core_warn(dev, "failed to allocate inbox\n");
match_value = kvzalloc(match_len, GFP_KERNEL);
if (!match_value)
return;
}

fs_get_obj(rule, node);
fs_get_obj(fte, rule->node.parent);
Expand Down Expand Up @@ -1159,7 +1157,7 @@ static struct mlx5_flow_group *create_autogroup(struct mlx5_flow_table *ft,
if (!ft->autogroup.active)
return ERR_PTR(-ENOENT);

in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return ERR_PTR(-ENOMEM);

Expand Down Expand Up @@ -1778,7 +1776,7 @@ static struct mlx5_flow_root_namespace *create_root_ns(struct mlx5_flow_steering
struct mlx5_flow_namespace *ns;

/* Create the root namespace */
root_ns = mlx5_vzalloc(sizeof(*root_ns));
root_ns = kvzalloc(sizeof(*root_ns), GFP_KERNEL);
if (!root_ns)
return NULL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/ipoib.c
Expand Up @@ -98,7 +98,7 @@ static int mlx5i_create_underlay_qp(struct mlx5_core_dev *mdev, struct mlx5_core
void *qpc;

inlen = MLX5_ST_SZ_BYTES(create_qp_in);
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
Expand Up @@ -279,7 +279,7 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
int i;

inlen += npages * MLX5_FLD_SZ_BYTES(manage_pages_in, pas[0]);
in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in) {
err = -ENOMEM;
mlx5_core_warn(dev, "vzalloc failed %d\n", inlen);
Expand Down Expand Up @@ -376,7 +376,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages,
*nclaimed = 0;

outlen += npages * MLX5_FLD_SZ_BYTES(manage_pages_out, pas[0]);
out = mlx5_vzalloc(outlen);
out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;

Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/mellanox/mlx5/core/port.c
Expand Up @@ -47,8 +47,8 @@ int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in,
u32 *in = NULL;
void *data;

in = mlx5_vzalloc(inlen);
out = mlx5_vzalloc(outlen);
in = kvzalloc(inlen, GFP_KERNEL);
out = kvzalloc(outlen, GFP_KERNEL);
if (!in || !out)
goto out;

Expand Down Expand Up @@ -454,7 +454,7 @@ int mlx5_core_query_ib_ppcnt(struct mlx5_core_dev *dev,
u32 *in;
int err;

in = mlx5_vzalloc(sz);
in = kvzalloc(sz, GFP_KERNEL);
if (!in) {
err = -ENOMEM;
return err;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/qp.c
Expand Up @@ -527,7 +527,7 @@ int mlx5_core_query_out_of_buffer(struct mlx5_core_dev *dev, u16 counter_id,
void *out;
int err;

out = mlx5_vzalloc(outlen);
out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;

Expand Down
14 changes: 7 additions & 7 deletions drivers/net/ethernet/mellanox/mlx5/core/srq.c
Expand Up @@ -162,7 +162,7 @@ static int create_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,

pas_size = get_pas_size(in);
inlen = MLX5_ST_SZ_BYTES(create_srq_in) + pas_size;
create_in = mlx5_vzalloc(inlen);
create_in = kvzalloc(inlen, GFP_KERNEL);
if (!create_in)
return -ENOMEM;

Expand Down Expand Up @@ -221,7 +221,7 @@ static int query_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
void *srqc;
int err;

srq_out = mlx5_vzalloc(MLX5_ST_SZ_BYTES(query_srq_out));
srq_out = kvzalloc(MLX5_ST_SZ_BYTES(query_srq_out), GFP_KERNEL);
if (!srq_out)
return -ENOMEM;

Expand Down Expand Up @@ -256,7 +256,7 @@ static int create_xrc_srq_cmd(struct mlx5_core_dev *dev,

pas_size = get_pas_size(in);
inlen = MLX5_ST_SZ_BYTES(create_xrc_srq_in) + pas_size;
create_in = mlx5_vzalloc(inlen);
create_in = kvzalloc(inlen, GFP_KERNEL);
if (!create_in)
return -ENOMEM;

Expand Down Expand Up @@ -320,7 +320,7 @@ static int query_xrc_srq_cmd(struct mlx5_core_dev *dev,
void *xrc_srqc;
int err;

xrcsrq_out = mlx5_vzalloc(MLX5_ST_SZ_BYTES(query_xrc_srq_out));
xrcsrq_out = kvzalloc(MLX5_ST_SZ_BYTES(query_xrc_srq_out), GFP_KERNEL);
if (!xrcsrq_out)
return -ENOMEM;
memset(xrcsrq_in, 0, sizeof(xrcsrq_in));
Expand Down Expand Up @@ -357,7 +357,7 @@ static int create_rmp_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,

pas_size = get_pas_size(in);
inlen = MLX5_ST_SZ_BYTES(create_rmp_in) + pas_size;
create_in = mlx5_vzalloc(inlen);
create_in = kvzalloc(inlen, GFP_KERNEL);
if (!create_in)
return -ENOMEM;

Expand Down Expand Up @@ -390,7 +390,7 @@ static int arm_rmp_cmd(struct mlx5_core_dev *dev,
void *bitmask;
int err;

in = mlx5_vzalloc(MLX5_ST_SZ_BYTES(modify_rmp_in));
in = kvzalloc(MLX5_ST_SZ_BYTES(modify_rmp_in), GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand All @@ -417,7 +417,7 @@ static int query_rmp_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
void *rmpc;
int err;

rmp_out = mlx5_vzalloc(MLX5_ST_SZ_BYTES(query_rmp_out));
rmp_out = kvzalloc(MLX5_ST_SZ_BYTES(query_rmp_out), GFP_KERNEL);
if (!rmp_out)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/transobj.c
Expand Up @@ -284,7 +284,7 @@ int mlx5_core_arm_rmp(struct mlx5_core_dev *dev, u32 rmpn, u16 lwm)
void *bitmask;
int err;

in = mlx5_vzalloc(MLX5_ST_SZ_BYTES(modify_rmp_in));
in = kvzalloc(MLX5_ST_SZ_BYTES(modify_rmp_in), GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down
34 changes: 14 additions & 20 deletions drivers/net/ethernet/mellanox/mlx5/core/vport.c
Expand Up @@ -172,7 +172,7 @@ int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
u8 *out_addr;
int err;

out = mlx5_vzalloc(outlen);
out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;

Expand All @@ -197,11 +197,9 @@ int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *mdev,
void *nic_vport_ctx;
u8 *perm_mac;

in = mlx5_vzalloc(inlen);
if (!in) {
mlx5_core_warn(mdev, "failed to allocate inbox\n");
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;
}

MLX5_SET(modify_nic_vport_context_in, in,
field_select.permanent_address, 1);
Expand Down Expand Up @@ -231,7 +229,7 @@ int mlx5_query_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 *mtu)
u32 *out;
int err;

out = mlx5_vzalloc(outlen);
out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;

Expand All @@ -251,7 +249,7 @@ int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu)
void *in;
int err;

in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand Down Expand Up @@ -501,7 +499,7 @@ int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
u32 *out;
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);

out = mlx5_vzalloc(outlen);
out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;

Expand All @@ -521,7 +519,7 @@ int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid)
u32 *out;
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);

out = mlx5_vzalloc(outlen);
out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;

Expand Down Expand Up @@ -551,7 +549,7 @@ int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev,
if (!MLX5_CAP_ESW(mdev, nic_vport_node_guid_modify))
return -EOPNOTSUPP;

in = mlx5_vzalloc(inlen);
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;

Expand All @@ -577,7 +575,7 @@ int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
u32 *out;
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);

out = mlx5_vzalloc(outlen);
out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;

Expand Down Expand Up @@ -879,11 +877,9 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev,
int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in);
int err;

in = mlx5_vzalloc(inlen);
if (!in) {
mlx5_core_err(mdev, "failed to allocate inbox\n");
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;
}

MLX5_SET(modify_nic_vport_context_in, in, field_select.promisc, 1);
MLX5_SET(modify_nic_vport_context_in, in,
Expand Down Expand Up @@ -913,11 +909,9 @@ static int mlx5_nic_vport_update_roce_state(struct mlx5_core_dev *mdev,
int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in);
int err;

in = mlx5_vzalloc(inlen);
if (!in) {
mlx5_core_warn(mdev, "failed to allocate inbox\n");
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;
}

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,
Expand Down Expand Up @@ -952,7 +946,7 @@ int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport,
int err;

is_group_manager = MLX5_CAP_GEN(dev, vport_group_manager);
in = mlx5_vzalloc(in_sz);
in = kvzalloc(in_sz, GFP_KERNEL);
if (!in) {
err = -ENOMEM;
return err;
Expand Down
5 changes: 0 additions & 5 deletions include/linux/mlx5/driver.h
Expand Up @@ -890,11 +890,6 @@ static inline u16 cmdif_rev(struct mlx5_core_dev *dev)
return ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16;
}

static inline void *mlx5_vzalloc(unsigned long size)
{
return kvzalloc(size, GFP_KERNEL);
}

static inline u32 mlx5_base_mkey(const u32 key)
{
return key & 0xffffff00u;
Expand Down