Skip to contentSkip to conversation

RESUBMIT: [PATCH] libibmad: To reserve upper 8 bits of tid used by solaris SRIOV driver

PATCH Boris Chiu 2 participants 2 messages Mar 26, 2013 – Mar 27, 2013 1 message not in the archive InfiniBand

lore
Share & tools
lore

Boris Chiu

author
#0 lore raw
Quoted 1 line

From 493e8ed95e32f9c3e337f758a979120392c9e412 Mon Sep 17 00:00:00 2001

From: Brendan Doyle <[email protected]>
Date: Tue, 12 Mar 2013 19:38:52 +0000
Subject: [PATCH] libibmad: To reserve upper 8 bits of tid used by solaris
SRIOV driver

---
 src/mad.c |    8 ++++++++
 src/rpc.c |    2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
src/mad.c +8 -0
index 70a69dd..fe1305d 100644
@@ -50,6 +50,13 @@
 #undef DEBUG
 #define DEBUG	if (ibdebug)	IBWARN
 
+#define GET_IB_USERLAND_TID(tid)	(tid & 0x00000000ffffffff)
+/*
+ * Generate the 64 bit MAD transaction ID. The upper 32 bits are reserved for
+ * use by the kernel. We clear the upper 32 bits here, but MADs received from
+ * the kernel may contain kernel specific data in these bits, consequently
+ * userland TID matching should only be done on the lower 32 bits.
+ */
 uint64_t mad_trid(void)
 {
 	static uint64_t base;
@@ -62,6 +69,7 @@ uint64_t mad_trid(void)
 		trid = random();
 	}
 	next = ++trid | (base << 32);
+	next = GET_IB_USERLAND_TID(next);
 	return next;
 }
 
src/rpc.c +1 -1
index 5cb13f1..7d93180 100644
@@ -129,7 +129,7 @@ static int
 _do_madrpc(int port_id, void *sndbuf, void *rcvbuf, int agentid, int len,
 	   int timeout, int max_retries, int *p_error)
 {
-	uint32_t trid;		/* only low 32 bits */
+	uint32_t trid;		/* only low 32 bits - see mad_trid() */
 	int retries;
 	int length, status;
 
Signature · 1 line
1.7.9.2

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

#2 lore raw

As I said before this is really what we should do so thanks, however, see below.

Quoted 31 lines · On Tue, 26 Mar 2013 11:31:15 -0700 Boris Chiu…

From 493e8ed95e32f9c3e337f758a979120392c9e412 Mon Sep 17 00:00:00 2001
From: Brendan Doyle <[email protected]>
Date: Tue, 12 Mar 2013 19:38:52 +0000
Subject: [PATCH] libibmad: To reserve upper 8 bits of tid used by solaris
SRIOV driver

---
 src/mad.c |    8 ++++++++
 src/rpc.c |    2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
src/mad.c +7 -0
index 70a69dd..fe1305d 100644
@@ -50,6 +50,13 @@
 #undef DEBUG
 #define DEBUG	if (ibdebug)	IBWARN
 
+#define GET_IB_USERLAND_TID(tid)	(tid & 0x00000000ffffffff)
+/*
+ * Generate the 64 bit MAD transaction ID. The upper 32 bits are reserved for
+ * use by the kernel. We clear the upper 32 bits here, but MADs received from
+ * the kernel may contain kernel specific data in these bits, consequently
+ * userland TID matching should only be done on the lower 32 bits.
+ */
 uint64_t mad_trid(void)
 {
 	static uint64_t base;

src/mad.c uint64_t mad_trid(void) · line 72

Quoted 4 lines
src/mad.c +1 -0
@@ -62,6 +69,7 @@ uint64_t mad_trid(void)
 		trid = random();
 	}
 	next = ++trid | (base << 32);
+	next = GET_IB_USERLAND_TID(next);

Sorry, I guess I should have specified that we don't need "base" any longer. I am going to combine the removal of base with your patch and accept this.

Thanks,
Ira

Quoted 19 lines
src/mad.c +0 -0
 	return next;
 }
 
src/rpc.c +1 -1
index 5cb13f1..7d93180 100644
@@ -129,7 +129,7 @@ static int
 _do_madrpc(int port_id, void *sndbuf, void *rcvbuf, int agentid, int len,
 	   int timeout, int max_retries, int *p_error)
 {
-	uint32_t trid;		/* only low 32 bits */
+	uint32_t trid;		/* only low 32 bits - see mad_trid() */
 	int retries;
 	int length, status;
 
Signature · 1 line
1.7.9.2
Signature · 5 lines
Ira Weiny <[email protected]>
--
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