Leaked source code of windows server 2003
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.

168 lines
7.9 KiB

  1. /****************************************************************************/
  2. // aschapi.h
  3. //
  4. // Scheduler header.
  5. //
  6. // Copyright (C) 1997-2000 Microsoft Corporation
  7. /****************************************************************************/
  8. #ifndef _H_ASCHAPI
  9. #define _H_ASCHAPI
  10. // Scheduling mode constants.
  11. #define SCH_MODE_ASLEEP 0
  12. #define SCH_MODE_NORMAL 1
  13. #define SCH_MODE_TURBO 2
  14. /****************************************************************************/
  15. /* Turbo mode duration in units of 100ns */
  16. /****************************************************************************/
  17. #define SCH_TURBO_MODE_FAST_LINK_DURATION 150 * 10000
  18. #define SCH_TURBO_MODE_SLOW_LINK_DURATION 30 * 10000
  19. /****************************************************************************/
  20. /* Turbo mode delay for a slow link (in ms). Fast link delay is read from */
  21. /* the registry. */
  22. /****************************************************************************/
  23. #define SCH_TURBO_PERIOD_SLOW_LINK_DELAY 10
  24. #define SCH_NO_TIMER (-1L)
  25. /****************************************************************************/
  26. /* InputKick mode duration in units of 100ns */
  27. /****************************************************************************/
  28. #define SCH_INPUTKICK_DURATION (1000 * 10000)
  29. /****************************************************************************/
  30. /* Preferred output PDU sizes. Note that these must be < 16384 */
  31. /* */
  32. /* HACKHACK: */
  33. /* We try to stay within the buffer allocation sizes allowed by TermDD's */
  34. /* buffer pools. The max is 8192 total bytes, which includes all WD */
  35. /* overhead (PKT_HEADER_SIZE + security header + NM pOutBuf + MCS prefix */
  36. /* and suffix) as well as TermDD overhead (estimated to 400 bytes). Until */
  37. /* we can redesign the WD to keep a variable with the real overhead, we'll */
  38. /* set the maximum sizes to an approximate amount. */
  39. /****************************************************************************/
  40. // The max OUTBUF, X.224, MCS, NM pointer, and encryption overhead sizes.
  41. #define OUTBUF_OVERHEAD 400
  42. #define MCS_ALLOC_OVERHEAD SendDataReqPrefixBytes
  43. #define MAX_X224_MCS_WIRE_OVERHEAD 15
  44. #define NM_OVERHEAD (sizeof(UINT_PTR))
  45. #define MAX_ENCRYPT_OVERHEAD (sizeof(RNS_SECURITY_HEADER1))
  46. // The on-the-wire overhead of the lower layers.
  47. #define NETWORK_WIRE_OVERHEAD \
  48. (MAX_X224_MCS_WIRE_OVERHEAD + MAX_ENCRYPT_OVERHEAD)
  49. // The OutBuf allocation overhead of the lower layers.
  50. #define NETWORK_ALLOC_OVERHEAD \
  51. (MCS_ALLOC_OVERHEAD + NM_OVERHEAD + MAX_ENCRYPT_OVERHEAD)
  52. #define OUTBUF_8K_ALLOC_SIZE 8192
  53. #define OUTBUF_HEADER_OVERHEAD 60
  54. #define OUTBUF_16K_ALLOC_SIZE 16384
  55. #ifdef DC_HICOLOR
  56. // Maximum size the order packer can request from the allocator and still
  57. // get a 16K OutBuf, taking into account the overhead of the lower layers.
  58. #define MAX_16K_OUTBUF_ALLOC_SIZE \
  59. (16384 - OUTBUF_OVERHEAD - NETWORK_ALLOC_OVERHEAD)
  60. #endif
  61. /****************************************************************************/
  62. // Packing sizes - different sizes for different connection speeds.
  63. // The client must fully reconstruct the contents of an OUTBUF before it can
  64. // act on the data contained within. For slow links, we must try not to
  65. // send large OUTBUFs else the output looks bursty as large numbers of
  66. // orders get unpacked at once. On LAN we have a bit more leeway, but still
  67. // want to limit ourselves a bit. And, we always want to try to
  68. // send payloads whose total wire size is as close to a multiple of 1460
  69. // (the LAN and RAS TCP/IP packet payload size) as possible to reduce the
  70. // number of frames we send.
  71. //
  72. // Note that here we specify small and large packing limits. This is
  73. // because some entire orders have trouble fitting into the smaller size
  74. // (e.g. a cache-bitmap secondary order with 4K of bitmap data attached).
  75. // The second size must be at least 4K, plus network overhead, plus the
  76. // the maximum size of a cache-bitmap order header in wire format, times
  77. // 8/7 (the inverse of the ratio used for compressed UP packing).
  78. // It must also be smaller than sc8KOutBufUsableSpace, since the package
  79. // allocator in SC will be allocating that size for the order packer.
  80. /****************************************************************************/
  81. // LAN small and large packing limits.
  82. #define SMALL_LAN_PAYLOAD_SIZE (1460 * 2 - NETWORK_WIRE_OVERHEAD)
  83. #define LARGE_LAN_PAYLOAD_SIZE (1460 * 5 - NETWORK_WIRE_OVERHEAD)
  84. // Slow link small and large packing limits.
  85. #define SMALL_SLOWLINK_PAYLOAD_SIZE (1460 * 1 - NETWORK_WIRE_OVERHEAD)
  86. #define LARGE_SLOWLINK_PAYLOAD_SIZE (1460 * 4 - NETWORK_WIRE_OVERHEAD)
  87. // For filling in order PDUs, we'd like to have a minimum size available in
  88. // the package beyond the update orders PDU header, to allow at least a
  89. // few small orders to be packed into a packet and amortize the cost of
  90. // the share headers.
  91. #define SCH_MIN_ORDER_BUFFER_SPACE 50
  92. // Minimum screen data space for packing network buffers.
  93. #define SCH_MIN_SDA_BUFFER_SPACE 128
  94. /****************************************************************************/
  95. /* Compression scaling factor. */
  96. /****************************************************************************/
  97. #define SCH_UNCOMP_BYTES 1024
  98. /****************************************************************************/
  99. /* Initial estimates for compression (these are tuned on the basis of real */
  100. /* data once we're running). The values are "bytes of compressed data per */
  101. /* SCH_UNCOMP_BYTES bytes of raw data" */
  102. /* */
  103. /* The initial values are typical values seen in normal usage. */
  104. /****************************************************************************/
  105. #define SCH_BA_INIT_EST 100
  106. #define SCH_MPPC_INIT_EST 512
  107. /****************************************************************************/
  108. /* Limit value to prevent odd behaviour */
  109. /****************************************************************************/
  110. #define SCH_COMP_LIMIT 25
  111. /****************************************************************************/
  112. /* Structure: SCH_SHARED_DATA */
  113. /* */
  114. /* Description: Data shared between WD and DD parts of SCH. */
  115. /****************************************************************************/
  116. typedef struct tagSCH_SHARED_DATA
  117. {
  118. /************************************************************************/
  119. /* The next fields are used by SCH to decide when there is enough */
  120. /* output to make a schedule worth-while. The values are passed by */
  121. /* OE2 and BA to the WD side of SCH. */
  122. /* */
  123. /* The value is the number of bytes that 1024 bytes of PDU payload */
  124. /* would on average compress to. */
  125. /************************************************************************/
  126. unsigned baCompressionEst; // Amount of BA compression expected.
  127. unsigned MPPCCompressionEst; // Compression ratio of MPPC bulk compressor.
  128. BOOL schSlowLink;
  129. // OUTBUF packing sizes, based on the link speed.
  130. unsigned SmallPackingSize;
  131. unsigned LargePackingSize;
  132. } SCH_SHARED_DATA, *PSCH_SHARED_DATA;
  133. #endif /* #ifndef _H_ASCHAPI */