Commit 013b2dff authored by Felix Fietkau's avatar Felix Fietkau
Browse files

mt76: fix tx status reporting for non-probing frames



On MT76x2, the hardware does not report tx status in the FIFO register,
if the packet id is 0.
Change the allocation of packet IDs to use 0 for no-ack packets, 1 for
non-probing packets and 2-255 for packets with tx status requested.
Fixes rate control issues

Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 5c9decdf
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -239,7 +239,9 @@ struct mt76_rx_tid {
#define MT_TX_CB_TXS_FAILED		BIT(2)

#define MT_PACKET_ID_MASK		GENMASK(7, 0)
#define MT_PACKET_ID_NO_ACK		MT_PACKET_ID_MASK
#define MT_PACKET_ID_NO_ACK		0
#define MT_PACKET_ID_NO_SKB		1
#define MT_PACKET_ID_FIRST		2

#define MT_TX_STATUS_SKB_TIMEOUT	HZ

+1 −1
Original line number Diff line number Diff line
@@ -433,7 +433,7 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev,
	}

	if (wcid) {
		if (stat->pktid)
		if (stat->pktid >= MT_PACKET_ID_FIRST)
			status.skb = mt76_tx_status_skb_get(mdev, wcid,
							    stat->pktid, &list);
		if (status.skb)
+1 −1
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ int mt76x02_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
	if (ret < 0)
		return ret;

	if (pid && pid != MT_PACKET_ID_NO_ACK)
	if (pid >= MT_PACKET_ID_FIRST)
		qsel = MT_QSEL_MGMT;

	*tx_info = FIELD_PREP(MT_TXD_INFO_QSEL, qsel) |
+1 −2
Original line number Diff line number Diff line
@@ -87,8 +87,7 @@ int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data,
	pid = mt76_tx_status_skb_add(mdev, wcid, skb);
	txwi->pktid = pid;

	if ((pid && pid != MT_PACKET_ID_NO_ACK) ||
	    q2ep(q->hw_idx) == MT_EP_OUT_HCCA)
	if (pid >= MT_PACKET_ID_FIRST || q2ep(q->hw_idx) == MT_EP_OUT_HCCA)
		qsel = MT_QSEL_MGMT;
	else
		qsel = MT_QSEL_EDCA;
+5 −4
Original line number Diff line number Diff line
@@ -170,21 +170,22 @@ mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid,
	int pid;

	if (!wcid)
		return 0;
		return MT_PACKET_ID_NO_ACK;

	if (info->flags & IEEE80211_TX_CTL_NO_ACK)
		return MT_PACKET_ID_NO_ACK;

	if (!(info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS |
			     IEEE80211_TX_CTL_RATE_CTRL_PROBE)))
		return 0;
		return MT_PACKET_ID_NO_SKB;

	spin_lock_bh(&dev->status_list.lock);

	memset(cb, 0, sizeof(*cb));
	wcid->packet_id = (wcid->packet_id + 1) & MT_PACKET_ID_MASK;
	if (!wcid->packet_id || wcid->packet_id == MT_PACKET_ID_NO_ACK)
		wcid->packet_id = 1;
	if (wcid->packet_id == MT_PACKET_ID_NO_ACK ||
	    wcid->packet_id == MT_PACKET_ID_NO_SKB)
		wcid->packet_id = MT_PACKET_ID_FIRST;

	pid = wcid->packet_id;
	cb->wcid = wcid->idx;