ath10k: fix diag_read to collect data for larger memory
authorAshok Raj Nagarajan <arnagara@qti.qualcomm.com>
Sat, 28 May 2016 08:25:40 +0000 (11:25 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 2 Jun 2016 14:50:29 +0000 (17:50 +0300)
commit1e56d5127d5c2142fcd26b93f4a9abacbd8f975d
tree9cb1cae533cbeb6b250c240758d1e49fe9016c8b
parent8a0a36cf98dbe689c31568b4f0ed883b43815cae
ath10k: fix diag_read to collect data for larger memory

diag_read uses dma_alloc_coherent to allocate memory requested by the
caller. If this memory requested is larger, more than DIAG_TRANSFER_LIMIT
(2K), then it is likely that we may not get the requested memory and we
would fail.

To solve this, request dma_alloc_coherent for only DIAG_TRANSFER_LIMIT, and
reuse this buffer multiple times as needed to copy the data requested in
smaller chunks of size not more than DIAG_TRANSFER_LIMIT. Previously we
were reading into the caller's only after getting the complete requested
data.

Fixes: 68c03249f388 ('ath10k: convert pci_alloc_consistent() to dma_alloc_coherent()')
Signed-off-by: Ashok Raj Nagarajan <arnagara@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/pci.c