{
struct carl9170_tx_superframe *super = get_super(desc);
unsigned int qidx = super->s.queue;
- bool txfail, success;
+ bool txfail = false, success;
success = true;
unhide_super(desc);
-#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ
- if (unlikely(super == (void *) &dma_mem.reserved.ba)) {
- fw.wlan.ba_desc = desc;
- fw.wlan.ba_desc_available = 1;
+ if (unlikely(super == fw.wlan.fw_desc_data)) {
+ fw.wlan.fw_desc = desc;
+ fw.wlan.fw_desc_available = 1;
+ if (fw.wlan.fw_desc_callback)
+ fw.wlan.fw_desc_callback(super, success);
+
return true;
}
-#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */
-
- wlan_tx_complete(super, success);
#ifdef CONFIG_CARL9170FW_CAB_QUEUE
if (unlikely(super->s.cab))
fw.wlan.cab_queue_len[super->s.vif_id]--;
#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
+ wlan_tx_complete(super, success);
+
/* recycle freed descriptors */
dma_reclaim(&fw.pta.down_queue, desc);
down_trigger();
wlan_tx_ampdu_end(i);
if (!queue_empty(&fw.wlan.tx_queue[i]))
wlan_trigger(BIT(i));
-
}
}
wlan_trigger(BIT(super->s.queue));
}
-#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ
+static void wlan_tx_fw(struct carl9170_tx_superdesc *super)
+{
+ if (!fw.wlan.fw_desc_available)
+ return;
+
+ fw.wlan.fw_desc_available = 0;
+
+ /* Format BlockAck */
+ fw.wlan.fw_desc->status = AR9170_OWN_BITS_SW;
+ fw.wlan.fw_desc->ctrl = AR9170_CTRL_FS_BIT | AR9170_CTRL_LS_BIT;
+ fw.wlan.fw_desc->totalLen = fw.wlan.fw_desc->dataSize = super->len;
+ fw.wlan.fw_desc_data = fw.wlan.fw_desc->dataAddr = super;
+ fw.wlan.fw_desc->nextAddr = fw.wlan.fw_desc->lastAddr =
+ fw.wlan.fw_desc;
+
+ wlan_tx(fw.wlan.fw_desc);
+}
+
static void wlan_send_buffered_ba(void)
{
struct carl9170_tx_ba_superframe *baf = &dma_mem.reserved.ba.ba;
return;
/* there's no point to continue when the ba_desc is not available. */
- if (!fw.wlan.ba_desc_available)
+ if (!fw.wlan.fw_desc_available)
return;
ctx = &fw.wlan.ba_cache[fw.wlan.ba_head_idx];
fw.wlan.ba_head_idx++;
fw.wlan.ba_head_idx %= CONFIG_CARL9170FW_BACK_REQS_NUM;
- /* Format BlockAck */
- fw.wlan.ba_desc->status = 0;
- fw.wlan.ba_desc->ctrl = AR9170_CTRL_FS_BIT | AR9170_CTRL_LS_BIT;
- fw.wlan.ba_desc_available = 0;
- fw.wlan.ba_desc->nextAddr = fw.wlan.ba_desc->lastAddr =
- fw.wlan.ba_desc;
-
- baf->s.len = fw.wlan.ba_desc->totalLen = fw.wlan.ba_desc->dataSize =
- sizeof(struct carl9170_tx_superdesc) +
- sizeof(struct ar9170_tx_hwdesc) +
- sizeof(struct ieee80211_ba);
-
+ baf->s.len = sizeof(struct carl9170_tx_superdesc) +
+ sizeof(struct ar9170_tx_hwdesc) +
+ sizeof(struct ieee80211_ba);
baf->s.ri[0].tries = 1;
baf->s.queue = AR9170_TXQ_VO;
baf->f.hdr.length = sizeof(struct ieee80211_ba) + FCS_LEN;
*/
ba->control = ctx->control | cpu_to_le16(1);
ba->start_seq_num = ctx->start_seq_num;
-
- wlan_tx(fw.wlan.ba_desc);
+ wlan_tx_fw(&baf->s);
}
static struct carl9170_bar_ctx *wlan_get_bar_cache_buffer(void)
ctx->phy = cpu_to_le32(0x2cc301);
}
}
-#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */
static void wlan_check_rx_overrun(void)
{
} else if (ieee80211_is_ctl(hdr->frame_control)) {
switch (le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_STYPE) {
case IEEE80211_STYPE_BACK_REQ:
-#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ
handle_bar(desc, hdr, data_len, mac_err);
-#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */
/* fallthrough */
rx_filter |= CARL9170_RX_FILTER_CTL_BACKR;
break;
wlan_assign_seq((struct ieee80211_hdr *)addr, vif);
}
+
+static void wlan_send_buffered_cab(void)
+{
+ unsigned int i;
+
+ for (i = 0; i < CARL9170_INTF_NUM; i++) {
+ if (unlikely(fw.wlan.cab_flush_trigger[i] == CARL9170_CAB_TRIGGER_ARMED)) {
+ /*
+ * This is hardcoded into carl9170usb driver.
+ *
+ * The driver must set the PRETBTT event to beacon_interval -
+ * CARL9170_PRETBTT_KUS (usually 6) Kus.
+ *
+ * But still, we can only do so much about 802.11-2007 9.3.2.1 &
+ * 11.2.1.6. Let's hope the current solution is adequate enough.
+ */
+
+ if (is_after_msecs(fw.wlan.cab_flush_time, (CARL9170_TBTT_DELTA))) {
+ wlan_cab_flush_queue(i);
+
+ /*
+ * This prevents the code from sending new BC/MC frames
+ * which were queued after the previous buffered traffic
+ * has been sent out... They will have to wait until the
+ * next DTIM beacon comes along.
+ */
+ fw.wlan.cab_flush_trigger[i] = CARL9170_CAB_TRIGGER_DEFER;
+ }
+ }
+
+ }
+}
#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
static void handle_beacon_config(void)
static void wlan_janitor(void)
{
#ifdef CONFIG_CARL9170FW_CAB_QUEUE
- unsigned int i;
-
- for (i = 0; i < CARL9170_INTF_NUM; i++) {
- if (unlikely(fw.wlan.cab_flush_trigger[i] == CARL9170_CAB_TRIGGER_ARMED)) {
- /*
- * This is hardcoded into carl9170usb driver.
- *
- * The driver must set the PRETBTT event to beacon_interval -
- * CARL9170_PRETBTT_KUS (usually 6) Kus.
- *
- * But still, we can only do so much about 802.11-2007 9.3.2.1 &
- * 11.2.1.6. Let's hope the current solution is adequate enough.
- */
-
- if (is_after_msecs(fw.wlan.cab_flush_time, (CARL9170_TBTT_DELTA))) {
- wlan_cab_flush_queue(i);
-
- /*
- * This prevents the code from sending new BC/MC frames
- * which were queued after the previous buffered traffic
- * has been sent out... They will have to wait until the
- * next DTIM beacon comes along.
- */
- fw.wlan.cab_flush_trigger[i] = CARL9170_CAB_TRIGGER_DEFER;
- }
- }
-
- }
+ wlan_send_buffered_cab();
#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
wlan_send_buffered_tx_status();
-#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ
wlan_send_buffered_ba();
-#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */
}
void handle_wlan(void)