Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

320 lines
9.0 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. afddata.h
  5. Abstract:
  6. This module declares global data for AFD.
  7. Author:
  8. David Treadwell (davidtr) 21-Feb-1992
  9. Revision History:
  10. Vadim Eydelman (vadime)
  11. 1998-1999 NT5.0 optimizations
  12. --*/
  13. #ifndef _AFDDATA_
  14. #define _AFDDATA_
  15. extern PDEVICE_OBJECT AfdDeviceObject;
  16. extern LIST_ENTRY AfdEndpointListHead;
  17. extern LIST_ENTRY AfdConstrainedEndpointListHead;
  18. extern LIST_ENTRY AfdPollListHead;
  19. extern AFD_QSPIN_LOCK AfdPollListLock;
  20. extern LIST_ENTRY AfdTransportInfoListHead;
  21. extern KEVENT AfdContextWaitEvent;
  22. #define AFD_CONTEXT_BUSY ((PVOID)-1)
  23. #define AFD_CONTEXT_WAITING ((PVOID)-2)
  24. extern PKPROCESS AfdSystemProcess;
  25. extern FAST_IO_DISPATCH AfdFastIoDispatch;
  26. //
  27. // Global data which must always be in nonpaged pool,
  28. // even when the driver is paged out (resource, lookaside lists).
  29. //
  30. PAFD_GLOBAL_DATA AfdGlobalData;
  31. #define AfdResource (&AfdGlobalData->Resource)
  32. #define AfdLookasideLists (AfdGlobalData)
  33. #define AfdAlignmentTable (AfdGlobalData->BufferAlignmentTable)
  34. //
  35. // Globals for dealing with AFD's executive worker thread.
  36. //
  37. extern LIST_ENTRY AfdWorkQueueListHead;
  38. extern BOOLEAN AfdWorkThreadRunning;
  39. extern PIO_WORKITEM AfdWorkQueueItem;
  40. //
  41. // Globals to track the buffers used by AFD.
  42. //
  43. extern ULONG AfdLargeBufferListDepth;
  44. #define AFD_SM_DEFAULT_LARGE_LIST_DEPTH 0
  45. #define AFD_MM_DEFAULT_LARGE_LIST_DEPTH 2
  46. #define AFD_LM_DEFAULT_LARGE_LIST_DEPTH 10
  47. extern ULONG AfdMediumBufferListDepth;
  48. #define AFD_SM_DEFAULT_MEDIUM_LIST_DEPTH 4
  49. #define AFD_MM_DEFAULT_MEDIUM_LIST_DEPTH 8
  50. #define AFD_LM_DEFAULT_MEDIUM_LIST_DEPTH 24
  51. extern ULONG AfdSmallBufferListDepth;
  52. #define AFD_SM_DEFAULT_SMALL_LIST_DEPTH 8
  53. #define AFD_MM_DEFAULT_SMALL_LIST_DEPTH 16
  54. #define AFD_LM_DEFAULT_SMALL_LIST_DEPTH 32
  55. extern ULONG AfdBufferTagListDepth;
  56. #define AFD_SM_DEFAULT_TAG_LIST_DEPTH 16
  57. #define AFD_MM_DEFAULT_TAG_LIST_DEPTH 32
  58. #define AFD_LM_DEFAULT_TAG_LIST_DEPTH 64
  59. extern CLONG AfdLargeBufferSize;
  60. // default value is AfdBufferLengthForOnePage
  61. extern CLONG AfdMediumBufferSize;
  62. #define AFD_DEFAULT_MEDIUM_BUFFER_SIZE 1504
  63. extern CLONG AfdSmallBufferSize;
  64. #define AFD_DEFAULT_SMALL_BUFFER_SIZE 128
  65. extern CLONG AfdBufferTagSize;
  66. #define AFD_DEFAULT_TAG_BUFFER_SIZE 0
  67. extern CLONG AfdStandardAddressLength;
  68. #define AFD_DEFAULT_STD_ADDRESS_LENGTH sizeof(TA_IP_ADDRESS)
  69. extern CLONG AfdBufferLengthForOnePage;
  70. extern ULONG AfdBufferAlignment;
  71. #define AFD_MINIMUM_BUFFER_ALIGNMENT \
  72. max(TYPE_ALIGNMENT(TRANSPORT_ADDRESS), \
  73. max(TYPE_ALIGNMENT(KAPC), \
  74. max(TYPE_ALIGNMENT(WORK_QUEUE_ITEM), \
  75. max(TYPE_ALIGNMENT(AFD_BUFFER), \
  76. max(TYPE_ALIGNMENT(MDL), \
  77. max(TYPE_ALIGNMENT(IRP), \
  78. MAX_NATURAL_ALIGNMENT))))))
  79. extern ULONG AfdAlignmentTableSize;
  80. extern ULONG AfdAlignmentOverhead;
  81. extern ULONG AfdBufferOverhead;
  82. //
  83. // Globals for tuning TransmitFile().
  84. //
  85. extern LIST_ENTRY AfdQueuedTransmitFileListHead;
  86. extern AFD_QSPIN_LOCK AfdQueuedTransmitFileSpinLock;
  87. extern ULONG AfdActiveTransmitFileCount;
  88. extern ULONG AfdMaxActiveTransmitFileCount;
  89. #define AFD_DEFAULT_MAX_ACTIVE_TRANSMIT_FILE_COUNT 2
  90. extern ULONG AfdDefaultTransmitWorker;
  91. #define AFD_DEFAULT_TRANSMIT_WORKER AFD_TF_USE_SYSTEM_THREAD
  92. #define AFD_MAX_FAST_TRANSPORT_ADDRESS 32
  93. //
  94. // Various pieces of configuration information, with default values.
  95. //
  96. extern CCHAR AfdIrpStackSize;
  97. #define AFD_DEFAULT_IRP_STACK_SIZE 4
  98. extern CCHAR AfdPriorityBoost;
  99. #define AFD_DEFAULT_PRIORITY_BOOST 2
  100. extern ULONG AfdFastSendDatagramThreshold;
  101. #define AFD_FAST_SEND_DATAGRAM_THRESHOLD 1024
  102. extern ULONG AfdTPacketsCopyThreshold;
  103. #define AFD_TPACKETS_COPY_THRESHOLD 512
  104. extern PVOID AfdDiscardableCodeHandle;
  105. extern PKEVENT AfdLoaded;
  106. extern AFD_WORK_ITEM AfdUnloadWorker;
  107. extern BOOLEAN AfdVolatileConfig;
  108. extern HANDLE AfdParametersNotifyHandle;
  109. extern WORK_QUEUE_ITEM AfdParametersNotifyWorker;
  110. extern PKEVENT AfdParametersUnloadEvent;
  111. //
  112. // Various globals for SAN
  113. //
  114. extern HANDLE AfdSanCodeHandle;
  115. extern LIST_ENTRY AfdSanHelperList;
  116. extern PAFD_ENDPOINT AfdSanServiceHelper;
  117. extern HANDLE AfdSanServicePid;
  118. extern POBJECT_TYPE IoCompletionObjectType;
  119. extern LONG AfdSanProviderListSeqNum;
  120. extern CLONG AfdReceiveWindowSize;
  121. #define AFD_LM_DEFAULT_RECEIVE_WINDOW 8192
  122. #define AFD_MM_DEFAULT_RECEIVE_WINDOW 8192
  123. #define AFD_SM_DEFAULT_RECEIVE_WINDOW 4096
  124. extern CLONG AfdSendWindowSize;
  125. #define AFD_LM_DEFAULT_SEND_WINDOW 8192
  126. #define AFD_MM_DEFAULT_SEND_WINDOW 8192
  127. #define AFD_SM_DEFAULT_SEND_WINDOW 4096
  128. extern CLONG AfdBufferMultiplier;
  129. #define AFD_DEFAULT_BUFFER_MULTIPLIER 4
  130. extern CLONG AfdTransmitIoLength;
  131. #define AFD_LM_DEFAULT_TRANSMIT_IO_LENGTH 65536
  132. #define AFD_MM_DEFAULT_TRANSMIT_IO_LENGTH (PAGE_SIZE*2)
  133. #define AFD_SM_DEFAULT_TRANSMIT_IO_LENGTH PAGE_SIZE
  134. extern CLONG AfdMaxFastTransmit;
  135. #define AFD_DEFAULT_MAX_FAST_TRANSMIT 65536
  136. extern CLONG AfdMaxFastCopyTransmit;
  137. #define AFD_DEFAULT_MAX_FAST_COPY_TRANSMIT 128
  138. extern ULONG AfdEndpointsOpened;
  139. extern ULONG AfdEndpointsCleanedUp;
  140. extern ULONG AfdEndpointsClosed;
  141. #define AFD_ENDPOINTS_FREEING_MAX 10
  142. extern ULONG AfdEndpointsFreeing;
  143. #define AFD_CONNECTIONS_FREEING_MAX 10
  144. extern ULONG AfdConnectionsFreeing;
  145. extern BOOLEAN AfdIgnorePushBitOnReceives;
  146. extern BOOLEAN AfdEnableDynamicBacklog;
  147. #define AFD_DEFAULT_ENABLE_DYNAMIC_BACKLOG FALSE
  148. extern LONG AfdMinimumDynamicBacklog;
  149. #define AFD_DEFAULT_MINIMUM_DYNAMIC_BACKLOG 0
  150. extern LONG AfdMaximumDynamicBacklog;
  151. #define AFD_DEFAULT_MAXIMUM_DYNAMIC_BACKLOG 0
  152. extern LONG AfdDynamicBacklogGrowthDelta;
  153. #define AFD_DEFAULT_DYNAMIC_BACKLOG_GROWTH_DELTA 0
  154. // Maximum number of free connections that we keep
  155. // on listening endpoint. This is not the same as a backlog,
  156. // it is just a policy on connection object reuse via AcceptEx
  157. // We stop reusing if we have that many free objects in the list
  158. // Currently the main reason for this limit is the ability to use the
  159. // SLists which have USHORT for item count.
  160. #define AFD_MAXIMUM_FREE_CONNECTIONS 32767
  161. //
  162. // These are limits on backlog in AFD_START_LISTEN
  163. // Application can work around this limit by posting AcceptEx(-s)
  164. //
  165. #define AFD_MAXIMUM_BACKLOG_NTS 200
  166. #define AFD_MAXIMUM_BACKLOG_NTW 5
  167. #define AFD_MINIMUM_BACKLOG 1
  168. extern BOOLEAN AfdDisableRawSecurity;
  169. extern PSECURITY_DESCRIPTOR AfdAdminSecurityDescriptor;
  170. extern BOOLEAN AfdDontShareAddresses;
  171. extern BOOLEAN AfdDisableDirectSuperAccept;
  172. extern BOOLEAN AfdDisableChainedReceive;
  173. #ifdef TDI_SERVICE_SEND_AND_DISCONNECT
  174. extern BOOLEAN AfdUseTdiSendAndDisconnect;
  175. #endif //TDI_SERVICE_SEND_AND_DISCONNECT
  176. #define AFD_MINIMUM_TPINFO_ELEMENT_COUNT 3 // For transmit file compatibility.
  177. extern ULONG AfdDefaultTpInfoElementCount;
  178. //
  179. // Data for transport address lists and queued change queries
  180. //
  181. extern HANDLE AfdBindingHandle;
  182. extern LIST_ENTRY AfdAddressEntryList;
  183. extern LIST_ENTRY AfdAddressChangeList;
  184. extern PERESOURCE AfdAddressListLock;
  185. extern AFD_QSPIN_LOCK AfdAddressChangeLock;
  186. extern AFD_WORK_ITEM AfdPnPDeregisterWorker;
  187. extern IO_STATUS_BLOCK AfdDontCareIoStatus;
  188. // Holds TDI connect timeout (-1).
  189. extern const LARGE_INTEGER AfdInfiniteTimeout;
  190. extern SLIST_HEADER AfdLRList;
  191. extern KDPC AfdLRListDpc;
  192. extern KTIMER AfdLRListTimer;
  193. extern AFD_WORK_ITEM AfdLRListWorker;
  194. extern LONG AfdLRListCount;
  195. extern SLIST_HEADER AfdLRFileMdlList;
  196. extern AFD_LR_LIST_ITEM AfdLRFileMdlListItem;
  197. #if AFD_PERF_DBG
  198. extern CLONG AfdFullReceiveIndications;
  199. extern CLONG AfdPartialReceiveIndications;
  200. extern CLONG AfdFullReceiveDatagramIndications;
  201. extern CLONG AfdPartialReceiveDatagramIndications;
  202. extern CLONG AfdFastSendsSucceeded;
  203. extern CLONG AfdFastSendsFailed;
  204. extern CLONG AfdFastReceivesSucceeded;
  205. extern CLONG AfdFastReceivesFailed;
  206. extern CLONG AfdFastSendDatagramsSucceeded;
  207. extern CLONG AfdFastSendDatagramsFailed;
  208. extern CLONG AfdFastReceiveDatagramsSucceeded;
  209. extern CLONG AfdFastReceiveDatagramsFailed;
  210. extern CLONG AfdFastReadsSucceeded;
  211. extern CLONG AfdFastReadsFailed;
  212. extern CLONG AfdFastWritesSucceeded;
  213. extern CLONG AfdFastWritesFailed;
  214. extern CLONG AfdFastTfSucceeded;
  215. extern CLONG AfdFastTfFailed;
  216. extern CLONG AfdFastTfReadFailed;
  217. extern CLONG AfdTPWorkersExecuted;
  218. extern CLONG AfdTPRequests;
  219. extern BOOLEAN AfdDisableFastIo;
  220. extern BOOLEAN AfdDisableConnectionReuse;
  221. #endif // if AFD_PERF_DBG
  222. #if AFD_KEEP_STATS
  223. extern AFD_QUOTA_STATS AfdQuotaStats;
  224. extern AFD_HANDLE_STATS AfdHandleStats;
  225. extern AFD_QUEUE_STATS AfdQueueStats;
  226. extern AFD_CONNECTION_STATS AfdConnectionStats;
  227. #endif // if AFD_KEEP_STATS
  228. #if DBG
  229. extern BOOLEAN AfdUsePrivateAssert;
  230. #endif
  231. #ifdef _WIN64
  232. extern QOS32 AfdDefaultQos32;
  233. #endif
  234. extern QOS AfdDefaultQos;
  235. ULONG AfdIoctlTable[AFD_NUM_IOCTLS];
  236. PAFD_IMMEDIATE_CALL AfdImmediateCallDispatch[AFD_NUM_IOCTLS];
  237. PAFD_IRP_CALL AfdIrpCallDispatch[AFD_NUM_IOCTLS];
  238. #define AFD_FAST_CONNECT_DATA_SIZE 256
  239. #endif // ndef _AFDDATA_