All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mt76: mt7615: disable hw/sched scan ops for non-offload firmware
@ 2020-04-09 10:36 Felix Fietkau
  2020-04-09 10:36 ` [PATCH v2 2/2] mt76: mt7615: set hw scan limits only for firmware with offload support Felix Fietkau
  2020-04-09 21:12 ` [PATCH v2 1/2] mt76: mt7615: disable hw/sched scan ops for non-offload firmware kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Felix Fietkau @ 2020-04-09 10:36 UTC (permalink / raw)
  To: linux-wireless

Avoid having to attempt hw scan and fall back to software for every scan
on devices/firmware without hw scan support

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt7615/init.c   | 7 +++++++
 drivers/net/wireless/mediatek/mt76/mt7615/mmio.c   | 8 +++++++-
 drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h | 1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
index 07d4b259fe8a..7f3683205b8e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
@@ -143,6 +143,13 @@ static void mt7615_init_work(struct work_struct *work)
 	mt7615_mac_init(dev);
 	mt7615_phy_init(dev);
 	mt7615_mcu_del_wtbl_all(dev);
+
+	if (!mt7615_firmware_offload(dev)) {
+		dev->ops->hw_scan = NULL;
+		dev->ops->cancel_hw_scan = NULL;
+		dev->ops->sched_scan_start = NULL;
+		dev->ops->sched_scan_stop = NULL;
+	}
 }
 
 static int mt7615_init_hardware(struct mt7615_dev *dev)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c
index d2eff5442824..3849bb6b49d0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c
@@ -139,11 +139,16 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
 		.sta_remove = mt7615_mac_sta_remove,
 		.update_survey = mt7615_update_channel,
 	};
+	struct ieee80211_ops *ops;
 	struct mt7615_dev *dev;
 	struct mt76_dev *mdev;
 	int ret;
 
-	mdev = mt76_alloc_device(pdev, sizeof(*dev), &mt7615_ops, &drv_ops);
+	ops = devm_kmemdup(pdev, &mt7615_ops, sizeof(mt7615_ops), GFP_KERNEL);
+	if (!ops)
+		return -ENOMEM;
+
+	mdev = mt76_alloc_device(pdev, sizeof(*dev), ops, &drv_ops);
 	if (!mdev)
 		return -ENOMEM;
 
@@ -151,6 +156,7 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
 	mt76_mmio_init(&dev->mt76, mem_base);
 
 	dev->reg_map = map;
+	dev->ops = ops;
 	mdev->rev = (mt76_rr(dev, MT_HW_CHIPID) << 16) |
 		    (mt76_rr(dev, MT_HW_REV) & 0xff);
 	dev_dbg(mdev->dev, "ASIC revision: %04x\n", mdev->rev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
index 65a2b30fc588..4f0d29e5e595 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
@@ -235,6 +235,7 @@ struct mt7615_dev {
 
 	u16 chainmask;
 
+	struct ieee80211_ops *ops;
 	const struct mt7615_mcu_ops *mcu_ops;
 	struct regmap *infracfg;
 	const u32 *reg_map;
-- 
2.24.0


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

* [PATCH v2 2/2] mt76: mt7615: set hw scan limits only for firmware with offload support
  2020-04-09 10:36 [PATCH v2 1/2] mt76: mt7615: disable hw/sched scan ops for non-offload firmware Felix Fietkau
@ 2020-04-09 10:36 ` Felix Fietkau
  2020-04-09 21:12 ` [PATCH v2 1/2] mt76: mt7615: disable hw/sched scan ops for non-offload firmware kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: Felix Fietkau @ 2020-04-09 10:36 UTC (permalink / raw)
  To: linux-wireless

They do not apply to software scan

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt7615/init.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
index 7f3683205b8e..96b7c6284833 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
@@ -145,10 +145,19 @@ static void mt7615_init_work(struct work_struct *work)
 	mt7615_mcu_del_wtbl_all(dev);
 
 	if (!mt7615_firmware_offload(dev)) {
+		struct wiphy *wiphy = mt76_hw(dev)->wiphy;
+
 		dev->ops->hw_scan = NULL;
 		dev->ops->cancel_hw_scan = NULL;
 		dev->ops->sched_scan_start = NULL;
 		dev->ops->sched_scan_stop = NULL;
+
+		wiphy->max_sched_scan_plan_interval = 0;
+		wiphy->max_sched_scan_ie_len = 0;
+		wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
+		wiphy->max_sched_scan_ssids = 0;
+		wiphy->max_match_sets = 0;
+		wiphy->max_sched_scan_reqs = 0;
 	}
 }
 
-- 
2.24.0


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

* Re: [PATCH v2 1/2] mt76: mt7615: disable hw/sched scan ops for non-offload firmware
  2020-04-09 10:36 [PATCH v2 1/2] mt76: mt7615: disable hw/sched scan ops for non-offload firmware Felix Fietkau
  2020-04-09 10:36 ` [PATCH v2 2/2] mt76: mt7615: set hw scan limits only for firmware with offload support Felix Fietkau
@ 2020-04-09 21:12 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-04-09 21:12 UTC (permalink / raw)
  To: kbuild-all

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

Hi Felix,

I love your patch! Yet something to improve:

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on wireless-drivers/master next-20200409]
[cannot apply to v5.6]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Felix-Fietkau/mt76-mt7615-disable-hw-sched-scan-ops-for-non-offload-firmware/20200410-021226
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/wireless/mediatek/mt76/mt7615/init.c: In function 'mt7615_init_work':
>> drivers/net/wireless/mediatek/mt76/mt7615/init.c:144:7: error: implicit declaration of function 'mt7615_firmware_offload' [-Werror=implicit-function-declaration]
     144 |  if (!mt7615_firmware_offload(dev)) {
         |       ^~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/mt7615_firmware_offload +144 drivers/net/wireless/mediatek/mt76/mt7615/init.c

   131	
   132	static void mt7615_init_work(struct work_struct *work)
   133	{
   134		struct mt7615_dev *dev = container_of(work, struct mt7615_dev, mcu_work);
   135	
   136		if (mt7615_mcu_init(dev))
   137			return;
   138	
   139		mt7615_mcu_set_eeprom(dev);
   140		mt7615_mac_init(dev);
   141		mt7615_phy_init(dev);
   142		mt7615_mcu_del_wtbl_all(dev);
   143	
 > 144		if (!mt7615_firmware_offload(dev)) {
   145			dev->ops->hw_scan = NULL;
   146			dev->ops->cancel_hw_scan = NULL;
   147			dev->ops->sched_scan_start = NULL;
   148			dev->ops->sched_scan_stop = NULL;
   149		}
   150	}
   151	

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

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

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

end of thread, other threads:[~2020-04-09 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-09 10:36 [PATCH v2 1/2] mt76: mt7615: disable hw/sched scan ops for non-offload firmware Felix Fietkau
2020-04-09 10:36 ` [PATCH v2 2/2] mt76: mt7615: set hw scan limits only for firmware with offload support Felix Fietkau
2020-04-09 21:12 ` [PATCH v2 1/2] mt76: mt7615: disable hw/sched scan ops for non-offload firmware kbuild test robot

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.