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

Commit e566d871 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wil6210: support 8KB RX buffers"

parents 8e3cba5f f2fac4fb
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -1654,12 +1654,6 @@ static int wil_cfg80211_set_power_mgmt(struct wiphy *wiphy,
{
	struct wil6210_priv *wil = wiphy_to_wil(wiphy);
	enum wmi_ps_profile_type ps_profile;
	int rc;

	if (!test_bit(WMI_FW_CAPABILITY_PS_CONFIG, wil->fw_capabilities)) {
		wil_err(wil, "set_power_mgmt not supported\n");
		return -EOPNOTSUPP;
	}

	wil_dbg_misc(wil, "enabled=%d, timeout=%d\n",
		     enabled, timeout);
@@ -1669,11 +1663,7 @@ static int wil_cfg80211_set_power_mgmt(struct wiphy *wiphy,
	else
		ps_profile = WMI_PS_PROFILE_TYPE_PS_DISABLED;

	rc  = wmi_ps_dev_profile_cfg(wil, ps_profile);
	if (rc)
		wil_err(wil, "wmi_ps_dev_profile_cfg failed (%d)\n", rc);

	return rc;
	return wil_ps_update(wil, ps_profile);
}

static struct cfg80211_ops wil_cfg80211_ops = {
+28 −4
Original line number Diff line number Diff line
@@ -576,6 +576,9 @@ int wil_priv_init(struct wil6210_priv *wil)

	if (rx_ring_overflow_thrsh == WIL6210_RX_HIGH_TRSH_INIT)
		rx_ring_overflow_thrsh = WIL6210_RX_HIGH_TRSH_DEFAULT;

	wil->ps_profile =  WMI_PS_PROFILE_TYPE_DEFAULT;

	return 0;

out_wmi_wq:
@@ -901,6 +904,24 @@ void wil_abort_scan(struct wil6210_priv *wil, bool sync)
	}
}

int wil_ps_update(struct wil6210_priv *wil, enum wmi_ps_profile_type ps_profile)
{
	int rc;

	if (!test_bit(WMI_FW_CAPABILITY_PS_CONFIG, wil->fw_capabilities)) {
		wil_err(wil, "set_power_mgmt not supported\n");
		return -EOPNOTSUPP;
	}

	rc  = wmi_ps_dev_profile_cfg(wil, ps_profile);
	if (rc)
		wil_err(wil, "wmi_ps_dev_profile_cfg failed (%d)\n", rc);
	else
		wil->ps_profile = ps_profile;

	return rc;
}

/*
 * We reset all the structures, and we reset the UMAC.
 * After calling this routine, you're expected to reload
@@ -950,15 +971,15 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
	/* Disable device led before reset*/
	wmi_led_cfg(wil, false);

	mutex_lock(&wil->p2p_wdev_mutex);
	wil_abort_scan(wil, false);
	mutex_unlock(&wil->p2p_wdev_mutex);

	/* prevent NAPI from being scheduled and prevent wmi commands */
	mutex_lock(&wil->wmi_mutex);
	bitmap_zero(wil->status, wil_status_last);
	mutex_unlock(&wil->wmi_mutex);

	mutex_lock(&wil->p2p_wdev_mutex);
	wil_abort_scan(wil, false);
	mutex_unlock(&wil->p2p_wdev_mutex);

	wil_mask_irq(wil);

	wmi_event_flush(wil);
@@ -1035,6 +1056,9 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
			return rc;
		}

		if (wil->ps_profile != WMI_PS_PROFILE_TYPE_DEFAULT)
			wil_ps_update(wil, wil->ps_profile);

		if (wil->tt_data_set)
			wmi_set_tt_cfg(wil, &wil->tt_data);

+10 −2
Original line number Diff line number Diff line
@@ -343,8 +343,16 @@ __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock)
		wil_err(wil, "BACK requested unsupported ba_policy == 1\n");
		status = WLAN_STATUS_INVALID_QOS_PARAM;
	}
	if (status == WLAN_STATUS_SUCCESS)
		agg_wsize = wil_agg_size(wil, req_agg_wsize);
	if (status == WLAN_STATUS_SUCCESS) {
		if (req_agg_wsize == 0) {
			wil_dbg_misc(wil, "Suggest BACK wsize %d\n",
				     WIL_MAX_AGG_WSIZE);
			agg_wsize = WIL_MAX_AGG_WSIZE;
		} else {
			agg_wsize = min_t(u16,
					  WIL_MAX_AGG_WSIZE, req_agg_wsize);
		}
	}

	rc = wmi_addba_rx_resp(wil, cid, tid, dialog_token, status,
			       agg_amsdu, agg_wsize, agg_timeout);
+22 −2
Original line number Diff line number Diff line
@@ -37,6 +37,10 @@ bool rx_align_2;
module_param(rx_align_2, bool, 0444);
MODULE_PARM_DESC(rx_align_2, " align Rx buffers on 4*n+2, default - no");

bool rx_large_buf;
module_param(rx_large_buf, bool, 0444);
MODULE_PARM_DESC(rx_large_buf, " allocate 8KB RX buffers, default - no");

static inline uint wil_rx_snaplen(void)
{
	return rx_align_2 ? 6 : 0;
@@ -255,7 +259,7 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring,
			       u32 i, int headroom)
{
	struct device *dev = wil_to_dev(wil);
	unsigned int sz = mtu_max + ETH_HLEN + wil_rx_snaplen();
	unsigned int sz = wil->rx_buf_len + ETH_HLEN + wil_rx_snaplen();
	struct vring_rx_desc dd, *d = ⅆ
	volatile struct vring_rx_desc *_d = &vring->va[i].rx;
	dma_addr_t pa;
@@ -419,7 +423,7 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
	struct sk_buff *skb;
	dma_addr_t pa;
	unsigned int snaplen = wil_rx_snaplen();
	unsigned int sz = mtu_max + ETH_HLEN + snaplen;
	unsigned int sz = wil->rx_buf_len + ETH_HLEN + snaplen;
	u16 dmalen;
	u8 ftype;
	int cid;
@@ -780,6 +784,20 @@ void wil_rx_handle(struct wil6210_priv *wil, int *quota)
	wil_rx_refill(wil, v->size);
}

static void wil_rx_buf_len_init(struct wil6210_priv *wil)
{
	wil->rx_buf_len = rx_large_buf ?
		WIL_MAX_ETH_MTU : TXRX_BUF_LEN_DEFAULT - WIL_MAX_MPDU_OVERHEAD;
	if (mtu_max > wil->rx_buf_len) {
		/* do not allow RX buffers to be smaller than mtu_max, for
		 * backward compatibility (mtu_max parameter was also used
		 * to support receiving large packets)
		 */
		wil_info(wil, "Override RX buffer to mtu_max(%d)\n", mtu_max);
		wil->rx_buf_len = mtu_max;
	}
}

int wil_rx_init(struct wil6210_priv *wil, u16 size)
{
	struct vring *vring = &wil->vring_rx;
@@ -792,6 +810,8 @@ int wil_rx_init(struct wil6210_priv *wil, u16 size)
		return -EINVAL;
	}

	wil_rx_buf_len_init(wil);

	vring->size = size;
	rc = wil_vring_alloc(wil, vring);
	if (rc)
+6 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ extern unsigned short rx_ring_overflow_thrsh;
extern int agg_wsize;
extern u32 vring_idle_trsh;
extern bool rx_align_2;
extern bool rx_large_buf;
extern bool debug_fw;
extern bool disable_ap_sme;

@@ -670,6 +671,7 @@ struct wil6210_priv {
	struct work_struct probe_client_worker;
	/* DMA related */
	struct vring vring_rx;
	unsigned int rx_buf_len;
	struct vring vring_tx[WIL6210_MAX_TX_RINGS];
	struct vring_tx_data vring_tx_data[WIL6210_MAX_TX_RINGS];
	u8 vring2cid_tid[WIL6210_MAX_TX_RINGS][2]; /* [0] - CID, [1] - TID */
@@ -705,6 +707,8 @@ struct wil6210_priv {
	/* High Access Latency Policy voting */
	struct wil_halp halp;

	enum wmi_ps_profile_type ps_profile;

	struct wil_ftm_priv ftm;
	bool tt_data_set;
	struct wmi_tt_data tt_data;
@@ -824,6 +828,8 @@ int wil_if_add(struct wil6210_priv *wil);
void wil_if_remove(struct wil6210_priv *wil);
int wil_priv_init(struct wil6210_priv *wil);
void wil_priv_deinit(struct wil6210_priv *wil);
int wil_ps_update(struct wil6210_priv *wil,
		  enum wmi_ps_profile_type ps_profile);
int wil_reset(struct wil6210_priv *wil, bool no_fw);
void wil_fw_error_recovery(struct wil6210_priv *wil);
void wil_set_recovery_state(struct wil6210_priv *wil, int state);
Loading