Commit ec22eb53 authored by Saeed Mahameed's avatar Saeed Mahameed Committed by Leon Romanovsky

{net,IB}/mlx5: MKey/PSV commands via mlx5 ifc

Remove old representation of manually created MKey/PSV commands layout,
and use mlx5_ifc canonical structures and defines.
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 27827786
...@@ -504,7 +504,7 @@ struct mlx5_ib_mr { ...@@ -504,7 +504,7 @@ struct mlx5_ib_mr {
int umred; int umred;
int npages; int npages;
struct mlx5_ib_dev *dev; struct mlx5_ib_dev *dev;
struct mlx5_create_mkey_mbox_out out; u32 out[MLX5_ST_SZ_DW(create_mkey_out)];
struct mlx5_core_sig_ctx *sig; struct mlx5_core_sig_ctx *sig;
int live; int live;
void *descs_alloc; void *descs_alloc;
......
...@@ -135,20 +135,10 @@ static void reg_mr_callback(int status, void *context) ...@@ -135,20 +135,10 @@ static void reg_mr_callback(int status, void *context)
return; return;
} }
if (mr->out.hdr.status) {
mlx5_ib_warn(dev, "failed - status %d, syndorme 0x%x\n",
mr->out.hdr.status,
be32_to_cpu(mr->out.hdr.syndrome));
kfree(mr);
dev->fill_delay = 1;
mod_timer(&dev->delay_timer, jiffies + HZ);
return;
}
spin_lock_irqsave(&dev->mdev->priv.mkey_lock, flags); spin_lock_irqsave(&dev->mdev->priv.mkey_lock, flags);
key = dev->mdev->priv.mkey_key++; key = dev->mdev->priv.mkey_key++;
spin_unlock_irqrestore(&dev->mdev->priv.mkey_lock, flags); spin_unlock_irqrestore(&dev->mdev->priv.mkey_lock, flags);
mr->mmkey.key = mlx5_idx_to_mkey(be32_to_cpu(mr->out.mkey) & 0xffffff) | key; mr->mmkey.key = mlx5_idx_to_mkey(MLX5_GET(create_mkey_out, mr->out, mkey_index)) | key;
cache->last_add = jiffies; cache->last_add = jiffies;
...@@ -170,16 +160,19 @@ static int add_keys(struct mlx5_ib_dev *dev, int c, int num) ...@@ -170,16 +160,19 @@ static int add_keys(struct mlx5_ib_dev *dev, int c, int num)
{ {
struct mlx5_mr_cache *cache = &dev->cache; struct mlx5_mr_cache *cache = &dev->cache;
struct mlx5_cache_ent *ent = &cache->ent[c]; struct mlx5_cache_ent *ent = &cache->ent[c];
struct mlx5_create_mkey_mbox_in *in; int inlen = MLX5_ST_SZ_BYTES(create_mkey_in);
struct mlx5_ib_mr *mr; struct mlx5_ib_mr *mr;
int npages = 1 << ent->order; int npages = 1 << ent->order;
void *mkc;
u32 *in;
int err = 0; int err = 0;
int i; int i;
in = kzalloc(sizeof(*in), GFP_KERNEL); in = kzalloc(inlen, GFP_KERNEL);
if (!in) if (!in)
return -ENOMEM; return -ENOMEM;
mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
if (ent->pending >= MAX_PENDING_REG_MR) { if (ent->pending >= MAX_PENDING_REG_MR) {
err = -EAGAIN; err = -EAGAIN;
...@@ -194,18 +187,22 @@ static int add_keys(struct mlx5_ib_dev *dev, int c, int num) ...@@ -194,18 +187,22 @@ static int add_keys(struct mlx5_ib_dev *dev, int c, int num)
mr->order = ent->order; mr->order = ent->order;
mr->umred = 1; mr->umred = 1;
mr->dev = dev; mr->dev = dev;
in->seg.status = MLX5_MKEY_STATUS_FREE;
in->seg.xlt_oct_size = cpu_to_be32((npages + 1) / 2); MLX5_SET(mkc, mkc, free, 1);
in->seg.qpn_mkey7_0 = cpu_to_be32(0xffffff << 8); MLX5_SET(mkc, mkc, umr_en, 1);
in->seg.flags = MLX5_ACCESS_MODE_MTT | MLX5_PERM_UMR_EN; MLX5_SET(mkc, mkc, access_mode, MLX5_MKC_ACCESS_MODE_MTT);
in->seg.log2_page_size = 12;
MLX5_SET(mkc, mkc, qpn, 0xffffff);
MLX5_SET(mkc, mkc, translations_octword_size, (npages + 1) / 2);
MLX5_SET(mkc, mkc, log_page_size, 12);
spin_lock_irq(&ent->lock); spin_lock_irq(&ent->lock);
ent->pending++; ent->pending++;
spin_unlock_irq(&ent->lock); spin_unlock_irq(&ent->lock);
err = mlx5_core_create_mkey(dev->mdev, &mr->mmkey, in, err = mlx5_core_create_mkey_cb(dev->mdev, &mr->mmkey,
sizeof(*in), reg_mr_callback, in, inlen,
mr, &mr->out); mr->out, sizeof(mr->out),
reg_mr_callback, mr);
if (err) { if (err) {
spin_lock_irq(&ent->lock); spin_lock_irq(&ent->lock);
ent->pending--; ent->pending--;
...@@ -670,30 +667,38 @@ int mlx5_mr_cache_cleanup(struct mlx5_ib_dev *dev) ...@@ -670,30 +667,38 @@ int mlx5_mr_cache_cleanup(struct mlx5_ib_dev *dev)
struct ib_mr *mlx5_ib_get_dma_mr(struct ib_pd *pd, int acc) struct ib_mr *mlx5_ib_get_dma_mr(struct ib_pd *pd, int acc)
{ {
struct mlx5_ib_dev *dev = to_mdev(pd->device); struct mlx5_ib_dev *dev = to_mdev(pd->device);
int inlen = MLX5_ST_SZ_BYTES(create_mkey_in);
struct mlx5_core_dev *mdev = dev->mdev; struct mlx5_core_dev *mdev = dev->mdev;
struct mlx5_create_mkey_mbox_in *in;
struct mlx5_mkey_seg *seg;
struct mlx5_ib_mr *mr; struct mlx5_ib_mr *mr;
void *mkc;
u32 *in;
int err; int err;
mr = kzalloc(sizeof(*mr), GFP_KERNEL); mr = kzalloc(sizeof(*mr), GFP_KERNEL);
if (!mr) if (!mr)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
in = kzalloc(sizeof(*in), GFP_KERNEL); in = kzalloc(inlen, GFP_KERNEL);
if (!in) { if (!in) {
err = -ENOMEM; err = -ENOMEM;
goto err_free; goto err_free;
} }
seg = &in->seg; mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
seg->flags = convert_access(acc) | MLX5_ACCESS_MODE_PA;
seg->flags_pd = cpu_to_be32(to_mpd(pd)->pdn | MLX5_MKEY_LEN64); MLX5_SET(mkc, mkc, access_mode, MLX5_MKC_ACCESS_MODE_PA);
seg->qpn_mkey7_0 = cpu_to_be32(0xffffff << 8); MLX5_SET(mkc, mkc, a, !!(acc & IB_ACCESS_REMOTE_ATOMIC));
seg->start_addr = 0; MLX5_SET(mkc, mkc, rw, !!(acc & IB_ACCESS_REMOTE_WRITE));
MLX5_SET(mkc, mkc, rr, !!(acc & IB_ACCESS_REMOTE_READ));
MLX5_SET(mkc, mkc, lw, !!(acc & IB_ACCESS_LOCAL_WRITE));
MLX5_SET(mkc, mkc, lr, 1);
err = mlx5_core_create_mkey(mdev, &mr->mmkey, in, sizeof(*in), NULL, NULL, MLX5_SET(mkc, mkc, length64, 1);
NULL); MLX5_SET(mkc, mkc, pd, to_mpd(pd)->pdn);
MLX5_SET(mkc, mkc, qpn, 0xffffff);
MLX5_SET64(mkc, mkc, start_addr, 0);
err = mlx5_core_create_mkey(mdev, &mr->mmkey, in, inlen);
if (err) if (err)
goto err_in; goto err_in;
...@@ -1063,9 +1068,11 @@ static struct mlx5_ib_mr *reg_create(struct ib_mr *ibmr, struct ib_pd *pd, ...@@ -1063,9 +1068,11 @@ static struct mlx5_ib_mr *reg_create(struct ib_mr *ibmr, struct ib_pd *pd,
int page_shift, int access_flags) int page_shift, int access_flags)
{ {
struct mlx5_ib_dev *dev = to_mdev(pd->device); struct mlx5_ib_dev *dev = to_mdev(pd->device);
struct mlx5_create_mkey_mbox_in *in;
struct mlx5_ib_mr *mr; struct mlx5_ib_mr *mr;
__be64 *pas;
void *mkc;
int inlen; int inlen;
u32 *in;
int err; int err;
bool pg_cap = !!(MLX5_CAP_GEN(dev->mdev, pg)); bool pg_cap = !!(MLX5_CAP_GEN(dev->mdev, pg));
...@@ -1073,31 +1080,41 @@ static struct mlx5_ib_mr *reg_create(struct ib_mr *ibmr, struct ib_pd *pd, ...@@ -1073,31 +1080,41 @@ static struct mlx5_ib_mr *reg_create(struct ib_mr *ibmr, struct ib_pd *pd,
if (!mr) if (!mr)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
inlen = sizeof(*in) + sizeof(*in->pas) * ((npages + 1) / 2) * 2; inlen = MLX5_ST_SZ_BYTES(create_mkey_in) +
sizeof(*pas) * ((npages + 1) / 2) * 2;
in = mlx5_vzalloc(inlen); in = mlx5_vzalloc(inlen);
if (!in) { if (!in) {
err = -ENOMEM; err = -ENOMEM;
goto err_1; goto err_1;
} }
mlx5_ib_populate_pas(dev, umem, page_shift, in->pas, pas = (__be64 *)MLX5_ADDR_OF(create_mkey_in, in, klm_pas_mtt);
mlx5_ib_populate_pas(dev, umem, page_shift, pas,
pg_cap ? MLX5_IB_MTT_PRESENT : 0); pg_cap ? MLX5_IB_MTT_PRESENT : 0);
/* The MLX5_MKEY_INBOX_PG_ACCESS bit allows setting the access flags /* The pg_access bit allows setting the access flags
* in the page list submitted with the command. */ * in the page list submitted with the command. */
in->flags = pg_cap ? cpu_to_be32(MLX5_MKEY_INBOX_PG_ACCESS) : 0; MLX5_SET(create_mkey_in, in, pg_access, !!(pg_cap));
in->seg.flags = convert_access(access_flags) |
MLX5_ACCESS_MODE_MTT; mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
in->seg.flags_pd = cpu_to_be32(to_mpd(pd)->pdn); MLX5_SET(mkc, mkc, access_mode, MLX5_MKC_ACCESS_MODE_MTT);
in->seg.start_addr = cpu_to_be64(virt_addr); MLX5_SET(mkc, mkc, a, !!(access_flags & IB_ACCESS_REMOTE_ATOMIC));
in->seg.len = cpu_to_be64(length); MLX5_SET(mkc, mkc, rw, !!(access_flags & IB_ACCESS_REMOTE_WRITE));
in->seg.bsfs_octo_size = 0; MLX5_SET(mkc, mkc, rr, !!(access_flags & IB_ACCESS_REMOTE_READ));
in->seg.xlt_oct_size = cpu_to_be32(get_octo_len(virt_addr, length, 1 << page_shift)); MLX5_SET(mkc, mkc, lw, !!(access_flags & IB_ACCESS_LOCAL_WRITE));
in->seg.log2_page_size = page_shift; MLX5_SET(mkc, mkc, lr, 1);
in->seg.qpn_mkey7_0 = cpu_to_be32(0xffffff << 8);
in->xlat_oct_act_size = cpu_to_be32(get_octo_len(virt_addr, length, MLX5_SET64(mkc, mkc, start_addr, virt_addr);
1 << page_shift)); MLX5_SET64(mkc, mkc, len, length);
err = mlx5_core_create_mkey(dev->mdev, &mr->mmkey, in, inlen, NULL, MLX5_SET(mkc, mkc, pd, to_mpd(pd)->pdn);
NULL, NULL); MLX5_SET(mkc, mkc, bsf_octword_size, 0);
MLX5_SET(mkc, mkc, translations_octword_size,
get_octo_len(virt_addr, length, 1 << page_shift));
MLX5_SET(mkc, mkc, log_page_size, page_shift);
MLX5_SET(mkc, mkc, qpn, 0xffffff);
MLX5_SET(create_mkey_in, in, translations_octword_actual_size,
get_octo_len(virt_addr, length, 1 << page_shift));
err = mlx5_core_create_mkey(dev->mdev, &mr->mmkey, in, inlen);
if (err) { if (err) {
mlx5_ib_warn(dev, "create mkey failed\n"); mlx5_ib_warn(dev, "create mkey failed\n");
goto err_2; goto err_2;
...@@ -1523,30 +1540,32 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd, ...@@ -1523,30 +1540,32 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd,
u32 max_num_sg) u32 max_num_sg)
{ {
struct mlx5_ib_dev *dev = to_mdev(pd->device); struct mlx5_ib_dev *dev = to_mdev(pd->device);
struct mlx5_create_mkey_mbox_in *in; int inlen = MLX5_ST_SZ_BYTES(create_mkey_in);
struct mlx5_ib_mr *mr;
int ndescs = ALIGN(max_num_sg, 4); int ndescs = ALIGN(max_num_sg, 4);
struct mlx5_ib_mr *mr;
void *mkc;
u32 *in;
int err; int err;
mr = kzalloc(sizeof(*mr), GFP_KERNEL); mr = kzalloc(sizeof(*mr), GFP_KERNEL);
if (!mr) if (!mr)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
in = kzalloc(sizeof(*in), GFP_KERNEL); in = kzalloc(inlen, GFP_KERNEL);
if (!in) { if (!in) {
err = -ENOMEM; err = -ENOMEM;
goto err_free; goto err_free;
} }
in->seg.status = MLX5_MKEY_STATUS_FREE; mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
in->seg.xlt_oct_size = cpu_to_be32(ndescs); MLX5_SET(mkc, mkc, free, 1);
in->seg.qpn_mkey7_0 = cpu_to_be32(0xffffff << 8); MLX5_SET(mkc, mkc, translations_octword_size, ndescs);
in->seg.flags_pd = cpu_to_be32(to_mpd(pd)->pdn); MLX5_SET(mkc, mkc, qpn, 0xffffff);
MLX5_SET(mkc, mkc, pd, to_mpd(pd)->pdn);
if (mr_type == IB_MR_TYPE_MEM_REG) { if (mr_type == IB_MR_TYPE_MEM_REG) {
mr->access_mode = MLX5_ACCESS_MODE_MTT; mr->access_mode = MLX5_MKC_ACCESS_MODE_MTT;
in->seg.log2_page_size = PAGE_SHIFT; MLX5_SET(mkc, mkc, log_page_size, PAGE_SHIFT);
err = mlx5_alloc_priv_descs(pd->device, mr, err = mlx5_alloc_priv_descs(pd->device, mr,
ndescs, sizeof(u64)); ndescs, sizeof(u64));
if (err) if (err)
...@@ -1555,7 +1574,7 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd, ...@@ -1555,7 +1574,7 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd,
mr->desc_size = sizeof(u64); mr->desc_size = sizeof(u64);
mr->max_descs = ndescs; mr->max_descs = ndescs;
} else if (mr_type == IB_MR_TYPE_SG_GAPS) { } else if (mr_type == IB_MR_TYPE_SG_GAPS) {
mr->access_mode = MLX5_ACCESS_MODE_KLM; mr->access_mode = MLX5_MKC_ACCESS_MODE_KLMS;
err = mlx5_alloc_priv_descs(pd->device, mr, err = mlx5_alloc_priv_descs(pd->device, mr,
ndescs, sizeof(struct mlx5_klm)); ndescs, sizeof(struct mlx5_klm));
...@@ -1566,9 +1585,8 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd, ...@@ -1566,9 +1585,8 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd,
} else if (mr_type == IB_MR_TYPE_SIGNATURE) { } else if (mr_type == IB_MR_TYPE_SIGNATURE) {
u32 psv_index[2]; u32 psv_index[2];
in->seg.flags_pd = cpu_to_be32(be32_to_cpu(in->seg.flags_pd) | MLX5_SET(mkc, mkc, bsf_en, 1);
MLX5_MKEY_BSF_EN); MLX5_SET(mkc, mkc, bsf_octword_size, MLX5_MKEY_BSF_OCTO_SIZE);
in->seg.bsfs_octo_size = cpu_to_be32(MLX5_MKEY_BSF_OCTO_SIZE);
mr->sig = kzalloc(sizeof(*mr->sig), GFP_KERNEL); mr->sig = kzalloc(sizeof(*mr->sig), GFP_KERNEL);
if (!mr->sig) { if (!mr->sig) {
err = -ENOMEM; err = -ENOMEM;
...@@ -1581,7 +1599,7 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd, ...@@ -1581,7 +1599,7 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd,
if (err) if (err)
goto err_free_sig; goto err_free_sig;
mr->access_mode = MLX5_ACCESS_MODE_KLM; mr->access_mode = MLX5_MKC_ACCESS_MODE_KLMS;
mr->sig->psv_memory.psv_idx = psv_index[0]; mr->sig->psv_memory.psv_idx = psv_index[0];
mr->sig->psv_wire.psv_idx = psv_index[1]; mr->sig->psv_wire.psv_idx = psv_index[1];
...@@ -1595,9 +1613,10 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd, ...@@ -1595,9 +1613,10 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd,
goto err_free_in; goto err_free_in;
} }
in->seg.flags = MLX5_PERM_UMR_EN | mr->access_mode; MLX5_SET(mkc, mkc, access_mode, mr->access_mode);
err = mlx5_core_create_mkey(dev->mdev, &mr->mmkey, in, sizeof(*in), MLX5_SET(mkc, mkc, umr_en, 1);
NULL, NULL, NULL);
err = mlx5_core_create_mkey(dev->mdev, &mr->mmkey, in, inlen);
if (err) if (err)
goto err_destroy_psv; goto err_destroy_psv;
...@@ -1633,8 +1652,10 @@ struct ib_mw *mlx5_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type, ...@@ -1633,8 +1652,10 @@ struct ib_mw *mlx5_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
struct ib_udata *udata) struct ib_udata *udata)
{ {
struct mlx5_ib_dev *dev = to_mdev(pd->device); struct mlx5_ib_dev *dev = to_mdev(pd->device);
struct mlx5_create_mkey_mbox_in *in = NULL; int inlen = MLX5_ST_SZ_BYTES(create_mkey_in);
struct mlx5_ib_mw *mw = NULL; struct mlx5_ib_mw *mw = NULL;
u32 *in = NULL;
void *mkc;
int ndescs; int ndescs;
int err; int err;
struct mlx5_ib_alloc_mw req = {}; struct mlx5_ib_alloc_mw req = {};
...@@ -1658,23 +1679,24 @@ struct ib_mw *mlx5_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type, ...@@ -1658,23 +1679,24 @@ struct ib_mw *mlx5_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
ndescs = req.num_klms ? roundup(req.num_klms, 4) : roundup(1, 4); ndescs = req.num_klms ? roundup(req.num_klms, 4) : roundup(1, 4);
mw = kzalloc(sizeof(*mw), GFP_KERNEL); mw = kzalloc(sizeof(*mw), GFP_KERNEL);
in = kzalloc(sizeof(*in), GFP_KERNEL); in = kzalloc(inlen, GFP_KERNEL);
if (!mw || !in) { if (!mw || !in) {
err = -ENOMEM; err = -ENOMEM;
goto free; goto free;
} }
in->seg.status = MLX5_MKEY_STATUS_FREE; mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
in->seg.xlt_oct_size = cpu_to_be32(ndescs);
in->seg.flags_pd = cpu_to_be32(to_mpd(pd)->pdn); MLX5_SET(mkc, mkc, free, 1);
in->seg.flags = MLX5_PERM_UMR_EN | MLX5_ACCESS_MODE_KLM | MLX5_SET(mkc, mkc, translations_octword_size, ndescs);
MLX5_PERM_LOCAL_READ; MLX5_SET(mkc, mkc, pd, to_mpd(pd)->pdn);
if (type == IB_MW_TYPE_2) MLX5_SET(mkc, mkc, umr_en, 1);
in->seg.flags_pd |= cpu_to_be32(MLX5_MKEY_REMOTE_INVAL); MLX5_SET(mkc, mkc, lr, 1);
in->seg.qpn_mkey7_0 = cpu_to_be32(0xffffff << 8); MLX5_SET(mkc, mkc, access_mode, MLX5_MKC_ACCESS_MODE_KLMS);
MLX5_SET(mkc, mkc, en_rinval, !!((type == IB_MW_TYPE_2)));
err = mlx5_core_create_mkey(dev->mdev, &mw->mmkey, in, sizeof(*in), MLX5_SET(mkc, mkc, qpn, 0xffffff);
NULL, NULL, NULL);
err = mlx5_core_create_mkey(dev->mdev, &mw->mmkey, in, inlen);
if (err) if (err)
goto free; goto free;
...@@ -1811,7 +1833,7 @@ int mlx5_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, ...@@ -1811,7 +1833,7 @@ int mlx5_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,
mr->desc_size * mr->max_descs, mr->desc_size * mr->max_descs,
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (mr->access_mode == MLX5_ACCESS_MODE_KLM) if (mr->access_mode == MLX5_MKC_ACCESS_MODE_KLMS)
n = mlx5_ib_sg_to_klms(mr, sg, sg_nents, sg_offset); n = mlx5_ib_sg_to_klms(mr, sg, sg_nents, sg_offset);
else else
n = ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, n = ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset,
......
...@@ -2968,7 +2968,7 @@ static void set_reg_umr_seg(struct mlx5_wqe_umr_ctrl_seg *umr, ...@@ -2968,7 +2968,7 @@ static void set_reg_umr_seg(struct mlx5_wqe_umr_ctrl_seg *umr,
memset(umr, 0, sizeof(*umr)); memset(umr, 0, sizeof(*umr));
if (mr->access_mode == MLX5_ACCESS_MODE_KLM) if (mr->access_mode == MLX5_MKC_ACCESS_MODE_KLMS)
/* KLMs take twice the size of MTTs */ /* KLMs take twice the size of MTTs */
ndescs *= 2; ndescs *= 2;
...@@ -3111,9 +3111,9 @@ static void set_reg_mkey_seg(struct mlx5_mkey_seg *seg, ...@@ -3111,9 +3111,9 @@ static void set_reg_mkey_seg(struct mlx5_mkey_seg *seg,
memset(seg, 0, sizeof(*seg)); memset(seg, 0, sizeof(*seg));
if (mr->access_mode == MLX5_ACCESS_MODE_MTT) if (mr->access_mode == MLX5_MKC_ACCESS_MODE_MTT)
seg->log2_page_size = ilog2(mr->ibmr.page_size); seg->log2_page_size = ilog2(mr->ibmr.page_size);
else if (mr->access_mode == MLX5_ACCESS_MODE_KLM) else if (mr->access_mode == MLX5_MKC_ACCESS_MODE_KLMS)
/* KLMs take twice the size of MTTs */ /* KLMs take twice the size of MTTs */
ndescs *= 2; ndescs *= 2;
...@@ -3454,7 +3454,7 @@ static void set_sig_mkey_segment(struct mlx5_mkey_seg *seg, ...@@ -3454,7 +3454,7 @@ static void set_sig_mkey_segment(struct mlx5_mkey_seg *seg,
memset(seg, 0, sizeof(*seg)); memset(seg, 0, sizeof(*seg));
seg->flags = get_umr_flags(wr->access_flags) | seg->flags = get_umr_flags(wr->access_flags) |
MLX5_ACCESS_MODE_KLM; MLX5_MKC_ACCESS_MODE_KLMS;
seg->qpn_mkey7_0 = cpu_to_be32((sig_key & 0xff) | 0xffffff00); seg->qpn_mkey7_0 = cpu_to_be32((sig_key & 0xff) | 0xffffff00);
seg->flags_pd = cpu_to_be32(MLX5_MKEY_REMOTE_INVAL | sigerr << 26 | seg->flags_pd = cpu_to_be32(MLX5_MKEY_REMOTE_INVAL | sigerr << 26 |
MLX5_MKEY_BSF_EN | pdn); MLX5_MKEY_BSF_EN | pdn);
......
...@@ -1301,10 +1301,12 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec) ...@@ -1301,10 +1301,12 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec)
callback = ent->callback; callback = ent->callback;
context = ent->context; context = ent->context;
err = ent->ret; err = ent->ret;
if (!err) if (!err) {
err = mlx5_copy_from_msg(ent->uout, err = mlx5_copy_from_msg(ent->uout,
ent->out, ent->out,
ent->uout_size); ent->uout_size);
err = err ? err : mlx5_cmd_status_to_err_v2(ent->uout);
}
mlx5_free_cmd_msg(dev, ent->out); mlx5_free_cmd_msg(dev, ent->out);
free_msg(dev, ent->in); free_msg(dev, ent->in);
......
...@@ -60,24 +60,27 @@ void mlx5e_destroy_tir(struct mlx5_core_dev *mdev, ...@@ -60,24 +60,27 @@ void mlx5e_destroy_tir(struct mlx5_core_dev *mdev,
static int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn, static int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn,
struct mlx5_core_mkey *mkey) struct mlx5_core_mkey *mkey)
{ {
struct mlx5_create_mkey_mbox_in *in; int inlen = MLX5_ST_SZ_BYTES(create_mkey_in);
void *mkc;
u32 *in;
int err; int err;
in = mlx5_vzalloc(sizeof(*in)); in = mlx5_vzalloc(inlen);
if (!in) if (!in)
return -ENOMEM; return -ENOMEM;
in->seg.flags = MLX5_PERM_LOCAL_WRITE | mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
MLX5_PERM_LOCAL_READ | MLX5_SET(mkc, mkc, access_mode, MLX5_MKC_ACCESS_MODE_PA);
MLX5_ACCESS_MODE_PA; MLX5_SET(mkc, mkc, lw, 1);
in->seg.flags_pd = cpu_to_be32(pdn | MLX5_MKEY_LEN64); MLX5_SET(mkc, mkc, lr, 1);
in->seg.qpn_mkey7_0 = cpu_to_be32(0xffffff << 8);
err = mlx5_core_create_mkey(mdev, mkey, in, sizeof(*in), NULL, NULL, MLX5_SET(mkc, mkc, pd, pdn);
NULL); MLX5_SET(mkc, mkc, length64, 1);
MLX5_SET(mkc, mkc, qpn, 0xffffff);
kvfree(in); err = mlx5_core_create_mkey(mdev, mkey, in, inlen);
kvfree(in);
return err; return err;
} }
......
...@@ -3228,35 +3228,34 @@ static void mlx5e_destroy_q_counter(struct mlx5e_priv *priv) ...@@ -3228,35 +3228,34 @@ static void mlx5e_destroy_q_counter(struct mlx5e_priv *priv)
static int mlx5e_create_umr_mkey(struct mlx5e_priv *priv) static int mlx5e_create_umr_mkey(struct mlx5e_priv *priv)
{ {
struct mlx5_core_dev *mdev = priv->mdev; struct mlx5_core_dev *mdev = priv->mdev;
struct mlx5_create_mkey_mbox_in *in; u64 npages = priv->profile->max_nch(mdev) * MLX5_CHANNEL_MAX_NUM_MTTS;
struct mlx5_mkey_seg *mkc; int inlen = MLX5_ST_SZ_BYTES(create_mkey_in);
int inlen = sizeof(*in); void *mkc;
u64 npages = u32 *in;
priv->profile->max_nch(mdev) * MLX5_CHANNEL_MAX_NUM_MTTS;
int err; int err;
in = mlx5_vzalloc(inlen); in = mlx5_vzalloc(inlen);
if (!in) if (!in)
return -ENOMEM; return -ENOMEM;
mkc = &in->seg; mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
mkc->status = MLX5_MKEY_STATUS_FREE;
mkc->flags = MLX5_PERM_UMR_EN |
MLX5_PERM_LOCAL_READ |
MLX5_PERM_LOCAL_WRITE |
MLX5_ACCESS_MODE_MTT;
mkc->qpn_mkey7_0 = cpu_to_be32(0xffffff << 8); MLX5_SET(mkc, mkc, free, 1);
mkc->flags_pd = cpu_to_be32(mdev->mlx5e_res.pdn); MLX5_SET(mkc, mkc, umr_en, 1);
mkc->len = cpu_to_be64(npages << PAGE_SHIFT); MLX5_SET(mkc, mkc, lw, 1);
mkc->xlt_oct_size = cpu_to_be32(mlx5e_get_mtt_octw(npages)); MLX5_SET(mkc, mkc, lr, 1);
mkc->log2_page_size = PAGE_SHIFT; MLX5_SET(mkc, mkc, access_mode, MLX5_MKC_ACCESS_MODE_MTT);
err = mlx5_core_create_mkey(mdev, &priv->umr_mkey, in, inlen, NULL, MLX5_SET(mkc, mkc, qpn, 0xffffff);
NULL, NULL); MLX5_SET(mkc, mkc, pd, mdev->mlx5e_res.pdn);
MLX5_SET64(mkc, mkc, len, npages << PAGE_SHIFT);
MLX5_SET(mkc, mkc, translations_octword_size,
mlx5e_get_mtt_octw(npages));
MLX5_SET(mkc, mkc, log_page_size, PAGE_SHIFT);
kvfree(in); err = mlx5_core_create_mkey(mdev, &priv->umr_mkey, in, inlen);
kvfree(in);
return err; return err;
} }
......
...@@ -49,48 +49,44 @@ void mlx5_cleanup_mkey_table(struct mlx5_core_dev *dev) ...@@ -49,48 +49,44 @@ void mlx5_cleanup_mkey_table(struct mlx5_core_dev *dev)
{ {
} }
int mlx5_core_create_mkey(struct mlx5_core_dev *dev, int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev,
struct mlx5_core_mkey *mkey, struct mlx5_core_mkey *mkey,
struct mlx5_create_mkey_mbox_in *in, int inlen, u32 *in, int inlen,
mlx5_cmd_cbk_t callback, void *context, u32 *out, int outlen,
struct mlx5_create_mkey_mbox_out *out) mlx5_cmd_cbk_t callback, void *context)
{ {
struct mlx5_mkey_table *table = &dev->priv.mkey_table; struct mlx5_mkey_table *table = &dev->priv.mkey_table;
struct mlx5_create_mkey_mbox_out lout; u32 lout[MLX5_ST_SZ_DW(create_mkey_out)] = {0};
u32 mkey_index;
void *mkc;
int err; int err;
u8 key; u8 key;
memset(&lout, 0, sizeof(lout));
spin_lock_irq(&dev->priv.mkey_lock); spin_lock_irq(&dev->priv.mkey_lock);
key = dev->priv.mkey_key++; key = dev->priv.mkey_key++;
spin_unlock_irq(&dev->priv.mkey_lock); spin_unlock_irq(&dev->priv.mkey_lock);
in->seg.qpn_mkey7_0 |= cpu_to_be32(key); mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_CREATE_MKEY);
if (callback) {
err = mlx5_cmd_exec_cb(dev, in, inlen, out, sizeof(*out),
callback, context);
return err;
} else {
err = mlx5_cmd_exec(dev, in, inlen, &lout, sizeof(lout));
}
if (err) { MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY);
mlx5_core_dbg(dev, "cmd exec failed %d\n", err); MLX5_SET(mkc, mkc, mkey_7_0, key);
return err;
}
if (lout.hdr.status) { if (callback)
mlx5_core_dbg(dev, "status %d\n", lout.hdr.status); return mlx5_cmd_exec_cb(dev, in, inlen, out, outlen,
return mlx5_cmd_status_to_err(&lout.hdr); callback, context);
}
err = mlx5_cmd_exec(dev, in, inlen, lout, sizeof(lout));
err = err ? : mlx5_cmd_status_to_err_v2(lout);
if (err)
return err;
mkey->iova = be64_to_cpu(in->seg.start_addr); mkey_index = MLX5_GET(create_mkey_out, lout, mkey_index);
mkey->size = be64_to_cpu(in->seg.len); mkey->iova = MLX5_GET64(mkc, mkc, start_addr);
mkey->key = mlx5_idx_to_mkey(be32_to_cpu(lout.mkey) & 0xffffff) | key; mkey->size = MLX5_GET64(mkc, mkc, len);
mkey->pd = be32_to_cpu(in->seg.flags_pd) & 0xffffff; mkey->key = mlx5_idx_to_mkey(mkey_index) | key;
mkey->pd = MLX5_GET(mkc, mkc, pd);
mlx5_core_dbg(dev, "out 0x%x, key 0x%x, mkey 0x%x\n", mlx5_core_dbg(dev, "out 0x%x, key 0x%x, mkey 0x%x\n",
be32_to_cpu(lout.mkey), key, mkey->key); mkey_index, key, mkey->key);
/* connect to mkey tree */ /* connect to mkey tree */
write_lock_irq(&table->lock); write_lock_irq(&table->lock);
...@@ -104,21 +100,27 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev, ...@@ -104,21 +100,27 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
return err; return err;
} }
EXPORT_SYMBOL(mlx5_core_create_mkey_cb);
int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
struct mlx5_core_mkey *mkey,
u32 *in, int inlen)
{
return mlx5_core_create_mkey_cb(dev, mkey, in, inlen,
NULL, 0, NULL, NULL);
}
EXPORT_SYMBOL(mlx5_core_create_mkey); EXPORT_SYMBOL(mlx5_core_create_mkey);
int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev,
struct mlx5_core_mkey *mkey) struct mlx5_core_mkey *mkey)
{ {
struct mlx5_mkey_table *table = &dev->priv.mkey_table; struct mlx5_mkey_table *table = &dev->priv.mkey_table;
struct mlx5_destroy_mkey_mbox_in in; u32 out[MLX5_ST_SZ_DW(destroy_mkey_out)] = {0};
struct mlx5_destroy_mkey_mbox_out out; u32 in[MLX5_ST_SZ_DW(destroy_mkey_in)] = {0};
struct mlx5_core_mkey *deleted_mkey; struct mlx5_core_mkey *deleted_mkey;
unsigned long flags; unsigned long flags;
int err; int err;
memset(&in, 0, sizeof(in));
memset(&out, 0, sizeof(out));
write_lock_irqsave(&table->lock, flags); write_lock_irqsave(&table->lock, flags);
deleted_mkey = radix_tree_delete(&table->tree, mlx5_base_mkey(mkey->key)); deleted_mkey = radix_tree_delete(&table->tree, mlx5_base_mkey(mkey->key));
write_unlock_irqrestore(&table->lock, flags); write_unlock_irqrestore(&table->lock, flags);
...@@ -128,94 +130,81 @@ int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, ...@@ -128,94 +130,81 @@ int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev,
return -ENOENT; return -ENOENT;
} }
in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DESTROY_MKEY); MLX5_SET(destroy_mkey_in, in, opcode, MLX5_CMD_OP_DESTROY_MKEY);
in.mkey = cpu_to_be32(mlx5_mkey_to_idx(mkey->key)); MLX5_SET(destroy_mkey_in, in, mkey_index, mlx5_mkey_to_idx(mkey->key));
err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out));
if (err)
return err;
if (out.hdr.status) err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
return mlx5_cmd_status_to_err(&out.hdr); return err ? : mlx5_cmd_status_to_err_v2(out);
return err;
} }
EXPORT_SYMBOL(mlx5_core_destroy_mkey); EXPORT_SYMBOL(mlx5_core_destroy_mkey);
int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey, int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey,
struct mlx5_query_mkey_mbox_out *out, int outlen) u32 *out, int outlen)
{ {
struct mlx5_query_mkey_mbox_in in; u32 in[MLX5_ST_SZ_DW(query_mkey_in)] = {0};
int err; int err;
memset(&in, 0, sizeof(in));
memset(out, 0, outlen); memset(out, 0, outlen);
MLX5_SET(query_mkey_in, in, opcode, MLX5_CMD_OP_QUERY_MKEY);
MLX5_SET(query_mkey_in, in, mkey_index, mlx5_mkey_to_idx(mkey->key));
in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_QUERY_MKEY); err = mlx5_cmd_exec(dev, in, sizeof(in), out, outlen);
in.mkey = cpu_to_be32(mlx5_mkey_to_idx(mkey->key)); return err ? : mlx5_cmd_status_to_err_v2(out);
err = mlx5_cmd_exec(dev, &in, sizeof(in), out, outlen);
if (err)
return err;
if (out->hdr.status)
return mlx5_cmd_status_to_err(&out->hdr);
return err;
} }
EXPORT_SYMBOL(mlx5_core_query_mkey); EXPORT_SYMBOL(mlx5_core_query_mkey);
int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *_mkey, int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *_mkey,
u32 *mkey) u32 *mkey)
{ {
struct mlx5_query_special_ctxs_mbox_in in; u32 out[MLX5_ST_SZ_DW(query_special_contexts_out)] = {0};
struct mlx5_query_special_ctxs_mbox_out out; u32 in[MLX5_ST_SZ_DW(query_special_contexts_in)] = {0};
int err; int err;
memset(&in, 0, sizeof(in)); MLX5_SET(query_special_contexts_in, in, opcode,
memset(&out, 0, sizeof(out)); MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS);
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS); err = err ? : mlx5_cmd_status_to_err_v2(out);
err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out));
if (err) if (err)
return err; return err;
if (out.hdr.status) *mkey = MLX5_GET(query_special_contexts_out, out, dump_fill_mkey);
return mlx5_cmd_status_to_err(&out.hdr);
*mkey = be32_to_cpu(out.dump_fill_mkey);
return err; return err;
} }
EXPORT_SYMBOL(mlx5_core_dump_fill_mkey); EXPORT_SYMBOL(mlx5_core_dump_fill_mkey);
static inline u32 mlx5_get_psv(u32 *out, int psv_index)
{
switch (psv_index) {
case 1: return MLX5_GET(create_psv_out, out, psv1_index);
case 2: return MLX5_GET(create_psv_out, out, psv2_index);
case 3: return MLX5_GET(create_psv_out, out, psv3_index);
default: return MLX5_GET(create_psv_out, out, psv0_index);
}
}
int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn, int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn,
int npsvs, u32 *sig_index) int npsvs, u32 *sig_index)
{ {
struct mlx5_allocate_psv_in in; u32 out[MLX5_ST_SZ_DW(create_psv_out)] = {0};
struct mlx5_allocate_psv_out out; u32 in[MLX5_ST_SZ_DW(create_psv_in)] = {0};
int i, err; int i, err;
if (npsvs > MLX5_MAX_PSVS) if (npsvs > MLX5_MAX_PSVS)
return -EINVAL; return -EINVAL;
memset(&in, 0, sizeof(in)); MLX5_SET(create_psv_in, in, opcode, MLX5_CMD_OP_CREATE_PSV);
memset(&out, 0, sizeof(out)); MLX5_SET(create_psv_in, in, pd, pdn);
MLX5_SET(create_psv_in, in, num_psv, npsvs);
in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_CREATE_PSV); err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
in.npsv_pd = cpu_to_be32((npsvs << 28) | pdn); err = err ? : mlx5_cmd_status_to_err_v2(out);
err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out));
if (err) { if (err) {
mlx5_core_err(dev, "cmd exec failed %d\n", err); mlx5_core_err(dev, "create_psv cmd exec failed %d\n", err);
return err; return err;
} }
if (out.hdr.status) {
mlx5_core_err(dev, "create_psv bad status %d\n",
out.hdr.status);
return mlx5_cmd_status_to_err(&out.hdr);
}
for (i = 0; i < npsvs; i++) for (i = 0; i < npsvs; i++)
sig_index[i] = be32_to_cpu(out.psv_idx[i]) & 0xffffff; sig_index[i] = mlx5_get_psv(out, i);
return err; return err;
} }
...@@ -223,29 +212,13 @@ EXPORT_SYMBOL(mlx5_core_create_psv); ...@@ -223,29 +212,13 @@ EXPORT_SYMBOL(mlx5_core_create_psv);
int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num) int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num)
{ {
struct mlx5_destroy_psv_in in; u32 out[MLX5_ST_SZ_DW(destroy_psv_out)] = {0};
struct mlx5_destroy_psv_out out; u32 in[MLX5_ST_SZ_DW(destroy_psv_in)] = {0};
int err; int err;
memset(&in, 0, sizeof(in)); MLX5_SET(destroy_psv_in, in, opcode, MLX5_CMD_OP_DESTROY_PSV);
memset(&out, 0, sizeof(out)); MLX5_SET(destroy_psv_in, in, psvn, psv_num);
err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
in.psv_number = cpu_to_be32(psv_num); return err ? : mlx5_cmd_status_to_err_v2(out);
in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DESTROY_PSV);
err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out));
if (err) {
mlx5_core_err(dev, "destroy_psv cmd exec failed %d\n", err);
goto out;
}
if (out.hdr.status) {
mlx5_core_err(dev, "destroy_psv bad status %d\n",
out.hdr.status);
err = mlx5_cmd_status_to_err(&out.hdr);
goto out;
}
out:
return err;
} }
EXPORT_SYMBOL(mlx5_core_destroy_psv); EXPORT_SYMBOL(mlx5_core_destroy_psv);
...@@ -197,19 +197,6 @@ enum { ...@@ -197,19 +197,6 @@ enum {
MLX5_PCIE_CTRL_TPH_MASK = 3 << 4, MLX5_PCIE_CTRL_TPH_MASK = 3 << 4,
}; };
enum {
MLX5_ACCESS_MODE_PA = 0,
MLX5_ACCESS_MODE_MTT = 1,
MLX5_ACCESS_MODE_KLM = 2
};
enum {
MLX5_MKEY_REMOTE_INVAL = 1 << 24,
MLX5_MKEY_FLAG_SYNC_UMR = 1 << 29,
MLX5_MKEY_BSF_EN = 1 << 30,
MLX5_MKEY_LEN64 = 1 << 31,
};
enum { enum {
MLX5_EN_RD = (u64)1, MLX5_EN_RD = (u64)1,
MLX5_EN_WR = (u64)2 MLX5_EN_WR = (u64)2
...@@ -923,6 +910,13 @@ enum { ...@@ -923,6 +910,13 @@ enum {
MLX5_MKEY_STATUS_FREE = 1 << 6, MLX5_MKEY_STATUS_FREE = 1 << 6,
}; };
enum {
MLX5_MKEY_REMOTE_INVAL = 1 << 24,
MLX5_MKEY_FLAG_SYNC_UMR = 1 << 29,
MLX5_MKEY_BSF_EN = 1 << 30,
MLX5_MKEY_LEN64 = 1 << 31,
};
struct mlx5_mkey_seg { struct mlx5_mkey_seg {
/* This is a two bit field occupying bits 31-30. /* This is a two bit field occupying bits 31-30.
* bit 31 is always 0, * bit 31 is always 0,
...@@ -945,105 +939,12 @@ struct mlx5_mkey_seg { ...@@ -945,105 +939,12 @@ struct mlx5_mkey_seg {
u8 rsvd4[4]; u8 rsvd4[4];
}; };
struct mlx5_query_special_ctxs_mbox_in {
struct mlx5_inbox_hdr hdr;
u8 rsvd[8];
};
struct mlx5_query_special_ctxs_mbox_out {
struct mlx5_outbox_hdr hdr;
__be32 dump_fill_mkey;
__be32 reserved_lkey;
};
struct mlx5_create_mkey_mbox_in {
struct mlx5_inbox_hdr hdr;
__be32 input_mkey_index;
__be32 flags;
struct mlx5_mkey_seg seg;
u8 rsvd1[16];
__be32 xlat_oct_act_size;
__be32 rsvd2;
u8 rsvd3[168];
__be64 pas[0];
};
struct mlx5_create_mkey_mbox_out {
struct mlx5_outbox_hdr hdr;
__be32 mkey;
u8 rsvd[4];
};
struct mlx5_destroy_mkey_mbox_in {
struct mlx5_inbox_hdr hdr;
__be32 mkey;
u8 rsvd[4];
};
struct mlx5_destroy_mkey_mbox_out {
struct mlx5_outbox_hdr hdr;
u8 rsvd[8];
};
struct mlx5_query_mkey_mbox_in {
struct mlx5_inbox_hdr hdr;
__be32 mkey;
};
struct mlx5_query_mkey_mbox_out {
struct mlx5_outbox_hdr hdr;
__be64 pas[0];
};
struct mlx5_modify_mkey_mbox_in {
struct mlx5_inbox_hdr hdr;
__be32 mkey;
__be64 pas[0];
};
struct mlx5_modify_mkey_mbox_out {
struct mlx5_outbox_hdr hdr;
u8 rsvd[8];
};
struct mlx5_dump_mkey_mbox_in {
struct mlx5_inbox_hdr hdr;
};
struct mlx5_dump_mkey_mbox_out {
struct mlx5_outbox_hdr hdr;
__be32 mkey;
};
#define MLX5_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) #define MLX5_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
enum { enum {
MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
}; };
struct mlx5_allocate_psv_in {
struct mlx5_inbox_hdr hdr;
__be32 npsv_pd;
__be32 rsvd_psv0;
};
struct mlx5_allocate_psv_out {
struct mlx5_outbox_hdr hdr;
u8 rsvd[8];
__be32 psv_idx[4];
};
struct mlx5_destroy_psv_in {
struct mlx5_inbox_hdr hdr;
__be32 psv_number;
u8 rsvd[4];
};
struct mlx5_destroy_psv_out {
struct mlx5_outbox_hdr hdr;
u8 rsvd[8];
};
enum { enum {
VPORT_STATE_DOWN = 0x0, VPORT_STATE_DOWN = 0x0,
VPORT_STATE_UP = 0x1, VPORT_STATE_UP = 0x1,
......
...@@ -807,15 +807,18 @@ int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq, ...@@ -807,15 +807,18 @@ int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
u16 lwm, int is_srq); u16 lwm, int is_srq);
void mlx5_init_mkey_table(struct mlx5_core_dev *dev); void mlx5_init_mkey_table(struct mlx5_core_dev *dev);
void mlx5_cleanup_mkey_table(struct mlx5_core_dev *dev); void mlx5_cleanup_mkey_table(struct mlx5_core_dev *dev);
int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev,
struct mlx5_core_mkey *mkey,
u32 *in, int inlen,
u32 *out, int outlen,
mlx5_cmd_cbk_t callback, void *context);
int mlx5_core_create_mkey(struct mlx5_core_dev *dev, int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
struct mlx5_core_mkey *mkey, struct mlx5_core_mkey *mkey,
struct mlx5_create_mkey_mbox_in *in, int inlen, u32 *in, int inlen);
mlx5_cmd_cbk_t callback, void *context,
struct mlx5_create_mkey_mbox_out *out);
int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev,
struct mlx5_core_mkey *mkey); struct mlx5_core_mkey *mkey);
int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey, int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey,
struct mlx5_query_mkey_mbox_out *out, int outlen); u32 *out, int outlen);
int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *_mkey, int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *_mkey,
u32 *mkey); u32 *mkey);
int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn); int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn);
......
...@@ -3489,7 +3489,7 @@ struct mlx5_ifc_query_special_contexts_out_bits { ...@@ -3489,7 +3489,7 @@ struct mlx5_ifc_query_special_contexts_out_bits {
u8 syndrome[0x20]; u8 syndrome[0x20];
u8 reserved_at_40[0x20]; u8 dump_fill_mkey[0x20];
u8 resd_lkey[0x20]; u8 resd_lkey[0x20];
}; };
......
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