[ipoib] Add support for Supermicro GUIDs.
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 7 Oct 2007 08:00:39 +0000 (08:00 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 7 Oct 2007 08:00:39 +0000 (08:00 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@848 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/ipoib_xfr_mgr.h

index 8e5ca00..56f662d 100644 (file)
@@ -193,7 +193,7 @@ ipoib_mac_from_sst_guid(
 \r
 /****f* IPOIB/ipoib_mac_from_mlx_guid\r
 * NAME\r
-*      ipoib_mac_from_sst_guid\r
+*      ipoib_mac_from_mlx_guid\r
 *\r
 * DESCRIPTION\r
 *      Generates an ethernet MAC address given a Mellanox port GUID.\r
@@ -277,6 +277,38 @@ ipoib_mac_from_voltaire_guid(
 \r
        return IB_SUCCESS;\r
 }\r
+\r
+/****f* IPOIB/ipoib_mac_from_supermicro_guid\r
+* NAME\r
+*      ipoib_mac_from_supermicro_guid\r
+*\r
+* DESCRIPTION\r
+*      Generates an ethernet MAC address given a supermicro port GUID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline ib_api_status_t\r
+ipoib_mac_from_supermicro_guid(\r
+       IN              const   net64_t                                         port_guid,\r
+               OUT                     mac_addr_t* const                       p_mac_addr )\r
+{\r
+       const uint8_t   *p_guid = (const uint8_t*)&port_guid;\r
+\r
+       /* Port guid is in network byte order.  OUI is in lower 3 bytes. */\r
+       ASSERT( p_guid[0] == 0x00 && p_guid[1] == 0x30 && p_guid[2] == 0x48 \r
+       && p_guid[3] == 0xff && p_guid[4] == 0xff);\r
+\r
+       p_mac_addr->addr[0] = 0;\r
+       p_mac_addr->addr[1] = 0x30;\r
+       p_mac_addr->addr[2] = 0x48; \r
+       p_mac_addr->addr[3] = p_guid[5];\r
+       p_mac_addr->addr[4] = p_guid[6];\r
+       p_mac_addr->addr[5] = p_guid[7];\r
+\r
+       return IB_SUCCESS;\r
+}\r
+\r
+\r
 /*\r
 * PARAMETERS\r
 *      port_guid\r
@@ -313,26 +345,35 @@ ipoib_mac_from_guid(
        const uint8_t   *p_guid = (const uint8_t*)&port_guid;\r
        uint32_t                laa;\r
 \r
-       /* Port guid is in network byte order.  OUI is in lower 3 bytes. */\r
-       if( p_guid[0] == 0x00 && p_guid[1] == 0x06 && p_guid[2] == 0x6a )\r
-       {\r
-               status = ipoib_mac_from_sst_guid( port_guid, p_mac_addr );\r
-               if( status == IB_SUCCESS )\r
-                       return IB_SUCCESS;\r
-       }\r
-       else if( p_guid[0] == 0x00 && p_guid[1] == 0x02 && p_guid[2] == 0xc9 )\r
+       if( p_guid[0] == 0 ) \r
        {\r
-               status = ipoib_mac_from_mlx_guid( port_guid, p_mac_addr );\r
-               if( status == IB_SUCCESS )\r
-                       return IB_SUCCESS;\r
+               if( p_guid[1] == 0x02 && p_guid[2] == 0xc9 )\r
+               {\r
+                       status = ipoib_mac_from_mlx_guid( port_guid, p_mac_addr );\r
+                       if( status == IB_SUCCESS )\r
+                               return IB_SUCCESS;\r
+               }\r
+               else if( p_guid[1] == 0x08 && p_guid[2] == 0xf1 )\r
+               {\r
+                       status = ipoib_mac_from_voltaire_guid( port_guid, p_mac_addr );\r
+                       if( status == IB_SUCCESS )\r
+                               return IB_SUCCESS;\r
+               }\r
+               else if( p_guid[1] == 0x30 && p_guid[2] == 0x48 )\r
+               {\r
+                       status = ipoib_mac_from_supermicro_guid( port_guid, p_mac_addr );\r
+                       if( status == IB_SUCCESS )\r
+                               return IB_SUCCESS;\r
+               }\r
+               /* Port guid is in network byte order.  OUI is in lower 3 bytes. */\r
+               else if( p_guid[1] == 0x06 && p_guid[2] == 0x6a )\r
+               {\r
+                       status = ipoib_mac_from_sst_guid( port_guid, p_mac_addr );\r
+                       if( status == IB_SUCCESS )\r
+                               return IB_SUCCESS;\r
+               }\r
+               \r
        }\r
-       else if( p_guid[0] == 0x00 && p_guid[1] == 0x08 && p_guid[2] == 0xf1 )\r
-       {\r
-               status = ipoib_mac_from_voltaire_guid( port_guid, p_mac_addr );\r
-               if( status == IB_SUCCESS )\r
-                       return IB_SUCCESS;\r
-       }\r
-       \r
        /* Value of zero is reserved. */\r
        laa = cl_atomic_inc( &g_ipoib.laa_idx );\r
 \r