diff options
author | Shayne Chen <shayne.chen@mediatek.com> | 2020-12-04 17:36:59 +0800 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2021-01-26 20:07:48 +0100 |
commit | 7517ea014d3c94caa238e140dfb29bde10540a54 (patch) | |
tree | 3385dccfc08255dea41388a6d1f6100ceb64f04b /drivers/net | |
parent | 78fc30a21cf1175e97567fa5153c0efc7d955a45 (diff) |
mt76: mt7615: move testmode data from dev to phy
Move per-chip testmode data to mt7615_phy, to properly support
reg_backup and rx status of each band in testmode.
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h | 22 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7615/testmode.c | 21 |
3 files changed, 30 insertions, 31 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 607880369380..5d2a14cf5d40 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -186,7 +186,7 @@ mt7615_get_status_freq_info(struct mt7615_dev *dev, struct mt76_phy *mphy, status->freq = ieee80211_channel_to_frequency(chfreq, status->band); } -static void mt7615_mac_fill_tm_rx(struct mt7615_dev *dev, __le32 *rxv) +static void mt7615_mac_fill_tm_rx(struct mt7615_phy *phy, __le32 *rxv) { #ifdef CONFIG_NL80211_TESTMODE u32 rxv1 = le32_to_cpu(rxv[0]); @@ -210,13 +210,13 @@ static void mt7615_mac_fill_tm_rx(struct mt7615_dev *dev, __le32 *rxv) foe = (foe * foe_const) >> 15; } - dev->test.last_freq_offset = foe; - dev->test.last_rcpi[0] = FIELD_GET(MT_RXV4_RCPI0, rxv4); - dev->test.last_rcpi[1] = FIELD_GET(MT_RXV4_RCPI1, rxv4); - dev->test.last_rcpi[2] = FIELD_GET(MT_RXV4_RCPI2, rxv4); - dev->test.last_rcpi[3] = FIELD_GET(MT_RXV4_RCPI3, rxv4); - dev->test.last_ib_rssi[0] = FIELD_GET(MT_RXV3_IB_RSSI, rxv3); - dev->test.last_wb_rssi[0] = FIELD_GET(MT_RXV3_WB_RSSI, rxv3); + phy->test.last_freq_offset = foe; + phy->test.last_rcpi[0] = FIELD_GET(MT_RXV4_RCPI0, rxv4); + phy->test.last_rcpi[1] = FIELD_GET(MT_RXV4_RCPI1, rxv4); + phy->test.last_rcpi[2] = FIELD_GET(MT_RXV4_RCPI2, rxv4); + phy->test.last_rcpi[3] = FIELD_GET(MT_RXV4_RCPI3, rxv4); + phy->test.last_ib_rssi[0] = FIELD_GET(MT_RXV3_IB_RSSI, rxv3); + phy->test.last_wb_rssi[0] = FIELD_GET(MT_RXV3_WB_RSSI, rxv3); #endif } @@ -435,7 +435,7 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb) status->chain_signal[i]); } - mt7615_mac_fill_tm_rx(dev, rxd); + mt7615_mac_fill_tm_rx(mphy->priv, rxd); rxd += 6; if ((u8 *)rxd - skb->data >= skb->len) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h index d697ff2ea56e..979c5c7fe93c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h @@ -195,6 +195,17 @@ struct mt7615_phy { struct timer_list roc_timer; wait_queue_head_t roc_wait; bool roc_grant; + +#ifdef CONFIG_NL80211_TESTMODE + struct { + u32 *reg_backup; + + s16 last_freq_offset; + u8 last_rcpi[4]; + s8 last_ib_rssi[4]; + s8 last_wb_rssi[4]; + } test; +#endif }; #define mt7615_mcu_add_tx_ba(dev, ...) (dev)->mcu_ops->add_tx_ba((dev), __VA_ARGS__) @@ -281,17 +292,6 @@ struct mt7615_dev { u32 muar_mask; -#ifdef CONFIG_NL80211_TESTMODE - struct { - u32 *reg_backup; - - s16 last_freq_offset; - u8 last_rcpi[4]; - s8 last_ib_rssi[4]; - s8 last_wb_rssi[4]; - } test; -#endif - struct { bool enable; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/testmode.c b/drivers/net/wireless/mediatek/mt76/mt7615/testmode.c index f70367d2d317..b82915445d0d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/testmode.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/testmode.c @@ -98,12 +98,12 @@ static void mt7615_tm_reg_backup_restore(struct mt7615_phy *phy) { struct mt7615_dev *dev = phy->dev; - u32 *b = dev->test.reg_backup; + u32 *b = phy->test.reg_backup; int n_regs = ARRAY_SIZE(reg_backup_list); int n_rf_regs = ARRAY_SIZE(rf_backup_list); int i; - if (dev->mphy.test.state == MT76_TM_STATE_OFF) { + if (phy->mt76->test.state == MT76_TM_STATE_OFF) { for (i = 0; i < n_regs; i++) mt76_wr(dev, reg_backup_list[i], b[i]); @@ -121,7 +121,7 @@ mt7615_tm_reg_backup_restore(struct mt7615_phy *phy) if (!b) return; - dev->test.reg_backup = b; + phy->test.reg_backup = b; for (i = 0; i < n_regs; i++) b[i] = mt76_rr(dev, reg_backup_list[i]); for (i = 0; i < n_rf_regs; i++) @@ -323,7 +323,6 @@ static int mt7615_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg) { struct mt7615_phy *phy = mphy->priv; - struct mt7615_dev *dev = phy->dev; void *rx, *rssi; int i; @@ -331,15 +330,15 @@ mt7615_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg) if (!rx) return -ENOMEM; - if (nla_put_s32(msg, MT76_TM_RX_ATTR_FREQ_OFFSET, dev->test.last_freq_offset)) + if (nla_put_s32(msg, MT76_TM_RX_ATTR_FREQ_OFFSET, phy->test.last_freq_offset)) return -ENOMEM; rssi = nla_nest_start(msg, MT76_TM_RX_ATTR_RCPI); if (!rssi) return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(dev->test.last_rcpi); i++) - if (nla_put_u8(msg, i, dev->test.last_rcpi[i])) + for (i = 0; i < ARRAY_SIZE(phy->test.last_rcpi); i++) + if (nla_put_u8(msg, i, phy->test.last_rcpi[i])) return -ENOMEM; nla_nest_end(msg, rssi); @@ -348,8 +347,8 @@ mt7615_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg) if (!rssi) return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(dev->test.last_ib_rssi); i++) - if (nla_put_s8(msg, i, dev->test.last_ib_rssi[i])) + for (i = 0; i < ARRAY_SIZE(phy->test.last_ib_rssi); i++) + if (nla_put_s8(msg, i, phy->test.last_ib_rssi[i])) return -ENOMEM; nla_nest_end(msg, rssi); @@ -358,8 +357,8 @@ mt7615_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg) if (!rssi) return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(dev->test.last_wb_rssi); i++) - if (nla_put_s8(msg, i, dev->test.last_wb_rssi[i])) + for (i = 0; i < ARRAY_SIZE(phy->test.last_wb_rssi); i++) + if (nla_put_s8(msg, i, phy->test.last_wb_rssi[i])) return -ENOMEM; nla_nest_end(msg, rssi); |