[ofw] [Patch][IPoIB[IPoIB_NDIS6_CM] GUID2MAC translation changes

Alex Naslednikov xalex at mellanox.co.il
Sun Sep 19 07:23:16 PDT 2010


Guids supported by several new vendors can't be distinguished only by first 2 bytes.
This patch adds 3-rd byte of GUID to the translation table.

Signed-off by: Alexander Naslednikov (xalex at mellanox.co.il)
Index: ipoib/kernel/ipoib_xfr_mgr.c
===================================================================
--- ipoib/kernel/ipoib_xfr_mgr.c               (revision 2934)
+++ ipoib/kernel/ipoib_xfr_mgr.c            (working copy)
@@ -40,13 +40,37 @@


 const ipoib_guid2mac_translation_t guid2mac_table[] = {
-              {0x30, 0x48, 0xE7},
-              {0x05, 0xAD, 0xE7},
-              {0x18, 0x8B, 0xE7},
-              {0x1A, 0x4B, 0xE7},
-              {0x17, 0x08, 0xE7},
-              {0x1E, 0x0B, 0xE7},
+             {0x00, 0x30, 0x48, 0xE7},
+             {0x00, 0x05, 0xAD, 0xE7},
+             {0x00, 0x18, 0x8B, 0xE7},
+             {0x00, 0x1A, 0x4B, 0xE7},
+             {0x00, 0x17, 0x08, 0xE7},
+             {0x00, 0x1E, 0x0B, 0xE7},

-              {0x00, 0x00, 0x00},
+             {0x00, 0x03, 0xBA, 0xE7},
+             {0x00, 0x05, 0xAD, 0xE7},
+             {0x00, 0x0D, 0x9D, 0xE7},
+             {0x00, 0x11, 0x0A, 0xE7},
+             {0x00, 0x11, 0x85, 0xE7},
+             {0x00, 0x12, 0x79, 0xE7},
+             {0x00, 0x13, 0x21, 0xE7},
+             {0x00, 0x14, 0x38, 0xE7},
+             {0x00, 0x16, 0x35, 0xE7},
+             {0x00, 0x17, 0x08, 0xE7},
+             {0x00, 0x17, 0xA4, 0xE7},
+             {0x00, 0x18, 0x8B, 0xE7},
+             {0x00, 0x18, 0xFE, 0xE7},
+             {0x00, 0x19, 0xBB, 0xE7},
+             {0x00, 0x1A, 0x4B, 0xE7},
+             {0x00, 0x1B, 0x78, 0xE7},
+             {0x00, 0x1E, 0x0B, 0xE7},
+             {0x00, 0x22, 0x64, 0xE7},
+             {0x00, 0x23, 0x7D, 0xE7},
+             {0x00, 0x25, 0x90, 0xE7},
+             {0x00, 0x30, 0x48, 0xE7},
+             {0x00, 0x80, 0x5F, 0xE7},
+
+             {0x00, 0x00, 0x00, 0x00},
 };

+
Index: ipoib/kernel/ipoib_xfr_mgr.h
===================================================================
--- ipoib/kernel/ipoib_xfr_mgr.h              (revision 2934)
+++ ipoib/kernel/ipoib_xfr_mgr.h           (working copy)
@@ -93,6 +93,7 @@
 */
 typedef struct _ipoib_guid2mac_translation_
 {
+             uint8_t first_byte;
                uint8_t second_byte;
                uint8_t third_byte;
                uint8_t guid_mask;
@@ -400,26 +401,26 @@
                uint32_t                               laa, idx = 0;

                /* Port guid is in network byte order.  OUI is in lower 3 bytes. */
-              if( p_guid[0] == 0 )
-              {
-                              if( p_guid[1] == 0x02 && p_guid[2] == 0xc9 )
+
+             if( p_guid[0] == 0 && p_guid[1] == 0x02 && p_guid[2] == 0xc9 )
                                {
                                                status = ipoib_mac_from_mlx_guid( port_guid, p_mac_addr );
                                }
-                              else if( p_guid[1] == 0x08 && p_guid[2] == 0xf1 )
+             else if( p_guid[0] == 0 && p_guid[1] == 0x08 && p_guid[2] == 0xf1 )
                                {
                                                status = ipoib_mac_from_voltaire_guid( port_guid, p_mac_addr );
                                }
-                              else if( p_guid[1] == 0x06 && p_guid[2] == 0x6a )
+             else if( p_guid[0] == 0 && p_guid[1] == 0x06 && p_guid[2] == 0x6a )
                                {
                                                status = ipoib_mac_from_sst_guid( port_guid, p_mac_addr );
                                }
                                else
                                {
                                                while( guid2mac_table[idx].second_byte != 0x00 ||
-                                                                 guid2mac_table[idx].third_byte != 0x00 )
+                                                guid2mac_table[idx].third_byte != 0x00 )  //first byte can be equal to 0
                                                {
-                                                              if( p_guid[1] == guid2mac_table[idx].second_byte &&
+                                             if( p_guid[0] == guid2mac_table[idx].first_byte &&
+                                                             p_guid[1] == guid2mac_table[idx].second_byte &&
                                                                                p_guid[2] == guid2mac_table[idx].third_byte )
                                                                {
                                                                                status = ipoib_mac_from_guid_mask(p_guid, guid2mac_table[idx].guid_mask,
@@ -432,8 +433,8 @@

                                if( status == IB_SUCCESS )
                                                return status;
-              }

+
                if( guid_mask )
                                return ipoib_mac_from_guid_mask( p_guid, guid_mask, p_mac_addr );

Index: ipoib_NDIS6_CM/kernel/ipoib_xfr_mgr.cpp
===================================================================
--- ipoib_NDIS6_CM/kernel/ipoib_xfr_mgr.cpp (revision 2934)
+++ ipoib_NDIS6_CM/kernel/ipoib_xfr_mgr.cpp              (working copy)
@@ -41,36 +41,36 @@


 const ipoib_guid2mac_translation_t guid2mac_table[] = {
-              {0x30, 0x48, 0xE7},
-              {0x05, 0xAD, 0xE7},
-              {0x18, 0x8B, 0xE7},
-              {0x1A, 0x4B, 0xE7},
-              {0x17, 0x08, 0xE7},
-              {0x1E, 0x0B, 0xE7},
+             {0x00, 0x30, 0x48, 0xE7},
+             {0x00, 0x05, 0xAD, 0xE7},
+             {0x00, 0x18, 0x8B, 0xE7},
+             {0x00, 0x1A, 0x4B, 0xE7},
+             {0x00, 0x17, 0x08, 0xE7},
+             {0x00, 0x1E, 0x0B, 0xE7},

-              {0x03, 0xBA, 0xE7},
-              {0x05, 0xAD, 0xE7},
-              {0x0D, 0x9D, 0xE7},
-              {0x11, 0x0A, 0xE7},
-              {0x11, 0x85, 0xE7},
-              {0x12, 0x79, 0xE7},
-              {0x13, 0x21, 0xE7},
-              {0x14, 0x38, 0xE7},
-              {0x16, 0x35, 0xE7},
-              {0x17, 0x08, 0xE7},
-              {0x17, 0xA4, 0xE7},
-              {0x18, 0x8B, 0xE7},
-              {0x18, 0xFE, 0xE7},
-              {0x19, 0xBB, 0xE7},
-              {0x1A, 0x4B, 0xE7},
-              {0x1B, 0x78, 0xE7},
-              {0x1E, 0x0B, 0xE7},
-              {0x22, 0x64, 0xE7},
-              {0x23, 0x7D, 0xE7},
-              {0x25, 0x90, 0xE7},
-              {0x30, 0x48, 0xE7},
-              {0x80, 0x5F, 0xE7},
+             {0x00, 0x03, 0xBA, 0xE7},
+             {0x00, 0x05, 0xAD, 0xE7},
+             {0x00, 0x0D, 0x9D, 0xE7},
+             {0x00, 0x11, 0x0A, 0xE7},
+             {0x00, 0x11, 0x85, 0xE7},
+             {0x00, 0x12, 0x79, 0xE7},
+             {0x00, 0x13, 0x21, 0xE7},
+             {0x00, 0x14, 0x38, 0xE7},
+             {0x00, 0x16, 0x35, 0xE7},
+             {0x00, 0x17, 0x08, 0xE7},
+             {0x00, 0x17, 0xA4, 0xE7},
+             {0x00, 0x18, 0x8B, 0xE7},
+             {0x00, 0x18, 0xFE, 0xE7},
+             {0x00, 0x19, 0xBB, 0xE7},
+             {0x00, 0x1A, 0x4B, 0xE7},
+             {0x00, 0x1B, 0x78, 0xE7},
+             {0x00, 0x1E, 0x0B, 0xE7},
+             {0x00, 0x22, 0x64, 0xE7},
+             {0x00, 0x23, 0x7D, 0xE7},
+             {0x00, 0x25, 0x90, 0xE7},
+             {0x00, 0x30, 0x48, 0xE7},
+             {0x00, 0x80, 0x5F, 0xE7},

-              {0x00, 0x00, 0x00},
+             {0x00, 0x00, 0x00, 0x00},
 };

Index: ipoib_NDIS6_CM/kernel/ipoib_xfr_mgr.h
===================================================================
--- ipoib_NDIS6_CM/kernel/ipoib_xfr_mgr.h     (revision 2934)
+++ ipoib_NDIS6_CM/kernel/ipoib_xfr_mgr.h  (working copy)
@@ -93,6 +93,7 @@
 */
 typedef struct _ipoib_guid2mac_translation_
 {
+             uint8_t first_byte;
                uint8_t second_byte;
                uint8_t third_byte;
                uint8_t guid_mask;
@@ -409,26 +410,25 @@
                uint32_t                               laa, idx = 0;

                /* Port guid is in network byte order.  OUI is in lower 3 bytes. */
-              if( p_guid[0] == 0 )
-              {
-                              if( p_guid[1] == 0x02 && p_guid[2] == 0xc9 )
+             if( p_guid[0] == 0 && p_guid[1] == 0x02 && p_guid[2] == 0xc9 )
                                {
                                                status = ipoib_mac_from_mlx_guid( port_guid, p_mac_addr );
                                }
-                              else if( p_guid[1] == 0x08 && p_guid[2] == 0xf1 )
+             else if( p_guid[0] == 0 && p_guid[1] == 0x08 && p_guid[2] == 0xf1 )
                                {
                                                status = ipoib_mac_from_voltaire_guid( port_guid, p_mac_addr );
                                }
-                              else if( p_guid[1] == 0x06 && p_guid[2] == 0x6a )
+             else if( p_guid[0] == 0 && p_guid[1] == 0x06 && p_guid[2] == 0x6a )
                                {
                                                status = ipoib_mac_from_sst_guid( port_guid, p_mac_addr );
                                }
                                else
                                {
                                                while( guid2mac_table[idx].second_byte != 0x00 ||
-                                                                 guid2mac_table[idx].third_byte != 0x00 )
+                                                guid2mac_table[idx].third_byte != 0x00 ) //first byte can be equal to 0
                                                {
-                                                              if( p_guid[1] == guid2mac_table[idx].second_byte &&
+                                             if( p_guid[0] == guid2mac_table[idx].first_byte &&
+                                                             p_guid[1] == guid2mac_table[idx].second_byte &&
                                                                                p_guid[2] == guid2mac_table[idx].third_byte )
                                                                {
                                                                                status = ipoib_mac_from_guid_mask(p_guid, guid2mac_table[idx].guid_mask,
@@ -441,7 +441,6 @@

                                if( status == IB_SUCCESS )
                                                return status;
-              }

                if( guid_mask )
                                return ipoib_mac_from_guid_mask( p_guid, guid_mask, p_mac_addr );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100919/076afb16/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GUID_support.patch
Type: application/octet-stream
Size: 7026 bytes
Desc: GUID_support.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100919/076afb16/attachment.obj>


More information about the ofw mailing list