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

Anatoly Greenblatt anatolyg at voltaire.com
Thu Jun 5 06:37:34 PDT 2008


 <<fix_for_mac_generation_for_unknown_guids.patch>> Replaced mac
creation based on static counter with creation based on guid.
Fixes problem with MAC address generation (reported by Fab)


Index: ulp/ipoib/kernel/ipoib_driver.h
===================================================================
--- ulp/ipoib/kernel/ipoib_driver.h	(revision 1245)
+++ ulp/ipoib/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: ulp/ipoib/kernel/ipoib_xfr_mgr.h
===================================================================
--- ulp/ipoib/kernel/ipoib_xfr_mgr.h	(revision 1245)
+++ ulp/ipoib/kernel/ipoib_xfr_mgr.h	(working copy)
@@ -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
+	uint32_t		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: 1645 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080605/608ab8ad/attachment.obj>


More information about the ofw mailing list