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

Commit 3edab305 authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho
Browse files

wlcore/wl12xx: change GEM Tx-spare blocks per-vif



The number of spare Tx blocks must be changed when the GEM cipher is
engaged. Track set_key() operations to see if this is the case and
change the Tx HW spare block count accordingly. Set the number of spare
blocks for each operating mode from the low level driver.

Signed-off-by: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 72b0624f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -34,6 +34,10 @@

#include "reg.h"

#define WL12XX_TX_HW_BLOCK_SPARE_DEFAULT        1
#define WL12XX_TX_HW_BLOCK_GEM_SPARE            2


static struct wlcore_partition_set wl12xx_ptable[PART_TABLE_LEN] = {
	[PART_DOWN] = {
		.mem = {
@@ -675,6 +679,8 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
	wl->ptable = wl12xx_ptable;
	wl->rtable = wl12xx_rtable;
	wl->num_tx_desc = 16;
	wl->normal_tx_spare = WL12XX_TX_HW_BLOCK_SPARE_DEFAULT;
	wl->gem_tx_spare = WL12XX_TX_HW_BLOCK_GEM_SPARE;

	return wlcore_probe(wl, pdev);
}
+1 −0
Original line number Diff line number Diff line
@@ -653,6 +653,7 @@ 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);
	}
+11 −13
Original line number Diff line number Diff line
@@ -1858,7 +1858,6 @@ static void wl1271_op_stop(struct ieee80211_hw *hw)
	wl->tx_results_count = 0;
	wl->tx_packets_count = 0;
	wl->time_offset = 0;
	wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
	wl->ap_fw_ps_map = 0;
	wl->ap_ps_map = 0;
	wl->sched_scanning = false;
@@ -2912,6 +2911,17 @@ static int wl1271_set_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
	int ret;
	bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS);

	/*
	 * A role set to GEM cipher requires different Tx settings (namely
	 * spare blocks). Note when we are in this mode so the HW can adjust.
	 */
	if (key_type == KEY_GEM) {
		if (action == KEY_ADD_OR_REPLACE)
			wlvif->is_gem = true;
		else if (action == KEY_REMOVE)
			wlvif->is_gem = false;
	}

	if (is_ap) {
		struct wl1271_station *wl_sta;
		u8 hlid;
@@ -2950,17 +2960,6 @@ static int wl1271_set_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
			0xff, 0xff, 0xff, 0xff, 0xff, 0xff
		};

		/*
		 * A STA set to GEM cipher requires 2 tx spare blocks.
		 * Return to default value when GEM cipher key is removed
		 */
		if (key_type == KEY_GEM) {
			if (action == KEY_ADD_OR_REPLACE)
				wl->tx_spare_blocks = 2;
			else if (action == KEY_REMOVE)
				wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
		}

		addr = sta ? sta->addr : bcast_addr;

		if (is_zero_ether_addr(addr)) {
@@ -5259,7 +5258,6 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size)
	wl->quirks = 0;
	wl->platform_quirks = 0;
	wl->sched_scanning = false;
	wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
	wl->system_hlid = WL12XX_SYSTEM_HLID;
	wl->active_sta_count = 0;
	wl->fwlog_size = 0;
+4 −5
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct wl12xx_vif *wlvif,
	u32 len;
	u32 total_blocks;
	int id, ret = -EBUSY, ac;
	u32 spare_blocks = wl->tx_spare_blocks;
	u32 spare_blocks = wl->normal_tx_spare;
	bool is_dummy = false;

	if (buf_offset + total_len > WL1271_AGGR_BUFFER_SIZE)
@@ -205,11 +205,10 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct wl12xx_vif *wlvif,
	   in the firmware */
	len = wl12xx_calc_packet_alignment(wl, total_len);

	/* in case of a dummy packet, use default amount of spare mem blocks */
	if (unlikely(wl12xx_is_dummy_packet(wl, skb))) {
	if (unlikely(wl12xx_is_dummy_packet(wl, skb)))
		is_dummy = true;
		spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
	}
	else if (wlvif->is_gem)
		spare_blocks = wl->gem_tx_spare;

	total_blocks = (len + TX_HW_BLOCK_SIZE - 1) / TX_HW_BLOCK_SIZE +
		spare_blocks;
+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@
#ifndef __TX_H__
#define __TX_H__

#define TX_HW_BLOCK_SPARE_DEFAULT        1
#define TX_HW_BLOCK_SIZE                 252

#define TX_HW_MGMT_PKT_LIFETIME_TU       2000
Loading