Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6bac40a6 authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho
Browse files

wlcore/wl12xx: adapt FW status for multiple families



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: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 34785be5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);

+11 −7
Original line number Diff line number Diff line
@@ -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;
@@ -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,
@@ -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)",
@@ -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 */
+1 −1
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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
+18 −9
Original line number Diff line number Diff line
@@ -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;
@@ -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 {
Loading