carl9170 firmware: enable BA REQ responder by default
authorChristian Lamparter <chunkeey@googlemail.com>
Sat, 7 May 2011 14:15:23 +0000 (16:15 +0200)
committerChristian Lamparter <chunkeey@googlemail.com>
Sat, 7 May 2011 14:15:23 +0000 (16:15 +0200)
This feature is mandatory in the 802.11n standard.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
carlfw/Kconfig
carlfw/include/carl9170.h
carlfw/include/config.h
carlfw/include/dma.h
carlfw/src/dma.c
carlfw/src/fw.c
carlfw/src/wlan.c

index 18d09586f583695f018972a4d827f3b688967d90..cd236bafaea80113dc6a9895a8f293b1244f706a 100644 (file)
@@ -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"
index 85ea1d2425bd5895915aff9525cb407a61f01bac..cbfa611b7e761ec2c6ae67b11ad6f668afac440e 100644 (file)
@@ -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 {
index 8361affbdbaa0968fb81d849e4bb0a9963600b64..bebb26005e1c93872baf31e9780a733f6a841893 100644 (file)
@@ -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 */
index 11a760dfc98139cb68c921d188d1cc19c8b71941..07d06d607f9bc2fea7429fede6e6799ac94fdd50 100644 (file)
@@ -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));
index de9c8b91b71489e0ff115b966a0d237005574fe6..7ca0c9aec0222eb2799e8f1fc3e998309097cee9 100644 (file)
@@ -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 */
 }
 
 /*
index a934687a9feaf1a10d87474e66e086732fa64c2b..94c52d1207979ee2b2c83a34781d82b7e0e8af3e 100644 (file)
@@ -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 */
index ec50e6c82cefb564febe5203b7d0506ea709ba5d..844036376a2532efb4e51d5ce2c11ef660eae4ad 100644 (file)
@@ -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)