NDIS_STATUS\r
ipoib_get_adapter_params(\r
IN NDIS_HANDLE* const wrapper_config_context,\r
- IN OUT ipoib_adapter_t *p_adapter );\r
+ IN OUT ipoib_adapter_t *p_adapter,\r
+ OUT PUCHAR *p_mac,\r
+ OUT UINT *p_len);\r
\r
\r
/* Implementation */\r
ipoib_adapter_t *p_adapter;\r
ib_api_status_t status;\r
cl_status_t cl_status;\r
+ PUCHAR mac;\r
+ UINT len;\r
\r
IPOIB_ENTER( IPOIB_DBG_INIT );\r
\r
return IB_ERROR;\r
}\r
\r
+ /* Read configuration parameters. */\r
+ status = ipoib_get_adapter_params( wrapper_config_context,\r
+ p_adapter , &mac, &len);\r
+ if( status != NDIS_STATUS_SUCCESS )\r
+ {\r
+ cl_obj_destroy( &p_adapter->obj );\r
+ IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+ ("ipoib_get_adapter_params returned 0x%.8x.\n", status) );\r
+ return status;\r
+ }\r
+ \r
status = adapter_init( p_adapter );\r
if( status != IB_SUCCESS )\r
{\r
return status;\r
}\r
\r
- /* Read configuration parameters. */\r
- status = ipoib_get_adapter_params( wrapper_config_context,\r
- p_adapter );\r
- if( status != NDIS_STATUS_SUCCESS )\r
+ ETH_COPY_NETWORK_ADDRESS( p_adapter->params.conf_mac.addr, p_adapter->mac.addr );\r
+ /* If there is a NetworkAddress override in registry, use it */\r
+ if( (status == NDIS_STATUS_SUCCESS) && (len == HW_ADDR_LEN) )\r
{\r
- cl_obj_destroy( &p_adapter->obj );\r
- IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
- ("ipoib_get_adapter_params returned 0x%.8x.\n", status) );\r
- return status;\r
+ if( ETH_IS_MULTICAST(mac) || ETH_IS_BROADCAST(mac) ||\r
+ !ETH_IS_LOCALLY_ADMINISTERED(mac) )\r
+ {\r
+ IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_INIT,\r
+ ("Overriding NetworkAddress is invalid - "\r
+ "%02x-%02x-%02x-%02x-%02x-%02x\n",\r
+ mac[0], mac[1], mac[2],\r
+ mac[3], mac[4], mac[5]) );\r
+ }\r
+ else\r
+ {\r
+ ETH_COPY_NETWORK_ADDRESS( p_adapter->params.conf_mac.addr, mac );\r
+ }\r
}\r
\r
*pp_adapter = p_adapter;\r
/* Validate the port GUID and generate the MAC address. */\r
status =\r
ipoib_mac_from_guid( p_adapter->guids.port_guid.guid, p_adapter->params.guid_mask, &p_adapter->mac);\r
- if( status != IB_SUCCESS )\r
+ if (status == IB_INVALID_GUID_MASK)\r
+ {\r
+ IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_ERROR,\r
+ ("Invalid GUID mask received, rejecting it") );\r
+ ipoib_create_log(p_adapter->h_adapter, GUID_MASK_LOG_INDEX, EVENT_IPOIB_WRONG_PARAMETER_WRN);\r
+ }\r
+ else if( status != IB_SUCCESS )\r
{\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
("ipoib_mac_from_guid returned %s\n", \r
\r
IPOIB_REG_ENTRY HCARegTable[] = {\r
// reg value name If Required Offset in parentr struct Field size Default Min Max\r
+ {NDIS_STRING_CONST("GUIDMask"), 1, IPOIB_OFFSET(guid_mask), IPOIB_SIZE(guid_mask), 0, 0, MAX_GUID_MAX},\r
+ /* GUIDMask should be the first element */\r
{NDIS_STRING_CONST("RqDepth"), 1, IPOIB_OFFSET(rq_depth), IPOIB_SIZE(rq_depth), 512, 128, 1024},\r
{NDIS_STRING_CONST("RqLowWatermark"), 0, IPOIB_OFFSET(rq_low_watermark), IPOIB_SIZE(rq_low_watermark), 4, 2, 8},\r
{NDIS_STRING_CONST("SqDepth"), 1, IPOIB_OFFSET(sq_depth), IPOIB_SIZE(sq_depth), 512, 128, 1024},\r
{NDIS_STRING_CONST("RecvRatio"), 1, IPOIB_OFFSET(recv_pool_ratio), IPOIB_SIZE(recv_pool_ratio), 1, 1, 10},\r
{NDIS_STRING_CONST("PayloadMtu"), 1, IPOIB_OFFSET(payload_mtu), IPOIB_SIZE(payload_mtu), 2044, 60, 4092},\r
{NDIS_STRING_CONST("lso"), 0, IPOIB_OFFSET(lso), IPOIB_SIZE(lso), 0, 0, 1},\r
- {NDIS_STRING_CONST("MCLeaveRescan"), 1, IPOIB_OFFSET(mc_leave_rescan), IPOIB_SIZE(mc_leave_rescan), 260, 1, 3600},\r
- {NDIS_STRING_CONST("GUIDMask"), 1, IPOIB_OFFSET(guid_mask), IPOIB_SIZE(guid_mask), 0, 0, MAX_GUID_MAX}\r
- \r
+ {NDIS_STRING_CONST("MCLeaveRescan"), 1, IPOIB_OFFSET(mc_leave_rescan), IPOIB_SIZE(mc_leave_rescan), 260, 1, 3600}\r
\r
}; \r
\r
#define IPOIB_NUM_REG_PARAMS (sizeof (HCARegTable) / sizeof(IPOIB_REG_ENTRY))\r
\r
\r
-static void\r
+void\r
ipoib_create_log(\r
NDIS_HANDLE h_adapter,\r
UINT ind,\r
NDIS_STATUS\r
ipoib_get_adapter_params(\r
IN NDIS_HANDLE* const wrapper_config_context,\r
- IN OUT ipoib_adapter_t *p_adapter )\r
+ IN OUT ipoib_adapter_t *p_adapter,\r
+ OUT PUCHAR *p_mac,\r
+ OUT UINT *p_len)\r
{\r
NDIS_STATUS status;\r
NDIS_HANDLE h_config;\r
NDIS_CONFIGURATION_PARAMETER *p_param;\r
- PUCHAR mac;\r
- UINT len;\r
UINT value;\r
PIPOIB_REG_ENTRY pRegEntry;\r
UINT i;\r
p_adapter->params.rq_depth / p_adapter->params.rq_low_watermark;\r
\r
p_adapter->params.xfer_block_size = (sizeof(eth_hdr_t) + p_adapter->params.payload_mtu);\r
- NdisReadNetworkAddress( &status, &mac, &len, h_config );\r
+ NdisReadNetworkAddress( &status, p_mac, p_len, h_config );\r
\r
- ETH_COPY_NETWORK_ADDRESS( p_adapter->params.conf_mac.addr, p_adapter->mac.addr );\r
- /* If there is a NetworkAddress override in registry, use it */\r
- if( (status == NDIS_STATUS_SUCCESS) && (len == HW_ADDR_LEN) )\r
- {\r
- if( ETH_IS_MULTICAST(mac) || ETH_IS_BROADCAST(mac) ||\r
- !ETH_IS_LOCALLY_ADMINISTERED(mac) )\r
- {\r
- IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_INIT,\r
- ("Overriding NetworkAddress is invalid - "\r
- "%02x-%02x-%02x-%02x-%02x-%02x\n",\r
- mac[0], mac[1], mac[2],\r
- mac[3], mac[4], mac[5]) );\r
- }\r
- else\r
- {\r
- ETH_COPY_NETWORK_ADDRESS( p_adapter->params.conf_mac.addr, mac );\r
- }\r
- }\r
\r
NdisCloseConfiguration( h_config );\r
\r
* List of adapters in the bundle. The adapter at the head is the\r
* primary adapter of the bundle.\r
*********/\r
+void\r
+ipoib_create_log(\r
+ NDIS_HANDLE h_adapter,\r
+ UINT ind,\r
+ ULONG eventLogMsgId);\r
\r
-\r
+#define GUID_MASK_LOG_INDEX 0\r
\r
void\r
ipoib_resume_oids(\r
#else /* IPOIB_INLINE_RECV */\r
p_desc->p_buf->ib.grh.src_gid.unicast.interface_id, p_port->p_adapter->params.guid_mask, &mac );\r
#endif /* IPOIB_INLINE_RECV */\r
- if( status != IB_SUCCESS )\r
+ if (status == IB_INVALID_GUID_MASK)\r
+ {\r
+ IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_ERROR,\r
+ ("Invalid GUID mask received, rejecting it") );\r
+ ipoib_create_log(p_port->p_adapter->h_adapter, GUID_MASK_LOG_INDEX, EVENT_IPOIB_WRONG_PARAMETER_WRN);\r
+ }\r
+ else if( status != IB_SUCCESS )\r
{\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
("ipoib_mac_from_guid returned %s\n",\r
p_cid[1] = HW_ADDR_LEN +1;// CID length \r
p_cid[2] = DHCP_HW_TYPE_ETH;// CID type \r
status = ipoib_mac_from_guid( gid.unicast.interface_id, p_port->p_adapter->params.guid_mask, (mac_addr_t*)&p_cid[3] );\r
+ if (status == IB_INVALID_GUID_MASK)\r
+ {\r
+ IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_ERROR,\r
+ ("Invalid GUID mask received, rejecting it") );\r
+ ipoib_create_log(p_port->p_adapter->h_adapter, GUID_MASK_LOG_INDEX, EVENT_IPOIB_WRONG_PARAMETER_WRN);\r
+ status = IB_SUCCESS;\r
+ }\r
p_cid[HW_ADDR_LEN + 3] = DHCP_OPT_END; //terminate tag\r
}\r
IPOIB_EXIT( IPOIB_DBG_RECV );\r
/* Copy the src GID to allow aligned access */\r
cl_memcpy( &gid, &p_ib_arp->src_hw.gid, sizeof(ib_gid_t) );\r
status = ipoib_mac_from_guid( gid.unicast.interface_id, p_port->p_adapter->params.guid_mask, &mac );\r
- if( status != IB_SUCCESS )\r
+ if (status == IB_INVALID_GUID_MASK)\r
+ {\r
+ IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_ERROR,\r
+ ("Invalid GUID mask received, rejecting it") );\r
+ ipoib_create_log(p_port->p_adapter->h_adapter, GUID_MASK_LOG_INDEX, EVENT_IPOIB_WRONG_PARAMETER_WRN);\r
+ }\r
+ else if( status != IB_SUCCESS )\r
{\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
("ipoib_mac_from_guid returned %s\n",\r
IN uint32_t guid_mask,\r
OUT mac_addr_t* const p_mac_addr )\r
{\r
-#define MAC_ADDR_SIZE 6\r
+ static const mac_addr_size = HW_ADDR_LEN;\r
uint8_t i;\r
const uint8_t *p_guid = (const uint8_t*)&port_guid;\r
int digit_counter = 0;\r
for (i = 7; guid_mask; guid_mask >>= 1, --i) {\r
if (guid_mask & 1 ) {\r
++digit_counter;\r
- if (digit_counter > MAC_ADDR_SIZE) {\r
+ if (digit_counter > mac_addr_size) {\r
//to avoid negative index\r
return IB_INVALID_GUID_MASK;\r
}\r
- p_mac_addr->addr[MAC_ADDR_SIZE - digit_counter] = p_guid [i];\r
+ p_mac_addr->addr[mac_addr_size - digit_counter] = p_guid [i];\r
}\r
}\r
// check for the mask validity: it should have 6 non-zero bits\r
- if (digit_counter != MAC_ADDR_SIZE) {\r
+ if (digit_counter != mac_addr_size) {\r
return IB_INVALID_GUID_MASK;\r
}\r
\r
return IB_SUCCESS;\r
}\r
\r
-\r
/*\r
* PARAMETERS\r
* port_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
-/****f* IPOIB/ipoib_mac_from_cisco_guid\r
-* NAME\r
-* ipoib_mac_from_cisco_guid\r
-*\r
-* DESCRIPTION\r
-* Generates an ethernet MAC address given a Cisco port GUID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_api_status_t\r
-ipoib_mac_from_cisco_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] == 0x5 && p_guid[2] == 0xad);\r
-\r
- p_mac_addr->addr[0] = 0;\r
- p_mac_addr->addr[1] = 0x5;\r
- p_mac_addr->addr[2] = 0xad; \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
-/****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
-* port_guid\r
-* The port GUID, in network byte order, for which to generate a\r
-* MAC address.\r
-*\r
-* p_mac_addr\r
-* Pointer to a mac address in which to store the results.\r
-*\r
-* RETURN VALUES\r
-* IB_SUCCESS\r
-* The MAC address was successfully converted.\r
-*\r
-* SEE ALSO\r
-* IPOIB\r
-*********/\r
-\r
\r
/****f* IPOIB/ipoib_mac_from_guid\r
* NAME\r
)\r
{\r
static const guid_default_mask = 0xE7; //==0b 11100111\r
- ib_api_status_t status;\r
+ ib_api_status_t status = IB_INVALID_GUID;\r
+ ib_api_status_t mask_status = IB_SUCCESS;\r
const uint8_t *p_guid = (const uint8_t*)&port_guid;\r
uint32_t laa;\r
\r
if ( guid_mask ) \r
{\r
- status = ipoib_mac_from_general_guid(port_guid, guid_mask, p_mac_addr);\r
- if( status == IB_SUCCESS )\r
+ mask_status = ipoib_mac_from_general_guid(port_guid, guid_mask, p_mac_addr);\r
+ if( mask_status == IB_SUCCESS )\r
return IB_SUCCESS;\r
//otherwise, mask was invalid, getting back to standard flow\r
+ /*if (status == IB_INVALID_GUID_MASK)\r
+ {\r
+ IPOIB_PRINT( TRACE_LEVEL_WARNING, IPOIB_DBG_ERROR,\r
+ ("Invalid GUID mask received, rejecting it") );\r
+ }*/\r
}\r
\r
if( p_guid[0] == 0 ) \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
+ //Supermicro GUID\r
+ status =ipoib_mac_from_general_guid(port_guid, guid_default_mask, p_mac_addr);\r
}\r
else if( p_guid[1] == 0x05 && p_guid[2] == 0xad )\r
{\r
- status = ipoib_mac_from_cisco_guid( port_guid, p_mac_addr );\r
- if( status == IB_SUCCESS )\r
- return IB_SUCCESS;\r
+ //Cisco GUID \r
+ status =ipoib_mac_from_general_guid(port_guid, guid_default_mask, p_mac_addr);\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
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
+ //HP GUID\r
+ status =ipoib_mac_from_general_guid(port_guid, guid_default_mask, p_mac_addr);\r
}\r
else if( p_guid[1] == 0x18 && p_guid[2] == 0x8b )\r
{\r
- status = ipoib_mac_from_dell_guid( port_guid, p_mac_addr );\r
- if( status == IB_SUCCESS )\r
- return IB_SUCCESS;\r
+ //DELL GUID\r
+ status =ipoib_mac_from_general_guid(port_guid, guid_default_mask, p_mac_addr);\r
+ }\r
+ \r
+ if (status == IB_SUCCESS )\r
+ {\r
+ ASSERT ( mask_status == IB_SUCCESS || mask_status == IB_INVALID_GUID_MASK );\r
+ return mask_status; \r
}\r
}\r
\r
p_mac_addr->addr[4] = (uint8_t)(laa >> 8);\r
p_mac_addr->addr[5] = (uint8_t)laa;\r
\r
- return IB_SUCCESS;\r
+ return mask_status;\r
}\r
/*\r
* PARAMETERS\r