All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: greearb@candelatech.com
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 03/11] mt76: mt7915: support enabling rx group-5 status
Date: Tue, 4 Jan 2022 11:39:17 +0100	[thread overview]
Message-ID: <YdQj1Yq9wIIlYbJl@localhost.localdomain> (raw)
In-Reply-To: <20211118164056.2965-3-greearb@candelatech.com>

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

> From: Ben Greear <greearb@candelatech.com>
> 
> When enabled, this allows per-skb rx rate reporting.
> Enabling this may degrade RX performance, so it remains
> disabled by default.
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> ---
>  .../wireless/mediatek/mt76/mt7915/debugfs.c   | 33 +++++++++++++++++++
>  .../net/wireless/mediatek/mt76/mt7915/init.c  |  3 +-
>  .../net/wireless/mediatek/mt76/mt7915/mac.c   |  3 +-
>  .../net/wireless/mediatek/mt76/mt7915/main.c  |  3 +-
>  .../wireless/mediatek/mt76/mt7915/mt7915.h    |  5 +++
>  5 files changed, 44 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
> index e3f6cd18e30a..32e219a20721 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
> @@ -435,6 +435,38 @@ mt7915_txs_for_no_skb_get(void *data, u64 *val)
>  DEFINE_DEBUGFS_ATTRIBUTE(fops_txs_for_no_skb, mt7915_txs_for_no_skb_get,
>  			 mt7915_txs_for_no_skb_set, "%lld\n");
>  
> +static int
> +mt7915_rx_group_5_enable_set(void *data, u64 val)
> +{
> +	struct mt7915_dev *dev = data;
> +
> +	mutex_lock(&dev->mt76.mutex);
> +
> +	dev->rx_group_5_enable = !!val;

I think this should be added in mt7915_phy instead of in mt7915_dev since
we have MT_DMA_DCR0() for each band.

> +
> +	/* Enabled if we requested enabled OR if monitor mode is enabled. */
> +	mt76_rmw_field(dev, MT_DMA_DCR0(0), MT_DMA_DCR0_RXD_G5_EN,
> +		       dev->phy.is_monitor_mode || dev->rx_group_5_enable);

I think we do not need dev->phy.is_monitor_mode, we can check if monitor is
enabled looking at hw->conf.flag.

> +	mt76_testmode_reset(dev->phy.mt76, true);
> +
> +	mutex_unlock(&dev->mt76.mutex);
> +
> +	return 0;
> +}
> +
> +static int
> +mt7915_rx_group_5_enable_get(void *data, u64 *val)
> +{
> +	struct mt7915_dev *dev = data;
> +
> +	*val = dev->rx_group_5_enable;
> +
> +	return 0;
> +}
> +
> +DEFINE_DEBUGFS_ATTRIBUTE(fops_rx_group_5_enable, mt7915_rx_group_5_enable_get,
> +			 mt7915_rx_group_5_enable_set, "%lld\n");
> +
>  static void
>  mt7915_ampdu_stat_read_phy(struct mt7915_phy *phy,
>  			   struct seq_file *file)
> @@ -786,6 +818,7 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
>  	debugfs_create_file("fw_util_wa", 0400, dir, dev,
>  			    &mt7915_fw_util_wa_fops);
>  	debugfs_create_file("force_txs", 0600, dir, dev, &fops_txs_for_no_skb);
> +	debugfs_create_file("rx_group_5_enable", 0600, dir, dev, &fops_rx_group_5_enable);
>  	debugfs_create_file("implicit_txbf", 0600, dir, dev,
>  			    &fops_implicit_txbf);
>  	debugfs_create_file("txpower_sku", 0400, dir, phy,
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> index 90aa62c64f3e..58a0ce72b714 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> @@ -391,7 +391,8 @@ mt7915_mac_init_band(struct mt7915_dev *dev, u8 band)
>  
>  	mt76_rmw_field(dev, MT_DMA_DCR0(band), MT_DMA_DCR0_MAX_RX_LEN, 0x680);
>  	/* disable rx rate report by default due to hw issues */
> -	mt76_clear(dev, MT_DMA_DCR0(band), MT_DMA_DCR0_RXD_G5_EN);
> +	mt76_rmw_field(dev, MT_DMA_DCR0(band), MT_DMA_DCR0_RXD_G5_EN,
> +		       dev->phy.is_monitor_mode || dev->rx_group_5_enable);
>  }
>  
>  static void mt7915_mac_init(struct mt7915_dev *dev)
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> index 6fbd58ae9c88..a6bcc76dcb03 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> @@ -715,7 +715,8 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb)
>  		status->flag |= RX_FLAG_8023;
>  	}
>  
> -	if (rxv && status->flag & RX_FLAG_RADIOTAP_HE) {
> +	if (phy->is_monitor_mode &&
> +	    rxv && status->flag & RX_FLAG_RADIOTAP_HE) {
>  		mt7915_mac_decode_he_radiotap(skb, status, rxv, mode);
>  		if (status->flag & RX_FLAG_RADIOTAP_HE_MU)
>  			mt7915_mac_decode_he_mu_radiotap(skb, status, rxv);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> index 3d702dc899ba..e973b2527b34 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> @@ -458,13 +458,14 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
>  	if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
>  		bool enabled = !!(hw->conf.flags & IEEE80211_CONF_MONITOR);
>  
> +		phy->is_monitor_mode = enabled;
>  		if (!enabled)
>  			phy->rxfilter |= MT_WF_RFCR_DROP_OTHER_UC;
>  		else
>  			phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_UC;
>  
>  		mt76_rmw_field(dev, MT_DMA_DCR0(band), MT_DMA_DCR0_RXD_G5_EN,
> -			       enabled);
> +			       phy->is_monitor_mode || dev->rx_group_5_enable);
>  		mt76_testmode_reset(phy->mt76, true);
>  		mt76_wr(dev, MT_WF_RFCR(band), phy->rxfilter);
>  	}
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h
> index 86cd0fc8e9de..84fff60ada92 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h
> @@ -209,6 +209,7 @@ struct mt7915_phy {
>  	struct thermal_cooling_device *cdev;
>  	u8 throttle_state;
>  	u32 throttle_temp[2]; /* 0: critical high, 1: maximum */
> +	u8 is_monitor_mode; /* are we in monitor mode or not ? */

not needed

>  
>  	u32 rxfilter;
>  	u64 omac_mask;
> @@ -261,6 +262,10 @@ struct mt7915_dev {
>  	 * creation by firmware, so may be a performance drag.
>  	 */
>  	bool txs_for_no_skb_enabled;
> +	/* Should we enable group-5 rx descriptor logic?  This may decrease RX
> +	 * throughput, but will give per skb rx rate information..
> +	 */
> +	bool rx_group_5_enable;

move it in mt7915_phy

>  
>  	struct work_struct init_work;
>  	struct work_struct rc_work;
> -- 
> 2.20.1
> 

Regards,
Lorenzo

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

  reply	other threads:[~2022-01-04 10:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 16:40 [PATCH 01/11] mt76: mt7915: add comments about rx descriptor parsing greearb
2021-11-18 16:40 ` [PATCH 02/11] mt76: mt7915: print out hw revision greearb
2021-11-18 16:59   ` Ryder Lee
2021-11-18 16:40 ` [PATCH 03/11] mt76: mt7915: support enabling rx group-5 status greearb
2022-01-04 10:39   ` Lorenzo Bianconi [this message]
2021-11-18 16:40 ` [PATCH 04/11] mt76: mt7915: use nss for calculating rx-chains greearb
2021-12-03  9:16   ` Felix Fietkau
2021-12-03 15:33     ` Ben Greear
2021-11-18 16:40 ` [PATCH 05/11] mt76: mt7915: ethtool group-5 rx stats information greearb
2022-01-04 10:58   ` Lorenzo Bianconi
2021-11-18 16:40 ` [PATCH 06/11] mt76: mt7915: ethtool counters for driver rx path greearb
2021-11-18 16:40 ` [PATCH 07/11] mt76: mt7915: fix rate rix and flags in txs path greearb
2022-01-04 11:15   ` Lorenzo Bianconi
2021-11-18 16:40 ` [PATCH 08/11] mt76: mt7915: add ethtool tx/rx pkts/bytes greearb
2021-11-18 16:40 ` [PATCH 09/11] mt76: mt7915: add rx-ppdu-size-out-of-range ethtool counter greearb
2021-11-18 16:40 ` [PATCH 10/11] mt76: mt7915: ethtool and mib rx stats greearb
2021-11-18 16:40 ` [PATCH 11/11] mt76: mt7915: poll mib counters every 200ms greearb
2021-11-18 17:01   ` Ryder Lee
2021-11-19 16:33 ` [PATCH 01/11] mt76: mt7915: add comments about rx descriptor parsing Lorenzo Bianconi
2021-11-19 16:41   ` Ben Greear

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=YdQj1Yq9wIIlYbJl@localhost.localdomain \
    --to=lorenzo@kernel.org \
    --cc=greearb@candelatech.com \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.