<!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.2900.3314" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff
size=2>Hi,</FONT></SPAN></DIV>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff size=2>The
following patch adds guid2mac table to ipoib_xfr_mgr files.</FONT></SPAN></DIV>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff size=2>The
idea is to have one table which holds all GUIDs with their guid mask used
in the GUID to MAC transformation.</FONT></SPAN></DIV>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff size=2>The
code will replace almost all if sections with one loop over the
table.</FONT></SPAN></DIV>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff
size=2>Another advantage is in future addition of GUIDs, one need only to add a
row in the table (The OUI bytes and the corresponding guid
mask)</FONT></SPAN></DIV>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff size=2>Please
note that Mellanox, SST and Voltaire GUIDs are not in the table (the
current transformation can't be represented by guid mask)</FONT></SPAN></DIV>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff
size=2>SuperMicro, Cisco, HP and DELL GUIDs moved to the
table.</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><EM><SPAN
class=285295713-07122008></SPAN></EM></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><EM>Thanks, Reuven.</EM></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff
size=2>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>></FONT></SPAN></DIV>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=285295713-07122008><FONT face=Arial color=#0000ff size=2>Index:
ulp/ipoib/kernel/ipoib_xfr_mgr.c<BR>===================================================================<BR>---
ulp/ipoib/kernel/ipoib_xfr_mgr.c (revision 0)<BR>+++
ulp/ipoib/kernel/ipoib_xfr_mgr.c (revision 0)<BR>@@ -0,0 +1,52
@@<BR>+/*<BR>+ * Copyright (c) 2008 Mellanox Technologies. All rights
reserved.<BR>+ *<BR>+ * This software is available to you under the OpenIB.org
BSD license<BR>+ * below:<BR>+ *<BR>+ * Redistribution
and use in source and binary forms, with or<BR>+ *
without modification, are permitted provided that the following<BR>+
* conditions are met:<BR>+ *<BR>+
* - Redistributions of source code must retain the
above<BR>+ * copyright notice, this
list of conditions and the following<BR>+
* disclaimer.<BR>+ *<BR>+
* - Redistributions in binary form must reproduce
the above<BR>+ * copyright notice,
this list of conditions and the following<BR>+
* disclaimer in the documentation
and/or other materials<BR>+ * provided
with the distribution.<BR>+ *<BR>+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
WARRANTY OF ANY KIND,<BR>+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF<BR>+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND<BR>+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS<BR>+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN<BR>+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN<BR>+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<BR>+ *
SOFTWARE.<BR>+ *<BR>+ * $Id: ipoib_xfr_mgr.c 3459 2008-11-12 16:48:21Z tzachid
$<BR>+ */<BR>+<BR>+<BR>+#include "ipoib_xfr_mgr.h"<BR>+#if
defined(EVENT_TRACING)<BR>+#ifdef offsetof<BR>+#undef
offsetof<BR>+#endif<BR>+#include
"ipoib_xfr_mgr.tmh"<BR>+#endif<BR>+<BR>+<BR>+const ipoib_guid2mac_translation_t
guid2mac_table[] = {<BR>+ {0x30, 0x48, 0xE7},<BR>+ {0x05, 0xAD,
0xE7},<BR>+ {0x18, 0x8B, 0xE7},<BR>+ {0x1A, 0x4B,
0xE7},<BR>+ {0x17, 0x08, 0xE7},<BR>+ {0x1E, 0x0B,
0xE7},<BR>+<BR>+ {0x00, 0x00, 0x00},<BR>+};<BR>+<BR>Index:
ulp/ipoib/kernel/ipoib_xfr_mgr.h<BR>===================================================================<BR>---
ulp/ipoib/kernel/ipoib_xfr_mgr.h (revision 1777)<BR>+++
ulp/ipoib/kernel/ipoib_xfr_mgr.h (working copy)<BR>@@ -81,7 +81,39
@@<BR> *********/<BR> #include
<complib/cl_packoff.h><BR> <BR>+/****s* IPoIB
Driver/ipoib_guid2mac_translation_t<BR>+* NAME<BR>+*
ipoib_guid2mac_translation_t<BR>+*<BR>+* DESCRIPTION<BR>+* The
ipoib_guid2mac_translation_t structure defines a GUID to MAC
translation.<BR>+* The structure holds map between known OUI to an
appropriate GUID mask.<BR>+*<BR>+* SYNOPSIS<BR>+*/<BR>+typedef struct
_ipoib_guid2mac_translation_<BR>+{<BR>+ uint8_t
second_byte;<BR>+ uint8_t third_byte;<BR>+ uint8_t
guid_mask;<BR>+ <BR>+} ipoib_guid2mac_translation_t;<BR>+/*<BR>+*
FIELDS<BR>+* second_byte<BR>+* second byte of OUI (located in
lower three bytes of GUID).<BR>+*<BR>+* third_byte<BR>+* third
byte of OUI (located in lower three bytes of
GUID).<BR>+*<BR>+* guid_mask<BR>+* GUID mask that will be used
to generate MAC from the GUID. <BR>+*<BR>+* SEE
ALSO<BR>+* IPoIB,
ipoib_mac_from_guid_mask<BR>+*********/<BR> <BR>+extern const
ipoib_guid2mac_translation_t guid2mac_table[];<BR> <BR> #ifdef
__cplusplus<BR> extern "C"<BR>@@ -363,10 +395,9
@@<BR> OUT mac_addr_t*
const p_mac_addr<BR> )<BR> {<BR>- static
const uint32_t guid_default_mask = 0xE7; //==0b
11100111<BR> ib_api_status_t status =
IB_INVALID_GUID;<BR> const uint8_t *p_guid = (const
uint8_t*)&port_guid;<BR>- uint32_t laa;<BR>+ uint32_t laa,
idx = 0;<BR> <BR> /* Port guid is in network byte order.
OUI is in lower 3 bytes. */<BR> if( p_guid[0] == 0 )<BR>@@ -379,33
+410,26 @@<BR> {<BR> status =
ipoib_mac_from_voltaire_guid( port_guid, p_mac_addr
);<BR> }<BR>- else if( p_guid[1] == 0x30 &&
p_guid[2] == 0x48 )<BR>- {<BR>- //Supermicro
GUID<BR>- status =ipoib_mac_from_guid_mask( p_guid,
guid_default_mask, p_mac_addr );<BR>- }<BR>- else if(
p_guid[1] == 0x05 && p_guid[2] == 0xad
)<BR>- {<BR>- //Cisco
GUID<BR>- status =ipoib_mac_from_guid_mask( p_guid,
guid_default_mask, p_mac_addr );<BR>- }<BR> else if(
p_guid[1] == 0x06 && p_guid[2] == 0x6a
)<BR> {<BR> status =
ipoib_mac_from_sst_guid( port_guid, p_mac_addr
);<BR> }<BR>- else if( p_guid[1] == 0x1a &&
p_guid[2] == 0x4b ||<BR>- p_guid[1] == 0x17 &&
p_guid[2] == 0x08 ||<BR>- p_guid[1] == 0x1e &&
p_guid[2] == 0x0b
)<BR>+ else<BR> {<BR>- //HP
GUID<BR>- status =ipoib_mac_from_guid_mask( p_guid,
guid_default_mask, p_mac_addr );<BR>+ while(
guid2mac_table[idx].second_byte != 0x00
||<BR>+ guid2mac_table[idx].third_byte !=
0x00 )<BR>+ {<BR>+ if( p_guid[1] ==
guid2mac_table[idx].second_byte
&&<BR>+ p_guid[2] ==
guid2mac_table[idx].third_byte
)<BR>+ {<BR>+ status =
ipoib_mac_from_guid_mask(p_guid,
guid2mac_table[idx].guid_mask,<BR>+ p_mac_addr);<BR>+ break;<BR>+ }<BR>+ ++idx;<BR>+ }<BR> }<BR>- else
if( p_guid[1] == 0x18 && p_guid[2] == 0x8b
)<BR>- {<BR>- //DELL
GUID<BR>- status =ipoib_mac_from_guid_mask( p_guid,
guid_default_mask, p_mac_addr
);<BR>- }<BR>- <BR>+<BR> if( status ==
IB_SUCCESS )<BR> return
status;<BR> }<BR>Index:
ulp/ipoib/kernel/SOURCES<BR>===================================================================<BR>---
ulp/ipoib/kernel/SOURCES (revision 1777)<BR>+++
ulp/ipoib/kernel/SOURCES (working copy)<BR>@@ -23,7 +23,8
@@<BR> ipoib_adapter.c \<BR> ipoib_endpoint.c
\<BR> ipoib_port.c
\<BR>- ipoib_ibat.c<BR>+ ipoib_ibat.c
\<BR>+ ipoib_xfr_mgr.c<BR> <BR> INCLUDES=..;..\..\..\inc;..\..\..\inc\kernel;<BR> <BR></FONT></SPAN></DIV></BODY></HTML>