introduce background radar support for mt7915 driver
Subsystems (4)
Lorenzo Bianconi
maintainerv2 cover introduce background radar support for mt7915 driver
Introduce radar/CAC background detection support for mt7915 driver Background radar/CAC detection allows to avoid the CAC downtime switching on a different channel during CAC detection on the selected radar channel.
Changes since v1:
- repost adding devicetree ml in cc
Lorenzo Bianconi (6):
mt76: mt7915: introduce mt7915_set_radar_background routine
mt76: mt7915: enable radar trigger on rdd2
mt76: mt7915: introduce rdd_monitor debugfs node
mt76: mt7915: report radar pattern if detected by rdd2
mt76: mt7915: enable radar background detection dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan
.../bindings/net/wireless/mediatek,mt76.yaml | 9 ++ .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../wireless/mediatek/mt76/mt7915/debugfs.c | 55 +++++++++- .../net/wireless/mediatek/mt76/mt7915/init.c | 10 ++ .../net/wireless/mediatek/mt76/mt7915/main.c | 50 +++++++++ .../net/wireless/mediatek/mt76/mt7915/mcu.c | 100 +++++++++++++++++- .../net/wireless/mediatek/mt76/mt7915/mcu.h | 23 ++++ .../wireless/mediatek/mt76/mt7915/mt7915.h | 7 ++ 8 files changed, 253 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
Lorenzo Bianconi
maintainerPATCH v2 1/6 mt76: mt7915: introduce mt7915_set_radar_background routine
Introduce mt7915_mcu_rdd_background_enable and mt7915_mcu_background_chain_ctrl routines to configure rx dfs dedicated chain. This is a preliminary patch to add zero-wait dfs support performing CAC detection on rdd2.
--- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../net/wireless/mediatek/mt76/mt7915/init.c | 3 + .../net/wireless/mediatek/mt76/mt7915/main.c | 50 ++++++++++ .../net/wireless/mediatek/mt76/mt7915/mcu.c | 93 +++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7915/mcu.h | 23 +++++ .../wireless/mediatek/mt76/mt7915/mt7915.h | 7 ++ 6 files changed, 177 insertions(+)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +1 -0
@@ -977,6 +977,7 @@ enum {MCU_EXT_CMD_SCS_CTRL =0x82 ,MCU_EXT_CMD_TWT_AGRT_UPDATE =0x94 ,MCU_EXT_CMD_FW_DBG_CTRL =0x95 , +MCU_EXT_CMD_OFFCH_SCAN_CTRL =0x9a ,MCU_EXT_CMD_SET_RDD_TH =0x9d ,MCU_EXT_CMD_MURU_CTRL =0x9f , MCU_EXT_CMD_SET_SPR = 0xa8,
drivers/net/wireless/mediatek/mt76/mt7915/init.c +3 -0
@@ -293,6 +293,9 @@ mt7915_regd_notifier(struct wiphy *wiphy,memcpy (dev->mt76.alpha2, request->alpha2,sizeof (dev->mt76.alpha2)); dev->mt76.region = request->dfs_region; +if (dev->mt76.region ==NL80211_DFS_UNSET ) +mt7915_mcu_rdd_background_enable (phy,NULL ); +mt7915_init_txpower (dev, &mphy->sband_2g.sband);mt7915_init_txpower (dev, &mphy->sband_5g.sband);
drivers/net/wireless/mediatek/mt76/mt7915/main.c +50 -0
60 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +93 -0
99 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +23 -0
@@ -131,6 +131,29 @@ struct mt7915_mcu_rdd_report { } hw_pulse[32 ]; } __packed; +struct mt7915_mcu_background_chain_ctrl { +u8 chan;/* primary channel */ +u8 central_chan;/* central channel */ +u8 bw; +u8 tx_stream; +u8 rx_stream; + +u8 monitor_chan;/* monitor channel */ +u8 monitor_central_chan;/* monitor central channel */ +u8 monitor_bw; +u8 monitor_tx_stream; +u8 monitor_rx_stream; + +u8 scan_mode;/* 0: ScanStop +* 1: ScanStart +* 2: ScanRunning +*/ +u8 band_idx;/* DBDC */ +u8 monitor_scan_type; +u8 band;/* 0: 2.4GHz, 1: 5GHz */ +u8 rsv[2 ]; +} __packed; +struct mt7915_mcu_eeprom {u8 buffer_mode;u8 format;
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +7 -0
@@ -269,6 +269,10 @@ struct mt7915_dev {struct tasklet_struct irq_tasklet;struct mt7915_phy phy; +/* monitor rx chain configured channel */ +struct cfg80211_chan_def rdd2_chandef; +struct mt7915_phy *rdd2_phy; +u16 chainmask;u32 hif_idx;
@@ -328,6 +332,7 @@ enum {enum {MT_RX_SEL0 ,MT_RX_SEL1 , +MT_RX_SEL2 ,/* monitor chain */ };enum mt7915_rdd_cmd {
@@ -461,6 +466,8 @@ int mt7915_mcu_get_temperature(struct mt7915_phy *phy);int mt7915_mcu_set_thermal_throttling (struct mt7915_phy *phy,u8 state);int mt7915_mcu_get_rx_rate (struct mt7915_phy *phy,struct ieee80211_vif *vif,struct ieee80211_sta *sta,struct rate_info *rate); +int mt7915_mcu_rdd_background_enable (struct mt7915_phy *phy, +struct cfg80211_chan_def *chandef);int mt7915_mcu_wa_cmd (struct mt7915_dev *dev,int cmd,u32 a1,u32 a2,u32 a3);int mt7915_mcu_fw_log_2_host (struct mt7915_dev *dev,u8 type,u8 ctrl);int mt7915_mcu_fw_dbg_ctrl (struct mt7915_dev *dev,u32 module,u8 level);
Signature · 1 line
2.34.1
Lorenzo Bianconi
maintainerPATCH v2 2/6 mt76: mt7915: enable radar trigger on rdd2
In reply to Lorenzo BianconiEnable radar trigger for rdd2 in mt7915_radar_trigger.
--- drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +5 -1
@@ -79,7 +79,11 @@ mt7915_radar_trigger(void *data, u64 val) {struct mt7915_dev *dev = data; -return mt76_connac_mcu_rdd_cmd (&dev->mt76,RDD_RADAR_EMULATE ,1 ,0 ,0 ); +if (val >MT_RX_SEL2 ) +return -EINVAL ; + +return mt76_connac_mcu_rdd_cmd (&dev->mt76,RDD_RADAR_EMULATE , + val,0 ,0 ); } DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_trigger, NULL,
Signature · 1 line
2.34.1
Lorenzo Bianconi
maintainerPATCH v2 3/6 mt76: mt7915: introduce rdd_monitor debugfs node
In reply to Lorenzo BianconiIntroduce rdd_monitor debugfs node in order to dump rdd2 configuration.
--- .../wireless/mediatek/mt76/mt7915/debugfs.c | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +49 -0
@@ -308,6 +308,53 @@ static int mt7915_muru_stats_show(struct seq_file *file, void *data) }DEFINE_SHOW_ATTRIBUTE (mt7915_muru_stats); +static int +mt7915_rdd_monitor (struct seq_file *s,void *data) +{ +struct mt7915_dev *dev =dev_get_drvdata (s->private); +struct cfg80211_chan_def *chandef = &dev->rdd2_chandef; +const char *bw; +int ret =0 ; + +mutex_lock (&dev->mt76.mutex); + +if (!cfg80211_chandef_valid (chandef)) { + ret = -EINVAL ; + goto out; + } + +if (!dev->rdd2_phy) { +seq_puts (s,"not running\n" ); + goto out; + } + +switch (chandef->width) { +case NL80211_CHAN_WIDTH_40 : + bw ="40" ; +break ; +case NL80211_CHAN_WIDTH_80 : + bw ="80" ; +break ; +case NL80211_CHAN_WIDTH_160 : + bw ="160" ; +break ; +case NL80211_CHAN_WIDTH_80P80 : + bw ="80P80" ; +break ; +default : + bw ="20" ; +break ; + } + +seq_printf (s,"channel %d (%d MHz) width %s MHz center1: %d MHz\n" , + chandef->chan->hw_value, chandef->chan->center_freq, + bw, chandef->center_freq1); +out: +mutex_unlock (&dev->mt76.mutex); + +return ret; +} +static int mt7915_fw_debug_wm_set (void *data,u64 val) {
@@ -856,6 +903,8 @@ int mt7915_init_debugfs(struct mt7915_phy *phy) &dev->hw_pattern);debugfs_create_file ("radar_trigger" ,0200 , dir, dev, &fops_radar_trigger); +debugfs_create_devm_seqfile (dev->mt76.dev,"rdd_monitor" , dir, + mt7915_rdd_monitor); }if (!ext_phy)
Signature · 1 line
2.34.1
Lorenzo Bianconi
maintainerPATCH v2 4/6 mt76: mt7915: report radar pattern if detected by rdd2
In reply to Lorenzo BianconiReport radar pattern to mac80211 if detected by the offchannel chain.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +6 -1
@@ -358,7 +358,12 @@ mt7915_mcu_rx_radar_detected(struct mt7915_dev *dev, struct sk_buff *skb)if (r->band_idx && dev->mt76.phy2) mphy = dev->mt76.phy2; -ieee80211_radar_detected (mphy->hw); +if (r->band_idx ==MT_RX_SEL2 ) +cfg80211_background_radar_event (mphy->hw->wiphy, + &dev->rdd2_chandef, +GFP_ATOMIC ); +else +ieee80211_radar_detected (mphy->hw); dev->hw_pattern++; }
Signature · 1 line
2.34.1
Lorenzo Bianconi
maintainerPATCH v2 5/6 mt76: mt7915: enable radar background detection
In reply to Lorenzo BianconiNotify userland the hw supports background radar/CAC detection.
--- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/init.c +7 -0
@@ -309,6 +309,7 @@ static void mt7915_init_wiphy(struct ieee80211_hw *hw) {struct mt7915_phy *phy =mt7915_hw_phy (hw); +struct mt76_dev *mdev = &phy->dev->mt76;struct wiphy *wiphy = hw->wiphy;struct mt7915_dev *dev = phy->dev;
@@ -337,6 +338,12 @@ mt7915_init_wiphy(struct ieee80211_hw *hw)wiphy_ext_feature_set (wiphy,NL80211_EXT_FEATURE_BEACON_RATE_VHT );wiphy_ext_feature_set (wiphy,NL80211_EXT_FEATURE_BEACON_RATE_HE ); +if (!mdev->dev->of_node || + !of_property_read_bool (mdev->dev->of_node, +"mediatek,disable-radar-background" )) +wiphy_ext_feature_set (wiphy, +NL80211_EXT_FEATURE_RADAR_BACKGROUND ); +ieee80211_hw_set (hw,HAS_RATE_CONTROL );ieee80211_hw_set (hw,SUPPORTS_TX_ENCAP_OFFLOAD );ieee80211_hw_set (hw,SUPPORTS_RX_DECAP_OFFLOAD );
Signature · 1 line
2.34.1
Lorenzo Bianconi
maintainerPATCH v2 6/6 dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan
In reply to Lorenzo BianconiAdd the capability to disable/enable radar/CAC detection running on a dedicated offchannel chain available on some hw. Offchannel radar/CAC detection allows to avoid CAC downtime switching on a different channel during CAC detection on the selected radar channel.
--- .../devicetree/bindings/net/wireless/mediatek,mt76.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml +9 -0
@@ -69,6 +69,15 @@ properties: calibration data is generic and specific calibration data should be pulled from the OTP ROM + mediatek,disable-radar-background: + type: boolean + description: + Disable/enable radar/CAC detection running on a dedicated offchannel + chain available on some hw. + Background radar/CAC detection allows to avoid the CAC downtime + switching on a different channel during CAC detection on the selected + radar channel. + led: type: object $ref: /schemas/leds/common.yaml#
Signature · 1 line
2.34.1
Re: [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan
Quoted 10 lines · Lorenzo Bianconi
Add the capability to disable/enable radar/CAC detection running on a dedicated offchannel chain available on some hw. Offchannel radar/CAC detection allows to avoid CAC downtime switching on a different channel during CAC detection on the selected radar channel.
Signed-off-by Lorenzo Bianconi <[email protected]>--- .../devicetree/bindings/net/wireless/mediatek,mt76.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)
Was the recommendation so that devicetree binding patches should be first in the patchset?
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Lorenzo Bianconi
maintainerRe: [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan
Quoted 8 lines
Quoted 6 lines · Lorenzo Bianconi
Add the capability to disable/enable radar/CAC detection running on a dedicated offchannel chain available on some hw. Offchannel radar/CAC detection allows to avoid CAC downtime switching on a different channel during CAC detection on the selected radar channel.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Lorenzo Bianconi <[email protected]>--- .../devicetree/bindings/net/wireless/mediatek,mt76.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)Was the recommendation so that devicetree binding patches should be first in the patchset?
ah, ok..I was not aware of it :)
Regards,
Lorenzo
Quoted 5 lines
Signature · 4 lines
-- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan
In reply to Lorenzo BianconiQuoted 11 lines · Lorenzo Bianconi
Add the capability to disable/enable radar/CAC detection running on a dedicated offchannel chain available on some hw. Offchannel radar/CAC detection allows to avoid CAC downtime switching on a different channel during CAC detection on the selected radar channel.
Signed-off-by Lorenzo Bianconi <[email protected]>--- .../devicetree/bindings/net/wireless/mediatek,mt76.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)