|
@@ -269,21 +269,31 @@ static void mt76x2_remove_hdr_pad(struct sk_buff *skb, int len)
|
|
|
skb_pull(skb, len);
|
|
|
}
|
|
|
|
|
|
-static struct mt76_wcid *
|
|
|
-mt76x2_rx_get_sta_wcid(struct mt76x2_dev *dev, u8 idx, bool unicast)
|
|
|
+static struct mt76x2_sta *
|
|
|
+mt76x2_rx_get_sta(struct mt76x2_dev *dev, u8 idx)
|
|
|
{
|
|
|
- struct mt76x2_sta *sta;
|
|
|
struct mt76_wcid *wcid;
|
|
|
|
|
|
if (idx >= ARRAY_SIZE(dev->wcid))
|
|
|
return NULL;
|
|
|
|
|
|
wcid = rcu_dereference(dev->wcid[idx]);
|
|
|
- if (unicast || !wcid)
|
|
|
- return wcid;
|
|
|
+ if (!wcid)
|
|
|
+ return NULL;
|
|
|
|
|
|
- sta = container_of(wcid, struct mt76x2_sta, wcid);
|
|
|
- return &sta->vif->group_wcid;
|
|
|
+ return container_of(wcid, struct mt76x2_sta, wcid);
|
|
|
+}
|
|
|
+
|
|
|
+static struct mt76_wcid *
|
|
|
+mt76x2_rx_get_sta_wcid(struct mt76x2_dev *dev, struct mt76x2_sta *sta, bool unicast)
|
|
|
+{
|
|
|
+ if (!sta)
|
|
|
+ return NULL;
|
|
|
+
|
|
|
+ if (unicast)
|
|
|
+ return &sta->wcid;
|
|
|
+ else
|
|
|
+ return &sta->vif->group_wcid;
|
|
|
}
|
|
|
|
|
|
int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb,
|
|
@@ -291,6 +301,7 @@ int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb,
|
|
|
{
|
|
|
struct mt76_rx_status *status = (struct mt76_rx_status *) skb->cb;
|
|
|
struct mt76x2_rxwi *rxwi = rxi;
|
|
|
+ struct mt76x2_sta *sta;
|
|
|
u32 rxinfo = le32_to_cpu(rxwi->rxinfo);
|
|
|
u32 ctl = le32_to_cpu(rxwi->ctl);
|
|
|
u16 rate = le16_to_cpu(rxwi->rate);
|
|
@@ -315,7 +326,8 @@ int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb,
|
|
|
}
|
|
|
|
|
|
wcid = FIELD_GET(MT_RXWI_CTL_WCID, ctl);
|
|
|
- status->wcid = mt76x2_rx_get_sta_wcid(dev, wcid, unicast);
|
|
|
+ sta = mt76x2_rx_get_sta(dev, wcid);
|
|
|
+ status->wcid = mt76x2_rx_get_sta_wcid(dev, sta, unicast);
|
|
|
|
|
|
len = FIELD_GET(MT_RXWI_CTL_MPDU_LEN, ctl);
|
|
|
pn_len = FIELD_GET(MT_RXINFO_PN_LEN, rxinfo);
|
|
@@ -361,6 +373,11 @@ int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb,
|
|
|
status->tid = FIELD_GET(MT_RXWI_TID, tid_sn);
|
|
|
status->seqno = FIELD_GET(MT_RXWI_SN, tid_sn);
|
|
|
|
|
|
+ if (sta) {
|
|
|
+ ewma_signal_add(&sta->rssi, status->signal);
|
|
|
+ sta->inactive_count = 0;
|
|
|
+ }
|
|
|
+
|
|
|
return mt76x2_mac_process_rate(status, rate);
|
|
|
}
|
|
|
|