DMA/PCIe driver: pci_map_sg not merging chunks in the scatterlist?

From: Evan Lavelle
Date: Thu Mar 17 2016 - 18:17:37 EST


Everything I've read makes me think that pci_map_sg will merge consecutive physical pages into one scatterlist entry, if possible.

However, this isn't happening on a driver I'm currently writing. The returned scatterlist contains one entry per page, with the physical addresses incrementing by 4K per page.

Is this expected behaviour, or do I have to do something to enable merging? This wouldn't be a major problem, except that the PCIe card I'm working on only has enough local storage for about 300 scatterlist entries, which means that DMA ops are limited to a little over 1Mbyte at a time, which isn't much use.

I'm on x86_64, RHEL6.7, IOMMU not enabled, and I don't need to support anything prior to 2.6.32. The PCIe card has 32-bit addressing. uname shows:

2.6.32-431.el6.x86_64 #1 SMP x86_64 x86_64 x86_64

Thanks.