[ofw][patch] added new case in ipoib_mac_from_guid to handle hp oui

Anatoly Greenblatt anatolyg at voltaire.com
Thu Jun 19 06:09:06 PDT 2008


 <<mac_generation_from_hp_guid.patch>> Index:
ulp/ipoib/kernel/ipoib_xfr_mgr.h
===================================================================
--- ulp/ipoib/kernel/ipoib_xfr_mgr.h	(revision 1269)
+++ ulp/ipoib/kernel/ipoib_xfr_mgr.h	(working copy)
@@ -337,7 +337,35 @@
 	return IB_SUCCESS;
 }
 
+/****f* IPOIB/ipoib_mac_from_hp_guid
+* NAME
+*	ipoib_mac_from_hp_guid
+*
+* DESCRIPTION
+*	Generates an ethernet MAC address given a HP port GUID.
+*
+* SYNOPSIS
+*/
+static inline ib_api_status_t
+ipoib_mac_from_hp_guid(
+	IN		const	net64_t
port_guid,
+		OUT			mac_addr_t* const
p_mac_addr )
+{
+	const uint8_t	*p_guid = (const uint8_t*)&port_guid;
 
+	/* Port guid is in network byte order.  OUI is in lower 3 bytes.
*/
+	ASSERT( p_guid[0] == 0x00 && p_guid[1] == 0x1a && p_guid[2] ==
0x4b);
+
+	p_mac_addr->addr[0] = 0;
+	p_mac_addr->addr[1] = 0x1a;
+	p_mac_addr->addr[2] = 0x4b; 
+	p_mac_addr->addr[3] = p_guid[5];
+	p_mac_addr->addr[4] = p_guid[6];
+	p_mac_addr->addr[5] = p_guid[7];
+
+	return IB_SUCCESS;
+}
+
 /*
 * PARAMETERS
 *	port_guid
@@ -407,8 +435,14 @@
 			if( status == IB_SUCCESS )
 				return IB_SUCCESS;
 		}
-		
+		else if( p_guid[1] == 0x1a && p_guid[2] == 0x4b )
+		{
+			status = ipoib_mac_from_hp_guid( port_guid,
p_mac_addr );
+			if( status == IB_SUCCESS )
+				return IB_SUCCESS;
+		}
 	}
+
 	/* Value of zero is reserved. */
 	laa = cl_atomic_inc( &g_ipoib.laa_idx );
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mac_generation_from_hp_guid.patch
Type: application/octet-stream
Size: 1424 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080619/a13a48a9/attachment.obj>


More information about the ofw mailing list