Skip to contentSkip to conversation

RDMA: Remove kernel private defines and reference to header from UAPI

PATCH In review Leon Romanovsky 3 participants 4 messages Feb 8, 2017 3 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA: Remove kernel private defines and reference to header from UAPI

Remove references to private kernel header and defines from exported ib_user_verb.h file.

The code snippet below is used to reproduce the issue:

#include <stdio.h>
#include <rdma/ib_user_verb.h>

int main(void)

 {
	printf("IB_USER_VERBS_ABI_VERSION = %d\n", IB_USER_VERBS_ABI_VERSION);
	return 0;

}

It fails during compilation phase with an error:
➜ /tmp gcc main.c
main.c:2:31: fatal error: rdma/ib_user_verb.h: No such file or directory

 #include <rdma/ib_user_verb.h>
                               ^

compilation terminated.

Fixes 189aba99e700 ("IB/uverbs: Extend modify_qp and support packet pacing")
CC Bodong Wang <bodong-VPRAkNaXOzVWk0Htik3J/[email protected]>
CC Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/[email protected]>
CC Christoph Hellwig <[email protected]>

---
Changelog v0 -> v1
* Document the origin of hard-coded values.

---
 include/uapi/rdma/ib_user_verbs.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
include/uapi/rdma/ib_user_verbs.h +8 -3
index dfdfe4e92d31..f4f87cff6dc6 100644
@@ -37,7 +37,6 @@
 #define IB_USER_VERBS_H
 
 #include <linux/types.h>
-#include <rdma/ib_verbs.h>
 
 /*
  * Increment this value if any changes that break userspace ABI
@@ -548,11 +547,17 @@ enum {
 };
 
 enum {
-	IB_USER_LEGACY_LAST_QP_ATTR_MASK = IB_QP_DEST_QPN
+	/*
+	 * This value is equal to IB_QP_DEST_QPN.
+	 */
+	IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20,
 };
 
 enum {
-	IB_USER_LAST_QP_ATTR_MASK = IB_QP_RATE_LIMIT
+	/*
+	 * This value is equal to IB_QP_RATE_LIMIT.
+	 */
+	IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,
 };
 
 struct ib_uverbs_ex_create_qp {

--
2.11.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170208150409.29537-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#2 lore raw
Quoted 67 lines · Leon Romanovsky

Remove references to private kernel header and defines from exported ib_user_verb.h file.

The code snippet below is used to reproduce the issue:

#include <stdio.h>
#include <rdma/ib_user_verb.h>

int main(void)

 {
	printf("IB_USER_VERBS_ABI_VERSION = %d\n", IB_USER_VERBS_ABI_VERSION);
	return 0;

}

It fails during compilation phase with an error:
➜ /tmp gcc main.c
main.c:2:31: fatal error: rdma/ib_user_verb.h: No such file or directory

 #include <rdma/ib_user_verb.h>
                               ^

compilation terminated.

Fixes 189aba99e700 ("IB/uverbs: Extend modify_qp and support packet pacing")
CC Bodong Wang <bodong-VPRAkNaXOzVWk0Htik3J/[email protected]>
CC Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/[email protected]>
CC Christoph Hellwig <[email protected]>

---
Changelog v0 -> v1
* Document the origin of hard-coded values.

---
 include/uapi/rdma/ib_user_verbs.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
include/uapi/rdma/ib_user_verbs.h +8 -4
index dfdfe4e92d31..f4f87cff6dc6 100644
@@ -37,7 +37,6 @@
 #define IB_USER_VERBS_H
 
 #include <linux/types.h>
-#include <rdma/ib_verbs.h>
 
 /*
  * Increment this value if any changes that break userspace ABI
@@ -548,11 +547,17 @@ enum {
 };
 
 enum {
-	IB_USER_LEGACY_LAST_QP_ATTR_MASK = IB_QP_DEST_QPN
+	/*
+	 * This value is equal to IB_QP_DEST_QPN.
+	 */
+	IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20,
 };
 
 enum {
-	IB_USER_LAST_QP_ATTR_MASK = IB_QP_RATE_LIMIT
+	/*
+	 * This value is equal to IB_QP_RATE_LIMIT.
+	 */
+	IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,
 };
 
 struct ib_uverbs_ex_create_qp {
--
Quoted 2 lines

2.11.1

I tried to write this earlier, but for some reason my mailer didn't really send it.
IMHO, since these enum values are actually passed between user-space and kernel (attr_mask), it's acceptable to expose all enum values. Otherwise, user-space should define all these symbols by by itself (as done today), so why bother introduce only this explicit symbol? --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 8c2f6c58-f622-95cf-e146-ed7a5747fd9a-VPRAkNaXOzVWk0Htik3J/[email protected]

#4 lore raw
Quoted 66 lines · Matan Barak (External)
Quoted 65 lines · Leon Romanovsky

Remove references to private kernel header and defines from exported ib_user_verb.h file.

The code snippet below is used to reproduce the issue:

#include <stdio.h>
#include <rdma/ib_user_verb.h>

int main(void)

 {
	printf("IB_USER_VERBS_ABI_VERSION = %d\n", IB_USER_VERBS_ABI_VERSION);
	return 0;

}

It fails during compilation phase with an error:
➜ /tmp gcc main.c
main.c:2:31: fatal error: rdma/ib_user_verb.h: No such file or directory

 #include <rdma/ib_user_verb.h>
                               ^

compilation terminated.

Fixes 189aba99e700 ("IB/uverbs: Extend modify_qp and support packet pacing")
CC Bodong Wang <bodong-VPRAkNaXOzVWk0Htik3J/[email protected]>
CC Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/[email protected]>
CC Christoph Hellwig <[email protected]>

---
Changelog v0 -> v1
* Document the origin of hard-coded values.

---
 include/uapi/rdma/ib_user_verbs.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
include/uapi/rdma/ib_user_verbs.h +8 -3
index dfdfe4e92d31..f4f87cff6dc6 100644
@@ -37,7 +37,6 @@
 #define IB_USER_VERBS_H
 
 #include <linux/types.h>
-#include <rdma/ib_verbs.h>
 
 /*
  * Increment this value if any changes that break userspace ABI
@@ -548,11 +547,17 @@ enum {
 };
 
 enum {
-	IB_USER_LEGACY_LAST_QP_ATTR_MASK = IB_QP_DEST_QPN
+	/*
+	 * This value is equal to IB_QP_DEST_QPN.
+	 */
+	IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20,
 };
 
 enum {
-	IB_USER_LAST_QP_ATTR_MASK = IB_QP_RATE_LIMIT
+	/*
+	 * This value is equal to IB_QP_RATE_LIMIT.
+	 */
+	IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,
 };
 
Quoted 11 lines
Quoted 4 lines
include/uapi/rdma/ib_user_verbs.h +0 -1
 struct ib_uverbs_ex_create_qp {
--

2.11.1

I tried to write this earlier, but for some reason my mailer didn't really send it.
IMHO, since these enum values are actually passed between user-space and kernel (attr_mask), it's acceptable to expose all enum values. Otherwise, user-space should define all these symbols by by itself (as done today), so why bother introduce only this explicit symbol?

Mainly because it is -rc7 fix and it is MUST be applied as soon as possible, currently IB stack is broken.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170208172544.GF6005-U/[email protected]

#6 lore raw
Quoted 4 lines · Leon Romanovsky
Quoted 1 line

I tried to write this earlier, but for some reason my mailer didn't

really

Quoted 2 lines

send it.
IMHO, since these enum values are actually passed between user-

Quoted 8 lines

space and

Quoted 2 lines

kernel (attr_mask), it's acceptable to expose all enum values. Otherwise, user-space should define all these symbols by by itself

(as done

Quoted 1 line

today), so why bother introduce only this explicit symbol?

Mainly because it is -rc7 fix and it is MUST be applied as soon as possible, currently IB stack is broken.

Indeed, which is why I took the V1 of the patch.  We can fix it up nicer in -next if people prefer.

Signature · 4 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD