[ofw] [PATCH] remove unused functions

Reuven Amitai reuven at mellanox.co.il
Mon Nov 3 05:36:14 PST 2008


Hi Tzachi,
 
The patch removes the following functions (they are not used anymore):
    ipoib_mac_from_dell_guid(),
    ipoib_sst_guid_from_mac(),
    ipoib_mlx_guid_from_mac()
 
I'm sure that mac_from_dell_guid() can be removed (since we used generic
function instead - mac_from_guid_mask)
I'm not sure if we ever used/will use the latter two functions. Your
comments will be helpful.
 
Thanks, Reuven.
 
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Index: ulp/ipoib/kernel/ipoib_xfr_mgr.h
===================================================================
--- ulp/ipoib/kernel/ipoib_xfr_mgr.h (revision 1722)
+++ ulp/ipoib/kernel/ipoib_xfr_mgr.h (working copy)
@@ -231,49 +231,53 @@
  
  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.
+*
+* IB_INVALID_GUID
+*  The port GUID provided was not a known GUID format.
+*
+*********/
 
-/****f* IPOIB/ipoib_mac_from_dell_guid
+
+/****f* IPOIB/ipoib_mac_from_voltaire_guid
 * NAME
-* ipoib_mac_from_dell_guid
+* ipoib_mac_from_voltaire_guid
 *
 * DESCRIPTION
-* Generates an ethernet MAC address given a DELL port GUID.
+* Generates an ethernet MAC address given a Voltaire port GUID.
 *
 * SYNOPSIS
 */
 static inline ib_api_status_t
-ipoib_mac_from_dell_guid(
+ipoib_mac_from_voltaire_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] == 0x18 && p_guid[2] == 0x8b );
- 
+ ASSERT( p_guid[0] == 0x00 && p_guid[1] == 0x08 && p_guid[2] == 0xf1 );
+
  p_mac_addr->addr[0] = p_guid[0];
  p_mac_addr->addr[1] = p_guid[1];
  p_mac_addr->addr[2] = p_guid[2];
- p_mac_addr->addr[3] = p_guid[5];
- p_mac_addr->addr[4] = p_guid[6];
- p_mac_addr->addr[5] = p_guid[7];
- 
+ p_mac_addr->addr[3] = p_guid[4] ^ p_guid[6];
+ p_mac_addr->addr[4] = p_guid[5] ^ p_guid[7];
+ p_mac_addr->addr[5] = p_guid[5] + p_guid[6] + 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.
-*
-*********/
 
 
 /****f* IPOIB/ipoib_mac_from_guid_mask
@@ -317,7 +321,6 @@
 
  return IB_SUCCESS;
 }
-
 /*
 * PARAMETERS
 * port_guid
@@ -344,36 +347,6 @@
 *********/
 
 
-/****f* IPOIB/ipoib_mac_from_voltaire_guid
-* NAME
-* ipoib_mac_from_voltaire_guid
-*
-* DESCRIPTION
-* Generates an ethernet MAC address given a Voltaire port GUID.
-*
-* SYNOPSIS
-*/
-static inline ib_api_status_t
-ipoib_mac_from_voltaire_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] == 0x08 && p_guid[2] == 0xf1 );
-
- p_mac_addr->addr[0] = p_guid[0];
- p_mac_addr->addr[1] = p_guid[1];
- p_mac_addr->addr[2] = p_guid[2];
- p_mac_addr->addr[3] = p_guid[4] ^ p_guid[6];
- p_mac_addr->addr[4] = p_guid[5] ^ p_guid[7];
- p_mac_addr->addr[5] = p_guid[5] + p_guid[6] + p_guid[7];
-
- return IB_SUCCESS;
-}
-
-
 /****f* IPOIB/ipoib_mac_from_guid
 * NAME
 * ipoib_mac_from_guid
@@ -478,143 +451,6 @@
 *********/
 
 
-/****f* IPOIB/ipoib_sst_guid_from_mac
-* NAME
-* ipoib_sst_guid_from_mac
-*
-* DESCRIPTION
-* Generates a port GUID given an ethernet MAC address.
-*
-* SYNOPSIS
-*/
-static inline ib_api_status_t
-ipoib_sst_guid_from_mac(
- IN  const mac_addr_t     mac,
-  OUT   net64_t* const    p_port_guid )
-{
- uint8_t  *p_guid = (uint8_t*)p_port_guid;
- uint32_t low24;
-
- /* MAC address is in network byte order.  OUI is in lower 3 bytes. */
- if( mac.addr[0] != 0x00 || 
-  mac.addr[1] != 0x06 || 
-  mac.addr[2] != 0x6a )
- {
-  return IB_INVALID_GUID;
- }
-
- low24 = mac.addr[3] << 16 || mac.addr[4] << 8 || mac.addr[5];
-
- low24 = 0x00FFF000 - low24;
- /* Divide by two */
- low24 >>= 1;
- /* Add the serial number base offset. */
- low24 += 0x101;
-
- /* OUI */
- p_guid[0] = mac.addr[0];
- p_guid[1] = mac.addr[1];
- p_guid[2] = mac.addr[2];
- /* Port number */
- p_guid[3] = mac.addr[5] & 0x01;
- /* Type */
- p_guid[4] = 0x98;
- /* Serial Number */
- p_guid[5] = (uint8_t)(low24 >> 16);
- p_guid[6] = (uint8_t)(low24 >> 8);
- p_guid[7] = (uint8_t)low24;
- 
- 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.
-*
-* IB_INVALID_GUID
-*  The port GUID provided was not a known GUID format.
-*
-* NOTES
-* The algorithm to convert portGuid to MAC address is as per DN0074,
and
-* assumes a 2 port HCA.
-*
-* SEE ALSO
-* IPOIB
-*********/
-
-
-/****f* IPOIB/ipoib_mlx_guid_from_mac
-* NAME
-* ipoib_mlx_guid_from_mac
-*
-* DESCRIPTION
-* Generates a port GUID given an ethernet MAC address.
-*
-* SYNOPSIS
-*/
-static inline ib_api_status_t
-ipoib_mlx_guid_from_mac(
- IN  const mac_addr_t     mac,
-  OUT   net64_t* const    p_port_guid )
-{
- uint8_t  *p_guid = (uint8_t*)p_port_guid;
- uint32_t low24;
-
- /* MAC address is in network byte order.  OUI is in lower 3 bytes. */
- if( mac.addr[0] != 0x00 || 
-  mac.addr[1] != 0x02 || 
-  mac.addr[2] != 0xc9 )
- {
-  return IB_INVALID_GUID;
- }
-
- low24 = mac.addr[3] << 16 || mac.addr[4] << 8 || mac.addr[5];
-
- /* OUI */
- p_guid[0] = mac.addr[0];
- p_guid[1] = mac.addr[1];
- p_guid[2] = mac.addr[2];
- p_guid[3] = 0x02;
- p_guid[4] = 0x00;
- /* Serial Number */
- p_guid[5] = (uint8_t)(low24 >> 16);
- p_guid[6] = (uint8_t)(low24 >> 8);
- p_guid[7] = (uint8_t)low24;
- 
- 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.
-*
-* IB_INVALID_GUID
-*  The port GUID provided was not a known GUID format.
-*
-* NOTES
-* The algorithm to convert portGuid to MAC address is as 
-*
-* SEE ALSO
-* IPOIB
-*********/
-
-
 /****f* IPOIB/ipoib_is_voltaire_router_gid
 * NAME
 * ipoib_is_voltaire_router_gid

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20081103/85eb10f8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove_ipoib_functions.patch
Type: application/octet-stream
Size: 6468 bytes
Desc: remove_ipoib_functions.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20081103/85eb10f8/attachment.obj>


More information about the ofw mailing list