Commit ddf7afdd authored by Ahmad Masri's avatar Ahmad Masri Committed by Kalle Valo
Browse files

wil6210: fix overwriting max_assoc_sta module param



Save the parameter of max_assoc_sta per device.
On fw_ready event calculate the max_assoc_sta and save it per device,
do not overwrite the max_assoc_sta module param.

Signed-off-by: default avatarAhmad Masri <amasri@codeaurora.org>
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 9a874d04
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ static int wil_find_cid_by_idx(struct wil6210_priv *wil, u8 mid, int idx)
{
	int i;

	for (i = 0; i < max_assoc_sta; i++) {
	for (i = 0; i < wil->max_assoc_sta; i++) {
		if (wil->sta[i].status == wil_sta_unused)
			continue;
		if (wil->sta[i].mid != mid)
@@ -3020,7 +3020,7 @@ static int wil_rf_sector_set_selected(struct wiphy *wiphy,
			wil, vif->mid, WMI_INVALID_RF_SECTOR_INDEX,
			sector_type, WIL_CID_ALL);
		if (rc == -EINVAL) {
			for (i = 0; i < max_assoc_sta; i++) {
			for (i = 0; i < wil->max_assoc_sta; i++) {
				if (wil->sta[i].mid != vif->mid)
					continue;
				rc = wil_rf_sector_wmi_set_selected(
+9 −9
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ static int ring_show(struct seq_file *s, void *data)

			snprintf(name, sizeof(name), "tx_%2d", i);

			if (cid < max_assoc_sta)
			if (cid < wil->max_assoc_sta)
				seq_printf(s,
					   "\n%pM CID %d TID %d 1x%s BACK([%u] %u TU A%s) [%3d|%3d] idle %s\n",
					   wil->sta[cid].addr, cid, tid,
@@ -839,7 +839,7 @@ static ssize_t wil_write_back(struct file *file, const char __user *buf,
				"BACK: del_rx require at least 2 params\n");
			return -EINVAL;
		}
		if (p1 < 0 || p1 >= max_assoc_sta) {
		if (p1 < 0 || p1 >= wil->max_assoc_sta) {
			wil_err(wil, "BACK: invalid CID %d\n", p1);
			return -EINVAL;
		}
@@ -1290,7 +1290,7 @@ static int bf_show(struct seq_file *s, void *data)

	memset(&reply, 0, sizeof(reply));

	for (i = 0; i < max_assoc_sta; i++) {
	for (i = 0; i < wil->max_assoc_sta; i++) {
		u32 status;

		cmd.cid = i;
@@ -1387,7 +1387,7 @@ static int link_show(struct seq_file *s, void *data)
	if (!sinfo)
		return -ENOMEM;

	for (i = 0; i < max_assoc_sta; i++) {
	for (i = 0; i < wil->max_assoc_sta; i++) {
		struct wil_sta_info *p = &wil->sta[i];
		char *status = "unknown";
		struct wil6210_vif *vif;
@@ -1589,7 +1589,7 @@ __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock)
	struct wil6210_priv *wil = s->private;
	int i, tid, mcs;

	for (i = 0; i < max_assoc_sta; i++) {
	for (i = 0; i < wil->max_assoc_sta; i++) {
		struct wil_sta_info *p = &wil->sta[i];
		char *status = "unknown";
		u8 aid = 0;
@@ -1698,7 +1698,7 @@ __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock)
	struct wil6210_priv *wil = s->private;
	int i, bin;

	for (i = 0; i < max_assoc_sta; i++) {
	for (i = 0; i < wil->max_assoc_sta; i++) {
		struct wil_sta_info *p = &wil->sta[i];
		char *status = "unknown";
		u8 aid = 0;
@@ -1787,7 +1787,7 @@ static ssize_t wil_tx_latency_write(struct file *file, const char __user *buf,
		size_t sz = sizeof(u64) * WIL_NUM_LATENCY_BINS;

		wil->tx_latency_res = val;
		for (i = 0; i < max_assoc_sta; i++) {
		for (i = 0; i < wil->max_assoc_sta; i++) {
			struct wil_sta_info *sta = &wil->sta[i];

			kfree(sta->tx_latency_bins);
@@ -1872,7 +1872,7 @@ static void wil_link_stats_debugfs_show_vif(struct wil6210_vif *vif,
	}

	seq_printf(s, "TSF %lld\n", vif->fw_stats_tsf);
	for (i = 0; i < max_assoc_sta; i++) {
	for (i = 0; i < wil->max_assoc_sta; i++) {
		if (wil->sta[i].status == wil_sta_unused)
			continue;
		if (wil->sta[i].mid != vif->mid)
@@ -2488,7 +2488,7 @@ void wil6210_debugfs_remove(struct wil6210_priv *wil)
	wil->debug = NULL;

	kfree(wil->dbg_data.data_arr);
	for (i = 0; i < max_assoc_sta; i++)
	for (i = 0; i < wil->max_assoc_sta; i++)
		kfree(wil->sta[i].tx_latency_bins);

	/* free pmc memory without sending command to fw, as it will
+5 −4
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ static bool wil_vif_is_connected(struct wil6210_priv *wil, u8 mid)
{
	int i;

	for (i = 0; i < max_assoc_sta; i++) {
	for (i = 0; i < wil->max_assoc_sta; i++) {
		if (wil->sta[i].mid == mid &&
		    wil->sta[i].status == wil_sta_connected)
			return true;
@@ -344,7 +344,7 @@ static void _wil6210_disconnect_complete(struct wil6210_vif *vif,
			wil_disconnect_cid_complete(vif, cid, reason_code);
	} else { /* all */
		wil_dbg_misc(wil, "Disconnect complete all\n");
		for (cid = 0; cid < max_assoc_sta; cid++)
		for (cid = 0; cid < wil->max_assoc_sta; cid++)
			wil_disconnect_cid_complete(vif, cid, reason_code);
	}

@@ -456,7 +456,7 @@ static void _wil6210_disconnect(struct wil6210_vif *vif, const u8 *bssid,
			wil_disconnect_cid(vif, cid, reason_code);
	} else { /* all */
		wil_dbg_misc(wil, "Disconnect all\n");
		for (cid = 0; cid < max_assoc_sta; cid++)
		for (cid = 0; cid < wil->max_assoc_sta; cid++)
			wil_disconnect_cid(vif, cid, reason_code);
	}

@@ -753,6 +753,7 @@ int wil_priv_init(struct wil6210_priv *wil)

	wil->reply_mid = U8_MAX;
	wil->max_vifs = 1;
	wil->max_assoc_sta = max_assoc_sta;

	/* edma configuration can be updated via debugfs before allocation */
	wil->num_rx_status_rings = WIL_DEFAULT_NUM_RX_STATUS_RINGS;
@@ -1922,7 +1923,7 @@ int wil_find_cid(struct wil6210_priv *wil, u8 mid, const u8 *mac)
	int i;
	int rc = -ENOENT;

	for (i = 0; i < max_assoc_sta; i++) {
	for (i = 0; i < wil->max_assoc_sta; i++) {
		if (wil->sta[i].mid == mid &&
		    wil->sta[i].status != wil_sta_unused &&
		    ether_addr_equal(wil->sta[i].addr, mac)) {
+1 −1
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock)
	might_sleep();

	/* sanity checks */
	if (cid >= max_assoc_sta) {
	if (cid >= wil->max_assoc_sta) {
		wil_err(wil, "BACK: invalid CID %d\n", cid);
		rc = -EINVAL;
		goto out;
+11 −11
Original line number Diff line number Diff line
@@ -411,7 +411,7 @@ static int wil_rx_get_cid_by_skb(struct wil6210_priv *wil, struct sk_buff *skb)
		ta = hdr->addr2;
	}

	if (max_assoc_sta <= WIL6210_RX_DESC_MAX_CID)
	if (wil->max_assoc_sta <= WIL6210_RX_DESC_MAX_CID)
		return cid;

	/* assuming no concurrency between AP interfaces and STA interfaces.
@@ -426,14 +426,14 @@ static int wil_rx_get_cid_by_skb(struct wil6210_priv *wil, struct sk_buff *skb)
	 * to find the real cid, compare transmitter address with the stored
	 * stations mac address in the driver sta array
	 */
	for (i = cid; i < max_assoc_sta; i += WIL6210_RX_DESC_MAX_CID) {
	for (i = cid; i < wil->max_assoc_sta; i += WIL6210_RX_DESC_MAX_CID) {
		if (wil->sta[i].status != wil_sta_unused &&
		    ether_addr_equal(wil->sta[i].addr, ta)) {
			cid = i;
			break;
		}
	}
	if (i >= max_assoc_sta) {
	if (i >= wil->max_assoc_sta) {
		wil_err_ratelimited(wil, "Could not find cid for frame with transmit addr = %pM, iftype = %d, frametype = %d, len = %d\n",
				    ta, vif->wdev.iftype, ftype, skb->len);
		cid = -ENOENT;
@@ -1064,7 +1064,7 @@ static int wil_vring_init_tx(struct wil6210_vif *vif, int id, int size,
	txdata->enabled = 0;
	spin_unlock_bh(&txdata->lock);
	wil_vring_free(wil, vring);
	wil->ring2cid_tid[id][0] = max_assoc_sta;
	wil->ring2cid_tid[id][0] = wil->max_assoc_sta;
	wil->ring2cid_tid[id][1] = 0;

 out:
@@ -1149,7 +1149,7 @@ fail:
	txdata->dot1x_open = false;
	txdata->enabled = 0;
	spin_unlock_bh(&txdata->lock);
	wil->ring2cid_tid[ring_id][0] = max_assoc_sta;
	wil->ring2cid_tid[ring_id][0] = wil->max_assoc_sta;
	wil->ring2cid_tid[ring_id][1] = 0;
	return rc;
}
@@ -1196,7 +1196,7 @@ int wil_vring_init_bcast(struct wil6210_vif *vif, int id, int size)
	if (rc)
		goto out;

	wil->ring2cid_tid[id][0] = max_assoc_sta; /* CID */
	wil->ring2cid_tid[id][0] = wil->max_assoc_sta; /* CID */
	wil->ring2cid_tid[id][1] = 0; /* TID */

	cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa);
@@ -1244,7 +1244,7 @@ static struct wil_ring *wil_find_tx_ucast(struct wil6210_priv *wil,

	cid = wil_find_cid(wil, vif->mid, da);

	if (cid < 0 || cid >= max_assoc_sta)
	if (cid < 0 || cid >= wil->max_assoc_sta)
		return NULL;

	/* TODO: fix for multiple TID */
@@ -1296,7 +1296,7 @@ static struct wil_ring *wil_find_tx_ring_sta(struct wil6210_priv *wil,
			continue;

		cid = wil->ring2cid_tid[i][0];
		if (cid >= max_assoc_sta) /* skip BCAST */
		if (cid >= wil->max_assoc_sta) /* skip BCAST */
			continue;

		if (!wil->ring_tx_data[i].dot1x_open &&
@@ -1374,7 +1374,7 @@ static struct wil_ring *wil_find_tx_bcast_2(struct wil6210_priv *wil,
			continue;

		cid = wil->ring2cid_tid[i][0];
		if (cid >= max_assoc_sta) /* skip BCAST */
		if (cid >= wil->max_assoc_sta) /* skip BCAST */
			continue;
		if (!wil->ring_tx_data[i].dot1x_open &&
		    skb->protocol != cpu_to_be16(ETH_P_PAE))
@@ -1402,7 +1402,7 @@ found:
		if (!v2->va || txdata2->mid != vif->mid)
			continue;
		cid = wil->ring2cid_tid[i][0];
		if (cid >= max_assoc_sta) /* skip BCAST */
		if (cid >= wil->max_assoc_sta) /* skip BCAST */
			continue;
		if (!wil->ring_tx_data[i].dot1x_open &&
		    skb->protocol != cpu_to_be16(ETH_P_PAE))
@@ -2258,7 +2258,7 @@ int wil_tx_complete(struct wil6210_vif *vif, int ringid)

	used_before_complete = wil_ring_used_tx(vring);

	if (cid < max_assoc_sta)
	if (cid < wil->max_assoc_sta)
		stats = &wil->sta[cid].stats;

	while (!wil_ring_is_empty(vring)) {
Loading