\r
#define ETH_PROT_TYPE_IP CL_HTON16(0x800)\r
#define ETH_PROT_TYPE_ARP CL_HTON16(0x806)\r
+#define ETH_PROT_VLAN_TAG CL_HTON16(0x8100)\r
\r
\r
#define ETH_IS_LOCALLY_ADMINISTERED(addr) \\r
\r
# The TARGETNAME. This is name of the item being built (without the\r
# extension. \r
-TARGETNAME=vnic\r
+TARGETNAME=qlc_vnic\r
\r
########################################################################\r
# The path where all binaries are built. \r
INCLUDES=..;..\..\..\inc;..\..\..\inc\kernel;\r
\r
C_DEFINES=$(C_DEFINES) -DNDIS_MINIPORT_DRIVER -DNDIS_WDM=1 \\r
- -DDEPRECATE_DDK_FUNCTIONS -DNDIS51_MINIPORT -DNEED_CL_OBJ -DBINARY_COMPATIBLE=0\r
+ -DDEPRECATE_DDK_FUNCTIONS -DNDIS51_MINIPORT -DBINARY_COMPATIBLE=0 -DLBFO_ENABLED\r
\r
TARGETLIBS= \\r
$(DDK_LIB_PATH)\ntoskrnl.lib \\r
$(DDK_LIB_PATH)\hal.lib \\r
$(DDK_LIB_PATH)\ndis.lib \\r
- $(TARGETPATH)\*\complib.lib \r
+ $(TARGETPATH)\*\complib.lib \\r
+ $(TARGETPATH)\*\ibal.lib\r
\r
#!if !defined(DDK_TARGET_OS) || "$(DDK_TARGET_OS)"=="Win2K"\r
#\r
#define VER_FILEDESCRIPTION_STR "Virtual Nic NDIS Miniport"\r
#endif\r
\r
-#define VER_INTERNALNAME_STR "vnic.sys"\r
-#define VER_ORIGINALFILENAME_STR "vnic.sys"\r
+#define VER_INTERNALNAME_STR "qlc_vnic.sys"\r
+#define VER_ORIGINALFILENAME_STR "qlc_vnic.sys"\r
\r
#include <common.ver>\r
-; SilverStorm Technologies Ethernet over Infiniband NIC.\r
-; Copyright 2006 SilverStorm Technologies all Rights Reserved.\r
+; QLogic Corporation Ethernet over Infiniband NIC.\r
+; Copyright (c) QLogic Corporation all Rights Reserved.\r
\r
[Version]\r
Signature="$Windows NT$"\r
Class=Net\r
ClassGUID={4d36e972-e325-11ce-bfc1-08002be10318}\r
Provider=%Inf_Provider%\r
-DriverVer=03/08/2006,1.0.0000.614\r
+DriverVer=01/21/2008,1.0.0000.927\r
\r
[ControlFlags]\r
ExcludeFromSelect = IBA\V00066aP00000030\r
DefaultDestDir=12\r
\r
[SourceDisksNames.x86]\r
-1=%DiskId%,,,\x86\r
+1=%DiskId%,,,""\r
\r
[SourceDisksNames.amd64]\r
-1=%DiskId%,,,\amd64\r
+1=%DiskId%,,,""\r
\r
[SourceDisksNames.ia64]\r
-1=%DiskId%,,,\ia64\r
+1=%DiskId%,,,""\r
\r
[SourceDisksFiles]\r
-vnic.sys=1\r
+qlc_vnic.sys=1\r
\r
[Manufacturer]\r
-%Inf_Provider% = VNIC.DeviceSection,ntx86,ntamd64,ntia64\r
+%Inf_Provider% = vnic.DeviceSection,ntx86,ntamd64,ntia64\r
\r
-[VNIC.DeviceSection]\r
+[vnic.DeviceSection]\r
; empty since we don't support W9x/Me\r
\r
-[VNIC.DeviceSection.ntx86]\r
-%VNIC.DeviceDesc% = VNIC.DDInstall,IBA\V00066aP00000030S00066as00000030v0001, \\r
+[vnic.DeviceSection.ntx86]\r
+%vnic.DeviceDesc% = VNIC.DDInstall,IBA\V00066aP00000030S00066as00000030v0001, \\r
IBA\V00066aP00000030S00066as00000030, \\r
IBA\V00066aP00000030v0001, \\r
IBA\V00066aP00000030\r
\r
-[VNIC.DeviceSection.ntamd64]\r
-%VNIC.DeviceDesc% = VNIC.DDInstall,IBA\V00066aP00000030S00066as00000030v0001, \\r
+[vnic.DeviceSection.ntamd64]\r
+%vnic.DeviceDesc% = vnic.DDInstall,IBA\V00066aP00000030S00066as00000030v0001, \\r
IBA\V00066aP00000030S00066as00000030, \\r
IBA\V00066aP00000030v0001, \\r
IBA\V00066aP00000030\r
\r
-[VNIC.DeviceSection.ntia64]\r
-%VNIC.DeviceDesc% = VNIC.DDInstall,IBA\V00066aP00000030S00066as00000030v0001, \\r
+[vnic.DeviceSection.ntia64]\r
+%vnic.DeviceDesc% = vnic.DDInstall,IBA\V00066aP00000030S00066as00000030v0001, \\r
IBA\V00066aP00000030S00066as00000030, \\r
IBA\V00066aP00000030v0001, \\r
IBA\V00066aP00000030\r
\r
-[VNIC.DDInstall.ntx86]\r
+[vnic.DDInstall.ntx86]\r
Characteristics = %CHARACTERISTICS%\r
-AddReg = VNIC.AddReg\r
-CopyFiles = VNIC.CopyFiles\r
+AddReg = vnic.AddReg\r
+CopyFiles = vnic.CopyFiles\r
\r
-[VNIC.DDInstall.ntamd64]\r
+[vnic.DDInstall.ntamd64]\r
Characteristics = %CHARACTERISTICS%\r
-AddReg = VNIC.AddReg\r
-CopyFiles = VNIC.CopyFiles\r
+AddReg = vnic.AddReg\r
+CopyFiles = vnic.CopyFiles\r
\r
-[VNIC.DDInstall.ntia64]\r
+[vnic.DDInstall.ntia64]\r
Characteristics = %CHARACTERISTICS%\r
-AddReg = VNIC.AddReg\r
-CopyFiles = VNIC.CopyFiles\r
+AddReg = vnic.AddReg\r
+CopyFiles = vnic.CopyFiles\r
\r
-[VNIC.DDInstall.ntx86.Services]\r
-AddService = vnic,%SPSVCINST_ASSOCSERVICE%,VNIC.ServiceInstall,VNIC.EventLogInstall\r
+[vnic.DDInstall.ntx86.Services]\r
+AddService = vnic,%SPSVCINST_ASSOCSERVICE%,vnic.ServiceInstall,vnic.EventLogInstall\r
\r
-[VNIC.DDInstall.ntamd64.Services]\r
-AddService = vnic,%SPSVCINST_ASSOCSERVICE%,VNIC.ServiceInstall,VNIC.EventLogInstall\r
+[vnic.DDInstall.ntamd64.Services]\r
+AddService = vnic,%SPSVCINST_ASSOCSERVICE%,vnic.ServiceInstall,vnic.EventLogInstall\r
\r
-[VNIC.DDInstall.ntia64.Services]\r
-AddService = vnic,%SPSVCINST_ASSOCSERVICE%,VNIC.ServiceInstall,VNIC.EventLogInstall\r
+[vnic.DDInstall.ntia64.Services]\r
+AddService = vnic,%SPSVCINST_ASSOCSERVICE%,vnic.ServiceInstall,vnic.EventLogInstall\r
\r
-[VNIC.CopyFiles]\r
-vnic.sys\r
+[vnic.CopyFiles]\r
+qlc_vnic.sys,,,2\r
\r
-[VNIC.AddReg]\r
-HKR, Ndi, Service, 0, "vnic"\r
+[vnic.AddReg]\r
+HKR, Ndi, Service, 0, "qlc_vnic"\r
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"\r
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"\r
\r
-\r
+HKR, Ndi\params\VlanId, ParamDesc, 0, "802.1q VlanId"\r
+HKR, Ndi\params\VlanId, Type, 0, "dword"\r
+HKR, Ndi\params\VlanId, Optional, 0, "1"\r
+HKR, Ndi\params\VlanId, Default, 0, "1"\r
+HKR, Ndi\params\VlanId, Min, 0, "1"\r
+HKR, Ndi\params\VlanId, Max, 0, "4094"\r
+HKR, Ndi\params\VlanId, Step, 0, "1"\r
+HKR, Ndi\params\VlanId, Base, 0, "10"\r
+\r
+HKR, Ndi\params\UserPriority, ParamDesc, 0, "802.1p Priority"\r
+HKR, Ndi\params\UserPriority, Type, 0, "dword"\r
+HKR, Ndi\Params\UserPriority, Optional, 0, "1"\r
+HKR, Ndi\params\UserPriority, Default, 0, "0"\r
+HKR, Ndi\params\UserPriority, Min, 0, "0"\r
+HKR, Ndi\params\UserPriority, Max, 0, "7"\r
+HKR, Ndi\params\UserPriority, Step, 0, "1"\r
+\r
+HKR, Ndi\Params\PayloadMtu, ParamDesc, 0, "Payload Mtu size"\r
+HKR, Ndi\Params\PayloadMtu, Type, 0, "dword"\r
+HKR, Ndi\Params\PayloadMtu, Default, 0, "1500"\r
+HKR, Ndi\Params\PayloadMtu, Min, 0, "1500"\r
+HKR, Ndi\Params\PayloadMtu, Max, 0, "9500"\r
+HKR, Ndi\Params\PayloadMtu, Step, 0, "500"\r
+HKR, Ndi\Params\PayloadMtu, Base, 0, "10"\r
+\r
+HKR, Ndi\Params\UseTxCsum, ParamDesc, 0, "Send Chksum Offload"\r
+HKR, Ndi\Params\UseTxCsum, Type, 0, "enum"\r
+HKR, Ndi\Params\UseTxCsum, Default, 0, "1"\r
+HKR, Ndi\Params\UseTxCsum, Optional, 0, "0"\r
+HKR, Ndi\Params\UseTxCsum\enum, "0", 0, "Disabled"\r
+HKR, Ndi\Params\UseTxCsum\enum, "1", 0, "Enabled"\r
+\r
+HKR, Ndi\Params\UseRxCsum,ParamDesc, 0, "Recv Chksum Offload"\r
+HKR, Ndi\Params\UseRxCsum,Type, 0, "enum"\r
+HKR, Ndi\Params\UseRxCsum,Default, 0, "1"\r
+HKR, Ndi\Params\UseRxCsum,Optional, 0, "0"\r
+HKR, Ndi\Params\UseRxCsum\enum, "0", 0, "Disabled"\r
+HKR, Ndi\Params\UseRxCsum\enum, "1", 0, "Enabled"\r
+\r
+HKR, Ndi\Params\SecondaryPath, ParamDesc, 0, "Secondary path"\r
+HKR, Ndi\Params\SecondaryPath, Type, 0, "enum"\r
+HKR, Ndi\Params\SecondaryPath, Default, 0, "0"\r
+HKR, Ndi\Params\SecondaryPath, Optional, 0, "0"\r
+HKR, Ndi\Params\SecondaryPath\enum, "0", 0, "Disabled"\r
+HKR, Ndi\Params\SecondaryPath\enum, "1", 0, "Enabled"\r
+\r
+HKR, Ndi\Params\Heartbeat, ParamDesc, 0, "Heartbeat interval (ms)"\r
+HKR, Ndi\Params\Heartbeat, Type, 0, "dword"\r
+HKR, Ndi\Params\Heartbeat, Default, 0, "2000"\r
+HKR, Ndi\Params\Heartbeat, Min, 0, "0"\r
+HKR, Ndi\Params\Heartbeat, Max, 0, "10000"\r
+HKR, Ndi\Params\Heartbeat, Step, 0, "1000"\r
+HKR, Ndi\Params\Heartbeat, Base, 0, "10"\r
+\r
+HKR, Ndi\Params\BundleId, ParamDesc, 0, "LBFO Bundle Id"\r
+HKR, Ndi\Params\BundleId, Type, 0, "enum"\r
+HKR, Ndi\Params\BundleId, Default, 0, "1"\r
+HKR, Ndi\Params\BundleId, Optional, 0, "1"\r
+HKR, Ndi\Params\BundleId\enum, "1", 0, "Bundle 1"\r
+HKR, Ndi\Params\BundleId\enum, "2", 0, "Bundle 2"\r
+HKR, Ndi\Params\BundleId\enum, "3", 0, "Bundle 3"\r
+HKR, Ndi\Params\BundleId\enum, "4", 0, "Bundle 4"\r
+;\r
+;\r
; ============= Service Install section ==============\r
+;\r
\r
-[VNIC.ServiceInstall]\r
-DisplayName = %VNIC.ServiceDesc%\r
+[vnic.ServiceInstall]\r
+DisplayName = %vnic.ServiceDesc%\r
ServiceType = %SERVICE_KERNEL_DRIVER%\r
StartType = %SERVICE_DEMAND_START%\r
ErrorControl = %SERVICE_ERROR_NORMAL%\r
-ServiceBinary = %12%\vnic.sys\r
+ServiceBinary = %12%\qlc_vnic.sys\r
LoadOrderGroup = NDIS\r
-AddReg = VNIC.ParamsReg\r
-\r
-[VNIC.ParamsReg]\r
-HKR,"Params\PnpInterface",%InternalBus%,%REG_DWORD%,1\r
-HKR,"Params\PnpInterface",%PNPBus%,%REG_DWORD%,1\r
-\r
-HKR, Params, MinMtu,, "1500"\r
-HKR, Params, MaxMtu,, "9500"\r
-HKR, Params, MinHostPoolSz,, "256"\r
-HKR, Params, HostRecvPoolEntries,, "512"\r
-HKR, Params, MinEiocPoolSz,, "256"\r
-HKR, Params, MaxEiocPoolSz,, "512"\r
-HKR, Params, MinHostKickTimeout,, "50"\r
-HKR, Params, MaxHostKickTimeout,, "100"\r
-HKR, Params, MinHostKickEntries,, "1"\r
-HKR, Params, MaxHostKickEntries,, "64"\r
-HKR, Params, MinHostKickBytes,, "0"\r
-HKR, Params, MaxHostKickBytes,, "5000"\r
-HKR, Params, MinHostUpdateSz,, "8"\r
-HKR, Params, MaxHostUpdateSz,, "32"\r
-HKR, Params, MinEiocUpdateSz,, "8"\r
-HKR, Params, MaxEiocUpdateSz,, "32"\r
-HKR, Params, UseRxCsum, %REG_DWORD%,1\r
-HKR, Params, UseTxCsum, %REG_DWORD%,1\r
-\r
-[VNIC.EventLogInstall]\r
-AddReg = VNIC.EventLogAddReg\r
-\r
-[VNIC.EventLogAddReg]\r
+AddReg = vnic.ParamsReg\r
+\r
+[vnic.ParamsReg]\r
+\r
+HKR,"Parameters","DebugFlags",%REG_DWORD%,0x00000003\r
+\r
+HKR,"Parameters","MinHostPoolSz",%REG_DWORD%,256\r
+HKR, "Parameters","HostRecvPoolEntries",%REG_DWORD%,512\r
+HKR, "Parameters","MinEiocPoolSz",%REG_DWORD%,256\r
+HKR, "Parameters","MaxEiocPoolSz",%REG_DWORD%,512\r
+HKR, "Parameters","MinHostKickTimeout",%REG_DWORD%,50\r
+HKR, "Parameters","MaxHostKickTimeout",%REG_DWORD%,100\r
+HKR, "Parameters","MinHostKickEntries",%REG_DWORD%,1\r
+HKR, "Parameters","MaxHostKickEntries",%REG_DWORD%,64\r
+HKR, "Parameters","MinHostKickBytes",%REG_DWORD%,0\r
+HKR, "Parameters","MaxHostKickBytes",%REG_DWORD%,5000\r
+HKR, "Parameters","MinHostUpdateSz",%REG_DWORD%,8\r
+HKR, "Parameters","MaxHostUpdateSz",%REG_DWORD%,32\r
+HKR, "Parameters","MinEiocUpdateSz",%REG_DWORD%,8\r
+HKR, "Parameters","MaxEiocUpdateSz",%REG_DWORD%,32\r
+HKR, "Parameters","HeartbeatTimeout",%REG_DWORD%,40000\r
+\r
+[vnic.EventLogInstall]\r
+AddReg = vnic.EventLogAddReg\r
+\r
+[vnic.EventLogAddReg]\r
HKR,,EventMessageFile,%REG_EXPAND_SZ%,"%%SystemRoot%%\System32\netevent.dll"\r
HKR,,TypesSupported,%REG_DWORD%,7\r
\r
[Strings]\r
-NetClassGuid = "{4d36e972-e325-11ce-bfc1-08002be10318}"\r
-Inf_Provider = "SilverStorm Technologies"\r
-VNIC.DeviceDesc = "Ethernet over InfiniBand Virtual NIC"\r
-VNIC.ServiceDesc = "Virtual NIC"\r
-DiskId = "SilverStorm Ethernet over InfiniBand Virtual NIC installation disk"\r
-InternalBus = 0\r
-PNPBus = 15\r
-SPSVCINST_NULL = 0x0\r
-SPSVCINST_ASSOCSERVICE = 0x00000002\r
-SERVICE_KERNEL_DRIVER = 1\r
-SERVICE_DEMAND_START = 3\r
-SERVICE_ERROR_NORMAL = 1\r
-REG_DWORD = 0x00010001\r
-REG_DWORD_NO_CLOBBER = 0x00010003\r
-REG_EXPAND_SZ = 0x00020000\r
-CHARACTERISTICS = 0x81 ; NCF_VIRTUAL | NCF_HAS_UI\r
-\r
+NetClassGuid="{4d36e972-e325-11ce-bfc1-08002be10318}"\r
+Inf_Provider="QLogic Corporation"\r
+vnic.DeviceDesc="Ethernet over InfiniBand Virtual NIC"\r
+vnic.ServiceDesc="Virtual NIC"\r
+DiskId="QLogic Ethernet over InfiniBand Disk"\r
+InternalBus=0\r
+PNPBus=15\r
+SPSVCINST_NULL=0x0\r
+SPSVCINST_ASSOCSERVICE=0x00000002\r
+SERVICE_KERNEL_DRIVER=1\r
+SERVICE_DEMAND_START=3\r
+SERVICE_ERROR_NORMAL=1\r
+REG_DWORD=0x00010001\r
+REG_DWORD_NO_CLOBBER=0x00010003\r
+REG_EXPAND_SZ=0x00020000\r
+CHARACTERISTICS=0x81; NCF_VIRTUAL | NCF_HAS_UI\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
\r
NDIS_STATUS\r
vnic_get_adapter_params(\r
- IN NDIS_HANDLE h_handle,\r
- OUT vnic_params_t* const p_params );\r
+ IN NDIS_HANDLE h_handle,\r
+ OUT vnic_params_t* const p_params );\r
+\r
+static\r
+NDIS_STATUS\r
+_adapter_set_sg_size(\r
+ IN NDIS_HANDLE h_handle,\r
+ IN ULONG mtu_size );\r
\r
NDIS_STATUS\r
vnic_get_adapter_interface(\r
- IN NDIS_HANDLE h_handle,\r
- IN vnic_adapter_t *p_adapter);\r
+ IN NDIS_HANDLE h_handle,\r
+ IN vnic_adapter_t *p_adapter);\r
\r
-static ib_api_status_t\r
+static\r
+vnic_path_record_t*\r
__path_record_add(\r
- IN vnic_adapter_t *p_adapter,\r
- IN ib_path_rec_t *p_path_rec );\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN ib_path_rec_t* const p_path_rec );\r
\r
-static ib_api_status_t\r
+static \r
+vnic_path_record_t*\r
__path_record_remove(\r
- IN vnic_adapter_t *p_adapter,\r
- IN ib_path_rec_t *p_path_rec );\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN ib_path_rec_t* const p_path_rec );\r
\r
static BOOLEAN\r
__path_records_match(\r
- IN ib_path_rec_t *p_path1,\r
- IN ib_path_rec_t *p_path2 );\r
+ IN ib_path_rec_t* const p_path1,\r
+ IN ib_path_rec_t* const p_path2 );\r
+\r
+static\r
+vnic_path_record_t *\r
+__path_record_find( \r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN ib_path_rec_t* const p_path_rec );\r
+\r
+static\r
+vnic_path_record_t*\r
+__path_record_get(\r
+ IN vnic_adapter_t* const p_adapter );\r
\r
static void\r
__path_records_cleanup(\r
- IN vnic_adapter_t *p_adapter );\r
+ IN vnic_adapter_t *p_adapter );\r
+\r
+static ib_api_status_t\r
+_adapter_open_ca(\r
+ IN vnic_adapter_t* const p_adapter );\r
+\r
\r
static ib_api_status_t\r
-_vnic_get_ca_info(\r
- IN vnic_adapter_t *p_adapter );\r
+_adapter_close_ca(\r
+ IN vnic_adapter_t* const p_adapter );\r
+\r
+static \r
+ib_api_status_t\r
+_adapter_netpath_update(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN viport_t* const p_viport,\r
+ IN vnic_path_record_t* p_path );\r
+\r
+static\r
+ib_api_status_t\r
+adapter_netpath_update_and_connect(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN vnic_path_record_t *p_path );\r
\r
static inline uint8_t\r
_get_ioc_num_from_iocguid(\r
- IN ib_net64_t *p_iocguid );\r
+ IN ib_net64_t *p_iocguid );\r
\r
static BOOLEAN\r
__sid_valid(\r
- IN vnic_adapter_t *p_adapter,\r
- IN ib_net64_t sid );\r
+ IN vnic_adapter_t *p_adapter,\r
+ IN ib_net64_t sid );\r
+\r
+static void\r
+__adapter_cleanup(\r
+ IN vnic_adapter_t *p_adapter );\r
+\r
+#if defined( LBFO_ENABLED )\r
+\r
+static NDIS_STATUS\r
+__adapter_set_failover_primary(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN BOOLEAN promote_secondary );\r
+\r
+static NDIS_STATUS\r
+__adapter_set_failover_secondary(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN NDIS_HANDLE primary_handle );\r
\r
static void\r
-_vnic_viport_free(\r
- IN vnic_adapter_t* const p_adapter );\r
+__adapter_add_to_failover_list(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN lbfo_state_t failover_state );\r
+static void\r
+__adapter_remove_from_failover_list(\r
+ IN vnic_adapter_t* const p_adapter );\r
+\r
+static\r
+vnic_adapter_t*\r
+__adapter_find_on_failover_list(\r
+ IN int list_flag,\r
+ IN uint32_t bundle_id );\r
+\r
+#endif // LBFO_ENABLED\r
\r
ib_api_status_t\r
vnic_create_adapter(\r
NDIS_STATUS status;\r
ib_api_status_t ib_status;\r
vnic_adapter_t *p_adapter;\r
- KIRQL irql;\r
\r
VNIC_ENTER( VNIC_DBG_ADAPTER );\r
\r
NdisZeroMemory( p_adapter, sizeof(vnic_adapter_t) );\r
\r
NdisAllocateSpinLock( &p_adapter->lock );\r
+ NdisAllocateSpinLock( &p_adapter->path_records_lock );\r
+ NdisAllocateSpinLock( &p_adapter->pending_list_lock );\r
+ NdisAllocateSpinLock( &p_adapter->cancel_list_lock );\r
+ \r
+ InitializeListHead( &p_adapter->send_pending_list );\r
+ InitializeListHead( &p_adapter->cancel_send_list );\r
\r
- status = vnic_get_adapter_params( wrapper_config_context, &p_adapter->params );\r
+ cl_qlist_init( &p_adapter->path_records_list );\r
+\r
+ status = \r
+ vnic_get_adapter_params( wrapper_config_context, &p_adapter->params );\r
\r
if ( status != NDIS_STATUS_SUCCESS )\r
{\r
if ( ib_status != IB_SUCCESS )\r
{\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("ib_open_al returned %s\n", p_adapter->ifc.get_err_str( ib_status )) );\r
+ ("ib_open_al returned %s\n", \r
+ p_adapter->ifc.get_err_str( ib_status )) );\r
NdisFreeMemory( p_adapter, sizeof(vnic_adapter_t), 0 );\r
return ib_status;\r
}\r
\r
- /* ca is opened here */\r
- ib_status = _vnic_get_ca_info( p_adapter );\r
- if( ib_status != IB_SUCCESS )\r
- {\r
- VNIC_TRACE ( VNIC_DBG_ERROR,\r
- ("_get_ca_info return status %s\n", p_adapter->ifc.get_err_str( ib_status )) );\r
- NdisFreeMemory( p_adapter, sizeof(vnic_adapter_t), 0 );\r
- return ib_status;\r
- }\r
+ /* we will use these indexes later as an viport instance ID for connect request\r
+ * since target requires unique instance per connection per IOC.\r
+ */\r
+ p_adapter->primaryPath.instance = NETPATH_PRIMARY;\r
+ p_adapter->secondaryPath.instance = NETPATH_SECONDARY;\r
+ \r
+ /* set adapter level params here */\r
+ p_adapter->vlan_info = p_adapter->params.VlanInfo;\r
\r
- KeAcquireSpinLock( &g_vnic.lock, &irql );\r
- InsertTailList( &g_vnic.adapter_list, &p_adapter->list_entry );\r
- InterlockedIncrement( &g_vnic.adapters );\r
- KeReleaseSpinLock( &g_vnic.lock, irql );\r
+#if defined (LBFO_ENABLED)\r
+\r
+ p_adapter->failover.bundle_id = p_adapter->params.bundle_id;\r
+ p_adapter->failover.fo_state = _ADAPTER_NOT_BUNDLED;\r
+\r
+#endif\r
\r
p_adapter->h_handle = h_handle;\r
*pp_adapter = p_adapter;\r
IN vnic_adapter_t *p_adapter)\r
{\r
ib_api_status_t ib_status = IB_SUCCESS;\r
- KIRQL irql;\r
+ ib_pnp_handle_t h_pnp;\r
+ ib_al_handle_t h_al;\r
\r
VNIC_ENTER( VNIC_DBG_ADAPTER );\r
\r
ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL );\r
\r
- KeAcquireSpinLock( &g_vnic.lock, &irql );\r
- RemoveEntryList( &p_adapter->list_entry );\r
- InterlockedDecrement( &g_vnic.adapters );\r
- KeReleaseSpinLock( &g_vnic.lock, irql );\r
-\r
- if( p_adapter->h_pnp )\r
+ if( ( h_pnp = InterlockedExchangePointer( (void *)&p_adapter->h_pnp, NULL ) ) != NULL )\r
{\r
ib_status =\r
- p_adapter->ifc.dereg_pnp( p_adapter->h_pnp, ib_sync_destroy );\r
+ p_adapter->ifc.dereg_pnp( h_pnp, NULL );\r
}\r
\r
- vnic_viport_cleanup( p_adapter );\r
+ /* should not receive new path notifications anymore, safe to cleanup */\r
\r
- if ( p_adapter->ca.region.h_mr )\r
+ if( InterlockedCompareExchange( (volatile LONG *)&p_adapter->state,\r
+ INIC_DEREGISTERING, INIC_REGISTERED ) == INIC_REGISTERED )\r
{\r
- ib_status = p_adapter->ifc.dereg_mr(p_adapter->ca.region.h_mr );\r
- ASSERT( ib_status == IB_SUCCESS );\r
+ __adapter_cleanup( p_adapter );\r
}\r
\r
- if( p_adapter->ca.hPd )\r
- {\r
- ib_status = p_adapter->ifc.dealloc_pd( p_adapter->ca.hPd, NULL );\r
- ASSERT( ib_status == IB_SUCCESS );\r
- }\r
+ _adapter_close_ca( p_adapter );\r
\r
- if ( p_adapter->h_ca )\r
- {\r
- ib_status = p_adapter->ifc.close_ca( p_adapter->h_ca, NULL );\r
- ASSERT( ib_status == IB_SUCCESS );\r
- }\r
+#if defined( LBFO_ENABLED )\r
+\r
+ __adapter_remove_from_failover_list( p_adapter );\r
\r
- if ( p_adapter->h_al )\r
+#endif\r
+\r
+ InterlockedExchange( (volatile LONG *)&p_adapter->state, INIC_UNINITIALIZED );\r
+ if( ( h_al = InterlockedExchangePointer( (void *)&p_adapter->h_al, NULL ) ) != NULL )\r
{\r
- ib_status = p_adapter->ifc.close_al( p_adapter->h_al );\r
+ ib_status = p_adapter->ifc.close_al( h_al );\r
ASSERT( ib_status == IB_SUCCESS );\r
}\r
\r
- if ( p_adapter->p_svc_entries )\r
- cl_free ( p_adapter->p_svc_entries );\r
-\r
NdisFreeSpinLock( &p_adapter->lock );\r
+ NdisFreeSpinLock( &p_adapter->path_records_lock );\r
NdisFreeMemory( p_adapter, sizeof(vnic_adapter_t), 0 );\r
+ p_adapter = NULL;\r
\r
VNIC_EXIT( VNIC_DBG_ADAPTER );\r
}\r
\r
-\r
static ib_api_status_t\r
-_vnic_get_ca_info(\r
- IN vnic_adapter_t *p_adapter )\r
+_adapter_open_ca(\r
+ IN vnic_adapter_t* const p_adapter )\r
{\r
ib_api_status_t ib_status = IB_SUCCESS;\r
ib_al_ifc_t *p_ifc = &p_adapter->ifc;\r
ib_ca_attr_t *p_ca_attrs;\r
uint32_t num;\r
uint64_t start_addr = 0;\r
+ \r
+ if( p_adapter->h_ca )\r
+ return ib_status;\r
\r
ib_status = p_ifc->open_ca( p_adapter->h_al,\r
p_adapter->ifc_data.ca_guid,\r
- ib_asyncEvent,\r
+ NULL, //ib_asyncEvent,\r
p_adapter,\r
&p_adapter->h_ca );\r
\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
("ib_query_ca failed status %s\n",\r
p_ifc->get_err_str( ib_status )) );\r
- return IB_INSUFFICIENT_RESOURCES;\r
+ \r
+ ib_status = IB_INSUFFICIENT_RESOURCES;\r
+ goto ca_failure;\r
}\r
\r
ASSERT( attr_size );\r
{\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
("Allocate %d bytes failed for Channel adapter\n", attr_size ));\r
- return IB_INSUFFICIENT_MEMORY;\r
+\r
+ ib_status = IB_INSUFFICIENT_MEMORY;\r
+ goto ca_failure;\r
}\r
\r
ib_status = p_ifc->query_ca( p_adapter->h_ca, p_ca_attrs , &attr_size );\r
if ( ib_status != IB_SUCCESS )\r
{\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("Query failed for channel adapter\n") );\r
+ ("CA attributes query failed\n") );\r
cl_free ( p_ca_attrs );\r
- return ib_status;\r
+ goto ca_failure;\r
}\r
\r
p_adapter->ca.numPorts = p_ca_attrs->num_ports;\r
if ( ib_status != IB_SUCCESS )\r
{\r
VNIC_TRACE_EXIT ( VNIC_DBG_ERROR,\r
- ("alloc PD failed status %s(%d)\n",\r
+ ("Alloc PD failed status %s(%d)\n",\r
p_adapter->ifc.get_err_str(ib_status), ib_status ));\r
- return ib_status;\r
+ goto ca_failure;\r
}\r
\r
if ( ( ib_status = ibregion_physInit( p_adapter,\r
VNIC_TRACE_EXIT ( VNIC_DBG_ERROR,\r
("phys region init failed status %s(%d)\n",\r
p_adapter->ifc.get_err_str(ib_status), ib_status ));\r
-\r
p_adapter->ifc.dealloc_pd( p_adapter->ca.hPd, NULL );\r
+ goto ca_failure;\r
}\r
\r
return ib_status;\r
+\r
+ca_failure:\r
+ if( p_adapter->h_ca )\r
+ p_ifc->close_ca( p_adapter->h_ca, NULL );\r
+\r
+ return ib_status;\r
}\r
\r
static BOOLEAN\r
-_vnic_params_sanity_check(vnic_params_t *p_params)\r
+_adapter_params_sanity_check(vnic_params_t *p_params)\r
{\r
- DEFAULT_PARAM( p_params->MaxAddressEntries, MAX_ADDRESS_ENTRIES );\r
- DEFAULT_PARAM( p_params->MinAddressEntries, MIN_ADDRESS_ENTRIES );\r
- \r
- DEFAULT_PARAM( p_params->ViportStatsInterval, VIPORT_STATS_INTERVAL );\r
- DEFAULT_PARAM( p_params->ViportHbInterval, VIPORT_HEARTBEAT_INTERVAL );\r
- DEFAULT_PARAM( p_params->ViportHbTimeout, VIPORT_HEARTBEAT_TIMEOUT );\r
- \r
- DEFAULT_PARAM( p_params->ControlRspTimeout, CONTROL_RSP_TIMEOUT );\r
- DEFAULT_PARAM( p_params->ControlReqRetryCount, CONTROL_REQ_RETRY_COUNT );\r
- \r
- DEFAULT_PARAM( p_params->RetryCount, RETRY_COUNT );\r
- DEFAULT_PARAM( p_params->MinRnrTimer, MIN_RNR_TIMER );\r
- \r
- DEFAULT_PARAM( p_params->MaxViportsPerNetpath, MAX_VIPORTS_PER_NETPATH );\r
- DEFAULT_PARAM( p_params->DefaultViportsPerNetpath, DEFAULT_VIPORTS_PER_NETPATH );\r
-\r
- DEFAULT_PARAM( p_params->DefaultPkey, DEFAULT_PKEY );\r
- DEFAULT_PARAM( p_params->NotifyBundleSz, NOTIFY_BUNDLE_SZ );\r
- DEFAULT_PARAM( p_params->DefaultNoPathTimeout, DEFAULT_NO_PATH_TIMEOUT );\r
- DEFAULT_PARAM( p_params->DefaultPrimaryConnectTimeout, DEFAULT_PRI_CON_TIMEOUT );\r
- DEFAULT_PARAM( p_params->DefaultPrimaryReconnectTimeout, DEFAULT_PRI_RECON_TIMEOUT );\r
- DEFAULT_PARAM( p_params->DefaultPrimarySwitchTimeout, DEFAULT_PRI_SWITCH_TIMEOUT );\r
- DEFAULT_PARAM( p_params->DefaultPreferPrimary, DEFAULT_PREFER_PRIMARY );\r
-\r
- U32_RANGE( p_params->MaxAddressEntries );\r
- U32_RANGE( p_params->MinAddressEntries );\r
- RANGE_CHECK( p_params->MinMtu, MIN_MTU, MAX_MTU );\r
- RANGE_CHECK( p_params->MaxMtu, MIN_MTU, MAX_MTU );\r
- U32_RANGE( p_params->HostRecvPoolEntries );\r
- U32_RANGE( p_params->MinHostPoolSz );\r
- U32_RANGE( p_params->MinEiocPoolSz );\r
- U32_RANGE( p_params->MaxEiocPoolSz );\r
- U32_ZERO_RANGE( p_params->MinHostKickTimeout );\r
- U32_ZERO_RANGE( p_params->MaxHostKickTimeout );\r
- U32_ZERO_RANGE( p_params->MinHostKickEntries );\r
- U32_ZERO_RANGE( p_params->MaxHostKickEntries );\r
- U32_ZERO_RANGE( p_params->MinHostKickBytes );\r
- U32_ZERO_RANGE( p_params->MaxHostKickBytes );\r
- U32_RANGE( p_params->MinHostUpdateSz );\r
- U32_RANGE( p_params->MaxHostUpdateSz );\r
- U32_RANGE( p_params->MinEiocUpdateSz );\r
- U32_RANGE( p_params->MaxEiocUpdateSz );\r
- U8_RANGE( p_params->NotifyBundleSz );\r
- U32_ZERO_RANGE( p_params->ViportStatsInterval );\r
- U32_ZERO_RANGE( p_params->ViportHbInterval );\r
- U32_ZERO_RANGE( p_params->ViportHbTimeout );\r
- U32_RANGE( p_params->ControlRspTimeout );\r
- U8_RANGE( p_params->ControlReqRetryCount );\r
- ZERO_RANGE_CHECK( p_params->RetryCount, 0, 7 );\r
- ZERO_RANGE_CHECK( p_params->MinRnrTimer, 0, 31 );\r
- U32_RANGE( p_params->DefaultViportsPerNetpath );\r
- U8_RANGE( p_params->MaxViportsPerNetpath );\r
- U16_ZERO_RANGE( p_params->DefaultPkey );\r
- U32_RANGE( p_params->DefaultNoPathTimeout );\r
- U32_RANGE( p_params->DefaultPrimaryConnectTimeout );\r
- U32_RANGE( p_params->DefaultPrimaryReconnectTimeout );\r
- U32_RANGE( p_params->DefaultPrimarySwitchTimeout );\r
- BOOLEAN_RANGE( p_params->DefaultPreferPrimary );\r
- BOOLEAN_RANGE( p_params->UseRxCsum );\r
- BOOLEAN_RANGE( p_params->UseTxCsum );\r
-\r
- LESS_THAN_OR_EQUAL( p_params->MinAddressEntries, p_params->MaxAddressEntries );\r
- LESS_THAN_OR_EQUAL( p_params->MinMtu, p_params->MaxMtu );\r
- LESS_THAN_OR_EQUAL( p_params->MinHostPoolSz, p_params->HostRecvPoolEntries );\r
- POWER_OF_2( p_params->HostRecvPoolEntries );\r
- POWER_OF_2( p_params->MinHostPoolSz );\r
- POWER_OF_2( p_params->NotifyBundleSz );\r
- LESS_THAN( p_params->NotifyBundleSz, p_params->MinEiocPoolSz );\r
- LESS_THAN_OR_EQUAL( p_params->MinEiocPoolSz, p_params->MaxEiocPoolSz );\r
- POWER_OF_2( p_params->MinEiocPoolSz );\r
- POWER_OF_2( p_params->MaxEiocPoolSz );\r
- LESS_THAN_OR_EQUAL( p_params->MinHostKickTimeout, p_params->MaxHostKickTimeout );\r
- LESS_THAN_OR_EQUAL( p_params->MinHostKickEntries, p_params->MaxHostKickEntries );\r
- LESS_THAN_OR_EQUAL( p_params->MinHostKickBytes, p_params->MaxHostKickBytes );\r
- LESS_THAN_OR_EQUAL( p_params->MinHostUpdateSz, p_params->MaxHostUpdateSz );\r
- POWER_OF_2( p_params->MinHostUpdateSz );\r
- POWER_OF_2( p_params->MaxHostUpdateSz );\r
- LESS_THAN( p_params->MinHostUpdateSz, p_params->MinHostPoolSz );\r
- LESS_THAN( p_params->MaxHostUpdateSz, p_params->HostRecvPoolEntries );\r
- LESS_THAN_OR_EQUAL( p_params->MinEiocUpdateSz, p_params->MaxEiocUpdateSz );\r
- POWER_OF_2( p_params->MinEiocUpdateSz );\r
- POWER_OF_2( p_params->MaxEiocUpdateSz );\r
- LESS_THAN( p_params->MinEiocUpdateSz, p_params->MinEiocPoolSz );\r
- LESS_THAN( p_params->MaxEiocUpdateSz, p_params->MaxEiocPoolSz );\r
- LESS_THAN_OR_EQUAL( p_params->DefaultViportsPerNetpath, p_params->MaxViportsPerNetpath );\r
-\r
- return TRUE;\r
+ DEFAULT_PARAM( p_params->MaxAddressEntries, MAX_ADDRESS_ENTRIES );\r
+ DEFAULT_PARAM( p_params->MinAddressEntries, MIN_ADDRESS_ENTRIES );\r
+\r
+ DEFAULT_PARAM( p_params->ViportStatsInterval, VIPORT_STATS_INTERVAL );\r
+ DEFAULT_PARAM( p_params->ViportHbInterval, VIPORT_HEARTBEAT_INTERVAL );\r
+ DEFAULT_PARAM( p_params->ViportHbTimeout, VIPORT_HEARTBEAT_TIMEOUT );\r
+\r
+ DEFAULT_PARAM( p_params->ControlRspTimeout, CONTROL_RSP_TIMEOUT );\r
+ DEFAULT_PARAM( p_params->ControlReqRetryCount, CONTROL_REQ_RETRY_COUNT );\r
+\r
+ DEFAULT_PARAM( p_params->RetryCount, RETRY_COUNT );\r
+ DEFAULT_PARAM( p_params->MinRnrTimer, MIN_RNR_TIMER );\r
+\r
+ DEFAULT_PARAM( p_params->MaxViportsPerNetpath, MAX_VIPORTS_PER_NETPATH );\r
+ DEFAULT_PARAM( p_params->DefaultViportsPerNetpath, DEFAULT_VIPORTS_PER_NETPATH );\r
+\r
+ DEFAULT_PARAM( p_params->DefaultPkey, DEFAULT_PKEY );\r
+ DEFAULT_PARAM( p_params->NotifyBundleSz, NOTIFY_BUNDLE_SZ );\r
+ DEFAULT_PARAM( p_params->DefaultNoPathTimeout, DEFAULT_NO_PATH_TIMEOUT );\r
+ DEFAULT_PARAM( p_params->DefaultPrimaryConnectTimeout, DEFAULT_PRI_CON_TIMEOUT );\r
+ DEFAULT_PARAM( p_params->DefaultPrimaryReconnectTimeout, DEFAULT_PRI_RECON_TIMEOUT );\r
+ DEFAULT_PARAM( p_params->DefaultPrimarySwitchTimeout, DEFAULT_PRI_SWITCH_TIMEOUT );\r
+ DEFAULT_PARAM( p_params->DefaultPreferPrimary, DEFAULT_PREFER_PRIMARY );\r
+\r
+ U32_RANGE( p_params->MaxAddressEntries );\r
+ U32_RANGE( p_params->MinAddressEntries );\r
+ RANGE_CHECK( p_params->MinMtu, MIN_MTU, MAX_MTU );\r
+ RANGE_CHECK( p_params->MaxMtu, MIN_MTU, MAX_MTU );\r
+ U32_RANGE( p_params->HostRecvPoolEntries );\r
+ U32_RANGE( p_params->MinHostPoolSz );\r
+ U32_RANGE( p_params->MinEiocPoolSz );\r
+ U32_RANGE( p_params->MaxEiocPoolSz );\r
+ U32_ZERO_RANGE( p_params->MinHostKickTimeout );\r
+ U32_ZERO_RANGE( p_params->MaxHostKickTimeout );\r
+ U32_ZERO_RANGE( p_params->MinHostKickEntries );\r
+ U32_ZERO_RANGE( p_params->MaxHostKickEntries );\r
+ U32_ZERO_RANGE( p_params->MinHostKickBytes );\r
+ U32_ZERO_RANGE( p_params->MaxHostKickBytes );\r
+ U32_RANGE( p_params->MinHostUpdateSz );\r
+ U32_RANGE( p_params->MaxHostUpdateSz );\r
+ U32_RANGE( p_params->MinEiocUpdateSz );\r
+ U32_RANGE( p_params->MaxEiocUpdateSz );\r
+ U8_RANGE( p_params->NotifyBundleSz );\r
+ U32_ZERO_RANGE( p_params->ViportStatsInterval );\r
+ U32_ZERO_RANGE( p_params->ViportHbInterval );\r
+ U32_ZERO_RANGE( p_params->ViportHbTimeout );\r
+ U32_RANGE( p_params->ControlRspTimeout );\r
+ U8_RANGE( p_params->ControlReqRetryCount );\r
+ ZERO_RANGE_CHECK( p_params->RetryCount, 0, 7 );\r
+ ZERO_RANGE_CHECK( p_params->MinRnrTimer, 0, 31 );\r
+ U32_RANGE( p_params->DefaultViportsPerNetpath );\r
+ U8_RANGE( p_params->MaxViportsPerNetpath );\r
+ U16_ZERO_RANGE( p_params->DefaultPkey );\r
+ U32_RANGE( p_params->DefaultNoPathTimeout );\r
+ U32_RANGE( p_params->DefaultPrimaryConnectTimeout );\r
+ U32_RANGE( p_params->DefaultPrimaryReconnectTimeout );\r
+ U32_RANGE( p_params->DefaultPrimarySwitchTimeout );\r
+ BOOLEAN_RANGE( p_params->DefaultPreferPrimary );\r
+ BOOLEAN_RANGE( p_params->UseRxCsum );\r
+ BOOLEAN_RANGE( p_params->UseTxCsum );\r
+\r
+ LESS_THAN_OR_EQUAL( p_params->MinAddressEntries, p_params->MaxAddressEntries );\r
+ LESS_THAN_OR_EQUAL( p_params->MinMtu, p_params->MaxMtu );\r
+ LESS_THAN_OR_EQUAL( p_params->MinHostPoolSz, p_params->HostRecvPoolEntries );\r
+ POWER_OF_2( p_params->HostRecvPoolEntries );\r
+ POWER_OF_2( p_params->MinHostPoolSz );\r
+ POWER_OF_2( p_params->NotifyBundleSz );\r
+ LESS_THAN( p_params->NotifyBundleSz, p_params->MinEiocPoolSz );\r
+ LESS_THAN_OR_EQUAL( p_params->MinEiocPoolSz, p_params->MaxEiocPoolSz );\r
+ POWER_OF_2( p_params->MinEiocPoolSz );\r
+ POWER_OF_2( p_params->MaxEiocPoolSz );\r
+ LESS_THAN_OR_EQUAL( p_params->MinHostKickTimeout, p_params->MaxHostKickTimeout );\r
+ LESS_THAN_OR_EQUAL( p_params->MinHostKickEntries, p_params->MaxHostKickEntries );\r
+ LESS_THAN_OR_EQUAL( p_params->MinHostKickBytes, p_params->MaxHostKickBytes );\r
+ LESS_THAN_OR_EQUAL( p_params->MinHostUpdateSz, p_params->MaxHostUpdateSz );\r
+ POWER_OF_2( p_params->MinHostUpdateSz );\r
+ POWER_OF_2( p_params->MaxHostUpdateSz );\r
+ LESS_THAN( p_params->MinHostUpdateSz, p_params->MinHostPoolSz );\r
+ LESS_THAN( p_params->MaxHostUpdateSz, p_params->HostRecvPoolEntries );\r
+ LESS_THAN_OR_EQUAL( p_params->MinEiocUpdateSz, p_params->MaxEiocUpdateSz );\r
+ POWER_OF_2( p_params->MinEiocUpdateSz );\r
+ POWER_OF_2( p_params->MaxEiocUpdateSz );\r
+ LESS_THAN( p_params->MinEiocUpdateSz, p_params->MinEiocPoolSz );\r
+ LESS_THAN( p_params->MaxEiocUpdateSz, p_params->MaxEiocPoolSz );\r
+ LESS_THAN_OR_EQUAL( p_params->DefaultViportsPerNetpath, p_params->MaxViportsPerNetpath );\r
+\r
+ return TRUE;\r
\r
}\r
NDIS_STATUS\r
status = NDIS_STATUS_FAILURE;\r
p_reg_prm = NULL;\r
\r
- RtlInitUnicodeString( &keyword, L"DebugFlags" );\r
-\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
- if( status == NDIS_STATUS_SUCCESS )\r
- g_vnic_dbg_lvl |= p_reg_prm->ParameterData.IntegerData;\r
-\r
- RtlInitUnicodeString( &keyword, L"MinMtu" );\r
+ RtlInitUnicodeString( &keyword, L"PayloadMtu" );\r
NdisReadConfiguration(\r
&status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
\r
p_params->MinMtu = ( status != NDIS_STATUS_SUCCESS ) ? MIN_MTU:\r
p_reg_prm->ParameterData.IntegerData;\r
-\r
- RtlInitUnicodeString( &keyword, L"MaxMtu" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
-\r
- p_params->MaxMtu =( status != NDIS_STATUS_SUCCESS )? MAX_MTU:\r
- p_reg_prm->ParameterData.IntegerData;\r
+ p_params->MaxMtu = MAX_MTU;\r
\r
RtlInitUnicodeString( &keyword, L"UseRxCsum" );\r
NdisReadConfiguration(\r
/* turn it on by default, if not present */\r
p_params->UseTxCsum = ( status != NDIS_STATUS_SUCCESS ) ?\r
TRUE : ( p_reg_prm->ParameterData.IntegerData )? TRUE : FALSE;\r
-\r
- RtlInitUnicodeString( &keyword, L"MinEiocUpdateSz" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
-\r
- p_params->MinEiocUpdateSz = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MIN_EIOC_UPDATE_SZ : p_reg_prm->ParameterData.IntegerData;\r
-\r
- RtlInitUnicodeString( &keyword, L"MaxEiocUpdateSz" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
-\r
- p_params->MaxEiocUpdateSz = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MAX_EIOC_UPDATE_SZ : p_reg_prm->ParameterData.IntegerData;\r
-\r
- RtlInitUnicodeString( &keyword, L"MinHostUpdateSz" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
-\r
- p_params->MinHostUpdateSz = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MIN_HOST_UPDATE_SZ : p_reg_prm->ParameterData.IntegerData;\r
-\r
- RtlInitUnicodeString( &keyword, L"MaxHostUpdateSz" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
-\r
- p_params->MaxHostUpdateSz = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MAX_HOST_UPDATE_SZ : p_reg_prm->ParameterData.IntegerData;\r
-\r
- RtlInitUnicodeString( &keyword, L"MinHostKickBytes" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
-\r
- p_params->MinHostKickBytes = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MIN_HOST_KICK_BYTES : p_reg_prm->ParameterData.IntegerData;\r
-\r
- RtlInitUnicodeString( &keyword, L"MaxHostKickBytes" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
-\r
- p_params->MaxHostKickBytes = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MAX_HOST_KICK_BYTES : p_reg_prm->ParameterData.IntegerData;\r
-\r
- RtlInitUnicodeString( &keyword, L"MinHostKickEntries" );\r
+ \r
+ /* handle VLAN + Priority paramters */\r
+ RtlInitUnicodeString( &keyword, L"VlanId" );\r
NdisReadConfiguration(\r
&status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
\r
- p_params->MinHostKickEntries = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MIN_HOST_KICK_ENTRIES : p_reg_prm->ParameterData.IntegerData;\r
-\r
- RtlInitUnicodeString( &keyword, L"MaxHostKickEntries" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
+ if( status == NDIS_STATUS_SUCCESS )\r
+ {\r
+ p_params->VlanInfo = \r
+ ( p_reg_prm->ParameterData.IntegerData & 0x00000fff );\r
\r
- p_params->MaxHostKickEntries = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MAX_HOST_KICK_ENTRIES : p_reg_prm->ParameterData.IntegerData;\r
+ RtlInitUnicodeString( &keyword, L"UserPriority" );\r
+ NdisReadConfiguration(\r
+ &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
+ \r
+ p_params->VlanInfo |= ( status != NDIS_STATUS_SUCCESS ) ? 0 :\r
+ ( ( p_reg_prm->ParameterData.IntegerData & 0x00000007 ) << 13 );\r
+ }\r
+ else\r
+ {\r
+ p_params->VlanInfo = 0;\r
+ }\r
\r
- RtlInitUnicodeString( &keyword, L"MinHostKickTimeout" );\r
+ RtlInitUnicodeString( &keyword, L"SecondaryPath" );\r
NdisReadConfiguration(\r
&status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
\r
- p_params->MinHostKickTimeout = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MIN_HOST_KICK_TIMEOUT : p_reg_prm->ParameterData.IntegerData;\r
+ /* disable, if not set. Save extra viport slot */\r
+ p_params->SecondaryPath = ( status != NDIS_STATUS_SUCCESS ) ?\r
+ FALSE : ( p_reg_prm->ParameterData.IntegerData )? TRUE : FALSE;\r
\r
- RtlInitUnicodeString( &keyword, L"MaxHostKickTimeout" );\r
+ RtlInitUnicodeString( &keyword, L"Heartbeat" );\r
NdisReadConfiguration(\r
&status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
\r
- p_params->MaxHostKickTimeout = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MAX_HOST_KICK_TIMEOUT : p_reg_prm->ParameterData.IntegerData;\r
+ p_params->ViportHbInterval = ( status != NDIS_STATUS_SUCCESS ) ?\r
+ VIPORT_HEARTBEAT_INTERVAL : p_reg_prm->ParameterData.IntegerData;\r
\r
- RtlInitUnicodeString( &keyword, L"MinEiocPoolSz" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
+#if defined(LBFO_ENABLED)\r
+ /* read Failover group Name/Number */\r
\r
- p_params->MinEiocPoolSz = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MIN_EIOC_POOL_SZ : p_reg_prm->ParameterData.IntegerData;\r
-\r
- RtlInitUnicodeString( &keyword, L"MaxEiocPoolSz" );\r
+ RtlInitUnicodeString( &keyword, L"BundleId" );\r
NdisReadConfiguration(\r
&status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
+ \r
+ p_params->bundle_id = ( status != NDIS_STATUS_SUCCESS ) ? 0 :\r
+ p_reg_prm->ParameterData.IntegerData;\r
+#endif // LBFO_ENABLED\r
\r
- p_params->MaxEiocPoolSz = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MAX_EIOC_POOL_SZ : p_reg_prm->ParameterData.IntegerData;\r
+ NdisCloseConfiguration( h_config );\r
+ \r
+ /* initialize the rest of adapter parameters with driver's global set */\r
+ if( g_vnic.p_params != NULL )\r
+ {\r
+ /* get global parameters from service entry */\r
+ p_params->MinHostPoolSz = g_vnic.p_params[INDEX_MIN_HOST_POOL_SZ].value;\r
+ p_params->HostRecvPoolEntries = g_vnic.p_params[INDEX_HOST_RECV_POOL_ENTRIES].value;\r
\r
- RtlInitUnicodeString( &keyword, L"MinHostPoolSz" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
+ p_params->MinEiocPoolSz = g_vnic.p_params[INDEX_MIN_EIOC_POOL_SZ].value;\r
+ p_params->MaxEiocPoolSz = g_vnic.p_params[INDEX_MAX_EIOC_POOL_SZ].value;\r
\r
- p_params->MinHostPoolSz = ( status != NDIS_STATUS_SUCCESS ) ?\r
- MIN_HOST_POOL_SZ : p_reg_prm->ParameterData.IntegerData;\r
+ p_params->MinHostKickTimeout = g_vnic.p_params[INDEX_MIN_HOST_KICK_TIMEOUT].value;\r
+ p_params->MaxHostKickTimeout = g_vnic.p_params[INDEX_MAX_HOST_KICK_TIMEOUT].value;\r
\r
- RtlInitUnicodeString( &keyword, L"HostRecvPoolEntries" );\r
- NdisReadConfiguration(\r
- &status, &p_reg_prm, h_config, &keyword, NdisParameterInteger );\r
+ p_params->MinHostKickEntries = g_vnic.p_params[INDEX_MIN_HOST_KICK_ENTRIES].value;\r
+ p_params->MaxHostKickEntries = g_vnic.p_params[INDEX_MAX_HOST_KICK_ENTRIES].value;\r
\r
- p_params->HostRecvPoolEntries = ( status != NDIS_STATUS_SUCCESS ) ?\r
- HOST_RECV_POOL_ENTRIES : p_reg_prm->ParameterData.IntegerData;\r
+ p_params->MinHostKickBytes = g_vnic.p_params[INDEX_MIN_HOST_KICK_BYTES].value;\r
+ p_params->MaxHostKickBytes = g_vnic.p_params[INDEX_MAX_HOST_KICK_BYTES].value;\r
+ \r
+ p_params->MinHostUpdateSz = g_vnic.p_params[INDEX_MIN_HOST_UPDATE_SZ].value;\r
+ p_params->MaxHostUpdateSz = g_vnic.p_params[INDEX_MAX_HOST_UPDATE_SZ].value;\r
\r
- NdisCloseConfiguration( h_config );\r
+ p_params->MinEiocUpdateSz = g_vnic.p_params[INDEX_MIN_EIOC_UPDATE_SZ].value;\r
+ p_params->MaxEiocUpdateSz = g_vnic.p_params[INDEX_MAX_EIOC_UPDATE_SZ].value;\r
+ \r
+ p_params->ViportHbTimeout = g_vnic.p_params[INDEX_HEARTBEAT_TIMEOUT].value;\r
+ }\r
+ else\r
+ {\r
+ /* set default constants */\r
+ p_params->MinHostPoolSz = MIN_HOST_POOL_SZ;\r
+ p_params->HostRecvPoolEntries = HOST_RECV_POOL_ENTRIES;\r
+ p_params->MinEiocPoolSz = MIN_EIOC_POOL_SZ;\r
+ p_params->MaxEiocPoolSz = MAX_EIOC_POOL_SZ;\r
+ p_params->MinHostKickTimeout = MIN_HOST_KICK_TIMEOUT;\r
+ p_params->MaxHostKickTimeout = MAX_HOST_KICK_TIMEOUT;\r
+ p_params->MinHostKickEntries = MIN_HOST_KICK_ENTRIES;\r
+ p_params->MaxHostKickEntries = MAX_HOST_KICK_ENTRIES;\r
+ p_params->MinHostKickBytes = MIN_HOST_KICK_BYTES;\r
+ p_params->MaxHostKickBytes = MAX_HOST_KICK_BYTES;\r
+ p_params->MinHostUpdateSz = MIN_HOST_UPDATE_SZ;\r
+ p_params->MaxHostUpdateSz = MAX_HOST_UPDATE_SZ;\r
+ p_params->MinEiocUpdateSz = MIN_EIOC_UPDATE_SZ;\r
+ p_params->MaxEiocUpdateSz = MAX_EIOC_UPDATE_SZ;\r
+ }\r
\r
- status = ( _vnic_params_sanity_check(p_params)?\r
+ status = ( _adapter_params_sanity_check(p_params)?\r
NDIS_STATUS_SUCCESS: NDIS_STATUS_FAILURE );\r
\r
VNIC_EXIT( VNIC_DBG_ADAPTER );\r
}\r
\r
ib_api_status_t\r
-vnic_viport_allocate(\r
+adapter_viport_allocate(\r
IN vnic_adapter_t* const p_adapter,\r
IN OUT viport_t** const pp_viport )\r
{\r
viport_t *p_viport;\r
NDIS_STATUS status;\r
+\r
VNIC_ENTER( VNIC_DBG_ADAPTER );\r
\r
NdisAcquireSpinLock( &p_adapter->lock );\r
- status = NdisAllocateMemoryWithTag( &p_viport, sizeof(viport_t), 'trop' );\r
\r
+ status = NdisAllocateMemoryWithTag( &p_viport, sizeof(viport_t), 'trop' );\r
if( status != NDIS_STATUS_SUCCESS )\r
{\r
NdisReleaseSpinLock( &p_adapter->lock );\r
}\r
\r
NdisZeroMemory( p_viport, sizeof(viport_t) );\r
-\r
- KeInitializeSpinLock( &p_viport->lock );\r
+ NdisAllocateSpinLock( &p_viport->lock );\r
InitializeListHead( &p_viport->listPtrs );\r
- InitializeListHead( &p_viport->send_pending_list );\r
- NdisAllocateSpinLock(&p_viport->pending_list_lock );\r
-\r
- KeInitializeEvent( &p_viport->conn_event, SynchronizationEvent, FALSE );\r
+ KeInitializeEvent( &p_viport->sync_event, SynchronizationEvent, FALSE );\r
\r
p_viport->p_adapter = p_adapter;\r
-\r
- viport_get_adapter_name( p_viport );\r
-\r
viport_config_defaults ( p_viport );\r
- VNIC_TRACE( VNIC_DBG_PNP, ("Configure Viport default values\n") );\r
\r
control_construct( &p_viport->control, p_viport );\r
data_construct( &p_viport->data, p_viport );\r
\r
p_viport->ioc_num = _get_ioc_num_from_iocguid( &p_adapter->ifc_data.guid );\r
- p_adapter->ioc_num = p_viport->ioc_num;\r
+ if( !p_adapter->ioc_num )\r
+ {\r
+ p_adapter->ioc_num = p_viport->ioc_num;\r
+ }\r
+\r
+ CL_ASSERT( p_adapter->ioc_num == p_viport->ioc_num );\r
\r
*pp_viport = p_viport;\r
\r
NdisReleaseSpinLock( &p_adapter->lock );\r
+\r
VNIC_EXIT( VNIC_DBG_ADAPTER );\r
return IB_SUCCESS;\r
}\r
+\r
+\r
static void\r
-_vnic_viport_free(\r
- IN vnic_adapter_t* const p_adapter )\r
+_adapter_netpath_free(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN Netpath_t* p_netpath )\r
{\r
- viport_t *p_viport = p_adapter->p_viport;\r
- VNIC_ENTER( VNIC_DBG_ADAPTER );\r
\r
- if ( p_viport )\r
+ UNREFERENCED_PARAMETER( p_adapter );\r
+\r
+ if( netpath_is_valid( p_netpath ) )\r
{\r
- p_adapter->p_viport = NULL;\r
- NdisFreeMemory( p_viport, sizeof(viport_t), 0 );\r
- }\r
- p_adapter->state = INIC_UNINITIALIZED;\r
+ VNIC_TRACE( VNIC_DBG_INFO,\r
+ ("IOC[%d] instance %d Free Path\n",\r
+ p_adapter->ioc_num, p_netpath->instance ));\r
\r
- VNIC_EXIT( VNIC_DBG_ADAPTER );\r
+ netpath_free( p_netpath );\r
+ netpath_init( p_netpath, NULL );\r
+ }\r
}\r
\r
-\r
NDIS_STATUS\r
-vnic_set_mcast(\r
+adapter_set_mcast(\r
IN vnic_adapter_t* const p_adapter,\r
IN mac_addr_t* const p_mac_array,\r
IN const uint8_t mc_count )\r
{\r
NDIS_STATUS status;\r
-\r
+ int i;\r
VNIC_ENTER( VNIC_DBG_MCAST );\r
\r
- VNIC_TRACE( VNIC_DBG_INIT,\r
- ("MCAST COUNT to set = %d\n", mc_count));\r
+ if( !netpath_is_valid( p_adapter->p_currentPath ) )\r
+ return NDIS_STATUS_NOT_ACCEPTED;\r
+\r
+ VNIC_TRACE( VNIC_DBG_MCAST,\r
+ ("IOC[%d] MCAST COUNT to set = %d\n", \r
+ p_adapter->ioc_num, mc_count));\r
+\r
/* Copy the MC address list into the adapter. */\r
if( mc_count )\r
{\r
RtlCopyMemory(\r
p_adapter->mcast_array, p_mac_array, mc_count * MAC_ADDR_LEN );\r
+ for( i = 0; i < mc_count; i++ )\r
+ VNIC_TRACE( VNIC_DBG_MCAST,\r
+ ("[%d] %02x:%02x:%02x:%02x:%02x:%02x\n", i,\r
+ p_mac_array->addr[0], p_mac_array->addr[1], p_mac_array->addr[2],\r
+ p_mac_array->addr[3], p_mac_array->addr[4], p_mac_array->addr[5] ));\r
}\r
p_adapter->mc_count = mc_count;\r
\r
- if( !p_adapter->p_currentPath->pViport )\r
- return NDIS_STATUS_SUCCESS;\r
-\r
- ++p_adapter->pending_set;\r
- status = viport_setMulticast( p_adapter->p_currentPath->pViport );\r
+ p_adapter->pending_set = TRUE;\r
+ status = netpath_setMulticast( p_adapter->p_currentPath );\r
if( status != NDIS_STATUS_PENDING )\r
{\r
- --p_adapter->pending_set;\r
+ p_adapter->pending_set = FALSE;\r
}\r
\r
VNIC_EXIT( VNIC_DBG_MCAST );\r
\r
static BOOLEAN\r
__path_records_match(\r
- IN ib_path_rec_t *p_path1,\r
- IN ib_path_rec_t *p_path2 )\r
+ IN ib_path_rec_t* const p_path1,\r
+ IN ib_path_rec_t* const p_path2 )\r
{\r
- if ( p_path1->dgid.unicast.prefix != p_path2->dgid.unicast.prefix )\r
+ if( p_path1->dgid.unicast.prefix != p_path2->dgid.unicast.prefix )\r
+ return FALSE;\r
+ if( p_path1->dgid.unicast.interface_id != p_path2->dgid.unicast.interface_id )\r
+ return FALSE;\r
+ if( p_path1->dlid != p_path2->dlid )\r
return FALSE;\r
- if ( p_path1->dgid.unicast.interface_id != p_path2->dgid.unicast.interface_id )\r
+\r
+ if( p_path1->sgid.unicast.prefix != p_path2->sgid.unicast.prefix )\r
+ return FALSE;\r
+ if( p_path1->sgid.unicast.interface_id != p_path2->sgid.unicast.interface_id )\r
+ return FALSE;\r
+ if( p_path1->slid != p_path2->slid )\r
+ return FALSE;\r
+\r
+ if( p_path1->pkey != p_path2->pkey )\r
return FALSE;\r
- if ( p_path1->dlid != p_path2->dlid )\r
+ if( p_path1->rate != p_path2->rate )\r
return FALSE;\r
- if ( p_path1->pkey != p_path2->pkey )\r
+ if( p_path1->sl != p_path2->sl )\r
return FALSE;\r
- if ( p_path1->rate != p_path2->rate )\r
+ if( p_path1->tclass != p_path2->tclass )\r
return FALSE;\r
\r
return TRUE;\r
return ( (vnic_ioc_guid_t *)p_iocguid)->s.ioc_num;\r
}\r
\r
-static ib_api_status_t\r
+static\r
+vnic_path_record_t*\r
__path_record_add(\r
- IN vnic_adapter_t *p_adapter,\r
- IN ib_path_rec_t *p_path_rec )\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN ib_path_rec_t* const p_path_rec )\r
{\r
\r
- NdisAcquireSpinLock( &p_adapter->lock );\r
+ vnic_path_record_t *p_path;\r
+\r
+ p_path = __path_record_find( p_adapter, p_path_rec );\r
\r
- if ( !__path_records_match( &p_adapter->path_record.path_rec, p_path_rec ) )\r
+ if( !p_path )\r
{\r
- p_adapter->path_record.path_rec = *p_path_rec;\r
- p_adapter->path_record.num_entries++;\r
+ p_path = cl_zalloc( sizeof( vnic_path_record_t ) );\r
+ if( !p_path )\r
+ return NULL;\r
+\r
+ NdisAcquireSpinLock( &p_adapter->path_records_lock );\r
+ \r
+ p_path->path_rec = *p_path_rec;\r
+ cl_qlist_insert_tail( &p_adapter->path_records_list, &p_path->list_entry );\r
+\r
+ NdisReleaseSpinLock( &p_adapter->path_records_lock );\r
+\r
+ VNIC_TRACE( VNIC_DBG_PNP,\r
+ ("New path Added to the list[ list size %d]\n", \r
+ cl_qlist_count(&p_adapter->path_records_list) ));\r
+ \r
+ return p_path;\r
}\r
+ VNIC_TRACE( VNIC_DBG_PNP,\r
+ ( "Path to add is already on the List\n" ) );\r
\r
- NdisReleaseSpinLock( &p_adapter->lock );\r
- return IB_SUCCESS;\r
+ return NULL;\r
}\r
\r
-static ib_api_status_t\r
+static\r
+vnic_path_record_t*\r
+__path_record_get(\r
+ IN vnic_adapter_t* const p_adapter )\r
+{\r
+ cl_list_item_t *p_item;\r
+\r
+ p_item = cl_qlist_head( &p_adapter->path_records_list );\r
+\r
+ if( p_item != cl_qlist_end( &p_adapter->path_records_list ) )\r
+ {\r
+ return ( vnic_path_record_t *)p_item;\r
+ }\r
+ return NULL;\r
+}\r
+\r
+static \r
+vnic_path_record_t*\r
__path_record_remove(\r
- IN vnic_adapter_t *p_adapter,\r
- IN ib_path_rec_t *p_path_rec )\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN ib_path_rec_t* const p_path_rec )\r
{\r
\r
- NdisAcquireSpinLock( &p_adapter->lock );\r
+ vnic_path_record_t *p_path;\r
\r
- if ( __path_records_match( &p_adapter->path_record.path_rec, p_path_rec ) )\r
+\r
+ p_path = __path_record_find( p_adapter, p_path_rec );\r
+\r
+ if ( p_path )\r
{\r
- --p_adapter->path_record.num_entries;\r
- cl_memclr( &p_adapter->path_record.path_rec, sizeof( ib_path_rec_t ));\r
+ NdisAcquireSpinLock( &p_adapter->path_records_lock );\r
+\r
+ cl_qlist_remove_item( &p_adapter->path_records_list, &p_path->list_entry );\r
+\r
+ NdisReleaseSpinLock( &p_adapter->path_records_lock );\r
}\r
+ \r
+ return p_path;\r
+}\r
\r
- NdisReleaseSpinLock( &p_adapter->lock );\r
- return IB_SUCCESS;\r
+static\r
+vnic_path_record_t *\r
+__path_record_find( \r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN ib_path_rec_t* const p_path_rec )\r
+{\r
+ cl_list_item_t *p_item;\r
+ vnic_path_record_t *p_path = NULL;\r
+\r
+ NdisAcquireSpinLock( &p_adapter->path_records_lock );\r
+\r
+ if( !cl_qlist_count( &p_adapter->path_records_list ) )\r
+ {\r
+ NdisReleaseSpinLock( &p_adapter->path_records_lock );\r
+ return NULL;\r
+ }\r
+ \r
+ p_item = cl_qlist_head( &p_adapter->path_records_list );\r
+\r
+ while( p_item != cl_qlist_end( &p_adapter->path_records_list ) )\r
+ {\r
+ p_path = ( vnic_path_record_t *)p_item;\r
+ \r
+ if ( __path_records_match( &p_path->path_rec, p_path_rec ) )\r
+ {\r
+ break;\r
+ }\r
+\r
+ p_item = cl_qlist_next( p_item );\r
+ }\r
+\r
+ NdisReleaseSpinLock( &p_adapter->path_records_lock );\r
+\r
+ if( p_item == cl_qlist_end( &p_adapter->path_records_list ) )\r
+ {\r
+ p_path = NULL;\r
+ }\r
+ return p_path;\r
+}\r
+\r
+void\r
+__pending_queue_cleanup( \r
+ IN vnic_adapter_t *p_adapter )\r
+{\r
+ LIST_ENTRY *p_list_item;\r
+ NDIS_PACKET *p_packet;\r
+\r
+ VNIC_ENTER( VNIC_DBG_ADAPTER );\r
+\r
+ /* clear pending queue if any */\r
+\r
+ while( ( p_list_item = NdisInterlockedRemoveHeadList(\r
+ &p_adapter->send_pending_list,\r
+ &p_adapter->pending_list_lock )) != NULL )\r
+ {\r
+ p_packet = VNIC_PACKET_FROM_LIST_ITEM( p_list_item );\r
+ if ( p_packet )\r
+ {\r
+ NDIS_SET_PACKET_STATUS( p_packet, NDIS_STATUS_FAILURE );\r
+ NdisMSendComplete( p_adapter->h_handle, p_packet, NDIS_STATUS_FAILURE );\r
+ }\r
+ }\r
+\r
+ VNIC_EXIT( VNIC_DBG_ADAPTER );\r
}\r
\r
static void\r
vnic_adapter_t *p_adapter )\r
{\r
\r
- NdisAcquireSpinLock( &p_adapter->lock );\r
+ vnic_path_record_t *p_path;\r
+ cl_list_item_t *p_item;\r
\r
- cl_memclr( &p_adapter->path_record.path_rec, sizeof( ib_path_rec_t ));\r
- p_adapter->path_record.num_entries = 0;\r
+ p_item = cl_qlist_remove_head( &p_adapter->path_records_list );\r
\r
- NdisReleaseSpinLock( &p_adapter->lock );\r
+ while( p_item != cl_qlist_end( &p_adapter->path_records_list ) )\r
+ {\r
+ p_path = (vnic_path_record_t *)p_item;\r
+\r
+ cl_free( p_path );\r
+\r
+ p_item = cl_qlist_remove_head( &p_adapter->path_records_list );\r
+ }\r
+ \r
return;\r
}\r
+\r
ib_api_status_t\r
__vnic_pnp_cb(\r
IN ib_pnp_rec_t *p_pnp_rec )\r
ib_api_status_t ib_status = IB_SUCCESS;\r
ib_pnp_ioc_rec_t *p_ioc_rec;\r
ib_pnp_ioc_path_rec_t *p_ioc_path;\r
+ vnic_path_record_t *p_path_record;\r
+ Netpath_t* p_netpath = NULL;\r
+\r
+#if defined( LBFO_ENABLED )\r
+ vnic_adapter_t *p_primary_adapter; \r
+#endif\r
\r
vnic_adapter_t * __ptr64 p_adapter = (vnic_adapter_t * __ptr64)p_pnp_rec->pnp_context;\r
\r
case IB_PNP_IOC_ADD:\r
p_ioc_rec = (ib_pnp_ioc_rec_t*)p_pnp_rec;\r
\r
- VNIC_TRACE( VNIC_DBG_PNP, ("IB_PNP_IOC_ADD for %s.\n", p_ioc_rec->info.profile.id_string) );\r
-\r
if( p_adapter->ifc_data.ca_guid != p_ioc_rec->ca_guid )\r
{\r
- VNIC_TRACE_EXIT( VNIC_DBG_WARN, ("Invalid CA GUID.\n") );\r
ib_status = IB_INVALID_GUID;\r
break;\r
}\r
if( p_adapter->ifc_data.guid != p_ioc_rec->info.profile.ioc_guid )\r
{\r
- VNIC_TRACE_EXIT( VNIC_DBG_WARN, ("Invalid IOC GUID.\n") );\r
ib_status = IB_INVALID_GUID;\r
break;\r
}\r
+ InterlockedExchange( (volatile LONG*)&p_adapter->pnp_state, IB_PNP_IOC_ADD );\r
+\r
+ VNIC_TRACE( VNIC_DBG_PNP, ("IB_PNP_IOC_ADD for %s.\n",\r
+ p_ioc_rec->info.profile.id_string) );\r
+\r
/* get ioc profile data */\r
NdisAcquireSpinLock( &p_adapter->lock );\r
\r
- InterlockedExchange( (volatile LONG*)&p_adapter->pnp_state, IB_PNP_IOC_ADD );\r
- \r
- p_adapter->ioc_info = p_ioc_rec->info;\r
- p_adapter->num_svc_entries = p_ioc_rec->info.profile.num_svc_entries;\r
- \r
- CL_ASSERT(p_adapter->num_svc_entries >= 2 );\r
-\r
if( !__sid_valid( p_adapter, p_ioc_rec->svc_entry_array[0].id ) )\r
{\r
NdisReleaseSpinLock( &p_adapter->lock );\r
\r
- VNIC_TRACE_EXIT( VNIC_DBG_WARN,\r
+ VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
("Invalid Service ID %#I64x\n",p_ioc_rec->svc_entry_array[0].id ) );\r
\r
ib_status = IB_INVALID_GUID; // should it be set INVALID_SERVICE_TYPE ?\r
break;\r
}\r
\r
- p_adapter->p_svc_entries =\r
- cl_zalloc( sizeof(ib_svc_entry_t) *\r
- p_adapter->ioc_info.profile.num_svc_entries );\r
-\r
- if( p_adapter->p_svc_entries == NULL )\r
- {\r
- NdisReleaseSpinLock( &p_adapter->lock );\r
-\r
- VNIC_TRACE_EXIT( VNIC_DBG_ERROR, ("Insufficient Memory.\n") );\r
- ib_status = IB_INSUFFICIENT_MEMORY;\r
- break;\r
- }\r
-\r
- cl_memcpy( p_adapter->p_svc_entries,\r
- p_ioc_rec->svc_entry_array,\r
- sizeof(ib_svc_entry_t) * p_adapter->ioc_info.profile.num_svc_entries);\r
+ p_adapter->ioc_info = p_ioc_rec->info;\r
+ CL_ASSERT(p_adapter->ioc_info.profile.num_svc_entries == 2 );\r
+ \r
+ p_adapter->svc_entries[0] = p_ioc_rec->svc_entry_array[0];\r
+ p_adapter->svc_entries[1] = p_ioc_rec->svc_entry_array[1];\r
+ p_adapter->ioc_num = _get_ioc_num_from_iocguid( &p_adapter->ifc_data.guid );\r
\r
VNIC_TRACE( VNIC_DBG_PNP,\r
("Found %d Service Entries.\n", p_adapter->ioc_info.profile.num_svc_entries));\r
+\r
NdisReleaseSpinLock( &p_adapter->lock );\r
+ \r
break;\r
\r
case IB_PNP_IOC_REMOVE:\r
\r
p_ioc_rec = (ib_pnp_ioc_rec_t*)p_pnp_rec;\r
\r
- InterlockedExchange( (volatile LONG*)&p_adapter->pnp_state, IB_PNP_IOC_REMOVE );\r
- \r
- VNIC_TRACE( VNIC_DBG_PNP, ("IB_PNP_IOC_REMOVE for %s.\n",\r
+ if( InterlockedExchange( (volatile LONG*)&p_adapter->pnp_state, IB_PNP_IOC_REMOVE ) == IB_PNP_IOC_ADD )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_INIT, ("IB_PNP_IOC_REMOVE for %s.\n",\r
p_adapter->ioc_info.profile.id_string) );\r
- \r
- viport_linkDown( p_adapter->p_viport );\r
+ \r
+ if( netpath_is_valid( p_adapter->p_currentPath ) )\r
+ {\r
+ netpath_stopXmit( p_adapter->p_currentPath );\r
+ InterlockedExchange( &p_adapter->p_currentPath->carrier, (LONG)FALSE );\r
+ netpath_linkDown( p_adapter->p_currentPath );\r
+ __pending_queue_cleanup( p_adapter );\r
+ }\r
+ /*\r
+ if( p_adapter->p_currentPath == &p_adapter->primaryPath )\r
+ p_netpath = &p_adapter->secondaryPath;\r
+ else\r
+ p_netpath = &p_adapter->primaryPath;\r
+\r
+ netpath_free( p_adapter->p_currentPath );\r
+ netpath_free( p_netpath );\r
+ */\r
+ }\r
break;\r
\r
case IB_PNP_IOC_PATH_ADD:\r
}\r
p_ioc_path = (ib_pnp_ioc_path_rec_t*)p_pnp_rec;\r
\r
- if( p_adapter->state != INIC_UNINITIALIZED )\r
- break;\r
-\r
- ib_status = __path_record_add( p_adapter, &p_ioc_path->path );\r
- if ( ib_status != IB_SUCCESS )\r
+ p_path_record = __path_record_add( p_adapter, &p_ioc_path->path );\r
+ if ( p_path_record == NULL )\r
{\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
("Failed to add path record\n") );\r
break;\r
}\r
\r
- netpath_init( &p_adapter->primaryPath, p_adapter );\r
- p_adapter->p_currentPath = &p_adapter->primaryPath;\r
-\r
- ib_status = vnic_viport_allocate( p_adapter, &p_adapter->p_viport );\r
-\r
- if( ib_status != IB_SUCCESS )\r
+ if( p_adapter->state == INIC_REGISTERED )\r
{\r
- VNIC_TRACE ( VNIC_DBG_ERROR,\r
- ("Failed status %s\n", p_adapter->ifc.get_err_str( ib_status )) );\r
- _vnic_viport_free( p_adapter );\r
- return ib_status;\r
+ if( p_adapter->num_paths > 0 )\r
+ {\r
+ if( p_adapter->params.SecondaryPath != TRUE )\r
+ {\r
+ VNIC_TRACE ( VNIC_DBG_WARN,\r
+ ("Allowed one path at a time\n") );\r
+ break;\r
+ }\r
+ }\r
+\r
+ if( p_adapter->num_paths > 1 )\r
+ {\r
+ VNIC_TRACE ( VNIC_DBG_WARN,\r
+ ("Max Paths[%d] Connected already\n", p_adapter->num_paths) );\r
+ break;\r
+ }\r
}\r
- \r
- netpath_addPath( p_adapter->p_currentPath, p_adapter->p_viport );\r
- viport_setPath( p_adapter->p_viport,\r
- &p_adapter->path_record.path_rec,\r
- &p_adapter->ioc_info.profile.ioc_guid );\r
- \r
- ib_status = viport_control_connect( p_adapter->p_viport );\r
+ \r
+ ib_status = adapter_netpath_update_and_connect( \r
+ p_adapter, p_path_record );\r
if( ib_status != IB_SUCCESS )\r
{\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("Control connect return %s\n", p_adapter->ifc.get_err_str( ib_status )) );\r
- vnic_viport_cleanup( p_adapter );\r
+ ("IOC[%d] adapter_netpath_update_and_connect return %s\n", \r
+ p_adapter->ioc_num,\r
+ p_adapter->ifc.get_err_str( ib_status )) );\r
break;\r
}\r
\r
- ib_status = viport_data_connect( p_adapter->p_viport );\r
- if( ib_status != IB_SUCCESS )\r
+ if( ( InterlockedCompareExchange( (volatile LONG *)&p_adapter->state, \r
+ INIC_REGISTERED, INIC_UNINITIALIZED ) == INIC_UNINITIALIZED )\r
+#if defined( LBFO_ENABLED )\r
+ || ( p_adapter->failover.fo_state == _ADAPTER_NOT_BUNDLED )\r
+#endif\r
+ )\r
{\r
- VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("Data path connect failed status %s\n",\r
- p_adapter->ifc.get_err_str( ib_status )) );\r
- vnic_viport_cleanup( p_adapter );\r
- break;\r
+#if defined( LBFO_ENABLED )\r
+ /* we don't look for zero id, since it meant to be primary by default */\r
+ if( p_adapter->failover.bundle_id != 0 && \r
+ ( p_primary_adapter = __adapter_find_on_failover_list( _ADAPTER_PRIMARY,\r
+ p_adapter->failover.bundle_id ) ) != NULL )\r
+ {\r
+ /* found matching primary */\r
+ __adapter_set_failover_secondary(\r
+ p_adapter, p_primary_adapter->h_handle );\r
+ }\r
+ else\r
+ {\r
+ /* bundle_id '0' , all go to primary */\r
+ __adapter_set_failover_primary( p_adapter, FALSE );\r
+ }\r
+#endif // LBFO_ENABLED\r
}\r
-\r
- p_adapter->state = INIC_REGISTERED;\r
break;\r
\r
case IB_PNP_IOC_PATH_REMOVE:\r
ntoh16( p_ioc_path->path.dlid ),\r
p_adapter->ioc_info.profile.id_string));\r
\r
- ib_status = __path_record_remove( p_adapter, &p_ioc_path->path );\r
- \r
- if ( ib_status != IB_SUCCESS )\r
+ p_path_record = __path_record_remove( p_adapter, &p_ioc_path->path );\r
+\r
+ if ( p_path_record != NULL )\r
{\r
+ int fail_over = 0;\r
+\r
+ if( p_adapter->p_currentPath->p_path_rec != &p_path_record->path_rec )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_INFO,\r
+ ("IOC[%d] Standby Path lost\n", p_adapter->ioc_num ));\r
+\r
+ if( p_adapter->p_currentPath != &p_adapter->primaryPath )\r
+ {\r
+ _adapter_netpath_free( p_adapter, &p_adapter->primaryPath );\r
+ }\r
+ else\r
+ {\r
+ _adapter_netpath_free( p_adapter, &p_adapter->secondaryPath );\r
+ }\r
+\r
+ cl_free( p_path_record );\r
+ break;\r
+ }\r
+\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("Failed to remove path record\n") );\r
+ ("IOC[%d]Current Path lost\n", p_adapter->ioc_num ));\r
+ \r
+ p_netpath = p_adapter->p_currentPath;\r
+ netpath_stopXmit( p_netpath );\r
+ viport_timerStop( p_netpath->pViport );\r
+\r
+ if( !p_adapter->params.SecondaryPath )\r
+ {\r
+ vnic_path_record_t* p_record;\r
+\r
+ netpath_linkDown( p_netpath );\r
+ _adapter_netpath_free(p_adapter, p_netpath );\r
+\r
+ p_record = __path_record_get( p_adapter );\r
+ if( p_record )\r
+ {\r
+ ib_status = adapter_netpath_update_and_connect( p_adapter, p_record );\r
+ }\r
+ \r
+ cl_free( p_path_record );\r
+ break;\r
+ }\r
+\r
+ if( p_netpath == &p_adapter->primaryPath )\r
+ {\r
+ if( netpath_is_connected( &p_adapter->secondaryPath ) )\r
+ {\r
+ netpath_stopXmit( &p_adapter->secondaryPath );\r
+ p_adapter->p_currentPath = &p_adapter->secondaryPath;\r
+ fail_over = 1;\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d]Switch to Secondary Path\n", p_adapter->ioc_num ));\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if( netpath_is_connected( &p_adapter->primaryPath ) )\r
+ {\r
+ netpath_stopXmit( &p_adapter->primaryPath );\r
+ p_adapter->p_currentPath = &p_adapter->primaryPath;\r
+ fail_over = 1;\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d]Switch to Primary Path\n", p_adapter->ioc_num ));\r
+ }\r
+ }\r
+ if( fail_over )\r
+ {\r
+ viport_setLink( p_adapter->p_currentPath->pViport,\r
+ INIC_FLAG_ENABLE_NIC| INIC_FLAG_SET_MTU,\r
+ (uint16_t)p_adapter->params.MinMtu, FALSE );\r
+ }\r
+\r
+ _adapter_netpath_free(p_adapter, p_netpath );\r
+ cl_free( p_path_record );\r
}\r
+\r
break;\r
\r
default:\r
}\r
\r
\r
-void\r
-vnic_viport_cleanup(\r
+static void\r
+__adapter_cleanup(\r
IN vnic_adapter_t *p_adapter )\r
{\r
- VNIC_ENTER( VNIC_DBG_ADAPTER );\r
+ __pending_queue_cleanup( p_adapter );\r
\r
- if ( p_adapter->p_viport )\r
- {\r
- if( ( InterlockedExchange( (volatile LONG *)&p_adapter->state,\r
- INIC_DEREGISTERING )) == INIC_DEREGISTERING )\r
- {\r
- VNIC_TRACE(VNIC_DBG_INIT,\r
- ("vnic viport cleanup - already destroying\n" ));\r
- return;\r
- }\r
- viport_timerStop( p_adapter->p_viport );\r
- InterlockedExchange( (volatile LONG *)&p_adapter->p_viport->disconnect, TRUE );\r
- viport_cleanup(p_adapter->p_viport );\r
- }\r
- p_adapter->p_viport = NULL;\r
+ __path_records_cleanup( p_adapter );\r
+\r
+ _adapter_netpath_free( p_adapter, &p_adapter->primaryPath );\r
+ _adapter_netpath_free( p_adapter, &p_adapter->secondaryPath );\r
\r
VNIC_EXIT( VNIC_DBG_ADAPTER );\r
}\r
{\r
vnic_adapter_t* p_adapter;\r
ib_api_status_t ib_status;\r
- ib_pnp_event_t state;\r
ib_pnp_req_t pnp_req;\r
- viport_t *p_viport;\r
+\r
+ NDIS_STATUS ndis_status = NDIS_STATUS_SUCCESS;\r
\r
VNIC_ENTER( VNIC_DBG_INIT );\r
\r
\r
CL_ASSERT( !p_adapter->h_pnp );\r
\r
+ /* Destroy port instances if still exist. */\r
+ __adapter_cleanup( p_adapter );\r
+ \r
if( p_adapter->pnp_state != IB_PNP_IOC_REMOVE )\r
- p_adapter->pnp_state = IB_PNP_IOC_ADD;\r
-\r
- state = p_adapter->pnp_state;\r
-\r
- /* Destroy the current port instance if it still exists. */\r
- p_viport = InterlockedExchangePointer( (void *)&p_adapter->p_viport, NULL );\r
-\r
- if( p_viport )\r
{\r
- viport_cleanup( p_viport );\r
- }\r
\r
- if( state != IB_PNP_IOC_REMOVE )\r
- {\r
/* Register for IOC events */\r
pnp_req.pfn_pnp_cb = __vnic_pnp_cb;\r
pnp_req.pnp_class = IB_PNP_IOC | IB_PNP_FLAG_REG_SYNC;\r
- pnp_req.pnp_context = p_adapter;\r
+ pnp_req.pnp_context = (const void *)p_adapter;\r
\r
ib_status = p_adapter->ifc.reg_pnp( p_adapter->h_al, &pnp_req, &p_adapter->h_pnp );\r
if( ib_status != IB_SUCCESS )\r
{\r
- p_adapter->reset = FALSE;\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
("pnp_reg returned %s\n",\r
p_adapter->ifc.get_err_str( ib_status )) );\r
- NdisMResetComplete( \r
- p_adapter->h_handle, NDIS_STATUS_HARD_ERRORS, TRUE );\r
+ ndis_status = NDIS_STATUS_HARD_ERRORS;\r
}\r
}\r
else\r
+ {\r
+ ndis_status = NDIS_STATUS_HARD_ERRORS;\r
+ }\r
+\r
+ if( p_adapter->reset )\r
{\r
p_adapter->reset = FALSE;\r
- NdisMResetComplete(\r
- p_adapter->h_handle, NDIS_STATUS_SUCCESS, TRUE );\r
- ib_status = IB_SUCCESS;\r
+ NdisMResetComplete( \r
+ p_adapter->h_handle, ndis_status, TRUE );\r
}\r
\r
VNIC_EXIT( VNIC_DBG_INIT );\r
\r
\r
ib_api_status_t\r
-vnic_reset_adapter(\r
+adapter_reset(\r
IN vnic_adapter_t* const p_adapter )\r
{\r
\r
ib_api_status_t status;\r
ib_pnp_handle_t h_pnp;\r
- ib_pnp_req_t pnp_req;\r
\r
VNIC_ENTER( VNIC_DBG_INIT );\r
\r
if( p_adapter->reset )\r
return IB_INVALID_STATE;\r
\r
- p_adapter->hung = 0;\r
p_adapter->reset = TRUE;\r
\r
+ __adapter_remove_from_failover_list( p_adapter );\r
+\r
if( p_adapter->h_pnp )\r
{\r
h_pnp = p_adapter->h_pnp;\r
p_adapter->h_pnp = NULL;\r
+\r
+ p_adapter->hung = 0;\r
status = p_adapter->ifc.dereg_pnp( h_pnp, __vnic_pnp_dereg_cb );\r
- if( status == IB_SUCCESS )\r
- status = IB_NOT_DONE;\r
}\r
else\r
{\r
- /* Register for IOC events */\r
- pnp_req.pfn_pnp_cb = __vnic_pnp_cb;\r
- pnp_req.pnp_class = IB_PNP_IOC | IB_PNP_FLAG_REG_SYNC;\r
- pnp_req.pnp_context = p_adapter;\r
+ status = IB_NOT_FOUND;\r
+ }\r
+\r
+ if( status == IB_SUCCESS )\r
+ status = IB_NOT_DONE;\r
+\r
+ VNIC_EXIT( VNIC_DBG_INIT );\r
+ return status;\r
+}\r
+\r
+static\r
+NDIS_STATUS\r
+_adapter_set_sg_size(\r
+ IN NDIS_HANDLE h_handle,\r
+ IN ULONG mtu_size )\r
+{\r
+ NDIS_STATUS status;\r
+ ULONG buf_size;\r
+\r
+ VNIC_ENTER( VNIC_DBG_INIT );\r
+\r
+ buf_size = mtu_size + ETH_VLAN_HLEN;\r
+\r
+ status = NdisMInitializeScatterGatherDma( h_handle, TRUE, buf_size );\r
+\r
+ if ( status != NDIS_STATUS_SUCCESS )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("Init ScatterGatherDma failed status %#x\n", status ) );\r
+ }\r
+\r
+ VNIC_EXIT( VNIC_DBG_INIT );\r
+ return status;\r
+}\r
+\r
+static ib_api_status_t\r
+_adapter_close_ca(\r
+ IN vnic_adapter_t* const p_adapter )\r
+{\r
+ ib_api_status_t ib_status = IB_SUCCESS;\r
+ ib_ca_handle_t h_ca;\r
+\r
+ VNIC_ENTER( VNIC_DBG_INIT );\r
\r
- status = p_adapter->ifc.reg_pnp( p_adapter->h_al, &pnp_req, &p_adapter->h_pnp );\r
- if( status == IB_SUCCESS )\r
+ if( !p_adapter )\r
+ return ib_status;\r
+\r
+ VNIC_TRACE(VNIC_DBG_INIT,\r
+ ("IOC[%d] Close CA\n", p_adapter->ioc_num ));\r
+\r
+ if( p_adapter->ca.region.h_mr )\r
+ {\r
+ ib_status = p_adapter->ifc.dereg_mr( p_adapter->ca.region.h_mr );\r
+ if( ib_status != IB_SUCCESS )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("Failed to dereg MR\n"));\r
+ }\r
+ p_adapter->ca.region.h_mr = NULL;\r
+ }\r
+\r
+ if( p_adapter->ca.hPd )\r
+ {\r
+ ib_status = p_adapter->ifc.dealloc_pd( p_adapter->ca.hPd, NULL );\r
+ if( ib_status != IB_SUCCESS )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("Failed to dealloc PD\n"));\r
+ }\r
+ p_adapter->ca.hPd = NULL;\r
+ }\r
+\r
+ if( ( h_ca = InterlockedExchangePointer( (void *)&p_adapter->h_ca, NULL ) ) != NULL )\r
+ {\r
+\r
+ ib_status = p_adapter->ifc.close_ca( h_ca, NULL );\r
+ if( ib_status != IB_SUCCESS )\r
{\r
- p_adapter->hung = FALSE;\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("Failed to close CA\n"));\r
}\r
}\r
+\r
VNIC_EXIT( VNIC_DBG_INIT );\r
+ return ib_status;\r
+}\r
+\r
+static \r
+ib_api_status_t\r
+_adapter_netpath_update(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN viport_t* const p_viport,\r
+ IN vnic_path_record_t* p_path )\r
+{\r
+\r
+ Netpath_t *p_netpath_init;\r
+\r
+ VNIC_ENTER( VNIC_DBG_PNP );\r
+\r
+ NdisAcquireSpinLock( &p_adapter->lock );\r
+ /* set primary first */\r
+ if( !netpath_is_valid( p_adapter->p_currentPath ) )\r
+ {\r
+ p_netpath_init = &p_adapter->primaryPath;\r
+ p_adapter->p_currentPath = p_netpath_init;\r
+ }\r
+\r
+ else \r
+ {\r
+ if( p_adapter->p_currentPath != &p_adapter->primaryPath )\r
+ {\r
+ p_netpath_init = &p_adapter->primaryPath;\r
+ }\r
+ else\r
+ {\r
+ p_netpath_init = &p_adapter->secondaryPath;\r
+ }\r
+ }\r
+\r
+ /* shouldn't really happened ?? */\r
+ if( netpath_is_connected( p_netpath_init ) )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_WARN,\r
+ ("No available Netpath found for update\n"));\r
+\r
+ NdisReleaseSpinLock( &p_adapter->lock );\r
+ return IB_NO_MATCH;\r
+ }\r
+\r
+ p_netpath_init->p_path_rec = &p_path->path_rec;\r
+\r
+ /* netpath initialization */\r
+\r
+ p_netpath_init->p_adapter = p_adapter;\r
+ p_netpath_init->pViport = p_viport;\r
+ p_netpath_init->carrier = FALSE;\r
+\r
+ /* viport initialization */\r
+ p_viport->p_netpath = p_netpath_init;\r
+\r
+ p_viport->portGuid = p_netpath_init->p_path_rec->sgid.unicast.interface_id;\r
+ p_viport->port_config.dataConfig.ibConfig.pathInfo = *p_netpath_init->p_path_rec;\r
+ p_viport->port_config.controlConfig.ibConfig.pathInfo = *p_netpath_init->p_path_rec;\r
+ \r
+ /* set our instance id per IOC */\r
+ p_viport->port_config.controlConfig.ibConfig.connData.inicInstance = (uint8_t)p_netpath_init->instance;\r
+ p_viport->port_config.dataConfig.ibConfig.connData.inicInstance = (uint8_t)p_netpath_init->instance;\r
+ /* save for later use */\r
+ p_viport->port_config.controlConfig.inicInstance = (uint8_t)p_netpath_init->instance;\r
+ \r
+ p_viport->iocGuid = p_adapter->ioc_info.profile.ioc_guid;\r
+ p_viport->port_config.controlConfig.ibConfig.sid = p_adapter->svc_entries[0].id;\r
+ p_viport->port_config.dataConfig.ibConfig.sid = p_adapter->svc_entries[1].id;\r
+\r
+ VNIC_TRACE( VNIC_DBG_INFO,\r
+ ("IOC[%d] instance %d [%s] is using SLID=%d DLID=%d Target:%s\n",\r
+ p_viport->ioc_num,\r
+ p_netpath_init->instance,\r
+ netpath_to_string( p_netpath_init ),\r
+ cl_ntoh16( p_path->path_rec.slid ),\r
+ cl_ntoh16( p_path->path_rec.dlid),\r
+ p_adapter->ioc_info.profile.id_string) );\r
+ \r
+ NdisReleaseSpinLock( &p_adapter->lock );\r
+\r
+ VNIC_EXIT( VNIC_DBG_PNP );\r
+ return IB_SUCCESS;\r
+}\r
+\r
+static\r
+ib_api_status_t\r
+adapter_netpath_update_and_connect(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN vnic_path_record_t* p_path )\r
+{\r
+ ib_api_status_t ib_status;\r
+ viport_t* p_viport;\r
+\r
+ ib_status = adapter_viport_allocate( p_adapter, &p_viport );\r
+ if( ib_status != IB_SUCCESS )\r
+ {\r
+ VNIC_TRACE ( VNIC_DBG_ERROR,\r
+ ("IOC[%] Viport allocate Failed status %s\n",\r
+ p_adapter->ioc_num, p_adapter->ifc.get_err_str( ib_status )) );\r
+ goto err;\r
+ }\r
+\r
+ ib_status = _adapter_open_ca( p_adapter );\r
+ if( ib_status != IB_SUCCESS )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d]Open CA failed %s\n", p_adapter->ioc_num,\r
+ p_adapter->ifc.get_err_str( ib_status )) );\r
+ goto err;\r
+ }\r
+\r
+ ib_status = _adapter_netpath_update( p_adapter, p_viport, p_path );\r
+ if( ib_status != IB_SUCCESS )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d]Update New Path failed %s\n", p_adapter->ioc_num,\r
+ p_adapter->ifc.get_err_str( ib_status )) );\r
+ goto err;\r
+ }\r
+\r
+ ib_status = viport_control_connect( p_viport );\r
+ if( ib_status != IB_SUCCESS )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d]Control QP connect return %s\n", p_adapter->ioc_num,\r
+ p_adapter->ifc.get_err_str( ib_status )) );\r
+ goto err;\r
+ }\r
+\r
+ /* should call this only once */\r
+ if( p_adapter->state == INIC_UNINITIALIZED )\r
+ {\r
+ if( _adapter_set_sg_size( p_adapter->h_handle, \r
+ p_adapter->params.MinMtu ) != NDIS_STATUS_SUCCESS )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d]ScatterGather Init using MTU size %d failed\n", p_adapter->ioc_num,\r
+ p_adapter->params.MinMtu ) );\r
+ goto err;\r
+ }\r
+ }\r
+\r
+ ib_status = viport_data_connect( p_viport );\r
+ if( ib_status != IB_SUCCESS )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d]Data QP connect return %s\n", p_adapter->ioc_num,\r
+ p_adapter->ifc.get_err_str( ib_status )) );\r
+ goto err;\r
+ }\r
+ \r
+ VNIC_TRACE( VNIC_DBG_INFO,\r
+ ("IOC[%d] instance %d %s is CONNECTED\n",\r
+ p_viport->ioc_num,\r
+ p_viport->p_netpath->instance,\r
+ netpath_to_string( p_viport->p_netpath ) ));\r
+\r
+ p_adapter->num_paths++;\r
+\r
+ if( p_adapter->num_paths > 1 &&\r
+ p_viport->p_netpath != p_adapter->p_currentPath )\r
+ {\r
+ if ( !netpath_setUnicast( p_viport->p_netpath, \r
+ p_adapter->p_currentPath->pViport->hwMacAddress ) )\r
+ {\r
+ ib_status = IB_ERROR;\r
+ goto err;\r
+ }\r
+ }\r
+\r
+ return ib_status;\r
+\r
+err:\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d] allocate return %#x (%s)\n", p_adapter->ioc_num,\r
+ ib_status, p_adapter->ifc.get_err_str( ib_status )) );\r
+\r
+ if( p_viport != NULL && \r
+ p_viport->p_netpath != NULL )\r
+ {\r
+ netpath_free( p_viport->p_netpath );\r
+ }\r
+ return ib_status;\r
+}\r
+\r
+#if defined( LBFO_ENABLED )\r
+\r
+static void\r
+__adapter_add_to_failover_list(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN lbfo_state_t state )\r
+{\r
+\r
+ CL_ASSERT( p_adapter );\r
+ CL_ASSERT( state == _ADAPTER_PRIMARY || state == _ADAPTER_SECONDARY );\r
+\r
+ p_adapter->failover.fo_state = state;\r
+\r
+ if( state == _ADAPTER_PRIMARY )\r
+ { \r
+ p_adapter->failover.primary_handle = p_adapter;\r
+ cl_qlist_insert_tail( &g_vnic.primary_list, &p_adapter->list_item );\r
+ }\r
+ else\r
+ {\r
+ cl_qlist_insert_tail( &g_vnic.secondary_list, &p_adapter->list_item );\r
+ }\r
+}\r
+\r
+static void\r
+__adapter_remove_from_failover_list(\r
+ IN vnic_adapter_t* const p_adapter )\r
+{\r
+ lbfo_state_t lbfo_state;\r
+ vnic_adapter_t *p_adapter_to_promote;\r
+ uint32_t bundle_id;\r
+\r
+ CL_ASSERT( p_adapter );\r
+\r
+ lbfo_state = p_adapter->failover.fo_state;\r
+ p_adapter->failover.fo_state = _ADAPTER_NOT_BUNDLED;\r
+ bundle_id = p_adapter->failover.bundle_id;\r
+\r
+ if( lbfo_state == _ADAPTER_PRIMARY )\r
+ {\r
+ cl_qlist_remove_item( &g_vnic.primary_list, &p_adapter->list_item );\r
+ NdisMRemoveMiniport( p_adapter->h_handle );\r
+\r
+ /* search for secondary adapter with same id && (id != 0 ) */\r
+ if( bundle_id != 0 )\r
+ {\r
+ p_adapter_to_promote =\r
+ __adapter_find_on_failover_list( _ADAPTER_SECONDARY, bundle_id );\r
+ \r
+ if( p_adapter_to_promote &&\r
+ p_adapter_to_promote->pnp_state != IB_PNP_IOC_REMOVE &&\r
+ ( p_adapter_to_promote->reset == FALSE || \r
+ p_adapter_to_promote->hung < p_adapter_to_promote->num_paths ) )\r
+ {\r
+ /* a small recursion */\r
+ __adapter_set_failover_primary( p_adapter_to_promote, TRUE );\r
+ }\r
+ }\r
+ }\r
+ else if( lbfo_state == _ADAPTER_SECONDARY )\r
+ {\r
+ cl_qlist_remove_item( &g_vnic.secondary_list, &p_adapter->list_item );\r
+ VNIC_TRACE( VNIC_DBG_INFO,\r
+ ("IOC[%d] LBFO bundle %d Secondary Adapter Removed\n", \r
+ p_adapter->ioc_num, p_adapter->failover.bundle_id ));\r
+ }\r
+ else\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d] Adapter not bundled\n", p_adapter->ioc_num ));\r
+\r
+ return;\r
+}\r
+\r
+\r
+static vnic_adapter_t*\r
+__adapter_find_on_failover_list(\r
+ IN lbfo_state_t list_flag,\r
+ IN uint32_t bundle_id )\r
+{\r
+ vnic_adapter_t *p_adapter = NULL;\r
+ cl_list_item_t *p_item;\r
+ cl_qlist_t *p_qlist = ( list_flag == _ADAPTER_PRIMARY ) ?\r
+ &g_vnic.primary_list : &g_vnic.secondary_list;\r
+ \r
+ p_item = cl_qlist_head( p_qlist );\r
+\r
+ while( p_item != cl_qlist_end( p_qlist ) )\r
+ {\r
+ p_adapter = PARENT_STRUCT( p_item, vnic_adapter_t, list_item );\r
+\r
+ if( p_adapter &&\r
+ p_adapter->failover.bundle_id == bundle_id )\r
+ {\r
+ return p_adapter;\r
+ }\r
+\r
+ p_item = cl_qlist_next( p_item );\r
+ }\r
+ return NULL;\r
+}\r
+\r
+static NDIS_STATUS\r
+__adapter_set_failover_primary(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN BOOLEAN promote_secondary )\r
+{\r
+ NDIS_STATUS status = NDIS_STATUS_SUCCESS;\r
+ \r
+ CL_ASSERT( p_adapter );\r
+ \r
+ if( promote_secondary )\r
+ {\r
+ if( p_adapter->failover.fo_state != _ADAPTER_SECONDARY )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("LBFO Can't promote NON_SECONDARY\n"));\r
+ return NDIS_STATUS_NOT_ACCEPTED;\r
+ }\r
+ __adapter_remove_from_failover_list( p_adapter );\r
+ status = NdisMPromoteMiniport( p_adapter->h_handle );\r
+ }\r
+\r
+ if( status == NDIS_STATUS_SUCCESS )\r
+ {\r
+ p_adapter->failover.p_adapter = p_adapter;\r
+ p_adapter->failover.fo_state = _ADAPTER_PRIMARY;\r
+ p_adapter->failover.primary_handle = p_adapter->h_handle;\r
+ __adapter_add_to_failover_list( p_adapter, _ADAPTER_PRIMARY );\r
+\r
+ VNIC_TRACE( VNIC_DBG_INFO,\r
+ ("IOC[%d] Set LBFO bundle %d Primary Adapter\n", \r
+ p_adapter->ioc_num, p_adapter->failover.bundle_id ));\r
+ }\r
+ else\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("LBFO Set to Primary Failed\n"));\r
+\r
return status;\r
}\r
+\r
+static NDIS_STATUS\r
+__adapter_set_failover_secondary(\r
+ IN vnic_adapter_t* const p_adapter,\r
+ IN NDIS_HANDLE primary_handle )\r
+{\r
+ NDIS_STATUS status;\r
+\r
+ CL_ASSERT( p_adapter );\r
+\r
+ status = NdisMSetMiniportSecondary( p_adapter->h_handle, primary_handle );\r
+ \r
+ if ( status == NDIS_STATUS_SUCCESS )\r
+ {\r
+ p_adapter->failover.fo_state = _ADAPTER_SECONDARY;\r
+ p_adapter->failover.primary_handle = primary_handle;\r
+ __adapter_add_to_failover_list( p_adapter, _ADAPTER_SECONDARY );\r
+\r
+ VNIC_TRACE( VNIC_DBG_INFO,\r
+ ("IOC[%d] Set LBFO bundle %d Secondary Adapter\n", \r
+ p_adapter->ioc_num, p_adapter->failover.bundle_id ));\r
+ }\r
+\r
+ return status;\r
+}\r
+\r
+#endif //LBFO_ENABLED\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
\r
} ipv4_address_item_t;\r
\r
+typedef struct _lbfo_failover {\r
+ struct _vnic_adapter *p_adapter;\r
+ NDIS_HANDLE primary_handle;\r
+ uint32_t bundle_id;\r
+ lbfo_state_t fo_state;\r
+} lbfo_failover_t;\r
+\r
typedef struct _vnic_params {\r
uint32_t MaxAddressEntries;\r
uint32_t MinAddressEntries;\r
uint32_t DefaultPreferPrimary;\r
uint32_t UseRxCsum;\r
uint32_t UseTxCsum;\r
+ uint32_t VlanInfo;\r
+ uint32_t SecondaryPath;\r
+ uint32_t bundle_id;\r
mac_addr_t conf_mac;\r
} vnic_params_t;\r
\r
\r
typedef struct _vnic_adapter {\r
- LIST_ENTRY list_entry;\r
+ cl_list_item_t list_item;\r
NDIS_HANDLE h_handle;\r
DEVICE_OBJECT *p_pdo;\r
NDIS_SPIN_LOCK lock;\r
ib_al_ifc_t ifc;\r
ioc_ifc_data_t ifc_data;\r
ib_ioc_info_t ioc_info;\r
- vnic_path_record_t path_record;\r
+ LIST_ENTRY send_pending_list;\r
+ LIST_ENTRY cancel_send_list;\r
+ NDIS_SPIN_LOCK pending_list_lock;\r
+ NDIS_SPIN_LOCK cancel_list_lock;\r
+ NDIS_SPIN_LOCK path_records_lock;\r
+ cl_qlist_t path_records_list;\r
ib_al_handle_t h_al;\r
ib_ca_handle_t h_ca;\r
ib_pnp_handle_t h_pnp;\r
ib_pnp_event_t pnp_state;\r
IbCa_t ca;\r
- struct _viport *p_viport;\r
InicState_t state;\r
struct Netpath primaryPath;\r
struct Netpath secondaryPath;\r
struct Netpath *p_currentPath;\r
vnic_params_t params;\r
- int open;\r
+ int num_paths;\r
int macSet;\r
int mc_count;\r
mac_addr_t mcast_array[MAX_MCAST];\r
uint32_t ioc_num;\r
uint32_t link_speed;\r
uint32_t packet_filter;\r
+ uint32_t vlan_info;\r
int hung;\r
BOOLEAN reset;\r
- int pending_set;\r
+ BOOLEAN pending_set;\r
BOOLEAN pending_query;\r
pending_oid_t query_oid;\r
pending_oid_t set_oid;\r
- uint8_t num_svc_entries;\r
- ib_svc_entry_t *p_svc_entries;\r
- char name[65];\r
- InicNPEvent_t np_event[INICNP_NUM_EVENTS];\r
+ ib_svc_entry_t svc_entries[2];\r
+\r
+#if defined( LBFO_ENABLED )\r
+ lbfo_failover_t failover;\r
+#endif\r
#ifdef VNIC_STATISTIC\r
struct {\r
uint64_t startTime;\r
IN vnic_adapter_t *p_adapter);\r
\r
NDIS_STATUS\r
-vnic_set_mcast(\r
+adapter_set_mcast(\r
IN vnic_adapter_t* const p_adapter,\r
IN mac_addr_t* const p_mac_array,\r
IN const uint8_t mc_count );\r
\r
ib_api_status_t\r
-vnic_viport_allocate(\r
+adapter_viport_allocate(\r
IN vnic_adapter_t* const p_adapter,\r
IN OUT viport_t** const pp_viport );\r
\r
-void\r
-vnic_viport_cleanup(\r
- IN vnic_adapter_t *p_adapter );\r
-\r
void\r
vnic_resume_set_oids(\r
IN vnic_adapter_t* const p_adapter );\r
IN void* context );\r
\r
ib_api_status_t\r
-vnic_reset_adapter(\r
+adapter_reset(\r
IN vnic_adapter_t* const p_adapter );\r
+void\r
+__pending_queue_cleanup( \r
+ IN vnic_adapter_t *p_adapter );\r
\r
#endif /* !defined _VNIC_ADAPTER_H_ */\r
+/*\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
#ifndef _VNIC_CONFIG_H_\r
#define _VNIC_CONFIG_H_\r
\r
#define INIC_MAJORVERSION 1\r
#define INIC_MINORVERSION 1\r
\r
+#define LIMIT_OUTSTANDING_SENDS 0\r
+\r
#define MAX_ADDRESS_ENTRIES 64 /* max entries to negotiate with remote */\r
#define MIN_ADDRESS_ENTRIES 16 /* min entries remote can return to us that we agree with */\r
#define MAX_ADDR_ARRAY 32 /* address array we can handle. for now */\r
some later will be converted to microseconds */\r
#define VIPORT_STATS_INTERVAL 5000 /* 5 sec */\r
#define VIPORT_HEARTBEAT_INTERVAL 2000 /* 2 seconds */\r
-#define VIPORT_HEARTBEAT_TIMEOUT 64000 /* 64 sec */\r
+#define VIPORT_HEARTBEAT_TIMEOUT 60000 /* 60 sec */\r
#define CONTROL_RSP_TIMEOUT 2000 /* 2 sec */\r
\r
#define _100NS_IN_1MS (10000)\r
#define U8_ZERO_RANGE(x) ZERO_RANGE_CHECK(x, 0, 0xFF)\r
#define U8_RANGE(x) RANGE_CHECK(x, 1, 0xFF)\r
\r
+enum {\r
+ INDEX_RESERVED,\r
+ INDEX_MIN_HOST_POOL_SZ,\r
+ INDEX_HOST_RECV_POOL_ENTRIES,\r
+ INDEX_MIN_EIOC_POOL_SZ,\r
+ INDEX_MAX_EIOC_POOL_SZ,\r
+ INDEX_MIN_HOST_KICK_TIMEOUT,\r
+ INDEX_MAX_HOST_KICK_TIMEOUT,\r
+ INDEX_MIN_HOST_KICK_ENTRIES,\r
+ INDEX_MAX_HOST_KICK_ENTRIES,\r
+ INDEX_MIN_HOST_KICK_BYTES,\r
+ INDEX_MAX_HOST_KICK_BYTES,\r
+ INDEX_MIN_HOST_UPDATE_SZ,\r
+ INDEX_MAX_HOST_UPDATE_SZ,\r
+ INDEX_MIN_EIOC_UPDATE_SZ,\r
+ INDEX_MAX_EIOC_UPDATE_SZ,\r
+ INDEX_HEARTBEAT_TIMEOUT,\r
+ INDEX_LAST // keep it the last entry\r
+};\r
+\r
+typedef struct _g_registry_params {\r
+ PWSTR name;\r
+ uint32_t value;\r
+}g_registry_params_t;\r
+\r
+#define ENTRY_INIT_VALUE MAXULONG\r
+#define VNIC_REGISTRY_TBL_SIZE INDEX_LAST\r
\r
typedef struct {\r
uint64_t ioc_guid;\r
} PathParam_t;\r
\r
typedef struct _vnic_globals {\r
- NDIS_HANDLE ndis_handle; // ndis wrapper handle\r
- volatile LONG dev_reg; // dev register counter\r
- volatile LONG adapters; // created adapters counter\r
- KSPIN_LOCK lock;\r
- LIST_ENTRY adapter_list;\r
- uint8_t host_name[IB_NODE_DESCRIPTION_SIZE + 1];\r
+ NDIS_HANDLE ndis_handle; // ndis wrapper handle\r
+ NDIS_SPIN_LOCK lock;\r
+#if defined (LBFO_ENABLED)\r
+ cl_qlist_t primary_list;\r
+ cl_qlist_t secondary_list;\r
+#endif\r
+ uint32_t shutdown;\r
+ uint8_t host_name[IB_NODE_DESCRIPTION_SIZE];\r
+ g_registry_params_t *p_params;\r
} vnic_globals_t;\r
-/*\r
-struct members:\r
- lock:\r
- take this lock before access to adapter_list\r
- adapter_list:\r
- head of list of virtual adapters initialized by driver\r
-*/\r
\r
typedef struct IbConfig {\r
ib_path_rec_t pathInfo;\r
uint32_t hbTimeout; /* heartbeat timeout */\r
uint64_t portGuid;\r
uint64_t guid;\r
- size_t pathIdx;\r
+ size_t instance;\r
char ioc_string[65];\r
\r
#define HB_INTERVAL_OVERRIDE 0x1\r
* give the primary?\r
* primaryReconnectTimeout - Same as above, but used when recovering when\r
* both paths fail\r
- * primaryReconnectTimeout - How long do we wait before switching to the\r
+ * primarySwitchTimeout - How long do we wait before switching to the\r
* primary when it comes back?\r
*/\r
#define IFNAMSIZ 65\r
INIC_REGISTERED,\r
} InicState_t;\r
\r
+typedef enum {\r
+ _ADAPTER_NOT_BUNDLED = 0,\r
+ _ADAPTER_PRIMARY,\r
+ _ADAPTER_SECONDARY\r
+} lbfo_state_t;\r
+\r
#endif /* _VNIC_CONFIG_H_ */\r
\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
\r
ibqp_cleanup( &pControl->qp );\r
cl_free( pControl->pLocalStorage );\r
+ pControl->pLocalStorage = NULL;\r
goto failure;\r
}\r
pIo = &pControl->sendIo.io;\r
{\r
control_cleanup( pControl );\r
ib_status = IB_ERROR;\r
- goto failure;\r
+ break;\r
}\r
}\r
\r
{\r
case INIC_STATUS_LINK_UP:\r
VNIC_TRACE( VNIC_DBG_CTRL,\r
- ("IOC %d: Link Up\n", pControl->p_viport->ioc_num ) );\r
- /* renew link speed info */\r
+ ("IOC %d: STATUS LINK UP\n", pControl->p_viport->ioc_num ) );\r
+ /* renew link speed info since it can change */\r
pControl->p_viport->p_adapter->link_speed =\r
ntoh32( pPkt->cmd.reportStatus.statusInfo );\r
viport_linkUp( pControl->p_viport );\r
\r
case INIC_STATUS_LINK_DOWN:\r
VNIC_TRACE( VNIC_DBG_CTRL,\r
- ("IOC %d: Link Down\n", pControl->p_viport->ioc_num ) );\r
+ ("IOC %d: STATUS LINK DOWN\n", pControl->p_viport->ioc_num ) );\r
\r
viport_linkDown( pControl->p_viport );\r
break;\r
-\r
+ case INIC_STATUS_EIOC_ERROR:\r
+ case INIC_STATUS_EIOC_SHUTDOWN:\r
+ viport_failure( pControl->p_viport );\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC %d: STATUS EIOC ERROR\n",\r
+ pControl->p_viport->ioc_num ) );\r
+ break;\r
default:\r
VNIC_TRACE( VNIC_DBG_CTRL | VNIC_DBG_ERROR,\r
- ("IOC %d: Asynchronous status received from EIOC\n",\r
- pControl->p_viport->ioc_num ) );\r
+ ("IOC %d: Asynchronous status %#x received\n",\r
+ pControl->p_viport->ioc_num,\r
+ ntoh32(pPkt->cmd.reportStatus.statusNumber)) );\r
__control_logControlPacket( pPkt );\r
break;\r
}\r
( pPkt->cmd.reportStatus.isFatal ) )\r
{\r
viport_failure( pControl->p_viport );\r
+ break;\r
}\r
\r
control_recv( pControl, pRecvIo );\r
__control_logControlPacket( pPkt );\r
goto failure;\r
}\r
+#ifdef _DEBUG_\r
+ VNIC_TRACE( VNIC_DBG_CTRL_PKT,\r
+ ("IOC %d: instance %d Sent initINIC request:\n",\r
+ pControl->p_viport->ioc_num,\r
+ pControl->p_viport->p_netpath->instance ) );\r
+ __control_logControlPacket( control_lastReq( pControl ) );\r
+ \r
+ VNIC_TRACE(VNIC_DBG_CTRL_PKT,\r
+ ("IOC %d: instance %d Received initInic response:\n",\r
+ pControl->p_viport->ioc_num,\r
+ pControl->p_viport->p_netpath->instance ) );\r
+ __control_logControlPacket( pPkt );\r
+#endif\r
+\r
pInitInicRsp = &pPkt->cmd.initInicRsp;\r
pControl->majVer = ntoh16( pInitInicRsp->inicMajorVersion );\r
pControl->minVer = ntoh16( pInitInicRsp->inicMinorVersion );\r
__control_logControlPacket( pPkt );\r
goto failure;\r
}\r
-\r
+#ifdef _DEBUG_\r
+ VNIC_TRACE( VNIC_DBG_CTRL_PKT,\r
+ ("IOC %d: instance %d Sent configDATAPATH request:\n",\r
+ pControl->p_viport->ioc_num,\r
+ pControl->p_viport->p_netpath->instance ) );\r
+ __control_logControlPacket( control_lastReq( pControl ) );\r
+ \r
+ VNIC_TRACE(VNIC_DBG_CTRL_PKT,\r
+ ("IOC %d: instance %d Received configDATAPATH response:\n",\r
+ pControl->p_viport->ioc_num,\r
+ pControl->p_viport->p_netpath->instance ) );\r
+ __control_logControlPacket( pPkt );\r
+#endif\r
pConfigDataPath = &pPkt->cmd.configDataPathRsp;\r
\r
if ( pConfigDataPath->dataPath != 0 )\r
goto failure;\r
}\r
\r
+#ifdef _DEBUG_\r
+ VNIC_TRACE( VNIC_DBG_CTRL_PKT,\r
+ ("IOC %d: instance %d Sent exchangePOOLS request:\n",\r
+ pControl->p_viport->ioc_num,\r
+ pControl->p_viport->p_netpath->instance ) );\r
+ __control_logControlPacket( control_lastReq( pControl ) );\r
+ \r
+ VNIC_TRACE(VNIC_DBG_CTRL_PKT,\r
+ ("IOC %d: instance %d Received exchangePOOLS response:\n",\r
+ pControl->p_viport->ioc_num,\r
+ pControl->p_viport->p_netpath->instance ) );\r
+ __control_logControlPacket( pPkt );\r
+#endif\r
pExchangePools = &pPkt->cmd.exchangePoolsRsp;\r
*pRkey = pExchangePools->poolRKey;\r
*pAddr = ntoh64( pExchangePools->poolAddr );\r
pConfigLinkReq = &pPkt->cmd.configLinkReq;\r
NdisZeroMemory( pConfigLinkReq, sizeof( Inic_CmdConfigLink_t ) );\r
pConfigLinkReq->lanSwitchNum = pControl->lanSwitch.lanSwitchNum;\r
- pConfigLinkReq->cmdFlags = INIC_FLAG_SET_MTU;\r
\r
if ( flags & INIC_FLAG_ENABLE_NIC )\r
{\r
{\r
pConfigLinkReq->cmdFlags |= INIC_FLAG_DISABLE_PROMISC;\r
}\r
- pConfigLinkReq->mtuSize = hton16( mtu );\r
+\r
+ if( flags & INIC_FLAG_SET_MTU )\r
+ {\r
+ pConfigLinkReq->cmdFlags |= INIC_FLAG_SET_MTU;\r
+ pConfigLinkReq->mtuSize = hton16( mtu );\r
+ }\r
\r
ib_status = control_send( pControl );\r
VNIC_EXIT( VNIC_DBG_CTRL );\r
__control_logControlPacket( pPkt );\r
goto failure;\r
}\r
-\r
+#ifdef _DEBUG_\r
+ VNIC_TRACE( VNIC_DBG_CTRL_PKT,\r
+ ("IOC %d: instance %d Sent configLINK request:\n",\r
+ pControl->p_viport->ioc_num,\r
+ pControl->p_viport->p_netpath->instance ) );\r
+ __control_logControlPacket( control_lastReq( pControl ) );\r
+ \r
+ VNIC_TRACE(VNIC_DBG_CTRL_PKT,\r
+ ("IOC %d: instance %d Received configLINK response:\n",\r
+ pControl->p_viport->ioc_num,\r
+ pControl->p_viport->p_netpath->instance ) );\r
+ __control_logControlPacket( pPkt );\r
+#endif\r
pConfigLinkRsp = &pPkt->cmd.configLinkRsp;\r
\r
*pFlags = pConfigLinkRsp->cmdFlags;\r
goto failure;\r
}\r
\r
+#ifdef _DEBUG_\r
+ VNIC_TRACE( VNIC_DBG_CTRL_PKT,\r
+ ("IOC %d: instance %d Sent configADDRS request:\n",\r
+ pControl->p_viport->ioc_num,\r
+ pControl->p_viport->p_netpath->instance ) );\r
+ __control_logControlPacket( control_lastReq( pControl ) );\r
+ \r
+ VNIC_TRACE(VNIC_DBG_CTRL_PKT,\r
+ ("IOC %d: instance %d Received configADDRS response:\n",\r
+ pControl->p_viport->ioc_num,\r
+ pControl->p_viport->p_netpath->instance ) );\r
+ __control_logControlPacket( pPkt );\r
+#endif\r
+\r
pConfigAddrsRsp = &pPkt->cmd.configAddressesRsp;\r
\r
control_recv( pControl, pRecvIo );\r
\r
if( p_viport->flags & INIC_FLAG_ENABLE_NIC )\r
{\r
- InterlockedExchange( &p_viport->p_netpath->carrier, TRUE );\r
/* don't indicate media state yet if in sync query */\r
- if( !( p_viport->updates & SYNC_QUERY ) )\r
+ if( ( InterlockedExchange( &p_viport->p_netpath->carrier, TRUE ) == FALSE ) &&\r
+ !( p_viport->updates & SYNC_QUERY ) )\r
{ \r
- viport_linkUp( p_viport );\r
+ viport_restartXmit( p_viport );\r
+ //viport_linkUp( p_viport );\r
}\r
}\r
- else\r
+ else if( p_viport->flags & INIC_FLAG_DISABLE_NIC )\r
{\r
- InterlockedExchange( &p_viport->p_netpath->carrier, FALSE );\r
- viport_linkDown( p_viport );\r
+ if( InterlockedExchange( &p_viport->p_netpath->carrier, FALSE ) == TRUE )\r
+ {\r
+ viport_stopXmit( p_viport );\r
+ viport_linkDown( p_viport );\r
+ }\r
}\r
InterlockedAnd( &p_viport->updates, ~NEED_LINK_CONFIG );\r
}\r
default:\r
break;\r
}\r
-\r
- if( _viport_process_query( p_viport, FALSE ) == STATUS_SUCCESS )\r
+ \r
+ if( _viport_process_query( p_viport, FALSE ) != NDIS_STATUS_PENDING )\r
{\r
/* Complete any pending set OID. */\r
vnic_resume_set_oids( p_viport->p_adapter );\r
}\r
\r
if( InterlockedAnd( &p_viport->updates, ~SYNC_QUERY ) & SYNC_QUERY )\r
- cl_event_signal( &p_viport->conn_event );\r
+ cl_event_signal( &p_viport->sync_event );\r
}\r
\r
\r
}\r
\r
#ifdef _DEBUG_\r
- __control_logControlPacket( pPkt );\r
+ //__control_logControlPacket( pPkt );\r
#endif\r
\r
InterlockedExchange( (volatile LONG*)&pControl->rspExpected,\r
Inic_ControlPacket_t *pPkt = control_packet( &pControl->sendIo );\r
Inic_ControlHeader_t *pHdr = &pPkt->hdr;\r
\r
- VNIC_TRACE( VNIC_DBG_CTRL| VNIC_DBG_ERROR,\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
("IOC %d: No response received from EIOC\n",\r
pControl->p_viport->ioc_num ) );\r
#ifdef VNIC_STATISTIC\r
\r
if ( pControl->reqRetryCounter >= pControl->p_conf->reqRetryCount )\r
{\r
- VNIC_TRACE( VNIC_DBG_CTRL| VNIC_DBG_ERROR,\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
("IOC %d: Control packet retry exceeded\n",\r
pControl->p_viport->ioc_num ) );\r
viport_failure(pControl->p_viport );\r
\r
if (value > *p_max )\r
{\r
- VNIC_TRACE( VNIC_DBG_CTRL| VNIC_DBG_ERROR,\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
("Value %s too large\n", name) );\r
return FALSE;\r
}\r
else if (value < *p_min )\r
{\r
- VNIC_TRACE( VNIC_DBG_CTRL| VNIC_DBG_ERROR,\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
("Value %s too small\n", name) );\r
return FALSE;\r
}\r
\r
if ( !IsPowerOf2( pDst->numRecvPoolEntries ) )\r
{\r
- VNIC_TRACE( VNIC_DBG_CTRL| VNIC_DBG_ERROR,\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
("numRecvPoolEntries (%d) must be power of 2\n",\r
pDst->numRecvPoolEntries) );\r
return FALSE;\r
}\r
if ( !IsPowerOf2( pDst->freeRecvPoolEntriesPerUpdate ) )\r
{\r
- VNIC_TRACE( VNIC_DBG_CTRL| VNIC_DBG_ERROR,\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
("freeRecvPoolEntriesPerUpdate (%d) must be power of 2\n",\r
pDst->freeRecvPoolEntriesPerUpdate) );\r
return FALSE;\r
}\r
if ( pDst->freeRecvPoolEntriesPerUpdate >= pDst->numRecvPoolEntries )\r
{\r
- VNIC_TRACE( VNIC_DBG_CTRL| VNIC_DBG_ERROR,\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
("freeRecvPoolEntriesPerUpdate (%d) must be less than numRecvPoolEntries (%d)\n",\r
pDst->freeRecvPoolEntriesPerUpdate, pDst->numRecvPoolEntries) );\r
return FALSE;\r
}\r
if ( pDst->numRecvPoolEntriesBeforeKick >= pDst->numRecvPoolEntries )\r
{\r
- VNIC_TRACE( VNIC_DBG_CTRL| VNIC_DBG_ERROR,\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
("numRecvPoolEntriesBeforeKick (%d) must be less than numRecvPoolEntries (%d)\n",\r
pDst->numRecvPoolEntriesBeforeKick, pDst->numRecvPoolEntries) );\r
return FALSE;\r
case CMD_INIT_INIC:\r
VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
("ControlPacket: pktType = %s, pktCmd = CMD_INIT_INIC\n", type ) );\r
- VNIC_PRINT( VNIC_DBG_CTRL,\r
+ VNIC_PRINT( VNIC_DBG_CTRL_PKT,\r
(" pktSeqNum = %u, pktRetryCount = %u\n",\r
pPkt->hdr.pktSeqNum,\r
pPkt->hdr.pktRetryCount) );\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
#define INIC_FEAT_CHASH_OFFLOAD 0x00004000\r
#define INIC_FEAT_RDMA_IMMED 0x00008000 \r
#define INIC_FEAT_IGNORE_VLAN 0x00010000\r
+#define INIC_FEAT_INBOUND_IB_MC 0x00200000\r
\r
/* pktCmd CMD_CONFIG_DATA_PATH subdata format */\r
typedef struct Inic_RecvPoolConfig {\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
BufferPoolEntry_t *pBpe,\r
RdmaIo_t *pRdmaIo );\r
static \r
-NDIS_PACKET *\r
+BOOLEAN\r
_data_recv_to_ndis_pkt( \r
Data_t *pData,\r
RdmaDest_t *pRdmaDest );\r
_tx_chksum_flags(\r
IN NDIS_PACKET* const p_packet );\r
\r
-\r
-static void\r
-_get_first_buffer(\r
- IN NDIS_PACKET *p_packet,\r
- IN OUT NDIS_BUFFER **pp_buf_desc,\r
- OUT void **pp_buf,\r
- OUT ULONG *p_packet_sz );\r
-\r
static void\r
_data_return_recv(\r
IN NDIS_PACKET *p_packet );\r
pData->p_viport = pViport;\r
pData->p_phy_region = &pViport->p_adapter->ca.region;\r
InitializeListHead( &pData->recvIos );\r
- KeInitializeSpinLock ( &pData->recvIosLock );\r
- KeInitializeSpinLock ( &pData->xmitBufLock );\r
+ KeInitializeSpinLock( &pData->recvListLock );\r
+ NdisAllocateSpinLock( &pData->recvIosLock );\r
+ NdisAllocateSpinLock( &pData->xmitBufLock );\r
cl_timer_construct( &pData->kickTimer );\r
\r
ibqp_construct( &pData->qp, pViport );\r
pXmitPool->notifyBundle = pData->p_conf->notifyBundle;\r
pXmitPool->nextXmitPool = 0;\r
\r
-#if TRUE // LIMIT_OUTSTANDING_SENDS\r
+#if LIMIT_OUTSTANDING_SENDS\r
pXmitPool->numXmitBufs = pXmitPool->notifyBundle * 2;\r
#else /* !LIMIT_OUTSTANDING_SENDS */\r
pXmitPool->numXmitBufs = pXmitPool->poolSz;\r
pRecvIo[i].dsList.length = 4;\r
pRecvIo[i].dsList.vaddr = PTR64( pRegionData );\r
pRecvIo[i].dsList.lkey = pData->region.lkey;\r
- \r
- ExInterlockedInsertTailList( &pData->recvIos, &pRecvIo[i].io.listPtrs, &pData->recvIosLock );\r
+ \r
+ InitializeListHead( &pRecvIo[i].io.listPtrs );\r
+ ExInterlockedInsertTailList( &pData->recvIos, &pRecvIo[i].io.listPtrs, &pData->recvListLock );\r
/* Do not need to move pointer since the receive info\r
* is not read. Note, we could reduce the amount\r
* of memory allocated and the size of the region.\r
for ( i = 0; i < pRecvPool->poolSz; i++ )\r
{\r
pRdmaDest = &pRecvPool->pRecvBufs[i];\r
+ pRdmaDest->p_viport = pData->p_viport;\r
pRdmaDest->data = pData->p_recv_bufs + (i * pRecvPool->bufferSz );\r
pRdmaDest->region = pData->rbuf_region;\r
InsertTailList( &pRecvPool->availRecvBufs, &pRdmaDest->listPtrs );\r
}\r
\r
\r
-void\r
+ib_api_status_t\r
data_connected(\r
IN Data_t *pData )\r
{\r
\r
_data_allocBuffers(pData, TRUE);\r
_data_sendFreeRecvBuffers(pData);\r
+ \r
+ if( pData->p_viport->errored )\r
+ {\r
+ return IB_ERROR;\r
+ }\r
+ \r
pData->connected = TRUE;\r
\r
VNIC_EXIT( VNIC_DBG_DATA );\r
- return;\r
+ return IB_SUCCESS;\r
}\r
\r
void\r
RecvPool_t *pRecvPool = &pData->recvPool;\r
viport_t *p_viport = pData->p_viport;\r
NDIS_PACKET *p_packet;\r
- LIST_ENTRY *p_list_item;\r
+ NDIS_BUFFER *p_buf;\r
unsigned int i;\r
\r
VNIC_ENTER( VNIC_DBG_DATA );\r
if ( p_packet != NULL )\r
{\r
pRecvPool->pRecvBufs[i].p_packet = NULL;\r
- _data_return_recv( p_packet );\r
- }\r
- }\r
- /* clear pending queue if any */\r
- while( ( p_list_item = NdisInterlockedRemoveHeadList(\r
- &p_viport->send_pending_list,\r
- &p_viport->pending_list_lock )) != NULL )\r
- {\r
- p_packet = VNIC_PACKET_FROM_LIST_ITEM( p_list_item );\r
- if ( p_packet )\r
- {\r
- NDIS_SET_PACKET_STATUS( p_packet, NDIS_STATUS_FAILURE );\r
- NdisMSendComplete( p_viport->p_adapter->h_handle,\r
- p_packet, NDIS_STATUS_FAILURE );\r
- p_viport->stats.ifOutErrors++;\r
+ NdisUnchainBufferAtFront( p_packet, &p_buf );\r
+ if( p_buf )\r
+ {\r
+ /* Return the NDIS packet and NDIS buffer to their pools. */\r
+ NdisFreeBuffer( p_buf );\r
+ }\r
+ NdisFreePacket( p_packet );\r
}\r
}\r
\r
IN Data_t *pData,\r
IN NDIS_PACKET* const p_packet )\r
{\r
- XmitPool_t *p_xmitPool = &pData->xmitPool;\r
+ XmitPool_t *p_xmitPool;\r
RdmaIo_t *pRdmaIo;\r
BufferPoolEntry_t *pBpe;\r
BOOLEAN last;\r
uint8_t *p_buf;\r
uint32_t buf_len;\r
+ uint32_t pkt_size;\r
NDIS_BUFFER *p_buf_desc;\r
eth_hdr_t* p_eth_hdr;\r
int pad;\r
SCATTER_GATHER_LIST *p_sgl;\r
uint32_t i;\r
PHYSICAL_ADDRESS phy_addr;\r
+ NDIS_PACKET_8021Q_INFO vlanInfo;\r
+ net16_t pri_vlan = 0;\r
\r
VNIC_ENTER( VNIC_DBG_DATA );\r
\r
- if( !data_allocXmitBuffer( pData, &pBpe, &pRdmaIo, &last ) )\r
- {\r
- return FALSE;\r
- }\r
p_sgl = NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet,\r
ScatterGatherListPacketInfo );\r
if ( p_sgl == NULL )\r
&p_buf_desc,\r
&p_buf,\r
&buf_len,\r
- &pRdmaIo->packet_sz,\r
+ &pkt_size,\r
NormalPagePriority );\r
- if( pRdmaIo->packet_sz > p_xmitPool->bufferSz )\r
+\r
+ if( pkt_size > pData->xmitPool.bufferSz )\r
{\r
VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
- ("Outbound packet too large, size = %d\n", pRdmaIo->packet_sz ) );\r
+ ("Outbound packet too large, size = %d\n", pkt_size ) );\r
return FALSE;\r
}\r
\r
p_sgl->NumberOfElements ) );\r
return FALSE;\r
}\r
- pRdmaIo->p_packet = p_packet;\r
\r
- for( i=0; i < p_sgl->NumberOfElements; i++ )\r
+ vlanInfo.Value = NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet, Ieee8021QInfo );\r
+ p_eth_hdr = (eth_hdr_t *)p_buf;\r
+\r
+ if( vlanInfo.Value ) /* there is VLAN_ID specified the packet */\r
{\r
- pRdmaIo->dsList[i].vaddr = p_sgl->Elements[i].Address.QuadPart;\r
- pRdmaIo->dsList[i].length = p_sgl->Elements[i].Length;\r
+ if( vlanInfo.TagHeader.VlanId != 0 )\r
+ {\r
+ /* packet vlanId does not match */\r
+ if( pData->p_viport->p_adapter->vlan_info &&\r
+ ( pData->p_viport->p_adapter->vlan_info & 0x00000fff ) != vlanInfo.TagHeader.VlanId )\r
+ {\r
+ return FALSE;\r
+ }\r
+ pri_vlan = (uint16_t)vlanInfo.TagHeader.VlanId;\r
+ pri_vlan |= (uint16_t)( vlanInfo.TagHeader.UserPriority << 13 );\r
+ }\r
+ else if( pData->p_viport->p_adapter->vlan_info )\r
+ {\r
+ pri_vlan = (uint16_t)( pData->p_viport->p_adapter->vlan_info );\r
+ }\r
}\r
+ else /* no VLAN_ID info in a packet */\r
+ {\r
+ if( pData->p_viport->p_adapter->vlan_info )\r
+ {\r
+ pri_vlan = (uint16_t)( pData->p_viport->p_adapter->vlan_info );\r
+ }\r
+ }\r
+\r
+ if( !data_allocXmitBuffer( pData, &pBpe, &pRdmaIo, &last ) )\r
+ {\r
+ return FALSE;\r
+ }\r
+\r
+ pRdmaIo->p_packet = p_packet;\r
+ pRdmaIo->packet_sz = pkt_size;\r
\r
pRdmaIo->len = (uint32_t)ROUNDUPP2(\r
- max(60, pRdmaIo->packet_sz), VIPORT_TRAILER_ALIGNMENT );\r
+ max(MIN_PACKET_LEN, pRdmaIo->packet_sz), VIPORT_TRAILER_ALIGNMENT );\r
pad = pRdmaIo->len - pRdmaIo->packet_sz;\r
\r
- p_eth_hdr = (eth_hdr_t *)p_buf;\r
-\r
pRdmaIo->p_trailer = (ViportTrailer_t *)&pRdmaIo->data[pad];\r
+ \r
cl_memclr( pRdmaIo->data, pad + sizeof( ViportTrailer_t ) );\r
cl_memcpy( pRdmaIo->p_trailer->destMacAddr, p_eth_hdr->dst.addr, MAC_ADDR_LEN );\r
-\r
+ \r
pRdmaIo->p_trailer->dataLength =\r
- hton16( (uint16_t)max( 60, pRdmaIo->packet_sz ) );\r
-\r
- NdisGetNextBuffer( p_buf_desc, &p_buf_desc );\r
-\r
- /* should handle VLAN tag */\r
- if( pRdmaIo->packet_sz > 16 )\r
+ cl_hton16( (uint16_t)max( MIN_PACKET_LEN, pRdmaIo->packet_sz ) );\r
+ \r
+ if( pri_vlan )\r
{\r
- if( p_eth_hdr->type == hton16(0x8100) )\r
+ /* if tagged frame */\r
+ if( *(uint16_t *)(p_buf + 12 ) == ETH_PROT_VLAN_TAG )\r
{\r
- if( p_sgl->Elements[0].Length > sizeof(eth_hdr_t) )\r
- {\r
- pRdmaIo->p_trailer->vLan = *(uint16_t *)((uint8_t *)p_eth_hdr + 14 );\r
- pRdmaIo->p_trailer->pktFlags |= PF_VLAN_INSERT;\r
- }\r
- else\r
- {\r
- if( p_buf_desc )\r
- {\r
- NdisQueryBufferSafe( p_buf_desc, &p_buf, &buf_len, NormalPagePriority );\r
-\r
- pad = sizeof(eth_hdr_t) - p_sgl->Elements[0].Length;\r
- pRdmaIo->p_trailer->vLan = *(uint16_t *)(p_buf + pad + 2);\r
- pRdmaIo->p_trailer->pktFlags |= PF_VLAN_INSERT;\r
- }\r
- }\r
+ /* strip vlan tag from header */\r
+ RtlMoveMemory( p_buf + 4, p_buf, 12 );\r
+ /* adjust data length */\r
+ pRdmaIo->p_trailer->dataLength = \r
+ cl_hton16( (uint16_t)max( MIN_PACKET_LEN, pRdmaIo->packet_sz ) - 4 );\r
}\r
- /* hash operation seem quite expensive\r
- * should figure out anther way to do this\r
- * meanwhile let's embedded do it for us.\r
- ********************************************\r
- else if( p_eth_hdr->type == ETH_PROT_TYPE_IP &&\r
- !( p_eth_hdr->dst.addr[0] & 0x01 ) )\r
- {\r
- if( p_buf_desc )\r
- {\r
- NdisQueryBufferSafe( p_buf_desc, &p_buf, &buf_len, NormalPagePriority );\r
-\r
- if( ((ip_pkt_t*)p_buf)->hdr.prot == IP_PROT_UDP ||\r
- ((ip_pkt_t*)p_buf)->hdr.prot == IP_PROT_TCP )\r
- {\r
- // use socket src port + dest port to generate hash value\r
- // for link aggregation distribution function.\r
- //\r
- pRdmaIo->p_trailer->connectionHashAndValid = CHV_VALID |\r
- ((uint8_t)ntoh16(((ip_pkt_t*)p_buf)->prot.tcp.src_port ) +\r
- (uint8_t)ntoh16(((ip_pkt_t*)p_buf)->prot.tcp.dst_port )) & CHV_HASH_MASH;\r
- pRdmaIo->p_trailer->pktFlags |= PF_CHASH_VALID;\r
- }\r
- else\r
- pRdmaIo->p_trailer->pktFlags &= ~PF_CHASH_VALID;\r
- }\r
- }\r
- **********************/\r
+ pRdmaIo->p_trailer->vLan = cl_hton16( pri_vlan );\r
+ pRdmaIo->p_trailer->pktFlags |= PF_VLAN_INSERT;\r
}\r
\r
- pRdmaIo->p_trailer->txChksumFlags = _tx_chksum_flags( p_packet );\r
+ for( i=0; i < p_sgl->NumberOfElements; i++ )\r
+ {\r
+ pRdmaIo->dsList[i].vaddr = p_sgl->Elements[i].Address.QuadPart;\r
+ pRdmaIo->dsList[i].length = p_sgl->Elements[i].Length;\r
+ }\r
+ if( viport_canTxCsum( pData->p_viport ) && \r
+ pData->p_viport->p_adapter->params.UseTxCsum )\r
+ {\r
+ pRdmaIo->p_trailer->txChksumFlags = _tx_chksum_flags( p_packet );\r
+ }\r
+ else\r
+ {\r
+ pRdmaIo->p_trailer->txChksumFlags = 0;\r
+ }\r
pRdmaIo->p_trailer->connectionHashAndValid |= CHV_VALID;\r
\r
if( last )\r
("RDMA WRITE Failed\n"));\r
return FALSE;\r
}\r
-\r
+ p_xmitPool = &pData->xmitPool;\r
if( p_xmitPool->sendKicks )\r
{\r
/* EIOC needs kicks to inform it of sent packets */\r
}\r
return TRUE;\r
}\r
+\r
static uint8_t\r
_tx_chksum_flags(\r
IN NDIS_PACKET* const p_packet )\r
return txChksumFlags;\r
}\r
\r
-static void\r
-_get_first_buffer(\r
- IN NDIS_PACKET *p_packet,\r
- IN OUT NDIS_BUFFER **pp_buf_desc,\r
- OUT void **pp_buf,\r
- OUT ULONG *p_packet_sz )\r
-{\r
- UINT buf_len;\r
- VNIC_ENTER( VNIC_DBG_DATA );\r
-\r
- NdisGetFirstBufferFromPacketSafe( p_packet,\r
- pp_buf_desc,\r
- pp_buf,\r
- &buf_len,\r
- p_packet_sz,\r
- NormalPagePriority );\r
- VNIC_EXIT( VNIC_DBG_DATA );\r
-}\r
-\r
static void\r
data_postRecvs(\r
IN Data_t *pData )\r
RecvIo_t *pRecvIo;\r
LIST_ENTRY *p_list_entry;\r
ib_api_status_t ib_status;\r
-\r
+ \r
VNIC_ENTER ( VNIC_DBG_DATA );\r
\r
- while( ( p_list_entry = ExInterlockedRemoveHeadList( &pData->recvIos,\r
- &pData->recvIosLock ))\r
- != NULL )\r
+ if( pData->p_viport->errored )\r
+ return;\r
+\r
+ while( ( p_list_entry = ExInterlockedRemoveHeadList( &pData->recvIos, &pData->recvListLock ) ) != NULL )\r
{\r
pRecvIo = (RecvIo_t *)p_list_entry;\r
\r
_data_receivedKick(\r
IN Io_t *pIo )\r
{\r
- Data_t *pData = &pIo->pViport->data;\r
- uint32_t num_pkts = 0;\r
+\r
+ uint32_t num_pkts = 0;\r
\r
VNIC_ENTER( VNIC_DBG_DATA );\r
\r
+ NdisAcquireSpinLock( &pIo->pViport->data.recvIosLock );\r
+\r
#ifdef VNIC_STATISTIC\r
recvRef = cl_get_tick_count();\r
#endif /* VNIC_STATISTIC */\r
\r
- ExInterlockedInsertTailList( &pData->recvIos, &pIo->listPtrs, &pData->recvIosLock );\r
+ ExInterlockedInsertTailList( &pIo->pViport->data.recvIos, \r
+ &pIo->listPtrs, \r
+ &pIo->pViport->data.recvListLock );\r
\r
- data_postRecvs( pData );\r
+ data_postRecvs( &pIo->pViport->data );\r
\r
#ifdef VNIC_STATISTIC\r
- pData->statistics.kickRecvs++;\r
+ pIo->pViport->data.statistics.kickRecvs++;\r
#endif /* VNIC_STATISTIC */\r
\r
- data_checkXmitBuffers( pData );\r
+ data_checkXmitBuffers( &pIo->pViport->data );\r
+\r
+ num_pkts = _data_incomingRecv( &pIo->pViport->data );\r
\r
- num_pkts = _data_incomingRecv( pData );\r
+ NdisReleaseSpinLock(&pIo->pViport->data.recvIosLock );\r
\r
if( num_pkts )\r
{\r
- NdisMIndicateReceivePacket( pData->p_viport->p_adapter->h_handle,\r
- pData->recvPool.recv_pkt_array,\r
- num_pkts );\r
- pData->p_viport->stats.ifInOk += num_pkts;\r
- }\r
+ viport_recvPacket( pIo->pViport,\r
+ pIo->pViport->data.recvPool.recv_pkt_array,\r
+ num_pkts );\r
\r
- if( pData->p_viport->data.connected == TRUE &&\r
- !pData->p_viport->errored )\r
- {\r
- _data_allocBuffers( pData, FALSE );\r
- _data_sendFreeRecvBuffers( pData );\r
+ pIo->pViport->stats.ifInOk += num_pkts;\r
}\r
\r
VNIC_EXIT( VNIC_DBG_DATA );\r
_data_xmitComplete(\r
IN Io_t *pIo )\r
{\r
- RdmaIo_t *pRdmaIo = (RdmaIo_t *)pIo;\r
- Data_t *pData = &pIo->pViport->data;\r
- XmitPool_t *p_xmitPool = &pData->xmitPool;\r
+\r
+ Data_t *pData;\r
+ XmitPool_t *p_xmitPool;\r
NDIS_PACKET *p_packet;\r
NDIS_STATUS ndis_status;\r
+ uint32_t io_index;\r
\r
VNIC_ENTER( VNIC_DBG_DATA );\r
+ \r
+ NdisAcquireSpinLock( &pIo->pViport->data.xmitBufLock );\r
+ \r
+ io_index = ((RdmaIo_t *)pIo)->index;\r
+ pData = &pIo->pViport->data;\r
+ p_xmitPool = &pData->xmitPool;\r
\r
- while ( p_xmitPool->lastCompBuf != pRdmaIo->index )\r
+ while ( p_xmitPool->lastCompBuf != io_index )\r
{\r
INC(p_xmitPool->lastCompBuf, 1, p_xmitPool->numXmitBufs);\r
+ \r
p_packet = p_xmitPool->pXmitBufs[p_xmitPool->lastCompBuf].p_packet;\r
\r
p_xmitPool->pXmitBufs[p_xmitPool->lastCompBuf].p_packet = NULL;\r
p_packet, ndis_status );\r
}\r
}\r
+ NdisReleaseSpinLock( &pData->xmitBufLock );\r
\r
if( !pData->p_viport->errored )\r
{\r
OUT RdmaIo_t **ppRdmaIo,\r
OUT BOOLEAN *pLast )\r
{\r
- XmitPool_t *p_xmitPool = &pData->xmitPool;\r
- KIRQL flags;\r
+ XmitPool_t *p_xmitPool;\r
\r
VNIC_ENTER( VNIC_DBG_DATA );\r
\r
- KeAcquireSpinLock( &pData->xmitBufLock, &flags );\r
-\r
+ NdisAcquireSpinLock( &pData->xmitBufLock );\r
+ \r
+ p_xmitPool = &pData->xmitPool;\r
*pLast = FALSE;\r
*ppRdmaIo = &p_xmitPool->pXmitBufs[p_xmitPool->nextXmitBuf];\r
*ppBpe = &p_xmitPool->bufPool[p_xmitPool->nextXmitPool];\r
\r
(*ppBpe)->valid = 0;\r
\r
- KeReleaseSpinLock( &pData->xmitBufLock, flags );\r
+ NdisReleaseSpinLock( &pData->xmitBufLock );\r
return TRUE;\r
}\r
else\r
\r
viport_stopXmit( pData->p_viport );\r
\r
- KeReleaseSpinLock( &pData->xmitBufLock, flags );\r
+ NdisReleaseSpinLock( &pData->xmitBufLock );\r
return FALSE;\r
}\r
}\r
data_checkXmitBuffers(\r
IN Data_t *pData )\r
{\r
- XmitPool_t *p_xmitPool = &pData->xmitPool;\r
- KIRQL flags;\r
-\r
VNIC_ENTER( VNIC_DBG_DATA );\r
\r
- KeAcquireSpinLock( &pData->xmitBufLock, &flags );\r
+ NdisAcquireSpinLock( &pData->xmitBufLock );\r
\r
if ( pData->xmitPool.needBuffers\r
- && p_xmitPool->bufPool[p_xmitPool->nextXmitPool].valid\r
- && p_xmitPool->nextXmitBuf != p_xmitPool->lastCompBuf )\r
+ && pData->xmitPool.bufPool[pData->xmitPool.nextXmitPool].valid\r
+ && pData->xmitPool.nextXmitBuf != pData->xmitPool.lastCompBuf )\r
{\r
pData->xmitPool.needBuffers = FALSE;\r
viport_restartXmit( pData->p_viport );\r
("There are free xmit buffers\n") );\r
}\r
\r
- KeReleaseSpinLock( &pData->xmitBufLock, flags );\r
+ NdisReleaseSpinLock( &pData->xmitBufLock );\r
\r
VNIC_EXIT( VNIC_DBG_DATA );\r
return;\r
return IB_SUCCESS;\r
}\r
\r
-static NDIS_PACKET *\r
+static BOOLEAN\r
_data_recv_to_ndis_pkt(\r
IN Data_t *pData,\r
IN RdmaDest_t *pRdmaDest )\r
{\r
struct ViportTrailer *pTrailer;\r
- NDIS_PACKET *p_packet;\r
- NDIS_STATUS ndis_status;\r
- int start;\r
- unsigned int len;\r
- uint8_t rxChksumFlags;\r
+ NDIS_PACKET *p_packet;\r
+ NDIS_STATUS ndis_status;\r
+ int start;\r
+ unsigned int len;\r
NDIS_TCP_IP_CHECKSUM_PACKET_INFO packet_info;\r
+ NDIS_PACKET_8021Q_INFO vlan_info;\r
+ uint16_t vlanId;\r
+ uint8_t rxChksumFlags;\r
\r
VNIC_ENTER( VNIC_DBG_DATA );\r
\r
pTrailer = pRdmaDest->pTrailer;\r
+ p_packet = pRdmaDest->p_packet;\r
+\r
start = (int)data_offset(pData, pTrailer);\r
len = data_len(pData, pTrailer);\r
\r
- NdisAllocatePacket( &ndis_status,\r
- &p_packet,\r
- pData->h_recv_pkt_pool );\r
-\r
- if ( ndis_status != NDIS_STATUS_SUCCESS )\r
- {\r
- VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
- ( "NdisAllocatePacket failed %#x\n", ndis_status ) );\r
- return NULL;\r
- }\r
NdisAllocateBuffer( &ndis_status,\r
&pRdmaDest->p_buf,\r
pData->h_recv_buf_pool,\r
{\r
VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
( "NdisAllocateBuffer failed %#x\n", ndis_status ) );\r
- NdisFreePacket( p_packet );\r
- return NULL;\r
+ return FALSE;\r
}\r
\r
NdisChainBufferAtFront( p_packet, pRdmaDest->p_buf );\r
- pRdmaDest->p_packet = p_packet;\r
+ pRdmaDest->buf_sz = len;\r
\r
if ( pTrailer->pktFlags & PF_VLAN_INSERT &&\r
!( pData->p_viport->featuresSupported & INIC_FEAT_IGNORE_VLAN ) )\r
{\r
- /* TODO:\r
- * add OID_GEN_VLAN_ID\r
- * handle VLAN tag insertion\r
- * set packet header size = eth_hdr + 4\r
- */\r
- }\r
+ /* handle VLAN tag insertion */\r
+ vlan_info.Value = NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet, Ieee8021QInfo );\r
+ vlanId = cl_ntoh16( pTrailer->vLan );\r
\r
- NDIS_SET_PACKET_HEADER_SIZE( p_packet, sizeof(eth_hdr_t) );\r
+ if( !( vlanId & 0xfff ) ||\r
+ ( ( (vlanId & 0xfff ) != 0 ) && \r
+ (vlanId & 0xfff ) == ((uint16_t)pData->p_viport->p_adapter->vlan_info & 0xfff ) ))\r
+ {\r
+ if( pTrailer->pktFlags & PF_PVID_OVERRIDDEN )\r
+ {\r
+ vlan_info.TagHeader.VlanId = 0;\r
+ }\r
+ else\r
+ {\r
+ vlan_info.TagHeader.VlanId = vlanId & 0xfff;\r
+ }\r
+ vlan_info.TagHeader.UserPriority = vlanId & 0xe000;\r
+ vlan_info.TagHeader.CanonicalFormatId = 0;\r
+ vlan_info.TagHeader.Reserved = 0;\r
+ NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet, Ieee8021QInfo ) = vlan_info.Value;\r
+ }\r
+ }\r
\r
- rxChksumFlags = pTrailer->rxChksumFlags;\r
+ if( viport_canRxCsum( pData->p_viport ) &&\r
+ pData->p_viport->p_adapter->params.UseRxCsum )\r
+ {\r
+ rxChksumFlags = pTrailer->rxChksumFlags;\r
\r
- VNIC_TRACE( VNIC_DBG_DATA,\r
- ("rxChksumFlags = %d, LOOP = %c, IP = %c, TCP = %c, UDP = %c\n",\r
- rxChksumFlags,\r
- (rxChksumFlags & RX_CHKSUM_FLAGS_LOOPBACK)? 'Y': 'N',\r
- (rxChksumFlags & RX_CHKSUM_FLAGS_IP_CHECKSUM_SUCCEEDED)? 'Y':\r
+ VNIC_TRACE( VNIC_DBG_DATA,\r
+ ("rxChksumFlags = %d, LOOP = %c, IP = %c, TCP = %c, UDP = %c\n",\r
+ rxChksumFlags,\r
+ (rxChksumFlags & RX_CHKSUM_FLAGS_LOOPBACK)? 'Y': 'N',\r
+ (rxChksumFlags & RX_CHKSUM_FLAGS_IP_CHECKSUM_SUCCEEDED)? 'Y':\r
(rxChksumFlags & RX_CHKSUM_FLAGS_IP_CHECKSUM_FAILED)? 'N': '-',\r
- (rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_SUCCEEDED)? 'Y':\r
+ (rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_SUCCEEDED)? 'Y':\r
(rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_FAILED)? 'N': '-',\r
- (rxChksumFlags & RX_CHKSUM_FLAGS_UDP_CHECKSUM_SUCCEEDED)? 'Y':\r
+ (rxChksumFlags & RX_CHKSUM_FLAGS_UDP_CHECKSUM_SUCCEEDED)? 'Y':\r
(rxChksumFlags & RX_CHKSUM_FLAGS_UDP_CHECKSUM_FAILED)? 'N': '-') );\r
\r
- packet_info.Value = 0;\r
+ packet_info.Value = 0;\r
\r
- if( rxChksumFlags & RX_CHKSUM_FLAGS_IP_CHECKSUM_SUCCEEDED )\r
- packet_info.Receive.NdisPacketIpChecksumSucceeded = TRUE;\r
- else if( rxChksumFlags & RX_CHKSUM_FLAGS_IP_CHECKSUM_FAILED )\r
- packet_info.Receive.NdisPacketIpChecksumFailed = TRUE;\r
+ if( rxChksumFlags & RX_CHKSUM_FLAGS_IP_CHECKSUM_SUCCEEDED )\r
+ packet_info.Receive.NdisPacketIpChecksumSucceeded = TRUE;\r
+ else if( rxChksumFlags & RX_CHKSUM_FLAGS_IP_CHECKSUM_FAILED )\r
+ packet_info.Receive.NdisPacketIpChecksumFailed = TRUE;\r
\r
- if( rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_SUCCEEDED )\r
- packet_info.Receive.NdisPacketTcpChecksumSucceeded = TRUE;\r
- else if( rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_FAILED )\r
- packet_info.Receive.NdisPacketTcpChecksumFailed = TRUE;\r
+ if( rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_SUCCEEDED )\r
+ packet_info.Receive.NdisPacketTcpChecksumSucceeded = TRUE;\r
+ else if( rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_FAILED )\r
+ packet_info.Receive.NdisPacketTcpChecksumFailed = TRUE;\r
\r
- if( rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_SUCCEEDED )\r
- packet_info.Receive.NdisPacketUdpChecksumSucceeded = TRUE;\r
- else if( rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_FAILED )\r
- packet_info.Receive.NdisPacketUdpChecksumFailed = TRUE;\r
+ if( rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_SUCCEEDED )\r
+ packet_info.Receive.NdisPacketUdpChecksumSucceeded = TRUE;\r
+ else if( rxChksumFlags & RX_CHKSUM_FLAGS_TCP_CHECKSUM_FAILED )\r
+ packet_info.Receive.NdisPacketUdpChecksumFailed = TRUE;\r
\r
- NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet, TcpIpChecksumPacketInfo )=\r
- (void *)(uintn_t)packet_info.Value;\r
+ NDIS_PER_PACKET_INFO_FROM_PACKET( p_packet, TcpIpChecksumPacketInfo )=\r
+ (void *)(uintn_t)packet_info.Value;\r
+ }\r
\r
- VNIC_RECV_FROM_PACKET( p_packet ) = pRdmaDest;\r
NDIS_SET_PACKET_STATUS( p_packet, NDIS_STATUS_SUCCESS );\r
+ NDIS_SET_PACKET_HEADER_SIZE( p_packet, sizeof(eth_hdr_t) );\r
+ VNIC_RECV_FROM_PACKET( p_packet ) = pRdmaDest;\r
\r
VNIC_EXIT( VNIC_DBG_DATA );\r
- return p_packet;\r
+ return TRUE;\r
}\r
\r
/* NOTE: This routine is not reentrant */\r
IN Data_t *pData,\r
IN BOOLEAN initialAllocation )\r
{\r
+ NDIS_STATUS ndis_status;\r
RecvPool_t *p_recvPool = &pData->recvPool;\r
RdmaDest_t *pRdmaDest;\r
LIST_ENTRY *p_list_entry;\r
(struct ViportTrailer*)(pRdmaDest->data + pRdmaDest->buf_sz\r
- sizeof(struct ViportTrailer));\r
pRdmaDest->pTrailer->connectionHashAndValid = 0;\r
+\r
+ NdisAllocatePacket( &ndis_status,\r
+ &pRdmaDest->p_packet,\r
+ pData->h_recv_pkt_pool );\r
+\r
+ if ( ndis_status != NDIS_STATUS_SUCCESS )\r
+ {\r
+ VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
+ ( "NdisAllocatePacket failed %#x\n", ndis_status ) );\r
+ return;\r
+ }\r
}\r
\r
- pRdmaDest->p_packet = NULL;\r
- _data_addFreeBuffer(pData, index, pRdmaDest);\r
+ _data_addFreeBuffer( pData, index, pRdmaDest );\r
index = NEXT(index,p_recvPool->eiocPoolSz);\r
}\r
\r
RdmaDest_t *pRdmaDest;\r
ViportTrailer_t *pTrailer;\r
BufferPoolEntry_t *pBpe;\r
- NDIS_PACKET *p_packet = NULL;\r
uint32_t idx = 0;\r
BOOLEAN status = FALSE;\r
\r
return idx;\r
\r
pBpe = &p_recvPool->bufPool[p_recvPool->nextFullBuf];\r
+\r
+ CL_ASSERT(pBpe->valid != 0 );\r
+\r
pRdmaDest = &p_recvPool->pRecvBufs[pBpe->valid - 1];\r
pTrailer = pRdmaDest->pTrailer;\r
\r
{\r
p_recvPool->kickOnFree = TRUE;\r
}\r
- /* we do not want to indicate packet if no filter is set */\r
- if( pData->p_viport->p_adapter->packet_filter &&\r
+ /* we do not want to indicate packet if filter is not set */\r
+ if( pData->p_viport->p_adapter->xmitStarted &&\r
+ pData->p_viport->p_adapter->packet_filter &&\r
p_recvPool->numPostedBufs > 0 )\r
{\r
- p_packet = _data_recv_to_ndis_pkt( pData, pRdmaDest );\r
- if ( p_packet != NULL )\r
+ if ( _data_recv_to_ndis_pkt( pData, pRdmaDest ) )\r
{\r
- p_recvPool->recv_pkt_array[idx++] = p_packet;\r
+ p_recvPool->recv_pkt_array[idx++] = pRdmaDest->p_packet;\r
}\r
}\r
else\r
IN NDIS_PACKET * const p_packet )\r
{\r
\r
+ RdmaDest_t *p_rdma_dest;\r
+ viport_t *p_viport;\r
+ \r
+ VNIC_ENTER( VNIC_DBG_DATA );\r
\r
- vnic_adapter_t *p_adapter = (vnic_adapter_t *)adapter_context;\r
- viport_t *p_viport = p_adapter->p_currentPath->pViport;\r
- RdmaDest_t *p_rdma_dest = VNIC_RECV_FROM_PACKET( p_packet );\r
+ UNREFERENCED_PARAMETER( adapter_context );\r
\r
- ASSERT( p_rdma_dest->p_packet == p_packet );\r
- _data_return_recv( p_packet );\r
- p_rdma_dest->p_packet = NULL;\r
+ p_rdma_dest = VNIC_RECV_FROM_PACKET( p_packet );\r
+ p_viport = p_rdma_dest->p_viport;\r
\r
+ ASSERT( p_rdma_dest->p_packet == p_packet ); \r
+\r
+ NdisAcquireSpinLock( &p_viport->data.recvIosLock );\r
+ \r
+ _data_return_recv( p_packet );\r
+ \r
+ NdisReinitializePacket( p_packet );\r
+ \r
InsertTailList( &p_viport->data.recvPool.availRecvBufs,\r
&p_rdma_dest->listPtrs );\r
+ _data_allocBuffers( &p_viport->data, FALSE );\r
+ _data_sendFreeRecvBuffers( &p_viport->data );\r
\r
+ NdisReleaseSpinLock(&p_viport->data.recvIosLock );\r
+\r
+ VNIC_EXIT( VNIC_DBG_DATA );\r
}\r
static void\r
_data_return_recv(\r
IN NDIS_PACKET *p_packet )\r
{\r
NDIS_BUFFER *p_buf;\r
+ PNDIS_PACKET_OOB_DATA p_oob_data;\r
+ \r
/* Unchain the NDIS buffer. */\r
NdisUnchainBufferAtFront( p_packet, &p_buf );\r
- CL_ASSERT( p_buf );\r
- /* Return the NDIS packet and NDIS buffer to their pools. */\r
- NdisFreeBuffer( p_buf );\r
- NdisFreePacket( p_packet );\r
+ if( p_buf )\r
+ {\r
+ /* Return the NDIS packet and NDIS buffer to their pools. */\r
+ NdisFreeBuffer( p_buf );\r
+ }\r
+ /* take care of OOB_DATA block since NdisReinitializePacket doesn't */\r
+ p_oob_data = NDIS_OOB_DATA_FROM_PACKET( p_packet );\r
+ NdisZeroMemory( p_oob_data, sizeof( NDIS_PACKET_OOB_DATA ));\r
}\r
\r
static void\r
\r
VNIC_ENTER( VNIC_DBG_DATA );\r
\r
- for ( numToSend = MIN_EIOC_UPDATE_SZ;\r
+ for ( numToSend = p_recvPool->szFreeBundle;\r
numToSend <= p_recvPool->numFreeBufs;\r
- numToSend += MIN_EIOC_UPDATE_SZ )\r
+ numToSend += p_recvPool->szFreeBundle )\r
{\r
\r
/* Handle multiple bundles as one when possible. */\r
- nextIncrement = numToSend + MIN_EIOC_UPDATE_SZ;\r
+ nextIncrement = numToSend + p_recvPool->szFreeBundle;\r
if (( nextIncrement <= p_recvPool->numFreeBufs )\r
&& ( p_recvPool->nextFreeBuf + nextIncrement <= p_recvPool->eiocPoolSz ) )\r
{\r
if( p_recvPool->numPostedBufs == 0 )\r
{\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("IOC %d: Unable to allocate receive buffers\n",\r
- pData->p_viport->ioc_num ) );\r
+ ("IOC %d: Unable to allocate receive buffers NumFreeBufs: %d nextFreeBuf: %d nextFullBuf %d eiocPoolSz: %d\n",\r
+ pData->p_viport->ioc_num, p_recvPool->numFreeBufs,\r
+ p_recvPool->nextFreeBuf, p_recvPool->nextFullBuf,\r
+ p_recvPool->eiocPoolSz ) );\r
\r
//viport_failure( pData->p_viport );\r
}\r
{\r
VNIC_ENTER( VNIC_DBG_DATA );\r
\r
- VNIC_TRACE(VNIC_DBG_INIT,\r
+ VNIC_TRACE(VNIC_DBG_DATA,\r
("IOC[%d]data cleanup\n", pData->p_viport->ioc_num ));\r
\r
if( pData->p_recv_bufs )\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
typedef struct RdmaDest {\r
LIST_ENTRY listPtrs;\r
IbRegion_t region;\r
+ struct _viport *p_viport;\r
NDIS_PACKET *p_packet;\r
NDIS_BUFFER *p_buf;\r
uint32_t buf_sz;\r
RdmaIo_t freeBufsIo;\r
SendIo_t kickIo;\r
LIST_ENTRY recvIos;\r
- KSPIN_LOCK recvIosLock;\r
- KSPIN_LOCK xmitBufLock;\r
+ KSPIN_LOCK recvListLock;\r
+ NDIS_SPIN_LOCK recvIosLock;\r
+ NDIS_SPIN_LOCK xmitBufLock;\r
volatile LONG kickTimerOn;\r
BOOLEAN connected;\r
cl_timer_t kickTimer;\r
data_connect(\r
Data_t *pData );\r
\r
-void\r
+ib_api_status_t\r
data_connected(\r
Data_t *pData );\r
\r
#define VNIC_PACKET_FROM_LIST_ITEM( I ) \\r
(PARENT_STRUCT( I, NDIS_PACKET, MiniportReservedEx ))\r
\r
-#endif /* _VNIC_DATA_H_ */
\ No newline at end of file
+#endif /* _VNIC_DATA_H_ */\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
#define VNIC_DBG_ERROR CL_DBG_ERROR\r
#define VNIC_DBG_ALL CL_DBG_ALL\r
\r
-#define VNIC_DEBUG_FLAGS ( VNIC_DBG_ERROR | VNIC_DBG_WARN | VNIC_DBG_INFO | VNIC_DBG_PNP | VNIC_DBG_INIT )\r
+#define VNIC_DEBUG_FLAGS ( VNIC_DBG_ERROR | VNIC_DBG_WARN | VNIC_DBG_INFO )\r
/* Enter and exit macros automatically add VNIC_DBG_FUNC bit */\r
#define VNIC_ENTER( lvl ) \\r
CL_ENTER( (lvl | VNIC_DBG_FUNC), g_vnic_dbg_lvl )\r
#define VNIC_EXIT( lvl ) \\r
CL_EXIT( (lvl | VNIC_DBG_FUNC), g_vnic_dbg_lvl )\r
\r
+#if defined FREE_BUILD_DBG\r
+#define VNIC_TRACE( lvl, msg ) \\r
+ { \\r
+ switch( (lvl) & VNIC_DBG_ERROR ) \\r
+ { \\r
+ case VNIC_DBG_ERROR: \\r
+ cl_msg_out msg; \\r
+ default: \\r
+ CL_TRACE( (lvl), g_vnic_dbg_lvl, msg ); \\r
+ } \\r
+ }\r
+\r
+#define VNIC_TRACE_EXIT( lvl, msg ) \\r
+ { \\r
+ switch( (lvl) & VNIC_DBG_ERROR ) \\r
+ { \\r
+ case VNIC_DBG_ERROR: \\r
+ cl_msg_out msg; \\r
+ default: \\r
+ CL_TRACE_EXIT( (lvl), g_vnic_dbg_lvl, msg ); \\r
+ } \\r
+ }\r
+\r
+#else // ! FREE_BUILD_DBG\r
+\r
#define VNIC_TRACE( lvl, msg ) \\r
CL_TRACE( (lvl), g_vnic_dbg_lvl, msg )\r
\r
#define VNIC_TRACE_EXIT( lvl, msg ) \\r
CL_TRACE_EXIT( (lvl), g_vnic_dbg_lvl, msg )\r
\r
+#endif // FREE_BUILD_DBG\r
+\r
#define VNIC_PRINT( lvl, msg ) \\r
CL_PRINT ( (lvl), g_vnic_dbg_lvl, msg )\r
\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
\r
vnic_globals_t g_vnic;\r
\r
+g_registry_params_t reg_array[VNIC_REGISTRY_TBL_SIZE] = {\r
+ {L"", 0},\r
+ {L"MinHostPoolSz", ENTRY_INIT_VALUE},\r
+ {L"HostRecvPoolEntries", ENTRY_INIT_VALUE},\r
+ {L"MinEiocPoolSz", ENTRY_INIT_VALUE},\r
+ {L"MaxEiocPoolSz", ENTRY_INIT_VALUE},\r
+ {L"MinHostKickTimeout", ENTRY_INIT_VALUE},\r
+ {L"MaxHostKickTimeout", ENTRY_INIT_VALUE},\r
+ {L"MinHostKickEntries", ENTRY_INIT_VALUE},\r
+ {L"MaxHostKickEntries", ENTRY_INIT_VALUE},\r
+ {L"MinHostKickBytes", ENTRY_INIT_VALUE},\r
+ {L"MaxHostKickBytes", ENTRY_INIT_VALUE},\r
+ {L"MinHostUpdateSz", ENTRY_INIT_VALUE},\r
+ {L"MaxHostUpdateSz", ENTRY_INIT_VALUE},\r
+ {L"MinEiocUpdateSz", ENTRY_INIT_VALUE},\r
+ {L"MaxEiocUpdateSz", ENTRY_INIT_VALUE},\r
+ {L"HeartbeatTimeout", ENTRY_INIT_VALUE},\r
+};\r
+\r
#define DEFAULT_HOST_NAME "VNIC Host"\r
\r
uint32_t g_vnic_dbg_lvl = VNIC_DEBUG_FLAGS;\r
static void\r
__vnic_read_machine_name( void );\r
\r
+static NTSTATUS\r
+__vnic_read_service_registry(\r
+ IN UNICODE_STRING* const p_registry_path );\r
+\r
static NDIS_STATUS\r
__vnic_set_machine_name(\r
IN VOID *p_uni_array,\r
#ifdef _DEBUG_\r
PAGED_CODE();\r
#endif\r
-\r
+/*\r
status = CL_INIT;\r
\r
if( !NT_SUCCESS( status ) )\r
("cl_init failed.\n") );\r
return status;\r
}\r
-\r
+*/\r
status = NDIS_STATUS_SUCCESS;\r
\r
- KeInitializeSpinLock( &g_vnic.lock );\r
- InitializeListHead( &g_vnic.adapter_list );\r
-\r
- g_vnic.adapters = 0;\r
g_vnic.ndis_handle = NULL;\r
+ g_vnic.shutdown = 0;\r
+ g_vnic.p_params = NULL;\r
\r
NdisMInitializeWrapper( &g_vnic.ndis_handle, p_drv_obj, p_registry_path, NULL );\r
\r
\r
characteristics.MajorNdisVersion = MAJOR_NDIS_VERSION;\r
characteristics.MinorNdisVersion = MINOR_NDIS_VERSION;\r
- //characteristics.CheckForHangHandler = vnic_check_for_hang;\r
+ characteristics.CheckForHangHandler = vnic_check_for_hang;\r
characteristics.HaltHandler = vnic_halt;\r
characteristics.InitializeHandler = vnic_initialize;\r
characteristics.QueryInformationHandler = vnic_oid_query_info;\r
characteristics.SendPacketsHandler = vnic_send_packets;\r
\r
#ifdef NDIS51_MINIPORT\r
+ characteristics.CancelSendPacketsHandler = vnic_cancel_xmit;\r
characteristics.PnPEventNotifyHandler = vnic_pnp_notify;\r
characteristics.AdapterShutdownHandler = vnic_shutdown;\r
#endif\r
NdisMRegisterUnloadHandler( g_vnic.ndis_handle, vnic_unload );\r
\r
__vnic_read_machine_name();\r
+ __vnic_read_service_registry( p_registry_path );\r
+\r
+#if defined (LBFO_ENABLED)\r
+ cl_qlist_init( &g_vnic.primary_list );\r
+ cl_qlist_init( &g_vnic.secondary_list );\r
+#endif\r
}\r
\r
VNIC_EXIT( VNIC_DBG_INIT );\r
VNIC_ENTER( VNIC_DBG_INIT );\r
\r
UNREFERENCED_PARAMETER( p_drv_obj );\r
- CL_DEINIT;\r
\r
- VNIC_EXIT( VNIC_DBG_INIT );\r
+ VNIC_TRACE_EXIT( VNIC_DBG_INFO,\r
+ (" Driver Unloaded....\n"));\r
+ //CL_DEINIT;\r
}\r
\r
\r
ib_pnp_req_t pnp_req;\r
UINT medium_index;\r
vnic_adapter_t *p_adapter;\r
- ULONG buffer_size;\r
\r
VNIC_ENTER( VNIC_DBG_INIT );\r
\r
/* set NDIS features we support */\r
NdisMSetAttributesEx( h_handle,\r
(NDIS_HANDLE)p_adapter,\r
- 2, /*check for hung t-out */\r
+ 0, /*check for hung timeout, 2 sec */\r
NDIS_ATTRIBUTE_BUS_MASTER |\r
NDIS_ATTRIBUTE_DESERIALIZE |\r
NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK |\r
NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS,\r
NdisInterfacePNPBus );\r
\r
- buffer_size = ROUNDUPP2(p_adapter->params.MinMtu + sizeof(eth_hdr_t), 8 );\r
-\r
- status = NdisMInitializeScatterGatherDma( h_handle, TRUE, buffer_size );\r
- if ( status != NDIS_STATUS_SUCCESS )\r
- {\r
- VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("Init ScatterGatherDma failed status %#x\n", status ) );\r
- goto failure;\r
- }\r
-\r
/* Register for IOC events */\r
pnp_req.pfn_pnp_cb = __vnic_pnp_cb;\r
pnp_req.pnp_class = IB_PNP_IOC | IB_PNP_FLAG_REG_SYNC;\r
goto failure;\r
}\r
\r
- if( p_adapter->state == INIC_UNINITIALIZED )\r
+ if( p_adapter->state != INIC_REGISTERED )\r
{\r
status = NDIS_STATUS_FAILURE;\r
failure:\r
vnic_halt(\r
IN NDIS_HANDLE adapter_context )\r
{\r
- vnic_adapter_t *p_adapter;\r
-\r
VNIC_ENTER( VNIC_DBG_INIT );\r
CL_ASSERT( adapter_context );\r
\r
- p_adapter = (vnic_adapter_t*)adapter_context;\r
-\r
- vnic_destroy_adapter( p_adapter );\r
+ vnic_destroy_adapter( (vnic_adapter_t*)adapter_context );\r
\r
VNIC_EXIT( VNIC_DBG_INIT );\r
}\r
@param adapter_context The adapter context allocated at start\r
@return TRUE if the driver determines that its NIC is not operating\r
*/\r
-#define VNIC_MAX_HUNG_CHK 3\r
+\r
BOOLEAN\r
vnic_check_for_hang(\r
IN NDIS_HANDLE adapter_context )\r
CL_ASSERT( adapter_context );\r
p_adapter = (vnic_adapter_t*)adapter_context;\r
\r
- if( p_adapter->p_viport )\r
+ /* current path is Ok */\r
+ if( netpath_is_connected( p_adapter->p_currentPath ) )\r
{\r
- if( p_adapter->p_viport->errored != 0 )\r
- p_adapter->hung++;\r
+ return FALSE;\r
}\r
- if( p_adapter->hung > VNIC_MAX_HUNG_CHK )\r
+\r
+ if( p_adapter->hung != 0 && \r
+ p_adapter->hung >= p_adapter->num_paths )\r
{\r
- VNIC_TRACE( VNIC_DBG_WARN, ("Adapter Hung\n"));\r
- p_adapter->hung = 0;\r
- return TRUE;\r
+ VNIC_TRACE( VNIC_DBG_WARN, \r
+ ("IOC[%d] Adapter Hung\n", p_adapter->ioc_num ));\r
+ return TRUE;\r
}\r
+\r
return FALSE;\r
}\r
\r
OUT PULONG p_bytes_needed )\r
{\r
vnic_adapter_t *p_adapter;\r
+ Netpath_t *p_netpath;\r
+\r
NDIS_STATUS status;\r
USHORT version;\r
- uint32_t info32;\r
- uint64_t info64;\r
+ uint32_t info32 = 0;\r
+ uint64_t info64 = 0;\r
PVOID src_buf;\r
ULONG buf_len;\r
pending_oid_t oid_info;\r
src_buf = &info32;\r
buf_len = sizeof(info32);\r
\r
- if( !p_adapter->p_viport ||\r
- !p_adapter->p_currentPath->carrier )\r
+ if( g_vnic.shutdown != 0 )\r
+ {\r
+ *p_bytes_written = 0;\r
+ return NDIS_STATUS_NOT_ACCEPTED;\r
+ }\r
+\r
+ p_netpath = p_adapter->p_currentPath;\r
+ if( !p_netpath || !p_netpath->carrier )\r
{\r
status = NDIS_STATUS_NOT_ACCEPTED;\r
goto complete;\r
VNIC_TRACE( VNIC_DBG_OID,\r
("received query for OID_GEN_HARDWARE_STATUS\n") );\r
\r
- if( p_adapter->p_currentPath->carrier )\r
+ if( p_netpath->carrier )\r
{\r
VNIC_TRACE( VNIC_DBG_OID,\r
("returning NdisHardwareStatusReady\n") );\r
"or OID_GEN_MEDIA_IN_USE\n") );\r
info32 = NdisMedium802_3;\r
break;\r
-\r
- case OID_GEN_MAXIMUM_FRAME_SIZE:\r
+ \r
+ case OID_GEN_MAXIMUM_TOTAL_SIZE: /* frame size inlcuding header */\r
+ info32 = sizeof( eth_hdr_t );\r
+ case OID_GEN_MAXIMUM_FRAME_SIZE: /* wihout header */\r
VNIC_TRACE( VNIC_DBG_OID,\r
("received query for OID_GEN_MAXIMUM_FRAME_SIZE\n") );\r
- if( !p_adapter->p_currentPath->carrier )\r
+ if( !p_netpath->carrier )\r
{\r
- info32 = p_adapter->params.MinMtu;\r
+ info32 += MIN_MTU;\r
}\r
else\r
{\r
- info32 = p_adapter->p_currentPath->pViport->mtu;\r
- /*TODO: add VLAN tag size if support request */\r
+ info32 += p_adapter->p_currentPath->pViport->mtu;\r
}\r
break;\r
\r
VNIC_TRACE( VNIC_DBG_OID,\r
("received query for OID_GEN_LINK_SPEED\n") );\r
\r
- if( p_adapter->p_currentPath->carrier )\r
+ if( p_netpath->carrier )\r
{\r
/* if we get link speed value - it is in Mbps units - have to convert to 100bps*/\r
info32 = ( p_adapter->link_speed )? \r
case OID_GEN_TRANSMIT_BUFFER_SPACE:\r
VNIC_TRACE( VNIC_DBG_OID,\r
("received query for OID_GEN_TRANSMIT_BUFFER_SPACE\n") );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
status= NDIS_STATUS_NOT_ACCEPTED;\r
}\r
else\r
{\r
- info32 = p_adapter->p_viport->data.xmitPool.bufferSz *\r
- p_adapter->p_viport->data.xmitPool.poolSz;\r
+ info32 = p_netpath->pViport->data.xmitPool.bufferSz *\r
+ p_netpath->pViport->data.xmitPool.poolSz;\r
}\r
break;\r
\r
VNIC_TRACE( VNIC_DBG_OID,\r
("received query for OID_GEN_RECEIVE_BUFFER_SPACE "\r
"or OID_GEN_RECEIVE_BUFFER_SPACE\n") );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
status = NDIS_STATUS_NOT_ACCEPTED;\r
}\r
else\r
{\r
- info32 = p_adapter->p_viport->data.recvPool.bufferSz *\r
- p_adapter->p_viport->data.recvPool.poolSz;\r
+ info32 = p_netpath->pViport->data.recvPool.bufferSz *\r
+ p_netpath->pViport->data.recvPool.poolSz;\r
}\r
break;\r
case OID_GEN_MAXIMUM_LOOKAHEAD:\r
case OID_GEN_CURRENT_LOOKAHEAD:\r
case OID_GEN_TRANSMIT_BLOCK_SIZE:\r
case OID_GEN_RECEIVE_BLOCK_SIZE:\r
- case OID_GEN_MAXIMUM_TOTAL_SIZE:\r
VNIC_TRACE( VNIC_DBG_OID,\r
("received query for OID_GEN_MAXIMUM_LOOKAHEAD "\r
"or OID_GEN_CURRENT_LOOKAHEAD or "\r
"OID_GEN_TRANSMIT_BLOCK_SIZE or "\r
- "OID_GEN_RECEIVE_BLOCK_SIZE or "\r
- "OID_GEN_MAXIMUM_TOTAL_SIZE\n") );\r
- if( !p_adapter->p_currentPath->carrier )\r
+ "OID_GEN_RECEIVE_BLOCK_SIZE\n") );\r
+ if( !p_netpath->carrier )\r
{\r
- info32 = p_adapter->params.MinMtu;\r
+ info32 = MIN_MTU;\r
}\r
else\r
{\r
info32 = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA |\r
NDIS_MAC_OPTION_TRANSFERS_NOT_PEND |\r
NDIS_MAC_OPTION_NO_LOOPBACK |\r
- NDIS_MAC_OPTION_FULL_DUPLEX ;\r
-//TODO: Figure out if we will support priority and VLANs.\r
-// NDIS_MAC_OPTION_8021P_PRIORITY;\r
-//#ifdef NDIS51_MINIPORT\r
-// info |= NDIS_MAC_OPTION_8021Q_VLAN;\r
-//#endif\r
+ NDIS_MAC_OPTION_FULL_DUPLEX |\r
+ NDIS_MAC_OPTION_8021P_PRIORITY |\r
+ NDIS_MAC_OPTION_8021Q_VLAN;\r
+\r
break;\r
\r
case OID_GEN_MEDIA_CONNECT_STATUS:\r
case OID_GEN_XMIT_OK:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_XMIT_OK\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifOutOk;\r
+ info64 = p_netpath->pViport->stats.ifOutOk;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_RCV_OK:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_RCV_OK\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier)\r
+ if ( !p_netpath->carrier)\r
{\r
info32 = 0;\r
break;\r
}\r
if ( info_buf_len == sizeof(info32) )\r
{\r
- info32 = (uint32_t)p_adapter->p_viport->stats.ifInOk;\r
+ info32 = (uint32_t)p_netpath->pViport->stats.ifInOk;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifInOk;\r
+ info64 = p_netpath->pViport->stats.ifInOk;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_XMIT_ERROR:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_XMIT_ERROR\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifOutErrors;\r
+ info64 = p_netpath->pViport->stats.ifOutErrors;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_RCV_ERROR:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_RCV_ERROR\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifInErrors;\r
+ info64 = p_netpath->pViport->stats.ifInErrors;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_DIRECTED_BYTES_XMIT:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_DIRECTED_BYTES_XMIT\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifOutUcastBytes;\r
+ info64 = p_netpath->pViport->stats.ifOutUcastBytes;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_DIRECTED_FRAMES_XMIT:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_DIRECTED_FRAMES_XMIT\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifOutNUcastPkts;\r
+ info64 = p_netpath->pViport->stats.ifOutNUcastPkts;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_MULTICAST_BYTES_XMIT:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_MULTICAST_BYTES_XMIT\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifOutMulticastBytes;\r
+ info64 = p_netpath->pViport->stats.ifOutMulticastBytes;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_MULTICAST_FRAMES_XMIT:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_MULTICAST_FRAMES_XMIT\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifOutMulticastPkts;\r
+ info64 = p_netpath->pViport->stats.ifOutMulticastPkts;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_BROADCAST_BYTES_XMIT:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_BROADCAST_BYTES_XMIT\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifOutBroadcastBytes;\r
+ info64 = p_netpath->pViport->stats.ifOutBroadcastBytes;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_BROADCAST_FRAMES_XMIT:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_BROADCAST_FRAMES_XMIT\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifOutBroadcastPkts;\r
+ info64 = p_netpath->pViport->stats.ifOutBroadcastPkts;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_DIRECTED_BYTES_RCV:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_DIRECTED_BYTES_RCV\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifInUcastBytes;\r
+ info64 = p_netpath->pViport->stats.ifInUcastBytes;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_DIRECTED_FRAMES_RCV:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_DIRECTED_FRAMES_RCV\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifInNUcastPkts;\r
+ info64 = p_netpath->pViport->stats.ifInNUcastPkts;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_MULTICAST_BYTES_RCV:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_MULTICAST_BYTES_RCV\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifInMulticastBytes;\r
+ info64 = p_netpath->pViport->stats.ifInMulticastBytes;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_MULTICAST_FRAMES_RCV:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_MULTICAST_FRAMES_RCV\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifInMulticastPkts;\r
+ info64 = p_netpath->pViport->stats.ifInMulticastPkts;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_BROADCAST_BYTES_RCV:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_BROADCAST_BYTES_RCV\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifInBroadcastBytes;\r
+ info64 = p_netpath->pViport->stats.ifInBroadcastBytes;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
case OID_GEN_BROADCAST_FRAMES_RCV:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_GEN_BROADCAST_FRAMES_RCV\n" ) );\r
- if ( !p_adapter->p_currentPath->carrier )\r
+ if ( !p_netpath->carrier )\r
{\r
info32 = 0;\r
}\r
else\r
{\r
- info64 = p_adapter->p_viport->stats.ifInBroadcastPkts;\r
+ info64 = p_netpath->pViport->stats.ifInBroadcastPkts;\r
src_buf = &info64;\r
buf_len = sizeof(info64);\r
}\r
(" received query for OID_802_3_CURRENT_ADDRESS\n" ) );\r
}\r
#endif /* defined( _DEBUG_ )*/\r
- if( !p_adapter->p_viport ||\r
- p_adapter->p_viport->errored ||\r
- p_adapter->p_viport->disconnect )\r
+ if( !p_netpath->pViport ||\r
+ p_netpath->pViport->errored ||\r
+ p_netpath->pViport->disconnect )\r
{\r
status = NDIS_STATUS_NOT_ACCEPTED;\r
break;\r
}\r
else\r
{\r
- src_buf = &p_adapter->p_viport->hwMacAddress;\r
+ src_buf = &p_netpath->pViport->hwMacAddress;\r
buf_len = HW_ADDR_LEN;\r
}\r
break;\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" received query for OID_802_3_MULTICAST_LIST\n" ) );\r
\r
- if (!p_adapter->p_currentPath->carrier ||\r
- !(p_adapter->p_viport->flags & INIC_FLAG_ENABLE_NIC) )\r
+ if( !p_netpath->carrier ||\r
+ !(p_netpath->pViport->flags & INIC_FLAG_ENABLE_NIC) )\r
{\r
- p_adapter->pending_query = TRUE;\r
+/* p_adapter->pending_query = TRUE;\r
p_adapter->query_oid = oid_info;\r
\r
VNIC_TRACE( VNIC_DBG_OID,\r
("returning NDIS_STATUS_PENDING\n") );\r
- status = NDIS_STATUS_PENDING;\r
+ status = NDIS_STATUS_PENDING; \r
+*/\r
+ status = NDIS_STATUS_NOT_ACCEPTED;\r
+ break;\r
}\r
- else if ( p_adapter->mc_count > 0 )\r
+ if( p_adapter->mc_count > 0 )\r
{\r
buf_len = p_adapter->mc_count * sizeof( mac_addr_t );\r
src_buf = &p_adapter->mcast_array;\r
}\r
else\r
{\r
- info32 = p_adapter->p_viport->numMacAddresses - MCAST_ADDR_START;\r
+ info32 = p_netpath->pViport->numMacAddresses - MCAST_ADDR_START;\r
}\r
break;\r
case OID_802_3_MAC_OPTIONS:\r
status = __vnic_get_tcp_task_offload( p_adapter, &oid_info );\r
break;\r
\r
+ case OID_GEN_VLAN_ID:\r
+ /* return current vlan info */\r
+ info32 =( p_adapter->vlan_info & 0x00000fff );\r
+ break;\r
/* Optional General */\r
case OID_GEN_SUPPORTED_GUIDS:\r
-#ifdef NDIS51_MINIPORT\r
- case OID_GEN_VLAN_ID:\r
-#endif\r
-\r
/* Optional General Stats */\r
case OID_GEN_RCV_CRC_ERROR:\r
case OID_GEN_TRANSMIT_QUEUE_LENGTH:\r
NDIS_TASK_OFFLOAD_HEADER *p_offload_hdr;\r
NDIS_TASK_OFFLOAD *p_offload_task;\r
NDIS_TASK_TCP_IP_CHECKSUM *p_offload_chksum;\r
- //uint8_t port_num;\r
+\r
ULONG buf_len;\r
+ uint32_t enabled_TxCsum;\r
+ uint32_t enabled_RxCsum;\r
+ viport_t *p_viport;\r
\r
buf_len = sizeof(NDIS_TASK_OFFLOAD_HEADER) +\r
sizeof(NDIS_TASK_OFFLOAD) +\r
{\r
return NDIS_STATUS_INVALID_DATA;\r
}\r
+ p_viport = p_adapter->p_currentPath->pViport;\r
+\r
+ /* too early, we didn't get response on CMD_INIT_INIC yet */\r
+ if( !p_viport || !viport_features( p_viport ) )\r
+ {\r
+ return NDIS_STATUS_NOT_ACCEPTED;\r
+ }\r
+\r
+ enabled_RxCsum = \r
+ (uint32_t)( p_adapter->params.UseRxCsum && \r
+ viport_canRxCsum( p_adapter->p_currentPath->pViport ) );\r
+ enabled_TxCsum = \r
+ (uint32_t)( p_adapter->params.UseTxCsum && \r
+ viport_canTxCsum( p_adapter->p_currentPath->pViport ) );\r
\r
p_offload_hdr->OffsetFirstTask = sizeof(NDIS_TASK_OFFLOAD_HEADER);\r
p_offload_task = (NDIS_TASK_OFFLOAD*)(p_offload_hdr + 1);\r
p_offload_chksum =\r
(NDIS_TASK_TCP_IP_CHECKSUM*)p_offload_task->TaskBuffer;\r
\r
- p_offload_chksum->V4Transmit.IpOptionsSupported =\r
- p_adapter->params.UseTxCsum;\r
- p_offload_chksum->V4Transmit.TcpOptionsSupported =\r
- p_adapter->params.UseTxCsum;\r
- p_offload_chksum->V4Transmit.TcpChecksum =\r
- p_adapter->params.UseTxCsum;\r
- p_offload_chksum->V4Transmit.UdpChecksum =\r
- p_adapter->params.UseTxCsum;\r
- p_offload_chksum->V4Transmit.IpChecksum =\r
- p_adapter->params.UseTxCsum;\r
-\r
- p_offload_chksum->V4Receive.IpOptionsSupported = TRUE;\r
- p_offload_chksum->V4Receive.TcpOptionsSupported = TRUE;\r
- p_offload_chksum->V4Receive.TcpChecksum =\r
- p_adapter->params.UseRxCsum;\r
- p_offload_chksum->V4Receive.UdpChecksum =\r
- p_adapter->params.UseRxCsum;\r
- p_offload_chksum->V4Receive.IpChecksum =\r
- p_adapter->params.UseRxCsum;\r
+ p_offload_chksum->V4Transmit.IpOptionsSupported = enabled_TxCsum;\r
+ p_offload_chksum->V4Transmit.TcpOptionsSupported = enabled_TxCsum;\r
+ p_offload_chksum->V4Transmit.TcpChecksum = enabled_TxCsum;\r
+ p_offload_chksum->V4Transmit.UdpChecksum = enabled_TxCsum;\r
+ p_offload_chksum->V4Transmit.IpChecksum = enabled_TxCsum;\r
+\r
+ p_offload_chksum->V4Receive.IpOptionsSupported = enabled_RxCsum;\r
+ p_offload_chksum->V4Receive.TcpOptionsSupported = enabled_RxCsum;\r
+ p_offload_chksum->V4Receive.TcpChecksum = enabled_RxCsum;\r
+ p_offload_chksum->V4Receive.UdpChecksum = enabled_RxCsum;\r
+ p_offload_chksum->V4Receive.IpChecksum = enabled_RxCsum;\r
\r
p_offload_chksum->V6Transmit.IpOptionsSupported = FALSE;\r
p_offload_chksum->V6Transmit.TcpOptionsSupported = FALSE;\r
NDIS_TASK_OFFLOAD *p_offload_task;\r
NDIS_TASK_TCP_IP_CHECKSUM *p_offload_chksum;\r
\r
+ ULONG enabled_TxCsum;\r
+ ULONG enabled_RxCsum;\r
+\r
VNIC_ENTER( VNIC_DBG_OID );\r
\r
p_offload_hdr = (NDIS_TASK_OFFLOAD_HEADER*)p_info_buf;\r
p_offload_chksum =\r
(NDIS_TASK_TCP_IP_CHECKSUM*)p_offload_task->TaskBuffer;\r
\r
- if( !p_adapter->params.UseTxCsum &&\r
+ enabled_TxCsum = \r
+ ( p_adapter->params.UseTxCsum && viport_canTxCsum( p_adapter->p_currentPath->pViport ) );\r
+ enabled_RxCsum = \r
+ ( p_adapter->params.UseRxCsum && viport_canRxCsum( p_adapter->p_currentPath->pViport ) );\r
+ \r
+ if( !enabled_TxCsum &&\r
(p_offload_chksum->V4Transmit.IpOptionsSupported ||\r
p_offload_chksum->V4Transmit.TcpOptionsSupported ||\r
p_offload_chksum->V4Transmit.TcpChecksum ||\r
return NDIS_STATUS_NOT_SUPPORTED;\r
}\r
\r
- if( !p_adapter->params.UseRxCsum &&\r
+ if( !enabled_RxCsum &&\r
(p_offload_chksum->V4Receive.IpOptionsSupported ||\r
p_offload_chksum->V4Receive.TcpOptionsSupported ||\r
p_offload_chksum->V4Receive.TcpChecksum ||\r
{\r
return NDIS_STATUS_NOT_SUPPORTED;\r
}\r
+\r
if( p_offload_chksum->V6Receive.IpOptionsSupported ||\r
p_offload_chksum->V6Receive.TcpOptionsSupported ||\r
p_offload_chksum->V6Receive.TcpChecksum ||\r
\r
p_adapter = (vnic_adapter_t*)adapter_context;\r
\r
- status = vnic_reset_adapter( p_adapter );\r
+ status = adapter_reset( p_adapter );\r
VNIC_EXIT( VNIC_DBG_INIT );\r
switch( status )\r
{\r
OUT PULONG p_bytes_needed )\r
{\r
vnic_adapter_t* p_adapter;\r
+ Netpath_t* p_netpath; \r
NDIS_STATUS status;\r
ULONG buf_len;\r
pending_oid_t oid_info;\r
\r
CL_ASSERT( adapter_context );\r
p_adapter = (vnic_adapter_t*)adapter_context;\r
+ p_netpath= p_adapter->p_currentPath;\r
\r
CL_ASSERT( p_bytes_read );\r
CL_ASSERT( p_bytes_needed );\r
- CL_ASSERT( p_adapter->pending_set == 0 );\r
+ CL_ASSERT( !p_adapter->pending_set );\r
\r
status = NDIS_STATUS_SUCCESS;\r
*p_bytes_needed = 0;\r
(" IOC %d received set for OID_GEN_CURRENT_PACKET_FILTER, %#x\n",\r
p_adapter->p_currentPath->pViport->ioc_num,\r
*(uint32_t*)info_buf ));\r
- if ( !p_adapter->p_currentPath->carrier )\r
- {\r
- status = NDIS_STATUS_NOT_ACCEPTED;\r
- break;\r
- }\r
+// if ( !p_adapter->p_currentPath->carrier )\r
+// {\r
+// status = NDIS_STATUS_NOT_ACCEPTED;\r
+// break;\r
+// }\r
if( info_buf_len < sizeof( p_adapter->packet_filter ) )\r
{\r
status = NDIS_STATUS_INVALID_LENGTH;\r
else\r
{\r
p_adapter->set_oid = oid_info;\r
- status = _vnic_process_packet_filter( p_adapter, *((uint32_t*)info_buf) );\r
+ status = _vnic_process_packet_filter( p_adapter, *((ULONG*)info_buf) );\r
}\r
break;\r
\r
else\r
{\r
p_adapter->set_oid = oid_info;\r
- status = vnic_set_mcast( p_adapter, (mac_addr_t*)info_buf,\r
+ status = adapter_set_mcast( p_adapter, (mac_addr_t*)info_buf,\r
(uint8_t)(info_buf_len / sizeof(mac_addr_t)) );\r
}\r
break;\r
VNIC_TRACE( VNIC_DBG_OID,\r
("Set for OID_GEN_TRANSPORT_HEADER_OFFSET\n") );\r
break;\r
-#ifdef NDIS51_MINIPORT\r
- case OID_GEN_RNDIS_CONFIG_PARAMETER:\r
case OID_GEN_VLAN_ID:\r
-#endif\r
- status = NDIS_STATUS_NOT_SUPPORTED;\r
- VNIC_TRACE( VNIC_DBG_OID,\r
- (" received an unsupported oid of 0x%.8X!\n" , oid));\r
+ if( info_buf_len != 4 )\r
+ {\r
+ status = NDIS_STATUS_INVALID_LENGTH;\r
+ break;\r
+ }\r
+ if( *(( uint32_t *)info_buf) < 4095 )\r
+ {\r
+ p_adapter->vlan_info = *((uint32_t*)info_buf );\r
+ }\r
+ else\r
+ {\r
+ status = NDIS_STATUS_INVALID_DATA;\r
+ }\r
break;\r
\r
case OID_GEN_SUPPORTED_LIST:\r
VNIC_EXIT( VNIC_DBG_SEND );\r
}\r
\r
+void vnic_cancel_xmit(\r
+ IN NDIS_HANDLE adapter_context,\r
+ IN PVOID cancel_id )\r
+{\r
+ vnic_adapter_t* const p_adapter =(vnic_adapter_t* const )adapter_context;\r
+\r
+ if( p_adapter && \r
+ p_adapter->p_currentPath )\r
+ {\r
+ netpath_cancel_xmit( p_adapter->p_currentPath, cancel_id );\r
+ }\r
+}\r
+\r
void\r
vnic_pnp_notify(\r
IN NDIS_HANDLE adapter_context,\r
IN PVOID info_buf,\r
IN ULONG info_buf_len )\r
{\r
- vnic_adapter_t *p_adapter;\r
+ vnic_adapter_t *p_adapter; \r
\r
VNIC_ENTER( VNIC_DBG_PNP );\r
\r
\r
p_adapter = (vnic_adapter_t*)adapter_context;\r
\r
- VNIC_TRACE( VNIC_DBG_PNP, ("Event %d IOC[%d]\n", pnp_event, p_adapter->ioc_num ) );\r
- if( pnp_event != NdisDevicePnPEventPowerProfileChanged )\r
+ CL_ASSERT( p_adapter );\r
+\r
+ VNIC_TRACE( VNIC_DBG_PNP, ("Event %d for IOC[%d] in state %#x\n", \r
+ pnp_event, p_adapter->ioc_num, p_adapter->pnp_state ) );\r
+\r
+ switch ( pnp_event )\r
{\r
- InterlockedExchange( (volatile LONG *)&p_adapter->pnp_state, IB_PNP_IOC_REMOVE );\r
+ case NdisDevicePnPEventPowerProfileChanged: \r
+ break;\r
+ case NdisDevicePnPEventQueryRemoved:\r
+ case NdisDevicePnPEventRemoved:\r
+ case NdisDevicePnPEventSurpriseRemoved:\r
+ case NdisDevicePnPEventQueryStopped:\r
+ case NdisDevicePnPEventStopped:\r
+ case NdisDevicePnPEventMaximum:\r
+\r
+ if( InterlockedExchange( (volatile LONG*)&p_adapter->pnp_state, IB_PNP_IOC_REMOVE ) == IB_PNP_IOC_ADD )\r
+ {\r
+ if( netpath_is_valid( p_adapter->p_currentPath ) )\r
+ {\r
+ netpath_stopXmit( p_adapter->p_currentPath );\r
+ InterlockedExchange( &p_adapter->p_currentPath->carrier, (LONG)FALSE );\r
+ netpath_linkDown( p_adapter->p_currentPath );\r
+ __pending_queue_cleanup( p_adapter );\r
+ }\r
+ }\r
vnic_resume_oids( p_adapter );\r
+ break;\r
}\r
\r
VNIC_EXIT( VNIC_DBG_PNP );\r
IN PVOID adapter_context )\r
{\r
vnic_adapter_t *p_adapter;\r
+ Netpath_t *p_netpath;\r
+\r
VNIC_ENTER( VNIC_DBG_INIT );\r
p_adapter = (vnic_adapter_t *)adapter_context;\r
\r
if( p_adapter )\r
{\r
+ g_vnic.shutdown = p_adapter->ioc_num;\r
VNIC_TRACE( VNIC_DBG_INIT, \r
- ("IOC[%d]Shutdown -early retierement\n", p_adapter->ioc_num ));\r
+ ("IOC[%d] going to Shutdown\n", p_adapter->ioc_num ));\r
+ p_netpath = p_adapter->p_currentPath;\r
\r
- if( p_adapter->p_currentPath &&\r
- p_adapter->p_currentPath->pViport )\r
+ if( p_netpath && p_netpath->pViport )\r
{\r
- viport_stopXmit( p_adapter->p_currentPath->pViport );\r
- viport_linkDown( p_adapter->p_currentPath->pViport );\r
- InterlockedExchange( &p_adapter->p_currentPath->carrier, (LONG)FALSE );\r
+ netpath_stopXmit( p_netpath );\r
+ InterlockedExchange( &p_netpath->carrier, (LONG)FALSE );\r
+ netpath_linkDown( p_netpath );\r
}\r
+\r
vnic_destroy_adapter( p_adapter );\r
}\r
\r
IN vnic_adapter_t* const p_adapter )\r
{\r
NDIS_STATUS status = NDIS_STATUS_SUCCESS;\r
- int pending_set;\r
+ BOOLEAN pending_set;\r
pending_oid_t set_oid = {0};\r
\r
+ Netpath_t* p_netpath;\r
VNIC_ENTER( VNIC_DBG_OID );\r
\r
+ if( !p_adapter->pending_set )\r
+ {\r
+ VNIC_EXIT( VNIC_DBG_OID );\r
+ return;\r
+ }\r
NdisAcquireSpinLock( &p_adapter->lock );\r
+ p_netpath = p_adapter->p_currentPath;\r
+ VNIC_TRACE( VNIC_DBG_OID,\r
+ ("IOC[%d]Resume Set OID %#x\n",\r
+ p_adapter->ioc_num, p_adapter->set_oid.oid ));\r
/*\r
* Set the status depending on our state. Fail OID requests that\r
* are pending while we reset the adapter.\r
*/\r
- switch( p_adapter->pnp_state )\r
+ if( p_adapter->pnp_state != IB_PNP_IOC_REMOVE && \r
+ netpath_is_connected( p_netpath ) )\r
+ {\r
+ status = NDIS_STATUS_SUCCESS;\r
+ }\r
+ else\r
{\r
- case IB_PNP_IOC_ADD:\r
- break;\r
-\r
- case IB_PNP_IOC_REMOVE:\r
- default:\r
status = NDIS_STATUS_NOT_ACCEPTED;\r
- break;\r
+ if( p_adapter->pending_set )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_PNP,\r
+ ("IOC[%d]Pending set OID %#x while removing \n",\r
+ p_adapter->ioc_num, p_adapter->set_oid.oid ));\r
+ }\r
}\r
\r
pending_set = p_adapter->pending_set;\r
if( pending_set )\r
{\r
set_oid = p_adapter->set_oid;\r
- --p_adapter->pending_set;\r
+ p_adapter->pending_set = FALSE;\r
}\r
NdisReleaseSpinLock( &p_adapter->lock );\r
\r
ASSERT( KeGetCurrentIrql() == DISPATCH_LEVEL );\r
\r
- if( pending_set )\r
+ if( pending_set && status == NDIS_STATUS_SUCCESS )\r
{\r
switch( set_oid.oid )\r
{\r
case OID_GEN_CURRENT_PACKET_FILTER:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" IOC %d resume PACKET_FILTER set \n",\r
- p_adapter->p_currentPath->pViport->ioc_num ) );\r
+ p_netpath->pViport->ioc_num ) );\r
/* Validation already performed in the SetInformation path. */\r
p_adapter->packet_filter = *(PULONG)set_oid.p_buf;\r
- NdisMSetInformationComplete( p_adapter->h_handle, status );\r
break;\r
\r
case OID_GEN_MACHINE_NAME:\r
status = __vnic_set_machine_name ( p_adapter->set_oid.p_buf, (USHORT)p_adapter->set_oid.buf_len );\r
- NdisMSetInformationComplete( p_adapter->h_handle, status );\r
break;\r
\r
case OID_802_3_MULTICAST_LIST:\r
VNIC_TRACE( VNIC_DBG_OID,\r
(" IOC %d resume MULTICAST_LIST\n",\r
- p_adapter->p_currentPath->pViport->ioc_num ) );\r
-\r
- NdisMSetInformationComplete( p_adapter->h_handle, status );\r
+ p_netpath->pViport->ioc_num ) );\r
break;\r
\r
default:\r
}\r
}\r
\r
+ if( !netpath_is_connected( p_netpath ) )\r
+ {\r
+ NdisMSetInformationComplete( p_adapter->h_handle, \r
+ NDIS_STATUS_NOT_ACCEPTED );\r
+ }\r
+ else\r
+ NdisMSetInformationComplete( p_adapter->h_handle, status );\r
+\r
VNIC_EXIT( VNIC_DBG_OID );\r
}\r
\r
pending_oid_t query_oid = {0};\r
KIRQL irql;\r
\r
+ Netpath_t* p_netpath = p_adapter->p_currentPath;\r
+\r
uint8_t mac[HW_ADDR_LEN];\r
\r
VNIC_ENTER( VNIC_DBG_OID );\r
* Set the status depending on our state. Fail OID requests that\r
* are pending while we reset the adapter.\r
*/\r
- if( !p_adapter->p_viport ||\r
- p_adapter->p_viport->disconnect == TRUE ||\r
- p_adapter->p_viport->errored == TRUE )\r
+ if( !netpath_is_connected( p_netpath ) )\r
{\r
status = NDIS_STATUS_NOT_ACCEPTED;\r
}\r
case OID_802_3_PERMANENT_ADDRESS:\r
if ( status == NDIS_STATUS_SUCCESS )\r
{\r
- cl_memcpy( mac, p_adapter->p_viport->hwMacAddress, HW_ADDR_LEN );\r
+ cl_memcpy( mac, p_netpath->pViport->hwMacAddress, HW_ADDR_LEN );\r
}\r
_vnic_complete_query( p_adapter,\r
&query_oid,\r
sizeof( info ) );\r
break;\r
case OID_802_3_MULTICAST_LIST:\r
- ASSERT( p_adapter->p_viport );\r
- _vnic_complete_query( p_adapter,\r
+ _vnic_complete_query( p_adapter,\r
&query_oid,\r
status,\r
- &p_adapter->p_viport->macAddresses[MCAST_ADDR_START],\r
- (p_adapter->p_viport->numMacAddresses -\r
- MCAST_ADDR_START) * sizeof( mac_addr_t ) );\r
+ p_netpath->p_adapter->mcast_array,\r
+ ( sizeof( p_netpath->p_adapter->mcast_array ) * sizeof( mac_addr_t ) ) );\r
break;\r
case OID_GEN_TRANSMIT_BUFFER_SPACE:\r
- info = p_adapter->p_viport->data.xmitPool.bufferSz *\r
- p_adapter->p_viport->data.xmitPool.numXmitBufs;\r
+ if( status == NDIS_STATUS_SUCCESS )\r
+ {\r
+ info = p_netpath->pViport->data.xmitPool.bufferSz *\r
+ p_netpath->pViport->data.xmitPool.numXmitBufs;\r
+ }\r
+ else\r
+ {\r
+ info = 0;\r
+ }\r
_vnic_complete_query( p_adapter,\r
&query_oid,\r
status,\r
sizeof( info ) );\r
break;\r
case OID_GEN_RECEIVE_BUFFER_SPACE:\r
- info = p_adapter->p_viport->data.recvPool.bufferSz *\r
- p_adapter->p_viport->data.recvPool.poolSz;\r
+ if( status == NDIS_STATUS_SUCCESS )\r
+ {\r
+ info = p_netpath->pViport->data.recvPool.bufferSz *\r
+ p_netpath->pViport->data.recvPool.poolSz;\r
+ }\r
+ else\r
+ {\r
+ info = 0;\r
+ }\r
_vnic_complete_query( p_adapter,\r
&query_oid,\r
status,\r
{\r
NDIS_STATUS status = NDIS_STATUS_SUCCESS;\r
uint8_t *p_src_buf = (uint8_t *)p_uni_array;\r
- int i;\r
+ uint32_t i;\r
\r
VNIC_ENTER( VNIC_DBG_OID );\r
\r
- cl_memclr(g_vnic.host_name, 65 );\r
- for( i = 0; i < ( buf_size >1 ); i++ )\r
+ if( buf_size > 0 )\r
{\r
- g_vnic.host_name[i] = *(p_src_buf + i*2);\r
+ cl_memclr(g_vnic.host_name, sizeof( g_vnic.host_name ) );\r
+ for( i = 0; i < min( ( buf_size > 1 ), sizeof( g_vnic.host_name ) ); i++ )\r
+ {\r
+ g_vnic.host_name[i] = *(p_src_buf + i*2);\r
+ }\r
}\r
\r
return status;\r
IN vnic_adapter_t* const p_adapter,\r
IN ULONG pkt_filter )\r
{\r
- NDIS_STATUS status;\r
+ NDIS_STATUS status = NDIS_STATUS_SUCCESS;\r
+ viport_t *p_viport;\r
+ ULONG need_updates = 0;\r
\r
VNIC_ENTER(VNIC_DBG_FUNC );\r
\r
ASSERT( p_adapter );\r
- ASSERT( p_adapter->p_viport );\r
- ASSERT( !(p_adapter->p_viport->updates & SYNC_QUERY) );\r
\r
- InterlockedExchange((volatile LONG*)&p_adapter->packet_filter, pkt_filter );\r
+ p_viport = p_adapter->p_currentPath->pViport;\r
\r
- ASSERT( (p_adapter->p_viport->updates & ~MCAST_OVERFLOW) == 0 );\r
+ ASSERT( p_viport );\r
+ ASSERT( !( p_viport->updates & SYNC_QUERY ) );\r
\r
- if( !( p_adapter->p_viport->flags & INIC_FLAG_ENABLE_NIC ) )\r
+ if( ( InterlockedExchange( \r
+ (volatile LONG*)&p_adapter->packet_filter, pkt_filter )) == (LONG)pkt_filter )\r
{\r
- p_adapter->p_viport->newFlags &= ~INIC_FLAG_DISABLE_NIC;\r
- p_adapter->p_viport->newFlags |= INIC_FLAG_ENABLE_NIC;\r
- InterlockedOr( &p_adapter->p_viport->updates, NEED_LINK_CONFIG );\r
+ InterlockedExchange( &p_viport->updates, 0 );\r
+ return status;\r
}\r
\r
- if( pkt_filter & NDIS_PACKET_TYPE_ALL_MULTICAST )\r
+ ASSERT( (p_viport->updates & ~MCAST_OVERFLOW) == 0 );\r
+\r
+ if( pkt_filter )\r
{\r
- if( !( p_adapter->p_viport->flags & INIC_FLAG_ENABLE_MCAST_ALL ) )\r
+ if( !( p_viport->flags & INIC_FLAG_ENABLE_NIC ) )\r
{\r
- p_adapter->p_viport->newFlags |= INIC_FLAG_ENABLE_MCAST_ALL;\r
- // TODO: Shouldn't MCAST_OVERFLOW be a flag bit, not an update bit?\r
- InterlockedOr( &p_adapter->p_viport->updates,\r
- NEED_LINK_CONFIG | MCAST_OVERFLOW );\r
+ p_viport->newFlags &= ~INIC_FLAG_DISABLE_NIC;\r
+ p_viport->newFlags |= INIC_FLAG_ENABLE_NIC;\r
+ InterlockedOr( (volatile LONG*)&need_updates, NEED_LINK_CONFIG );\r
}\r
- }\r
\r
- if ( pkt_filter & NDIS_PACKET_TYPE_PROMISCUOUS )\r
- {\r
- if( !( p_adapter->p_viport->flags & INIC_FLAG_ENABLE_PROMISC ) )\r
+ if( pkt_filter & NDIS_PACKET_TYPE_ALL_MULTICAST )\r
{\r
- p_adapter->p_viport->newFlags |= INIC_FLAG_ENABLE_PROMISC;\r
- InterlockedOr( &p_adapter->p_viport->updates, NEED_LINK_CONFIG );\r
+ if( !( p_viport->flags & INIC_FLAG_ENABLE_MCAST_ALL ) )\r
+ {\r
+ p_viport->newFlags &= ~INIC_FLAG_DISABLE_MCAST_ALL;\r
+ p_viport->newFlags |= INIC_FLAG_ENABLE_MCAST_ALL;\r
+ InterlockedOr( (volatile LONG*)&need_updates,\r
+ NEED_LINK_CONFIG | MCAST_OVERFLOW );\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if( p_viport->flags & NDIS_PACKET_TYPE_ALL_MULTICAST )\r
+ {\r
+ p_viport->newFlags &= ~INIC_FLAG_ENABLE_MCAST_ALL;\r
+ p_viport->newFlags |= INIC_FLAG_DISABLE_MCAST_ALL;\r
+ InterlockedOr( (volatile LONG*)&need_updates, NEED_LINK_CONFIG );\r
+ }\r
+ }\r
+\r
+ if ( pkt_filter & NDIS_PACKET_TYPE_PROMISCUOUS )\r
+ {\r
+ if( !( p_viport->flags & INIC_FLAG_ENABLE_PROMISC ) )\r
+ {\r
+ p_viport->newFlags &= ~INIC_FLAG_DISABLE_PROMISC;\r
+ p_viport->newFlags |= INIC_FLAG_ENABLE_PROMISC;\r
+ InterlockedOr( (volatile LONG*)&need_updates, NEED_LINK_CONFIG );\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if( p_viport->flags & INIC_FLAG_ENABLE_PROMISC )\r
+ {\r
+ p_viport->newFlags &= ~INIC_FLAG_ENABLE_PROMISC;\r
+ p_viport->newFlags |= INIC_FLAG_DISABLE_PROMISC;\r
+ InterlockedOr( (volatile LONG*)&need_updates, NEED_LINK_CONFIG );\r
+ }\r
}\r
}\r
\r
/* ENABLE NIC, BROADCAST and MULTICAST flags set on start */\r
-\r
- ++p_adapter->pending_set;\r
- status = _viport_process_query( p_adapter->p_viport, FALSE );\r
- VNIC_TRACE( VNIC_DBG_OID,\r
- ("LINK CONFIG status %x\n", status ));\r
- if( status != NDIS_STATUS_PENDING )\r
+ if( need_updates )\r
{\r
- --p_adapter->pending_set;\r
+ p_adapter->pending_set = TRUE;\r
+ InterlockedOr( &p_viport->updates, need_updates );\r
+\r
+ status = _viport_process_query( p_viport, FALSE );\r
+ VNIC_TRACE( VNIC_DBG_OID,\r
+ ("LINK CONFIG status %x\n", status ));\r
+ if( status != NDIS_STATUS_PENDING )\r
+ {\r
+ p_adapter->pending_set = FALSE;\r
+ }\r
}\r
+\r
VNIC_EXIT( VNIC_DBG_FUNC );\r
return status;\r
}\r
\r
+static NTSTATUS\r
+__vnic_read_service_registry(\r
+ IN UNICODE_STRING* const p_registry_path )\r
+{\r
+ NTSTATUS status;\r
+ RTL_QUERY_REGISTRY_TABLE table[VNIC_REGISTRY_TBL_SIZE + 1];\r
+ UNICODE_STRING param_path;\r
+ ULONG _reg_dbg_lvl = 0;\r
+ int i;\r
+\r
+ RtlInitUnicodeString( ¶m_path, NULL );\r
+ param_path.MaximumLength = \r
+ p_registry_path->Length + sizeof(L"\\Parameters");\r
+ \r
+ param_path.Buffer = cl_zalloc( param_path.MaximumLength );\r
+ if( !param_path.Buffer )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("Failed to allocate parameters path buffer.\n") );\r
+ return STATUS_INSUFFICIENT_RESOURCES;\r
+ }\r
+\r
+ RtlAppendUnicodeStringToString( ¶m_path, p_registry_path );\r
+ RtlAppendUnicodeToString( ¶m_path, L"\\Parameters" );\r
+\r
+ cl_memclr( table, sizeof(table) );\r
+ \r
+ /* init debug flags entry */\r
+ table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+ table[0].Name = L"DebugFlags";\r
+ table[0].EntryContext = &_reg_dbg_lvl;\r
+ table[0].DefaultType = REG_DWORD;\r
+ table[0].DefaultData = &_reg_dbg_lvl;\r
+ table[0].DefaultLength = sizeof(ULONG);\r
+\r
+ /* Setup the rest of table entries. */\r
+ for ( i = 1; i < VNIC_REGISTRY_TBL_SIZE; i++ )\r
+ {\r
+ table[i].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+ table[i].Name = reg_array[i].name;\r
+ table[i].EntryContext = ®_array[i].value;\r
+ table[i].DefaultType = REG_DWORD;\r
+ table[i].DefaultData = ®_array[i].value;\r
+ table[i].DefaultLength = sizeof(ULONG);\r
+ }\r
+\r
+ status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, \r
+ param_path.Buffer, table, NULL, NULL );\r
+\r
+ if( status == STATUS_SUCCESS )\r
+ {\r
+ g_vnic_dbg_lvl |= _reg_dbg_lvl;\r
+ VNIC_TRACE(VNIC_DBG_INFO, ("DebugFlags Set %#x\n",g_vnic_dbg_lvl ));\r
+ g_vnic.p_params = reg_array;\r
+ }\r
+\r
+ cl_free( param_path.Buffer );\r
+\r
+ return status;\r
+}\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
OID_GEN_MULTICAST_FRAMES_RCV,\r
OID_GEN_BROADCAST_BYTES_RCV,\r
OID_GEN_BROADCAST_FRAMES_RCV,\r
+ OID_GEN_VLAN_ID,\r
OID_802_3_PERMANENT_ADDRESS,\r
OID_802_3_CURRENT_ADDRESS,\r
OID_802_3_MULTICAST_LIST,\r
IN UINT num_packets );\r
\r
void\r
+vnic_cancel_xmit(\r
+ IN NDIS_HANDLE adapter_context,\r
+ IN PVOID cancel_id );\r
+void\r
vnic_pnp_notify(\r
IN NDIS_HANDLE adapter_context,\r
IN NDIS_DEVICE_PNP_EVENT pnp_event,\r
IN cl_timer_t* const p_timer,\r
IN const uint32_t time_usec );\r
\r
-#endif /* _VNIC_DRIVER_H_ */
\ No newline at end of file
+#endif /* _VNIC_DRIVER_H_ */\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
p_adapter->ifc.get_err_str(ib_status), ib_status ) );\r
pRegion->h_mr = NULL;\r
}\r
- pRegion->virtAddress = vaddr;\r
- pRegion->len = len;\r
+ else\r
+ {\r
+ pRegion->virtAddress = vaddr;\r
+ pRegion->len = len;\r
+ }\r
\r
VNIC_EXIT( VNIC_DBG_IB );\r
return ib_status;\r
{\r
VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
("Dereg MR failed status (%d)\n", ib_status ));\r
- return;\r
}\r
- InterlockedExchangePointer( (void *)&pRegion->h_mr, NULL );\r
+ pRegion->h_mr = NULL;\r
}\r
\r
VNIC_EXIT( VNIC_DBG_IB );\r
cq_create.h_wait_obj = NULL;\r
\r
ib_status = pQp->pViport->p_adapter->ifc.create_cq(\r
- pQp->pViport->p_adapter->h_ca, &cq_create, pQp, NULL, &h_cq );\r
+ pQp->pViport->p_adapter->h_ca, &cq_create, pQp, ib_asyncEvent, &h_cq );\r
\r
if( ib_status != IB_SUCCESS )\r
{\r
attribCreate.sq_signaled = FALSE;\r
\r
ib_status = pQp->pViport->p_adapter->ifc.create_qp(\r
- pQp->pViport->p_adapter->ca.hPd, &attribCreate, pQp, NULL, &pQp->qp );\r
+ pQp->pViport->p_adapter->ca.hPd, \r
+ &attribCreate, \r
+ pQp,\r
+ ib_asyncEvent,\r
+ &pQp->qp );\r
if( ib_status != IB_SUCCESS )\r
{\r
VNIC_TRACE_EXIT( VNIC_DBG_IB, ("Create QP failed %s\n",\r
}\r
\r
if( cl_event_wait_on(\r
- &p_viport->conn_event, EVENT_NO_TIMEOUT, FALSE ) != CL_SUCCESS )\r
+ &p_viport->sync_event, EVENT_NO_TIMEOUT, FALSE ) != CL_SUCCESS )\r
{\r
VNIC_TRACE_EXIT( VNIC_DBG_ERROR, ("conn event timeout!\n") );\r
return IB_TIMEOUT;\r
cl_ntoh16( p_rej_rec->rej_status )) );\r
}\r
viport_failure( pQp->pViport );\r
- cl_event_signal( &pQp->pViport->conn_event );\r
+ cl_event_signal( &pQp->pViport->sync_event );\r
}\r
\r
static void\r
}\r
\r
InterlockedExchange (&pQp->qpState, IB_DETACHED );\r
+ pQp->pViport->p_adapter->hung++;\r
+ viport_failure( pQp->pViport );\r
\r
VNIC_EXIT( VNIC_DBG_IB );\r
}\r
InterlockedExchange ( &pQp->qpState, IB_ATTACHED );\r
}\r
\r
- cl_event_signal( &p_viport->conn_event );\r
+ cl_event_signal( &p_viport->sync_event );\r
VNIC_EXIT( VNIC_DBG_IB );\r
}\r
\r
\r
#ifdef VNIC_STATISTIC\r
int64_t compTime;\r
- uint32_t compNum = 0;\r
#endif /* VNIC_STATISTIC */\r
\r
VNIC_ENTER ( VNIC_DBG_IB );\r
IN ib_async_event_rec_t *pEventRecord )\r
{\r
vnic_adapter_t *p_adapter;\r
+ viport_t *p_viport;\r
\r
VNIC_ENTER ( VNIC_DBG_IB );\r
\r
if ( pEventRecord )\r
{\r
- p_adapter = (vnic_adapter_t * __ptr64 )pEventRecord->context;\r
-\r
+ \r
switch ( pEventRecord->code )\r
{\r
- case IB_AE_QP_COMM:\r
- case IB_AE_QP_FATAL:\r
+ case IB_AE_PORT_DOWN:\r
+ p_adapter = ( vnic_adapter_t * __ptr64)pEventRecord->context;\r
+\r
+ if( p_adapter &&\r
+ p_adapter->p_currentPath->pViport &&\r
+ !p_adapter->p_currentPath->pViport->errored )\r
+ {\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("Async Event %d\n", pEventRecord->code ));\r
+ ("Async Event Port Down for CA GUID: %#016I64x\n", \r
+ p_adapter->ifc_data.ca_guid ) );\r
+ }\r
break;\r
- case IB_AE_PORT_DOWN:\r
+\r
+ case IB_AE_CQ_ERROR:\r
+ case IB_AE_RQ_ERROR:\r
+ case IB_AE_SQ_ERROR:\r
+ case IB_AE_QP_FATAL:\r
+ case IB_AE_WQ_REQ_ERROR:\r
+ case IB_AE_WQ_ACCESS_ERROR:\r
+\r
+ p_viport = ((IbQp_t * __ptr64 )pEventRecord->context)->pViport;\r
+\r
+ if( p_viport && !p_viport->errored )\r
+ {\r
+ viport_failure( p_viport );\r
+\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("Async Event %s (%#x) for port GUID: %#016I64x\n",\r
+ ib_get_async_event_str( pEventRecord->code ),\r
+ pEventRecord->code, \r
+ p_viport->portGuid ) );\r
+\r
+ }\r
+ break;\r
+\r
default:\r
- VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("Async Event %d received\n", pEventRecord->code) );\r
- if( p_adapter && p_adapter->p_viport )\r
- viport_stopXmit( p_adapter->p_viport );\r
- break;\r
+ VNIC_TRACE( VNIC_DBG_IB,\r
+ ("Async Event %d\n", pEventRecord->code ));\r
+ break;\r
}\r
}\r
- else\r
- {\r
- VNIC_TRACE( VNIC_DBG_ERROR, ("Unknown NULL event\n") );\r
- }\r
+\r
VNIC_EXIT ( VNIC_DBG_IB );\r
}\r
\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
#pragma warning ( disable : 4324 )\r
typedef struct _vnic_path_record {\r
cl_list_item_t list_entry;\r
- uint32_t num_entries;\r
ib_path_rec_t path_rec;\r
} vnic_path_record_t;\r
#pragma warning( default : 4324 )\r
uint64_t portGuids[VNIC_CA_MAX_PORTS];\r
} IbCa_t;\r
\r
-typedef enum _OpType { RECV, RDMA, SEND }OpType_t;\r
+typedef enum _OpType {\r
+ RECV, \r
+ RDMA,\r
+ SEND \r
+} OpType_t;\r
\r
typedef struct Io {\r
LIST_ENTRY listPtrs;\r
-\r
+/*\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
#include "vnic_adapter.h"\r
\r
extern vnic_globals_t g_vnic;\r
IN Netpath_t *pNetpath,\r
IN vnic_adapter_t *p_adapter )\r
{\r
- int i;\r
-\r
VNIC_ENTER( VNIC_DBG_FUNC );\r
\r
pNetpath->p_adapter = p_adapter;\r
pNetpath->carrier = 0;\r
pNetpath->pViport = NULL;\r
+ pNetpath->p_path_rec = NULL;\r
pNetpath->timerState = NETPATH_TS_IDLE;\r
\r
- for ( i = 0; i < INICNP_NUM_EVENTS; i++ )\r
- {\r
- p_adapter->np_event[i].p_adapter = p_adapter;\r
- p_adapter->np_event[i].event_num = (uint8_t)i;\r
- InitializeListHead( &p_adapter->np_event[i].listPtrs );\r
- }\r
-\r
VNIC_EXIT( VNIC_DBG_FUNC );\r
return;\r
}\r
}\r
}\r
\r
+BOOLEAN\r
+netpath_setUnicast(\r
+ IN Netpath_t* p_netpath,\r
+ IN uint8_t* p_address )\r
+{\r
+ if( p_netpath->pViport )\r
+ {\r
+ return( viport_setUnicast( p_netpath->pViport, p_address ) );\r
+ }\r
+ return FALSE;\r
+}\r
+\r
+NDIS_STATUS\r
+netpath_setMulticast(\r
+ IN Netpath_t* p_netpath )\r
+{\r
+ if( netpath_is_connected( p_netpath ) )\r
+ {\r
+ return viport_setMulticast( p_netpath->pViport );\r
+ }\r
+ return NDIS_STATUS_NOT_ACCEPTED;\r
+}\r
+\r
BOOLEAN\r
netpath_removePath(\r
- Netpath_t *pNetpath,\r
- viport_t *pViport)\r
+ IN Netpath_t *p_netpath,\r
+ IN viport_t *p_viport )\r
+\r
{\r
- if( pNetpath->pViport != pViport )\r
+ if( p_netpath->pViport != p_viport )\r
{\r
return FALSE;\r
}\r
else\r
{\r
- pNetpath->pViport = NULL;\r
- viport_unsetParent( pViport, pNetpath );\r
- return TRUE;\r
+ viport_timerStop( p_netpath->pViport );\r
+ viport_unsetParent( p_netpath->pViport );\r
+ viport_cleanup( p_viport );\r
+ }\r
+\r
+ return TRUE;\r
+}\r
+\r
+void\r
+netpath_free(\r
+ IN Netpath_t *pNetpath )\r
+{\r
+ if( netpath_is_valid( pNetpath ) )\r
+ {\r
+ netpath_removePath( pNetpath, pNetpath->pViport );\r
+ }\r
+ return;\r
+}\r
+\r
+BOOLEAN\r
+netpath_is_valid(\r
+ IN Netpath_t* const p_netpath )\r
+{\r
+ if( p_netpath == NULL )\r
+ return FALSE;\r
+ \r
+ if( p_netpath->pViport == NULL )\r
+ return FALSE;\r
+\r
+ return TRUE;\r
+}\r
+\r
+BOOLEAN\r
+netpath_is_connected(\r
+ IN Netpath_t* const p_netpath )\r
+{\r
+ if( !netpath_is_valid( p_netpath ) )\r
+ return FALSE;\r
+\r
+ if( p_netpath->pViport->errored )\r
+ return FALSE;\r
+\r
+ if( p_netpath->p_path_rec == NULL )\r
+ return FALSE;\r
+\r
+ if( p_netpath->pViport->state != VIPORT_CONNECTED )\r
+ return FALSE;\r
+\r
+ \r
+ return TRUE;\r
+}\r
+\r
+BOOLEAN\r
+netpath_is_primary(\r
+ IN Netpath_t* const p_netpath )\r
+{\r
+ return (BOOLEAN)( p_netpath->instance == NETPATH_PRIMARY );\r
+}\r
+BOOLEAN \r
+netpath_linkUp(\r
+ IN Netpath_t* p_netpath )\r
+{\r
+ if( p_netpath != p_netpath->p_adapter->p_currentPath )\r
+ return FALSE;\r
+\r
+ if( p_netpath->carrier == TRUE && \r
+ InterlockedExchange( &p_netpath->p_adapter->carrier, TRUE ) == FALSE )\r
+ {\r
+ NdisMIndicateStatus( p_netpath->p_adapter->h_handle,\r
+ NDIS_STATUS_MEDIA_CONNECT, NULL, 0 );\r
+ NdisMIndicateStatusComplete( p_netpath->p_adapter->h_handle );\r
+ VNIC_TRACE( VNIC_DBG_INIT,\r
+ ("IOC[%d] %s Link UP\n", \r
+ p_netpath->p_adapter->ioc_num,\r
+ netpath_to_string( p_netpath ) ) );\r
}\r
+ return TRUE;\r
}\r
\r
+BOOLEAN\r
+netpath_linkDown(\r
+ IN Netpath_t* p_netpath )\r
+{\r
+ if( p_netpath != p_netpath->p_adapter->p_currentPath )\r
+ return FALSE;\r
+\r
+ if ( InterlockedExchange( &p_netpath->p_adapter->carrier, FALSE ) == TRUE )\r
+ {\r
+ NdisMIndicateStatus( p_netpath->p_adapter->h_handle,\r
+ NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0 );\r
+ NdisMIndicateStatusComplete( p_netpath->p_adapter->h_handle );\r
+ VNIC_TRACE( VNIC_DBG_INIT,\r
+ ("IOC[%d] %s Link DOWN\n", \r
+ p_netpath->p_adapter->ioc_num,\r
+ netpath_to_string( p_netpath ) ) );\r
+ }\r
\r
+ return TRUE;\r
+}\r
\r
int netpath_maxMtu(Netpath_t *pNetpath)\r
{\r
IN Netpath_t *pNetpath,\r
IN NDIS_PACKET * const p_packet )\r
{\r
- BOOLEAN ret = FALSE;\r
\r
- if ( pNetpath->pViport )\r
+ if ( pNetpath->pViport &&\r
+ pNetpath->p_adapter->xmitStarted )\r
{\r
- ret = viport_xmitPacket(pNetpath->pViport, p_packet );\r
+ return ( viport_xmitPacket(pNetpath->pViport, p_packet ) );\r
+ }\r
+ else\r
+ {\r
+ NdisInterlockedInsertTailList( \r
+ &pNetpath->p_adapter->send_pending_list,\r
+ VNIC_LIST_ITEM_FROM_PACKET( p_packet ),\r
+ &pNetpath->p_adapter->pending_list_lock );\r
+ return TRUE;\r
}\r
- return ret;\r
}\r
\r
+void\r
+netpath_cancel_xmit( \r
+ IN Netpath_t *p_netpath, \r
+ IN PVOID cancel_id )\r
+{\r
+ if( p_netpath->pViport )\r
+ {\r
+ viport_cancel_xmit( p_netpath->pViport, cancel_id );\r
+ }\r
+}\r
\r
void\r
netpath_stopXmit(\r
\r
VNIC_ENTER( VNIC_DBG_NETPATH );\r
\r
- if (pNetpath == pNetpath->p_adapter->p_currentPath )\r
+ if( pNetpath == pNetpath->p_adapter->p_currentPath )\r
{\r
InterlockedCompareExchange( &pNetpath->p_adapter->xmitStarted, 0, 1 );\r
}\r
\r
if (pNetpath == pNetpath->p_adapter->p_currentPath )\r
{\r
- if( !pNetpath->pViport->errored )\r
+ if( !pNetpath->pViport->errored &&\r
+ pNetpath->pViport->state == VIPORT_CONNECTED )\r
{\r
InterlockedCompareExchange( &pNetpath->p_adapter->xmitStarted, 1, 0 );\r
+ VNIC_TRACE( VNIC_DBG_NETPATH,\r
+ ("IOC[%d] instance %d Restart TRANSMIT\n", \r
+ pNetpath->pViport->ioc_num, \r
+ pNetpath->instance ));\r
+ \r
}\r
}\r
#ifdef INIC_STATISTICS\r
// Viport on input calls this\r
void netpath_recvPacket(\r
IN Netpath_t *pNetpath,\r
- IN NDIS_PACKET* p_packet )\r
+ IN NDIS_PACKET** pp_packet_array,\r
+ IN uint32_t num_packets )\r
{\r
- #ifdef INIC_STATISTICS\r
- extern cycles_t recvRef;\r
+\r
+#ifdef INIC_STATISTICS\r
+ extern uin64_t recvRef;\r
#endif /* INIC_STATISTICS */\r
\r
VNIC_ENTER( VNIC_DBG_NETPATH );\r
\r
#ifdef INIC_STATISTICS\r
- pNetpath->p_adapter->statistics.recvTime += get_time_stamp_ms() - recvRef;\r
+ pNetpath->p_adapter->statistics.recvTime += cl_get_tick_count() - recvRef;\r
pNetpath->p_adapter->statistics.recvNum++;\r
#endif /* INIC_STATISTICS */\r
\r
- NdisMIndicateReceivePacket( pNetpath->p_adapter->h_handle, &p_packet, 1 );\r
-\r
+ NdisMIndicateReceivePacket( pNetpath->p_adapter->h_handle,\r
+ pp_packet_array, \r
+ num_packets );\r
return;\r
}\r
\r
\r
const char *\r
netpath_to_string(\r
- IN vnic_adapter_t *p_adapter,\r
- IN Netpath_t *pNetpath )\r
+ IN Netpath_t *p_netpath )\r
{\r
- if ( !pNetpath )\r
+ if ( !netpath_is_valid( p_netpath ) )\r
{\r
return "NULL";\r
}\r
- else if ( pNetpath == &p_adapter->primaryPath )\r
+ else if ( p_netpath == p_netpath->p_adapter->p_currentPath )\r
{\r
- return "PRIMARY";\r
+ return "CURRENT";\r
}\r
- else if ( pNetpath == &p_adapter->secondaryPath )\r
- {\r
- return "SECONDARY";\r
- } else\r
+ else\r
{\r
- return "UNKNOWN";\r
+ return "STANDBY";\r
}\r
}\r
-\r
-\r
-static BOOLEAN\r
-__netpath_npevent_register(vnic_adapter_t *p_adapter, Netpath_t *pNetpath)\r
-{\r
- VNIC_ENTER( VNIC_DBG_NETPATH );\r
-\r
- UNUSED_PARAM( pNetpath );\r
- p_adapter->state = INIC_REGISTERED;\r
- return TRUE;\r
-}\r
-\r
-static const char * const inicNPEventStr[] = {\r
- "PRIMARY CONNECTED",\r
- "PRIMARY DISCONNECTED",\r
- "PRIMARY CARRIER",\r
- "PRIMARY NO CARRIER",\r
- "PRIMARY TIMER EXPIRED",\r
- "SETLINK",\r
-\r
- "SECONDARY CONNECTED",\r
- "SECONDARY DISCONNECTED",\r
- "SECONDARY CARRIER",\r
- "SECONDARY NO CARRIER",\r
- "SECONDARY TIMER EXPIRED",\r
- "FREE INIC",\r
-};\r
-\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
/* round down value to align, align must be a power of 2 */\r
#ifndef ROUNDDOWNP2\r
#define ROUNDDOWNP2(val, align) \\r
- (((uintn_t)(val)) & (~((uintn_t)(align)-1)))\r
+ (((ULONG)(val)) & (~((ULONG)(align)-1)))\r
#endif\r
\r
/* round up value to align, align must be a power of 2 */\r
#ifndef ROUNDUPP2\r
#define ROUNDUPP2(val, align) \\r
- (((uintn_t)(val) + (uintn_t)(align) - 1) & (~((uintn_t)(align)-1)))\r
+ (((ULONG)(val) + (ULONG)(align) - 1) & (~((ULONG)(align)-1)))\r
#endif\r
-/* roundup address to align */\r
-#define ADDR_ROUNDUPP2(_addr, _align) \\r
- ((VOID *)(((ULONG_PTR)(_addr) + (_align - 1)) & ( ~(_align - 1) )))\r
\r
#define VIPORT_TRAILER_ALIGNMENT 32\r
#define BUFFER_SIZE(len) (sizeof(ViportTrailer_t) + ROUNDUPP2((len), VIPORT_TRAILER_ALIGNMENT))\r
#define MAX_PAYLOAD(len) ROUNDDOWNP2((len) - sizeof(ViportTrailer_t), VIPORT_TRAILER_ALIGNMENT)\r
-\r
+#define MIN_PACKET_LEN 64\r
#include <complib/cl_packon.h>\r
\r
typedef struct ViportTrailer {\r
\r
#include <complib/cl_packoff.h>\r
\r
-#endif /* _VNIC_TRAILER_H_ */
\ No newline at end of file
+#endif /* _VNIC_TRAILER_H_ */\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
\r
#include "vnic_debug.h"\r
\r
-#define MAXU32 0xffffffff\r
+#define MAXU32 MAXULONG\r
#define MAXU64 ((uint64_t)(~0))\r
\r
-#define MODULE_NAME "VNIC"\r
-\r
#define PTR64(what) ((uint64_t)(void * __ptr64)(what))\r
\r
-#define CONV2JIFFIES(time) (((time) * HZ) / 100) /* source time is 100ths of a sec */\r
-#define CONV2USEC(time) ((time) * 10000) /* source time is 100ths of a sec */\r
-\r
#ifndef min\r
#define min(a,b) ((a)<(b)?(a):(b))\r
#endif\r
#define ntoh32(x) hton32(x)\r
#define ntoh64(x) hton64(x)\r
\r
-#define IsPowerOf2(value) (((value) & ((value - 1))) == 0)\r
+#define IsPowerOf2(value) (((value) & (value - 1)) == 0)\r
/* round down to closest power of 2 value */\r
\r
#define SetMinPowerOf2(_val) ((_val) & ( 1 << RtlFindMostSignificantBit( (uint64_t)(_val) )))\r
\r
-#define PRINT(level,x) VNIC_PRINT(level, x )\r
-\r
-#define PRINT_CONDITIONAL(level,x,condition) if (condition){PRINT( level, x)}\r
-\r
-#ifdef _DEBUG_\r
-#define IB_FSTATUS(functionName) \\r
- if( (ib_status != IB_SUCCESS) && \\r
- (ib_status != IB_PENDING) ) \\r
- VNIC_PRINT( g_vnic_dbg_lvl,("[%s]: %d\n", functionName,ib_status))\r
-\r
-#else\r
-#define IB_FSTATUS(functionName)\r
-#endif\r
-\r
-#define IB_TEST_FSTATUS( functionName ) IB_FSTATUS( functionName ); \\r
- if ((ib_status != IB_SUCCESS) && (ib_status != IB_PENDING)) goto failure\r
\r
#endif /* _VNIC_UTIL_H_ */\r
\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
\r
extern vnic_globals_t g_vnic;\r
\r
-static void viport_timeout( void *context );\r
-static ib_api_status_t viport_initMacAddresses( viport_t *p_viport );\r
-static void viport_statemachine( void *context );\r
+static void\r
+viport_timeout( \r
+ void *context );\r
\r
-uint32_t\r
-viport_get_adapter_name(\r
- IN viport_t *p_viport )\r
-{\r
- /* TODO: consider unique addressable and friendly name \r
- should I use ioc profile string ? seem too long */\r
- cl_memcpy(p_viport->p_adapter->name, DEFAULT_VNIC_NAME, sizeof(DEFAULT_VNIC_NAME) );\r
- return ( sizeof(DEFAULT_VNIC_NAME) );\r
-}\r
+static ib_api_status_t \r
+viport_initMacAddresses( \r
+ viport_t *p_viport );\r
\r
BOOLEAN\r
viport_config_defaults(\r
p_viport->linkState = LINK_RETRYWAIT;\r
p_viport->newMtu = 1500;\r
p_viport->newFlags = 0;\r
+ p_viport->hb_send_pending = FALSE;\r
\r
cl_timer_init( &p_viport->timer, viport_timeout, p_viport );\r
\r
\r
pControlConfig->ibConfig.sid = 0; /* will set it later, from svc entries */\r
pControlConfig->ibConfig.connData.pathId = 0;\r
- pControlConfig->ibConfig.connData.inicInstance = 0;\r
+ pControlConfig->ibConfig.connData.inicInstance = 0; // assign instance id in update_path\r
pControlConfig->ibConfig.connData.pathNum = 0;\r
\r
pControlConfig->ibConfig.retryCount = p_adapter->params.RetryCount;\r
pDataConfig->ibConfig.numRecvs = p_adapter->params.HostRecvPoolEntries +\r
( p_adapter->params.MaxEiocPoolSz / p_adapter->params.MinHostUpdateSz );\r
\r
-#if TRUE //defined(LIMIT_OUTSTANDING_SENDS)\r
+#if LIMIT_OUTSTANDING_SENDS\r
\r
pDataConfig->ibConfig.numSends = (2 * p_adapter->params.NotifyBundleSz ) +\r
( p_adapter->params.HostRecvPoolEntries / p_adapter->params.MinEiocUpdateSz ) + 1;\r
\r
if( p_viport )\r
{\r
- VNIC_TRACE(VNIC_DBG_INIT,\r
+ if( InterlockedExchange( (volatile LONG *)&p_viport->disconnect, TRUE ) )\r
+ {\r
+ return;\r
+ }\r
+\r
+ VNIC_TRACE(VNIC_DBG_VIPORT,\r
("IOC[%d]viport cleanup\n", p_viport->ioc_num ));\r
- InterlockedExchange( &p_viport->p_adapter->carrier, FALSE );\r
- InterlockedExchange( &p_viport->p_netpath->carrier, FALSE );\r
- viport_timerStop( p_viport );\r
+\r
data_disconnect( &p_viport->data );\r
\r
control_cleanup( &p_viport->control );\r
\r
cl_timer_destroy( &p_viport->timer );\r
\r
- InterlockedExchange( (volatile LONG *)&p_viport->p_adapter->state,\r
- INIC_UNINITIALIZED );\r
-\r
- NdisFreeMemory ( p_viport, sizeof(viport_t), 0 );\r
+ NdisFreeMemory( p_viport, sizeof(viport_t), 0 );\r
+ p_viport = NULL;\r
}\r
+\r
VNIC_EXIT( VNIC_DBG_VIPORT );\r
return;\r
}\r
\r
-\r
-void\r
-viport_setPath(\r
- IN viport_t *p_viport,\r
- IN ib_path_rec_t *p_path,\r
- IN uint64_t *p_guid )\r
-{\r
-\r
- UNUSED_PARAM( p_guid );\r
-\r
- VNIC_ENTER( VNIC_DBG_FUNC );\r
-\r
- VNIC_TRACE( VNIC_DBG_PNP,\r
- ("Using SLID=%d DLID=%d Target:%s\n",\r
- cl_ntoh16( p_path->slid ),\r
- cl_ntoh16( p_path->dlid ),\r
- p_viport->p_adapter->ioc_info.profile.id_string) );\r
-\r
- p_viport->portGuid = p_path->sgid.unicast.interface_id;\r
- p_viport->iocGuid = *p_guid;\r
- p_viport->port_config.dataConfig.ibConfig.pathInfo = *p_path;\r
- p_viport->port_config.controlConfig.ibConfig.pathInfo = *p_path;\r
- p_viport->port_config.controlConfig.ibConfig.sid =\r
- p_viport->p_adapter->p_svc_entries[0].id;\r
- p_viport->port_config.dataConfig.ibConfig.sid =\r
- p_viport->p_adapter->p_svc_entries[1].id;\r
-\r
- VNIC_EXIT( VNIC_DBG_FUNC );\r
-}\r
-\r
BOOLEAN\r
viport_setParent(\r
IN viport_t *p_viport,\r
\r
BOOLEAN\r
viport_unsetParent(\r
- IN viport_t *p_viport,\r
- IN Netpath_t *pNetpath )\r
-{\r
- VNIC_ENTER( VNIC_DBG_VIPORT );\r
- if( pNetpath->pViport == p_viport )\r
- viport_free( p_viport );\r
- VNIC_EXIT( VNIC_DBG_VIPORT );\r
- return TRUE;\r
-}\r
-\r
-void\r
-viport_free(\r
- IN viport_t *p_viport )\r
-{\r
- VNIC_ENTER( VNIC_DBG_VIPORT );\r
-\r
- viport_timerStop( p_viport );\r
- viport_disconnect(p_viport);\r
- VNIC_EXIT( VNIC_DBG_VIPORT );\r
- return;\r
-}\r
-\r
-void\r
-viport_disconnect(\r
IN viport_t *p_viport )\r
{\r
- VNIC_ENTER( VNIC_DBG_VIPORT );\r
-\r
- InterlockedExchange( (volatile LONG *)&p_viport->disconnect, TRUE );\r
- viport_failure( p_viport );\r
-\r
- VNIC_EXIT( VNIC_DBG_VIPORT );\r
- return;\r
+ if( !p_viport || \r
+ !p_viport->p_netpath )\r
+ {\r
+ return FALSE;\r
+ }\r
+ InterlockedExchange( &p_viport->p_netpath->carrier, FALSE );\r
+ p_viport->p_netpath->pViport = NULL;\r
+ p_viport->p_netpath = NULL;\r
+ p_viport->p_adapter->num_paths--;\r
+ return TRUE;\r
}\r
\r
\r
viport_setLink(\r
IN viport_t *p_viport,\r
IN uint8_t flags,\r
- IN uint16_t mtu )\r
+ IN uint16_t mtu ,\r
+ IN BOOLEAN sync )\r
{\r
- KIRQL irql;\r
- NDIS_STATUS status = NDIS_STATUS_SUCCESS;\r
+\r
+ NDIS_STATUS status;\r
\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
\r
- if(mtu > data_maxMtu(&p_viport->data))\r
+ if( mtu > data_maxMtu(&p_viport->data) )\r
{\r
viport_failure(p_viport);\r
VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
- ("Configuration error. Mtu of %d unsupported by %s\n", mtu, p_viport->p_adapter->name ) );\r
+ ("IOC[%d] Configuration error. Mtu of %d unsupported\n", p_viport->ioc_num, mtu ) );\r
return NDIS_STATUS_FAILURE;\r
}\r
\r
- KeAcquireSpinLock( &p_viport->lock, &irql );\r
-\r
- flags &= ( INIC_FLAG_ENABLE_NIC |\r
- INIC_FLAG_ENABLE_MCAST_ALL |\r
- INIC_FLAG_ENABLE_PROMISC );\r
-\r
- if( (p_viport->newFlags != flags) ||\r
- (p_viport->newMtu != mtu))\r
+ NdisAcquireSpinLock( &p_viport->lock );\r
+ \r
+ if( ( (p_viport->flags & flags ) != flags ) || (p_viport->mtu != mtu ))\r
{\r
p_viport->newFlags = flags;\r
p_viport->newMtu = mtu;\r
InterlockedOr( &p_viport->updates, NEED_LINK_CONFIG );\r
}\r
- KeReleaseSpinLock( &p_viport->lock, irql );\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
\r
- status = _viport_process_query( p_viport, TRUE );\r
+ status = _viport_process_query( p_viport, sync );\r
+ \r
VNIC_EXIT( VNIC_DBG_VIPORT );\r
return status;\r
}\r
\r
BOOLEAN\r
viport_setUnicast(\r
- IN viport_t *p_viport,\r
+ IN viport_t* const p_viport,\r
IN uint8_t *p_address )\r
{\r
- KIRQL flags;\r
+ NDIS_STATUS status = NDIS_STATUS_SUCCESS;\r
\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
\r
if( !p_viport )\r
return FALSE;\r
\r
- KeAcquireSpinLock( &p_viport->lock, &flags );\r
+ NdisAcquireSpinLock( &p_viport->lock );\r
+\r
if( p_viport->macAddresses == NULL )\r
{\r
- KeReleaseSpinLock( &p_viport->lock, flags );\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
return FALSE;\r
}\r
+\r
if( cl_memcmp(p_viport->macAddresses[UNICAST_ADDR].address,\r
p_address, MAC_ADDR_LEN ) )\r
{\r
+\r
cl_memcpy( p_viport->macAddresses[UNICAST_ADDR].address,\r
p_address, MAC_ADDR_LEN );\r
- p_viport->macAddresses[UNICAST_ADDR].operation\r
- = INIC_OP_SET_ENTRY;\r
+\r
+ VNIC_TRACE( VNIC_DBG_VIPORT,\r
+ ("Change Viport MAC From : %02x %02x %02x %02x %02x %02x -> to : %02x %02x %02x %02x %02x %02x\n",\r
+ p_viport->hwMacAddress[0], p_viport->hwMacAddress[1], p_viport->hwMacAddress[2],\r
+ p_viport->hwMacAddress[3], p_viport->hwMacAddress[4], p_viport->hwMacAddress[5],\r
+ p_viport->macAddresses[UNICAST_ADDR].address[0], p_viport->macAddresses[UNICAST_ADDR].address[1],\r
+ p_viport->macAddresses[UNICAST_ADDR].address[2], p_viport->macAddresses[UNICAST_ADDR].address[3],\r
+ p_viport->macAddresses[UNICAST_ADDR].address[4], p_viport->macAddresses[UNICAST_ADDR].address[5] \r
+ ) );\r
+\r
+ NdisMoveMemory( p_viport->hwMacAddress,\r
+ p_viport->macAddresses[UNICAST_ADDR].address, MAC_ADDR_LEN );\r
+ \r
+ p_viport->macAddresses[UNICAST_ADDR].operation = INIC_OP_SET_ENTRY;\r
+\r
InterlockedOr( &p_viport->updates, NEED_ADDRESS_CONFIG );\r
+\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
+\r
+ status = _viport_process_query( p_viport, FALSE );\r
+ if( status != NDIS_STATUS_SUCCESS &&\r
+ status != NDIS_STATUS_PENDING )\r
+ {\r
+ VNIC_TRACE_EXIT( VNIC_DBG_ERROR, ("Viport MAC set failed\n") );\r
+ return FALSE;\r
+ }\r
}\r
- KeReleaseSpinLock( &p_viport->lock, flags );\r
+\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
\r
VNIC_EXIT( VNIC_DBG_VIPORT );\r
return TRUE;\r
vnic_adapter_t *p_adapter = p_viport->p_adapter;\r
uint32_t updates = 0;\r
int i;\r
- KIRQL flags;\r
NDIS_STATUS status;\r
\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
\r
- KeAcquireSpinLock( &p_viport->lock, &flags );\r
+ NdisAcquireSpinLock( &p_viport->lock );\r
\r
if( p_viport->macAddresses == NULL )\r
{\r
- KeReleaseSpinLock( &p_viport->lock, flags );\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
return NDIS_STATUS_NOT_ACCEPTED;\r
}\r
\r
ASSERT( (p_viport->updates & ~MCAST_OVERFLOW) == 0 );\r
\r
- if( p_adapter->mc_count > p_viport->numMacAddresses - MCAST_ADDR_START )\r
- {\r
- updates |= NEED_LINK_CONFIG | MCAST_OVERFLOW;\r
- }\r
- else if( p_adapter->mc_count == 0 )\r
+ if( p_adapter->mc_count == 0 )\r
{\r
/* invalidate all entries for the remote */\r
for (i = MCAST_ADDR_START;\r
p_viport->macAddresses[i].valid = 0;\r
p_viport->macAddresses[i].operation = INIC_OP_SET_ENTRY;\r
}\r
+ /* do we have to report to remote ? */\r
+ p_viport->updates = 0;\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
+ return NDIS_STATUS_SUCCESS;\r
+ }\r
+\r
+ if( p_adapter->mc_count > p_viport->numMacAddresses - MCAST_ADDR_START )\r
+ {\r
+ updates |= NEED_LINK_CONFIG | MCAST_OVERFLOW;\r
}\r
else\r
{\r
* to send the request.\r
*/\r
InterlockedOr( &p_viport->updates, updates );\r
- KeReleaseSpinLock( &p_viport->lock, flags );\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
\r
status = _viport_process_query( p_viport, FALSE );\r
\r
IN viport_t* const p_viport,\r
IN NDIS_PACKET* const p_packet )\r
{\r
- BOOLEAN status = TRUE;\r
- KIRQL flags;\r
+ BOOLEAN status;\r
LIST_ENTRY *p_list_item;\r
- NDIS_PACKET *p_packet_from_list;\r
+ NDIS_PACKET *p_pending_packet;\r
+ vnic_adapter_t* p_adapter;\r
\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
\r
- if( !p_viport->p_adapter->xmitStarted )\r
- {\r
- NdisInterlockedInsertTailList( \r
- &p_viport->send_pending_list,\r
- VNIC_LIST_ITEM_FROM_PACKET( p_packet ),\r
- &p_viport->pending_list_lock );\r
- }\r
- else\r
+ NdisAcquireSpinLock( &p_viport->lock );\r
+ \r
+ p_adapter = p_viport->p_netpath->p_adapter;\r
+\r
+ while( ( p_list_item = NdisInterlockedRemoveHeadList(\r
+ &p_adapter->send_pending_list,\r
+ &p_adapter->pending_list_lock ) ) != NULL )\r
{\r
- KeAcquireSpinLock( &p_viport->lock, &flags );\r
+ p_pending_packet = VNIC_PACKET_FROM_LIST_ITEM( p_list_item );\r
\r
- while( ( p_list_item = NdisInterlockedRemoveHeadList(\r
- &p_viport->send_pending_list,\r
- &p_viport->pending_list_lock ) ) != NULL )\r
+ status = data_xmitPacket( &p_viport->data, p_pending_packet );\r
+ if( !status )\r
{\r
- p_packet_from_list = VNIC_PACKET_FROM_LIST_ITEM( p_list_item );\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d] Xmit Pending Packet failed\n", p_viport->ioc_num ));\r
\r
- status = data_xmitPacket( &p_viport->data, p_packet_from_list );\r
- if( !status )\r
- {\r
- VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("IOC[%d] Xmit Pending Packet failed\n", p_viport->ioc_num ));\r
- /* put it back on pending list - will complete it on cleanup */\r
- NdisInterlockedInsertTailList( \r
- &p_viport->send_pending_list,\r
- VNIC_LIST_ITEM_FROM_PACKET( p_packet_from_list ),\r
- &p_viport->pending_list_lock );\r
- viport_stopXmit( p_viport );\r
- break;\r
- }\r
+ /* put it back on pending list - will complete it on cleanup */\r
+ NdisInterlockedInsertTailList( \r
+ &p_adapter->send_pending_list,\r
+ VNIC_LIST_ITEM_FROM_PACKET( p_pending_packet ),\r
+ &p_adapter->pending_list_lock );\r
+ /*do not try to send packet, just exit */\r
+ goto err;\r
}\r
+ }\r
\r
- if( !status )\r
- { /*do not try to send, just exit */\r
- NdisInterlockedInsertTailList( \r
- &p_viport->send_pending_list,\r
+ /* send a packet */\r
+ status = data_xmitPacket( &p_viport->data, p_packet );\r
+ if( status )\r
+ {\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
+ \r
+ VNIC_EXIT( VNIC_DBG_VIPORT );\r
+ return status;\r
+ }\r
+\r
+err:\r
+ NdisInterlockedInsertTailList( \r
+ &p_adapter->send_pending_list,\r
VNIC_LIST_ITEM_FROM_PACKET( p_packet ),\r
- &p_viport->pending_list_lock );\r
- viport_stopXmit( p_viport );\r
- \r
- KeReleaseSpinLock( &p_viport->lock, flags );\r
- VNIC_EXIT( VNIC_DBG_VIPORT );\r
- return status;\r
- }\r
+ &p_adapter->pending_list_lock );\r
+ \r
+ viport_stopXmit( p_viport );\r
\r
- /* just send a packet */\r
- status = data_xmitPacket( &p_viport->data, p_packet );\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
+ \r
+ VNIC_EXIT( VNIC_DBG_VIPORT );\r
+ return status;\r
+}\r
\r
- if( !status )\r
+void\r
+viport_cancel_xmit( \r
+ viport_t *p_viport, \r
+ PVOID cancel_id )\r
+{\r
+ NDIS_PACKET *p_packet;\r
+ LIST_ENTRY *p_list_item;\r
+ LIST_ENTRY *p_list;\r
+ PVOID _id;\r
+ vnic_adapter_t* p_adapter;\r
+\r
+ NdisAcquireSpinLock( &p_viport->lock );\r
+\r
+ p_adapter = p_viport->p_netpath->p_adapter;\r
+ p_list = &p_adapter->send_pending_list;\r
+\r
+ while( !IsListEmpty( &p_adapter->send_pending_list ) )\r
+ {\r
+ p_list_item = p_list->Flink;\r
+\r
+ if ( p_list_item->Flink == &p_adapter->send_pending_list )\r
+ break;\r
+\r
+ p_packet = VNIC_PACKET_FROM_LIST_ITEM( p_list_item );\r
+\r
+ _id = NdisGetPacketCancelId( p_packet );\r
+\r
+ if( _id == cancel_id )\r
{\r
- VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("IOC[%d] XmitPacket failed\n", p_viport->ioc_num ));\r
- /* put it on pending list - will complete it on cleanup */\r
- NdisInterlockedInsertTailList( \r
- &p_viport->send_pending_list,\r
- VNIC_LIST_ITEM_FROM_PACKET( p_packet ),\r
- &p_viport->pending_list_lock );\r
- viport_stopXmit( p_viport );\r
+ NdisInterlockedRemoveHeadList( p_list, &p_adapter->pending_list_lock );\r
+ NdisInterlockedInsertTailList( &p_adapter->cancel_send_list, p_list_item,\r
+ &p_adapter->cancel_list_lock );\r
+ p_list_item = p_list->Flink;\r
+ }\r
+ else\r
+ {\r
+ p_list = p_list_item;\r
}\r
+ }\r
\r
- KeReleaseSpinLock( &p_viport->lock, flags );\r
+ while( !IsListEmpty( &p_adapter->cancel_send_list ) )\r
+ {\r
+ p_list_item = NdisInterlockedRemoveHeadList( &p_adapter->cancel_send_list,\r
+ &p_adapter->cancel_list_lock );\r
+ \r
+ p_packet = VNIC_PACKET_FROM_LIST_ITEM( p_list_item );\r
+ \r
+ if( p_packet )\r
+ {\r
+ NDIS_SET_PACKET_STATUS( p_packet, NDIS_STATUS_REQUEST_ABORTED );\r
+ NdisMSendComplete( p_adapter->h_handle, p_packet, NDIS_STATUS_REQUEST_ABORTED );\r
+ }\r
}\r
\r
- VNIC_EXIT( VNIC_DBG_VIPORT );\r
- return status;\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
}\r
\r
-void viport_linkUp(viport_t *p_viport)\r
+void\r
+viport_linkUp(viport_t *p_viport)\r
{\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
\r
- if( p_viport->p_netpath->carrier == TRUE && \r
- InterlockedExchange( &p_viport->p_adapter->carrier, TRUE ) == FALSE )\r
- {\r
- NdisMIndicateStatus( p_viport->p_adapter->h_handle,\r
- NDIS_STATUS_MEDIA_CONNECT, NULL, 0 );\r
- NdisMIndicateStatusComplete( p_viport->p_adapter->h_handle );\r
- }\r
+ netpath_linkUp( p_viport->p_netpath );\r
+\r
VNIC_EXIT( VNIC_DBG_VIPORT );\r
return;\r
}\r
\r
-void viport_linkDown(viport_t *p_viport)\r
+void\r
+viport_linkDown(viport_t *p_viport)\r
{\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
- if ( InterlockedExchange( &p_viport->p_adapter->carrier, FALSE ) == TRUE )\r
- {\r
- NdisMIndicateStatus( p_viport->p_adapter->h_handle,\r
- NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0 );\r
- NdisMIndicateStatusComplete( p_viport->p_adapter->h_handle );\r
- }\r
+\r
+ netpath_linkDown( p_viport->p_netpath );\r
+ \r
VNIC_EXIT( VNIC_DBG_VIPORT );\r
return;\r
}\r
\r
-void viport_stopXmit(viport_t *p_viport)\r
+void\r
+viport_stopXmit(viport_t *p_viport)\r
{\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
netpath_stopXmit( p_viport->p_netpath );\r
return;\r
}\r
\r
-void viport_restartXmit(viport_t *p_viport)\r
+void\r
+viport_restartXmit(viport_t *p_viport)\r
{\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
netpath_restartXmit( p_viport->p_netpath );\r
void\r
viport_recvPacket(\r
IN viport_t *p_viport,\r
- IN NDIS_PACKET *p_packet )\r
+ IN NDIS_PACKET **pp_pkt_arr,\r
+ IN uint32_t num_packets )\r
{\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
- netpath_recvPacket(p_viport->p_netpath, p_packet );\r
+ netpath_recvPacket(p_viport->p_netpath, pp_pkt_arr, num_packets );\r
VNIC_EXIT( VNIC_DBG_VIPORT );\r
return;\r
}\r
{\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
\r
- CL_ASSERT( p_viport );\r
+ if( !p_viport || !p_viport->p_netpath )\r
+ return;\r
\r
InterlockedExchange( &p_viport->p_netpath->carrier, FALSE );\r
\r
if( InterlockedExchange( (volatile LONG*)&p_viport->errored, TRUE ) == FALSE )\r
{\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d] %s instance %d FAILED\n", \r
+ p_viport->ioc_num,\r
+ netpath_to_string( p_viport->p_netpath ),\r
+ p_viport->p_netpath->instance ));\r
viport_stopXmit( p_viport );\r
viport_linkDown( p_viport );\r
}\r
viport_t *p_viport = (viport_t *)context;\r
CL_ASSERT( p_viport );\r
\r
- InterlockedExchange( &p_viport->timerActive, FALSE );\r
- // did we get response from previous query ?\r
- if( p_viport->link_hb_state != LINK_HEARTBEATRSP )\r
+ if( InterlockedExchange( &p_viport->timerActive, FALSE ) == TRUE )\r
{\r
- VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("IOC[%d] NO HEARTBEAT RESPONSE\n", p_viport->ioc_num ));\r
- viport_failure( p_viport );\r
- return;\r
- }\r
- if( p_viport &&\r
- p_viport->data.connected &&\r
- !p_viport->errored )\r
- {\r
- viport_timer( p_viport, p_viport->port_config.hbInterval );\r
+ // did we send a query and got response ?\r
+ if( p_viport->link_hb_state != LINK_HEARTBEATRSP &&\r
+ !p_viport->hb_send_pending )\r
+ {\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d] instance %d HEARTBEAT TIMEOUT\n", \r
+ p_viport->ioc_num,\r
+ p_viport->p_netpath->instance ));\r
+ viport_failure( p_viport );\r
+ return;\r
+ }\r
+ /* send heartbeat message again */\r
+ else if( !p_viport->errored &&\r
+ p_viport->state == VIPORT_CONNECTED )\r
+ {\r
+ viport_timer( p_viport, p_viport->port_config.hbInterval );\r
+ }\r
}\r
}\r
\r
\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
\r
- if( !p_viport->control.reqOutstanding )\r
+ if( !p_viport->errored )\r
{\r
- InterlockedExchange( &p_viport->timerActive, TRUE );\r
p_viport->link_hb_state = LINK_HEARTBEATREQ;\r
+ InterlockedExchange( &p_viport->timerActive, TRUE );\r
+ \r
+ /* we can send now */\r
+ if( !p_viport->control.reqOutstanding )\r
+ {\r
+ p_viport->hb_send_pending = FALSE;\r
+ cl_timer_start( &p_viport->timer, (uint32_t)timeout ); \r
\r
- cl_timer_start( &p_viport->timer, (uint32_t)timeout );\r
-\r
- ib_status = control_heartbeatReq( &p_viport->control,\r
- p_viport->port_config.hbTimeout );\r
+ ib_status = control_heartbeatReq( &p_viport->control,\r
+ p_viport->port_config.hbTimeout );\r
\r
- if( ib_status != IB_SUCCESS )\r
+ if( ib_status != IB_SUCCESS )\r
+ {\r
+ viport_timerStop( p_viport );\r
+ VNIC_TRACE( VNIC_DBG_ERROR,\r
+ ("IOC[%d] instance %d HEARTBEAT send failed\n", \r
+ p_viport->ioc_num,\r
+ p_viport->p_netpath->instance ));\r
+ viport_failure( p_viport );\r
+ return;\r
+ }\r
+ }\r
+ /* schedule send on next timeout */\r
+ else\r
{\r
- viport_timerStop( p_viport );\r
- VNIC_TRACE( VNIC_DBG_ERROR,\r
- ("IOC[%d] HEARTBEAT send failed\n", p_viport->ioc_num ));\r
- viport_failure( p_viport );\r
- return;\r
+ p_viport->hb_send_pending = TRUE;\r
+ cl_timer_start(&p_viport->timer, (uint32_t)timeout );\r
}\r
}\r
+\r
VNIC_EXIT( VNIC_DBG_VIPORT );\r
}\r
\r
IN viport_t *p_viport )\r
{\r
int i, size;\r
- KIRQL flags;\r
NDIS_STATUS status;\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
\r
\r
NdisZeroMemory( p_viport->macAddresses, size );\r
\r
- KeAcquireSpinLock( &p_viport->lock, &flags );\r
+ NdisAcquireSpinLock( &p_viport->lock );\r
for( i = 0; i < p_viport->numMacAddresses; i++ )\r
{\r
p_viport->macAddresses[i].index = (uint16_t)i;\r
p_viport->hwMacAddress, MAC_ADDR_LEN );\r
\r
p_viport->macAddresses[UNICAST_ADDR].valid = TRUE;\r
- p_viport->p_adapter->macSet = TRUE;\r
+ \r
+ if( !p_viport->p_adapter->macSet )\r
+ {\r
+ p_viport->p_adapter->macSet = TRUE;\r
+ }\r
\r
- KeReleaseSpinLock( &p_viport->lock, flags );\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
\r
VNIC_EXIT( VNIC_DBG_VIPORT );\r
return IB_SUCCESS;\r
{\r
ib_api_status_t ib_status;\r
\r
- VNIC_ENTER( VNIC_DBG_VIPORT );\r
+ VNIC_ENTER( VNIC_DBG_INIT );\r
\r
ib_status = control_init( &p_viport->control, p_viport,\r
&p_viport->port_config.controlConfig, p_viport->portGuid );\r
{\r
VNIC_TRACE_EXIT( VNIC_DBG_ERROR, \r
("CMD_INIT_INIC REQ failed\n") );\r
+ control_resetReq( &p_viport->control );\r
control_cleanup( &p_viport->control );\r
return ib_status;\r
}\r
- cl_event_wait_on( &p_viport->conn_event,\r
+ cl_event_wait_on( &p_viport->sync_event,\r
(p_viport->control.p_conf->rspTimeout << 11), TRUE );\r
\r
if( p_viport->linkState != LINK_INITINICRSP )\r
VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
("CMD_INIT_INIC RSP failed\n"));\r
ib_status = IB_INSUFFICIENT_RESOURCES;\r
+ control_resetReq( &p_viport->control );\r
control_cleanup( &p_viport->control );\r
return ib_status;\r
}\r
{\r
VNIC_TRACE( VNIC_DBG_ERROR,\r
("Init MAC Addresses failed\n"));\r
+ \r
+ control_resetReq( &p_viport->control );\r
control_cleanup( &p_viport->control );\r
}\r
\r
- VNIC_EXIT( VNIC_DBG_VIPORT );\r
+ VNIC_EXIT( VNIC_DBG_INIT );\r
return ib_status;\r
}\r
\r
NDIS_STATUS status;\r
ib_api_status_t ib_status;\r
\r
- VNIC_ENTER( VNIC_DBG_VIPORT );\r
+ VNIC_ENTER( VNIC_DBG_INIT );\r
\r
ib_status = data_init( &p_viport->data,\r
&p_viport->port_config.dataConfig,\r
("command CONFIGDATAPATH REQ failed\n"));\r
return ib_status;\r
}\r
- cl_event_wait_on( &p_viport->conn_event,\r
+ cl_event_wait_on( &p_viport->sync_event,\r
(p_viport->control.p_conf->rspTimeout << 11), TRUE );\r
\r
if( p_viport->linkState != LINK_CONFIGDATAPATHRSP )\r
ib_status = data_connect( &p_viport->data );\r
if( ib_status != IB_SUCCESS )\r
{\r
- VNIC_EXIT( VNIC_DBG_VIPORT );\r
+ VNIC_EXIT( VNIC_DBG_INIT );\r
return ib_status;\r
}\r
- cl_event_wait_on( &p_viport->conn_event,\r
+ cl_event_wait_on( &p_viport->sync_event,\r
(p_viport->control.p_conf->rspTimeout << 11), TRUE );\r
if( p_viport->data.qp.qpState != IB_ATTACHED )\r
{\r
- VNIC_EXIT( VNIC_DBG_VIPORT );\r
+ VNIC_EXIT( VNIC_DBG_INIT );\r
return IB_ERROR;\r
}\r
InterlockedExchange( (volatile LONG*)&p_viport->linkState,\r
("command XCHGPOOL REQ failed\n"));\r
return ib_status;\r
}\r
- cl_event_wait_on( &p_viport->conn_event,\r
+ cl_event_wait_on( &p_viport->sync_event,\r
(p_viport->control.p_conf->rspTimeout << 11), TRUE );\r
\r
if( p_viport->linkState != LINK_XCHGPOOLRSP )\r
\r
InterlockedExchange( (volatile LONG*)&p_viport->linkState,\r
(LONG)LINK_INITIALIZED );\r
- p_viport->state = VIPORT_CONNECTED;\r
\r
- data_connected(&p_viport->data);\r
+ p_viport->state = VIPORT_CONNECTED;\r
\r
- InterlockedExchange( (volatile LONG *)&p_viport->mtu, 1500 );\r
- InterlockedExchange( (volatile LONG *)&p_viport->flags, 0 );\r
- status = viport_setLink( p_viport, INIC_FLAG_ENABLE_NIC, 1500 );\r
- if( status != NDIS_STATUS_SUCCESS )\r
+ ib_status = data_connected( &p_viport->data );\r
+ if( ib_status != IB_SUCCESS )\r
{\r
VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
- ("failed to set Link flags\n"));\r
- return IB_ERROR;\r
+ ("Alloc/Send Recv Buffers failed\n"));\r
+ return ib_status;\r
}\r
\r
- /* now we have to start periodic heartbeat timer */\r
- if( p_viport->port_config.hbInterval )\r
+ p_viport->flags = 0;\r
+ \r
+ if( p_viport->p_netpath == p_viport->p_adapter->p_currentPath )\r
{\r
- viport_timer( p_viport, p_viport->port_config.hbInterval );\r
- }\r
+ status = viport_setLink( p_viport, \r
+ INIC_FLAG_ENABLE_NIC| INIC_FLAG_SET_MTU,\r
+ (uint16_t)p_viport->p_adapter->params.MinMtu, TRUE );\r
+ if( status != NDIS_STATUS_SUCCESS )\r
+ {\r
+ VNIC_TRACE_EXIT( VNIC_DBG_ERROR,\r
+ ("failed to set Link flags\n"));\r
+ return IB_ERROR;\r
+ }\r
\r
- VNIC_EXIT( VNIC_DBG_VIPORT );\r
+ /* start periodic heartbeat timer for active path */\r
+ if( p_viport->port_config.hbInterval )\r
+ {\r
+ viport_timer( p_viport, p_viport->port_config.hbInterval );\r
+ }\r
+ }\r
+ VNIC_EXIT( VNIC_DBG_INIT );\r
return IB_SUCCESS;\r
}\r
\r
{\r
NDIS_STATUS status;\r
ib_api_status_t ib_status;\r
- KIRQL irql;\r
LinkState_t expected_state = 0;\r
\r
VNIC_ENTER( VNIC_DBG_VIPORT );\r
-\r
- if ( p_viport->state != VIPORT_CONNECTED ||\r
- p_viport->errored != 0 )\r
+ \r
+ if( p_viport->errored ||\r
+ p_viport->p_adapter->pnp_state == IB_PNP_IOC_REMOVE )\r
{\r
- VNIC_TRACE_EXIT( VNIC_DBG_INFO, ("Invalid state or error.\n") );\r
+ VNIC_TRACE( VNIC_DBG_WARN,\r
+ ("IOC[%d] updates = %#x packet_filter = %#x, query: %#x(%d) set: %#x(%d)\n",\r
+ p_viport->ioc_num,\r
+ p_viport->updates,\r
+ p_viport->p_adapter->packet_filter,\r
+ p_viport->p_adapter->query_oid.oid,\r
+ p_viport->p_adapter->pending_query,\r
+ p_viport->p_adapter->set_oid.oid,\r
+ p_viport->p_adapter->pending_set ));\r
+\r
+ VNIC_TRACE_EXIT( VNIC_DBG_WARN, ("IOC[%d] in REMOVE or invalid state.\n", \r
+ p_viport->ioc_num ));\r
+ \r
return NDIS_STATUS_NOT_ACCEPTED;\r
}\r
\r
// is the only way for this function to return success.\r
if( !InterlockedCompareExchange( &p_viport->updates, 0, 0 ) )\r
{\r
- VNIC_TRACE_EXIT( VNIC_DBG_VIPORT, ("No updates.\n") );\r
/* now can restart heartbeats */\r
if( !p_viport->timerActive &&\r
p_viport->port_config.hbInterval )\r
}\r
return NDIS_STATUS_SUCCESS;\r
}\r
+ \r
+ else\r
+ {\r
+ /* stop heartbeat timer to serve another query */\r
+ viport_timerStop( p_viport );\r
+ }\r
\r
if( sync )\r
{\r
{\r
status = NDIS_STATUS_PENDING;\r
}\r
- /* stop heartbeat timer to serve another query */\r
- viport_timerStop( p_viport );\r
-\r
+ \r
// Handle update bits one at a time.\r
if( p_viport->updates & NEED_ADDRESS_CONFIG )\r
{\r
- VNIC_TRACE( VNIC_DBG_OID,\r
- ("QUERY NEED_ADDRESS_CONFIG\n"));\r
- KeAcquireSpinLock(&p_viport->lock, &irql );\r
+ VNIC_TRACE( VNIC_DBG_CONF,("QUERY NEED_ADDRESS_CONFIG\n"));\r
+ \r
+ NdisAcquireSpinLock(&p_viport->lock );\r
+\r
p_viport->linkState = LINK_CONFIGADDRSREQ;\r
ib_status = control_configAddrsReq(\r
&p_viport->control, p_viport->macAddresses,\r
p_viport->numMacAddresses, &p_viport->addrs_query_done );\r
- KeReleaseSpinLock( &p_viport->lock, irql );\r
+ \r
+ NdisReleaseSpinLock( &p_viport->lock );\r
+\r
if ( ib_status != IB_SUCCESS )\r
{\r
InterlockedAnd( &p_viport->updates, ~NEED_ADDRESS_CONFIG );\r
}\r
else if( p_viport->updates & NEED_LINK_CONFIG )\r
{\r
- VNIC_TRACE( VNIC_DBG_OID,\r
+ VNIC_TRACE( VNIC_DBG_CONF,\r
("QUERY NEED_LINK_CONFIG\n"));\r
\r
- KeAcquireSpinLock(&p_viport->lock, &irql );\r
+ NdisAcquireSpinLock(&p_viport->lock );\r
+\r
p_viport->linkState = LINK_CONFIGLINKREQ;\r
\r
if( (InterlockedAnd(\r
- &p_viport->updates, ~MCAST_OVERFLOW ) & MCAST_OVERFLOW) )\r
+ &p_viport->updates, ~MCAST_OVERFLOW ) & MCAST_OVERFLOW ) )\r
{\r
p_viport->newFlags |= INIC_FLAG_ENABLE_MCAST_ALL;\r
}\r
}\r
\r
if ( p_viport->mtu != p_viport->newMtu )\r
+ {\r
+ p_viport->newFlags |= INIC_FLAG_SET_MTU;\r
p_viport->mtu = p_viport->newMtu;\r
+ }\r
+ if( ( p_viport->newFlags & INIC_FLAG_ENABLE_NIC ) &&\r
+ ( p_viport->p_netpath != p_viport->p_adapter->p_currentPath ) )\r
+ {\r
+ ASSERT(0);\r
+ }\r
\r
ib_status = control_configLinkReq( &p_viport->control,\r
- p_viport->newFlags, p_viport->mtu );\r
- KeReleaseSpinLock( &p_viport->lock, irql );\r
+ p_viport->newFlags, p_viport->newMtu );\r
+\r
+ p_viport->newFlags &= ~INIC_FLAG_SET_MTU;\r
+\r
+ NdisReleaseSpinLock( &p_viport->lock );\r
+\r
if( ib_status != IB_SUCCESS )\r
{\r
InterlockedAnd( &p_viport->updates, ~NEED_LINK_CONFIG );\r
}\r
else if( p_viport->updates & NEED_STATS )\r
{\r
- // TODO: This is dead code.\r
- VNIC_TRACE( VNIC_DBG_OID,\r
+ // TODO: \r
+ VNIC_TRACE( VNIC_DBG_CONF,\r
("QUERY NEED_STATS\n"));\r
\r
- KeAcquireSpinLock( &p_viport->lock, &irql );\r
+ NdisAcquireSpinLock( &p_viport->lock );\r
+\r
p_viport->linkState = LINK_REPORTSTATREQ;\r
\r
ib_status = control_reportStatisticsReq( &p_viport->control );\r
- KeReleaseSpinLock( &p_viport->lock, irql );\r
+ \r
+ NdisReleaseSpinLock( &p_viport->lock );\r
+\r
if( ib_status != IB_SUCCESS )\r
{\r
InterlockedAnd( &p_viport->updates, ~NEED_STATS );\r
\r
if( sync )\r
{\r
- cl_event_wait_on( &p_viport->conn_event, EVENT_NO_TIMEOUT, TRUE );\r
+ cl_event_wait_on( &p_viport->sync_event, EVENT_NO_TIMEOUT, TRUE );\r
\r
if( p_viport->linkState != expected_state )\r
{\r
/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2007 QLogic Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
} InicNPEvent_t;\r
\r
typedef enum {\r
- INICNP_CONNECTED = 0,\r
- INICNP_DISCONNECTED,\r
- INICNP_LINKUP,\r
- INICNP_LINKDOWN,\r
- INICNP_TIMEREXPIRED,\r
- INICNP_UNIVERSAL1,\r
- /* SECONDARYOFFSET MUST ALWAYS COME AT THE END */\r
- INICNP_SECONDARYOFFSET\r
-} InicNPEventPos_t;\r
-\r
-#define INICNP_NUM_EVENTS (2 * INICNP_SECONDARYOFFSET)\r
-\r
-#define INIC_PRINP_CONNECTED INICNP_CONNECTED\r
-#define INIC_PRINP_DISCONNECTED INICNP_DISCONNECTED\r
-#define INIC_PRINP_LINKUP INICNP_LINKUP\r
-#define INIC_PRINP_LINKDOWN INICNP_LINKDOWN\r
-#define INIC_PRINP_TIMEREXPIRED INICNP_TIMEREXPIRED\r
-#define INIC_NP_SETLINK INICNP_UNIVERSAL1\r
-\r
-#define INIC_SECNP_CONNECTED (INICNP_CONNECTED + INICNP_SECONDARYOFFSET)\r
-#define INIC_SECNP_DISCONNECTED (INICNP_DISCONNECTED + INICNP_SECONDARYOFFSET)\r
-#define INIC_SECNP_LINKUP (INICNP_LINKUP + INICNP_SECONDARYOFFSET)\r
-#define INIC_SECNP_LINKDOWN (INICNP_LINKDOWN + INICNP_SECONDARYOFFSET)\r
-#define INIC_SECNP_TIMEREXPIRED (INICNP_TIMEREXPIRED + INICNP_SECONDARYOFFSET)\r
-#define INIC_NP_FREEINIC (INICNP_UNIVERSAL1 + INICNP_SECONDARYOFFSET)\r
+ NETPATH_PRIMARY = 1,\r
+ NETPATH_SECONDARY = 2\r
+} netpath_instance_t;\r
\r
\r
typedef struct Netpath {\r
- volatile LONG carrier;\r
- struct _vnic_adapter *p_adapter;\r
- struct _viport *pViport;\r
- size_t pathIdx;\r
- uint64_t connectTime;\r
- netpathTS_t timerState;\r
+ volatile LONG carrier;\r
+ struct _vnic_adapter *p_adapter;\r
+ struct _viport *pViport;\r
+ ib_path_rec_t *p_path_rec;\r
+ uint64_t connectTime;\r
+ netpathTS_t timerState;\r
+ netpath_instance_t instance;\r
} Netpath_t;\r
\r
typedef enum {\r
\r
typedef struct _viport {\r
LIST_ENTRY listPtrs;\r
- KSPIN_LOCK lock;\r
+ NDIS_SPIN_LOCK lock;\r
cl_obj_t obj;\r
- LIST_ENTRY send_pending_list;\r
- NDIS_SPIN_LOCK pending_list_lock;\r
struct _vnic_adapter *p_adapter;\r
struct Netpath *p_netpath;\r
struct ViportConfig port_config;\r
// State machine state?\r
LinkState_t linkState;\r
LinkState_t link_hb_state;\r
-\r
Inic_CmdReportStatisticsRsp_t stats;\r
uint64_t lastStatsTime;\r
uint32_t featuresSupported;\r
uint32_t disconnect;\r
volatile LONG timerActive;\r
cl_timer_t timer;\r
- cl_event_t conn_event;\r
-\r
+ cl_event_t sync_event;\r
+ BOOLEAN hb_send_pending;\r
} viport_t;\r
\r
\r
BOOLEAN\r
viport_xmitPacket(\r
- viport_t* const p_viport,\r
- NDIS_PACKET* const p_pkt );\r
+ IN viport_t* const p_viport,\r
+ IN NDIS_PACKET* const p_pkt );\r
\r
BOOLEAN \r
viport_config_defaults(\r
viport_get_adapter_name(\r
IN viport_t *p_viport );\r
\r
-void viport_cleanup(viport_t *p_viport );\r
-void viport_setPath(viport_t *pViport, ib_path_rec_t *path, uint64_t *guid);\r
-BOOLEAN viport_setParent(viport_t *pViport, struct Netpath *pNetpath);\r
-BOOLEAN viport_unsetParent(viport_t *pViport, struct Netpath *pNetpath);\r
-void viport_free(viport_t *pViport);\r
-void viport_disconnect(viport_t *pViport);\r
-NDIS_STATUS viport_setLink(viport_t *pViport, uint8_t flags, uint16_t mtu);\r
-NDIS_STATUS viport_getStats(viport_t *pViport );\r
-\r
-void viport_timer( viport_t *p_viport, int timeout );\r
-void viport_timerStop( viport_t *p_viport );\r
-\r
-void viport_linkUp(viport_t *pViport);\r
-void viport_linkDown(viport_t *pViport);\r
-void viport_stopXmit(viport_t *pViport);\r
-void viport_restartXmit(viport_t *pViport);\r
-void viport_recvPacket(viport_t *pViport, NDIS_PACKET *pkt );\r
-void viport_failure(viport_t *pViport);\r
-BOOLEAN viport_setUnicast(viport_t *pViport, uint8_t *pAddress);\r
-NDIS_STATUS viport_setMulticast( viport_t* const pViport );\r
-#define viport_portGuid(pViport) ((pViport)->portGuid)\r
-#define viport_maxMtu(pViport) data_maxMtu(&(pViport)->data)\r
+void \r
+viport_cleanup(\r
+ IN viport_t *p_viport );\r
+\r
+BOOLEAN \r
+viport_setParent(\r
+ IN viport_t *pViport,\r
+ IN struct Netpath *pNetpath);\r
+\r
+NDIS_STATUS \r
+viport_setLink(\r
+ IN viport_t *pViport, \r
+ IN uint8_t flags,\r
+ IN uint16_t mtu,\r
+ IN BOOLEAN sync );\r
+\r
+NDIS_STATUS \r
+viport_getStats(\r
+ IN viport_t *pViport );\r
+\r
+void \r
+viport_timer(\r
+ IN viport_t *p_viport,\r
+ IN int timeout );\r
+\r
+void \r
+viport_timerStop(\r
+ IN viport_t *p_viport );\r
+\r
+void \r
+viport_linkUp(\r
+ IN viport_t *pViport);\r
+\r
+void \r
+viport_linkDown(\r
+ IN viport_t *pViport);\r
+\r
+void \r
+viport_stopXmit(\r
+ IN viport_t *pViport);\r
+\r
+void \r
+viport_restartXmit(\r
+ IN viport_t *pViport);\r
+\r
+void \r
+viport_recvPacket(\r
+ IN viport_t *pViport,\r
+ IN NDIS_PACKET **p_pkt,\r
+ IN uint32_t num_pkts );\r
+\r
+void \r
+viport_failure(\r
+ IN viport_t *pViport);\r
\r
-#define viport_getHwAddr(pViport,pAddress) \\r
- cl_memcpy(pAddress, (pViport)->hwMacAddress, MAC_ADDR_LEN)\r
+BOOLEAN\r
+viport_setUnicast(\r
+ IN viport_t* const pViport, \r
+ IN uint8_t * pAddress);\r
\r
-#define viport_features(pViport) ((pViport)->featuresSupported)\r
-#define viport_canTxCsum(pViport) (((pViport)->featuresSupported & \\r
- (INIC_FEAT_IPV4_CSUM_TX|INIC_FEAT_TCP_CSUM_TX|INIC_FEAT_UDP_CSUM_TX)) \\r
- == (INIC_FEAT_IPV4_CSUM_TX|INIC_FEAT_TCP_CSUM_TX|INIC_FEAT_UDP_CSUM_TX))\r
+NDIS_STATUS \r
+viport_setMulticast(\r
+ IN viport_t* const pViport );\r
\r
+void \r
+netpath_init(\r
+ IN struct Netpath *pNetpath,\r
+ IN struct _vnic_adapter *p_adapter );\r
\r
-void netpath_init( struct Netpath *pNetpath, struct _vnic_adapter *p_adapter );\r
-BOOLEAN netpath_addPath(struct Netpath *pNetpath, viport_t *pViport);\r
-BOOLEAN netpath_removePath(struct Netpath *pNetpath, viport_t *pViport);\r
-BOOLEAN netpath_getStats(struct Netpath *pNetpath );\r
-BOOLEAN netpath_setMulticast(struct Netpath *pNetpath, mc_list_t *mc_list,\r
- int mc_count);\r
-int netpath_maxMtu(struct Netpath *pNetpath);\r
+BOOLEAN \r
+netpath_addPath(\r
+ IN struct Netpath *pNetpath,\r
+ IN viport_t *pViport);\r
\r
BOOLEAN\r
-netpath_xmitPacket(\r
- struct Netpath* pNetpath,\r
- NDIS_PACKET* const p_pkt );\r
-void \r
-netpath_recvPacket(\r
- struct Netpath* pNetpath,\r
- NDIS_PACKET* p_pkt );\r
-\r
-void netpath_stopXmit(struct Netpath *pNetpath );\r
-void netpath_restartXmit(struct Netpath *pNetpath );\r
-\r
-void netpath_kick(struct Netpath *pNetpath);\r
-void netpath_timer(struct Netpath *pNetpath, int timeout);\r
-void netpath_tx_timeout(struct Netpath *pNetpath);\r
-\r
-const char * netpath_to_string(struct _vnic_adapter *p_adapter, struct Netpath *pNetpath);\r
-#define netpath_getHwAddr(pNetpath, pAddress) viport_getHwAddr((pNetpath)->pViport, pAddress)\r
-#define netpath_isConnected(pNetpath) (pNetpath->state == NETPATH_CONNECTED)\r
-#define netpath_canTxCsum(pNetpath) viport_canTxCsum(pNetpath->pViport)\r
+viport_unsetParent(\r
+ IN viport_t *pViport );\r
\r
ib_api_status_t\r
viport_control_connect(\r
- IN viport_t* const p_viport );\r
+ IN viport_t* const p_viport );\r
+\r
ib_api_status_t\r
viport_data_connect(\r
- IN viport_t* const p_viport );\r
+ IN viport_t* const p_viport );\r
\r
NDIS_STATUS\r
_viport_process_query(\r
IN viport_t* const p_viport,\r
IN BOOLEAN sync );\r
\r
+void\r
+viport_cancel_xmit( \r
+ IN viport_t *p_viport, \r
+ IN void *p_cancel_id );\r
+\r
+BOOLEAN \r
+netpath_removePath(\r
+ IN struct Netpath *pNetpath,\r
+ IN viport_t *p_viport );\r
+\r
+void\r
+netpath_free(\r
+ IN struct Netpath *pNetpath );\r
+\r
+BOOLEAN \r
+netpath_getStats(\r
+ IN struct Netpath *pNetpath );\r
+\r
+NDIS_STATUS \r
+netpath_setMulticast(\r
+ IN struct Netpath *pNetpath );\r
+\r
+int\r
+netpath_maxMtu(\r
+ IN struct Netpath *pNetpath);\r
+\r
+BOOLEAN\r
+netpath_linkDown(\r
+ IN Netpath_t* p_netpath );\r
+\r
+\r
+BOOLEAN \r
+netpath_linkUp(\r
+ IN Netpath_t* p_netpath );\r
+\r
+BOOLEAN\r
+netpath_is_valid(\r
+ IN Netpath_t* const p_netpath );\r
+\r
+BOOLEAN\r
+netpath_is_connected(\r
+ IN Netpath_t* const p_netpath );\r
+\r
+BOOLEAN\r
+netpath_is_primary(\r
+ IN Netpath_t* const p_netpath );\r
+\r
+BOOLEAN\r
+netpath_xmitPacket(\r
+ IN struct Netpath* pNetpath,\r
+ IN NDIS_PACKET* const p_pkt );\r
+\r
+void\r
+netpath_cancel_xmit( \r
+ IN struct Netpath* p_netpath, \r
+ IN PVOID cancel_id );\r
+\r
+void \r
+netpath_recvPacket(\r
+ IN struct Netpath* pNetpath,\r
+ IN NDIS_PACKET** pp_pkt,\r
+ IN uint32_t num_packets);\r
+\r
+void\r
+netpath_stopXmit(\r
+ IN struct Netpath *pNetpath );\r
+\r
+void\r
+netpath_restartXmit(\r
+ IN struct Netpath *pNetpath );\r
+\r
+void\r
+netpath_kick(\r
+ IN struct Netpath *pNetpath);\r
+\r
+void\r
+netpath_timer(\r
+ IN struct Netpath *pNetpath,\r
+ IN int timeout);\r
+\r
+void\r
+netpath_tx_timeout(\r
+ IN struct Netpath *pNetpath);\r
+\r
+const char*\r
+netpath_to_string(\r
+ IN struct Netpath *pNetpath );\r
+\r
+BOOLEAN\r
+netpath_setUnicast(\r
+ IN Netpath_t* p_netpath,\r
+ IN uint8_t* p_address );\r
+\r
+#define viport_portGuid(pViport) ((pViport)->portGuid)\r
+#define viport_maxMtu(pViport) data_maxMtu(&(pViport)->data)\r
+\r
+#define viport_getHwAddr(pViport,pAddress) \\r
+ cl_memcpy(pAddress, (pViport)->hwMacAddress, MAC_ADDR_LEN)\r
+\r
+#define viport_features(pViport) ( (pViport)->featuresSupported )\r
+\r
+#define viport_canTxCsum(pViport) \\r
+ ( (pViport) && ((pViport)->featuresSupported & \\r
+ (INIC_FEAT_IPV4_CSUM_TX|INIC_FEAT_TCP_CSUM_TX|INIC_FEAT_UDP_CSUM_TX)) \\r
+ == (INIC_FEAT_IPV4_CSUM_TX|INIC_FEAT_TCP_CSUM_TX|INIC_FEAT_UDP_CSUM_TX))\r
+\r
+#define viport_canRxCsum(pViport) \\r
+ ( (pViport) && ((pViport)->featuresSupported & \\r
+ (INIC_FEAT_IPV4_CSUM_RX|INIC_FEAT_TCP_CSUM_RX|INIC_FEAT_UDP_CSUM_RX)) \\r
+ == (INIC_FEAT_IPV4_CSUM_RX|INIC_FEAT_TCP_CSUM_RX|INIC_FEAT_UDP_CSUM_RX))\r
+\r
+#define netpath_getHwAddr(pNetpath, pAddress) \\r
+ viport_getHwAddr((pNetpath)->pViport, pAddress)\r
+\r
+#define netpath_canTxCsum(pNetpath) \\r
+ viport_canTxCsum( (pNetpath)->pViport )\r
\r
#endif /* _VNIC_VIPORT_H_ */\r