Skip to contentSkip to conversation

libibumad: clean up htonll/ntohnll handling

PATCH Applied Jarod Wilson 4 participants 5 messages May 22, 2017 – May 30, 2017 2 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libibumad: clean up htonll/ntohnll handling

Only ntohll was being checked to see if it wasn't defined, and was then redefining htonll as well as ntohll. This was causing some problems for the compile of the opa-ff package. Simple enough to rearrange this code a bit such that htonll and ntohll are handled entirely independent of one another.

---
 libibumad/umad.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
libibumad/umad.h +6 -4
index 81811380..479165a8 100644
@@ -247,15 +247,17 @@ static inline void umad_free(void *umad)
 	free(umad);
 }
 
+/* Users should use the glibc functions directly, not these wrappers */
 #ifndef ntohll
-#undef htonll
 #undef ntohll
-/* Users should use the glibc functions directly, not these wrappers */
-static inline __attribute__((deprecated)) uint64_t htonll(uint64_t x) { return htobe64(x); }
 static inline __attribute__((deprecated)) uint64_t ntohll(uint64_t x) { return be64toh(x); }
-#define htonll htonll
 #define ntohll ntohll
 #endif
+#ifndef htonll
+#undef htonll
+static inline __attribute__((deprecated)) uint64_t htonll(uint64_t x) { return htobe64(x); }
+#define htonll htonll
+#endif
 
 END_C_DECLS
 #endif				/* _UMAD_H */
Signature · 6 lines
2.12.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
Reviewed-by
#2 lore raw
In reply to a message not in the archive
Quoted 5 lines · Jarod Wilson

Only ntohll was being checked to see if it wasn't defined, and was then redefining htonll as well as ntohll. This was causing some problems for the compile of the opa-ff package. Simple enough to rearrange this code a bit such that htonll and ntohll are handled entirely independent of one another.

It used to be the case that they were treated independently.

Quoted 2 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

#3 lore raw
In reply to a message not in the archive
Quoted 5 lines · Jarod Wilson

Only ntohll was being checked to see if it wasn't defined, and was then redefining htonll as well as ntohll. This was causing some problems for the compile of the opa-ff package. Simple enough to rearrange this code a bit such that htonll and ntohll are handled entirely independent of one another.

What problem did this cause?

libibumad/umad.h static inline void umad_free(void *umad) · line 257

Quoted 12 lines
libibumad/umad.h +3 -4
+/* Users should use the glibc functions directly, not these wrappers */
 #ifndef ntohll
-#undef htonll
 #undef ntohll
-/* Users should use the glibc functions directly, not these wrappers */
-static inline __attribute__((deprecated)) uint64_t htonll(uint64_t x) { return htobe64(x); }
 static inline __attribute__((deprecated)) uint64_t ntohll(uint64_t x) { return be64toh(x); }
-#define htonll htonll
 #define ntohll ntohll
 #endif
+#ifndef htonll
+#undef htonll

Both these undefs are not needed anymore.

Seems fine to me, if not weird that something would have a problem here.

Jason
--
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

#5 lore raw
In reply to a message not in the archive
Quoted 24 lines · Jason Gunthorpe
Quoted 5 lines · Jarod Wilson

Only ntohll was being checked to see if it wasn't defined, and was then redefining htonll as well as ntohll. This was causing some problems for the compile of the opa-ff package. Simple enough to rearrange this code a bit such that htonll and ntohll are handled entirely independent of one another.

What problem did this cause?

libibumad/umad.h static inline void umad_free(void *umad) · line 257

Quoted 12 lines
libibumad/umad.h +3 -4
+/* Users should use the glibc functions directly, not these wrappers */
  #ifndef ntohll
-#undef htonll
  #undef ntohll
-/* Users should use the glibc functions directly, not these wrappers */
-static inline __attribute__((deprecated)) uint64_t htonll(uint64_t x) { return htobe64(x); }
  static inline __attribute__((deprecated)) uint64_t ntohll(uint64_t x) { return be64toh(x); }
-#define htonll htonll
  #define ntohll ntohll
  #endif
+#ifndef htonll
+#undef htonll

Both these undefs are not needed anymore.

Quoted 2 lines

Seems fine to me, if not weird that something would have a problem here.

My understanding from Honggang is that this was necessary for him to get opa-ff and infiniband-diags to compile (along with an update to our libibmad package). He should be able to fill in the blanks with further details.

Signature · 6 lines
Jarod Wilson
[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
#6 lore raw
In reply to a message not in the archive
Quoted 6 lines · Jarod Wilson

Only ntohll was being checked to see if it wasn't defined, and was then redefining htonll as well as ntohll. This was causing some problems for the compile of the opa-ff package. Simple enough to rearrange this code a bit such that htonll and ntohll are handled entirely independent of one another.

Quoted 6 lines
---
 libibumad/umad.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Thanks, applied.