Commit 32bb2c03 authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho
Browse files

wlcore/wl12xx/wl18xx: handle spare blocks spacial cases per arch



Add a HW op for getting spare blocks.

12xx cards require 2 spare blocks for GEM encrypted SKBs, regardless
of VIFs or keys programmed into the FW.

18xx cards require 2 spare blocks when there are any connected TKIP or
GEM VIFs. For now always return 2 spare blocks, as this works with all
networks. The special case TKIP/GEM functionality is added at a later
patch.

Signed-off-by: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 2c0133a4
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1361,6 +1361,14 @@ out:
	return ret;
}

static int wl12xx_get_spare_blocks(struct wl1271 *wl, bool is_gem)
{
	if (is_gem)
		return WL12XX_TX_HW_BLOCK_GEM_SPARE;

	return WL12XX_TX_HW_BLOCK_SPARE_DEFAULT;
}

static struct wlcore_ops wl12xx_ops = {
	.identify_chip		= wl12xx_identify_chip,
	.identify_fw		= wl12xx_identify_fw,
@@ -1384,6 +1392,7 @@ static struct wlcore_ops wl12xx_ops = {
	.set_rx_csum		= NULL,
	.ap_get_mimo_wide_rate_mask = NULL,
	.debugfs_init		= wl12xx_debugfs_add_files,
	.get_spare_blocks	= wl12xx_get_spare_blocks,
};

static struct ieee80211_sta_ht_cap wl12xx_ht_cap = {
@@ -1419,8 +1428,6 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
	wl->rtable = wl12xx_rtable;
	wl->num_tx_desc = 16;
	wl->num_rx_desc = 8;
	wl->normal_tx_spare = WL12XX_TX_HW_BLOCK_SPARE_DEFAULT;
	wl->gem_tx_spare = WL12XX_TX_HW_BLOCK_GEM_SPARE;
	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;
+8 −3
Original line number Diff line number Diff line
@@ -874,7 +874,7 @@ static int wl18xx_hw_init(struct wl1271 *wl)

	ret = wl18xx_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap,
					    sdio_align_size,
					    WL18XX_TX_HW_BLOCK_SPARE,
					    WL18XX_TX_HW_EXTRA_BLOCK_SPARE,
					    WL18XX_HOST_IF_LEN_SIZE_FIELD);
	if (ret < 0)
		return ret;
@@ -1034,6 +1034,12 @@ static int wl18xx_handle_static_data(struct wl1271 *wl,
	return 0;
}

static int wl18xx_get_spare_blocks(struct wl1271 *wl, bool is_gem)
{
	/* TODO: dynamically change to extra only when we have GEM or TKIP */
	return WL18XX_TX_HW_EXTRA_BLOCK_SPARE;
}

static struct wlcore_ops wl18xx_ops = {
	.identify_chip	= wl18xx_identify_chip,
	.boot		= wl18xx_boot,
@@ -1056,6 +1062,7 @@ static struct wlcore_ops wl18xx_ops = {
	.get_mac	= wl18xx_get_mac,
	.debugfs_init	= wl18xx_debugfs_add_files,
	.handle_static_data	= wl18xx_handle_static_data,
	.get_spare_blocks = wl18xx_get_spare_blocks,
};

/* HT cap appropriate for wide channels */
@@ -1129,8 +1136,6 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)
	wl->rtable = wl18xx_rtable;
	wl->num_tx_desc = 32;
	wl->num_rx_desc = 16;
	wl->normal_tx_spare = WL18XX_TX_HW_BLOCK_SPARE;
	wl->gem_tx_spare = WL18XX_TX_HW_GEM_BLOCK_SPARE;
	wl->band_rate_to_idx = wl18xx_band_rate_to_idx;
	wl->hw_tx_rate_tbl_size = WL18XX_CONF_HW_RXTX_RATE_MAX;
	wl->hw_min_ht_rate = WL18XX_CONF_HW_RXTX_RATE_MCS0;
+2 −1
Original line number Diff line number Diff line
@@ -25,7 +25,8 @@
#include "../wlcore/wlcore.h"

#define WL18XX_TX_HW_BLOCK_SPARE        1
#define WL18XX_TX_HW_GEM_BLOCK_SPARE    2
/* for special cases - namely, TKIP and GEM */
#define WL18XX_TX_HW_EXTRA_BLOCK_SPARE  2
#define WL18XX_TX_HW_BLOCK_SIZE         268

#define WL18XX_TX_STATUS_DESC_ID_MASK    0x7F
+0 −1
Original line number Diff line number Diff line
@@ -507,7 +507,6 @@ static ssize_t vifs_state_read(struct file *file, char __user *user_buf,
		VIF_STATE_PRINT_INT(last_rssi_event);
		VIF_STATE_PRINT_INT(ba_support);
		VIF_STATE_PRINT_INT(ba_allowed);
		VIF_STATE_PRINT_INT(is_gem);
		VIF_STATE_PRINT_LLHEX(tx_security_seq);
		VIF_STATE_PRINT_INT(tx_security_last_seq_lsb);
	}
+9 −0
Original line number Diff line number Diff line
@@ -167,4 +167,13 @@ wlcore_handle_static_data(struct wl1271 *wl, void *static_data)
	return 0;
}

static inline int
wlcore_hw_get_spare_blocks(struct wl1271 *wl, bool is_gem)
{
	if (!wl->ops->get_spare_blocks)
		BUG_ON(1);

	return wl->ops->get_spare_blocks(wl, is_gem);
}

#endif
Loading