public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Chad Monroe <chad@monroe.io>
Cc: Felix Fietkau <nbd@nbd.name>,
	Johannes Berg <johannes.berg@intel.com>,
	Shayne Chen <shayne.chen@mediatek.com>,
	Evelyn Tsai <evelyn.tsai@mediatek.com>,
	Ryder Lee <ryder.lee@mediatek.com>,
	linux-wireless@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	Rubio Lu <Rubio-DW.Lu@mediatek.com>,
	Ben Greear <greearb@candelatech.com>
Subject: Re: [PATCH 1/2] mt76: mt7615: fix STA mode connection on DFS channels
Date: Fri, 27 Aug 2021 20:12:54 +0200	[thread overview]
Message-ID: <YSkrJtKTB40u1U9H@lore-desk> (raw)
In-Reply-To: <54c9a89210608d2a9b9adf37a8c2a743275e5723.1630081048.git.chad@monroe.io>

[-- Attachment #1: Type: text/plain, Size: 2601 bytes --]

> Only AP, adhoc and mesh mode needs to check CAC.
> Stations, in particular, do not need this check.
> 
> Signed-off-by: Rubio Lu <Rubio-DW.Lu@mediatek.com>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> Signed-off-by: Chad Monroe <chad@monroe.io>
> ---
>  .../net/wireless/mediatek/mt76/mt7615/mac.c   | 38 +++++++++++++++++--
>  1 file changed, 35 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> index ed1bba42a322..78b55e872da0 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> @@ -2153,6 +2153,32 @@ static int mt7615_dfs_start_radar_detector(struct mt7615_phy *phy)
>  	return 0;
>  }
>  
> +struct mt7615_vif_counts {
> +	u32 mesh;
> +	u32 adhoc;
> +	u32 ap;

I think u8 it is enough here. Moreover I think we can just count dfs_vif, what
do you think?

> +};
> +
> +static void
> +mt7615_vif_counts(void *priv, u8 *mac, struct ieee80211_vif *vif)
> +{
> +	struct mt7615_vif_counts *counts = priv;
> +
> +	switch (vif->type) {
> +	case NL80211_IFTYPE_ADHOC:
> +		counts->adhoc++;
> +		break;
> +	case NL80211_IFTYPE_MESH_POINT:
> +		counts->mesh++;
> +		break;
> +	case NL80211_IFTYPE_AP:
> +		counts->ap++;
> +		break;
> +	default:
> +		break;
> +	}
> +}
> +
>  static int
>  mt7615_dfs_init_radar_specs(struct mt7615_phy *phy)
>  {
> @@ -2196,6 +2222,7 @@ int mt7615_dfs_init_radar_detector(struct mt7615_phy *phy)
>  	struct mt7615_dev *dev = phy->dev;
>  	bool ext_phy = phy != &dev->phy;
>  	int err;
> +	struct mt7615_vif_counts counts = {0};
>  
>  	if (is_mt7663(&dev->mt76))
>  		return 0;
> @@ -2223,9 +2250,14 @@ int mt7615_dfs_init_radar_detector(struct mt7615_phy *phy)
>  	phy->dfs_state = chandef->chan->dfs_state;
>  
>  	if (chandef->chan->flags & IEEE80211_CHAN_RADAR) {
> -		if (chandef->chan->dfs_state != NL80211_DFS_AVAILABLE)
> -			return mt7615_dfs_start_radar_detector(phy);
> -
> +		if (chandef->chan->dfs_state != NL80211_DFS_AVAILABLE) {
> +			ieee80211_iterate_active_interfaces(phy->mt76->hw,
> +				IEEE80211_IFACE_ITER_RESUME_ALL,
> +				mt7615_vif_counts, &counts);
> +			if (counts.ap + counts.adhoc + counts.mesh)
> +				mt7615_dfs_start_radar_detector(phy);

here we are not considering the return value of
mt7615_dfs_start_radar_detector()

Regards,
Lorenzo

> +			return 0;
> +		}
>  		return mt7615_mcu_rdd_cmd(dev, RDD_CAC_END, ext_phy,
>  					  MT_RX_SEL0, 0);
>  	}
> -- 
> 2.20.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      parent reply	other threads:[~2021-08-27 18:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27 17:06 [PATCH 1/2] mt76: mt7615: fix STA mode connection on DFS channels Chad Monroe
2021-08-27 17:06 ` [PATCH 2/2] mt76: mt7615: fix radar detector logic Chad Monroe
2021-08-27 18:44   ` Lorenzo Bianconi
2021-08-27 18:12 ` Lorenzo Bianconi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YSkrJtKTB40u1U9H@lore-desk \
    --to=lorenzo.bianconi@redhat.com \
    --cc=Rubio-DW.Lu@mediatek.com \
    --cc=chad@monroe.io \
    --cc=evelyn.tsai@mediatek.com \
    --cc=greearb@candelatech.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox