Way to force transfer count in scatter/gather list to be multiple of 16 bytes? RRS feed

  • Question

  • Hi Developers,

    I have to implement a device driver for my company proprietary PCIe card. This hardware needs the transfer count in a scatter/gather list entry to be multiple of 16-bytes. Is there a way that I can implement this?

    Currently I already have the code to perform bus-mastered DMA from a scatter/gather list provided by the WDF framework call to WdfDmaTransactionInitializeUsingRequest(). But when my callback routine to program the DMA receives the scatter/gather list, it sometimes has a beginning or ending entry with count not in multiple of 16-bytes even though I know my buffer size is in multiple of 16-bytes. Is there anyway to tell/force the WDF framework to give the drive the count in multiple of 16-bytes?

    Any help is greatly appreciated.

    Thursday, May 23, 2019 6:08 AM


  • No.  The address of the buffer comes from the application.  WDF can't change that.  The best plan is to make it part of your application contract that the buffer it sends must be 16-byte aligned.  It's certainly very easy for you to check the alignment in your ioctl handler and return an error like STATUS_INVALID_PARAMETER if they don't do so.

    Otherwise, the only other choice is for your driver to copy the data to an aligned buffer.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Thursday, May 23, 2019 7:01 AM