2015-07-30 07:33:13

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 00/15] Modify MR allocation API

This patch set is detached from my WIP for modifying our
fast registration kernel API. I incorporated some comments
from Jason and Christoph. The current set is a drop-in replacement
of ib_alloc_fast_reg_mr to ib_alloc_mr which receives a memory
region type (whcih can be IB_MR_TYPE_MEM_REG for normal memory
registration, IB_MR_TYPE_SIGNATURE for a data-integrity capable
memory region and future arbitrary SG support capable memory
region).

Sagi Grimberg (15):
IB/core: Get rid of redundant verb ib_destroy_mr
IB: Modify ib_create_mr API
IB/iser: Convert to ib_alloc_mr
iser-target: Convert to ib_alloc_mr
IB/srp: Convert to ib_alloc_mr
xprtrdma, svcrdma: Convert to ib_alloc_mr
RDS: Convert to ib_alloc_mr
mlx5: Drop mlx5_ib_alloc_fast_reg_mr
mlx4: Support ib_alloc_mr verb
ocrdma: Support ib_alloc_mr verb
iw_cxgb4: Support ib_alloc_mr verb
cxgb3: Support ib_alloc_mr verb
nes: Support ib_alloc_mr verb
qib: Support ib_alloc_mr verb
IB/core: Drop ib_alloc_fast_reg_mr

drivers/infiniband/core/verbs.c | 62 +++++------------
drivers/infiniband/hw/cxgb3/iwch_provider.c | 14 ++--
drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 4 +-
drivers/infiniband/hw/cxgb4/mem.c | 12 +++-
drivers/infiniband/hw/cxgb4/provider.c | 2 +-
drivers/infiniband/hw/mlx4/main.c | 2 +-
drivers/infiniband/hw/mlx4/mlx4_ib.h | 5 +-
drivers/infiniband/hw/mlx4/mr.c | 11 ++-
drivers/infiniband/hw/mlx5/main.c | 4 +-
drivers/infiniband/hw/mlx5/mlx5_ib.h | 8 +--
drivers/infiniband/hw/mlx5/mr.c | 104 +++++++---------------------
drivers/infiniband/hw/nes/nes_verbs.c | 19 +++--
drivers/infiniband/hw/ocrdma/ocrdma_main.c | 2 +-
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 11 ++-
drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 4 +-
drivers/infiniband/hw/qib/qib_mr.c | 9 ++-
drivers/infiniband/hw/qib/qib_verbs.c | 2 +-
drivers/infiniband/hw/qib/qib_verbs.h | 4 +-
drivers/infiniband/ulp/iser/iser_verbs.c | 15 ++--
drivers/infiniband/ulp/isert/ib_isert.c | 14 ++--
drivers/infiniband/ulp/srp/ib_srp.c | 3 +-
include/rdma/ib_verbs.h | 58 ++++------------
net/rds/iw_rdma.c | 5 +-
net/rds/iw_send.c | 5 +-
net/sunrpc/xprtrdma/frwr_ops.c | 6 +-
net/sunrpc/xprtrdma/svc_rdma_transport.c | 2 +-
26 files changed, 159 insertions(+), 228 deletions(-)

--
1.8.4.3



2015-07-30 07:33:13

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 03/15] IB/iser: Convert to ib_alloc_mr

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/ulp/iser/iser_verbs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 9bef5a7..0a7ceb9 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -299,8 +299,8 @@ iser_alloc_pi_ctx(struct ib_device *ib_device, struct ib_pd *pd,
goto prot_frpl_failure;
}

- pi_ctx->prot_mr = ib_alloc_fast_reg_mr(pd,
- ISCSI_ISER_SG_TABLESIZE + 1);
+ pi_ctx->prot_mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG,
+ ISCSI_ISER_SG_TABLESIZE + 1);
if (IS_ERR(pi_ctx->prot_mr)) {
ret = PTR_ERR(pi_ctx->prot_mr);
goto prot_mr_failure;
@@ -351,7 +351,8 @@ iser_create_fastreg_desc(struct ib_device *ib_device, struct ib_pd *pd,
return PTR_ERR(desc->data_frpl);
}

- desc->data_mr = ib_alloc_fast_reg_mr(pd, ISCSI_ISER_SG_TABLESIZE + 1);
+ desc->data_mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG,
+ ISCSI_ISER_SG_TABLESIZE + 1);
if (IS_ERR(desc->data_mr)) {
ret = PTR_ERR(desc->data_mr);
iser_err("Failed to allocate ib_fast_reg_mr err=%d\n", ret);
--
1.8.4.3


2015-07-30 07:33:13

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 02/15] IB: Modify ib_create_mr API

Use ib_alloc_mr with specific parameters.
Change the existing callers.

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/core/verbs.c | 31 ++++++++++++++++++++------
drivers/infiniband/hw/mlx5/main.c | 2 +-
drivers/infiniband/hw/mlx5/mlx5_ib.h | 5 +++--
drivers/infiniband/hw/mlx5/mr.c | 17 ++++++++++-----
drivers/infiniband/ulp/iser/iser_verbs.c | 6 ++----
drivers/infiniband/ulp/isert/ib_isert.c | 6 +-----
include/rdma/ib_verbs.h | 37 +++++++++++++-------------------
7 files changed, 58 insertions(+), 46 deletions(-)

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 003bb62..2ac599b 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1272,15 +1272,32 @@ int ib_dereg_mr(struct ib_mr *mr)
}
EXPORT_SYMBOL(ib_dereg_mr);

-struct ib_mr *ib_create_mr(struct ib_pd *pd,
- struct ib_mr_init_attr *mr_init_attr)
+/**
+ * ib_alloc_mr() - Allocates a memory region
+ * @pd: protection domain associated with the region
+ * @mr_type: memory region type
+ * @max_num_sg: maximum sg entries available for registration.
+ *
+ * Notes:
+ * Memory registeration page/sg lists must not exceed max_num_sg.
+ * For mr_type IB_MR_TYPE_MEM_REG, the total length cannot exceed
+ * max_num_sg * used_page_size.
+ *
+ */
+struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg)
{
struct ib_mr *mr;

- if (!pd->device->create_mr)
- return ERR_PTR(-ENOSYS);
-
- mr = pd->device->create_mr(pd, mr_init_attr);
+ if (pd->device->alloc_mr) {
+ mr = pd->device->alloc_mr(pd, mr_type, max_num_sg);
+ } else {
+ if (mr_type != IB_MR_TYPE_MEM_REG ||
+ !pd->device->alloc_fast_reg_mr)
+ return ERR_PTR(-ENOSYS);
+ mr = pd->device->alloc_fast_reg_mr(pd, max_num_sg);
+ }

if (!IS_ERR(mr)) {
mr->device = pd->device;
@@ -1292,7 +1309,7 @@ struct ib_mr *ib_create_mr(struct ib_pd *pd,

return mr;
}
-EXPORT_SYMBOL(ib_create_mr);
+EXPORT_SYMBOL(ib_alloc_mr);

struct ib_mr *ib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len)
{
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 46d1383..2c2a461 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1489,7 +1489,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
dev->ib_dev.attach_mcast = mlx5_ib_mcg_attach;
dev->ib_dev.detach_mcast = mlx5_ib_mcg_detach;
dev->ib_dev.process_mad = mlx5_ib_process_mad;
- dev->ib_dev.create_mr = mlx5_ib_create_mr;
+ dev->ib_dev.alloc_mr = mlx5_ib_alloc_mr;
dev->ib_dev.alloc_fast_reg_mr = mlx5_ib_alloc_fast_reg_mr;
dev->ib_dev.alloc_fast_reg_page_list = mlx5_ib_alloc_fast_reg_page_list;
dev->ib_dev.free_fast_reg_page_list = mlx5_ib_free_fast_reg_page_list;
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 537f42e..3030abe 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -572,8 +572,9 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
int mlx5_ib_update_mtt(struct mlx5_ib_mr *mr, u64 start_page_index,
int npages, int zap);
int mlx5_ib_dereg_mr(struct ib_mr *ibmr);
-struct ib_mr *mlx5_ib_create_mr(struct ib_pd *pd,
- struct ib_mr_init_attr *mr_init_attr);
+struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg);
struct ib_mr *mlx5_ib_alloc_fast_reg_mr(struct ib_pd *pd,
int max_page_list_len);
struct ib_fast_reg_page_list *mlx5_ib_alloc_fast_reg_page_list(struct ib_device *ibdev,
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 03cf74e..b0b68bb 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1246,14 +1246,15 @@ int mlx5_ib_dereg_mr(struct ib_mr *ibmr)
return 0;
}

-struct ib_mr *mlx5_ib_create_mr(struct ib_pd *pd,
- struct ib_mr_init_attr *mr_init_attr)
+struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg)
{
struct mlx5_ib_dev *dev = to_mdev(pd->device);
struct mlx5_create_mkey_mbox_in *in;
struct mlx5_ib_mr *mr;
int access_mode, err;
- int ndescs = roundup(mr_init_attr->max_reg_descriptors, 4);
+ int ndescs = roundup(max_num_sg, 4);

mr = kzalloc(sizeof(*mr), GFP_KERNEL);
if (!mr)
@@ -1269,9 +1270,11 @@ struct ib_mr *mlx5_ib_create_mr(struct ib_pd *pd,
in->seg.xlt_oct_size = cpu_to_be32(ndescs);
in->seg.qpn_mkey7_0 = cpu_to_be32(0xffffff << 8);
in->seg.flags_pd = cpu_to_be32(to_mpd(pd)->pdn);
- access_mode = MLX5_ACCESS_MODE_MTT;

- if (mr_init_attr->flags & IB_MR_SIGNATURE_EN) {
+ if (mr_type == IB_MR_TYPE_MEM_REG) {
+ access_mode = MLX5_ACCESS_MODE_MTT;
+ in->seg.log2_page_size = PAGE_SHIFT;
+ } else if (mr_type == IB_MR_TYPE_SIGNATURE) {
u32 psv_index[2];

in->seg.flags_pd = cpu_to_be32(be32_to_cpu(in->seg.flags_pd) |
@@ -1297,6 +1300,10 @@ struct ib_mr *mlx5_ib_create_mr(struct ib_pd *pd,
mr->sig->sig_err_exists = false;
/* Next UMR, Arm SIGERR */
++mr->sig->sigerr_count;
+ } else {
+ mlx5_ib_warn(dev, "Invalid mr type %d\n", mr_type);
+ err = -EINVAL;
+ goto err_free_in;
}

in->seg.flags = MLX5_PERM_UMR_EN | access_mode;
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 255321c..9bef5a7 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -284,9 +284,7 @@ iser_alloc_pi_ctx(struct ib_device *ib_device, struct ib_pd *pd,
struct fast_reg_descriptor *desc)
{
struct iser_pi_context *pi_ctx = NULL;
- struct ib_mr_init_attr mr_init_attr = {.max_reg_descriptors = 2,
- .flags = IB_MR_SIGNATURE_EN};
- int ret = 0;
+ int ret;

desc->pi_ctx = kzalloc(sizeof(*desc->pi_ctx), GFP_KERNEL);
if (!desc->pi_ctx)
@@ -309,7 +307,7 @@ iser_alloc_pi_ctx(struct ib_device *ib_device, struct ib_pd *pd,
}
desc->reg_indicators |= ISER_PROT_KEY_VALID;

- pi_ctx->sig_mr = ib_create_mr(pd, &mr_init_attr);
+ pi_ctx->sig_mr = ib_alloc_mr(pd, IB_MR_TYPE_SIGNATURE, 2);
if (IS_ERR(pi_ctx->sig_mr)) {
ret = PTR_ERR(pi_ctx->sig_mr);
goto sig_mr_failure;
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 559e6be..23a793a 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -497,7 +497,6 @@ isert_create_pi_ctx(struct fast_reg_descriptor *desc,
struct ib_device *device,
struct ib_pd *pd)
{
- struct ib_mr_init_attr mr_init_attr;
struct pi_context *pi_ctx;
int ret;

@@ -525,10 +524,7 @@ isert_create_pi_ctx(struct fast_reg_descriptor *desc,
}
desc->ind |= ISERT_PROT_KEY_VALID;

- memset(&mr_init_attr, 0, sizeof(mr_init_attr));
- mr_init_attr.max_reg_descriptors = 2;
- mr_init_attr.flags |= IB_MR_SIGNATURE_EN;
- pi_ctx->sig_mr = ib_create_mr(pd, &mr_init_attr);
+ pi_ctx->sig_mr = ib_alloc_mr(pd, IB_MR_TYPE_SIGNATURE, 2);
if (IS_ERR(pi_ctx->sig_mr)) {
isert_err("Failed to allocate signature enabled mr err=%ld\n",
PTR_ERR(pi_ctx->sig_mr));
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index a534ee5..110044d 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -556,20 +556,18 @@ __attribute_const__ int ib_rate_to_mult(enum ib_rate rate);
*/
__attribute_const__ int ib_rate_to_mbps(enum ib_rate rate);

-enum ib_mr_create_flags {
- IB_MR_SIGNATURE_EN = 1,
-};

/**
- * ib_mr_init_attr - Memory region init attributes passed to routine
- * ib_create_mr.
- * @max_reg_descriptors: max number of registration descriptors that
- * may be used with registration work requests.
- * @flags: MR creation flags bit mask.
+ * enum ib_mr_type - memory region type
+ * @IB_MR_TYPE_MEM_REG: memory region that is used for
+ * normal registration
+ * @IB_MR_TYPE_SIGNATURE: memory region that is used for
+ * signature operations (data-integrity
+ * capable regions)
*/
-struct ib_mr_init_attr {
- int max_reg_descriptors;
- u32 flags;
+enum ib_mr_type {
+ IB_MR_TYPE_MEM_REG,
+ IB_MR_TYPE_SIGNATURE,
};

/**
@@ -1670,8 +1668,9 @@ struct ib_device {
int (*query_mr)(struct ib_mr *mr,
struct ib_mr_attr *mr_attr);
int (*dereg_mr)(struct ib_mr *mr);
- struct ib_mr * (*create_mr)(struct ib_pd *pd,
- struct ib_mr_init_attr *mr_init_attr);
+ struct ib_mr * (*alloc_mr)(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg);
struct ib_mr * (*alloc_fast_reg_mr)(struct ib_pd *pd,
int max_page_list_len);
struct ib_fast_reg_page_list * (*alloc_fast_reg_page_list)(struct ib_device *device,
@@ -2815,15 +2814,9 @@ int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);
*/
int ib_dereg_mr(struct ib_mr *mr);

-
-/**
- * ib_create_mr - Allocates a memory region that may be used for
- * signature handover operations.
- * @pd: The protection domain associated with the region.
- * @mr_init_attr: memory region init attributes.
- */
-struct ib_mr *ib_create_mr(struct ib_pd *pd,
- struct ib_mr_init_attr *mr_init_attr);
+struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg);

/**
* ib_alloc_fast_reg_mr - Allocates memory region usable with the
--
1.8.4.3


2015-07-30 07:33:18

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 01/15] IB/core: Get rid of redundant verb ib_destroy_mr

This was added in a thought of uniting all mr allocation
and deallocation routines but the fact is we have a single
deallocation routine already, ib_dereg_mr.

And, move mlx5_ib_destroy_mr specific logic into mlx5_ib_dereg_mr
(includes only signature stuff for now).

And, fixup the only callers (iser/isert) accordingly.

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/core/verbs.c | 17 -------------
drivers/infiniband/hw/mlx5/main.c | 1 -
drivers/infiniband/hw/mlx5/mlx5_ib.h | 1 -
drivers/infiniband/hw/mlx5/mr.c | 43 ++++++++++----------------------
drivers/infiniband/ulp/iser/iser_verbs.c | 2 +-
drivers/infiniband/ulp/isert/ib_isert.c | 2 +-
include/rdma/ib_verbs.h | 10 --------
7 files changed, 15 insertions(+), 61 deletions(-)

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index bb561c8..003bb62 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1294,23 +1294,6 @@ struct ib_mr *ib_create_mr(struct ib_pd *pd,
}
EXPORT_SYMBOL(ib_create_mr);

-int ib_destroy_mr(struct ib_mr *mr)
-{
- struct ib_pd *pd;
- int ret;
-
- if (atomic_read(&mr->usecnt))
- return -EBUSY;
-
- pd = mr->pd;
- ret = mr->device->destroy_mr(mr);
- if (!ret)
- atomic_dec(&pd->usecnt);
-
- return ret;
-}
-EXPORT_SYMBOL(ib_destroy_mr);
-
struct ib_mr *ib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len)
{
struct ib_mr *mr;
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 5cfb0b1..46d1383 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1486,7 +1486,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
dev->ib_dev.get_dma_mr = mlx5_ib_get_dma_mr;
dev->ib_dev.reg_user_mr = mlx5_ib_reg_user_mr;
dev->ib_dev.dereg_mr = mlx5_ib_dereg_mr;
- dev->ib_dev.destroy_mr = mlx5_ib_destroy_mr;
dev->ib_dev.attach_mcast = mlx5_ib_mcg_attach;
dev->ib_dev.detach_mcast = mlx5_ib_mcg_detach;
dev->ib_dev.process_mad = mlx5_ib_process_mad;
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 446d804..537f42e 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -572,7 +572,6 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
int mlx5_ib_update_mtt(struct mlx5_ib_mr *mr, u64 start_page_index,
int npages, int zap);
int mlx5_ib_dereg_mr(struct ib_mr *ibmr);
-int mlx5_ib_destroy_mr(struct ib_mr *ibmr);
struct ib_mr *mlx5_ib_create_mr(struct ib_pd *pd,
struct ib_mr_init_attr *mr_init_attr);
struct ib_mr *mlx5_ib_alloc_fast_reg_mr(struct ib_pd *pd,
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 4c92ca8..03cf74e 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1172,6 +1172,19 @@ static int clean_mr(struct mlx5_ib_mr *mr)
int umred = mr->umred;
int err;

+ if (mr->sig) {
+ if (mlx5_core_destroy_psv(dev->mdev,
+ mr->sig->psv_memory.psv_idx))
+ mlx5_ib_warn(dev, "failed to destroy mem psv %d\n",
+ mr->sig->psv_memory.psv_idx);
+ if (mlx5_core_destroy_psv(dev->mdev,
+ mr->sig->psv_wire.psv_idx))
+ mlx5_ib_warn(dev, "failed to destroy wire psv %d\n",
+ mr->sig->psv_wire.psv_idx);
+ kfree(mr->sig);
+ mr->sig = NULL;
+ }
+
if (!umred) {
err = destroy_mkey(dev, mr);
if (err) {
@@ -1319,36 +1332,6 @@ err_free:
return ERR_PTR(err);
}

-int mlx5_ib_destroy_mr(struct ib_mr *ibmr)
-{
- struct mlx5_ib_dev *dev = to_mdev(ibmr->device);
- struct mlx5_ib_mr *mr = to_mmr(ibmr);
- int err;
-
- if (mr->sig) {
- if (mlx5_core_destroy_psv(dev->mdev,
- mr->sig->psv_memory.psv_idx))
- mlx5_ib_warn(dev, "failed to destroy mem psv %d\n",
- mr->sig->psv_memory.psv_idx);
- if (mlx5_core_destroy_psv(dev->mdev,
- mr->sig->psv_wire.psv_idx))
- mlx5_ib_warn(dev, "failed to destroy wire psv %d\n",
- mr->sig->psv_wire.psv_idx);
- kfree(mr->sig);
- }
-
- err = destroy_mkey(dev, mr);
- if (err) {
- mlx5_ib_warn(dev, "failed to destroy mkey 0x%x (%d)\n",
- mr->mmr.key, err);
- return err;
- }
-
- kfree(mr);
-
- return err;
-}
-
struct ib_mr *mlx5_ib_alloc_fast_reg_mr(struct ib_pd *pd,
int max_page_list_len)
{
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 5226835..255321c 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -334,7 +334,7 @@ iser_free_pi_ctx(struct iser_pi_context *pi_ctx)
{
ib_free_fast_reg_page_list(pi_ctx->prot_frpl);
ib_dereg_mr(pi_ctx->prot_mr);
- ib_destroy_mr(pi_ctx->sig_mr);
+ ib_dereg_mr(pi_ctx->sig_mr);
kfree(pi_ctx);
}

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 00d75d9..559e6be 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -480,7 +480,7 @@ isert_conn_free_fastreg_pool(struct isert_conn *isert_conn)
if (fr_desc->pi_ctx) {
ib_free_fast_reg_page_list(fr_desc->pi_ctx->prot_frpl);
ib_dereg_mr(fr_desc->pi_ctx->prot_mr);
- ib_destroy_mr(fr_desc->pi_ctx->sig_mr);
+ ib_dereg_mr(fr_desc->pi_ctx->sig_mr);
kfree(fr_desc->pi_ctx);
}
kfree(fr_desc);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index eaec308..a534ee5 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1670,7 +1670,6 @@ struct ib_device {
int (*query_mr)(struct ib_mr *mr,
struct ib_mr_attr *mr_attr);
int (*dereg_mr)(struct ib_mr *mr);
- int (*destroy_mr)(struct ib_mr *mr);
struct ib_mr * (*create_mr)(struct ib_pd *pd,
struct ib_mr_init_attr *mr_init_attr);
struct ib_mr * (*alloc_fast_reg_mr)(struct ib_pd *pd,
@@ -2827,15 +2826,6 @@ struct ib_mr *ib_create_mr(struct ib_pd *pd,
struct ib_mr_init_attr *mr_init_attr);

/**
- * ib_destroy_mr - Destroys a memory region that was created using
- * ib_create_mr and removes it from HW translation tables.
- * @mr: The memory region to destroy.
- *
- * This function can fail, if the memory region has memory windows bound to it.
- */
-int ib_destroy_mr(struct ib_mr *mr);
-
-/**
* ib_alloc_fast_reg_mr - Allocates memory region usable with the
* IB_WR_FAST_REG_MR send work request.
* @pd: The protection domain associated with the region.
--
1.8.4.3


2015-07-30 07:33:25

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 05/15] IB/srp: Convert to ib_alloc_mr

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/ulp/srp/ib_srp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index a800307..4cc2cd4 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -378,7 +378,8 @@ static struct srp_fr_pool *srp_create_fr_pool(struct ib_device *device,
INIT_LIST_HEAD(&pool->free_list);

for (i = 0, d = &pool->desc[0]; i < pool->size; i++, d++) {
- mr = ib_alloc_fast_reg_mr(pd, max_page_list_len);
+ mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG,
+ max_page_list_len);
if (IS_ERR(mr)) {
ret = PTR_ERR(mr);
goto destroy_pool;
--
1.8.4.3


2015-07-30 07:33:28

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 04/15] iser-target: Convert to ib_alloc_mr

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/ulp/isert/ib_isert.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 23a793a..bf094cc 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -515,7 +515,8 @@ isert_create_pi_ctx(struct fast_reg_descriptor *desc,
goto err_pi_ctx;
}

- pi_ctx->prot_mr = ib_alloc_fast_reg_mr(pd, ISCSI_ISER_SG_TABLESIZE);
+ pi_ctx->prot_mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG,
+ ISCSI_ISER_SG_TABLESIZE);
if (IS_ERR(pi_ctx->prot_mr)) {
isert_err("Failed to allocate prot frmr err=%ld\n",
PTR_ERR(pi_ctx->prot_mr));
@@ -562,7 +563,8 @@ isert_create_fr_desc(struct ib_device *ib_device, struct ib_pd *pd,
return PTR_ERR(fr_desc->data_frpl);
}

- fr_desc->data_mr = ib_alloc_fast_reg_mr(pd, ISCSI_ISER_SG_TABLESIZE);
+ fr_desc->data_mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG,
+ ISCSI_ISER_SG_TABLESIZE);
if (IS_ERR(fr_desc->data_mr)) {
isert_err("Failed to allocate data frmr err=%ld\n",
PTR_ERR(fr_desc->data_mr));
--
1.8.4.3


2015-07-30 07:33:31

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 08/15] mlx5: Drop mlx5_ib_alloc_fast_reg_mr

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/hw/mlx5/main.c | 1 -
drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 --
drivers/infiniband/hw/mlx5/mr.c | 44 ------------------------------------
3 files changed, 47 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 2c2a461..41d6911 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1490,7 +1490,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
dev->ib_dev.detach_mcast = mlx5_ib_mcg_detach;
dev->ib_dev.process_mad = mlx5_ib_process_mad;
dev->ib_dev.alloc_mr = mlx5_ib_alloc_mr;
- dev->ib_dev.alloc_fast_reg_mr = mlx5_ib_alloc_fast_reg_mr;
dev->ib_dev.alloc_fast_reg_page_list = mlx5_ib_alloc_fast_reg_page_list;
dev->ib_dev.free_fast_reg_page_list = mlx5_ib_free_fast_reg_page_list;
dev->ib_dev.check_mr_status = mlx5_ib_check_mr_status;
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 3030abe..a5fa0b9 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -575,8 +575,6 @@ int mlx5_ib_dereg_mr(struct ib_mr *ibmr);
struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd,
enum ib_mr_type mr_type,
u32 max_num_sg);
-struct ib_mr *mlx5_ib_alloc_fast_reg_mr(struct ib_pd *pd,
- int max_page_list_len);
struct ib_fast_reg_page_list *mlx5_ib_alloc_fast_reg_page_list(struct ib_device *ibdev,
int page_list_len);
void mlx5_ib_free_fast_reg_page_list(struct ib_fast_reg_page_list *page_list);
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index b0b68bb..09e6ae6 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1339,50 +1339,6 @@ err_free:
return ERR_PTR(err);
}

-struct ib_mr *mlx5_ib_alloc_fast_reg_mr(struct ib_pd *pd,
- int max_page_list_len)
-{
- struct mlx5_ib_dev *dev = to_mdev(pd->device);
- struct mlx5_create_mkey_mbox_in *in;
- struct mlx5_ib_mr *mr;
- int err;
-
- mr = kzalloc(sizeof(*mr), GFP_KERNEL);
- if (!mr)
- return ERR_PTR(-ENOMEM);
-
- in = kzalloc(sizeof(*in), GFP_KERNEL);
- if (!in) {
- err = -ENOMEM;
- goto err_free;
- }
-
- in->seg.status = MLX5_MKEY_STATUS_FREE;
- in->seg.xlt_oct_size = cpu_to_be32((max_page_list_len + 1) / 2);
- in->seg.qpn_mkey7_0 = cpu_to_be32(0xffffff << 8);
- in->seg.flags = MLX5_PERM_UMR_EN | MLX5_ACCESS_MODE_MTT;
- in->seg.flags_pd = cpu_to_be32(to_mpd(pd)->pdn);
- /*
- * TBD not needed - issue 197292 */
- in->seg.log2_page_size = PAGE_SHIFT;
-
- err = mlx5_core_create_mkey(dev->mdev, &mr->mmr, in, sizeof(*in), NULL,
- NULL, NULL);
- kfree(in);
- if (err)
- goto err_free;
-
- mr->ibmr.lkey = mr->mmr.key;
- mr->ibmr.rkey = mr->mmr.key;
- mr->umem = NULL;
-
- return &mr->ibmr;
-
-err_free:
- kfree(mr);
- return ERR_PTR(err);
-}
-
struct ib_fast_reg_page_list *mlx5_ib_alloc_fast_reg_page_list(struct ib_device *ibdev,
int page_list_len)
{
--
1.8.4.3


2015-07-30 07:33:30

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 07/15] RDS: Convert to ib_alloc_mr

Signed-off-by: Sagi Grimberg <[email protected]>
---
net/rds/iw_rdma.c | 5 +++--
net/rds/iw_send.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c
index dba8d08..6a8fbd6 100644
--- a/net/rds/iw_rdma.c
+++ b/net/rds/iw_rdma.c
@@ -667,11 +667,12 @@ static int rds_iw_init_fastreg(struct rds_iw_mr_pool *pool,
struct ib_mr *mr;
int err;

- mr = ib_alloc_fast_reg_mr(rds_iwdev->pd, pool->max_message_size);
+ mr = ib_alloc_mr(rds_iwdev->pd, IB_MR_TYPE_MEM_REG,
+ pool->max_message_size);
if (IS_ERR(mr)) {
err = PTR_ERR(mr);

- printk(KERN_WARNING "RDS/IW: ib_alloc_fast_reg_mr failed (err=%d)\n", err);
+ printk(KERN_WARNING "RDS/IW: ib_alloc_mr failed (err=%d)\n", err);
return err;
}

diff --git a/net/rds/iw_send.c b/net/rds/iw_send.c
index 334fe98..86152ec 100644
--- a/net/rds/iw_send.c
+++ b/net/rds/iw_send.c
@@ -153,9 +153,10 @@ void rds_iw_send_init_ring(struct rds_iw_connection *ic)
sge->length = sizeof(struct rds_header);
sge->lkey = 0;

- send->s_mr = ib_alloc_fast_reg_mr(ic->i_pd, fastreg_message_size);
+ send->s_mr = ib_alloc_mr(ic->i_pd, IB_MR_TYPE_MEM_REG,
+ fastreg_message_size);
if (IS_ERR(send->s_mr)) {
- printk(KERN_WARNING "RDS/IW: ib_alloc_fast_reg_mr failed\n");
+ printk(KERN_WARNING "RDS/IW: ib_alloc_mr failed\n");
break;
}

--
1.8.4.3


2015-07-30 07:33:38

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 4 +++-
drivers/infiniband/hw/cxgb4/mem.c | 12 +++++++++---
drivers/infiniband/hw/cxgb4/provider.c | 2 +-
3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
index cc77844..c7bb38c 100644
--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
@@ -970,7 +970,9 @@ void c4iw_free_fastreg_pbl(struct ib_fast_reg_page_list *page_list);
struct ib_fast_reg_page_list *c4iw_alloc_fastreg_pbl(
struct ib_device *device,
int page_list_len);
-struct ib_mr *c4iw_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth);
+struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg);
int c4iw_dealloc_mw(struct ib_mw *mw);
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start,
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
index cff815b..026b91e 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
@@ -853,7 +853,9 @@ int c4iw_dealloc_mw(struct ib_mw *mw)
return 0;
}

-struct ib_mr *c4iw_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth)
+struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg)
{
struct c4iw_dev *rhp;
struct c4iw_pd *php;
@@ -862,6 +864,10 @@ struct ib_mr *c4iw_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth)
u32 stag = 0;
int ret = 0;

+ if (mr_type != IB_MR_TYPE_MEM_REG ||
+ max_num_sg > t4_max_fr_depth(use_dsgl))
+ return ERR_PTR(-EINVAL);
+
php = to_c4iw_pd(pd);
rhp = php->rhp;
mhp = kzalloc(sizeof(*mhp), GFP_KERNEL);
@@ -871,10 +877,10 @@ struct ib_mr *c4iw_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth)
}

mhp->rhp = rhp;
- ret = alloc_pbl(mhp, pbl_depth);
+ ret = alloc_pbl(mhp, max_num_sg);
if (ret)
goto err1;
- mhp->attr.pbl_size = pbl_depth;
+ mhp->attr.pbl_size = max_num_sg;
ret = allocate_stag(&rhp->rdev, &stag, php->pdid,
mhp->attr.pbl_size, mhp->attr.pbl_addr);
if (ret)
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index 6eee3d3..7746113 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -556,7 +556,7 @@ int c4iw_register_device(struct c4iw_dev *dev)
dev->ibdev.alloc_mw = c4iw_alloc_mw;
dev->ibdev.bind_mw = c4iw_bind_mw;
dev->ibdev.dealloc_mw = c4iw_dealloc_mw;
- dev->ibdev.alloc_fast_reg_mr = c4iw_alloc_fast_reg_mr;
+ dev->ibdev.alloc_mr = c4iw_alloc_mr;
dev->ibdev.alloc_fast_reg_page_list = c4iw_alloc_fastreg_pbl;
dev->ibdev.free_fast_reg_page_list = c4iw_free_fastreg_pbl;
dev->ibdev.attach_mcast = c4iw_multicast_attach;
--
1.8.4.3


2015-07-30 07:33:45

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 10/15] ocrdma: Support ib_alloc_mr verb

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/hw/ocrdma/ocrdma_main.c | 2 +-
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 11 ++++++++---
drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 4 +++-
3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index d98a707..62086ba 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -294,7 +294,7 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
dev->ibdev.dereg_mr = ocrdma_dereg_mr;
dev->ibdev.reg_user_mr = ocrdma_reg_user_mr;

- dev->ibdev.alloc_fast_reg_mr = ocrdma_alloc_frmr;
+ dev->ibdev.alloc_mr = ocrdma_alloc_mr;
dev->ibdev.alloc_fast_reg_page_list = ocrdma_alloc_frmr_page_list;
dev->ibdev.free_fast_reg_page_list = ocrdma_free_frmr_page_list;

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 5bb61eb..7a5260f 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -2983,21 +2983,26 @@ int ocrdma_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags cq_flags)
return 0;
}

-struct ib_mr *ocrdma_alloc_frmr(struct ib_pd *ibpd, int max_page_list_len)
+struct ib_mr *ocrdma_alloc_mr(struct ib_pd *ibpd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg)
{
int status;
struct ocrdma_mr *mr;
struct ocrdma_pd *pd = get_ocrdma_pd(ibpd);
struct ocrdma_dev *dev = get_ocrdma_dev(ibpd->device);

- if (max_page_list_len > dev->attr.max_pages_per_frmr)
+ if (mr_type != IB_MR_TYPE_MEM_REG)
+ return ERR_PTR(-EINVAL);
+
+ if (max_num_sg > dev->attr.max_pages_per_frmr)
return ERR_PTR(-EINVAL);

mr = kzalloc(sizeof(*mr), GFP_KERNEL);
if (!mr)
return ERR_PTR(-ENOMEM);

- status = ocrdma_get_pbl_info(dev, mr, max_page_list_len);
+ status = ocrdma_get_pbl_info(dev, mr, max_num_sg);
if (status)
goto pbl_err;
mr->hwmr.fr_mr = 1;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h
index b15c608..50d8d47 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h
@@ -96,7 +96,9 @@ struct ib_mr *ocrdma_reg_kernel_mr(struct ib_pd *,
int num_phys_buf, int acc, u64 *iova_start);
struct ib_mr *ocrdma_reg_user_mr(struct ib_pd *, u64 start, u64 length,
u64 virt, int acc, struct ib_udata *);
-struct ib_mr *ocrdma_alloc_frmr(struct ib_pd *pd, int max_page_list_len);
+struct ib_mr *ocrdma_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg);
struct ib_fast_reg_page_list *ocrdma_alloc_frmr_page_list(struct ib_device
*ibdev,
int page_list_len);
--
1.8.4.3


2015-07-30 07:33:50

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 14/15] qib: Support ib_alloc_mr verb

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/hw/qib/qib_mr.c | 9 +++++++--
drivers/infiniband/hw/qib/qib_verbs.c | 2 +-
drivers/infiniband/hw/qib/qib_verbs.h | 4 +++-
3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_mr.c b/drivers/infiniband/hw/qib/qib_mr.c
index c4473db..19220dc 100644
--- a/drivers/infiniband/hw/qib/qib_mr.c
+++ b/drivers/infiniband/hw/qib/qib_mr.c
@@ -327,11 +327,16 @@ out:
*
* Return the memory region on success, otherwise return an errno.
*/
-struct ib_mr *qib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len)
+struct ib_mr *qib_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg)
{
struct qib_mr *mr;

- mr = alloc_mr(max_page_list_len, pd);
+ if (mr_type != IB_MR_TYPE_MEM_REG)
+ return ERR_PTR(-EINVAL);
+
+ mr = alloc_mr(max_num_sg, pd);
if (IS_ERR(mr))
return (struct ib_mr *)mr;

diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c
index a05d1a3..ef022a1 100644
--- a/drivers/infiniband/hw/qib/qib_verbs.c
+++ b/drivers/infiniband/hw/qib/qib_verbs.c
@@ -2235,7 +2235,7 @@ int qib_register_ib_device(struct qib_devdata *dd)
ibdev->reg_phys_mr = qib_reg_phys_mr;
ibdev->reg_user_mr = qib_reg_user_mr;
ibdev->dereg_mr = qib_dereg_mr;
- ibdev->alloc_fast_reg_mr = qib_alloc_fast_reg_mr;
+ ibdev->alloc_mr = qib_alloc_mr;
ibdev->alloc_fast_reg_page_list = qib_alloc_fast_reg_page_list;
ibdev->free_fast_reg_page_list = qib_free_fast_reg_page_list;
ibdev->alloc_fmr = qib_alloc_fmr;
diff --git a/drivers/infiniband/hw/qib/qib_verbs.h b/drivers/infiniband/hw/qib/qib_verbs.h
index 1635572..3bc0caf 100644
--- a/drivers/infiniband/hw/qib/qib_verbs.h
+++ b/drivers/infiniband/hw/qib/qib_verbs.h
@@ -1032,7 +1032,9 @@ struct ib_mr *qib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,

int qib_dereg_mr(struct ib_mr *ibmr);

-struct ib_mr *qib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len);
+struct ib_mr *qib_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_entries);

struct ib_fast_reg_page_list *qib_alloc_fast_reg_page_list(
struct ib_device *ibdev, int page_list_len);
--
1.8.4.3


2015-07-30 07:33:54

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 15/15] IB/core: Drop ib_alloc_fast_reg_mr

Fully replaced by a more generic and suitable
ib_alloc_mr.

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/core/verbs.c | 32 +++-----------------------------
include/rdma/ib_verbs.h | 11 -----------
2 files changed, 3 insertions(+), 40 deletions(-)

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 2ac599b..2e5fd89 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1290,36 +1290,10 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
{
struct ib_mr *mr;

- if (pd->device->alloc_mr) {
- mr = pd->device->alloc_mr(pd, mr_type, max_num_sg);
- } else {
- if (mr_type != IB_MR_TYPE_MEM_REG ||
- !pd->device->alloc_fast_reg_mr)
- return ERR_PTR(-ENOSYS);
- mr = pd->device->alloc_fast_reg_mr(pd, max_num_sg);
- }
-
- if (!IS_ERR(mr)) {
- mr->device = pd->device;
- mr->pd = pd;
- mr->uobject = NULL;
- atomic_inc(&pd->usecnt);
- atomic_set(&mr->usecnt, 0);
- }
-
- return mr;
-}
-EXPORT_SYMBOL(ib_alloc_mr);
-
-struct ib_mr *ib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len)
-{
- struct ib_mr *mr;
-
- if (!pd->device->alloc_fast_reg_mr)
+ if (!pd->device->alloc_mr)
return ERR_PTR(-ENOSYS);

- mr = pd->device->alloc_fast_reg_mr(pd, max_page_list_len);
-
+ mr = pd->device->alloc_mr(pd, mr_type, max_num_sg);
if (!IS_ERR(mr)) {
mr->device = pd->device;
mr->pd = pd;
@@ -1330,7 +1304,7 @@ struct ib_mr *ib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len)

return mr;
}
-EXPORT_SYMBOL(ib_alloc_fast_reg_mr);
+EXPORT_SYMBOL(ib_alloc_mr);

struct ib_fast_reg_page_list *ib_alloc_fast_reg_page_list(struct ib_device *device,
int max_page_list_len)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 110044d..a2c328b 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1671,8 +1671,6 @@ struct ib_device {
struct ib_mr * (*alloc_mr)(struct ib_pd *pd,
enum ib_mr_type mr_type,
u32 max_num_sg);
- struct ib_mr * (*alloc_fast_reg_mr)(struct ib_pd *pd,
- int max_page_list_len);
struct ib_fast_reg_page_list * (*alloc_fast_reg_page_list)(struct ib_device *device,
int page_list_len);
void (*free_fast_reg_page_list)(struct ib_fast_reg_page_list *page_list);
@@ -2819,15 +2817,6 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
u32 max_num_sg);

/**
- * ib_alloc_fast_reg_mr - Allocates memory region usable with the
- * IB_WR_FAST_REG_MR send work request.
- * @pd: The protection domain associated with the region.
- * @max_page_list_len: requested max physical buffer list length to be
- * used with fast register work requests for this MR.
- */
-struct ib_mr *ib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len);
-
-/**
* ib_alloc_fast_reg_page_list - Allocates a page list array
* @device - ib device pointer.
* @page_list_len - size of the page list array to be allocated.
--
1.8.4.3


2015-07-30 07:33:56

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 12/15] cxgb3: Support ib_alloc_mr verb

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/hw/cxgb3/iwch_provider.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index b1b7323..7e004c7 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -796,7 +796,9 @@ static int iwch_dealloc_mw(struct ib_mw *mw)
return 0;
}

-static struct ib_mr *iwch_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth)
+static struct ib_mr *iwch_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg)
{
struct iwch_dev *rhp;
struct iwch_pd *php;
@@ -805,6 +807,10 @@ static struct ib_mr *iwch_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth)
u32 stag = 0;
int ret = 0;

+ if (mr_type != IB_MR_TYPE_MEM_REG ||
+ max_num_sg > T3_MAX_FASTREG_DEPTH)
+ return ERR_PTR(-EINVAL);
+
php = to_iwch_pd(pd);
rhp = php->rhp;
mhp = kzalloc(sizeof(*mhp), GFP_KERNEL);
@@ -812,10 +818,10 @@ static struct ib_mr *iwch_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth)
goto err;

mhp->rhp = rhp;
- ret = iwch_alloc_pbl(mhp, pbl_depth);
+ ret = iwch_alloc_pbl(mhp, max_num_sg);
if (ret)
goto err1;
- mhp->attr.pbl_size = pbl_depth;
+ mhp->attr.pbl_size = max_num_sg;
ret = cxio_allocate_stag(&rhp->rdev, &stag, php->pdid,
mhp->attr.pbl_size, mhp->attr.pbl_addr);
if (ret)
@@ -1439,7 +1445,7 @@ int iwch_register_device(struct iwch_dev *dev)
dev->ibdev.alloc_mw = iwch_alloc_mw;
dev->ibdev.bind_mw = iwch_bind_mw;
dev->ibdev.dealloc_mw = iwch_dealloc_mw;
- dev->ibdev.alloc_fast_reg_mr = iwch_alloc_fast_reg_mr;
+ dev->ibdev.alloc_mr = iwch_alloc_mr;
dev->ibdev.alloc_fast_reg_page_list = iwch_alloc_fastreg_pbl;
dev->ibdev.free_fast_reg_page_list = iwch_free_fastreg_pbl;
dev->ibdev.attach_mcast = iwch_multicast_attach;
--
1.8.4.3


2015-07-30 07:33:53

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 09/15] mlx4: Support ib_alloc_mr verb

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/hw/mlx4/main.c | 2 +-
drivers/infiniband/hw/mlx4/mlx4_ib.h | 5 +++--
drivers/infiniband/hw/mlx4/mr.c | 11 ++++++++---
3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 05166b7..9ab73a4 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2294,7 +2294,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
ibdev->ib_dev.reg_user_mr = mlx4_ib_reg_user_mr;
ibdev->ib_dev.rereg_user_mr = mlx4_ib_rereg_user_mr;
ibdev->ib_dev.dereg_mr = mlx4_ib_dereg_mr;
- ibdev->ib_dev.alloc_fast_reg_mr = mlx4_ib_alloc_fast_reg_mr;
+ ibdev->ib_dev.alloc_mr = mlx4_ib_alloc_mr;
ibdev->ib_dev.alloc_fast_reg_page_list = mlx4_ib_alloc_fast_reg_page_list;
ibdev->ib_dev.free_fast_reg_page_list = mlx4_ib_free_fast_reg_page_list;
ibdev->ib_dev.attach_mcast = mlx4_ib_mcg_attach;
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h
index 9066fc2..80228b2 100644
--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h
+++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h
@@ -679,8 +679,9 @@ struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
int mlx4_ib_bind_mw(struct ib_qp *qp, struct ib_mw *mw,
struct ib_mw_bind *mw_bind);
int mlx4_ib_dealloc_mw(struct ib_mw *mw);
-struct ib_mr *mlx4_ib_alloc_fast_reg_mr(struct ib_pd *pd,
- int max_page_list_len);
+struct ib_mr *mlx4_ib_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg);
struct ib_fast_reg_page_list *mlx4_ib_alloc_fast_reg_page_list(struct ib_device *ibdev,
int page_list_len);
void mlx4_ib_free_fast_reg_page_list(struct ib_fast_reg_page_list *page_list);
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c
index e0d2717..2542fd3 100644
--- a/drivers/infiniband/hw/mlx4/mr.c
+++ b/drivers/infiniband/hw/mlx4/mr.c
@@ -350,19 +350,24 @@ int mlx4_ib_dealloc_mw(struct ib_mw *ibmw)
return 0;
}

-struct ib_mr *mlx4_ib_alloc_fast_reg_mr(struct ib_pd *pd,
- int max_page_list_len)
+struct ib_mr *mlx4_ib_alloc_mr(struct ib_pd *pd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg)
{
struct mlx4_ib_dev *dev = to_mdev(pd->device);
struct mlx4_ib_mr *mr;
int err;

+ if (mr_type != IB_MR_TYPE_MEM_REG ||
+ max_num_sg > MLX4_MAX_FAST_REG_PAGES)
+ return ERR_PTR(-EINVAL);
+
mr = kmalloc(sizeof *mr, GFP_KERNEL);
if (!mr)
return ERR_PTR(-ENOMEM);

err = mlx4_mr_alloc(dev->dev, to_mpd(pd)->pdn, 0, 0, 0,
- max_page_list_len, 0, &mr->mmr);
+ max_num_sg, 0, &mr->mmr);
if (err)
goto err_free;

--
1.8.4.3


2015-07-30 07:34:00

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 13/15] nes: Support ib_alloc_mr verb

Signed-off-by: Sagi Grimberg <[email protected]>
---
drivers/infiniband/hw/nes/nes_verbs.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index fbc43e5..44cb513 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -375,9 +375,11 @@ static int alloc_fast_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
}

/*
- * nes_alloc_fast_reg_mr
+ * nes_alloc_mr
*/
-static struct ib_mr *nes_alloc_fast_reg_mr(struct ib_pd *ibpd, int max_page_list_len)
+static struct ib_mr *nes_alloc_mr(struct ib_pd *ibpd,
+ enum ib_mr_type mr_type,
+ u32 max_num_sg)
{
struct nes_pd *nespd = to_nespd(ibpd);
struct nes_vnic *nesvnic = to_nesvnic(ibpd->device);
@@ -393,11 +395,18 @@ static struct ib_mr *nes_alloc_fast_reg_mr(struct ib_pd *ibpd, int max_page_list
u32 stag;
int ret;
struct ib_mr *ibmr;
+
+ if (mr_type != IB_MR_TYPE_MEM_REG)
+ return ERR_PTR(-EINVAL);
+
+ if (max_num_sg > (NES_4K_PBL_CHUNK_SIZE / sizeof(u64)))
+ return ERR_PTR(-E2BIG);
+
/*
* Note: Set to always use a fixed length single page entry PBL. This is to allow
* for the fast_reg_mr operation to always know the size of the PBL.
*/
- if (max_page_list_len > (NES_4K_PBL_CHUNK_SIZE / sizeof(u64)))
+ if (max_num_sg > (NES_4K_PBL_CHUNK_SIZE / sizeof(u64)))
return ERR_PTR(-E2BIG);

get_random_bytes(&next_stag_index, sizeof(next_stag_index));
@@ -424,7 +433,7 @@ static struct ib_mr *nes_alloc_fast_reg_mr(struct ib_pd *ibpd, int max_page_list
nes_debug(NES_DBG_MR, "Allocating STag 0x%08X index = 0x%08X\n",
stag, stag_index);

- ret = alloc_fast_reg_mr(nesdev, nespd, stag, max_page_list_len);
+ ret = alloc_fast_reg_mr(nesdev, nespd, stag, max_num_sg);

if (ret == 0) {
nesmr->ibmr.rkey = stag;
@@ -3929,7 +3938,7 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev)
nesibdev->ibdev.dealloc_mw = nes_dealloc_mw;
nesibdev->ibdev.bind_mw = nes_bind_mw;

- nesibdev->ibdev.alloc_fast_reg_mr = nes_alloc_fast_reg_mr;
+ nesibdev->ibdev.alloc_mr = nes_alloc_mr;
nesibdev->ibdev.alloc_fast_reg_page_list = nes_alloc_fast_reg_page_list;
nesibdev->ibdev.free_fast_reg_page_list = nes_free_fast_reg_page_list;

--
1.8.4.3


2015-07-30 07:33:33

by Sagi Grimberg

[permalink] [raw]
Subject: [PATCH for-4.3 06/15] xprtrdma, svcrdma: Convert to ib_alloc_mr

Signed-off-by: Sagi Grimberg <[email protected]>
---
net/sunrpc/xprtrdma/frwr_ops.c | 6 +++---
net/sunrpc/xprtrdma/svc_rdma_transport.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c
index 63f282e..d6653f5 100644
--- a/net/sunrpc/xprtrdma/frwr_ops.c
+++ b/net/sunrpc/xprtrdma/frwr_ops.c
@@ -117,7 +117,7 @@ __frwr_recovery_worker(struct work_struct *work)
if (ib_dereg_mr(r->r.frmr.fr_mr))
goto out_fail;

- r->r.frmr.fr_mr = ib_alloc_fast_reg_mr(pd, depth);
+ r->r.frmr.fr_mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG, depth);
if (IS_ERR(r->r.frmr.fr_mr))
goto out_fail;

@@ -148,7 +148,7 @@ __frwr_init(struct rpcrdma_mw *r, struct ib_pd *pd, struct ib_device *device,
struct rpcrdma_frmr *f = &r->r.frmr;
int rc;

- f->fr_mr = ib_alloc_fast_reg_mr(pd, depth);
+ f->fr_mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG, depth);
if (IS_ERR(f->fr_mr))
goto out_mr_err;
f->fr_pgl = ib_alloc_fast_reg_page_list(device, depth);
@@ -158,7 +158,7 @@ __frwr_init(struct rpcrdma_mw *r, struct ib_pd *pd, struct ib_device *device,

out_mr_err:
rc = PTR_ERR(f->fr_mr);
- dprintk("RPC: %s: ib_alloc_fast_reg_mr status %i\n",
+ dprintk("RPC: %s: ib_alloc_mr status %i\n",
__func__, rc);
return rc;

diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index 6b36279..adcf904 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -738,7 +738,7 @@ static struct svc_rdma_fastreg_mr *rdma_alloc_frmr(struct svcxprt_rdma *xprt)
if (!frmr)
goto err;

- mr = ib_alloc_fast_reg_mr(xprt->sc_pd, RPCSVC_MAXPAGES);
+ mr = ib_alloc_mr(xprt->sc_pd, IB_MR_TYPE_MEM_REG, RPCSVC_MAXPAGES);
if (IS_ERR(mr))
goto err_free_frmr;

--
1.8.4.3


2015-07-30 13:53:43

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH for-4.3 00/15] Modify MR allocation API

On Thu, Jul 30, 2015 at 10:32:33AM +0300, Sagi Grimberg wrote:
> This patch set is detached from my WIP for modifying our
> fast registration kernel API. I incorporated some comments
> from Jason and Christoph. The current set is a drop-in replacement
> of ib_alloc_fast_reg_mr to ib_alloc_mr which receives a memory
> region type (whcih can be IB_MR_TYPE_MEM_REG for normal memory
> registration, IB_MR_TYPE_SIGNATURE for a data-integrity capable
> memory region and future arbitrary SG support capable memory
> region).

While this series doesn't get us much yet it looks reasonable.
So let's start small and get this one in.

2015-07-30 14:50:57

by Steve Wise

[permalink] [raw]
Subject: Re: [PATCH for-4.3 02/15] IB: Modify ib_create_mr API

On 7/30/2015 2:32 AM, Sagi Grimberg wrote:
> Use ib_alloc_mr with specific parameters.
> Change the existing callers.
>
> Signed-off-by: Sagi Grimberg <[email protected]>
> ---
> drivers/infiniband/core/verbs.c | 31 ++++++++++++++++++++------
> drivers/infiniband/hw/mlx5/main.c | 2 +-
> drivers/infiniband/hw/mlx5/mlx5_ib.h | 5 +++--
> drivers/infiniband/hw/mlx5/mr.c | 17 ++++++++++-----
> drivers/infiniband/ulp/iser/iser_verbs.c | 6 ++----
> drivers/infiniband/ulp/isert/ib_isert.c | 6 +-----
> include/rdma/ib_verbs.h | 37 +++++++++++++-------------------
> 7 files changed, 58 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index 003bb62..2ac599b 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -1272,15 +1272,32 @@ int ib_dereg_mr(struct ib_mr *mr)
> }
> EXPORT_SYMBOL(ib_dereg_mr);
>
> -struct ib_mr *ib_create_mr(struct ib_pd *pd,
> - struct ib_mr_init_attr *mr_init_attr)
> +/**
> + * ib_alloc_mr() - Allocates a memory region
> + * @pd: protection domain associated with the region
> + * @mr_type: memory region type
> + * @max_num_sg: maximum sg entries available for registration.
> + *
> + * Notes:
> + * Memory registeration page/sg lists must not exceed max_num_sg.
> + * For mr_type IB_MR_TYPE_MEM_REG, the total length cannot exceed
> + * max_num_sg * used_page_size.
> + *

Nit: the above sounds like used_page_size is a variable. Something
like this might work?

"max_num_sg * the page size used for this sg list."


> + */
> +struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
> + enum ib_mr_type mr_type,
> + u32 max_num_sg)
> {
> struct ib_mr *mr;
>
> - if (!pd->device->create_mr)
> - return ERR_PTR(-ENOSYS);
> -
> - mr = pd->device->create_mr(pd, mr_init_attr);
> + if (pd->device->alloc_mr) {
> + mr = pd->device->alloc_mr(pd, mr_type, max_num_sg);
> + } else {
> + if (mr_type != IB_MR_TYPE_MEM_REG ||
> + !pd->device->alloc_fast_reg_mr)
> + return ERR_PTR(-ENOSYS);
> + mr = pd->device->alloc_fast_reg_mr(pd, max_num_sg);
> + }
>
> if (!IS_ERR(mr)) {
> mr->device = pd->device;
> @@ -1292,7 +1309,7 @@ struct ib_mr *ib_create_mr(struct ib_pd *pd,
>
> return mr;
> }
> -EXPORT_SYMBOL(ib_create_mr);
> +EXPORT_SYMBOL(ib_alloc_mr);
>
> struct ib_mr *ib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len)
> {
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 46d1383..2c2a461 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -1489,7 +1489,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
> dev->ib_dev.attach_mcast = mlx5_ib_mcg_attach;
> dev->ib_dev.detach_mcast = mlx5_ib_mcg_detach;
> dev->ib_dev.process_mad = mlx5_ib_process_mad;
> - dev->ib_dev.create_mr = mlx5_ib_create_mr;
> + dev->ib_dev.alloc_mr = mlx5_ib_alloc_mr;
> dev->ib_dev.alloc_fast_reg_mr = mlx5_ib_alloc_fast_reg_mr;
> dev->ib_dev.alloc_fast_reg_page_list = mlx5_ib_alloc_fast_reg_page_list;
> dev->ib_dev.free_fast_reg_page_list = mlx5_ib_free_fast_reg_page_list;
> diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
> index 537f42e..3030abe 100644
> --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
> +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
> @@ -572,8 +572,9 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
> int mlx5_ib_update_mtt(struct mlx5_ib_mr *mr, u64 start_page_index,
> int npages, int zap);
> int mlx5_ib_dereg_mr(struct ib_mr *ibmr);
> -struct ib_mr *mlx5_ib_create_mr(struct ib_pd *pd,
> - struct ib_mr_init_attr *mr_init_attr);
> +struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd,
> + enum ib_mr_type mr_type,
> + u32 max_num_sg);
> struct ib_mr *mlx5_ib_alloc_fast_reg_mr(struct ib_pd *pd,
> int max_page_list_len);
> struct ib_fast_reg_page_list *mlx5_ib_alloc_fast_reg_page_list(struct ib_device *ibdev,
> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index 03cf74e..b0b68bb 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -1246,14 +1246,15 @@ int mlx5_ib_dereg_mr(struct ib_mr *ibmr)
> return 0;
> }
>
> -struct ib_mr *mlx5_ib_create_mr(struct ib_pd *pd,
> - struct ib_mr_init_attr *mr_init_attr)
> +struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd,
> + enum ib_mr_type mr_type,
> + u32 max_num_sg)
> {
> struct mlx5_ib_dev *dev = to_mdev(pd->device);
> struct mlx5_create_mkey_mbox_in *in;
> struct mlx5_ib_mr *mr;
> int access_mode, err;
> - int ndescs = roundup(mr_init_attr->max_reg_descriptors, 4);
> + int ndescs = roundup(max_num_sg, 4);
>
> mr = kzalloc(sizeof(*mr), GFP_KERNEL);
> if (!mr)
> @@ -1269,9 +1270,11 @@ struct ib_mr *mlx5_ib_create_mr(struct ib_pd *pd,
> in->seg.xlt_oct_size = cpu_to_be32(ndescs);
> in->seg.qpn_mkey7_0 = cpu_to_be32(0xffffff << 8);
> in->seg.flags_pd = cpu_to_be32(to_mpd(pd)->pdn);
> - access_mode = MLX5_ACCESS_MODE_MTT;
>
> - if (mr_init_attr->flags & IB_MR_SIGNATURE_EN) {
> + if (mr_type == IB_MR_TYPE_MEM_REG) {
> + access_mode = MLX5_ACCESS_MODE_MTT;
> + in->seg.log2_page_size = PAGE_SHIFT;
> + } else if (mr_type == IB_MR_TYPE_SIGNATURE) {
> u32 psv_index[2];
>
> in->seg.flags_pd = cpu_to_be32(be32_to_cpu(in->seg.flags_pd) |
> @@ -1297,6 +1300,10 @@ struct ib_mr *mlx5_ib_create_mr(struct ib_pd *pd,
> mr->sig->sig_err_exists = false;
> /* Next UMR, Arm SIGERR */
> ++mr->sig->sigerr_count;
> + } else {
> + mlx5_ib_warn(dev, "Invalid mr type %d\n", mr_type);
> + err = -EINVAL;
> + goto err_free_in;
> }
>
> in->seg.flags = MLX5_PERM_UMR_EN | access_mode;
> diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
> index 255321c..9bef5a7 100644
> --- a/drivers/infiniband/ulp/iser/iser_verbs.c
> +++ b/drivers/infiniband/ulp/iser/iser_verbs.c
> @@ -284,9 +284,7 @@ iser_alloc_pi_ctx(struct ib_device *ib_device, struct ib_pd *pd,
> struct fast_reg_descriptor *desc)
> {
> struct iser_pi_context *pi_ctx = NULL;
> - struct ib_mr_init_attr mr_init_attr = {.max_reg_descriptors = 2,
> - .flags = IB_MR_SIGNATURE_EN};
> - int ret = 0;
> + int ret;
>
> desc->pi_ctx = kzalloc(sizeof(*desc->pi_ctx), GFP_KERNEL);
> if (!desc->pi_ctx)
> @@ -309,7 +307,7 @@ iser_alloc_pi_ctx(struct ib_device *ib_device, struct ib_pd *pd,
> }
> desc->reg_indicators |= ISER_PROT_KEY_VALID;
>
> - pi_ctx->sig_mr = ib_create_mr(pd, &mr_init_attr);
> + pi_ctx->sig_mr = ib_alloc_mr(pd, IB_MR_TYPE_SIGNATURE, 2);
> if (IS_ERR(pi_ctx->sig_mr)) {
> ret = PTR_ERR(pi_ctx->sig_mr);
> goto sig_mr_failure;
> diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
> index 559e6be..23a793a 100644
> --- a/drivers/infiniband/ulp/isert/ib_isert.c
> +++ b/drivers/infiniband/ulp/isert/ib_isert.c
> @@ -497,7 +497,6 @@ isert_create_pi_ctx(struct fast_reg_descriptor *desc,
> struct ib_device *device,
> struct ib_pd *pd)
> {
> - struct ib_mr_init_attr mr_init_attr;
> struct pi_context *pi_ctx;
> int ret;
>
> @@ -525,10 +524,7 @@ isert_create_pi_ctx(struct fast_reg_descriptor *desc,
> }
> desc->ind |= ISERT_PROT_KEY_VALID;
>
> - memset(&mr_init_attr, 0, sizeof(mr_init_attr));
> - mr_init_attr.max_reg_descriptors = 2;
> - mr_init_attr.flags |= IB_MR_SIGNATURE_EN;
> - pi_ctx->sig_mr = ib_create_mr(pd, &mr_init_attr);
> + pi_ctx->sig_mr = ib_alloc_mr(pd, IB_MR_TYPE_SIGNATURE, 2);
> if (IS_ERR(pi_ctx->sig_mr)) {
> isert_err("Failed to allocate signature enabled mr err=%ld\n",
> PTR_ERR(pi_ctx->sig_mr));
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index a534ee5..110044d 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -556,20 +556,18 @@ __attribute_const__ int ib_rate_to_mult(enum ib_rate rate);
> */
> __attribute_const__ int ib_rate_to_mbps(enum ib_rate rate);
>
> -enum ib_mr_create_flags {
> - IB_MR_SIGNATURE_EN = 1,
> -};
>
> /**
> - * ib_mr_init_attr - Memory region init attributes passed to routine
> - * ib_create_mr.
> - * @max_reg_descriptors: max number of registration descriptors that
> - * may be used with registration work requests.
> - * @flags: MR creation flags bit mask.
> + * enum ib_mr_type - memory region type
> + * @IB_MR_TYPE_MEM_REG: memory region that is used for
> + * normal registration
> + * @IB_MR_TYPE_SIGNATURE: memory region that is used for
> + * signature operations (data-integrity
> + * capable regions)
> */
> -struct ib_mr_init_attr {
> - int max_reg_descriptors;
> - u32 flags;
> +enum ib_mr_type {
> + IB_MR_TYPE_MEM_REG,
> + IB_MR_TYPE_SIGNATURE,
> };
>
> /**
> @@ -1670,8 +1668,9 @@ struct ib_device {
> int (*query_mr)(struct ib_mr *mr,
> struct ib_mr_attr *mr_attr);
> int (*dereg_mr)(struct ib_mr *mr);
> - struct ib_mr * (*create_mr)(struct ib_pd *pd,
> - struct ib_mr_init_attr *mr_init_attr);
> + struct ib_mr * (*alloc_mr)(struct ib_pd *pd,
> + enum ib_mr_type mr_type,
> + u32 max_num_sg);
> struct ib_mr * (*alloc_fast_reg_mr)(struct ib_pd *pd,
> int max_page_list_len);
> struct ib_fast_reg_page_list * (*alloc_fast_reg_page_list)(struct ib_device *device,
> @@ -2815,15 +2814,9 @@ int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);
> */
> int ib_dereg_mr(struct ib_mr *mr);
>
> -
> -/**
> - * ib_create_mr - Allocates a memory region that may be used for
> - * signature handover operations.
> - * @pd: The protection domain associated with the region.
> - * @mr_init_attr: memory region init attributes.
> - */
> -struct ib_mr *ib_create_mr(struct ib_pd *pd,
> - struct ib_mr_init_attr *mr_init_attr);
> +struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
> + enum ib_mr_type mr_type,
> + u32 max_num_sg);
>
> /**
> * ib_alloc_fast_reg_mr - Allocates memory region usable with the


2015-07-30 14:56:40

by Steve Wise

[permalink] [raw]
Subject: Re: [PATCH for-4.3 00/15] Modify MR allocation API

On 7/30/2015 2:32 AM, Sagi Grimberg wrote:
> This patch set is detached from my WIP for modifying our
> fast registration kernel API. I incorporated some comments
> from Jason and Christoph. The current set is a drop-in replacement
> of ib_alloc_fast_reg_mr to ib_alloc_mr which receives a memory
> region type (whcih can be IB_MR_TYPE_MEM_REG for normal memory
> registration, IB_MR_TYPE_SIGNATURE for a data-integrity capable
> memory region and future arbitrary SG support capable memory
> region).
>
>

Series looks good.

Reviewed-by: Steve Wise <[email protected]>

2015-07-30 16:42:04

by Doug Ledford

[permalink] [raw]
Subject: Re: [PATCH for-4.3 00/15] Modify MR allocation API

On 07/30/2015 10:56 AM, Steve Wise wrote:
> On 7/30/2015 2:32 AM, Sagi Grimberg wrote:
>> This patch set is detached from my WIP for modifying our
>> fast registration kernel API. I incorporated some comments
>> from Jason and Christoph. The current set is a drop-in replacement
>> of ib_alloc_fast_reg_mr to ib_alloc_mr which receives a memory
>> region type (whcih can be IB_MR_TYPE_MEM_REG for normal memory
>> registration, IB_MR_TYPE_SIGNATURE for a data-integrity capable
>> memory region and future arbitrary SG support capable memory
>> region).
>>
>>
>
> Series looks good.
>
> Reviewed-by: Steve Wise <[email protected]>

I've pulled this in for 4.3.


--
Doug Ledford <[email protected]>
GPG KeyID: 0E572FDD



Attachments:
signature.asc (884.00 B)
OpenPGP digital signature

2015-07-30 17:22:43

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH for-4.3 00/15] Modify MR allocation API

On Thu, Jul 30, 2015 at 10:32:33AM +0300, Sagi Grimberg wrote:
> This patch set is detached from my WIP for modifying our
> fast registration kernel API. I incorporated some comments
> from Jason and Christoph. The current set is a drop-in replacement
> of ib_alloc_fast_reg_mr to ib_alloc_mr which receives a memory
> region type (whcih can be IB_MR_TYPE_MEM_REG for normal memory
> registration, IB_MR_TYPE_SIGNATURE for a data-integrity capable
> memory region and future arbitrary SG support capable memory
> region).

Looks good to me now..

Reviewed-by: Jason Gunthorpe <[email protected]>

Jason

2015-07-31 11:41:09

by Marciniszyn, Mike

[permalink] [raw]
Subject: RE: [PATCH for-4.3 14/15] qib: Support ib_alloc_mr verb

> Subject: [PATCH for-4.3 14/15] qib: Support ib_alloc_mr verb
>

Doug,

Have you staged this anywhere?

Mike

2015-07-31 12:52:53

by Doug Ledford

[permalink] [raw]
Subject: Re: [PATCH for-4.3 14/15] qib: Support ib_alloc_mr verb

On 07/31/2015 07:41 AM, Marciniszyn, Mike wrote:
>> Subject: [PATCH for-4.3 14/15] qib: Support ib_alloc_mr verb
>>
>
> Doug,
>
> Have you staged this anywhere?
>
> Mike
>

Yes. In my github repo this is present on the mr-cleanup and
to-be-rebased/for-4.3 branches.

--
Doug Ledford <[email protected]>
GPG KeyID: 0E572FDD



Attachments:
signature.asc (884.00 B)
OpenPGP digital signature

2015-07-31 23:13:39

by Bart Van Assche

[permalink] [raw]
Subject: Re: [PATCH for-4.3 05/15] IB/srp: Convert to ib_alloc_mr

On 07/30/2015 12:32 AM, Sagi Grimberg wrote:
> Signed-off-by: Sagi Grimberg <[email protected]>

Reviewed-by: Bart Van Assche <[email protected]>

2015-08-06 14:23:05

by Anna Schumaker

[permalink] [raw]
Subject: Re: [PATCH for-4.3 06/15] xprtrdma, svcrdma: Convert to ib_alloc_mr

This looks good to me:

Signed-off-by: Anna Schumaker <[email protected]>

Thanks,
Anna

On 07/30/2015 03:32 AM, Sagi Grimberg wrote:
> Signed-off-by: Sagi Grimberg <[email protected]>
> ---
> net/sunrpc/xprtrdma/frwr_ops.c | 6 +++---
> net/sunrpc/xprtrdma/svc_rdma_transport.c | 2 +-
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c
> index 63f282e..d6653f5 100644
> --- a/net/sunrpc/xprtrdma/frwr_ops.c
> +++ b/net/sunrpc/xprtrdma/frwr_ops.c
> @@ -117,7 +117,7 @@ __frwr_recovery_worker(struct work_struct *work)
> if (ib_dereg_mr(r->r.frmr.fr_mr))
> goto out_fail;
>
> - r->r.frmr.fr_mr = ib_alloc_fast_reg_mr(pd, depth);
> + r->r.frmr.fr_mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG, depth);
> if (IS_ERR(r->r.frmr.fr_mr))
> goto out_fail;
>
> @@ -148,7 +148,7 @@ __frwr_init(struct rpcrdma_mw *r, struct ib_pd *pd, struct ib_device *device,
> struct rpcrdma_frmr *f = &r->r.frmr;
> int rc;
>
> - f->fr_mr = ib_alloc_fast_reg_mr(pd, depth);
> + f->fr_mr = ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG, depth);
> if (IS_ERR(f->fr_mr))
> goto out_mr_err;
> f->fr_pgl = ib_alloc_fast_reg_page_list(device, depth);
> @@ -158,7 +158,7 @@ __frwr_init(struct rpcrdma_mw *r, struct ib_pd *pd, struct ib_device *device,
>
> out_mr_err:
> rc = PTR_ERR(f->fr_mr);
> - dprintk("RPC: %s: ib_alloc_fast_reg_mr status %i\n",
> + dprintk("RPC: %s: ib_alloc_mr status %i\n",
> __func__, rc);
> return rc;
>
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> index 6b36279..adcf904 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> @@ -738,7 +738,7 @@ static struct svc_rdma_fastreg_mr *rdma_alloc_frmr(struct svcxprt_rdma *xprt)
> if (!frmr)
> goto err;
>
> - mr = ib_alloc_fast_reg_mr(xprt->sc_pd, RPCSVC_MAXPAGES);
> + mr = ib_alloc_mr(xprt->sc_pd, IB_MR_TYPE_MEM_REG, RPCSVC_MAXPAGES);
> if (IS_ERR(mr))
> goto err_free_frmr;
>
>


2015-08-07 14:47:33

by Marciniszyn, Mike

[permalink] [raw]
Subject: RE: [PATCH for-4.3 14/15] qib: Support ib_alloc_mr verb

> Subject: [PATCH for-4.3 14/15] qib: Support ib_alloc_mr verb
>
> Signed-off-by: Sagi Grimberg <[email protected]>

This did require repair of the to-be-rebased/for-4.3 branch to
"revert IB/core: Guarantee that a local_dma_lkey is available" and replace with
a corrected version.

Tested-by: Vinit Agnihotri <[email protected]>
Acked-by: Mike Marciniszyn <[email protected]>



2015-08-07 15:06:21

by Steve Wise

[permalink] [raw]
Subject: RE: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb



> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Sagi Grimberg
> Sent: Thursday, July 30, 2015 2:33 AM
> To: [email protected]; [email protected]; [email protected]
> Subject: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb
>
> Signed-off-by: Sagi Grimberg <[email protected]>
> ---
> drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 4 +++-
> drivers/infiniband/hw/cxgb4/mem.c | 12 +++++++++---
> drivers/infiniband/hw/cxgb4/provider.c | 2 +-
> 3 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
> index cc77844..c7bb38c 100644
> --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
> +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
> @@ -970,7 +970,9 @@ void c4iw_free_fastreg_pbl(struct ib_fast_reg_page_list *page_list);
> struct ib_fast_reg_page_list *c4iw_alloc_fastreg_pbl(
> struct ib_device *device,
> int page_list_len);
> -struct ib_mr *c4iw_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth);
> +struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd,
> + enum ib_mr_type mr_type,
> + u32 max_num_sg);
> int c4iw_dealloc_mw(struct ib_mw *mw);
> struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
> struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start,
> diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
> index cff815b..026b91e 100644
> --- a/drivers/infiniband/hw/cxgb4/mem.c
> +++ b/drivers/infiniband/hw/cxgb4/mem.c
> @@ -853,7 +853,9 @@ int c4iw_dealloc_mw(struct ib_mw *mw)
> return 0;
> }
>
> -struct ib_mr *c4iw_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth)
> +struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd,
> + enum ib_mr_type mr_type,
> + u32 max_num_sg)
> {
> struct c4iw_dev *rhp;
> struct c4iw_pd *php;
> @@ -862,6 +864,10 @@ struct ib_mr *c4iw_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth)
> u32 stag = 0;
> int ret = 0;
>
> + if (mr_type != IB_MR_TYPE_MEM_REG ||
> + max_num_sg > t4_max_fr_depth(use_dsgl))
> + return ERR_PTR(-EINVAL);
> +
> php = to_c4iw_pd(pd);
> rhp = php->rhp;
> mhp = kzalloc(sizeof(*mhp), GFP_KERNEL);

Hey Sagi/Doug,

The above change introduces a regression with NFSRDMA over cxgb4. Prior to this commit, cxgb4 allowed frmr and page list
allocations that exceeded the device max. It does enforce the max when processing a fastreg WR though. This is definitely a bug in
cxgb4, but was benign. Further, the NFSRDMA server currently allocates frmrs and page_lists using RPCSVC_MAXPAGES for max_num_sg
which exceeds the max supported by cxgb4. Thus with the above patch, NFSRDMA doesn't work at all over cxgb4. :(

So I need to fix NFSRDMA for sure. But adding a fix on top of the above patch will leave a bisectable window where NFSRDMA is
broken on cxgb4. Is it too late to change the above patch so the regression is avoided? Then I can provide a new series of patches
to fix the NFS server to mind the device max, and fix cxgb4 to enforce the device max.

If it is too much of a pain to alter this patch, then I'll just submit the NFSRDMA fix and live with the bisect issue...

Thoughts?

Steve.


2015-08-07 15:13:21

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb

On Fri, Aug 07, 2015 at 10:06:26AM -0500, Steve Wise wrote:
> If it is too much of a pain to alter this patch, then I'll just
> submit the NFSRDMA fix and live with the bisect issue...

Doug's tree is still to be rebased. So please submit your NFS
fix now as ask Doug to merge it before Sagi's series in the final
tree.

2015-08-07 16:19:54

by Steve Wise

[permalink] [raw]
Subject: RE: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb



> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Christoph Hellwig
> Sent: Friday, August 07, 2015 10:13 AM
> To: Steve Wise
> Cc: 'Sagi Grimberg'; 'Doug Ledford'; [email protected]; [email protected]; [email protected]
> Subject: Re: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb
>
> On Fri, Aug 07, 2015 at 10:06:26AM -0500, Steve Wise wrote:
> > If it is too much of a pain to alter this patch, then I'll just
> > submit the NFSRDMA fix and live with the bisect issue...
>
> Doug's tree is still to be rebased. So please submit your NFS
> fix now as ask Doug to merge it before Sagi's series in the final
> tree.

My new NFS fix needs to land before these two:

af78181 cxgb3: Support ib_alloc_mr verb
b7e06cd iw_cxgb4: Support ib_alloc_mr verb

But it will cause the following patch, which is after the above two, to need rework because it hits the same lines:

e20684a xprtrdma, svcrdma: Convert to ib_alloc_mr

I guess I'll post two patches, the NFS fix that preceeds af78181/ b7e06cd, and a reworked patch to replace e20684a.

Is that the way to go in your opinion?

Steve.





2015-08-07 16:26:02

by Steve Wise

[permalink] [raw]
Subject: Re: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb

On 8/7/2015 11:19 AM, Steve Wise wrote:
>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On Behalf Of Christoph Hellwig
>> Sent: Friday, August 07, 2015 10:13 AM
>> To: Steve Wise
>> Cc: 'Sagi Grimberg'; 'Doug Ledford'; [email protected]; [email protected]; [email protected]
>> Subject: Re: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb
>>
>> On Fri, Aug 07, 2015 at 10:06:26AM -0500, Steve Wise wrote:
>>> If it is too much of a pain to alter this patch, then I'll just
>>> submit the NFSRDMA fix and live with the bisect issue...
>> Doug's tree is still to be rebased. So please submit your NFS
>> fix now as ask Doug to merge it before Sagi's series in the final
>> tree.
> My new NFS fix needs to land before these two:
>
> af78181 cxgb3: Support ib_alloc_mr verb
> b7e06cd iw_cxgb4: Support ib_alloc_mr verb
>
> But it will cause the following patch, which is after the above two, to need rework because it hits the same lines:
>
> e20684a xprtrdma, svcrdma: Convert to ib_alloc_mr
>
> I guess I'll post two patches, the NFS fix that preceeds af78181/ b7e06cd, and a reworked patch to replace e20684a.
>
> Is that the way to go in your opinion?
>
> Steve.

Ignore this. I think I was looking at the wrong staging branch.



2015-08-07 16:26:17

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb

On Fri, Aug 07, 2015 at 11:19:59AM -0500, Steve Wise wrote:
> I guess I'll post two patches, the NFS fix that preceeds af78181/ b7e06cd, and a reworked patch to replace e20684a.
>
> Is that the way to go in your opinion?

To me this sounds good. We have a couple patches from Jason's series
that already need to be replaced, so the tree will need a rebase anyway,
so I don't see a problem with replacing ones in Sagi's series either.
If Sagi needs to do a repost for some reason he can just include your
NFS patch in front of the series.

2015-08-07 16:29:06

by Steve Wise

[permalink] [raw]
Subject: RE: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb



> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of 'Christoph Hellwig'
> Sent: Friday, August 07, 2015 11:26 AM
> To: Steve Wise
> Cc: 'Christoph Hellwig'; 'Sagi Grimberg'; 'Doug Ledford'; [email protected]; [email protected]; target-
> [email protected]
> Subject: Re: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb
>
> On Fri, Aug 07, 2015 at 11:19:59AM -0500, Steve Wise wrote:
> > I guess I'll post two patches, the NFS fix that preceeds af78181/ b7e06cd, and a reworked patch to replace e20684a.
> >
> > Is that the way to go in your opinion?
>
> To me this sounds good. We have a couple patches from Jason's series
> that already need to be replaced, so the tree will need a rebase anyway,
> so I don't see a problem with replacing ones in Sagi's series either.
> If Sagi needs to do a repost for some reason he can just include your
> NFS patch in front of the series.

I misspoke. I had the order reversed. The order is such that we can add my new NFS patch after:

e20684a xprtrdma, svcrdma: Convert to ib_alloc_mr

and before these:

af78181 cxgb3: Support ib_alloc_mr verb
b7e06cd iw_cxgb4: Support ib_alloc_mr verb

Steve



2015-08-07 16:31:56

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH for-4.3 11/15] iw_cxgb4: Support ib_alloc_mr verb

On Fri, Aug 07, 2015 at 11:29:12AM -0500, Steve Wise wrote:
> I misspoke. I had the order reversed. The order is such that we can add my new NFS patch after:
>
> e20684a xprtrdma, svcrdma: Convert to ib_alloc_mr
>
> and before these:
>
> af78181 cxgb3: Support ib_alloc_mr verb
> b7e06cd iw_cxgb4: Support ib_alloc_mr verb

In general it would be preferable to have it before the ib_alloc_mr
conversion, but if it causes more work I doubt it's really worth it.