dev = container_of(napi->dev, struct mt76_dev, napi_dev);
qid = napi - dev->napi;
+ rcu_read_lock();
+
do {
cur = mt76_dma_rx_process(dev, &dev->q_rx[qid], budget - done);
mt76_rx_complete(dev, qid);
done += cur;
} while (cur && done < budget);
+ rcu_read_unlock();
+
if (done < budget) {
napi_complete(napi);
dev->drv->rx_poll_complete(dev, qid);
}
EXPORT_SYMBOL_GPL(mt76_get_survey);
-static void
+static struct ieee80211_sta *
mt76_rx_convert(struct sk_buff *skb)
{
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
BUILD_BUG_ON(sizeof(mstat) > sizeof(skb->cb));
BUILD_BUG_ON(sizeof(status->chain_signal) != sizeof(mstat.chain_signal));
memcpy(status->chain_signal, mstat.chain_signal, sizeof(mstat.chain_signal));
+
+ return wcid_to_sta(mstat.wcid);
}
void mt76_rx_complete(struct mt76_dev *dev, enum mt76_rxq_id q)
{
+ struct ieee80211_sta *sta;
struct sk_buff *skb;
while ((skb = __skb_dequeue(&dev->rx_skb[q])) != NULL) {
- mt76_rx_convert(skb);
- ieee80211_rx_napi(dev->hw, NULL, skb, &dev->napi[q]);
+ sta = mt76_rx_convert(skb);
+ ieee80211_rx_napi(dev->hw, sta, skb, &dev->napi[q]);
}
}
u8 idx;
u8 hw_key_idx;
+ u8 sta:1;
+
__le16 tx_rate;
bool tx_rate_set;
u8 tx_rate_nss;
};
struct mt76_rx_status {
+ struct mt76_wcid *wcid;
u32 flag;
u16 freq;
u8 enc_flags;
return container_of(ptr, struct ieee80211_txq, drv_priv);
}
+static inline struct ieee80211_sta *
+wcid_to_sta(struct mt76_wcid *wcid)
+{
+ void *ptr = wcid;
+
+ if (!wcid || !wcid->sta)
+ return NULL;
+
+ return container_of(ptr, struct ieee80211_sta, drv_priv);
+}
+
int mt76_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
struct sk_buff *skb, struct mt76_wcid *wcid,
struct ieee80211_sta *sta);
skb_pull(skb, 2);
}
+static struct mt76_wcid *
+mt76x2_rx_get_wcid(struct mt76x2_dev *dev, u8 idx)
+{
+ if (idx >= ARRAY_SIZE(dev->wcid))
+ return NULL;
+
+ return rcu_dereference(dev->wcid[idx]);
+}
+
int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb,
void *rxi)
{
struct mt76x2_rxwi *rxwi = rxi;
u32 ctl = le32_to_cpu(rxwi->ctl);
u16 rate = le16_to_cpu(rxwi->rate);
+ u8 wcid;
int len;
+ wcid = FIELD_GET(MT_RXWI_CTL_WCID, ctl);
+ status->wcid = mt76x2_rx_get_wcid(dev, wcid);
+
if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_L2PAD))
mt76x2_remove_hdr_pad(skb);
goto out;
}
+ msta->wcid.sta = 1;
msta->wcid.idx = idx;
msta->wcid.hw_key_idx = -1;
mt76x2_mac_wcid_setup(dev, idx, mvif->idx, sta->addr);