]> git.baikalelectronics.ru Git - kernel.git/commit
iwlwifi: use coherent DMA memory for command header
authorJohannes Berg <johannes.berg@intel.com>
Wed, 27 Feb 2013 12:18:50 +0000 (13:18 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 28 Feb 2013 10:49:42 +0000 (11:49 +0100)
commit35210b0f67779f956d90d52c5d37652066ccc11f
tree0deec3b8af53cc2caab0fbfb65de7a5bf7b3dc1d
parentf281518bc6d7fad65f8c18d6e60c4b76075c5073
iwlwifi: use coherent DMA memory for command header

Recently in commit 1082fb61d042fceec953b339cae59fa6803e9c15
("iwlwifi: always copy first 16 bytes of commands") we fixed
the problem that the hardware writes back to the command and
that could overwrite parts of the data that was still needed
and would thus be corrupted.

Investigating this problem more closely we found that this
write-back isn't really ordered very well with respect to
other DMA traffic. Therefore, it sometimes happened that the
write-back occurred after unmapping the command again which
is clearly an issue and could corrupt the next allocation
that goes to that spot, or (better) cause IOMMU faults.

To fix this, allocate coherent memory for the first 16 bytes
of each command, containing the write-back part, and use it
for all queues. All the dynamic DMA mappings only need to be
TO_DEVICE then. This ensures that even when the write-back
happens "too late" it can't hit memory that has been freed
or a mapping that doesn't exist any more.

Since now the actual command is no longer modified, we can
also remove CMD_WANT_HCMD and get rid of the DMA sync that
was necessary to update the scratch pointer.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/dvm/sta.c
drivers/net/wireless/iwlwifi/iwl-trans.h
drivers/net/wireless/iwlwifi/pcie/internal.h
drivers/net/wireless/iwlwifi/pcie/rx.c
drivers/net/wireless/iwlwifi/pcie/tx.c