This patch reuses ipoib_mac_from_general_guid and contains important
bugfix
Signed-off by: Alexander Naslednikov (xalex at mellanox.co.il)
Index: D:/Windows/MLNX_WINOF/ulp/ipoib/kernel/ipoib_adapter.c
===================================================================
--- D:/Windows/MLNX_WINOF/ulp/ipoib/kernel/ipoib_adapter.c
(revision 3221)
+++ D:/Windows/MLNX_WINOF/ulp/ipoib/kernel/ipoib_adapter.c
(revision 3222)
@@ -121,7 +121,9 @@
 NDIS_STATUS
 ipoib_get_adapter_params(
        IN                              NDIS_HANDLE* const
wrapper_config_context,
-       IN      OUT                     ipoib_adapter_t
*p_adapter );
+       IN      OUT                     ipoib_adapter_t
*p_adapter,
+       OUT                             PUCHAR
*p_mac,
+       OUT                             UINT
*p_len);
 
 
 /* Implementation */
@@ -134,6 +136,8 @@
        ipoib_adapter_t         *p_adapter;
        ib_api_status_t         status;
        cl_status_t                     cl_status;
+       PUCHAR                          mac;
+       UINT                            len;
 
        IPOIB_ENTER( IPOIB_DBG_INIT );
 
@@ -185,6 +189,17 @@
                return IB_ERROR;
        }
 
+       /* Read configuration parameters. */
+       status = ipoib_get_adapter_params( wrapper_config_context,
+               p_adapter , &mac, &len);
+       if( status != NDIS_STATUS_SUCCESS )
+       {
+               cl_obj_destroy( &p_adapter->obj );
+               IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
+                       ("ipoib_get_adapter_params returned 0x%.8x.\n",
status) );
+               return status;
+       }
+               
        status = adapter_init( p_adapter );
        if( status != IB_SUCCESS )
        {
@@ -195,15 +210,23 @@
                return status;
        }
 
-       /* Read configuration parameters. */
-       status = ipoib_get_adapter_params( wrapper_config_context,
-               p_adapter );
-       if( status != NDIS_STATUS_SUCCESS )
+       ETH_COPY_NETWORK_ADDRESS( p_adapter->params.conf_mac.addr,
p_adapter->mac.addr );
+       /* If there is a NetworkAddress override in registry, use it */
+       if( (status == NDIS_STATUS_SUCCESS) && (len == HW_ADDR_LEN) )
        {
-               cl_obj_destroy( &p_adapter->obj );
-               IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
-                       ("ipoib_get_adapter_params returned 0x%.8x.\n",
status) );
-               return status;
+               if( ETH_IS_MULTICAST(mac) || ETH_IS_BROADCAST(mac) ||
+                       !ETH_IS_LOCALLY_ADMINISTERED(mac) )
+               {
+                       IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_INIT,
+                               ("Overriding NetworkAddress is invalid -
"
+                               "%02x-%02x-%02x-%02x-%02x-%02x\n",
+                               mac[0], mac[1], mac[2],
+                               mac[3], mac[4], mac[5]) );
+               }
+               else
+       {
+                       ETH_COPY_NETWORK_ADDRESS(
p_adapter->params.conf_mac.addr, mac );
+               }
        }
 
        *pp_adapter = p_adapter;
Index: D:/Windows/MLNX_WINOF/ulp/ipoib/kernel/ipoib_driver.c
===================================================================
--- D:/Windows/MLNX_WINOF/ulp/ipoib/kernel/ipoib_driver.c
(revision 3221)
+++ D:/Windows/MLNX_WINOF/ulp/ipoib/kernel/ipoib_driver.c
(revision 3222)
@@ -484,13 +484,13 @@
 NDIS_STATUS
 ipoib_get_adapter_params(
        IN                              NDIS_HANDLE* const
wrapper_config_context,
-       IN      OUT                     ipoib_adapter_t
*p_adapter )
+       IN      OUT                     ipoib_adapter_t
*p_adapter,
+       OUT                             PUCHAR
*p_mac,
+       OUT                             UINT
*p_len)
 {
        NDIS_STATUS                                             status;
        NDIS_HANDLE
h_config;
        NDIS_CONFIGURATION_PARAMETER    *p_param;
-       PUCHAR                                                  mac;
-       UINT                                                    len;
        UINT                            value;
        PIPOIB_REG_ENTRY                pRegEntry;
        UINT                            i;
@@ -598,26 +598,8 @@
                        p_adapter->params.rq_depth /
p_adapter->params.rq_low_watermark;
 
        p_adapter->params.xfer_block_size = (sizeof(eth_hdr_t) +
p_adapter->params.payload_mtu);
-       NdisReadNetworkAddress( &status, &mac, &len, h_config );
+       NdisReadNetworkAddress( &status, p_mac, p_len, h_config );
 
-       ETH_COPY_NETWORK_ADDRESS( p_adapter->params.conf_mac.addr,
p_adapter->mac.addr );
-       /* If there is a NetworkAddress override in registry, use it */
-       if( (status == NDIS_STATUS_SUCCESS) && (len == HW_ADDR_LEN) )
-       {
-               if( ETH_IS_MULTICAST(mac) || ETH_IS_BROADCAST(mac) ||
-                       !ETH_IS_LOCALLY_ADMINISTERED(mac) )
-               {
-                       IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_INIT,
-                               ("Overriding NetworkAddress is invalid -
"
-                               "%02x-%02x-%02x-%02x-%02x-%02x\n",
-                               mac[0], mac[1], mac[2],
-                               mac[3], mac[4], mac[5]) );
-               }
-               else
-               {
-                       ETH_COPY_NETWORK_ADDRESS(
p_adapter->params.conf_mac.addr, mac );
-               }
-       }
 
        NdisCloseConfiguration( h_config );
 
Index: D:/Windows/MLNX_WINOF/ulp/ipoib/kernel/ipoib_xfr_mgr.h
===================================================================
--- D:/Windows/MLNX_WINOF/ulp/ipoib/kernel/ipoib_xfr_mgr.h
(revision 3221)
+++ D:/Windows/MLNX_WINOF/ulp/ipoib/kernel/ipoib_xfr_mgr.h
(revision 3222)
@@ -431,53 +431,7 @@
        return IB_SUCCESS;
 }
 
-/****f* IPOIB/ipoib_mac_from_hp_guid
-* NAME
-*      ipoib_mac_from_hp_guid
-*
-* DESCRIPTION
-*      Generates an ethernet MAC address given a HP port GUID.
-*
-* SYNOPSIS
-*/
-static inline ib_api_status_t
-ipoib_mac_from_hp_guid(
-       IN              const   net64_t
port_guid,
-               OUT                     mac_addr_t* const
p_mac_addr )
-{
-       const uint8_t   *p_guid = (const uint8_t*)&port_guid;
 
-       /* Port guid is in network byte order.  OUI is in lower 3 bytes.
*/
-       ASSERT( p_guid[0] == 0x00 && p_guid[1] == 0x1a && p_guid[2] ==
0x4b);
-
-       p_mac_addr->addr[0] = 0;
-       p_mac_addr->addr[1] = 0x1a;
-       p_mac_addr->addr[2] = 0x4b; 
-       p_mac_addr->addr[3] = p_guid[5];
-       p_mac_addr->addr[4] = p_guid[6];
-       p_mac_addr->addr[5] = p_guid[7];
-
-       return IB_SUCCESS;
-}
-
-/*
-* PARAMETERS
-*      port_guid
-*              The port GUID, in network byte order, for which to
generate a
-*              MAC address.
-*
-*      p_mac_addr
-*              Pointer to a mac address in which to store the results.
-*
-* RETURN VALUES
-*      IB_SUCCESS
-*              The MAC address was successfully converted.
-*
-* SEE ALSO
-*      IPOIB
-*********/
-
-
 /****f* IPOIB/ipoib_mac_from_guid
 * NAME
 *      ipoib_mac_from_guid
@@ -505,53 +459,53 @@
                if( status == IB_SUCCESS )
                                return IB_SUCCESS;
                //otherwise, mask was invalid, getting back to standard
flow
+               if (status == IB_INVALID_GUID_MASK)
+               {
+                       IPOIB_PRINT( TRACE_LEVEL_WARNING,
IPOIB_DBG_ERROR,
+                       ("Invalid GUID mask received, rejecting it") );
+               }
        }
                        
        if( p_guid[0] == 0 ) 
        {
+               status = IB_INVALID_GUID;
                if( p_guid[1] == 0x02 && p_guid[2] == 0xc9 )
                {
                        status = ipoib_mac_from_mlx_guid( port_guid,
p_mac_addr );
-                       if( status == IB_SUCCESS )
-                               return IB_SUCCESS;
                }
                else if( p_guid[1] == 0x08 && p_guid[2] == 0xf1 )
                {
                        status = ipoib_mac_from_voltaire_guid(
port_guid, p_mac_addr );
-                       if( status == IB_SUCCESS )
-                               return IB_SUCCESS;
                }
                else if( p_guid[1] == 0x30 && p_guid[2] == 0x48 )
                {
-                       status = ipoib_mac_from_supermicro_guid(
port_guid, p_mac_addr );
-                       if( status == IB_SUCCESS )
-                               return IB_SUCCESS;
+                       //Supermicro GUID
+                       status =ipoib_mac_from_general_guid(port_guid,
guid_default_mask, p_mac_addr);
                }
                else if( p_guid[1] == 0x05 && p_guid[2] == 0xad )
                {
-                       status = ipoib_mac_from_cisco_guid( port_guid,
p_mac_addr );
-                       if( status == IB_SUCCESS )
-                               return IB_SUCCESS;
+                       //Cisco GUID 
+                       status =ipoib_mac_from_general_guid(port_guid,
guid_default_mask, p_mac_addr);
                }        
                /* Port guid is in network byte order.  OUI is in lower
3 bytes. */
                else if( p_guid[1] == 0x06 && p_guid[2] == 0x6a )
                {
                        status = ipoib_mac_from_sst_guid( port_guid,
p_mac_addr );
-                       if( status == IB_SUCCESS )
-                               return IB_SUCCESS;
                }
                else if( p_guid[1] == 0x1a && p_guid[2] == 0x4b )
                {
-                       status = ipoib_mac_from_hp_guid( port_guid,
p_mac_addr );
-                       if( status == IB_SUCCESS )
-                               return IB_SUCCESS;
+                       //HP GUID
+                       status =ipoib_mac_from_general_guid(port_guid,
guid_default_mask, p_mac_addr);
                }
                else if( p_guid[1] == 0x18 && p_guid[2] == 0x8b )
                {
-                       status = ipoib_mac_from_dell_guid( port_guid,
p_mac_addr );
+                       //DELL GUID
+                       status =ipoib_mac_from_general_guid(port_guid,
guid_default_mask, p_mac_addr);
+               }
+               
                        if( status == IB_SUCCESS )
                                return IB_SUCCESS;
-               }
+               ASSERT(status != IB_INVALID_GUID_MASK);
        }
 
        /* Value of zero is reserved. */
_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to