Commit 72b0624f authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho

wlcore/wl12xx: set the number of Tx descriptors per chip family

Each chip family can have a different amount of Tx descriptors. These
are set on init.
Signed-off-by: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 96e0c683
...@@ -674,6 +674,7 @@ static int __devinit wl12xx_probe(struct platform_device *pdev) ...@@ -674,6 +674,7 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
wl->ops = &wl12xx_ops; wl->ops = &wl12xx_ops;
wl->ptable = wl12xx_ptable; wl->ptable = wl12xx_ptable;
wl->rtable = wl12xx_rtable; wl->rtable = wl12xx_rtable;
wl->num_tx_desc = 16;
return wlcore_probe(wl, pdev); return wlcore_probe(wl, pdev);
} }
......
...@@ -978,7 +978,7 @@ int wl12xx_acx_mem_cfg(struct wl1271 *wl) ...@@ -978,7 +978,7 @@ int wl12xx_acx_mem_cfg(struct wl1271 *wl)
mem_conf->rx_mem_block_num = mem->rx_block_num; mem_conf->rx_mem_block_num = mem->rx_block_num;
mem_conf->tx_min_mem_block_num = mem->tx_min_block_num; mem_conf->tx_min_mem_block_num = mem->tx_min_block_num;
mem_conf->num_ssid_profiles = mem->ssid_profiles; mem_conf->num_ssid_profiles = mem->ssid_profiles;
mem_conf->total_tx_descriptors = cpu_to_le32(ACX_TX_DESCRIPTORS); mem_conf->total_tx_descriptors = cpu_to_le32(wl->num_tx_desc);
mem_conf->dyn_mem_enable = mem->dynamic_memory; mem_conf->dyn_mem_enable = mem->dynamic_memory;
mem_conf->tx_free_req = mem->min_req_tx_blocks; mem_conf->tx_free_req = mem->min_req_tx_blocks;
mem_conf->rx_free_req = mem->min_req_rx_blocks; mem_conf->rx_free_req = mem->min_req_rx_blocks;
......
...@@ -5269,7 +5269,7 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size) ...@@ -5269,7 +5269,7 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size)
__set_bit(WL12XX_SYSTEM_HLID, wl->links_map); __set_bit(WL12XX_SYSTEM_HLID, wl->links_map);
memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map)); memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map));
for (i = 0; i < ACX_TX_DESCRIPTORS; i++) for (i = 0; i < wl->num_tx_desc; i++)
wl->tx_frames[i] = NULL; wl->tx_frames[i] = NULL;
spin_lock_init(&wl->wl_lock); spin_lock_init(&wl->wl_lock);
...@@ -5411,6 +5411,8 @@ int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev) ...@@ -5411,6 +5411,8 @@ int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev)
goto out_free_hw; goto out_free_hw;
} }
BUG_ON(wl->num_tx_desc > WLCORE_MAX_TX_DESCRIPTORS);
wl->irq = platform_get_irq(pdev, 0); wl->irq = platform_get_irq(pdev, 0);
wl->ref_clock = pdata->board_ref_clock; wl->ref_clock = pdata->board_ref_clock;
wl->tcxo_clock = pdata->board_tcxo_clock; wl->tcxo_clock = pdata->board_tcxo_clock;
......
...@@ -61,8 +61,8 @@ static int wl1271_alloc_tx_id(struct wl1271 *wl, struct sk_buff *skb) ...@@ -61,8 +61,8 @@ static int wl1271_alloc_tx_id(struct wl1271 *wl, struct sk_buff *skb)
{ {
int id; int id;
id = find_first_zero_bit(wl->tx_frames_map, ACX_TX_DESCRIPTORS); id = find_first_zero_bit(wl->tx_frames_map, wl->num_tx_desc);
if (id >= ACX_TX_DESCRIPTORS) if (id >= wl->num_tx_desc)
return -EBUSY; return -EBUSY;
__set_bit(id, wl->tx_frames_map); __set_bit(id, wl->tx_frames_map);
...@@ -74,7 +74,7 @@ static int wl1271_alloc_tx_id(struct wl1271 *wl, struct sk_buff *skb) ...@@ -74,7 +74,7 @@ static int wl1271_alloc_tx_id(struct wl1271 *wl, struct sk_buff *skb)
static void wl1271_free_tx_id(struct wl1271 *wl, int id) static void wl1271_free_tx_id(struct wl1271 *wl, int id)
{ {
if (__test_and_clear_bit(id, wl->tx_frames_map)) { if (__test_and_clear_bit(id, wl->tx_frames_map)) {
if (unlikely(wl->tx_frames_cnt == ACX_TX_DESCRIPTORS)) if (unlikely(wl->tx_frames_cnt == wl->num_tx_desc))
clear_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); clear_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags);
wl->tx_frames[id] = NULL; wl->tx_frames[id] = NULL;
...@@ -818,7 +818,7 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl, ...@@ -818,7 +818,7 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
u8 retries = 0; u8 retries = 0;
/* check for id legality */ /* check for id legality */
if (unlikely(id >= ACX_TX_DESCRIPTORS || wl->tx_frames[id] == NULL)) { if (unlikely(id >= wl->num_tx_desc || wl->tx_frames[id] == NULL)) {
wl1271_warning("TX result illegal id: %d", id); wl1271_warning("TX result illegal id: %d", id);
return; return;
} }
...@@ -1011,7 +1011,7 @@ void wl12xx_tx_reset(struct wl1271 *wl, bool reset_tx_queues) ...@@ -1011,7 +1011,7 @@ void wl12xx_tx_reset(struct wl1271 *wl, bool reset_tx_queues)
if (reset_tx_queues) if (reset_tx_queues)
wl1271_handle_tx_low_watermark(wl); wl1271_handle_tx_low_watermark(wl);
for (i = 0; i < ACX_TX_DESCRIPTORS; i++) { for (i = 0; i < wl->num_tx_desc; i++) {
if (wl->tx_frames[i] == NULL) if (wl->tx_frames[i] == NULL)
continue; continue;
......
...@@ -89,8 +89,6 @@ ...@@ -89,8 +89,6 @@
#define WL1271_AP_BSS_INDEX 0 #define WL1271_AP_BSS_INDEX 0
#define WL1271_AP_DEF_BEACON_EXP 20 #define WL1271_AP_DEF_BEACON_EXP 20
#define ACX_TX_DESCRIPTORS 16
#define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) #define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
enum wl1271_state { enum wl1271_state {
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
#include "wl12xx.h" #include "wl12xx.h"
#include "event.h" #include "event.h"
/* The maximum number of Tx descriptors in all chip families */
#define WLCORE_MAX_TX_DESCRIPTORS 32
struct wlcore_ops { struct wlcore_ops {
int (*identify_chip)(struct wl1271 *wl); int (*identify_chip)(struct wl1271 *wl);
int (*boot)(struct wl1271 *wl); int (*boot)(struct wl1271 *wl);
...@@ -174,8 +177,8 @@ struct wl1271 { ...@@ -174,8 +177,8 @@ struct wl1271 {
struct workqueue_struct *freezable_wq; struct workqueue_struct *freezable_wq;
/* Pending TX frames */ /* Pending TX frames */
unsigned long tx_frames_map[BITS_TO_LONGS(ACX_TX_DESCRIPTORS)]; unsigned long tx_frames_map[BITS_TO_LONGS(WLCORE_MAX_TX_DESCRIPTORS)];
struct sk_buff *tx_frames[ACX_TX_DESCRIPTORS]; struct sk_buff *tx_frames[WLCORE_MAX_TX_DESCRIPTORS];
int tx_frames_cnt; int tx_frames_cnt;
/* FW Rx counter */ /* FW Rx counter */
...@@ -303,6 +306,9 @@ struct wl1271 { ...@@ -303,6 +306,9 @@ struct wl1271 {
/* per-chip-family private structure */ /* per-chip-family private structure */
void *priv; void *priv;
/* number of TX descriptors the HW supports. */
u32 num_tx_desc;
}; };
int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev); int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment