From cdced53c2ede33a9fe9004db4d93cfc984ad4243 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 7 May 2011 16:15:23 +0200 Subject: [PATCH] carl9170 firmware: enable BA REQ responder by default This feature is mandatory in the 802.11n standard. Signed-off-by: Christian Lamparter --- carlfw/Kconfig | 14 -------------- carlfw/include/carl9170.h | 2 -- carlfw/include/config.h | 6 ++---- carlfw/include/dma.h | 17 ++++------------- carlfw/src/dma.c | 7 +------ carlfw/src/fw.c | 4 +--- carlfw/src/wlan.c | 8 -------- 7 files changed, 8 insertions(+), 50 deletions(-) diff --git a/carlfw/Kconfig b/carlfw/Kconfig index 18d0958..cd236ba 100644 --- a/carlfw/Kconfig +++ b/carlfw/Kconfig @@ -67,20 +67,6 @@ endmenu menu "802.11 Firmware Features" -config CARL9170FW_HANDLE_BACK_REQ - def_bool y - prompt "Handle BlockACK Requests in Firmware" - ---help--- - Enables a firmware mechanism to answer incoming BlockACK requests. - This feature is necessary to comply with 802.11n. So say Y, - if you have plans to support this operation mode. - -config CARL9170FW_BACK_REQS_NUM - default 4 - int - prompt "Number of max. active BlockACK Request" - depends on CARL9170FW_HANDLE_BACK_REQ - config CARL9170FW_CAB_QUEUE def_bool y prompt "Support software-based Content after Beacon Queue" diff --git a/carlfw/include/carl9170.h b/carlfw/include/carl9170.h index 85ea1d2..cbfa611 100644 --- a/carlfw/include/carl9170.h +++ b/carlfw/include/carl9170.h @@ -129,14 +129,12 @@ struct firmware_context_struct { tx_status_tail_idx; struct carl9170_tx_status tx_status_cache[CARL9170_TX_STATUS_NUM]; -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ /* BA(R) Request Handler */ struct dma_desc *ba_desc; struct carl9170_bar_ctx ba_cache[CONFIG_CARL9170FW_BACK_REQS_NUM]; unsigned int ba_desc_available, ba_tail_idx, ba_head_idx; -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ } wlan; struct { diff --git a/carlfw/include/config.h b/carlfw/include/config.h index 8361aff..bebb260 100644 --- a/carlfw/include/config.h +++ b/carlfw/include/config.h @@ -52,6 +52,8 @@ #define CARL9170_INTF_NUM (1) #endif /* CONFIG_CARL9170FW_VIFS_NUM */ +#define CONFIG_CARL9170FW_BACK_REQS_NUM 4 + #if ((defined CONFIG_CARL9170FW_DEBUG) || \ (defined CONFIG_CARL9170FW_LOOPBACK)) #define CARL9170FW_UNUSABLE y @@ -62,10 +64,6 @@ static inline void __config_check(void) BUILD_BUG_ON(!CARL9170_TX_STATUS_NUM); BUILD_BUG_ON(CARL9170_INTF_NUM < 1); BUILD_BUG_ON(CARL9170_INTF_NUM >= AR9170_MAX_VIRTUAL_MAC); - -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ - BUILD_BUG_ON(!CONFIG_CARL9170FW_BACK_REQS_NUM); -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ } #endif /* __CARL9170FW_CONFIG_H */ diff --git a/carlfw/include/dma.h b/carlfw/include/dma.h index 11a760d..07d06d6 100644 --- a/carlfw/include/dma.h +++ b/carlfw/include/dma.h @@ -46,8 +46,8 @@ struct dma_desc { struct dma_desc *nextAddr; /* Next TD address */ } __packed __aligned(4); -/* Up, Dn, 5x Tx, retry, Rx, [USB Int], (CAB), (BA) */ -#define AR9170_TERMINATOR_NUMBER_B 9 +/* Up, Dn, 5x Tx, retry, Rx, [USB Int], (CAB), FW */ +#define AR9170_TERMINATOR_NUMBER_B 10 #define AR9170_TERMINATOR_NUMBER_INT 1 @@ -57,15 +57,9 @@ struct dma_desc { #define AR9170_TERMINATOR_NUMBER_CAB 0 #endif /* CONFIG_CARL9170FW_CAB_QUEUE */ -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ -#define AR9170_TERMINATOR_NUMBER_BA 1 -#else -#define AR9170_TERMINATOR_NUMBER_BA 0 -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ #define AR9170_TERMINATOR_NUMBER (AR9170_TERMINATOR_NUMBER_B + \ AR9170_TERMINATOR_NUMBER_INT + \ - AR9170_TERMINATOR_NUMBER_CAB + \ - AR9170_TERMINATOR_NUMBER_BA) + AR9170_TERMINATOR_NUMBER_CAB) #define AR9170_BLOCK_SIZE (256 + 64) @@ -85,12 +79,11 @@ struct carl9170_tx_ba_superframe { #define CARL9170_RSP_BUFFER_LEN AR9170_BLOCK_SIZE struct carl9170_sram_reserved { -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ union { uint32_t buf[CARL9170_BA_BUFFER_LEN / sizeof(uint32_t)]; struct carl9170_tx_ba_superframe ba; } ba; -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ + union { uint32_t buf[CARL9170_MAX_CMD_LEN / sizeof(uint32_t)]; struct carl9170_cmd cmd; @@ -331,9 +324,7 @@ static inline void __check_desc(void) BUILD_BUG_ON(sizeof(mem) > AR9170_SRAM_SIZE); -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, ba.buf) & (BLOCK_ALIGNMENT - 1)); -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, cmd.buf) & (BLOCK_ALIGNMENT - 1)); BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, rsp.buf) & (BLOCK_ALIGNMENT - 1)); BUILD_BUG_ON(offsetof(struct carl9170_sram_reserved, bcn.buf) & (BLOCK_ALIGNMENT - 1)); diff --git a/carlfw/src/dma.c b/carlfw/src/dma.c index de9c8b9..7ca0c9a 100644 --- a/carlfw/src/dma.c +++ b/carlfw/src/dma.c @@ -81,6 +81,7 @@ void dma_init_descriptors(void) fw.wlan.tx_retry.head = fw.wlan.tx_retry.terminator = &dma_mem.terminator[i++]; fw.wlan.rx_queue.head = fw.wlan.rx_queue.terminator = &dma_mem.terminator[i++]; fw.usb.int_desc = &dma_mem.terminator[i++]; + fw.wlan.ba_desc = &dma_mem.terminator[i++]; #ifdef CONFIG_CARL9170FW_CAB_QUEUE /* GCC bug ? */ @@ -93,10 +94,6 @@ void dma_init_descriptors(void) #endif #endif /* CONFIG_CARL9170FW_CAB_QUEUE */ -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ - fw.wlan.ba_desc = &dma_mem.terminator[i++]; -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ - BUILD_BUG_ON(AR9170_TERMINATOR_NUMBER != j); DBG("Blocks:%d [tx:%d, rx:%d] Terminators:%d/%d\n", @@ -140,7 +137,6 @@ void dma_init_descriptors(void) /* rsp is now available for use */ fw.usb.int_desc_available = 1; -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ fw.wlan.ba_desc->status = AR9170_OWN_BITS_SW; fw.wlan.ba_desc->ctrl = (AR9170_CTRL_LS_BIT | AR9170_CTRL_FS_BIT); fw.wlan.ba_desc->dataSize = fw.wlan.ba_desc->totalLen = @@ -154,7 +150,6 @@ void dma_init_descriptors(void) memset(DESC_PAYLOAD(fw.wlan.ba_desc), 0, 128); fw.wlan.ba_desc_available = 1; -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ } /* diff --git a/carlfw/src/fw.c b/carlfw/src/fw.c index a934687..94c52d1 100644 --- a/carlfw/src/fw.c +++ b/carlfw/src/fw.c @@ -35,6 +35,7 @@ const struct carl9170_firmware_descriptor __section(fwdsc) carl9170fw_desc = { FILL(otus, OTUS, .feature_set = cpu_to_le32(BIT(CARL9170FW_DUMMY_FEATURE) | BIT(CARL9170FW_USB_RESP_EP2) | + BIT(CARL9170FW_HANDLE_BACK_REQ) | BIT(CARL9170FW_RX_FILTER) | #ifdef CONFIG_CARL9170FW_USB_INIT_FIRMWARE BIT(CARL9170FW_USB_INIT_FIRMWARE) | @@ -55,9 +56,6 @@ const struct carl9170_firmware_descriptor __section(fwdsc) carl9170fw_desc = { #ifdef CONFIG_CARL9170FW_CAB_QUEUE BIT(CARL9170FW_WLANTX_CAB) | #endif /* CONFIG_CARL9170FW_CAB_QUEUE */ -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ - BIT(CARL9170FW_HANDLE_BACK_REQ) | -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ #ifdef CONFIG_CARL9170FW_UNUSABLE BIT(CARL9170FW_UNUSABLE) | #endif /* CONFIG_CARL9170FW_UNUSABLE */ diff --git a/carlfw/src/wlan.c b/carlfw/src/wlan.c index ec50e6c..8440363 100644 --- a/carlfw/src/wlan.c +++ b/carlfw/src/wlan.c @@ -438,13 +438,11 @@ static bool wlan_tx_status(struct dma_queue *queue, 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; return true; } -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ wlan_tx_complete(super, success); @@ -502,7 +500,6 @@ void __hot wlan_tx(struct dma_desc *desc) wlan_trigger(BIT(super->s.queue)); } -#ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ static void wlan_send_buffered_ba(void) { struct carl9170_tx_ba_superframe *baf = &dma_mem.reserved.ba.ba; @@ -629,7 +626,6 @@ static void handle_bar(struct dma_desc *desc, struct ieee80211_hdr *hdr, ctx->phy = cpu_to_le32(0x2cc301); } } -#endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */ static void wlan_check_rx_overrun(void) { @@ -829,9 +825,7 @@ static unsigned int wlan_rx_filter(struct dma_desc *desc) } 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; @@ -1041,9 +1035,7 @@ static void wlan_janitor(void) 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) -- 2.31.1