[Openib-windows] [PATCH] 2c_addresschange

Yossi Leybovich sleybo at mellanox.co.il
Tue May 9 07:57:50 PDT 2006


Fab 
 
There was error in my former patch.
This is the patch with a fix.
I rerun and we still fail 6 cases (was 9)
 
10x
Yossi
 
Index: ip_packet.h
===================================================================
--- ip_packet.h (revision 1322)
+++ ip_packet.h (working copy)
@@ -47,6 +47,9 @@
 #define ETH_PROT_TYPE_ARP CL_HTON16(0x806)
 
 
+#define ETH_IS_LOCALLY_ADMINISTERED(addr) \
+ (BOOLEAN)(((PUCHAR)(addr))[0] & ((UCHAR)0x02))
+
 #include <complib/cl_packon.h>
 /****s* IB Network Drivers/mac_addr_t
 * NAME
Index: kernel/ipoib_adapter.h
===================================================================
--- kernel/ipoib_adapter.h (revision 1322)
+++ kernel/ipoib_adapter.h (working copy)
@@ -71,6 +71,8 @@
  uint32_t sa_retry_cnt;
  uint32_t recv_pool_ratio;
  boolean_t recv_growth;
+ mac_addr_t conf_mac;
+ boolean_t override_mac;
 } ipoib_params_t;
 /*
 * FIELDS
Index: kernel/ipoib_driver.c
===================================================================
--- kernel/ipoib_driver.c (revision 1322)
+++ kernel/ipoib_driver.c (working copy)
@@ -393,13 +393,15 @@
 NDIS_STATUS
 ipoib_get_adapter_params(
  IN    NDIS_HANDLE* const   wrapper_config_context,
-  OUT   ipoib_params_t* const  p_params )
+ OUT   ipoib_params_t* const  p_params )
 {
  NDIS_STATUS      status;
  NDIS_HANDLE      h_config;
  NDIS_CONFIGURATION_PARAMETER *p_param;
  NDIS_STRING      keyword;
-
+ PUCHAR       mac;
+ UINT       len;
+ 
  IPOIB_ENTER( IPOIB_DBG_INIT );
 
  NdisOpenConfiguration( &status, &h_config, wrapper_config_context );
@@ -518,6 +520,31 @@
  else
   p_params->recv_growth = (p_param->ParameterData.IntegerData != 0);
 
+ NdisReadNetworkAddress(
+  &status,
+  &mac,
+  &len,
+  h_config);
+
+ // 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_params->conf_mac.addr, mac);
+   p_params->override_mac = TRUE;
+  }
+ }
+
  NdisCloseConfiguration( h_config );
 
  IPOIB_EXIT( IPOIB_DBG_INIT );
@@ -1148,23 +1175,24 @@
 
  /* Required Ethernet operational characteristics */
  case OID_802_3_PERMANENT_ADDRESS:
- case OID_802_3_CURRENT_ADDRESS:
-#if defined( _DEBUG_ )
-  if( oid == OID_802_3_PERMANENT_ADDRESS )
-  {
-   IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
-    ("Port %d received query for OID_802_3_PERMANENT_ADDRESS\n",
port_num) );
-  }
-  else
-  {
-   IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
-    ("Port %d received query for OID_802_3_CURRENT_ADDRESS\n",
port_num) );
-  }
-#endif /* defined( _DEBUG_ )*/
+  IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
+   ("Port %d received query for OID_802_3_PERMANENT_ADDRESS\n",
port_num) );
   src_buf = &p_adapter->mac;
   buf_len = sizeof(p_adapter->mac);
   break;
 
+ case OID_802_3_CURRENT_ADDRESS:
+  IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
+   ("Port %d received query for OID_802_3_CURRENT_ADDRESS\n", port_num)
);
+  if(p_adapter->params.override_mac == TRUE){
+   src_buf = &p_adapter->params.conf_mac;
+   buf_len = sizeof(p_adapter->params.conf_mac);
+  }else{
+   src_buf = &p_adapter->mac;
+   buf_len = sizeof(p_adapter->mac);
+  }
+  break;
+
  case OID_802_3_MULTICAST_LIST:
   IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
    ("Port %d received query for OID_802_3_MULTICAST_LIST\n", port_num)
);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2c_addresschange2.patch
Type: application/octet-stream
Size: 3647 bytes
Desc: 2c_addresschange2.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20060509/33f8dcc3/attachment.obj>


More information about the ofw mailing list