[nvmewin] updated SGL conversion routine
Luse, Paul E
paul.e.luse at intel.com
Wed Apr 18 17:43:02 PDT 2012
OK, the else has now been updated (thanks Jim, needed some tweaks though but I saw what you were going for of course). There's so many way to handle this problem, I'm sure we can find something more efficient than this but its pretty good I think and easy to follow.
Please review, I have this under test now and am heading out....
Thx
Paul
physicalAddress.QuadPart = pSgl->List[index].PhysicalAddress.QuadPart;
if (sgElementSize <= PAGE_SIZE) {
ULONG nextPage = 0;
/* Must transfer at least one full page */
numImplicitEntries = 1;
/*
* since we may be offset into the page, look to determine
* address to determine if a 2nd PRP entry is needed
*/
nextPage = physicalAddress.LowPart + PAGE_SIZE;
nextPage = nextPage & ~PAGE_MASK;
numImplicitEntries +=
((physicalAddress.LowPart + sgElementSize) > nextPage) ? 1 : 0;
} else {
PHYSICAL_ADDRESS startAddr, endAddr;
startAddr.QuadPart = physicalAddress.QuadPart;
endAddr.QuadPart = startAddr.QuadPart + sgElementSize;
numImplicitEntries = 0;
/* account for an entry becaue of an offset start */
if (startAddr.QuadPart % PAGE_SIZE) {
numImplicitEntries += 1;
/* bump the start address to the next page boundary */
startAddr.QuadPart += PAGE_SIZE;
startAddr.QuadPart &= ~PAGE_MASK;
}
/* account for an entry becaue of tail */
if (endAddr.QuadPart % PAGE_SIZE) {
numImplicitEntries += 1;
/* lop off the tail */
endAddr.QuadPart &= ~PAGE_MASK;
}
/* now account for the whole pages if any */
numImplicitEntries += (ULONG)((endAddr.QuadPart - startAddr.QuadPart) / PAGE_SIZE);
}
____________________________________
Paul Luse
Sr. Staff Engineer
PCG Server Software Engineering
Desk: 480.554.3688, Mobile: 480.334.4630
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/nvmewin/attachments/20120419/2959ab31/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nvmeSnti.c
URL: <http://lists.openfabrics.org/pipermail/nvmewin/attachments/20120419/2959ab31/attachment.c>
More information about the nvmewin
mailing list