File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -981,7 +981,6 @@ typedef struct _SCATTER_GATHER_CONTEXT {
981981} SCATTER_GATHER_CONTEXT , * PSCATTER_GATHER_CONTEXT ;
982982
983983#define MAX_SG_ELEMENTS 0x30
984- #define SG_ELEMENT_MIN 4096 // Minimum bytes in a S/G element
985984
986985IO_ALLOCATION_ACTION
987986NTAPI
@@ -996,9 +995,10 @@ HalpScatterGatherAdapterControl(IN PDEVICE_OBJECT DeviceObject,
996995 PSCATTER_GATHER_ELEMENT TempElements ;
997996 ULONG ElementCount = 0 , RemainingLength = AdapterControlContext -> Length ;
998997 PUCHAR CurrentVa = AdapterControlContext -> CurrentVa ;
999- // RemainingLength / Minimum BYTES in S/G element
1000- // + 1 for remainder of division + 1 for a safety cushion
1001- ULONG Est_SG_Elements = min (RemainingLength / SG_ELEMENT_MIN + 2 , MAX_SG_ELEMENTS );
998+ // RemainingLength / PAGE_SIZE + 1 for the remainder of our division
999+ // + 1 for a safety cushion gives a good safe value. Using the
1000+ // min function with MAX_SG_ELEMENTS keeps us from getting too large.
1001+ ULONG Est_SG_Elements = min (RemainingLength / PAGE_SIZE + 2 , MAX_SG_ELEMENTS );
10021002
10031003 /* Store the map register base for later in HalPutScatterGatherList */
10041004 AdapterControlContext -> MapRegisterBase = MapRegisterBase ;
You can’t perform that action at this time.
0 commit comments