<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN
class=406493011-19092008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=406493011-19092008>This patch adds
support for dell guid and also enables user-defined MAC address generation
according to predefined GUID bitwise mask</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=406493011-19092008>IPoIB GUID
patch</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=406493011-19092008>Signed-off by:
Alexander Naslednikov (xalex at mellanox.co.il)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2>Index:
inc/iba/ib_types.h<BR>===================================================================<BR>---
inc/iba/ib_types.h (revision 3193)<BR>+++ inc/iba/ib_types.h (working
copy)<BR>@@ -8696,6 +8696,7
@@<BR> IB_INVALID_GID,<BR> IB_INVALID_LID,<BR> IB_INVALID_GUID,<BR>+ IB_INVALID_GUID_MASK,<BR> IB_INVALID_CA_HANDLE,<BR> IB_INVALID_AV_HANDLE,<BR> IB_INVALID_CQ_HANDLE,<BR>Index:
ulp/ipoib/kernel/ipoib_adapter.c<BR>===================================================================<BR>---
ulp/ipoib/kernel/ipoib_adapter.c (revision 3193)<BR>+++
ulp/ipoib/kernel/ipoib_adapter.c (working copy)<BR>@@ -343,8 +343,8
@@<BR> <BR> <BR> /* Validate the port GUID and generate the
MAC address. */<BR>- status =<BR>- ipoib_mac_from_guid(
p_adapter->guids.port_guid.guid, &p_adapter->mac );<BR>+ status =
<BR>+ ipoib_mac_from_guid( p_adapter->guids.port_guid.guid,
p_adapter->params.guid_mask, &p_adapter->mac);<BR> if(
status != IB_SUCCESS )<BR> {<BR> IPOIB_PRINT_EXIT(
TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,<BR>Index:
ulp/ipoib/kernel/ipoib_adapter.h<BR>===================================================================<BR>---
ulp/ipoib/kernel/ipoib_adapter.h (revision 3193)<BR>+++
ulp/ipoib/kernel/ipoib_adapter.h (working copy)<BR>@@ -77,6 +77,7
@@<BR> uint32_t xfer_block_size;<BR> mac_addr_t conf_mac;<BR> uint32_t mc_leave_rescan;<BR>+ uint64_t guid_mask;<BR> } ipoib_params_t;<BR> /*<BR> *
FIELDS<BR>Index:
ulp/ipoib/kernel/ipoib_driver.c<BR>===================================================================<BR>---
ulp/ipoib/kernel/ipoib_driver.c (revision 3193)<BR>+++
ulp/ipoib/kernel/ipoib_driver.c (working copy)<BR>@@ -128,7 +128,10
@@<BR> <BR> #define
IB_INFINITE_SERVICE_LEASE 0xFFFFFFFF<BR> <BR>+//The mask is 8 bit and
can't contain more than 6 non-zero bits<BR>+#define MAX_GUID_MAX
0xFC<BR> <BR>+<BR> /* Global driver debug level
*/<BR> uint32_t g_ipoib_dbg_level =
TRACE_LEVEL_ERROR;<BR> uint32_t g_ipoib_dbg_flags =
0x00000fff;<BR>@@ -157,7 +160,10
@@<BR> {NDIS_STRING_CONST("RecvRatio"),
1, IPOIB_OFFSET(recv_pool_ratio),
IPOIB_SIZE(recv_pool_ratio),
1,
1,
10},<BR> {NDIS_STRING_CONST("PayloadMtu"),
1,
IPOIB_OFFSET(payload_mtu),
IPOIB_SIZE(payload_mtu),
2044, 60,
4092},<BR> {NDIS_STRING_CONST("lso"),
0,
IPOIB_OFFSET(lso),
IPOIB_SIZE(lso),
0,
0,
1},<BR>- {NDIS_STRING_CONST("MCLeaveRescan"), 1,
IPOIB_OFFSET(mc_leave_rescan),
IPOIB_SIZE(mc_leave_rescan),
260, 1,
3600}<BR>+ {NDIS_STRING_CONST("MCLeaveRescan"), 1,
IPOIB_OFFSET(mc_leave_rescan),
IPOIB_SIZE(mc_leave_rescan),
260, 1,
3600},<BR>+ {NDIS_STRING_CONST("GUIDMask"),
1,
IPOIB_OFFSET(guid_mask),
IPOIB_SIZE(guid_mask),
0, 0,
MAX_GUID_MAX}<BR>+ <BR>+ <BR> };
<BR> <BR> #define IPOIB_NUM_REG_PARAMS (sizeof (HCARegTable) /
sizeof(IPOIB_REG_ENTRY))<BR>Index:
ulp/ipoib/kernel/ipoib_port.c<BR>===================================================================<BR>---
ulp/ipoib/kernel/ipoib_port.c (revision 3193)<BR>+++
ulp/ipoib/kernel/ipoib_port.c (working copy)<BR>@@ -1819,9 +1819,9
@@<BR> {<BR> status =
ipoib_mac_from_guid(<BR> #if
IPOIB_INLINE_RECV<BR>- p_desc->buf.ib.grh.src_gid.unicast.interface_id,
&mac
);<BR>+ p_desc->buf.ib.grh.src_gid.unicast.interface_id,
p_port->p_adapter->params.guid_mask, &mac );<BR> #else /*
IPOIB_INLINE_RECV
*/<BR>- p_desc->p_buf->ib.grh.src_gid.unicast.interface_id,
&mac
);<BR>+ p_desc->p_buf->ib.grh.src_gid.unicast.interface_id,
p_port->p_adapter->params.guid_mask,&mac );<BR> #endif /*
IPOIB_INLINE_RECV */<BR> if( status != IB_SUCCESS
)<BR> {<BR>@@ -2315,7 +2315,7
@@<BR> cl_memcpy( &gid, &p_cid[7], sizeof(ib_gid_t)
);<BR> p_cid[1] = HW_ADDR_LEN +1;// CID length
<BR> p_cid[2] = DHCP_HW_TYPE_ETH;// CID type
<BR>- status = ipoib_mac_from_guid( gid.unicast.interface_id,
(mac_addr_t*)&p_cid[3] );<BR>+ status = ipoib_mac_from_guid(
gid.unicast.interface_id,
p_port->p_adapter->params.guid_mask,(mac_addr_t*)&p_cid[3]
);<BR> p_cid[HW_ADDR_LEN + 3] = DHCP_OPT_END; //terminate
tag<BR> }<BR> IPOIB_EXIT( IPOIB_DBG_RECV );<BR>@@ -2425,7
+2425,7 @@<BR> {<BR> /* Copy the src GID to allow
aligned access */<BR> cl_memcpy( &gid,
&p_ib_arp->src_hw.gid, sizeof(ib_gid_t) );<BR>- status =
ipoib_mac_from_guid( gid.unicast.interface_id, &mac
);<BR>+ status = ipoib_mac_from_guid( gid.unicast.interface_id,
p_port->p_adapter->params.guid_mask,&mac );<BR> if(
status != IB_SUCCESS
)<BR> {<BR> IPOIB_PRINT_EXIT(
TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,<BR>Index:
ulp/ipoib/kernel/ipoib_xfr_mgr.h<BR>===================================================================<BR>---
ulp/ipoib/kernel/ipoib_xfr_mgr.h (revision 3193)<BR>+++
ulp/ipoib/kernel/ipoib_xfr_mgr.h (working copy)<BR>@@ -231,6 +231,77
@@<BR> <BR> return IB_SUCCESS;<BR> }<BR>+<BR>+/****f*
IPOIB/ipoib_mac_from_dell_guid<BR>+*
NAME<BR>+* ipoib_mac_from_dell_guid<BR>+*<BR>+*
DESCRIPTION<BR>+* Generates an ethernet MAC address given a DELL port
GUID.<BR>+*<BR>+* SYNOPSIS<BR>+*/<BR>+static inline
ib_api_status_t<BR>+ipoib_mac_from_dell_guid(<BR>+ IN const net64_t port_guid,<BR>+ OUT mac_addr_t*
const p_mac_addr )<BR>+{<BR>+ const uint8_t *p_guid =
(const
uint8_t*)&port_guid;<BR>+ uint32_t low24;<BR>+ net16_t guid_middle;<BR>+<BR>+ /*
Port guid is in network byte order. OUI is in lower 3 bytes.
*/<BR>+ ASSERT( p_guid[0] == 0x00 && p_guid[1] == 0x18 &&
p_guid[2] == 0x8b );<BR>+<BR>+ low24 = ((uint32_t)cl_ntoh64( port_guid )
& 0x00FFFFFF);<BR>+ <BR>+ p_mac_addr->addr[0] =
p_guid[0];<BR>+ p_mac_addr->addr[1] =
p_guid[1];<BR>+ p_mac_addr->addr[2] =
p_guid[2];<BR>+ p_mac_addr->addr[3] = (uint8_t)(low24 >>
16);<BR>+ p_mac_addr->addr[4] = (uint8_t)(low24 >>
8);<BR>+ p_mac_addr->addr[5] =
(uint8_t)low24;<BR>+ <BR>+ return IB_SUCCESS;<BR>+}<BR>+<BR>+/****f*
IPOIB/ipoib_mac_from_general_guid<BR>+*
NAME<BR>+* ipoib_mac_from_general_guid<BR>+*<BR>+*
DESCRIPTION<BR>+* Generates an ethernet MAC address given a general port
GUID and a bitwise mask<BR>+*<BR>+* SYNOPSIS<BR>+*/<BR>+static inline
ib_api_status_t<BR>+ipoib_mac_from_general_guid(<BR>+ IN const net64_t port_guid,<BR>+ IN
uint8_t guid_mask,<BR>+ OUT mac_addr_t*
const p_mac_addr )<BR>+{<BR>+#define MAC_ADDR_SIZE
6<BR>+ uint8_t i;<BR>+ const uint8_t *p_guid = (const
uint8_t*)&port_guid;<BR>+ int dig_counter = 0;<BR>+<BR>+ //All
non-zero bits of guid_mask indicates the number of an appropriate byte
in<BR>+ // port_guid, that will be used in MAC address
construction<BR>+ for (i = 7; guid_mask; guid_mask >>= 1, --i)
{<BR>+ if (guid_mask & 1 )
{<BR>+ p_mac_addr->addr[MAC_ADDR_SIZE - dig_counter] =
p_guid
[i];<BR>+ ++dig_counter;<BR>+ }<BR>+ }<BR>+ //
check for the mask validity: it can't have more than 6 non-zero
bits<BR>+ if (dig_counter != MAC_ADDR_SIZE)
{<BR>+ return
IB_INVALID_GUID_MASK;<BR>+ }<BR>+ <BR>+ return
IB_SUCCESS;<BR>+}<BR>+<BR>+<BR> /*<BR> *
PARAMETERS<BR> * port_guid<BR>@@ -399,12 +470,22 @@<BR> static
inline
ib_api_status_t<BR> ipoib_mac_from_guid(<BR> IN const net64_t port_guid,<BR>- OUT mac_addr_t*
const p_mac_addr )<BR>+ IN const
uint32_t guid_mask,<BR>+ OUT mac_addr_t*
const p_mac_addr<BR>+ )<BR> {<BR> ib_api_status_t status;<BR> const
uint8_t *p_guid = (const
uint8_t*)&port_guid;<BR> uint32_t laa;<BR> <BR>+ if
(guid_mask) {<BR>+ status = ipoib_mac_from_general_guid(port_guid,
guid_mask, p_mac_addr);<BR>+ if( status == IB_SUCCESS
)<BR>+ return IB_SUCCESS;<BR>+ //otherwise,
mask was invalid, getting back to standard
flow<BR>+ }<BR>+ <BR>+<BR> if( p_guid[0] == 0 )
<BR> {<BR> if( p_guid[1] == 0x02 &&
p_guid[2] == 0xc9 )<BR>@@ -444,6 +525,13 @@<BR> if(
status == IB_SUCCESS )<BR> return
IB_SUCCESS;<BR> }<BR>+ else if( p_guid[1] == 0x18
&& p_guid[2] == 0x8b )<BR>+ {<BR>+ status =
ipoib_mac_from_dell_guid( port_guid, p_mac_addr );<BR>+ if(
status == IB_SUCCESS )<BR>+ return
IB_SUCCESS;<BR>+ }<BR>+ <BR> }<BR> <BR> /*
Value of zero is reserved. */<BR>Index:
ulp/opensm/user/include/iba/ib_types.h<BR>===================================================================<BR>---
ulp/opensm/user/include/iba/ib_types.h (revision 3193)<BR>+++
ulp/opensm/user/include/iba/ib_types.h (working copy)<BR>@@ -7928,6 +7928,7
@@<BR> IB_INVALID_GID,<BR> IB_INVALID_LID,<BR> IB_INVALID_GUID,<BR>+ IB_INVALID_GUID_MASK,<BR> IB_INVALID_CA_HANDLE,<BR> IB_INVALID_AV_HANDLE,<BR> IB_INVALID_CQ_HANDLE,<BR>Index:
ulp/opensm/user/include/iba/ib_types_extended.h<BR>===================================================================<BR>---
ulp/opensm/user/include/iba/ib_types_extended.h (revision 3193)<BR>+++
ulp/opensm/user/include/iba/ib_types_extended.h (working copy)<BR>@@ -137,6
+137,7
@@<BR> IB_INVALID_GID,<BR> IB_INVALID_LID,<BR> IB_INVALID_GUID,<BR>+ IB_INVALID_GUID_MASK,<BR> IB_INVALID_CA_HANDLE,<BR> IB_INVALID_AV_HANDLE,<BR> IB_INVALID_CQ_HANDLE,</FONT></DIV></BODY></HTML>