public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core] cxgb4: always query device before initializing chip version
@ 2019-11-04 12:26 Potnuri Bharat Teja
  2019-11-05 14:45 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Potnuri Bharat Teja @ 2019-11-04 12:26 UTC (permalink / raw)
  To: jgg, dledford; +Cc: linux-rdma, bharat, nirranjan, Rahul Kundu

chip_version may be initialized wrongly if alloc_context() is
invoked multiple times. therefore always query device to derive the
correct chip_version.

Fixes: c7e71b250268 ("cxgb4: fix chipversion initialization")
Signed-off-by: Rahul Kundu <rahul.kundu@chelsio.com>
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
---
 providers/cxgb4/dev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c
index 4d02c7a91892..6526a7170fce 100644
--- a/providers/cxgb4/dev.c
+++ b/providers/cxgb4/dev.c
@@ -143,14 +143,14 @@ static struct verbs_context *c4iw_alloc_context(struct ibv_device *ibdev,
 	} 
 
 	verbs_set_ops(&context->ibv_ctx, &c4iw_ctx_common_ops);
+	ret = ibv_cmd_query_device(&context->ibv_ctx.context, &attr,
+				   &raw_fw_ver, &qcmd, sizeof(qcmd));
+	if (ret)
+		goto err_unmap;
 
 	if (!rhp->mmid2ptr) {
 		int ret;
 
-		ret = ibv_cmd_query_device(&context->ibv_ctx.context, &attr,
-					   &raw_fw_ver, &qcmd, sizeof(qcmd));
-		if (ret)
-			goto err_unmap;
 		rhp->max_mr = attr.max_mr;
 		rhp->mmid2ptr = calloc(attr.max_mr, sizeof(void *));
 		if (!rhp->mmid2ptr) {
-- 
2.3.9


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH rdma-core] cxgb4: always query device before initializing chip version
  2019-11-04 12:26 [PATCH rdma-core] cxgb4: always query device before initializing chip version Potnuri Bharat Teja
@ 2019-11-05 14:45 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2019-11-05 14:45 UTC (permalink / raw)
  To: Potnuri Bharat Teja; +Cc: jgg, dledford, linux-rdma, nirranjan, Rahul Kundu

On Mon, Nov 04, 2019 at 05:56:08PM +0530, Potnuri Bharat Teja wrote:
> chip_version may be initialized wrongly if alloc_context() is
> invoked multiple times. therefore always query device to derive the
> correct chip_version.
>
> Fixes: c7e71b250268 ("cxgb4: fix chipversion initialization")
> Signed-off-by: Rahul Kundu <rahul.kundu@chelsio.com>
> Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
> ---
>  providers/cxgb4/dev.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>

Thanks, applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-05 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-04 12:26 [PATCH rdma-core] cxgb4: always query device before initializing chip version Potnuri Bharat Teja
2019-11-05 14:45 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox