* [PATCH V4 0/5] iSER support for iWARP
@ 2015-07-02 15:16 Steve Wise
2015-07-02 15:16 ` [PATCH V4 1/5] mlx4, mlx5, mthca: Expose max_sge_rd correctly Steve Wise
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Steve Wise @ 2015-07-02 15:16 UTC (permalink / raw)
To: dledford; +Cc: roid, linux-rdma, sagig, infinipath, target-devel, eli, ogerlitz
The following series implements support for iWARP transports in the iSER
initiator and target. This is based on Doug's k.o/for-4.2 branch.
I've tested this on cxgb4 and mlx4 hardware.
Changes since V3:
Fixed commit messages based on feedback.
iser: adjust max_sectors
isert: split into 2 patches
isert: always set REMOTE_WRITE for dma mrs
Changes since V2:
The transport independent work is removed from this series and will
be submitted in a subsequent series. This V3 series now enables iWARP
using existing core services.
Changes since V1:
Introduce and use transport-independent RDMA core services for allocating
DMA MRs and computing fast register access flags.
Correctly set the device max_sge_rd capability in several rdma device
drivers.
isert: use device capability max_sge_rd for the read sge depth.
isert: change max_sge to max_write_sge in struct isert_conn.
---
Sagi Grimberg (1):
mlx4, mlx5, mthca: Expose max_sge_rd correctly
Steve Wise (4):
ipath,qib: Expose max_sge_rd correctly
RDMA/iser: Limit sg tablesize and max_sectors to device fastreg max depth
RDMA/isert: Set REMOTE_WRITE on DMA MRs to support iWARP devices
RDMA/isert: Limit read depth based on the device max_sge_rd capability
drivers/infiniband/hw/ipath/ipath_verbs.c | 1 +
drivers/infiniband/hw/mlx4/main.c | 1 +
drivers/infiniband/hw/mlx5/main.c | 1 +
drivers/infiniband/hw/mthca/mthca_provider.c | 1 +
drivers/infiniband/hw/qib/qib_verbs.c | 1 +
drivers/infiniband/ulp/iser/iscsi_iser.c | 9 +++++++
drivers/infiniband/ulp/isert/ib_isert.c | 34 +++++++++++++++++++-------
drivers/infiniband/ulp/isert/ib_isert.h | 3 ++
8 files changed, 41 insertions(+), 10 deletions(-)
--
Steve.
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH V4 1/5] mlx4, mlx5, mthca: Expose max_sge_rd correctly 2015-07-02 15:16 [PATCH V4 0/5] iSER support for iWARP Steve Wise @ 2015-07-02 15:16 ` Steve Wise 2015-07-02 15:16 ` [PATCH V4 4/5] RDMA/isert: Set REMOTE_WRITE on DMA MRs to support iWARP devices Steve Wise [not found] ` <20150702151508.12946.29133.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org> 2 siblings, 0 replies; 8+ messages in thread From: Steve Wise @ 2015-07-02 15:16 UTC (permalink / raw) To: dledford; +Cc: roid, linux-rdma, sagig, infinipath, target-devel, eli, ogerlitz From: Sagi Grimberg <sagig@mellanox.com> Applications must not assume that max_sge and max_sge_rd are the same, Hence expose max_sge_rd correctly as well. Reported-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Sagi Grimberg <sagig@mellanox.com> --- drivers/infiniband/hw/mlx4/main.c | 1 + drivers/infiniband/hw/mlx5/main.c | 1 + drivers/infiniband/hw/mthca/mthca_provider.c | 1 + 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 166da78..81c342f 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -229,6 +229,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE; props->max_sge = min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg); + props->max_sge_rd = props->max_sge; props->max_cq = dev->dev->quotas.cq; props->max_cqe = dev->dev->caps.max_cqes; props->max_mr = dev->dev->quotas.mpt; diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index c6cb26e..a2bcd96 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -137,6 +137,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, max_sq_sg = (gen->max_sq_desc_sz - sizeof(struct mlx5_wqe_ctrl_seg)) / sizeof(struct mlx5_wqe_data_seg); props->max_sge = min(max_rq_sg, max_sq_sg); + props->max_sge_rd = props->max_sge; props->max_cq = 1 << gen->log_max_cq; props->max_cqe = gen->max_cqes - 1; props->max_mr = 1 << gen->log_max_mkey; diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 93ae51d..dc2d48c 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c @@ -97,6 +97,7 @@ static int mthca_query_device(struct ib_device *ibdev, struct ib_device_attr *pr props->max_qp = mdev->limits.num_qps - mdev->limits.reserved_qps; props->max_qp_wr = mdev->limits.max_wqes; props->max_sge = mdev->limits.max_sg; + props->max_sge_rd = props->max_sge; props->max_cq = mdev->limits.num_cqs - mdev->limits.reserved_cqs; props->max_cqe = mdev->limits.max_cqes; props->max_mr = mdev->limits.num_mpts - mdev->limits.reserved_mrws; ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH V4 4/5] RDMA/isert: Set REMOTE_WRITE on DMA MRs to support iWARP devices 2015-07-02 15:16 [PATCH V4 0/5] iSER support for iWARP Steve Wise 2015-07-02 15:16 ` [PATCH V4 1/5] mlx4, mlx5, mthca: Expose max_sge_rd correctly Steve Wise @ 2015-07-02 15:16 ` Steve Wise [not found] ` <20150702151508.12946.29133.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org> 2 siblings, 0 replies; 8+ messages in thread From: Steve Wise @ 2015-07-02 15:16 UTC (permalink / raw) To: dledford; +Cc: roid, linux-rdma, sagig, infinipath, target-devel, eli, ogerlitz iWARP devices require REMOTE_WRITE for MRs used as the destination of an RDMA READ. IB does not require this. Since isert never advertises the rkey of its DMA MRs to the peer, just add REMOTE_WRITE to the access flags when allocating DMA MRs for all devices. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> --- drivers/infiniband/ulp/isert/ib_isert.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 9e7b492..2737ade 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -383,7 +383,8 @@ isert_create_device_ib_res(struct isert_device *device) goto out_cq; } - device->mr = ib_get_dma_mr(device->pd, IB_ACCESS_LOCAL_WRITE); + device->mr = ib_get_dma_mr(device->pd, IB_ACCESS_LOCAL_WRITE | + IB_ACCESS_REMOTE_WRITE); if (IS_ERR(device->mr)) { ret = PTR_ERR(device->mr); isert_err("failed to create dma mr, device %p, ret=%d\n", ^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <20150702151508.12946.29133.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>]
* [PATCH V4 2/5] ipath,qib: Expose max_sge_rd correctly [not found] ` <20150702151508.12946.29133.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org> @ 2015-07-02 15:16 ` Steve Wise 2015-07-02 15:16 ` [PATCH V4 3/5] RDMA/iser: Limit sg tablesize and max_sectors to device fastreg max depth Steve Wise 2015-07-02 15:16 ` [PATCH V4 5/5] RDMA/isert: Limit read depth based on the device max_sge_rd capability Steve Wise 2 siblings, 0 replies; 8+ messages in thread From: Steve Wise @ 2015-07-02 15:16 UTC (permalink / raw) To: dledford-H+wXaHxf7aLQT0dZR+AlfA Cc: roid-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, sagig-VPRAkNaXOzVWk0Htik3J/w, infinipath-ral2JQCrhuEAvxtiuMwx3w, target-devel-u79uwXL29TY76Z2rM5mHXA, eli-VPRAkNaXOzVWk0Htik3J/w, ogerlitz-VPRAkNaXOzVWk0Htik3J/w Applications must not assume that max_sge and max_sge_rd are the same, Hence expose max_sge_rd correctly as well. Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org> Acked-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> --- drivers/infiniband/hw/ipath/ipath_verbs.c | 1 + drivers/infiniband/hw/qib/qib_verbs.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 48253b8..d958236 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c @@ -1521,6 +1521,7 @@ static int ipath_query_device(struct ib_device *ibdev, struct ib_device_attr *pr props->max_qp = ib_ipath_max_qps; props->max_qp_wr = ib_ipath_max_qp_wrs; props->max_sge = ib_ipath_max_sges; + props->max_sge_rd = ib_ipath_max_sges; props->max_cq = ib_ipath_max_cqs; props->max_ah = ib_ipath_max_ahs; props->max_cqe = ib_ipath_max_cqes; diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c index a05d1a3..bc723b5 100644 --- a/drivers/infiniband/hw/qib/qib_verbs.c +++ b/drivers/infiniband/hw/qib/qib_verbs.c @@ -1574,6 +1574,7 @@ static int qib_query_device(struct ib_device *ibdev, struct ib_device_attr *prop props->max_qp = ib_qib_max_qps; props->max_qp_wr = ib_qib_max_qp_wrs; props->max_sge = ib_qib_max_sges; + props->max_sge_rd = ib_qib_max_sges; props->max_cq = ib_qib_max_cqs; props->max_ah = ib_qib_max_ahs; props->max_cqe = ib_qib_max_cqes; -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH V4 3/5] RDMA/iser: Limit sg tablesize and max_sectors to device fastreg max depth [not found] ` <20150702151508.12946.29133.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org> 2015-07-02 15:16 ` [PATCH V4 2/5] ipath,qib: Expose max_sge_rd correctly Steve Wise @ 2015-07-02 15:16 ` Steve Wise [not found] ` <20150702151619.12946.79500.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org> 2015-07-02 15:16 ` [PATCH V4 5/5] RDMA/isert: Limit read depth based on the device max_sge_rd capability Steve Wise 2 siblings, 1 reply; 8+ messages in thread From: Steve Wise @ 2015-07-02 15:16 UTC (permalink / raw) To: dledford-H+wXaHxf7aLQT0dZR+AlfA Cc: roid-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, sagig-VPRAkNaXOzVWk0Htik3J/w, infinipath-ral2JQCrhuEAvxtiuMwx3w, target-devel-u79uwXL29TY76Z2rM5mHXA, eli-VPRAkNaXOzVWk0Htik3J/w, ogerlitz-VPRAkNaXOzVWk0Htik3J/w Currently the sg tablesize, which dictates fast register page list depth to use, does not take into account the limits of the rdma device. So adjust it once we discover the device fastreg max depth limit. Also adjust the max_sectors based on the resulting sg tablesize. Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org> Reviewed-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> --- drivers/infiniband/ulp/iser/iscsi_iser.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 6a594aa..0ed8638 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -640,6 +640,15 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, SHOST_DIX_GUARD_CRC); } + /* + * Limit the sg_tablesize and max_sectors based on the device + * max fastreg page list length. + */ + shost->sg_tablesize = min_t(u32, shost->sg_tablesize, + ib_conn->device->dev_attr.max_fast_reg_page_list_len); + shost->max_sectors = + min(1024, (shost->sg_tablesize * PAGE_SIZE) >> 9); + if (iscsi_host_add(shost, ib_conn->device->ib_device->dma_device)) { mutex_unlock(&iser_conn->state_mutex); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <20150702151619.12946.79500.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>]
* Re: [PATCH V4 3/5] RDMA/iser: Limit sg tablesize and max_sectors to device fastreg max depth [not found] ` <20150702151619.12946.79500.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org> @ 2015-07-05 9:57 ` Sagi Grimberg [not found] ` <5598FFA3.5020508-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Sagi Grimberg @ 2015-07-05 9:57 UTC (permalink / raw) To: Steve Wise, dledford-H+wXaHxf7aLQT0dZR+AlfA Cc: roid-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, sagig-VPRAkNaXOzVWk0Htik3J/w, infinipath-ral2JQCrhuEAvxtiuMwx3w, target-devel-u79uwXL29TY76Z2rM5mHXA, eli-VPRAkNaXOzVWk0Htik3J/w, ogerlitz-VPRAkNaXOzVWk0Htik3J/w On 7/2/2015 6:16 PM, Steve Wise wrote: > Currently the sg tablesize, which dictates fast register page list > depth to use, does not take into account the limits of the rdma device. > So adjust it once we discover the device fastreg max depth limit. Also > adjust the max_sectors based on the resulting sg tablesize. > > Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org> > Reviewed-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > --- > drivers/infiniband/ulp/iser/iscsi_iser.c | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c > index 6a594aa..0ed8638 100644 > --- a/drivers/infiniband/ulp/iser/iscsi_iser.c > +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c > @@ -640,6 +640,15 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, > SHOST_DIX_GUARD_CRC); > } > > + /* > + * Limit the sg_tablesize and max_sectors based on the device > + * max fastreg page list length. > + */ > + shost->sg_tablesize = min_t(u32, shost->sg_tablesize, > + ib_conn->device->dev_attr.max_fast_reg_page_list_len); > + shost->max_sectors = > + min(1024, (shost->sg_tablesize * PAGE_SIZE) >> 9); > + Steve, This triggers a compilation warning: drivers/infiniband/ulp/iser/iscsi_iser.c: In function iscsi_iser_session_create: drivers/infiniband/ulp/iser/iscsi_iser.c:653: warning: comparison of distinct pointer types lacks a cast For next time, let's remove the reviewed-by tags and I'll re-review the patches. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <5598FFA3.5020508-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>]
* Re: [PATCH V4 3/5] RDMA/iser: Limit sg tablesize and max_sectors to device fastreg max depth [not found] ` <5598FFA3.5020508-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> @ 2015-07-05 13:15 ` Steve Wise 0 siblings, 0 replies; 8+ messages in thread From: Steve Wise @ 2015-07-05 13:15 UTC (permalink / raw) To: Sagi Grimberg, dledford-H+wXaHxf7aLQT0dZR+AlfA Cc: roid-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, sagig-VPRAkNaXOzVWk0Htik3J/w, infinipath-ral2JQCrhuEAvxtiuMwx3w, target-devel-u79uwXL29TY76Z2rM5mHXA, eli-VPRAkNaXOzVWk0Htik3J/w, ogerlitz-VPRAkNaXOzVWk0Htik3J/w On 7/5/2015 4:57 AM, Sagi Grimberg wrote: > On 7/2/2015 6:16 PM, Steve Wise wrote: >> Currently the sg tablesize, which dictates fast register page list >> depth to use, does not take into account the limits of the rdma device. >> So adjust it once we discover the device fastreg max depth limit. Also >> adjust the max_sectors based on the resulting sg tablesize. >> >> Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org> >> Reviewed-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> >> --- >> drivers/infiniband/ulp/iser/iscsi_iser.c | 9 +++++++++ >> 1 files changed, 9 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c >> b/drivers/infiniband/ulp/iser/iscsi_iser.c >> index 6a594aa..0ed8638 100644 >> --- a/drivers/infiniband/ulp/iser/iscsi_iser.c >> +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c >> @@ -640,6 +640,15 @@ iscsi_iser_session_create(struct iscsi_endpoint >> *ep, >> SHOST_DIX_GUARD_CRC); >> } >> >> + /* >> + * Limit the sg_tablesize and max_sectors based on the device >> + * max fastreg page list length. >> + */ >> + shost->sg_tablesize = min_t(u32, shost->sg_tablesize, >> + ib_conn->device->dev_attr.max_fast_reg_page_list_len); >> + shost->max_sectors = >> + min(1024, (shost->sg_tablesize * PAGE_SIZE) >> 9); >> + > > Steve, > > This triggers a compilation warning: > drivers/infiniband/ulp/iser/iscsi_iser.c: In function > iscsi_iser_session_create: > drivers/infiniband/ulp/iser/iscsi_iser.c:653: warning: comparison of > distinct pointer types lacks a cast > > For next time, let's remove the reviewed-by tags and I'll re-review the > patches. Oops. My bad. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH V4 5/5] RDMA/isert: Limit read depth based on the device max_sge_rd capability [not found] ` <20150702151508.12946.29133.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org> 2015-07-02 15:16 ` [PATCH V4 2/5] ipath,qib: Expose max_sge_rd correctly Steve Wise 2015-07-02 15:16 ` [PATCH V4 3/5] RDMA/iser: Limit sg tablesize and max_sectors to device fastreg max depth Steve Wise @ 2015-07-02 15:16 ` Steve Wise 2 siblings, 0 replies; 8+ messages in thread From: Steve Wise @ 2015-07-02 15:16 UTC (permalink / raw) To: dledford-H+wXaHxf7aLQT0dZR+AlfA Cc: roid-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, sagig-VPRAkNaXOzVWk0Htik3J/w, infinipath-ral2JQCrhuEAvxtiuMwx3w, target-devel-u79uwXL29TY76Z2rM5mHXA, eli-VPRAkNaXOzVWk0Htik3J/w, ogerlitz-VPRAkNaXOzVWk0Htik3J/w Use the device's max_sge_rd capability to compute the target's read sge depth. Save both the read and write max_sge values in the isert_conn struct, and use these when creating RDMA_WRITE/READ work requests. Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org> Reviewed-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> --- drivers/infiniband/ulp/isert/ib_isert.c | 31 +++++++++++++++++++++++-------- drivers/infiniband/ulp/isert/ib_isert.h | 3 ++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 2737ade..c2c7037 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -163,7 +163,9 @@ isert_create_qp(struct isert_conn *isert_conn, * outgoing control PDU responses. */ attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2); - isert_conn->max_sge = attr.cap.max_send_sge; + isert_conn->max_write_sge = attr.cap.max_send_sge; + isert_conn->max_read_sge = min_t(u32, device->dev_attr.max_sge_rd, + attr.cap.max_send_sge); attr.cap.max_recv_sge = 1; attr.sq_sig_type = IB_SIGNAL_REQ_WR; @@ -2376,7 +2378,7 @@ isert_put_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn) static int isert_build_rdma_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd, struct ib_sge *ib_sge, struct ib_send_wr *send_wr, - u32 data_left, u32 offset) + u32 data_left, u32 offset, u32 max_sge) { struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd; struct scatterlist *sg_start, *tmp_sg; @@ -2387,7 +2389,7 @@ isert_build_rdma_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd, sg_off = offset / PAGE_SIZE; sg_start = &cmd->se_cmd.t_data_sg[sg_off]; - sg_nents = min(cmd->se_cmd.t_data_nents - sg_off, isert_conn->max_sge); + sg_nents = min(cmd->se_cmd.t_data_nents - sg_off, max_sge); page_off = offset % PAGE_SIZE; send_wr->sg_list = ib_sge; @@ -2431,8 +2433,9 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd, struct isert_data_buf *data = &wr->data; struct ib_send_wr *send_wr; struct ib_sge *ib_sge; - u32 offset, data_len, data_left, rdma_write_max, va_offset = 0; + u32 offset, data_len, data_left, rdma_max_len, va_offset = 0; int ret = 0, i, ib_sge_cnt; + u32 max_sge; isert_cmd->tx_desc.isert_cmd = isert_cmd; @@ -2454,7 +2457,12 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd, } wr->ib_sge = ib_sge; - wr->send_wr_num = DIV_ROUND_UP(data->nents, isert_conn->max_sge); + if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) + max_sge = isert_conn->max_write_sge; + else + max_sge = isert_conn->max_read_sge; + + wr->send_wr_num = DIV_ROUND_UP(data->nents, max_sge); wr->send_wr = kzalloc(sizeof(struct ib_send_wr) * wr->send_wr_num, GFP_KERNEL); if (!wr->send_wr) { @@ -2464,11 +2472,11 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd, } wr->isert_cmd = isert_cmd; - rdma_write_max = isert_conn->max_sge * PAGE_SIZE; + rdma_max_len = max_sge * PAGE_SIZE; for (i = 0; i < wr->send_wr_num; i++) { send_wr = &isert_cmd->rdma_wr.send_wr[i]; - data_len = min(data_left, rdma_write_max); + data_len = min(data_left, rdma_max_len); send_wr->send_flags = 0; if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) { @@ -2490,7 +2498,7 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd, } ib_sge_cnt = isert_build_rdma_wr(isert_conn, isert_cmd, ib_sge, - send_wr, data_len, offset); + send_wr, data_len, offset, max_sge); ib_sge += ib_sge_cnt; offset += data_len; @@ -2619,6 +2627,13 @@ isert_fast_reg_mr(struct isert_conn *isert_conn, fr_wr.wr.fast_reg.rkey = mr->rkey; fr_wr.wr.fast_reg.access_flags = IB_ACCESS_LOCAL_WRITE; + /* + * IWARP transports need REMOTE_WRITE for MRs used as the target of + * an RDMA_READ. + */ + if (rdma_protocol_iwarp(ib_dev, isert_conn->cm_id->port_num)) + fr_wr.wr.fast_reg.access_flags |= IB_ACCESS_REMOTE_WRITE; + if (!wr) wr = &fr_wr; else diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h index 9ec23a7..29fde27 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.h +++ b/drivers/infiniband/ulp/isert/ib_isert.h @@ -152,7 +152,8 @@ struct isert_conn { u32 responder_resources; u32 initiator_depth; bool pi_support; - u32 max_sge; + u32 max_write_sge; + u32 max_read_sge; char *login_buf; char *login_req_buf; char *login_rsp_buf; -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-07-05 13:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-02 15:16 [PATCH V4 0/5] iSER support for iWARP Steve Wise
2015-07-02 15:16 ` [PATCH V4 1/5] mlx4, mlx5, mthca: Expose max_sge_rd correctly Steve Wise
2015-07-02 15:16 ` [PATCH V4 4/5] RDMA/isert: Set REMOTE_WRITE on DMA MRs to support iWARP devices Steve Wise
[not found] ` <20150702151508.12946.29133.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
2015-07-02 15:16 ` [PATCH V4 2/5] ipath,qib: Expose max_sge_rd correctly Steve Wise
2015-07-02 15:16 ` [PATCH V4 3/5] RDMA/iser: Limit sg tablesize and max_sectors to device fastreg max depth Steve Wise
[not found] ` <20150702151619.12946.79500.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
2015-07-05 9:57 ` Sagi Grimberg
[not found] ` <5598FFA3.5020508-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-05 13:15 ` Steve Wise
2015-07-02 15:16 ` [PATCH V4 5/5] RDMA/isert: Limit read depth based on the device max_sge_rd capability Steve Wise
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox