Skip to content

Commit

Permalink
wlcore/wl12xx: adapt FW status for multiple families
Browse files Browse the repository at this point in the history
Add room for a private data struct at the end of the common FW status.
Add a convenience "counters" struct inside the FW status.

The wl12xx family does not currently use the FW status private data.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information
Arik Nemtsov authored and Luciano Coelho committed Apr 12, 2012
1 parent 34785be commit 6bac40a
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 19 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/ti/wl12xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,7 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
wl->band_rate_to_idx = wl12xx_band_rate_to_idx;
wl->hw_tx_rate_tbl_size = WL12XX_CONF_HW_RXTX_RATE_MAX;
wl->hw_min_ht_rate = WL12XX_CONF_HW_RXTX_RATE_MCS0;
wl->fw_status_priv_len = 0;
memcpy(&wl->ht_cap, &wl12xx_ht_cap, sizeof(wl12xx_ht_cap));
wl12xx_conf_init(wl);

Expand Down
18 changes: 11 additions & 7 deletions drivers/net/wireless/ti/wlcore/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl,

static void wl12xx_irq_update_links_status(struct wl1271 *wl,
struct wl12xx_vif *wlvif,
struct wl12xx_fw_status *status)
struct wl_fw_status *status)
{
struct wl1271_link *lnk;
u32 cur_fw_ps_map;
Expand All @@ -407,9 +407,10 @@ static void wl12xx_irq_update_links_status(struct wl1271 *wl,

for_each_set_bit(hlid, wlvif->ap.sta_hlid_map, WL12XX_MAX_LINKS) {
lnk = &wl->links[hlid];
cnt = status->tx_lnk_free_pkts[hlid] - lnk->prev_freed_pkts;
cnt = status->counters.tx_lnk_free_pkts[hlid] -
lnk->prev_freed_pkts;

lnk->prev_freed_pkts = status->tx_lnk_free_pkts[hlid];
lnk->prev_freed_pkts = status->counters.tx_lnk_free_pkts[hlid];
lnk->allocated_pkts -= cnt;

wl12xx_irq_ps_regulate_link(wl, wlvif, hlid,
Expand All @@ -418,16 +419,19 @@ static void wl12xx_irq_update_links_status(struct wl1271 *wl,
}

static void wl12xx_fw_status(struct wl1271 *wl,
struct wl12xx_fw_status *status)
struct wl_fw_status *status)
{
struct wl12xx_vif *wlvif;
struct timespec ts;
u32 old_tx_blk_count = wl->tx_blocks_available;
int avail, freed_blocks;
int i;
size_t status_len;

status_len = sizeof(*status) + wl->fw_status_priv_len;

wlcore_raw_read_data(wl, REG_RAW_FW_STATUS_ADDR, status,
sizeof(*status), false);
status_len, false);

wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, "
"drv_rx_counter = %d, tx_results_counter = %d)",
Expand All @@ -439,10 +443,10 @@ static void wl12xx_fw_status(struct wl1271 *wl,
for (i = 0; i < NUM_TX_QUEUES; i++) {
/* prevent wrap-around in freed-packets counter */
wl->tx_allocated_pkts[i] -=
(status->tx_released_pkts[i] -
(status->counters.tx_released_pkts[i] -
wl->tx_pkts_freed[i]) & 0xff;

wl->tx_pkts_freed[i] = status->tx_released_pkts[i];
wl->tx_pkts_freed[i] = status->counters.tx_released_pkts[i];
}

/* prevent wrap-around in total blocks counter */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ti/wlcore/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,
return is_data;
}

void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status)
void wl12xx_rx(struct wl1271 *wl, struct wl_fw_status *status)
{
unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0};
u32 buf_size;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ti/wlcore/rx.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct wl1271_rx_descriptor {
u8 reserved;
} __packed;

void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status);
void wl12xx_rx(struct wl1271 *wl, struct wl_fw_status *status);
u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band);

#endif
27 changes: 18 additions & 9 deletions drivers/net/wireless/ti/wlcore/wl12xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,21 @@ struct wl1271_stats {

#define AP_MAX_STATIONS 8

struct wl_fw_packet_counters {
/* Cumulative counter of released packets per AC */
u8 tx_released_pkts[NUM_TX_QUEUES];

/* Cumulative counter of freed packets per HLID */
u8 tx_lnk_free_pkts[WL12XX_MAX_LINKS];

/* Cumulative counter of released Voice memory blocks */
u8 tx_voice_released_blks;

u8 padding[3];
} __packed;

/* FW status registers */
struct wl12xx_fw_status {
struct wl_fw_status {
__le32 intr;
u8 fw_rx_counter;
u8 drv_rx_counter;
Expand All @@ -173,16 +186,12 @@ struct wl12xx_fw_status {
/* Size (in Memory Blocks) of TX pool */
__le32 tx_total;

/* Cumulative counter of released packets per AC */
u8 tx_released_pkts[NUM_TX_QUEUES];
struct wl_fw_packet_counters counters;

/* Cumulative counter of freed packets per HLID */
u8 tx_lnk_free_pkts[WL12XX_MAX_LINKS];

/* Cumulative counter of released Voice memory blocks */
u8 tx_voice_released_blks;
u8 padding_1[3];
__le32 log_start_addr;

/* Private status to be used by the lower drivers */
u8 priv[0];
} __packed;

struct wl1271_rx_mem_pool_addr {
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/wireless/ti/wlcore/wlcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ struct wl1271 {
u32 buffer_cmd;
u32 buffer_busyword[WL1271_BUSY_WORD_CNT];

struct wl12xx_fw_status *fw_status;
struct wl_fw_status *fw_status;
struct wl1271_tx_hw_res_if *tx_res_if;

/* Current chipset configuration */
Expand Down Expand Up @@ -346,6 +346,9 @@ struct wl1271 {

/* HW HT (11n) capabilities */
struct ieee80211_sta_ht_cap ht_cap;

/* size of the private FW status data */
size_t fw_status_priv_len;
};

int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev);
Expand Down

0 comments on commit 6bac40a

Please sign in to comment.