[ipoib] mac generation from hp GUID.
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 19 Jun 2008 14:11:17 +0000 (14:11 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 19 Jun 2008 14:11:17 +0000 (14:11 +0000)
Signed by: Anatoly Greenblatt

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1287 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/ipoib_xfr_mgr.h

index e563a23..5063643 100644 (file)
@@ -337,6 +337,34 @@ ipoib_mac_from_cisco_guid(
        return IB_SUCCESS;\r
 }\r
 \r
+/****f* IPOIB/ipoib_mac_from_hp_guid\r
+* NAME\r
+*      ipoib_mac_from_hp_guid\r
+*\r
+* DESCRIPTION\r
+*      Generates an ethernet MAC address given a HP port GUID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline ib_api_status_t\r
+ipoib_mac_from_hp_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] == 0x1a && p_guid[2] == 0x4b);\r
+\r
+       p_mac_addr->addr[0] = 0;\r
+       p_mac_addr->addr[1] = 0x1a;\r
+       p_mac_addr->addr[2] = 0x4b; \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
 * PARAMETERS\r
@@ -407,8 +435,14 @@ ipoib_mac_from_guid(
                        if( status == IB_SUCCESS )\r
                                return IB_SUCCESS;\r
                }\r
-               \r
+               else if( p_guid[1] == 0x1a && p_guid[2] == 0x4b )\r
+               {\r
+                       status = ipoib_mac_from_hp_guid( port_guid, p_mac_addr );\r
+                       if( status == IB_SUCCESS )\r
+                               return IB_SUCCESS;\r
+               }\r
        }\r
+\r
        /* Value of zero is reserved. */\r
        laa = cl_atomic_inc( &g_ipoib.laa_idx );\r
 \r