[ofw][patch] fixes mac generation for unknown guids (HP)

Anatoly Greenblatt anatolyg at voltaire.com
Thu Jun 5 07:08:01 PDT 2008


 <<fix_for_mac_generation_for_unknown_guids.patch>> Ignore my last
e-mail, this is the correct patch.
Fixes mac address generation problem reported by Fab.


Index: kernel/ipoib_driver.h
===================================================================
--- kernel/ipoib_driver.h	(revision 1245)
+++ kernel/ipoib_driver.h	(working copy)
@@ -71,8 +71,6 @@
 	cl_qlist_t		adapter_list;
 	cl_qlist_t		bundle_list;
 
-	atomic32_t		laa_idx;
-
 	NDIS_HANDLE		h_ndis_wrapper;
 	NDIS_HANDLE		h_ibat_dev;
 	volatile LONG	ibat_ref;
@@ -90,9 +88,6 @@
 *	bundle_list
 *		List of all adapter bundles.
 *
-*	laa_idx
-*		Global counter for generating LAA MACs
-*
 *	h_ibat_dev
 *		Device handle returned by NdisMRegisterDevice.
 *********/
Index: kernel/ipoib_xfr_mgr.h
===================================================================
--- kernel/ipoib_xfr_mgr.h	(revision 1245)
+++ kernel/ipoib_xfr_mgr.h	(working copy)
@@ -372,7 +372,7 @@
 {
 	ib_api_status_t	status;
 	const uint8_t	*p_guid = (const uint8_t*)&port_guid;
-	uint32_t		laa;
+	uint32_t		low24;
 
 	if( p_guid[0] == 0 ) 
 	{
@@ -409,18 +409,16 @@
 		}
 		
 	}
-	/* Value of zero is reserved. */
-	laa = cl_atomic_inc( &g_ipoib.laa_idx );
 
-	if( !laa )
-		return IB_INVALID_GUID;
+	// create mac based on unknown vendor guid
+	low24 = ((uint32_t)cl_ntoh64( port_guid ) & 0x00FFFFFF);
 
-	p_mac_addr->addr[0] = 2; /* LAA bit */
-	p_mac_addr->addr[1] = 0;
-	p_mac_addr->addr[2] = (uint8_t)(laa >> 24);
-	p_mac_addr->addr[3] = (uint8_t)(laa >> 16);
-	p_mac_addr->addr[4] = (uint8_t)(laa >> 8);
-	p_mac_addr->addr[5] = (uint8_t)laa;
+	p_mac_addr->addr[0] = p_guid[0];
+	p_mac_addr->addr[1] = p_guid[1];
+	p_mac_addr->addr[2] = p_guid[2];
+	p_mac_addr->addr[3] = (uint8_t)(low24 >> 16);
+	p_mac_addr->addr[4] = (uint8_t)(low24 >> 8);
+	p_mac_addr->addr[5] = (uint8_t)low24;
 	
 	return IB_SUCCESS;
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_for_mac_generation_for_unknown_guids.patch
Type: application/octet-stream
Size: 1753 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080605/bf3350ae/attachment.obj>


More information about the ofw mailing list