Skip to contentSkip to conversation

osmtest/osmt_multicast.c: Fix IPoIB MC group recognition

PATCH New Hal Rosenstock 1 participant 1 message Feb 21, 2013 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 osmtest/osmt_multicast.c: Fix IPoIB MC group recognition

Recognize IPoIB groups by signature in MGID

---
 osmtest/osmt_multicast.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)
osmtest/osmt_multicast.c +18 -3
index d24f03a..ac8d1b2 100644
@@ -435,10 +435,23 @@ void osmt_init_mc_query_rec(IN osmtest_t * const p_osmt,
  * - Try GetTable with PortGUID wildcarded and get back some groups.
  ***********************************************************************/
 
+#define PREFIX_MASK CL_HTON64(0xff10ffff00000000ULL)
+#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL)
+#define IPV4_PREFIX_MASK CL_HTON64(0xff10ffff00000000ULL)
+#define PREFIX_SIGNATURE_IPV4 CL_HTON64(0xff10401b00000000ULL)
+
+static unsigned is_ipv4_mgid(ib_gid_t * mgid)
+{
+	return ((mgid->unicast.prefix & IPV4_PREFIX_MASK) == PREFIX_SIGNATURE_IPV4);
+}
+
+static unsigned is_ipv6_mgid(ib_gid_t * mgid)
+{
+	return ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE);
+}
+
 /* The following macro can be used only within the osmt_run_mcast_flow() function */
-#define IS_IPOIB_MGID(p_mgid) \
-           ( !memcmp(&osm_ipoib_good_mgid,    (p_mgid), sizeof(osm_ipoib_good_mgid)) || \
-             !memcmp(&osm_ts_ipoib_good_mgid, (p_mgid), sizeof(osm_ts_ipoib_good_mgid)) )
+#define IS_IPOIB_MGID(p_mgid) (is_ipv4_mgid(p_mgid) || is_ipv6_mgid(p_mgid))
 
 ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 {
@@ -486,6 +499,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 		 0xff, 0xff, 0xff, 0xee,	/* 32 bit IPv4 broadcast address */
 		 },
 	};
+#if 0
 	static ib_gid_t osm_ts_ipoib_good_mgid = {
 		{
 		 0xff,		/* multicast field */
@@ -496,6 +510,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 		 0x00, 0x00, 0x00, 0x01,	/* 32 bit IPv4 broadcast address */
 		 },
 	};
+#endif
 	static ib_gid_t osm_ipoib_good_mgid = {
 		{
 		 0xff,		/* multicast field */
Signature · 6 lines
1.7.8.2

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