staging: brcm80211: invalidate all AMPDU packets on IEEE80211_AMPDU_TX_STOP
authorRoland Vossen <rvossen@broadcom.com>
Thu, 10 Mar 2011 10:35:09 +0000 (11:35 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Mar 2011 18:44:03 +0000 (11:44 -0700)
The previous patch flushed the AMPDU packets associated to a certain STA/AP
in the driver queues, but left the AMPDU packets in the DMA queue untouched.
This patch invalidates AMPDU packets in the DMA queue, so they can be
processed accordingly when hardware releases the packets to the driver.

Signed-off-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
drivers/staging/brcm80211/brcmsmac/wlc_main.c
drivers/staging/brcm80211/brcmsmac/wlc_main.h
drivers/staging/brcm80211/include/hnddma.h
drivers/staging/brcm80211/util/hnddma.c

index 3d00180efacca77265745d97af53be7a6aa04b37..0a0ff3057f110d4fa9acdd17f3338838bd8a2ef6 100644 (file)
@@ -1387,6 +1387,19 @@ static bool cb_del_ampdu_pkt(void *p, int arg_a)
        return rc;
 }
 
+/*
+ * callback function that helps invalidating ampdu packets in a DMA queue
+ */
+static void dma_cb_fn_ampdu(void *txi, void *arg_a)
+{
+       struct ieee80211_sta *sta = arg_a;
+       struct ieee80211_tx_info *tx_info = (struct ieee80211_tx_info *)txi;
+
+       if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) &&
+           (tx_info->control.sta == sta || sta == NULL))
+               tx_info->control.sta = NULL;
+}
+
 /*
  * When a remote party is no longer available for ampdu communication, any
  * pending tx ampdu packets in the driver have to be flushed.
@@ -1405,4 +1418,5 @@ void wlc_ampdu_flush(struct wlc_info *wlc,
                pktq_pflush(pq, prec, true, cb_del_ampdu_pkt,
                            (int)&ampdu_pars);
        }
+       wlc_inval_dma_pkts(wlc->hw, sta, dma_cb_fn_ampdu);
 }
index 8bee149f6316814aa5176ae744a4deef0ce93985..785357047d2cdebe022c32da82dd6ee342ef41a0 100644 (file)
@@ -8477,3 +8477,21 @@ void wlc_associate_upd(struct wlc_info *wlc, bool state)
        wlc->pub->associated = state;
        wlc->cfg->associated = state;
 }
+
+/*
+ * When a remote STA/AP is removed by Mac80211, or when it can no longer accept
+ * AMPDU traffic, packets pending in hardware have to be invalidated so that
+ * when later on hardware releases them, they can be handled appropriately.
+ */
+void wlc_inval_dma_pkts(struct wlc_hw_info *hw,
+                              struct ieee80211_sta *sta,
+                              void (*dma_callback_fn))
+{
+       struct hnddma_pub *dmah;
+       int i;
+       for (i = 0; i < NFIFO; i++) {
+               dmah = hw->di[i];
+               if (dmah != NULL)
+                       dma_walk_packets(dmah, dma_callback_fn, sta);
+       }
+}
index 7c5d7e1df07c9cb734ef6ee452a63718ea2c3c45..0eaef07d33241b0fc4b43c1048fafa23024e4821 100644 (file)
@@ -873,6 +873,9 @@ extern u16 wlc_compute_rtscts_dur(struct wlc_info *wlc, bool cts_only,
                                     bool ba);
 
 extern void wlc_tbtt(struct wlc_info *wlc, d11regs_t *regs);
+extern void wlc_inval_dma_pkts(struct wlc_hw_info *hw,
+                              struct ieee80211_sta *sta,
+                              void (*dma_callback_fn));
 
 #if defined(BCMDBG)
 extern void wlc_dump_ie(struct wlc_info *wlc, bcm_tlv_t *ie,
index 121768eccfeae37758416d55eb6b5891f7299831..5d079e77490ee24185f545bb4f1cc75f14720787 100644 (file)
@@ -202,5 +202,6 @@ extern const di_fcn_t dma64proc;
  * This info is needed by DMA_ALLOC_CONSISTENT in dma attach
  */
 extern uint dma_addrwidth(si_t *sih, void *dmaregs);
-
+void dma_walk_packets(struct hnddma_pub *dmah, void (*callback_fnc)
+                     (void *pkt, void *arg_a), void *arg_a);
 #endif                         /* _hnddma_h_ */
index 60afd06297e895a0e9c03425e80d1d876d1f8482..122f7d3fd704889607356bcecf5bf158bceba432 100644 (file)
@@ -1800,3 +1800,27 @@ uint dma_addrwidth(si_t *sih, void *dmaregs)
        return DMADDRWIDTH_64;
 }
 
+/*
+ * Mac80211 initiated actions sometimes require packets in the DMA queue to be
+ * modified. The modified portion of the packet is not under control of the DMA
+ * engine. This function calls a caller-supplied function for each packet in
+ * the caller specified dma chain.
+ */
+void dma_walk_packets(struct hnddma_pub *dmah, void (*callback_fnc)
+                     (void *pkt, void *arg_a), void *arg_a)
+{
+       dma_info_t *di = (dma_info_t *) dmah;
+       uint i =   di->txin;
+       uint end = di->txout;
+       struct sk_buff *skb;
+       struct ieee80211_tx_info *tx_info;
+
+       while (i != end) {
+               skb = (struct sk_buff *)di->txp[i];
+               if (skb != NULL) {
+                       tx_info = (struct ieee80211_tx_info *)skb->cb;
+                       (callback_fnc)(tx_info, arg_a);
+               }
+               i = NEXTTXD(i);
+       }
+}
This page took 0.03094 seconds and 5 git commands to generate.