[ofw] [PATCH 4/4] Clean up MAC generation, add support for HP GUIDs
Fab Tillier
ftillier at windows.microsoft.com
Tue Sep 30 12:09:22 PDT 2008
This patch tries to makes sense of the GUID mask.
1. Conversion algorithms for known GUIDs takes precedence over user-provided GUID mask.
2. Only use user-provided GUID mask for generating local MAC address, not for received packets.
3. Fail adapter initialization if GUID mask is invalid.
Signed-off-by: Fab Tillier <ftillier at microsoft.com>
diff -r -up -X docs\dontdiff.txt -I \$Id: \dev\openib\gen1\branches\WOF2-0\trunk\ulp\ipoib\kernel\ipoib_adapter.c ulp\ipoib\kernel\ipoib_adapter.c
--- \dev\openib\gen1\branches\WOF2-0\trunk\ulp\ipoib\kernel\ipoib_adapter.c Wed Sep 24 14:25:56 2008
+++ ulp\ipoib\kernel\ipoib_adapter.c Tue Sep 30 11:59:06 2008
@@ -364,26 +364,24 @@ adapter_init(
return IB_ERROR;
}
-
/* Validate the port GUID and generate the MAC address. */
status =
ipoib_mac_from_guid( p_adapter->guids.port_guid.guid, p_adapter->params.guid_mask, &p_adapter->mac);
- if (status == IB_INVALID_GUID_MASK)
- {
- IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_ERROR,
- ("Invalid GUID mask received, rejecting it") );
- ipoib_create_log(p_adapter->h_adapter, GUID_MASK_LOG_INDEX, EVENT_IPOIB_WRONG_PARAMETER_WRN);
- }
- else if( status != IB_SUCCESS )
+ if( status != IB_SUCCESS )
{
+ if( status == IB_INVALID_GUID_MASK )
+ {
+ IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_ERROR,
+ ("Invalid GUID mask received, rejecting it") );
+ ipoib_create_log(p_adapter->h_adapter, GUID_MASK_LOG_INDEX, EVENT_IPOIB_WRONG_PARAMETER_WRN);
+ }
+
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
("ipoib_mac_from_guid returned %s\n",
p_adapter->p_ifc->get_err_str( status )) );
return status;
}
-
-
/* Open AL. */
status = p_adapter->p_ifc->open_al( &p_adapter->h_al );
if( status != IB_SUCCESS )
diff -r -up -X docs\dontdiff.txt -I \$Id: \dev\openib\gen1\branches\WOF2-0\trunk\ulp\ipoib\kernel\ipoib_port.c ulp\ipoib\kernel\ipoib_port.c
--- \dev\openib\gen1\branches\WOF2-0\trunk\ulp\ipoib\kernel\ipoib_port.c Tue Sep 30 10:54:46 2008
+++ ulp\ipoib\kernel\ipoib_port.c Tue Sep 30 11:55:12 2008
@@ -1819,17 +1819,11 @@ __recv_get_endpts(
{
status = ipoib_mac_from_guid(
#if IPOIB_INLINE_RECV
- p_desc->buf.ib.grh.src_gid.unicast.interface_id, p_port->p_adapter->params.guid_mask, &mac );
+ p_desc->buf.ib.grh.src_gid.unicast.interface_id, 0, &mac );
#else /* IPOIB_INLINE_RECV */
- p_desc->p_buf->ib.grh.src_gid.unicast.interface_id, p_port->p_adapter->params.guid_mask, &mac );
+ p_desc->p_buf->ib.grh.src_gid.unicast.interface_id, 0, &mac );
#endif /* IPOIB_INLINE_RECV */
- if (status == IB_INVALID_GUID_MASK)
- {
- IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_ERROR,
- ("Invalid GUID mask received, rejecting it") );
- ipoib_create_log(p_port->p_adapter->h_adapter, GUID_MASK_LOG_INDEX, EVENT_IPOIB_WRONG_PARAMETER_WRN);
- }
- else if( status != IB_SUCCESS )
+ if( status != IB_SUCCESS )
{
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
("ipoib_mac_from_guid returned %s\n",
diff -r -up -X docs\dontdiff.txt -I \$Id: \dev\openib\gen1\branches\WOF2-0\trunk\ulp\ipoib\kernel\ipoib_xfr_mgr.h ulp\ipoib\kernel\ipoib_xfr_mgr.h
--- \dev\openib\gen1\branches\WOF2-0\trunk\ulp\ipoib\kernel\ipoib_xfr_mgr.h Tue Sep 30 11:47:12 2008
+++ ulp\ipoib\kernel\ipoib_xfr_mgr.h Tue Sep 30 11:59:08 2008
@@ -305,7 +305,7 @@ ipoib_mac_from_guid_mask(
if( digit_counter > mac_addr_size )
{
//to avoid negative index
- return IB_INVALID_GUID;
+ return IB_INVALID_GUID_MASK;
}
p_mac_addr->addr[mac_addr_size - digit_counter] = p_guid [i];
}
@@ -313,7 +313,7 @@ ipoib_mac_from_guid_mask(
// check for the mask validity: it should have 6 non-zero bits
if( digit_counter != mac_addr_size )
- return IB_INVALID_GUID;
+ return IB_INVALID_GUID_MASK;
return IB_SUCCESS;
}
@@ -395,13 +395,6 @@ ipoib_mac_from_guid(
const uint8_t *p_guid = (const uint8_t*)&port_guid;
uint32_t laa;
- if( guid_mask )
- {
- status = ipoib_mac_from_guid_mask( p_guid, guid_mask, p_mac_addr );
- if( status == IB_SUCCESS )
- return IB_SUCCESS;
- }
-
/* Port guid is in network byte order. OUI is in lower 3 bytes. */
if( p_guid[0] == 0 )
{
@@ -442,6 +435,9 @@ ipoib_mac_from_guid(
if( status == IB_SUCCESS )
return status;
}
+
+ if( guid_mask )
+ return ipoib_mac_from_guid_mask( p_guid, guid_mask, p_mac_addr );
/* Value of zero is reserved. */
laa = cl_atomic_inc( &g_ipoib.laa_idx );
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipoib_mac.4.patch
Type: application/octet-stream
Size: 4195 bytes
Desc: ipoib_mac.4.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080930/9cdb216d/attachment.obj>
More information about the ofw
mailing list