* [PATCHv2 1/4] rds: ib: drop unnecessary rdma_reject
@ 2017-03-12 8:07 Zhu Yanjun
2017-03-12 8:07 ` [PATCHv2 3/4] rds: ib: add the static type to the function Zhu Yanjun
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Zhu Yanjun @ 2017-03-12 8:07 UTC (permalink / raw)
To: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
rds-devel-N0ozoZBvEnrZJqsBc5GL+g
When rdma_accept fails, rdma_reject is called in it. As such, it is
not necessary to execute rdma_reject again.
Cc: Joe Jin <joe.jin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Zhu Yanjun <yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
Change from v1 to v2:
Add the acker.
net/rds/ib_cm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index ce3775a..eca3d5f 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -677,8 +677,7 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
event->param.conn.initiator_depth);
/* rdma_accept() calls rdma_reject() internally if it fails */
- err = rdma_accept(cm_id, &conn_param);
- if (err)
+ if (rdma_accept(cm_id, &conn_param))
rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err);
out:
--
2.7.4
--
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
* [PATCHv2 2/4] rds: ib: remove redundant ib_dealloc_fmr
[not found] ` <1489306078-3354-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
@ 2017-03-12 8:07 ` Zhu Yanjun
2017-03-12 19:33 ` [PATCHv2 1/4] rds: ib: drop unnecessary rdma_reject Leon Romanovsky
1 sibling, 0 replies; 8+ messages in thread
From: Zhu Yanjun @ 2017-03-12 8:07 UTC (permalink / raw)
To: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
rds-devel-N0ozoZBvEnrZJqsBc5GL+g
The function ib_dealloc_fmr will never be called. As such, it should
be removed.
Cc: Joe Jin <joe.jin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Johannes Thumshirn <jthumshirn-l3A5Bk7waGM@public.gmane.org>
Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Zhu Yanjun <yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
Change from v1 to v2:
Add the reviewer and acker.
Remove ibmr NULL test.
net/rds/ib_fmr.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c
index 4fe8f4f..249ae1c 100644
--- a/net/rds/ib_fmr.c
+++ b/net/rds/ib_fmr.c
@@ -78,12 +78,9 @@ struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev, int npages)
return ibmr;
out_no_cigar:
- if (ibmr) {
- if (fmr->fmr)
- ib_dealloc_fmr(fmr->fmr);
- kfree(ibmr);
- }
+ kfree(ibmr);
atomic_dec(&pool->item_count);
+
return ERR_PTR(err);
}
--
2.7.4
--
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
* [PATCHv2 3/4] rds: ib: add the static type to the function
2017-03-12 8:07 [PATCHv2 1/4] rds: ib: drop unnecessary rdma_reject Zhu Yanjun
@ 2017-03-12 8:07 ` Zhu Yanjun
[not found] ` <1489306078-3354-3-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-03-12 8:07 ` [PATCHv2 4/4] rds: ib: unmap the scatter/gather list when error Zhu Yanjun
[not found] ` <1489306078-3354-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2 siblings, 1 reply; 8+ messages in thread
From: Zhu Yanjun @ 2017-03-12 8:07 UTC (permalink / raw)
To: santosh.shilimkar, netdev, linux-rdma, rds-devel
The function rds_ib_map_fmr is used only in the ib_fmr.c
file. As such, the static type is added to limit it in this file.
Cc: Joe Jin <joe.jin@oracle.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
Change from v1 to v2:
Add the acker.
net/rds/ib_fmr.c | 5 +++--
net/rds/ib_mr.h | 2 --
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c
index 249ae1c..c936b0d 100644
--- a/net/rds/ib_fmr.c
+++ b/net/rds/ib_fmr.c
@@ -84,8 +84,9 @@ struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev, int npages)
return ERR_PTR(err);
}
-int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev, struct rds_ib_mr *ibmr,
- struct scatterlist *sg, unsigned int nents)
+static int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev,
+ struct rds_ib_mr *ibmr, struct scatterlist *sg,
+ unsigned int nents)
{
struct ib_device *dev = rds_ibdev->dev;
struct rds_ib_fmr *fmr = &ibmr->u.fmr;
diff --git a/net/rds/ib_mr.h b/net/rds/ib_mr.h
index 5d6e98a..0ea4ab0 100644
--- a/net/rds/ib_mr.h
+++ b/net/rds/ib_mr.h
@@ -125,8 +125,6 @@ void rds_ib_mr_exit(void);
void __rds_ib_teardown_mr(struct rds_ib_mr *);
void rds_ib_teardown_mr(struct rds_ib_mr *);
struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *, int);
-int rds_ib_map_fmr(struct rds_ib_device *, struct rds_ib_mr *,
- struct scatterlist *, unsigned int);
struct rds_ib_mr *rds_ib_reuse_mr(struct rds_ib_mr_pool *);
int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *, int, struct rds_ib_mr **);
struct rds_ib_mr *rds_ib_reg_fmr(struct rds_ib_device *, struct scatterlist *,
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCHv2 4/4] rds: ib: unmap the scatter/gather list when error
2017-03-12 8:07 [PATCHv2 1/4] rds: ib: drop unnecessary rdma_reject Zhu Yanjun
2017-03-12 8:07 ` [PATCHv2 3/4] rds: ib: add the static type to the function Zhu Yanjun
@ 2017-03-12 8:07 ` Zhu Yanjun
[not found] ` <1489306078-3354-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2 siblings, 0 replies; 8+ messages in thread
From: Zhu Yanjun @ 2017-03-12 8:07 UTC (permalink / raw)
To: santosh.shilimkar, netdev, linux-rdma, rds-devel
When some errors occur, the scatter/gather list mapped to DMA addresses
should be handled.
Cc: Joe Jin <joe.jin@oracle.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
Change from v1 to v2:
Add the acker.
net/rds/ib_fmr.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c
index c936b0d..86ef907 100644
--- a/net/rds/ib_fmr.c
+++ b/net/rds/ib_fmr.c
@@ -112,29 +112,39 @@ static int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev,
u64 dma_addr = ib_sg_dma_address(dev, &scat[i]);
if (dma_addr & ~PAGE_MASK) {
- if (i > 0)
+ if (i > 0) {
+ ib_dma_unmap_sg(dev, sg, nents,
+ DMA_BIDIRECTIONAL);
return -EINVAL;
- else
+ } else {
++page_cnt;
+ }
}
if ((dma_addr + dma_len) & ~PAGE_MASK) {
- if (i < sg_dma_len - 1)
+ if (i < sg_dma_len - 1) {
+ ib_dma_unmap_sg(dev, sg, nents,
+ DMA_BIDIRECTIONAL);
return -EINVAL;
- else
+ } else {
++page_cnt;
+ }
}
len += dma_len;
}
page_cnt += len >> PAGE_SHIFT;
- if (page_cnt > ibmr->pool->fmr_attr.max_pages)
+ if (page_cnt > ibmr->pool->fmr_attr.max_pages) {
+ ib_dma_unmap_sg(dev, sg, nents, DMA_BIDIRECTIONAL);
return -EINVAL;
+ }
dma_pages = kmalloc_node(sizeof(u64) * page_cnt, GFP_ATOMIC,
rdsibdev_to_node(rds_ibdev));
- if (!dma_pages)
+ if (!dma_pages) {
+ ib_dma_unmap_sg(dev, sg, nents, DMA_BIDIRECTIONAL);
return -ENOMEM;
+ }
page_cnt = 0;
for (i = 0; i < sg_dma_len; ++i) {
@@ -147,8 +157,10 @@ static int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev,
}
ret = ib_map_phys_fmr(fmr->fmr, dma_pages, page_cnt, io_addr);
- if (ret)
+ if (ret) {
+ ib_dma_unmap_sg(dev, sg, nents, DMA_BIDIRECTIONAL);
goto out;
+ }
/* Success - we successfully remapped the MR, so we can
* safely tear down the old mapping.
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCHv2 1/4] rds: ib: drop unnecessary rdma_reject
[not found] ` <1489306078-3354-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-03-12 8:07 ` [PATCHv2 2/4] rds: ib: remove redundant ib_dealloc_fmr Zhu Yanjun
@ 2017-03-12 19:33 ` Leon Romanovsky
[not found] ` <20170312193357.GH2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
1 sibling, 1 reply; 8+ messages in thread
From: Leon Romanovsky @ 2017-03-12 19:33 UTC (permalink / raw)
To: Zhu Yanjun
Cc: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
rds-devel-N0ozoZBvEnrZJqsBc5GL+g
[-- Attachment #1: Type: text/plain, Size: 1416 bytes --]
On Sun, Mar 12, 2017 at 04:07:55AM -0400, Zhu Yanjun wrote:
> When rdma_accept fails, rdma_reject is called in it. As such, it is
> not necessary to execute rdma_reject again.
>
> Cc: Joe Jin <joe.jin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Cc: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Zhu Yanjun <yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
> Change from v1 to v2:
> Add the acker.
>
> net/rds/ib_cm.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
> index ce3775a..eca3d5f 100644
> --- a/net/rds/ib_cm.c
> +++ b/net/rds/ib_cm.c
> @@ -677,8 +677,7 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
> event->param.conn.initiator_depth);
>
> /* rdma_accept() calls rdma_reject() internally if it fails */
> - err = rdma_accept(cm_id, &conn_param);
> - if (err)
> + if (rdma_accept(cm_id, &conn_param))
> rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err);
You omitted initialization of "err" variable which you print here ^^^^^.
>
> out:
> --
> 2.7.4
>
> --
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCHv2 3/4] rds: ib: add the static type to the function
[not found] ` <1489306078-3354-3-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
@ 2017-03-12 19:34 ` Leon Romanovsky
0 siblings, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2017-03-12 19:34 UTC (permalink / raw)
To: Zhu Yanjun
Cc: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
rds-devel-N0ozoZBvEnrZJqsBc5GL+g
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]
On Sun, Mar 12, 2017 at 04:07:57AM -0400, Zhu Yanjun wrote:
> The function rds_ib_map_fmr is used only in the ib_fmr.c
> file. As such, the static type is added to limit it in this file.
>
> Cc: Joe Jin <joe.jin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Cc: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Zhu Yanjun <yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
Thanks,
Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCHv2 1/4] rds: ib: drop unnecessary rdma_reject
[not found] ` <20170312193357.GH2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-03-12 19:43 ` santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA
2017-03-13 0:59 ` Yanjun Zhu
0 siblings, 1 reply; 8+ messages in thread
From: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA @ 2017-03-12 19:43 UTC (permalink / raw)
To: Leon Romanovsky, Zhu Yanjun
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
rds-devel-N0ozoZBvEnrZJqsBc5GL+g
On 3/12/17 12:33 PM, Leon Romanovsky wrote:
> On Sun, Mar 12, 2017 at 04:07:55AM -0400, Zhu Yanjun wrote:
>> When rdma_accept fails, rdma_reject is called in it. As such, it is
>> not necessary to execute rdma_reject again.
>>
>> Cc: Joe Jin <joe.jin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>> Cc: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>> Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>> Signed-off-by: Zhu Yanjun <yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>> ---
>> Change from v1 to v2:
>> Add the acker.
>>
>> net/rds/ib_cm.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
>> index ce3775a..eca3d5f 100644
>> --- a/net/rds/ib_cm.c
>> +++ b/net/rds/ib_cm.c
>> @@ -677,8 +677,7 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
>> event->param.conn.initiator_depth);
>>
>> /* rdma_accept() calls rdma_reject() internally if it fails */
>> - err = rdma_accept(cm_id, &conn_param);
>> - if (err)
>> + if (rdma_accept(cm_id, &conn_param))
>> rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err);
>
> You omitted initialization of "err" variable which you print here ^^^^^.
>
Its inited by rds_ib_setup_qp() but you are right. It will print
failed with error = 0. :-)
Zhu, please drop that 'err' from the message.
--
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
* Re: [PATCHv2 1/4] rds: ib: drop unnecessary rdma_reject
2017-03-12 19:43 ` santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA
@ 2017-03-13 0:59 ` Yanjun Zhu
0 siblings, 0 replies; 8+ messages in thread
From: Yanjun Zhu @ 2017-03-13 0:59 UTC (permalink / raw)
To: santosh.shilimkar, Leon Romanovsky; +Cc: netdev, linux-rdma, rds-devel
On 2017/3/13 3:43, santosh.shilimkar@oracle.com wrote:
> On 3/12/17 12:33 PM, Leon Romanovsky wrote:
>> On Sun, Mar 12, 2017 at 04:07:55AM -0400, Zhu Yanjun wrote:
>>> When rdma_accept fails, rdma_reject is called in it. As such, it is
>>> not necessary to execute rdma_reject again.
>>>
>>> Cc: Joe Jin <joe.jin@oracle.com>
>>> Cc: Junxiao Bi <junxiao.bi@oracle.com>
>>> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
>>> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
>>> ---
>>> Change from v1 to v2:
>>> Add the acker.
>>>
>>> net/rds/ib_cm.c | 3 +--
>>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
>>> index ce3775a..eca3d5f 100644
>>> --- a/net/rds/ib_cm.c
>>> +++ b/net/rds/ib_cm.c
>>> @@ -677,8 +677,7 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id
>>> *cm_id,
>>> event->param.conn.initiator_depth);
>>>
>>> /* rdma_accept() calls rdma_reject() internally if it fails */
>>> - err = rdma_accept(cm_id, &conn_param);
>>> - if (err)
>>> + if (rdma_accept(cm_id, &conn_param))
>>> rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err);
>>
>> You omitted initialization of "err" variable which you print here ^^^^^.
>>
> Its inited by rds_ib_setup_qp() but you are right. It will print
> failed with error = 0. :-)
>
> Zhu, please drop that 'err' from the message.
OK. I will do.
Zhu Yanjun
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-03-13 0:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-12 8:07 [PATCHv2 1/4] rds: ib: drop unnecessary rdma_reject Zhu Yanjun
2017-03-12 8:07 ` [PATCHv2 3/4] rds: ib: add the static type to the function Zhu Yanjun
[not found] ` <1489306078-3354-3-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-03-12 19:34 ` Leon Romanovsky
2017-03-12 8:07 ` [PATCHv2 4/4] rds: ib: unmap the scatter/gather list when error Zhu Yanjun
[not found] ` <1489306078-3354-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-03-12 8:07 ` [PATCHv2 2/4] rds: ib: remove redundant ib_dealloc_fmr Zhu Yanjun
2017-03-12 19:33 ` [PATCHv2 1/4] rds: ib: drop unnecessary rdma_reject Leon Romanovsky
[not found] ` <20170312193357.GH2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-03-12 19:43 ` santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA
2017-03-13 0:59 ` Yanjun Zhu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.