linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mt76: mt7915: add missing capabilities for DBDC
@ 2021-02-25 14:58 Ryder Lee
  2021-02-25 14:58 ` [PATCH v2 2/2] mt76: mt7615: " Ryder Lee
  2021-03-10  8:30 ` [kbuild] Re: [PATCH v2 1/2] mt76: mt7915: " Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Ryder Lee @ 2021-02-25 14:58 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi
  Cc: Shayne Chen, linux-wireless, linux-mediatek, Ryder Lee

Adjust capabilities setup for DBDC to improve performance.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
change since v2 - adjust setup sequence.
---
 .../net/wireless/mediatek/mt76/mt7915/init.c  | 50 +++++++++++--------
 1 file changed, 29 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index c599b44a728c..98de148e1043 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -113,6 +113,24 @@ mt7915_init_wiphy(struct ieee80211_hw *hw)
 	ieee80211_hw_set(hw, WANT_MONITOR_VIF);
 
 	hw->max_tx_fragments = 4;
+
+	if (phy->mt76->cap.has_2ghz)
+		phy->mt76->sband_2g.sband.ht_cap.cap |=
+			IEEE80211_HT_CAP_LDPC_CODING |
+			IEEE80211_HT_CAP_MAX_AMSDU;
+
+	if (phy->mt76->cap.has_5ghz) {
+		phy->mt76->sband_5g.sband.ht_cap.cap |=
+			IEEE80211_HT_CAP_LDPC_CODING |
+			IEEE80211_HT_CAP_MAX_AMSDU;
+		phy->mt76->sband_5g.sband.vht_cap.cap |=
+			IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
+			IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
+	}
+
+	mt76_set_stream_caps(phy->mt76, true);
+	mt7915_set_stream_vht_txbf_caps(phy);
+	mt7915_set_stream_he_caps(phy);
 }
 
 static void
@@ -240,22 +258,17 @@ static int mt7915_register_ext_phy(struct mt7915_dev *dev)
 	phy->mt76 = mphy;
 	mphy->chainmask = dev->chainmask & ~dev->mphy.chainmask;
 	mphy->antenna_mask = BIT(hweight8(mphy->chainmask)) - 1;
-	mt7915_init_wiphy(mphy->hw);
 
 	INIT_LIST_HEAD(&phy->stats_list);
 	INIT_DELAYED_WORK(&mphy->mac_work, mt7915_mac_work);
 
 	mt7915_eeprom_parse_band_config(phy);
-	mt7915_set_stream_vht_txbf_caps(phy);
-	mt7915_set_stream_he_caps(phy);
+	mt7915_init_wiphy(mphy->hw);
 
 	memcpy(mphy->macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR2,
 	       ETH_ALEN);
 	mt76_eeprom_override(mphy);
 
-	/* The second interface does not get any packets unless it has a vif */
-	ieee80211_hw_set(mphy->hw, WANT_MONITOR_VIF);
-
 	ret = mt7915_init_tx_queues(phy, MT7915_TXQ_BAND1,
 				    MT7915_TX_RING_SIZE);
 	if (ret)
@@ -332,8 +345,14 @@ static int mt7915_init_hardware(struct mt7915_dev *dev)
 
 void mt7915_set_stream_vht_txbf_caps(struct mt7915_phy *phy)
 {
-	int nss = hweight8(phy->mt76->chainmask);
-	u32 *cap = &phy->mt76->sband_5g.sband.vht_cap.cap;
+	int nss;
+	u32 *cap;
+
+	if (!phy->mt76->cap.has_5ghz)
+		return;
+
+	nss = hweight8(phy->mt76->chainmask);
+	*cap = &phy->mt76->sband_5g.sband.vht_cap.cap;
 
 	*cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
 		IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE |
@@ -637,25 +656,14 @@ int mt7915_register_device(struct mt7915_dev *dev)
 		return ret;
 
 	mt7915_init_wiphy(hw);
-	dev->mphy.sband_2g.sband.ht_cap.cap |=
-			IEEE80211_HT_CAP_LDPC_CODING |
-			IEEE80211_HT_CAP_MAX_AMSDU;
-	dev->mphy.sband_5g.sband.ht_cap.cap |=
-			IEEE80211_HT_CAP_LDPC_CODING |
-			IEEE80211_HT_CAP_MAX_AMSDU;
-	dev->mphy.sband_5g.sband.vht_cap.cap |=
-			IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
-			IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
+
 	if (!dev->dbdc_support)
 		dev->mphy.sband_5g.sband.vht_cap.cap |=
 			IEEE80211_VHT_CAP_SHORT_GI_160 |
 			IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
+
 	dev->mphy.hw->wiphy->available_antennas_rx = dev->mphy.chainmask;
 	dev->mphy.hw->wiphy->available_antennas_tx = dev->mphy.chainmask;
-
-	mt76_set_stream_caps(&dev->mphy, true);
-	mt7915_set_stream_vht_txbf_caps(&dev->phy);
-	mt7915_set_stream_he_caps(&dev->phy);
 	dev->phy.dfs_state = -1;
 
 #ifdef CONFIG_NL80211_TESTMODE
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] mt76: mt7615: add missing capabilities for DBDC
  2021-02-25 14:58 [PATCH v2 1/2] mt76: mt7915: add missing capabilities for DBDC Ryder Lee
@ 2021-02-25 14:58 ` Ryder Lee
  2021-03-10  8:30 ` [kbuild] Re: [PATCH v2 1/2] mt76: mt7915: " Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Ryder Lee @ 2021-02-25 14:58 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi
  Cc: Shayne Chen, linux-wireless, linux-mediatek, Ryder Lee

Same as mt7915, this should improve performance.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
change since v2 - adjust setup sequence.
---
 .../net/wireless/mediatek/mt76/mt7615/init.c    | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
index 88a2ee7e7143..bc908514a510 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
@@ -368,6 +368,17 @@ mt7615_init_wiphy(struct ieee80211_hw *hw)
 		hw->max_tx_fragments = MT_TXP_MAX_BUF_NUM;
 	else
 		hw->max_tx_fragments = MT_HW_TXP_MAX_BUF_NUM;
+
+	if (phy->mt76->cap.has_2ghz)
+		phy->mt76->sband_2g.sband.ht_cap.cap |=
+			IEEE80211_HT_CAP_LDPC_CODING;
+
+	if (phy->mt76->cap.has_5ghz) {
+		phy->mt76->sband_5g.sband.ht_cap.cap |=
+			IEEE80211_HT_CAP_LDPC_CODING;
+		phy->mt76->sband_5g.sband.vht_cap.cap |=
+			IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
+	}
 }
 
 static void
@@ -424,7 +435,6 @@ int mt7615_register_ext_phy(struct mt7615_dev *dev)
 	phy->mt76 = mphy;
 	mphy->chainmask = dev->chainmask & ~dev->mphy.chainmask;
 	mphy->antenna_mask = BIT(hweight8(mphy->chainmask)) - 1;
-	mt7615_init_wiphy(mphy->hw);
 
 	INIT_DELAYED_WORK(&mphy->mac_work, mt7615_mac_work);
 	INIT_DELAYED_WORK(&phy->scan_work, mt7615_scan_work);
@@ -448,6 +458,7 @@ int mt7615_register_ext_phy(struct mt7615_dev *dev)
 
 	/* second phy can only handle 5 GHz */
 	mphy->cap.has_5ghz = true;
+	mt7615_init_wiphy(mphy->hw);
 
 	/* mt7615 second phy shares the same hw queues with the primary one */
 	for (i = 0; i <= MT_TXQ_PSD ; i++)
@@ -505,10 +516,6 @@ void mt7615_init_device(struct mt7615_dev *dev)
 
 	mt7615_init_wiphy(hw);
 	dev->pm.idle_timeout = MT7615_PM_TIMEOUT;
-	dev->mphy.sband_2g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
-	dev->mphy.sband_5g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
-	dev->mphy.sband_5g.sband.vht_cap.cap |=
-			IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
 	mt7615_cap_dbdc_disable(dev);
 	dev->phy.dfs_state = -1;
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [kbuild] Re: [PATCH v2 1/2] mt76: mt7915: add missing capabilities for DBDC
  2021-02-25 14:58 [PATCH v2 1/2] mt76: mt7915: add missing capabilities for DBDC Ryder Lee
  2021-02-25 14:58 ` [PATCH v2 2/2] mt76: mt7615: " Ryder Lee
@ 2021-03-10  8:30 ` Dan Carpenter
  2021-03-10  8:54   ` Ryder Lee
  1 sibling, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2021-03-10  8:30 UTC (permalink / raw)
  To: kbuild, Ryder Lee, Felix Fietkau, Lorenzo Bianconi
  Cc: lkp, kbuild-all, Shayne Chen, linux-wireless, linux-mediatek,
	Ryder Lee

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

Hi Ryder,

url:    https://github.com/0day-ci/linux/commits/Ryder-Lee/mt76-mt7915-add-missing-capabilities-for-DBDC/20210225-230323 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git  master
config: x86_64-randconfig-m001-20210309 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/net/wireless/mediatek/mt76/mt7915/init.c:353 mt7915_set_stream_vht_txbf_caps() error: potentially dereferencing uninitialized 'cap'.

vim +/cap +353 drivers/net/wireless/mediatek/mt76/mt7915/init.c

00b2e16e006390 Ryder Lee 2020-05-12  344  void mt7915_set_stream_vht_txbf_caps(struct mt7915_phy *phy)
00b2e16e006390 Ryder Lee 2020-05-12  345  {
50a6fe79623e22 Ryder Lee 2021-02-25  346  	int nss;
50a6fe79623e22 Ryder Lee 2021-02-25  347  	u32 *cap;
50a6fe79623e22 Ryder Lee 2021-02-25  348  
50a6fe79623e22 Ryder Lee 2021-02-25  349  	if (!phy->mt76->cap.has_5ghz)
50a6fe79623e22 Ryder Lee 2021-02-25  350  		return;
50a6fe79623e22 Ryder Lee 2021-02-25  351  
50a6fe79623e22 Ryder Lee 2021-02-25  352  	nss = hweight8(phy->mt76->chainmask);
50a6fe79623e22 Ryder Lee 2021-02-25 @353  	*cap = &phy->mt76->sband_5g.sband.vht_cap.cap;
                                                ^^^^
"cap" isn't initialized.

00b2e16e006390 Ryder Lee 2020-05-12  354  
00b2e16e006390 Ryder Lee 2020-05-12  355  	*cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
00b2e16e006390 Ryder Lee 2020-05-12  356  		IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE |
00b2e16e006390 Ryder Lee 2020-05-12  357  		(3 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
00b2e16e006390 Ryder Lee 2020-05-12  358  
00b2e16e006390 Ryder Lee 2020-05-12  359  	*cap &= ~(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK |
00b2e16e006390 Ryder Lee 2020-05-12  360  		  IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
00b2e16e006390 Ryder Lee 2020-05-12  361  		  IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE);
00b2e16e006390 Ryder Lee 2020-05-12  362  
00b2e16e006390 Ryder Lee 2020-05-12  363  	if (nss < 2)
00b2e16e006390 Ryder Lee 2020-05-12  364  		return;
00b2e16e006390 Ryder Lee 2020-05-12  365  
00b2e16e006390 Ryder Lee 2020-05-12  366  	*cap |= IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
00b2e16e006390 Ryder Lee 2020-05-12  367  		IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE |
00b2e16e006390 Ryder Lee 2020-05-12  368  		FIELD_PREP(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK,
00b2e16e006390 Ryder Lee 2020-05-12  369  			   nss - 1);
00b2e16e006390 Ryder Lee 2020-05-12  370  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org 

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41137 bytes --]

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kbuild] Re: [PATCH v2 1/2] mt76: mt7915: add missing capabilities for DBDC
  2021-03-10  8:30 ` [kbuild] Re: [PATCH v2 1/2] mt76: mt7915: " Dan Carpenter
@ 2021-03-10  8:54   ` Ryder Lee
  0 siblings, 0 replies; 4+ messages in thread
From: Ryder Lee @ 2021-03-10  8:54 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kbuild, Felix Fietkau, Lorenzo Bianconi, lkp, kbuild-all,
	Shayne Chen, linux-wireless, linux-mediatek

On Wed, 2021-03-10 at 11:30 +0300, Dan Carpenter wrote:
> Hi Ryder,
> 
> url:    https://github.com/0day-ci/linux/commits/Ryder-Lee/mt76-mt7915-add-missing-capabilities-for-DBDC/20210225-230323 
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git  master
> config: x86_64-randconfig-m001-20210309 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> smatch warnings:
> drivers/net/wireless/mediatek/mt76/mt7915/init.c:353 mt7915_set_stream_vht_txbf_caps() error: potentially dereferencing uninitialized 'cap'.
> 
> vim +/cap +353 drivers/net/wireless/mediatek/mt76/mt7915/init.c
> 
> 00b2e16e006390 Ryder Lee 2020-05-12  344  void mt7915_set_stream_vht_txbf_caps(struct mt7915_phy *phy)
> 00b2e16e006390 Ryder Lee 2020-05-12  345  {
> 50a6fe79623e22 Ryder Lee 2021-02-25  346  	int nss;
> 50a6fe79623e22 Ryder Lee 2021-02-25  347  	u32 *cap;
> 50a6fe79623e22 Ryder Lee 2021-02-25  348  
> 50a6fe79623e22 Ryder Lee 2021-02-25  349  	if (!phy->mt76->cap.has_5ghz)
> 50a6fe79623e22 Ryder Lee 2021-02-25  350  		return;
> 50a6fe79623e22 Ryder Lee 2021-02-25  351  
> 50a6fe79623e22 Ryder Lee 2021-02-25  352  	nss = hweight8(phy->mt76->chainmask);
> 50a6fe79623e22 Ryder Lee 2021-02-25 @353  	*cap = &phy->mt76->sband_5g.sband.vht_cap.cap;
>                                                 ^^^^
> "cap" isn't initialized.

This has been fixed in v3
https://patchwork.kernel.org/project/linux-mediatek/patch/427ab5a2a79b8bbfa05225cfe4cfb55b3f143c8c.1614357346.git.ryder.lee@mediatek.com/

Ryder


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-10  8:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-25 14:58 [PATCH v2 1/2] mt76: mt7915: add missing capabilities for DBDC Ryder Lee
2021-02-25 14:58 ` [PATCH v2 2/2] mt76: mt7615: " Ryder Lee
2021-03-10  8:30 ` [kbuild] Re: [PATCH v2 1/2] mt76: mt7915: " Dan Carpenter
2021-03-10  8:54   ` Ryder Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).