mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: add PPDU based TxS support for WED device
Given that there's no data coming from network stack for binding flows, hence driver counts and reports station's statistics directly through NL80211_STA_INFO_* based on active PPDU based TxS for offloading data. Apart from that, WA firmware and its offloading engine (SDO) have hardcoded "2" as PID, so we introduce MT_PACKET_ID_WED to differentiate WED reporting. Note that PPDU format TxS is mutually exclusive with MT_TXD5_TX_STATUS_HOST. Co-developed-by: Yi-Chia Hsieh <[email protected]> Signed-off-by: Yi-Chia Hsieh <[email protected]> Signed-off-by: Ryder Lee <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
+48
-26
@@ -490,6 +490,10 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
|
||||
p_fmt = mt76_is_mmio(dev) ? MT_TX_TYPE_CT : MT_TX_TYPE_SF;
|
||||
q_idx = wmm_idx * MT76_CONNAC_MAX_WMM_SETS +
|
||||
mt76_connac_lmac_mapping(skb_get_queue_mapping(skb));
|
||||
|
||||
/* counting non-offloading skbs */
|
||||
wcid->stats.tx_bytes += skb->len;
|
||||
wcid->stats.tx_packets++;
|
||||
}
|
||||
|
||||
val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len + sz_txd) |
|
||||
@@ -550,35 +554,29 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_connac2_mac_write_txwi);
|
||||
|
||||
bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
|
||||
int pid, __le32 *txs_data)
|
||||
bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
|
||||
__le32 *txs_data)
|
||||
{
|
||||
struct mt76_sta_stats *stats = &wcid->stats;
|
||||
struct ieee80211_supported_band *sband;
|
||||
struct mt76_phy *mphy;
|
||||
struct ieee80211_tx_info *info;
|
||||
struct sk_buff_head list;
|
||||
struct rate_info rate = {};
|
||||
struct sk_buff *skb;
|
||||
bool cck = false;
|
||||
u32 txrate, txs, mode;
|
||||
|
||||
mt76_tx_status_lock(dev, &list);
|
||||
skb = mt76_tx_status_skb_get(dev, wcid, pid, &list);
|
||||
if (!skb)
|
||||
goto out;
|
||||
|
||||
txs = le32_to_cpu(txs_data[0]);
|
||||
|
||||
info = IEEE80211_SKB_CB(skb);
|
||||
if (!(txs & MT_TXS0_ACK_ERROR_MASK))
|
||||
info->flags |= IEEE80211_TX_STAT_ACK;
|
||||
|
||||
info->status.ampdu_len = 1;
|
||||
info->status.ampdu_ack_len = !!(info->flags &
|
||||
IEEE80211_TX_STAT_ACK);
|
||||
|
||||
info->status.rates[0].idx = -1;
|
||||
/* PPDU based reporting */
|
||||
if (FIELD_GET(MT_TXS0_TXS_FORMAT, txs) > 1) {
|
||||
stats->tx_bytes +=
|
||||
le32_get_bits(txs_data[5], MT_TXS5_MPDU_TX_BYTE);
|
||||
stats->tx_packets +=
|
||||
le32_get_bits(txs_data[5], MT_TXS5_MPDU_TX_CNT);
|
||||
stats->tx_failed +=
|
||||
le32_get_bits(txs_data[6], MT_TXS6_MPDU_FAIL_CNT);
|
||||
stats->tx_retries +=
|
||||
le32_get_bits(txs_data[7], MT_TXS7_MPDU_RETRY_CNT);
|
||||
}
|
||||
|
||||
txrate = FIELD_GET(MT_TXS0_TX_RATE, txs);
|
||||
|
||||
@@ -613,7 +611,7 @@ bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
|
||||
case MT_PHY_TYPE_HT:
|
||||
case MT_PHY_TYPE_HT_GF:
|
||||
if (rate.mcs > 31)
|
||||
goto out;
|
||||
return false;
|
||||
|
||||
rate.flags = RATE_INFO_FLAGS_MCS;
|
||||
if (wcid->rate.flags & RATE_INFO_FLAGS_SHORT_GI)
|
||||
@@ -621,7 +619,7 @@ bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
|
||||
break;
|
||||
case MT_PHY_TYPE_VHT:
|
||||
if (rate.mcs > 9)
|
||||
goto out;
|
||||
return false;
|
||||
|
||||
rate.flags = RATE_INFO_FLAGS_VHT_MCS;
|
||||
break;
|
||||
@@ -630,14 +628,14 @@ bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
|
||||
case MT_PHY_TYPE_HE_TB:
|
||||
case MT_PHY_TYPE_HE_MU:
|
||||
if (rate.mcs > 11)
|
||||
goto out;
|
||||
return false;
|
||||
|
||||
rate.he_gi = wcid->rate.he_gi;
|
||||
rate.he_dcm = FIELD_GET(MT_TX_RATE_DCM, txrate);
|
||||
rate.flags = RATE_INFO_FLAGS_HE_MCS;
|
||||
break;
|
||||
default:
|
||||
goto out;
|
||||
return false;
|
||||
}
|
||||
|
||||
stats->tx_mode[mode]++;
|
||||
@@ -662,10 +660,34 @@ bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
|
||||
}
|
||||
wcid->rate = rate;
|
||||
|
||||
out:
|
||||
if (skb)
|
||||
mt76_tx_status_skb_done(dev, skb, &list);
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_connac2_mac_fill_txs);
|
||||
|
||||
bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
|
||||
int pid, __le32 *txs_data)
|
||||
{
|
||||
struct sk_buff_head list;
|
||||
struct sk_buff *skb;
|
||||
|
||||
mt76_tx_status_lock(dev, &list);
|
||||
skb = mt76_tx_status_skb_get(dev, wcid, pid, &list);
|
||||
if (skb) {
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
bool noacked = !(info->flags & IEEE80211_TX_STAT_ACK);
|
||||
|
||||
if (!(le32_to_cpu(txs_data[0]) & MT_TXS0_ACK_ERROR_MASK))
|
||||
info->flags |= IEEE80211_TX_STAT_ACK;
|
||||
|
||||
info->status.ampdu_len = 1;
|
||||
info->status.ampdu_ack_len = !noacked;
|
||||
info->status.rates[0].idx = -1;
|
||||
|
||||
wcid->stats.tx_failed += noacked;
|
||||
|
||||
mt76_connac2_mac_fill_txs(dev, wcid, txs_data);
|
||||
mt76_tx_status_skb_done(dev, skb, &list);
|
||||
}
|
||||
mt76_tx_status_unlock(dev, &list);
|
||||
|
||||
return !!skb;
|
||||
|
||||
Reference in New Issue
Block a user