wlcore/wl18xx/wl12xx: aggregation buffer size set
authorIgal Chernobelsky <igalc@ti.com>
Sun, 29 Jul 2012 15:21:12 +0000 (18:21 +0300)
committerLuciano Coelho <luca@coelho.fi>
Thu, 27 Sep 2012 09:13:51 +0000 (12:13 +0300)
Aggregation buffer size is set separately per 18xx/12xx chip family.
For 18xx aggragation buffer is set to 13 pages to utilize all
the available tx/rx descriptors for aggregation.

[Arik - remove redundant parts from the patch]

Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
drivers/net/wireless/ti/wl12xx/main.c
drivers/net/wireless/ti/wl12xx/wl12xx.h
drivers/net/wireless/ti/wl18xx/main.c
drivers/net/wireless/ti/wl18xx/wl18xx.h
drivers/net/wireless/ti/wlcore/main.c
drivers/net/wireless/ti/wlcore/rx.c
drivers/net/wireless/ti/wlcore/tx.c
drivers/net/wireless/ti/wlcore/wlcore.h

index f38e76942ccc6c28b43b84400eeb15234bb9b194..0a8bc0c7b6ccda3a185135e536177bfca0f59911 100644 (file)
@@ -1630,7 +1630,7 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
        struct ieee80211_hw *hw;
        struct wl12xx_priv *priv;
 
-       hw = wlcore_alloc_hw(sizeof(*priv));
+       hw = wlcore_alloc_hw(sizeof(*priv), WL12XX_AGGR_BUFFER_SIZE);
        if (IS_ERR(hw)) {
                wl1271_error("can't allocate hw");
                return PTR_ERR(hw);
index c8ff7ec9fd4106729f15bdbfa5efaf454a18b31d..9953374a307da9a02cb86feca80ef5e9ea1f37da 100644 (file)
@@ -38,6 +38,8 @@
 #define WL128X_SUBTYPE_VER     2
 #define WL128X_MINOR_VER       115
 
+#define WL12XX_AGGR_BUFFER_SIZE        (4 * PAGE_SIZE)
+
 #define WL12XX_NUM_TX_DESCRIPTORS 16
 #define WL12XX_NUM_RX_DESCRIPTORS 8
 
index 934708b6db8dcef473059defd3a1f5aa3ed6199b..3f4fbd80d4ae7e42e387e58aaa9d0ff46697019a 100644 (file)
@@ -1380,7 +1380,7 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)
        struct wl18xx_priv *priv;
        int ret;
 
-       hw = wlcore_alloc_hw(sizeof(*priv));
+       hw = wlcore_alloc_hw(sizeof(*priv), WL18XX_AGGR_BUFFER_SIZE);
        if (IS_ERR(hw)) {
                wl1271_error("can't allocate hw");
                ret = PTR_ERR(hw);
index 9882e29db4a8a396020e8ed230d19cbb79f53229..a6e61a25124d29013bc985a3925916b680f72331 100644 (file)
@@ -33,6 +33,8 @@
 
 #define WL18XX_CMD_MAX_SIZE          740
 
+#define WL18XX_AGGR_BUFFER_SIZE                (13 * PAGE_SIZE)
+
 #define WL18XX_NUM_TX_DESCRIPTORS 32
 #define WL18XX_NUM_RX_DESCRIPTORS 32
 
index 612008f32992f22e025046320aa474a202ef7a24..7fe19defa97f98da6d5b9ff6b6773c07f70a9708 100644 (file)
@@ -5313,7 +5313,7 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
 
 #define WL1271_DEFAULT_CHANNEL 0
 
-struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size)
+struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size)
 {
        struct ieee80211_hw *hw;
        struct wl1271 *wl;
@@ -5398,12 +5398,13 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size)
        mutex_init(&wl->mutex);
        mutex_init(&wl->flush_mutex);
 
-       order = get_order(WL1271_AGGR_BUFFER_SIZE);
+       order = get_order(aggr_buf_size);
        wl->aggr_buf = (u8 *)__get_free_pages(GFP_KERNEL, order);
        if (!wl->aggr_buf) {
                ret = -ENOMEM;
                goto err_wq;
        }
+       wl->aggr_buf_size = aggr_buf_size;
 
        wl->dummy_packet = wl12xx_alloc_dummy_packet(wl);
        if (!wl->dummy_packet) {
@@ -5466,8 +5467,7 @@ int wlcore_free_hw(struct wl1271 *wl)
        device_remove_file(wl->dev, &dev_attr_bt_coex_state);
        free_page((unsigned long)wl->fwlog);
        dev_kfree_skb(wl->dummy_packet);
-       free_pages((unsigned long)wl->aggr_buf,
-                       get_order(WL1271_AGGR_BUFFER_SIZE));
+       free_pages((unsigned long)wl->aggr_buf, get_order(wl->aggr_buf_size));
 
        wl1271_debugfs_exit(wl);
 
index f55e2f9e7ac56c4212c01cdf0e96b32cf3a7e465..9ee0ec6fd1db3d666769747e2f52c42bcdbe53e1 100644 (file)
@@ -221,7 +221,7 @@ int wlcore_rx(struct wl1271 *wl, struct wl_fw_status_1 *status)
                        pkt_len = wlcore_rx_get_buf_size(wl, des);
                        align_pkt_len = wlcore_rx_get_align_buf_size(wl,
                                                                     pkt_len);
-                       if (buf_size + align_pkt_len > WL1271_AGGR_BUFFER_SIZE)
+                       if (buf_size + align_pkt_len > wl->aggr_buf_size)
                                break;
                        buf_size += align_pkt_len;
                        rx_counter++;
index f9c26b19bff07867aea9f76cb505de43bd5ec77d..a90d3cd094089c82fe60db12dca55bedaa33af0f 100644 (file)
@@ -193,7 +193,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct wl12xx_vif *wlvif,
        int id, ret = -EBUSY, ac;
        u32 spare_blocks;
 
-       if (buf_offset + total_len > WL1271_AGGR_BUFFER_SIZE)
+       if (buf_offset + total_len > wl->aggr_buf_size)
                return -EAGAIN;
 
        spare_blocks = wlcore_hw_get_spare_blocks(wl, is_gem);
index 81790a0aea0813cdb52c5ccafb13e6b445edf6de..a7e9d5869db4bdea93ac03a13152c12c4b19c470 100644 (file)
@@ -237,6 +237,7 @@ struct wl1271 {
 
        /* Intermediate buffer, used for packet aggregation */
        u8 *aggr_buf;
+       u32 aggr_buf_size;
 
        /* Reusable dummy packet template */
        struct sk_buff *dummy_packet;
@@ -399,7 +400,7 @@ struct wl1271 {
 
 int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev);
 int __devexit wlcore_remove(struct platform_device *pdev);
-struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size);
+struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size);
 int wlcore_free_hw(struct wl1271 *wl);
 int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd,
                   struct ieee80211_vif *vif,