developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 1 | From 882682e4d7b0212bfe7c519d6ae4f5d30bd8f3d4 Mon Sep 17 00:00:00 2001 |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 2 | From: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 3 | Date: Mon, 22 Apr 2024 16:49:48 +0800 |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 111/193] mtk: mt76: mt7996: remain multiple wiphy model for |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 5 | testmode |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 6 | |
| 7 | Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 8 | --- |
| 9 | mt7996/init.c | 13 ++++++++----- |
| 10 | mt7996/main.c | 14 ++++++++++---- |
| 11 | mt7996/mt7996.h | 9 ++++----- |
| 12 | 3 files changed, 22 insertions(+), 14 deletions(-) |
| 13 | |
| 14 | diff --git a/mt7996/init.c b/mt7996/init.c |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 15 | index 3cd0c9e..59ea76f 100644 |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 16 | --- a/mt7996/init.c |
| 17 | +++ b/mt7996/init.c |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 18 | @@ -792,9 +792,11 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy, |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 19 | mtk_wed_device_start(&dev->mt76.mmio.wed_hif2, MT_INT_TX_RX_DONE_EXT); |
| 20 | } |
| 21 | |
| 22 | - /* TODO: FIXME: force to use single wiphy, need to rework init flow */ |
| 23 | - phy->mt76->ori_hw = mphy->hw; |
| 24 | - mphy->hw = dev->phy.mt76->hw; |
| 25 | + /* TODO: FIXME: force to use single wiphy for normal mode, need to rework init flow */ |
| 26 | + if (!dev->testmode_enable) { |
| 27 | + phy->mt76->ori_hw = mphy->hw; |
| 28 | + mphy->hw = dev->phy.mt76->hw; |
| 29 | + } |
| 30 | |
| 31 | return 0; |
| 32 | |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 33 | @@ -830,8 +832,9 @@ mt7996_unregister_phy(struct mt7996_phy *phy, enum mt76_band_id band) |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 34 | if (!phy) |
| 35 | return; |
| 36 | |
| 37 | - /* TODO: FIXME: temp for single wiphy support */ |
| 38 | - phy->mt76->hw = phy->mt76->ori_hw; |
| 39 | + /* TODO: FIXME: temp for normal mode single wiphy support */ |
| 40 | + if (!phy->dev->testmode_enable) |
| 41 | + phy->mt76->hw = phy->mt76->ori_hw; |
| 42 | |
| 43 | #ifdef CONFIG_MTK_VENDOR |
| 44 | mt7996_unregister_csi(phy); |
| 45 | diff --git a/mt7996/main.c b/mt7996/main.c |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 46 | index 7b976d0..765e7d6 100644 |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 47 | --- a/mt7996/main.c |
| 48 | +++ b/mt7996/main.c |
| 49 | @@ -140,8 +140,8 @@ static int mt7996_start(struct ieee80211_hw *hw) |
| 50 | struct mt7996_dev *dev = mt7996_hw_dev(hw); |
| 51 | int ret; |
| 52 | |
| 53 | - /* only allow settings from hw0 */ |
| 54 | - if (hw != dev->phy.mt76->hw) |
| 55 | + /* only allow settings from hw0 for normal mode */ |
| 56 | + if (!dev->testmode_enable && hw != dev->phy.mt76->hw) |
| 57 | return -1; |
| 58 | |
| 59 | flush_work(&dev->init_work); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 60 | @@ -158,8 +158,8 @@ static void mt7996_stop(struct ieee80211_hw *hw, bool suspend) |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 61 | struct mt7996_dev *dev = mt7996_hw_dev(hw); |
| 62 | int band; |
| 63 | |
| 64 | - /* only allow settings from hw0 */ |
| 65 | - if (hw != dev->phy.mt76->hw) |
| 66 | + /* only allow settings from hw0 for normal mode */ |
| 67 | + if (!dev->testmode_enable && hw != dev->phy.mt76->hw) |
| 68 | return; |
| 69 | |
| 70 | cancel_delayed_work_sync(&dev->scs_work); |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 71 | @@ -455,6 +455,12 @@ static int mt7996_add_interface(struct ieee80211_hw *hw, |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 72 | is_zero_ether_addr(vif->addr)) |
| 73 | phy->monitor_vif = vif; |
| 74 | |
| 75 | + if (dev->testmode_enable && vif->type != NL80211_IFTYPE_MONITOR) { |
| 76 | + mutex_unlock(&dev->mt76.mutex); |
| 77 | + dev_err(dev->mt76.dev, "Only monitor interface is allowed in testmode\n"); |
| 78 | + return -EINVAL; |
| 79 | + } |
| 80 | + |
| 81 | INIT_DELAYED_WORK(&mvif->beacon_mon_work, mt7996_beacon_mon_work); |
| 82 | mvif->dev = dev; |
| 83 | mvif->hw = hw; |
| 84 | diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 85 | index e23ed8e..b8699b6 100644 |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 86 | --- a/mt7996/mt7996.h |
| 87 | +++ b/mt7996/mt7996.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 88 | @@ -880,16 +880,15 @@ mt7996_has_background_radar(struct mt7996_dev *dev) |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 89 | static inline struct mt7996_phy * |
| 90 | mt7996_band_phy(struct ieee80211_hw *hw, enum nl80211_band band) |
| 91 | { |
| 92 | - struct mt76_dev *dev = hw->priv; |
| 93 | - struct mt76_phy *phy; |
| 94 | + struct mt76_phy *phy = hw->priv; |
| 95 | |
| 96 | /* TODO: mlo: temporarily hardcode */ |
| 97 | if (band == NL80211_BAND_6GHZ) |
| 98 | - phy = dev->phys[MT_BAND2]; |
| 99 | + phy = phy->dev->phys[MT_BAND2]; |
| 100 | else if (band == NL80211_BAND_5GHZ) |
| 101 | - phy = dev->phys[MT_BAND1]; |
| 102 | + phy = phy->dev->phys[MT_BAND1]; |
| 103 | else |
| 104 | - phy = dev->phys[MT_BAND0]; |
| 105 | + phy = phy->dev->phys[MT_BAND0]; |
| 106 | |
| 107 | if (!phy) |
| 108 | return NULL; |
| 109 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 110 | 2.45.2 |
developer | dad89a3 | 2024-04-29 14:17:17 +0800 | [diff] [blame] | 111 | |