[PATCH] RDMA/rxe: Fix parameter errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Correct errors in rxe_param.h caused by extending the range of
indices for MRs allowing it to overlap the range for MWs. Since
the driver determines whether an rkey is for an MR or MW by comparing
the index part of the rkey with these ranges this can cause an
MR to be incorrectly determined to be an MW.

Additionally the parameters which determine the size of the index
ranges for MR, MW, QP and SRQ are incorrect since the actual
number of integers in the range [min, max] is (max - min + 1) not
(max - min).

This patch corrects these errors.

Fixes: 0994a1bcd5f7 ("RDMA/rxe: Bump up default maximum values used via uverbs")
Signed-off-by: Bob Pearson <rpearsonhpe@xxxxxxxxx>
---
 drivers/infiniband/sw/rxe/rxe_param.h | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h
index a754fc902e3d..14baa84d1d9d 100644
--- a/drivers/infiniband/sw/rxe/rxe_param.h
+++ b/drivers/infiniband/sw/rxe/rxe_param.h
@@ -91,18 +91,29 @@ enum rxe_device_param {
 
 	RXE_MIN_QP_INDEX		= 16,
 	RXE_MAX_QP_INDEX		= DEFAULT_MAX_VALUE,
-	RXE_MAX_QP			= DEFAULT_MAX_VALUE - RXE_MIN_QP_INDEX,
+	RXE_MAX_QP			= RXE_MAX_QP_INDEX
+						- RXE_MIN_QP_INDEX + 1,
 
 	RXE_MIN_SRQ_INDEX		= 0x00020001,
 	RXE_MAX_SRQ_INDEX		= DEFAULT_MAX_VALUE,
-	RXE_MAX_SRQ			= DEFAULT_MAX_VALUE - RXE_MIN_SRQ_INDEX,
-
-	RXE_MIN_MR_INDEX		= 0x00000001,
+	RXE_MAX_SRQ			= RXE_MAX_SRQ_INDEX
+						- RXE_MIN_SRQ_INDEX + 1,
+
+	/*
+	 * MR and MW indices are converted to rkeys by shifting
+	 * left 8 bits and oring in an 8 bit key which either
+	 * belongs to the driver or the user depending on the
+	 * MR type. In order to determine if the rkey is an MR
+	 * or an MW the index ranges below must not overlap.
+	 */
+	RXE_MIN_MR_INDEX		= 1,
 	RXE_MAX_MR_INDEX		= DEFAULT_MAX_VALUE,
-	RXE_MAX_MR			= DEFAULT_MAX_VALUE - RXE_MIN_MR_INDEX,
-	RXE_MIN_MW_INDEX		= 0x00010001,
-	RXE_MAX_MW_INDEX		= 0x00020000,
-	RXE_MAX_MW			= 0x00001000,
+	RXE_MAX_MR			= RXE_MAX_MR_INDEX
+						- RXE_MIN_MR_INDEX + 1,
+	RXE_MIN_MW_INDEX		= DEFAULT_MAX_VALUE + 1,
+	RXE_MAX_MW_INDEX		= 2*DEFAULT_MAX_VALUE,
+	RXE_MAX_MW			= RXE_MAX_MW_INDEX
+						- RXE_MIN_MW_INDEX + 1,
 
 	RXE_MAX_PKT_PER_ACK		= 64,
 
-- 
2.37.2




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux