iwlwifi: don't count the tfds in HW queue any more
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 21 Nov 2011 09:07:18 +0000 (11:07 +0200)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Fri, 16 Dec 2011 15:22:33 +0000 (07:22 -0800)
commiteb9a372a73ea3e2b7e795a7ea03a5b8d92815672
tree396d90022f3b304ef10f900a3306b8b616a376af
parentaca15f81fffb71e5df8fd72e76ef5f1a3128bd11
iwlwifi: don't count the tfds in HW queue any more

Since packets sent to an RA / TID in AGG are sent from a
separate HW Tx queue, we may get into a race:
the regular queue isn't empty while we already begin to
send packets from the AGG queue. This would result in sending
packets out of order.

In order to cope with this, mac80211 waits until the driver
reports that the legacy queue is drained before it can send
packets to the AGG queue. During that time, mac80211 buffers
packets for the driver. These packets will be sent in order
after the driver reports it is ready.

The way this was implemented in the driver is as follows:
We held a counter that monitors the number of packets for
an RA / TID in the HW queues. When this counter reached 0,
we knew that the HW queues were drained and we reported to
mac80211 that were ready to proceed.

This patch changes the implementation described above. We
now remember what is the wifi sequence number of the first
packet that will be sent in the AGG queue (lets' call it
ssn). When we reclaim the packet before ssn, we know that
the queue is drained, and we are ready to proceed.

This will allow us to move this logic in the upper layer and
eventually remove the tid_data from the shared area.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
drivers/net/wireless/iwlwifi/iwl-debugfs.c
drivers/net/wireless/iwlwifi/iwl-shared.h
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c