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

Commit 12e8945d authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by Ian Maund
Browse files

wil6210: fix Tx VRING for STA mode



In STA mode, all Tx should be directed to the same VRING towards the AP.
Thus, look up for the 1-st eligible VRING and use it.

Change-Id: Iec97d8b399da9b955293f18acd3c1afdef3e7ea1
Signed-off-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Git-commit: 54ed90a826e088ee3883ae6437d0aa5adf87f972
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git


Signed-off-by: default avatarHamad Kadmany <hkadmany@codeaurora.org>
parent 0564f974
Loading
Loading
Loading
Loading
+41 −5
Original line number Diff line number Diff line
@@ -777,6 +777,38 @@ static void wil_set_da_for_vring(struct wil6210_priv *wil,

static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
			struct sk_buff *skb);

static struct vring *wil_find_tx_vring_sta(struct wil6210_priv *wil,
					   struct sk_buff *skb)
{
	struct vring *v;
	int i;
	u8 cid;

	/* In the STA mode, it is expected to have only 1 VRING
	 * for the AP we connected to.
	 * find 1-st vring and see whether it is eligible for data
	 */
	for (i = 0; i < WIL6210_MAX_TX_RINGS; i++) {
		v = &wil->vring_tx[i];
		if (!v->va)
			continue;

		cid = wil->vring2cid_tid[i][0];
		if (!wil->sta[cid].data_port_open &&
		    (skb->protocol != cpu_to_be16(ETH_P_PAE)))
			break;

		wil_dbg_txrx(wil, "Tx -> ring %d\n", i);

		return v;
	}

	wil_dbg_txrx(wil, "Tx while no vrings active?\n");

	return NULL;
}

/*
 * Find 1-st vring and return it; set dest address for this vring in skb
 * duplicate skb and send it to other active vrings
@@ -1056,15 +1088,19 @@ netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev)
	pr_once_fw = false;

	/* find vring */
	if (wil->wdev->iftype == NL80211_IFTYPE_STATION) {
		/* in STA mode (ESS), all to same VRING */
		vring = wil_find_tx_vring_sta(wil, skb);
	} else { /* direct communication, find matching VRING */
		if (is_unicast_ether_addr(eth->h_dest))
			vring = wil_find_tx_vring(wil, skb);
		else
			vring = wil_tx_bcast(wil, skb);
	}
	if (!vring) {
		wil_dbg_txrx(wil, "No Tx VRING found for %pM\n", eth->h_dest);
		goto drop;
	}

	/* set up vring entry */
	rc = wil_tx_vring(wil, vring, skb);