Skip to content

Commit

Permalink
mt76: fix tx status reporting for non-probing frames
Browse files Browse the repository at this point in the history
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: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Jan 11, 2019
1 parent 7d4a95c commit f84b008
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion mt76.h
Expand Up @@ -245,7 +245,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

Expand Down
2 changes: 1 addition & 1 deletion mt7603/mac.c
Expand Up @@ -1102,7 +1102,7 @@ mt7603_mac_add_txs_skb(struct mt7603_dev *dev, struct mt7603_sta *sta, int pid,
struct sk_buff_head list;
struct sk_buff *skb;

if (!pid)
if (pid < MT_PACKET_ID_FIRST)
return false;

mt76_tx_status_lock(mdev, &list);
Expand Down
2 changes: 1 addition & 1 deletion mt76x02_mac.c
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mt76x02_txrx.c
Expand Up @@ -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) |
Expand Down
3 changes: 1 addition & 2 deletions mt76x02_usb_core.c
Expand Up @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions tx.c
Expand Up @@ -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;
Expand Down

0 comments on commit f84b008

Please sign in to comment.