Blame SOURCES/0009-cxgb4-always-query-device-before-initializing-chip-v.patch

baba1b
From 3146dd6503fbb87b311caae47eeac739dc59bfd3 Mon Sep 17 00:00:00 2001
baba1b
From: Potnuri Bharat Teja <bharat@chelsio.com>
baba1b
Date: Mon, 4 Nov 2019 17:18:25 +0530
baba1b
Subject: [PATCH rdma-core 09/13] cxgb4: always query device before
baba1b
 initializing chip version
baba1b
baba1b
[ Upstream commit df720f3658ca49aea89cb6e8f11980f30574d10a ]
baba1b
baba1b
chip_version may be initialized wrongly if alloc_context() is
baba1b
invoked multiple times. therefore always query device to derive the
baba1b
correct chip_version.
baba1b
baba1b
Fixes: c7e71b250268 ("cxgb4: fix chipversion initialization")
baba1b
Signed-off-by: Rahul Kundu <rahul.kundu@chelsio.com>
baba1b
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
baba1b
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
baba1b
---
baba1b
 providers/cxgb4/dev.c | 9 +++------
baba1b
 1 file changed, 3 insertions(+), 6 deletions(-)
baba1b
baba1b
diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c
baba1b
index 4d02c7a9..ecd87e6c 100644
baba1b
--- a/providers/cxgb4/dev.c
baba1b
+++ b/providers/cxgb4/dev.c
baba1b
@@ -143,14 +143,11 @@ static struct verbs_context *c4iw_alloc_context(struct ibv_device *ibdev,
baba1b
 	} 
baba1b
 
baba1b
 	verbs_set_ops(&context->ibv_ctx, &c4iw_ctx_common_ops);
baba1b
+	if (ibv_cmd_query_device(&context->ibv_ctx.context, &attr,
baba1b
+				 &raw_fw_ver, &qcmd, sizeof(qcmd)))
baba1b
+		goto err_unmap;
baba1b
 
baba1b
 	if (!rhp->mmid2ptr) {
baba1b
-		int ret;
baba1b
-
baba1b
-		ret = ibv_cmd_query_device(&context->ibv_ctx.context, &attr,
baba1b
-					   &raw_fw_ver, &qcmd, sizeof(qcmd));
baba1b
-		if (ret)
baba1b
-			goto err_unmap;
baba1b
 		rhp->max_mr = attr.max_mr;
baba1b
 		rhp->mmid2ptr = calloc(attr.max_mr, sizeof(void *));
baba1b
 		if (!rhp->mmid2ptr) {
baba1b
-- 
baba1b
2.20.1
baba1b