IB_INVALID_GID,\r
IB_INVALID_LID,\r
IB_INVALID_GUID,\r
+ IB_INVALID_GUID_MASK,\r
IB_INVALID_CA_HANDLE,\r
IB_INVALID_AV_HANDLE,\r
IB_INVALID_CQ_HANDLE,\r
\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->mac );\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
{\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
uint32_t xfer_block_size;\r
mac_addr_t conf_mac;\r
uint32_t mc_leave_rescan;\r
+ uint32_t guid_mask;\r
} ipoib_params_t;\r
/*\r
* FIELDS\r
\r
#define IB_INFINITE_SERVICE_LEASE 0xFFFFFFFF\r
\r
+//The mask is 8 bit and can't contain more than 6 non-zero bits\r
+#define MAX_GUID_MAX 0xFC\r
+\r
\r
/* Global driver debug level */\r
uint32_t g_ipoib_dbg_level = TRACE_LEVEL_ERROR;\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("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
+ \r
}; \r
\r
#define IPOIB_NUM_REG_PARAMS (sizeof (HCARegTable) / sizeof(IPOIB_REG_ENTRY))\r
{\r
status = ipoib_mac_from_guid(\r
#if IPOIB_INLINE_RECV\r
- p_desc->buf.ib.grh.src_gid.unicast.interface_id, &mac );\r
+ p_desc->buf.ib.grh.src_gid.unicast.interface_id, p_port->p_adapter->params.guid_mask, &mac );\r
#else /* IPOIB_INLINE_RECV */\r
- p_desc->p_buf->ib.grh.src_gid.unicast.interface_id, &mac );\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
{\r
cl_memcpy( &gid, &p_cid[7], sizeof(ib_gid_t) );\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, (mac_addr_t*)&p_cid[3] );\r
+ status = ipoib_mac_from_guid( gid.unicast.interface_id, p_port->p_adapter->params.guid_mask, (mac_addr_t*)&p_cid[3] );\r
p_cid[HW_ADDR_LEN + 3] = DHCP_OPT_END; //terminate tag\r
}\r
IPOIB_EXIT( IPOIB_DBG_RECV );\r
{\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, &mac );\r
+ status = ipoib_mac_from_guid( gid.unicast.interface_id, p_port->p_adapter->params.guid_mask, &mac );\r
if( status != IB_SUCCESS )\r
{\r
IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
* The MAC address was successfully converted.\r
*\r
*********/\r
+\r
+\r
+/****f* IPOIB/ipoib_mac_from_general_guid\r
+* NAME\r
+* ipoib_mac_from_dell_guid\r
+*\r
+* DESCRIPTION\r
+* Generates an ethernet MAC address given general port GUID and a bitwise mask\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline ib_api_status_t\r
+ipoib_mac_from_general_guid(\r
+ IN const net64_t port_guid,\r
+ IN uint32_t guid_mask,\r
+ OUT mac_addr_t* const p_mac_addr )\r
+{\r
+#define MAC_ADDR_SIZE 6\r
+ uint8_t i;\r
+ const uint8_t *p_guid = (const uint8_t*)&port_guid;\r
+ int digit_counter = 0;\r
+\r
+ //All non-zero bits of guid_mask indicates the number of an appropriate byte in\r
+ // port_guid, that will be used in MAC address construction\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
+ //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
+ }\r
+ }\r
+ // check for the mask validity: it should have 6 non-zero bits\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
* The port GUID, in network byte order, for which to generate a\r
* MAC address.\r
*\r
+* guid_mask\r
+* Each BIT in the mask indicates whether to include the appropriate BYTE\r
+* to the MAC address. Bit 0 corresponds to the less significant BYTE , i.e.\r
+* highest index in the MAC array\r
+*\r
* p_mac_addr\r
* Pointer to a mac address in which to store the results.\r
*\r
static inline ib_api_status_t\r
ipoib_mac_from_guid(\r
IN const net64_t port_guid,\r
- OUT mac_addr_t* const p_mac_addr )\r
+ IN uint32_t guid_mask,\r
+ OUT mac_addr_t* const p_mac_addr\r
+ )\r
{\r
+ static const guid_default_mask = 0xE7; //==0b 11100111\r
ib_api_status_t status;\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
+ return IB_SUCCESS;\r
+ //otherwise, mask was invalid, getting back to standard flow\r
+ }\r
+ \r
if( p_guid[0] == 0 ) \r
{\r
if( p_guid[1] == 0x02 && p_guid[2] == 0xc9 )\r
HKR, Ndi\Params\MCLeaveRescan, Min, 0, "1"\r
HKR, Ndi\Params\MCLeaveRescan, Max, 0, "3600"\r
\r
+HKR, Ndi\Params\guid_mask, ParamDesc, 0, "GUID bitwise mask"\r
+HKR, Ndi\Params\guid_mask, Type, 0, "dword"\r
+HKR, Ndi\Params\guid_mask, Default, 0, "0"\r
+HKR, Ndi\Params\guid_mask, Optional, 0, "0"\r
+HKR, Ndi\Params\guid_mask, Min, 0, "0"\r
+HKR, Ndi\Params\guid_mask, Max, 0, "252"\r
+\r
[IpoibService]\r
DisplayName = %IpoibServiceDispName%\r
ServiceType = 1 ;%SERVICE_KERNEL_DRIVER%\r
IB_INVALID_GID,\r
IB_INVALID_LID,\r
IB_INVALID_GUID,\r
+ IB_INVALID_GUID_MASK,\r
IB_INVALID_CA_HANDLE,\r
IB_INVALID_AV_HANDLE,\r
IB_INVALID_CQ_HANDLE,\r
IB_INVALID_GID,\r
IB_INVALID_LID,\r
IB_INVALID_GUID,\r
+ IB_INVALID_GUID_MASK,\r
IB_INVALID_CA_HANDLE,\r
IB_INVALID_AV_HANDLE,\r
IB_INVALID_CQ_HANDLE,\r