X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Fsrc%2Fwlan.c;h=942df83148fa61ff4e24f34d49c0f6e97603be4a;hb=c3eeab99a9fcd78fe86cbf827c318ba11b568682;hp=caf9b6d9201161c86cfea542a78c6a9264f5c3ef;hpb=c9ae7f9a14af3330eaf62abfd6de5dfab31bf708;p=carl9170fw.git diff --git a/carlfw/src/wlan.c b/carlfw/src/wlan.c index caf9b6d..942df83 100644 --- a/carlfw/src/wlan.c +++ b/carlfw/src/wlan.c @@ -438,19 +438,22 @@ static bool wlan_tx_status(struct dma_queue *queue, unhide_super(desc); - 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; } - 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(); @@ -500,6 +503,24 @@ void __hot wlan_tx(struct dma_desc *desc) wlan_trigger(BIT(super->s.queue)); } +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; @@ -510,26 +531,16 @@ static void wlan_send_buffered_ba(void) 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; - fw.wlan.ba_desc_available = 0; - 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 = AR9170_OWN_BITS_SW; - fw.wlan.ba_desc->ctrl = AR9170_CTRL_FS_BIT | AR9170_CTRL_LS_BIT; - 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; @@ -561,8 +572,7 @@ static void wlan_send_buffered_ba(void) */ 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) @@ -957,6 +967,38 @@ void wlan_modify_beacon(const unsigned int vif, 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) @@ -1004,34 +1046,7 @@ static void handle_radar(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();