mt7603: fill in rx frequency information

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2015-12-16 10:53:58 +01:00
parent 73feccc170
commit 732b74a65c
2 changed files with 14 additions and 3 deletions
+4 -2
View File
@@ -76,7 +76,7 @@ u32 mt7603_reg_map(struct mt7603_dev *dev, u32 addr)
int mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
{
int ret;
int idx, ret;
u8 bw = MT_BW_20;
@@ -88,7 +88,9 @@ int mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
if (ret)
return ret;
mt76_set(dev, MT_WF_RMAC_CH_FREQ, 1);
idx = def->chan->band == IEEE80211_BAND_5GHZ;
idx |= (def->chan - mt76_hw(dev)->wiphy->bands[def->chan->band]->channels) << 1;
mt76_set(dev, MT_WF_RMAC_CH_FREQ, idx);
mt7603_mac_start(dev);
return 0;
+10 -1
View File
@@ -112,8 +112,18 @@ int
mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_buff *skb)
{
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
struct ieee80211_supported_band *sband;
__le32 *rxd = (__le32 *) skb->data;
u32 rxd0 = le32_to_cpu(rxd[0]);
int idx;
memset(status, 0, sizeof(*status));
idx = MT76_GET(MT_RXD1_NORMAL_CH_FREQ, rxd[1]);
sband = (idx & 1) ? &dev->mt76.sband_5g : &dev->mt76.sband_2g;
idx >>= 1;
if (idx < sband->n_channels)
status->freq = sband->channels[idx].center_freq;
rxd += 4;
if (rxd0 & MT_RXD0_NORMAL_GROUP_4) {
@@ -137,7 +147,6 @@ mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_buff *skb)
return -EINVAL;
}
memset(status, 0, sizeof(*status));
skb_pull(skb, (u8 *) rxd - skb->data);
return 0;