Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] mac80211: handle deauthentication/disassociation from TDLS peer
From: Yu Wang @ 2019-05-10  9:04 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Yu Wang

When receiving a deauthentication/disassociation frame from a TDLS
peer, a station should not disconnect the current AP, but only
disable the current TDLS link if it's enabled.

Without this change, a TDLS issue can be reproduced by following the
steps as below:

1. STA-1 and STA-2 are connected to AP, bidirection traffic is running
   between STA-1 and STA-2.
2. Set up TDLS link between STA-1 and STA-2, stay for a while, then
   teardown TDLS link.
3. Repeat step #2 and monitor the connection between STA and AP.

During the test, one STA may send a deauthentication/disassociation
frame to another, after TDLS teardown, with reason code 6/7, which
means: Class 2/3 frame received from nonassociated STA.

On receive this frame, the receiver STA will disconnect the current
AP and then reconnect. It's not a expected behavior, purpose of this
frame should be disabling the TDLS link, not the link with AP.

Signed-off-by: Yu Wang <yyuwang@codeaurora.org>
---
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/mlme.c        | 12 +++++++++++-
 net/mac80211/tdls.c        | 23 +++++++++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 861bf83..3a360b0 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -2223,6 +2223,9 @@ void ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy,
 					  const u8 *addr);
 void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata);
 void ieee80211_tdls_chsw_work(struct work_struct *wk);
+void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata,
+				      const u8 *peer, u16 reason);
+const char *ieee80211_get_reason_code_string(u16 reason_code);
 
 extern const struct ethtool_ops ieee80211_ethtool_ops;
 
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index b7a9fe3..383b0df 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2963,7 +2963,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
 #define case_WLAN(type) \
 	case WLAN_REASON_##type: return #type
 
-static const char *ieee80211_get_reason_code_string(u16 reason_code)
+const char *ieee80211_get_reason_code_string(u16 reason_code)
 {
 	switch (reason_code) {
 	case_WLAN(UNSPECIFIED);
@@ -3028,6 +3028,11 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
 	if (len < 24 + 2)
 		return;
 
+	if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) {
+		ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code);
+		return;
+	}
+
 	if (ifmgd->associated &&
 	    ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) {
 		const u8 *bssid = ifmgd->associated->bssid;
@@ -3077,6 +3082,11 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
 
 	reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
 
+	if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) {
+		ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code);
+		return;
+	}
+
 	sdata_info(sdata, "disassociated from %pM (Reason: %u=%s)\n",
 		   mgmt->sa, reason_code,
 		   ieee80211_get_reason_code_string(reason_code));
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index d30690d..fcc5cd4 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -1994,3 +1994,26 @@ void ieee80211_tdls_chsw_work(struct work_struct *wk)
 	}
 	rtnl_unlock();
 }
+
+void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata,
+				      const u8 *peer, u16 reason)
+{
+	struct ieee80211_sta *sta;
+
+	rcu_read_lock();
+	sta = ieee80211_find_sta(&sdata->vif, peer);
+	if (!sta || !sta->tdls) {
+		rcu_read_unlock();
+		return;
+	}
+	rcu_read_unlock();
+
+	tdls_dbg(sdata, "disconnected from TDLS peer %pM (Reason: %u=%s)\n",
+		 peer, reason,
+		 ieee80211_get_reason_code_string(reason));
+
+	ieee80211_tdls_oper_request(&sdata->vif, peer,
+				    NL80211_TDLS_TEARDOWN,
+				    WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE,
+				    GFP_ATOMIC);
+}
-- 
2.7.4


^ permalink raw reply related

* Re: [PATCH 03/16] lib,treewide: add new match_string() helper/macro
From: Ardelean, Alexandru @ 2019-05-10  9:15 UTC (permalink / raw)
  To: andriy.shevchenko@linux.intel.com, gregkh@linuxfoundation.org
  Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-ide@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-mmc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	cgroups@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	linux-pm@vger.kernel.org, linux-mm@kvack.org,
	linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-security-module@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-integrity@vger.kernel.org, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	alsa-devel@alsa-project.org, linux-rockchip@lists.infradead.org,
	linux-clk@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-wireless@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-tegra@vger.kernel.org
In-Reply-To: <b2440bc9485456a7a90a488c528997587b22088b.camel@analog.com>

On Wed, 2019-05-08 at 16:22 +0300, Alexandru Ardelean wrote:
> On Wed, 2019-05-08 at 15:18 +0200, Greg KH wrote:
> > 
> > 
> > On Wed, May 08, 2019 at 04:11:28PM +0300, Andy Shevchenko wrote:
> > > On Wed, May 08, 2019 at 02:28:29PM +0300, Alexandru Ardelean wrote:
> > > > This change re-introduces `match_string()` as a macro that uses
> > > > ARRAY_SIZE() to compute the size of the array.
> > > > The macro is added in all the places that do
> > > > `match_string(_a, ARRAY_SIZE(_a), s)`, since the change is pretty
> > > > straightforward.
> > > 
> > > Can you split include/linux/ change from the rest?
> > 
> > That would break the build, why do you want it split out?  This makes
> > sense all as a single patch to me.
> > 
> 
> Not really.
> It would be just be the new match_string() helper/macro in a new commit.
> And the conversions of the simple users of match_string() (the ones using
> ARRAY_SIZE()) in another commit.
> 

I should have asked in my previous reply.
Leave this as-is or re-formulate in 2 patches ?

No strong preference from my side.

Thanks
Alex

> Thanks
> Alex
> 
> > thanks,
> > 
> > greg k-h

^ permalink raw reply

* [PATCH net 5/5] net: wireless: mt76: fix similar warning reported by kbuild test robot
From: Petr Štetiar @ 2019-05-10  9:35 UTC (permalink / raw)
  To: netdev, Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Roy Luo,
	Kalle Valo, David S. Miller, Matthias Brugger
  Cc: Andrew Lunn, Rob Herring, Petr Štetiar, linux-wireless,
	linux-arm-kernel, linux-mediatek, linux-kernel
In-Reply-To: <1557480918-9627-1-git-send-email-ynezz@true.cz>

This patch fixes following (similar) warning reported by kbuild test robot:

 In function ‘memcpy’,
  inlined from ‘smsc75xx_init_mac_address’ at drivers/net/usb/smsc75xx.c:778:3,
  inlined from ‘smsc75xx_bind’ at drivers/net/usb/smsc75xx.c:1501:2:
  ./include/linux/string.h:355:9: warning: argument 2 null where non-null expected [-Wnonnull]
  return __builtin_memcpy(p, q, size);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  drivers/net/usb/smsc75xx.c: In function ‘smsc75xx_bind’:
  ./include/linux/string.h:355:9: note: in a call to built-in function ‘__builtin_memcpy’

I've replaced the offending memcpy with ether_addr_copy, because I'm
100% sure, that of_get_mac_address can't return NULL as it returns valid
pointer or ERR_PTR encoded value, nothing else.

I'm hesitant to just change IS_ERR into IS_ERR_OR_NULL check, as this
would make the warning disappear also, but it would be confusing to
check for impossible return value just to make a compiler happy.

I'm now changing all occurencies of memcpy to ether_addr_copy after the
of_get_mac_address call, as it's very likely, that we're going to get
similar reports from kbuild test robot in the future.

Fixes: d31a36b5f407 ("net: wireless: support of_get_mac_address new ERR_PTR error")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 drivers/net/wireless/mediatek/mt76/eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c
index 04964937a3af..b7a49ae6b327 100644
--- a/drivers/net/wireless/mediatek/mt76/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
@@ -95,7 +95,7 @@
 
 	mac = of_get_mac_address(np);
 	if (!IS_ERR(mac))
-		memcpy(dev->macaddr, mac, ETH_ALEN);
+		ether_addr_copy(dev->macaddr, mac);
 #endif
 
 	if (!is_valid_ether_addr(dev->macaddr)) {
-- 
1.9.1


^ permalink raw reply related

* [PATCH net 2/5] dt-bindings: doc: net: remove Linux API references
From: Petr Štetiar @ 2019-05-10  9:35 UTC (permalink / raw)
  To: netdev, David S. Miller, Rob Herring, Mark Rutland, Kalle Valo,
	Matthias Brugger
  Cc: Andrew Lunn, Rob Herring, Petr Štetiar, devicetree,
	linux-kernel, linux-wireless, linux-arm-kernel, linux-mediatek
In-Reply-To: <1557480918-9627-1-git-send-email-ynezz@true.cz>

In commit 687e3d5550c7 ("dt-bindings: doc: reflect new NVMEM
of_get_mac_address behaviour") I've kept or added references to Linux
of_get_mac_address API which is unwanted so this patch fixes that by
removing those references.

Fixes: 687e3d5550c7 ("dt-bindings: doc: reflect new NVMEM of_get_mac_address behaviour")
Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 Documentation/devicetree/bindings/net/keystone-netcp.txt         | 6 +++---
 Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/keystone-netcp.txt b/Documentation/devicetree/bindings/net/keystone-netcp.txt
index 3a65aabc76a2..6262c2f293b0 100644
--- a/Documentation/devicetree/bindings/net/keystone-netcp.txt
+++ b/Documentation/devicetree/bindings/net/keystone-netcp.txt
@@ -139,9 +139,9 @@ Optional properties:
 			sub-module attached to this interface.
 
 The MAC address will be determined using the optional properties defined in
-ethernet.txt, as provided by the of_get_mac_address API and only if efuse-mac
-is set to 0. If any of the optional MAC address properties are not present,
-then the driver will use random MAC address.
+ethernet.txt and only if efuse-mac is set to 0. If all of the optional MAC
+address properties are not present, then the driver will use a random MAC
+address.
 
 Example binding:
 
diff --git a/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt b/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt
index 74665502f4cf..7e675dafc256 100644
--- a/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt
+++ b/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt
@@ -16,8 +16,8 @@ Optional properties:
 - ieee80211-freq-limit: See ieee80211.txt
 - mediatek,mtd-eeprom: Specify a MTD partition + offset containing EEPROM data
 
-The driver is using of_get_mac_address API, so the MAC address can be as well
-be set with corresponding optional properties defined in net/ethernet.txt.
+The MAC address can as well be set with corresponding optional properties
+defined in net/ethernet.txt.
 
 Optional nodes:
 - led: Properties for a connected LED
-- 
1.9.1


^ permalink raw reply related

* Re: [PATCH] NFC: fix attrs checks in netlink interface
From: Andrey Konovalov @ 2019-05-10 12:25 UTC (permalink / raw)
  To: Samuel Ortiz, David S . Miller, linux-wireless, netdev
  Cc: LKML, Dmitry Vyukov, Kostya Serebryany
In-Reply-To: <CAAeHK+yvf-LqrfdQ18FMzaCNqdNHqAjgrDMrwUReZq8ei=hTYQ@mail.gmail.com>

From: Andrey Konovalov <andreyknvl@google.com>
Date: Wed, Jan 2, 2019 at 4:30 PM
To: Samuel Ortiz
Cc: David S . Miller, <linux-wireless@vger.kernel.org>, netdev, LKML,
Dmitry Vyukov, Kostya Serebryany

> On Mon, Jun 4, 2018 at 6:29 AM Samuel Ortiz <sameo@linux.intel.com> wrote:
> >
> > Hi Andrey,
> >
> > On Thu, Apr 12, 2018 at 06:56:56PM +0200, Andrey Konovalov wrote:
> > > nfc_genl_deactivate_target() relies on the NFC_ATTR_TARGET_INDEX
> > > attribute being present, but doesn't check whether it is actually
> > > provided by the user. Same goes for nfc_genl_fw_download() and
> > > NFC_ATTR_FIRMWARE_NAME.
> > >
> > > This patch adds appropriate checks.
> > >
> > > Found with syzkaller.
> > >
> > > Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
> > > ---
> > >  net/nfc/netlink.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > Thanks, applied to nfc-next.
>
> Hi Samuel,
>
> It's been 6 months and this fix is still not in mainline. Did it get lost?

More than a year passed since I've sent this patch, it's still sitting
in the nfc-next tree which hasn't been updated since June last year.
Did NFC stopped being maintained?

>
> Thanks!
>
> >
> > Cheers,
> > Samuel.

^ permalink raw reply

* Re: [PATCH] mac80211: remove warning message
From: Ben Greear @ 2019-05-10 14:04 UTC (permalink / raw)
  To: Yibo Zhao, linux-wireless; +Cc: ath10k, Zhi Chen
In-Reply-To: <1557471662-1355-1-git-send-email-yiboz@codeaurora.org>



On 05/10/2019 12:01 AM, Yibo Zhao wrote:
> In multiple SSID cases, it takes time to prepare every AP interface
> to be ready in initializing phase. If a sta already knows everything it
> needs to join one of the APs and sends authentication to the AP which
> is not fully prepared at this point of time, AP's channel context
> could be NULL. As a result, warning message occurs.
>
> Even worse, if the AP is under attack via tools such as MDK3 and massive
> authentication requests are received in a very short time, console will
> be hung due to kernel warning messages.

Since it is a WARN_ON_ONCE, how it the console hang due to warnings?  You should
get no more than once per boot?

I have no problem with removing it though.  Seems a harmless splat and I removed
it from my tree some time back as well.

Thanks,
Ben

>
> If this case can be hit during normal functionality, there should be no
> WARN_ON(). Those should be reserved to cases that are not supposed to be
> hit at all or some other more specific cases like indicating obsolete
> interface.
>
> Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
> Signed-off-by: Yibo Zhao <yiboz@codeaurora.org>
> ---
>  net/mac80211/ieee80211_i.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index 2ae0364..f39c289 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -1435,7 +1435,7 @@ struct ieee80211_local {
>  	rcu_read_lock();
>  	chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
>
> -	if (WARN_ON_ONCE(!chanctx_conf)) {
> +	if (!chanctx_conf) {
>  		rcu_read_unlock();
>  		return NULL;
>  	}
>

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply

* Re: [PATCH 03/16] lib,treewide: add new match_string() helper/macro
From: andriy.shevchenko @ 2019-05-10 14:34 UTC (permalink / raw)
  To: Ardelean, Alexandru
  Cc: gregkh@linuxfoundation.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-mmc@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, cgroups@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, linux-pm@vger.kernel.org,
	linux-mm@kvack.org, linux-omap@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-security-module@vger.kernel.org,
	devel@driverdev.osuosl.org, linux-integrity@vger.kernel.org,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	alsa-devel@alsa-project.org, linux-rockchip@lists.infradead.org,
	linux-clk@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-wireless@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-tegra@vger.kernel.org
In-Reply-To: <4df165bc4247e60aa4952fd55cb0c77e60712767.camel@analog.com>

On Fri, May 10, 2019 at 09:15:27AM +0000, Ardelean, Alexandru wrote:
> On Wed, 2019-05-08 at 16:22 +0300, Alexandru Ardelean wrote:
> > On Wed, 2019-05-08 at 15:18 +0200, Greg KH wrote:
> > > On Wed, May 08, 2019 at 04:11:28PM +0300, Andy Shevchenko wrote:
> > > > On Wed, May 08, 2019 at 02:28:29PM +0300, Alexandru Ardelean wrote:

> > > > Can you split include/linux/ change from the rest?
> > > 
> > > That would break the build, why do you want it split out?  This makes
> > > sense all as a single patch to me.
> > > 
> > 
> > Not really.
> > It would be just be the new match_string() helper/macro in a new commit.
> > And the conversions of the simple users of match_string() (the ones using
> > ARRAY_SIZE()) in another commit.
> > 
> 
> I should have asked in my previous reply.
> Leave this as-is or re-formulate in 2 patches ?

Depends on on what you would like to spend your time: collecting Acks for all
pieces in treewide patch or send new API first followed up by per driver /
module update in next cycle.

I also have no strong preference.
And I think it's good to add Heikki Krogerus to Cc list for both patch series,
since he is the author of sysfs variant and may have something to comment on
the rest.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply

* mainline kernel brcmfmac regression
From: Andy Lavr @ 2019-05-10 14:34 UTC (permalink / raw)
  To: linux-wireless

Hi,


*Kernel 5.1 WiFi work fine:*

[   20.659502] brcmfmac: brcmf_fw_alloc_request: using 
brcm/brcmfmac43340-sdio for chip BCM43340/2

[   20.664444] usbcore: registered new interface driver brcmfmac

[   21.089209] brcmfmac: brcmf_fw_alloc_request: using 
brcm/brcmfmac43340-sdio for chip BCM43340/2

[   21.094169] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available 
(err=-2), device may have limited channels available

[   21.099805] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43340/2 
wl0: Oct 23 2017 08:41:23 version 6.10.190.70 (r674464) FWID 01-98d71006


*Kernel mainline* 
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/) 
*WiFi dont work:*


[   21.120466] brcmfmac: brcmf_fw_alloc_request: using 
brcm/brcmfmac43340-sdio for chip BCM43340/2

[   21.125156] usbcore: registered new interface driver brcmfmac


Same device and system.


Best regards, Andy Lavr.

^ permalink raw reply

* Re: ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Andy Shevchenko @ 2019-05-10 16:40 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Samuel Ortiz, linux-nfc, linux-wireless, Cristian Sovaiala,
	jgeslin, Oleg Zhurakivskyy
In-Reply-To: <CA+icZUX1N9zK_SGN-OyDVbZ1Jq9EjRxpOfQ0Oe0iSDwuEaJRfg@mail.gmail.com>

(+Cc: Oleg)

On Fri, May 10, 2019 at 09:43:29AM +0200, Sedat Dilek wrote:
> On Thu, May 9, 2019 at 3:46 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> >
> > Hi,
> >
> > I am here on Debian/buster AMD64 and Linux v5.1 final.
> >
> > I have successfully installed and tested the NXP NFC driver from
> > Lenovo under Windows 10 as a first step (see [1] and [2]).
> >
> > As a testcase I used my YubiKey which was recognized via NFC and I
> > could automatically register at the YubiKey demo website.
> >
> > Under Linux v5.1 I have activated all sort of CONFIG_NFC_XXX as
> > modules if available (see below and attached files).
> >
> > I am not sure if I need to load the PN544 (I2C) driver?
> >
> > I can see in /sys ...
> >
> > # cd /sys/bus/i2c/devices/i2c-NXP1001:00

> > The NXP NFC Windows driver lists (I have both firmware files copied to Linux)...
> > [Firmware.CopyFiles]
> > NXPPN548FW.DAT
> > NXPPN547FW.DAT

First of all it seems the driver lacks of ID. And the ID seems odd.
Looking for this ID in tables I see mention of NXP NPC100. The driver is
drivers/nfc/nxp-nci for it.

> > Last question: Do I need these firmware files installed?
> > Rename them?
> > Which directory - /lib/firmware?
> >
> > I ran out of ideas...
> >
> > Do you need more informations?
> >
> > I have attached my linux-config and the dmesg output.
> >
> > Thanks in advance.
> >
> > Kind regards,
> > - Sedat -
> >
> > [1] https://pcsupport.lenovo.com/us/de/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t470/downloads
> > [2] https://download.lenovo.com/pccbbs/mobiles/n1qnb04w.txt
> > [3] https://github.com/NXPNFCLinux/linux_libnfc-nci
> > [4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/nfc/nfc-hci.txt
> > [5] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/nfc/nfc-pn544.txt
> >
> > P.S.: Some interesting outputs and files
> >
> > [ LINUX-CONFIG ]
> >
> > $ grep NFC /boot/config-5.1.0-1-amd64-cbl-asmgoto | sort
> > CONFIG_IP_VS_NFCT=y
> > CONFIG_MLX5_EN_RXNFC=y
> > CONFIG_NFC_DIGITAL=m
> > CONFIG_NFC_FDP_I2C=m
> > CONFIG_NFC_FDP=m
> > CONFIG_NFC_HCI=m
> > CONFIG_NFC=m
> > CONFIG_NFC_MEI_PHY=m
> > CONFIG_NFC_MICROREAD_I2C=m
> > CONFIG_NFC_MICROREAD=m
> > CONFIG_NFC_MICROREAD_MEI=m
> > CONFIG_NFC_MRVL_I2C=m
> > CONFIG_NFC_MRVL=m
> > CONFIG_NFC_MRVL_SPI=m
> > CONFIG_NFC_MRVL_UART=m
> > CONFIG_NFC_MRVL_USB=m
> > CONFIG_NFC_NCI=m
> > CONFIG_NFC_NCI_SPI=m
> > CONFIG_NFC_NCI_UART=m
> > CONFIG_NFC_NXP_NCI_I2C=m
> > CONFIG_NFC_NXP_NCI=m
> > CONFIG_NFC_PN533_I2C=m
> > CONFIG_NFC_PN533=m
> > CONFIG_NFC_PN533_USB=m
> > CONFIG_NFC_PN544_I2C=m
> > CONFIG_NFC_PN544=m
> > CONFIG_NFC_PN544_MEI=m
> > CONFIG_NFC_PORT100=m
> > CONFIG_NFC_S3FWRN5_I2C=m
> > CONFIG_NFC_S3FWRN5=m
> > CONFIG_NFC_SHDLC=y
> > CONFIG_NFC_SIM=m
> > CONFIG_NFC_ST21NFCA_I2C=m
> > CONFIG_NFC_ST21NFCA=m
> > CONFIG_NFC_ST95HF=m
> > CONFIG_NFC_ST_NCI_I2C=m
> > CONFIG_NFC_ST_NCI=m
> > CONFIG_NFC_ST_NCI_SPI=m
> > CONFIG_NFC_TRF7970A=m
> > # Near Field Communication (NFC) devices
> >
> > [ WINDOWS 10 INF DRIVER ]
> >
> > $ cat NxpNfcClientDriver.inf
> > ��;
> > ; NxpNfcClientDriver.inf
> > ;
> >
> > [Version]
> > Signature="$Windows NT$"
> > Class=Proximity
> > ClassGuid={5630831C-06C9-4856-B327-F5D32586E060}
> > Provider=%ManufacturerName%
> > CatalogFile=NxpNfcClientDriver.cat
> > DriverVer=03/30/2018,12.0.3.0
> >
> > [Manufacturer]
> > %ManufacturerName%=Standard,NTamd64
> >
> > [Standard.NTamd64]
> > %DeviceName%=MyDevice_Install,ACPI\NXP1000
> > %DeviceName%=MyDevice_Install,ACPI\NXP1001
> > %DeviceName%=MyDevice_Install,ACPI\NXP1002
> > %DeviceName%=MyDevice_Install,ACPI\NXP1003
> > %DeviceName%=MyDevice_Install,ACPI\NXP7471
> > %DeviceName%=MyDevice_Install,ACPI\NXP8013
> > %DeviceName%=MyDevice_Install,ACPI\NXP3001
> >
> > [SourceDisksNames]
> > 1=%DiskName%
> >
> > [SourceDisksFiles]
> > NxpNfcClientDriver.dll=1
> > NXPPN548FW.DAT=1
> > NXPPN547FW.DAT=1
> >
> > ; =================== UMDF Device ==================================
> >
> > [MyDevice_Install.NT]
> > CopyFiles=UMDriverCopy,Firmware.CopyFiles
> > AddReg=NxpNfpProviderProximityCustomValuesRegister
> >
> > [MyDevice_Install.NT.hw]
> > AddReg=NxpNfcClientDriver_AddReg
> >
> > [MyDevice_Install.NT.Services]
> > AddService=WUDFRd,0x000001fa,WUDFRD_ServiceInstall
> >
> > [MyDevice_Install.NT.CoInstallers]
> > AddReg=CoInstallers_AddReg
> >
> > [MyDevice_Install.NT.Wdf]
> > UmdfService=NxpNfcClientDriver,NxpNfcClientDriver_Install
> > UmdfServiceOrder=NxpNfcClientDriver
> > UmdfDirectHardwareAccess=AllowDirectHardwareAccess
> > UmdfFileObjectPolicy=AllowNullAndUnknownFileObjects
> > UmdfImpersonationLevel=Impersonation
> >
> > [NxpNfcClientDriver_Install]
> > UmdfLibraryVersion=2.0.0
> > ServiceBinary=%12%\UMDF\NxpNfcClientDriver.dll
> > UmdfExtensions=NfcCx0102
> >
> > [NxpNfcClientDriver_AddReg]
> > HKR,FirmwareMap,"8",0x00020000,"%%SystemRoot%%\System32\NXPPN547FW.dat"
> > ; HW version of PN547 is 8
> > HKR,FirmwareMap,"10",0x00020000,"%%SystemRoot%%\System32\NXPPN548FW.dat"
> > ; HW version of PN548 is 10
> > HKR,NxpNfcClientDriver, "RfConfigData",            0x00000001, 00
> > HKR,NxpNfcClientDriver, "EEPROMConfigBlob",        0x00000001, 00
> > HKR,NxpNfcClientDriver, "RfSessionMgmt",           0x00010001, 1
> > HKR,NxpNfcClientDriver, "KeepRfData",              0x00010001, 1
> >
> > ; ============== custom registry sections ==================
> >
> > [NxpNfpProviderProximityCustomValuesRegister]
> > HKLM,"SYSTEM\CurrentControlSet\Proximity\","Dummy",0x00000010,0
> >
> >
> > [NxpNfpProviderProximityCustomValuesRegister.Security]
> > "D:P(A;OICI;GA;;;LS)(A;;GA;;;BA)(A;;GA;;;SY)"
> >
> > [WUDFRD_ServiceInstall]
> > DisplayName=%WudfRdDisplayName%
> > ServiceType=1
> > StartType=3
> > ErrorControl=1
> > ServiceBinary=%12%\WUDFRd.sys
> >
> > [CoInstallers_AddReg]
> > HKR,,CoInstallers32,0x00010000,"WUDFCoinstaller.dll"
> >
> >
> > [DestinationDirs]
> > UMDriverCopy=12,UMDF ; copy to Drivers\UMDF
> > Firmware.CopyFiles=11
> >
> > [UMDriverCopy]
> > NxpNfcClientDriver.dll,,,0x100
> >
> > [Firmware.CopyFiles]
> > NXPPN548FW.DAT
> > NXPPN547FW.DAT
> >
> > [ControlFlags]
> > ExcludeFromSelect=*
> >
> > ; =================== Generic ==================================
> >
> > [Strings]
> > ManufacturerName="NXP Semiconductors"
> > DiskName="NxpNfcClientDriver Installation Disk"
> > WudfRdDisplayName="NxpNfcClientDriver"
> > DeviceName="NxpNfcClientDriver"
> >
> > - EOT -
> 
> [ CC Cristian and Jeremy of NXP ]
> 
> What Linux-kernel configs do I need that PN544 I2C NFC driver works?
> 
> Additionally, I have set CONFIG_I2C_GPIO=m.
> 
> What else is important to be activated?
> 
> Thanks.
> 
> - Sedat -



-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply

* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Oleg Zhurakivskyy @ 2019-05-10 18:55 UTC (permalink / raw)
  To: sedat.dilek; +Cc: Samuel Ortiz, Andy Shevchenko, linux-wireless, linux-nfc
In-Reply-To: <CA+icZUX+VNtk00YQnNYCnDeeH2Onq6s1vbdzYrv-OHf7q186Ww@mail.gmail.com>


Hi Sedat,

I would like to help you, but at the same time not to mislead, as it’s been a time since I touched that.

So take everything with a grain of salt and correct me where I might be wrong/forgot.

> I am not sure if I need to load the PN544 (I2C) driver?

Yes, the driver is needed, for PN547 it’s NXP NPC100, the driver is drivers/nfc/nxp-nci.

> Do I need these firmware files installed?

To start with, i.e. for a simple signal through like reading a tag, most likely not (the chip is usually provisioned with some FW).

Regards,
Oleg

^ permalink raw reply

* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Sedat Dilek @ 2019-05-10 19:40 UTC (permalink / raw)
  To: Oleg Zhurakivskyy
  Cc: Samuel Ortiz, Andy Shevchenko, linux-wireless, linux-nfc
In-Reply-To: <154e3e74-38b5-850b-5993-295f9db8fe3c@intel.com>

On Fri, May 10, 2019 at 8:56 PM Oleg Zhurakivskyy
<oleg.zhurakivskyy@intel.com> wrote:
>
>
> Hi Sedat,
>
> I would like to help you, but at the same time not to mislead, as it’s been a time since I touched that.
>
> So take everything with a grain of salt and correct me where I might be wrong/forgot.
>
> > I am not sure if I need to load the PN544 (I2C) driver?
>
> Yes, the driver is needed, for PN547 it’s NXP NPC100, the driver is drivers/nfc/nxp-nci.
>
> > Do I need these firmware files installed?
>
> To start with, i.e. for a simple signal through like reading a tag, most likely not (the chip is usually provisioned with some FW).
>

Hi Oleg,

thanks for all the informations...

# modprobe -v nxp-nci_i2c

...gives me...

# lsmod | egrep 'nfc|rfkill|pn544|i2c|gpio|mei|nxp|nci' | sort
i2c_algo_bit           24576  1 i915
i2c_dev                24576  0
i2c_i801               32768  0
mei                   118784  1 mei_me
mei_me                 36864  0
nci                    77824  2 nxp_nci,nxp_nci_i2c
nfc                   122880  2 nci,nxp_nci
nxp_nci                16384  1 nxp_nci_i2c
nxp_nci_i2c            16384  0
rfkill                 32768  10 nfc,bluetooth,thinkpad_acpi,cfg80211

What userspace do I need?

I tried...

# rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
        Soft blocked: no
        Hard blocked: no
1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
2: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no

# nfc-list
nfc-list uses libnfc 1.7.1
No NFC device found.

# nfc-scan-device
nfc-scan-device uses libnfc 1.7.1
No NFC device found.

> To start with, i.e. for a simple signal through like reading a tag, most likely not (the chip is usually provisioned with some FW).

Can you guide me how to do that?

Thanks!

Regards,
- Sedat -

^ permalink raw reply

* Re: ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Sedat Dilek @ 2019-05-10 19:51 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Samuel Ortiz, linux-nfc, linux-wireless, Cristian Sovaiala,
	jgeslin, Oleg Zhurakivskyy
In-Reply-To: <20190510164030.GG9224@smile.fi.intel.com>

On Fri, May 10, 2019 at 6:40 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> (+Cc: Oleg)
>
> On Fri, May 10, 2019 at 09:43:29AM +0200, Sedat Dilek wrote:
> > On Thu, May 9, 2019 at 3:46 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > I am here on Debian/buster AMD64 and Linux v5.1 final.
> > >
> > > I have successfully installed and tested the NXP NFC driver from
> > > Lenovo under Windows 10 as a first step (see [1] and [2]).
> > >
> > > As a testcase I used my YubiKey which was recognized via NFC and I
> > > could automatically register at the YubiKey demo website.
> > >
> > > Under Linux v5.1 I have activated all sort of CONFIG_NFC_XXX as
> > > modules if available (see below and attached files).
> > >
> > > I am not sure if I need to load the PN544 (I2C) driver?
> > >
> > > I can see in /sys ...
> > >
> > > # cd /sys/bus/i2c/devices/i2c-NXP1001:00
>
> > > The NXP NFC Windows driver lists (I have both firmware files copied to Linux)...
> > > [Firmware.CopyFiles]
> > > NXPPN548FW.DAT
> > > NXPPN547FW.DAT
>
> First of all it seems the driver lacks of ID. And the ID seems odd.
> Looking for this ID in tables I see mention of NXP NPC100. The driver is
> drivers/nfc/nxp-nci for it.
>

Hi Andy,

what do you mean by "the driver lacks ID"?
Do you mean VendorID and ProductID?
How to get these informations?
Do I need to modify the linux kernel sources?

Thanks.

Regards,
- Sedat -

> > > Last question: Do I need these firmware files installed?
> > > Rename them?
> > > Which directory - /lib/firmware?
> > >
> > > I ran out of ideas...
> > >
> > > Do you need more informations?
> > >
> > > I have attached my linux-config and the dmesg output.
> > >
> > > Thanks in advance.
> > >
> > > Kind regards,
> > > - Sedat -
> > >
> > > [1] https://pcsupport.lenovo.com/us/de/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t470/downloads
> > > [2] https://download.lenovo.com/pccbbs/mobiles/n1qnb04w.txt
> > > [3] https://github.com/NXPNFCLinux/linux_libnfc-nci
> > > [4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/nfc/nfc-hci.txt
> > > [5] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/nfc/nfc-pn544.txt
> > >
> > > P.S.: Some interesting outputs and files
> > >
> > > [ LINUX-CONFIG ]
> > >
> > > $ grep NFC /boot/config-5.1.0-1-amd64-cbl-asmgoto | sort
> > > CONFIG_IP_VS_NFCT=y
> > > CONFIG_MLX5_EN_RXNFC=y
> > > CONFIG_NFC_DIGITAL=m
> > > CONFIG_NFC_FDP_I2C=m
> > > CONFIG_NFC_FDP=m
> > > CONFIG_NFC_HCI=m
> > > CONFIG_NFC=m
> > > CONFIG_NFC_MEI_PHY=m
> > > CONFIG_NFC_MICROREAD_I2C=m
> > > CONFIG_NFC_MICROREAD=m
> > > CONFIG_NFC_MICROREAD_MEI=m
> > > CONFIG_NFC_MRVL_I2C=m
> > > CONFIG_NFC_MRVL=m
> > > CONFIG_NFC_MRVL_SPI=m
> > > CONFIG_NFC_MRVL_UART=m
> > > CONFIG_NFC_MRVL_USB=m
> > > CONFIG_NFC_NCI=m
> > > CONFIG_NFC_NCI_SPI=m
> > > CONFIG_NFC_NCI_UART=m
> > > CONFIG_NFC_NXP_NCI_I2C=m
> > > CONFIG_NFC_NXP_NCI=m
> > > CONFIG_NFC_PN533_I2C=m
> > > CONFIG_NFC_PN533=m
> > > CONFIG_NFC_PN533_USB=m
> > > CONFIG_NFC_PN544_I2C=m
> > > CONFIG_NFC_PN544=m
> > > CONFIG_NFC_PN544_MEI=m
> > > CONFIG_NFC_PORT100=m
> > > CONFIG_NFC_S3FWRN5_I2C=m
> > > CONFIG_NFC_S3FWRN5=m
> > > CONFIG_NFC_SHDLC=y
> > > CONFIG_NFC_SIM=m
> > > CONFIG_NFC_ST21NFCA_I2C=m
> > > CONFIG_NFC_ST21NFCA=m
> > > CONFIG_NFC_ST95HF=m
> > > CONFIG_NFC_ST_NCI_I2C=m
> > > CONFIG_NFC_ST_NCI=m
> > > CONFIG_NFC_ST_NCI_SPI=m
> > > CONFIG_NFC_TRF7970A=m
> > > # Near Field Communication (NFC) devices
> > >
> > > [ WINDOWS 10 INF DRIVER ]
> > >
> > > $ cat NxpNfcClientDriver.inf
> > > ��;
> > > ; NxpNfcClientDriver.inf
> > > ;
> > >
> > > [Version]
> > > Signature="$Windows NT$"
> > > Class=Proximity
> > > ClassGuid={5630831C-06C9-4856-B327-F5D32586E060}
> > > Provider=%ManufacturerName%
> > > CatalogFile=NxpNfcClientDriver.cat
> > > DriverVer=03/30/2018,12.0.3.0
> > >
> > > [Manufacturer]
> > > %ManufacturerName%=Standard,NTamd64
> > >
> > > [Standard.NTamd64]
> > > %DeviceName%=MyDevice_Install,ACPI\NXP1000
> > > %DeviceName%=MyDevice_Install,ACPI\NXP1001
> > > %DeviceName%=MyDevice_Install,ACPI\NXP1002
> > > %DeviceName%=MyDevice_Install,ACPI\NXP1003
> > > %DeviceName%=MyDevice_Install,ACPI\NXP7471
> > > %DeviceName%=MyDevice_Install,ACPI\NXP8013
> > > %DeviceName%=MyDevice_Install,ACPI\NXP3001
> > >
> > > [SourceDisksNames]
> > > 1=%DiskName%
> > >
> > > [SourceDisksFiles]
> > > NxpNfcClientDriver.dll=1
> > > NXPPN548FW.DAT=1
> > > NXPPN547FW.DAT=1
> > >
> > > ; =================== UMDF Device ==================================
> > >
> > > [MyDevice_Install.NT]
> > > CopyFiles=UMDriverCopy,Firmware.CopyFiles
> > > AddReg=NxpNfpProviderProximityCustomValuesRegister
> > >
> > > [MyDevice_Install.NT.hw]
> > > AddReg=NxpNfcClientDriver_AddReg
> > >
> > > [MyDevice_Install.NT.Services]
> > > AddService=WUDFRd,0x000001fa,WUDFRD_ServiceInstall
> > >
> > > [MyDevice_Install.NT.CoInstallers]
> > > AddReg=CoInstallers_AddReg
> > >
> > > [MyDevice_Install.NT.Wdf]
> > > UmdfService=NxpNfcClientDriver,NxpNfcClientDriver_Install
> > > UmdfServiceOrder=NxpNfcClientDriver
> > > UmdfDirectHardwareAccess=AllowDirectHardwareAccess
> > > UmdfFileObjectPolicy=AllowNullAndUnknownFileObjects
> > > UmdfImpersonationLevel=Impersonation
> > >
> > > [NxpNfcClientDriver_Install]
> > > UmdfLibraryVersion=2.0.0
> > > ServiceBinary=%12%\UMDF\NxpNfcClientDriver.dll
> > > UmdfExtensions=NfcCx0102
> > >
> > > [NxpNfcClientDriver_AddReg]
> > > HKR,FirmwareMap,"8",0x00020000,"%%SystemRoot%%\System32\NXPPN547FW.dat"
> > > ; HW version of PN547 is 8
> > > HKR,FirmwareMap,"10",0x00020000,"%%SystemRoot%%\System32\NXPPN548FW.dat"
> > > ; HW version of PN548 is 10
> > > HKR,NxpNfcClientDriver, "RfConfigData",            0x00000001, 00
> > > HKR,NxpNfcClientDriver, "EEPROMConfigBlob",        0x00000001, 00
> > > HKR,NxpNfcClientDriver, "RfSessionMgmt",           0x00010001, 1
> > > HKR,NxpNfcClientDriver, "KeepRfData",              0x00010001, 1
> > >
> > > ; ============== custom registry sections ==================
> > >
> > > [NxpNfpProviderProximityCustomValuesRegister]
> > > HKLM,"SYSTEM\CurrentControlSet\Proximity\","Dummy",0x00000010,0
> > >
> > >
> > > [NxpNfpProviderProximityCustomValuesRegister.Security]
> > > "D:P(A;OICI;GA;;;LS)(A;;GA;;;BA)(A;;GA;;;SY)"
> > >
> > > [WUDFRD_ServiceInstall]
> > > DisplayName=%WudfRdDisplayName%
> > > ServiceType=1
> > > StartType=3
> > > ErrorControl=1
> > > ServiceBinary=%12%\WUDFRd.sys
> > >
> > > [CoInstallers_AddReg]
> > > HKR,,CoInstallers32,0x00010000,"WUDFCoinstaller.dll"
> > >
> > >
> > > [DestinationDirs]
> > > UMDriverCopy=12,UMDF ; copy to Drivers\UMDF
> > > Firmware.CopyFiles=11
> > >
> > > [UMDriverCopy]
> > > NxpNfcClientDriver.dll,,,0x100
> > >
> > > [Firmware.CopyFiles]
> > > NXPPN548FW.DAT
> > > NXPPN547FW.DAT
> > >
> > > [ControlFlags]
> > > ExcludeFromSelect=*
> > >
> > > ; =================== Generic ==================================
> > >
> > > [Strings]
> > > ManufacturerName="NXP Semiconductors"
> > > DiskName="NxpNfcClientDriver Installation Disk"
> > > WudfRdDisplayName="NxpNfcClientDriver"
> > > DeviceName="NxpNfcClientDriver"
> > >
> > > - EOT -
> >
> > [ CC Cristian and Jeremy of NXP ]
> >
> > What Linux-kernel configs do I need that PN544 I2C NFC driver works?
> >
> > Additionally, I have set CONFIG_I2C_GPIO=m.
> >
> > What else is important to be activated?
> >
> > Thanks.
> >
> > - Sedat -
>
>
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

^ permalink raw reply

* [PATCH 0/4] run mt76x02_edcca_init atomically
From: Lorenzo Bianconi @ 2019-05-11 10:17 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka

Run mt76x02_edcca_init atomically in mt76_edcca_set since it is
concurrent with mt76x2_set_channel/mt76x2u_set_channel and
channel calibration

Lorenzo Bianconi (4):
  mt76: mt76x02: remove enable from mt76x02_edcca_init signature
  mt76: mt76x2u: remove mt76x02_edcca_init in mt76x2u_set_channel
  mt76: mt76x2: move mutex_lock inside mt76x2_set_channel
  mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_set

 .../net/wireless/mediatek/mt76/mt76x0/main.c  |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76x02.h  |  7 ++++++
 .../wireless/mediatek/mt76/mt76x02_debugfs.c  |  6 ++++-
 .../net/wireless/mediatek/mt76/mt76x02_dfs.c  |  2 +-
 .../net/wireless/mediatek/mt76/mt76x02_mac.c  |  6 ++---
 .../net/wireless/mediatek/mt76/mt76x02_mac.h  |  1 -
 .../wireless/mediatek/mt76/mt76x2/pci_main.c  | 16 +++++++------
 .../wireless/mediatek/mt76/mt76x2/pci_phy.c   | 15 ++++++++----
 .../wireless/mediatek/mt76/mt76x2/usb_main.c  | 23 ++++++++++---------
 .../wireless/mediatek/mt76/mt76x2/usb_phy.c   | 15 ++++++++----
 10 files changed, 58 insertions(+), 35 deletions(-)

-- 
2.20.1


^ permalink raw reply

* [PATCH 1/4] mt76: mt76x02: remove enable from mt76x02_edcca_init signature
From: Lorenzo Bianconi @ 2019-05-11 10:17 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <cover.1557567465.git.lorenzo@kernel.org>

Remove enable parameter from mt76x02_edcca_init routine signature since
it is always true

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt76x0/main.c     | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c     | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c     | 4 ++--
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.h     | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c  | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c  | 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
index 691984037f98..800ebbfc3055 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
@@ -33,7 +33,7 @@ mt76x0_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
 	mt76_rr(dev, MT_CH_IDLE);
 	mt76_rr(dev, MT_CH_BUSY);
 
-	mt76x02_edcca_init(dev, true);
+	mt76x02_edcca_init(dev);
 
 	if (mt76_is_mmio(dev)) {
 		mt76x02_dfs_init_params(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
index b1d6fd4861e3..7853078e8ca4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
@@ -125,7 +125,7 @@ mt76_edcca_set(void *data, u64 val)
 	dev->ed_monitor_enabled = !!val;
 	dev->ed_monitor = dev->ed_monitor_enabled &&
 			  region == NL80211_DFS_ETSI;
-	mt76x02_edcca_init(dev, true);
+	mt76x02_edcca_init(dev);
 
 	return 0;
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
index 17d12d212d1b..84b845647881 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
@@ -887,7 +887,7 @@ mt76x02_dfs_set_domain(struct mt76x02_dev *dev,
 
 		dev->ed_monitor = dev->ed_monitor_enabled &&
 				  region == NL80211_DFS_ETSI;
-		mt76x02_edcca_init(dev, true);
+		mt76x02_edcca_init(dev);
 
 		dfs_pd->region = region;
 		mt76x02_dfs_init_params(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index 56510a1a843a..ee4a86971be7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -945,12 +945,12 @@ mt76x02_edcca_tx_enable(struct mt76x02_dev *dev, bool enable)
 	dev->ed_tx_blocked = !enable;
 }
 
-void mt76x02_edcca_init(struct mt76x02_dev *dev, bool enable)
+void mt76x02_edcca_init(struct mt76x02_dev *dev)
 {
 	dev->ed_trigger = 0;
 	dev->ed_silent = 0;
 
-	if (dev->ed_monitor && enable) {
+	if (dev->ed_monitor) {
 		struct ieee80211_channel *chan = dev->mt76.chandef.chan;
 		u8 ed_th = chan->band == NL80211_BAND_5GHZ ? 0x0e : 0x20;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
index e4a9e0d0924b..cb39da79527a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
@@ -209,5 +209,5 @@ int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx,
 void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
 				   struct ieee80211_vif *vif, bool val);
 
-void mt76x02_edcca_init(struct mt76x02_dev *dev, bool enable);
+void mt76x02_edcca_init(struct mt76x02_dev *dev);
 #endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
index cc1aebcb0696..7a39a390a7ac 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
@@ -74,7 +74,7 @@ mt76x2_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
 		mt76x2_mac_resume(dev);
 
 	mt76x2_apply_gain_adj(dev);
-	mt76x02_edcca_init(dev, true);
+	mt76x02_edcca_init(dev);
 
 	dev->cal.channel_cal_done = true;
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index 97bcf6494ec1..6657693edc3e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -59,7 +59,7 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
 	err = mt76x2u_phy_set_channel(dev, chandef);
 
 	mt76x2_mac_resume(dev);
-	mt76x02_edcca_init(dev, true);
+	mt76x02_edcca_init(dev);
 
 	dev->beacon_ops->pre_tbtt_enable(dev, true);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
index 07f67cb6854c..c7208c5375ac 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
@@ -45,7 +45,7 @@ mt76x2u_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
 	if (!mac_stopped)
 		mt76x2_mac_resume(dev);
 	mt76x2_apply_gain_adj(dev);
-	mt76x02_edcca_init(dev, true);
+	mt76x02_edcca_init(dev);
 
 	dev->cal.channel_cal_done = true;
 }
-- 
2.20.1


^ permalink raw reply related

* [PATCH 2/4] mt76: mt76x2u: remove mt76x02_edcca_init in mt76x2u_set_channel
From: Lorenzo Bianconi @ 2019-05-11 10:17 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <cover.1557567465.git.lorenzo@kernel.org>

Remove mt76x02_edcca_init in mt76x2u_set_channel since it is already
run by mt76x2u_phy_channel_calibrate performing channel calibration

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index 6657693edc3e..3351b736603d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -59,7 +59,6 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
 	err = mt76x2u_phy_set_channel(dev, chandef);
 
 	mt76x2_mac_resume(dev);
-	mt76x02_edcca_init(dev);
 
 	dev->beacon_ops->pre_tbtt_enable(dev, true);
 
-- 
2.20.1


^ permalink raw reply related

* [PATCH 3/4] mt76: mt76x2: move mutex_lock inside mt76x2_set_channel
From: Lorenzo Bianconi @ 2019-05-11 10:17 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <cover.1557567465.git.lorenzo@kernel.org>

This is a preliminary patch to run mt76x02_edcca_init atomically

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../wireless/mediatek/mt76/mt76x2/pci_main.c  | 16 ++++++++------
 .../wireless/mediatek/mt76/mt76x2/usb_main.c  | 22 ++++++++++---------
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
index e416eee6a306..3a1467326f4d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
@@ -54,14 +54,14 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
 	int ret;
 
 	cancel_delayed_work_sync(&dev->cal_work);
+	tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
+	tasklet_disable(&dev->dfs_pd.dfs_tasklet);
 
+	mutex_lock(&dev->mt76.mutex);
 	set_bit(MT76_RESET, &dev->mt76.state);
 
 	mt76_set_channel(&dev->mt76);
 
-	tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
-	tasklet_disable(&dev->dfs_pd.dfs_tasklet);
-
 	mt76x2_mac_stop(dev, true);
 	ret = mt76x2_phy_set_channel(dev, chandef);
 
@@ -72,10 +72,12 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
 	mt76x02_dfs_init_params(dev);
 
 	mt76x2_mac_resume(dev);
-	tasklet_enable(&dev->dfs_pd.dfs_tasklet);
-	tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
 
 	clear_bit(MT76_RESET, &dev->mt76.state);
+	mutex_unlock(&dev->mt76.mutex);
+
+	tasklet_enable(&dev->dfs_pd.dfs_tasklet);
+	tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
 
 	mt76_txq_schedule_all(&dev->mt76);
 
@@ -111,14 +113,14 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed)
 		}
 	}
 
+	mutex_unlock(&dev->mt76.mutex);
+
 	if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
 		ieee80211_stop_queues(hw);
 		ret = mt76x2_set_channel(dev, &hw->conf.chandef);
 		ieee80211_wake_queues(hw);
 	}
 
-	mutex_unlock(&dev->mt76.mutex);
-
 	return ret;
 }
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index 3351b736603d..e4dfc3bea3c5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -48,21 +48,23 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
 	int err;
 
 	cancel_delayed_work_sync(&dev->cal_work);
+	dev->beacon_ops->pre_tbtt_enable(dev, false);
+
+	mutex_lock(&dev->mt76.mutex);
 	set_bit(MT76_RESET, &dev->mt76.state);
 
 	mt76_set_channel(&dev->mt76);
 
-	dev->beacon_ops->pre_tbtt_enable(dev, false);
-
 	mt76x2_mac_stop(dev, false);
 
 	err = mt76x2u_phy_set_channel(dev, chandef);
 
 	mt76x2_mac_resume(dev);
 
-	dev->beacon_ops->pre_tbtt_enable(dev, true);
-
 	clear_bit(MT76_RESET, &dev->mt76.state);
+	mutex_unlock(&dev->mt76.mutex);
+
+	dev->beacon_ops->pre_tbtt_enable(dev, true);
 	mt76_txq_schedule_all(&dev->mt76);
 
 	return err;
@@ -84,12 +86,6 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
 		mt76_wr(dev, MT_RX_FILTR_CFG, dev->mt76.rxfilter);
 	}
 
-	if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
-		ieee80211_stop_queues(hw);
-		err = mt76x2u_set_channel(dev, &hw->conf.chandef);
-		ieee80211_wake_queues(hw);
-	}
-
 	if (changed & IEEE80211_CONF_CHANGE_POWER) {
 		dev->mt76.txpower_conf = hw->conf.power_level * 2;
 
@@ -102,6 +98,12 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
 
 	mutex_unlock(&dev->mt76.mutex);
 
+	if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
+		ieee80211_stop_queues(hw);
+		err = mt76x2u_set_channel(dev, &hw->conf.chandef);
+		ieee80211_wake_queues(hw);
+	}
+
 	return err;
 }
 
-- 
2.20.1


^ permalink raw reply related

* [PATCH 4/4] mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_set
From: Lorenzo Bianconi @ 2019-05-11 10:17 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <cover.1557567465.git.lorenzo@kernel.org>

Run mt76x02_edcca_init atomically in mt76_edcca_set since it runs
concurrently with calibration work and mt76x2_set_channel.
Introduce __mt76x02_edcca_init helper routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt76x0/main.c  |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76x02.h      |  7 +++++++
 .../net/wireless/mediatek/mt76/mt76x02_debugfs.c  |  6 +++++-
 drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c  |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c  |  4 ++--
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.h  |  1 -
 .../net/wireless/mediatek/mt76/mt76x2/pci_phy.c   | 15 ++++++++++-----
 .../net/wireless/mediatek/mt76/mt76x2/usb_phy.c   | 15 ++++++++++-----
 8 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
index 800ebbfc3055..115961a054e3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
@@ -33,7 +33,7 @@ mt76x0_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
 	mt76_rr(dev, MT_CH_IDLE);
 	mt76_rr(dev, MT_CH_BUSY);
 
-	mt76x02_edcca_init(dev);
+	__mt76x02_edcca_init(dev);
 
 	if (mt76_is_mmio(dev)) {
 		mt76x02_dfs_init_params(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index f7fd53a1738a..e028c1a4cf88 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -268,4 +268,11 @@ mt76x02_rx_get_sta_wcid(struct mt76x02_sta *sta, bool unicast)
 		return &sta->vif->group_wcid;
 }
 
+void __mt76x02_edcca_init(struct mt76x02_dev *dev);
+static inline void mt76x02_edcca_init(struct mt76x02_dev *dev)
+{
+	mutex_lock(&dev->mt76.mutex);
+	__mt76x02_edcca_init(dev);
+	mutex_unlock(&dev->mt76.mutex);
+}
 #endif /* __MT76x02_H */
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
index 7853078e8ca4..501794a6076b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
@@ -122,10 +122,14 @@ mt76_edcca_set(void *data, u64 val)
 	struct mt76x02_dev *dev = data;
 	enum nl80211_dfs_regions region = dev->dfs_pd.region;
 
+	mutex_lock(&dev->mt76.mutex);
+
 	dev->ed_monitor_enabled = !!val;
 	dev->ed_monitor = dev->ed_monitor_enabled &&
 			  region == NL80211_DFS_ETSI;
-	mt76x02_edcca_init(dev);
+	__mt76x02_edcca_init(dev);
+
+	mutex_unlock(&dev->mt76.mutex);
 
 	return 0;
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
index 84b845647881..e372621c3798 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
@@ -887,7 +887,7 @@ mt76x02_dfs_set_domain(struct mt76x02_dev *dev,
 
 		dev->ed_monitor = dev->ed_monitor_enabled &&
 				  region == NL80211_DFS_ETSI;
-		mt76x02_edcca_init(dev);
+		__mt76x02_edcca_init(dev);
 
 		dfs_pd->region = region;
 		mt76x02_dfs_init_params(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index ee4a86971be7..ac29422b5335 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -945,7 +945,7 @@ mt76x02_edcca_tx_enable(struct mt76x02_dev *dev, bool enable)
 	dev->ed_tx_blocked = !enable;
 }
 
-void mt76x02_edcca_init(struct mt76x02_dev *dev)
+void __mt76x02_edcca_init(struct mt76x02_dev *dev)
 {
 	dev->ed_trigger = 0;
 	dev->ed_silent = 0;
@@ -979,7 +979,7 @@ void mt76x02_edcca_init(struct mt76x02_dev *dev)
 	mt76_rr(dev, MT_ED_CCA_TIMER);
 	dev->ed_time = ktime_get_boottime();
 }
-EXPORT_SYMBOL_GPL(mt76x02_edcca_init);
+EXPORT_SYMBOL_GPL(__mt76x02_edcca_init);
 
 #define MT_EDCCA_TH		92
 #define MT_EDCCA_BLOCK_TH	2
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
index cb39da79527a..ce73c60c579a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
@@ -209,5 +209,4 @@ int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx,
 void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
 				   struct ieee80211_vif *vif, bool val);
 
-void mt76x02_edcca_init(struct mt76x02_dev *dev);
 #endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
index 7a39a390a7ac..818c4f051df3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
@@ -43,17 +43,17 @@ mt76x2_phy_tssi_init_cal(struct mt76x02_dev *dev)
 	return true;
 }
 
-static void
+static bool
 mt76x2_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
 {
 	struct ieee80211_channel *chan = dev->mt76.chandef.chan;
 	bool is_5ghz = chan->band == NL80211_BAND_5GHZ;
 
 	if (dev->cal.channel_cal_done)
-		return;
+		return false;
 
 	if (mt76x2_channel_silent(dev))
-		return;
+		return false;
 
 	if (!dev->cal.tssi_cal_done)
 		mt76x2_phy_tssi_init_cal(dev);
@@ -74,9 +74,10 @@ mt76x2_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
 		mt76x2_mac_resume(dev);
 
 	mt76x2_apply_gain_adj(dev);
-	mt76x02_edcca_init(dev);
 
 	dev->cal.channel_cal_done = true;
+
+	return true;
 }
 
 void mt76x2_phy_set_antenna(struct mt76x02_dev *dev)
@@ -245,6 +246,7 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
 		return 0;
 
 	mt76x2_phy_channel_calibrate(dev, true);
+	__mt76x02_edcca_init(dev);
 	mt76x02_init_agc_gain(dev);
 
 	/* init default values for temp compensation */
@@ -292,9 +294,12 @@ mt76x2_phy_temp_compensate(struct mt76x02_dev *dev)
 void mt76x2_phy_calibrate(struct work_struct *work)
 {
 	struct mt76x02_dev *dev;
+	bool ret;
 
 	dev = container_of(work, struct mt76x02_dev, cal_work.work);
-	mt76x2_phy_channel_calibrate(dev, false);
+	ret = mt76x2_phy_channel_calibrate(dev, false);
+	if (ret)
+		mt76x02_edcca_init(dev);
 	mt76x2_phy_tssi_compensate(dev);
 	mt76x2_phy_temp_compensate(dev);
 	mt76x2_phy_update_channel_gain(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
index c7208c5375ac..2576654f2920 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
@@ -18,17 +18,17 @@
 #include "eeprom.h"
 #include "../mt76x02_phy.h"
 
-static void
+static bool
 mt76x2u_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
 {
 	struct ieee80211_channel *chan = dev->mt76.chandef.chan;
 	bool is_5ghz = chan->band == NL80211_BAND_5GHZ;
 
 	if (dev->cal.channel_cal_done)
-		return;
+		return false;
 
 	if (mt76x2_channel_silent(dev))
-		return;
+		return false;
 
 	if (!mac_stopped)
 		mt76x2u_mac_stop(dev);
@@ -45,17 +45,21 @@ mt76x2u_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
 	if (!mac_stopped)
 		mt76x2_mac_resume(dev);
 	mt76x2_apply_gain_adj(dev);
-	mt76x02_edcca_init(dev);
 
 	dev->cal.channel_cal_done = true;
+
+	return true;
 }
 
 void mt76x2u_phy_calibrate(struct work_struct *work)
 {
 	struct mt76x02_dev *dev;
+	bool ret;
 
 	dev = container_of(work, struct mt76x02_dev, cal_work.work);
-	mt76x2u_phy_channel_calibrate(dev, false);
+	ret = mt76x2u_phy_channel_calibrate(dev, false);
+	if (ret)
+		mt76x02_edcca_init(dev);
 	mt76x2_phy_tssi_compensate(dev);
 	mt76x2_phy_update_channel_gain(dev);
 
@@ -177,6 +181,7 @@ int mt76x2u_phy_set_channel(struct mt76x02_dev *dev,
 		return 0;
 
 	mt76x2u_phy_channel_calibrate(dev, true);
+	__mt76x02_edcca_init(dev);
 	mt76x02_init_agc_gain(dev);
 
 	if (mt76x2_tssi_enabled(dev)) {
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH] mt76: mt76x02: remove useless return in mt76x02_resync_beacon_timer
From: Felix Fietkau @ 2019-05-11 13:22 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <b6e845207d947ce62161d98ea79a011211709062.1556717431.git.lorenzo@kernel.org>

On 2019-05-01 15:44, Lorenzo Bianconi wrote:
> Remove useless return statment in mt76x02_resync_beacon_timer routine
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Applied, thanks.

- Felix

^ permalink raw reply

* Re: [PATCH 0/4] mt76: add tx napi polling support to mt7603/mt7615
From: Felix Fietkau @ 2019-05-11 13:27 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee
In-Reply-To: <cover.1556718795.git.lorenzo@kernel.org>

On 2019-05-01 16:06, Lorenzo Bianconi wrote:
> Use napi polling for tx cleanup in mt7603 and mt7615 drivers in order
> to allow tx scheduling and tx cleanup to run concurrently
> 
> Lorenzo Bianconi (4):
>   mt76: move tx_napi in mt76_dev
>   mt76: mt7603: use napi polling for tx cleanup
>   mt76: mt7615: use napi polling for tx cleanup
>   mt76: move netif_napi_del in mt76_dma_cleanup
Applied, thanks.

- Felix

^ permalink raw reply

* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Oleg Zhurakivskyy @ 2019-05-11 13:27 UTC (permalink / raw)
  To: sedat.dilek; +Cc: Samuel Ortiz, Andy Shevchenko, linux-wireless, linux-nfc
In-Reply-To: <CA+icZUWhBeup95PTP_k58xs8Lf2Ofqb0S_gkdBfbuc0-wdpF-w@mail.gmail.com>


Hi Sedat,

On 5/10/19 10:40 PM, Sedat Dilek wrote:

> Can you guide me how to do that?

I try and then decide whether this is help or not.
	
If I remember correctly, support for PN547 was done by multiple parties for some Broadwell based designs through the upstream, both on the kernel and neard side.

Assuming the integration details of PN547 didn’t deviate much, this might be:

- From relatively simple, i.e. getting the relevant data from ACPI and hinting the kernel/driver with a minimally sufficient changes. Most likely, once you sort the basic details (i2c, gpio, etc), everything would just work.

- To more laborious and would require a working and ideally open source reference. An option here might be Broadwell based Chromebooks with PN547 (just not sure whether plain or OEMs).

Regards,
Oleg

^ permalink raw reply

* Re: [PATCH] mt76: Fix a signedness bug in mt7615_add_interface()
From: Felix Fietkau @ 2019-05-11 13:28 UTC (permalink / raw)
  To: Dan Carpenter, Ryder Lee
  Cc: Lorenzo Bianconi, Roy Luo, Kalle Valo, Matthias Brugger,
	linux-wireless, linux-mediatek, kernel-janitors
In-Reply-To: <20190502212341.GA31847@mwanda>

On 2019-05-03 14:54, Dan Carpenter wrote:
> The problem is that "mvif->omac_idx" is a u8 so it can't be negative
> and the error handling won't work.  The get_omac_idx() function returns
> -1 on error.
> 
> Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks.

- Felix

^ permalink raw reply

* Re: [PATCH][next] mt76: fix less than zero check on a u8 variable
From: Felix Fietkau @ 2019-05-11 13:31 UTC (permalink / raw)
  To: Colin King, Roy Luo, Kalle Valo, David S . Miller,
	Matthias Brugger, linux-wireless, netdev, linux-arm-kernel,
	linux-mediatek
  Cc: kernel-janitors, linux-kernel
In-Reply-To: <20190505213135.3895-1-colin.king@canonical.com>

On 2019-05-05 23:31, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The signed return from the call to get_omac_idx is being assigned to the
> u8 variable mac_idx and then checked for a negative error condition
> which is always going to be false. Fix this by assigning the return to
> the int variable ret and checking this instead.
> 
> Addresses-Coverity: ("Unsigned compared against 0")
> Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Already fixed by a similar patch by Dan Carpenter.

- Felix

^ permalink raw reply

* Re: [PATCH 00/17] use standard signature for mt7615 mcu api
From: Felix Fietkau @ 2019-05-11 14:00 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee, royluo
In-Reply-To: <cover.1556981521.git.lorenzo@kernel.org>

On 2019-05-04 17:28, Lorenzo Bianconi wrote:
> Introduce mt76_mcu_ops data structure in mt7615 mcu code in order
> to reuse the code with other bus types and unify the code with mt7603
> driver
> 
> Changes since RFC:
> - rebase ontop of https://patchwork.kernel.org/patch/10928753/
> - fix net_type initialization in mt7615_mcu_set_bss_info
> 
> Lorenzo Bianconi (17):
>   mt7615: mcu: simplify __mt7615_mcu_set_wtbl
>   mt7615: mcu: simplify __mt7615_mcu_set_sta_rec
>   mt7615: mcu: remove bss_info_convert_vif_type routine
>   mt7615: mcu: use proper msg size in mt7615_mcu_add_wtbl_bmc
>   mt7615: mcu: use proper msg size in mt7615_mcu_add_wtbl
>   mt7615: mcu: unify mt7615_mcu_add_wtbl_bmc and mt7615_mcu_del_wtbl_bmc
>   mt7615: mcu: remove unused parameter in mt7615_mcu_del_wtbl
>   mt7615: remove query from mt7615_mcu_msg_send signature
>   mt7615: remove dest from mt7615_mcu_msg_send signature
>   mt7615: mcu: remove skb_ret from mt7615_mcu_msg_send
>   mt7615: mcu: unify __mt7615_mcu_set_dev_info and
>     mt7615_mcu_set_dev_info
>   mt7615: mcu: do not use function pointers whenever possible
>   mt7615: mcu: remove unused structure in mcu.h
>   mt7615: mcu: use standard signature for mt7615_mcu_msg_send
>   mt7615: initialize mt76_mcu_ops data structure
>   mt7615: mcu: init mcu_restart function pointer
>   mt7615: mcu: run __mt76_mcu_send_msg in mt7615_mcu_send_firmware
Applied (including updated patch 12/17), thanks.

- Felix

^ permalink raw reply

* Re: [PATCH 4/4] mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_set
From: Felix Fietkau @ 2019-05-11 14:22 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <436469e1a4c1e0c11ae43a0b002378708d31f15d.1557567465.git.lorenzo@kernel.org>

On 2019-05-11 12:17, Lorenzo Bianconi wrote:
> Run mt76x02_edcca_init atomically in mt76_edcca_set since it runs
> concurrently with calibration work and mt76x2_set_channel.
> Introduce __mt76x02_edcca_init helper routine
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
I don't think this is enough. To prevent issues with calibration, we
probably need to hold the mutex for the duration of the calibration
anyway. Otherwise it might get enabled right in the middle of it and
screw things up.
Also, it probably simplifies the patch if you don't add the wrapper
function that takes the mutex, and instead just explicitly take the
mutex where needed.

- Felix

^ permalink raw reply

* Re: [PATCH] mt76: mt7615: Make mt7615_irq_handler static
From: Felix Fietkau @ 2019-05-11 14:24 UTC (permalink / raw)
  To: YueHaibing, lorenzo.bianconi83, ryder.lee, royluo, kvalo,
	matthias.bgg
  Cc: linux-kernel, netdev, linux-mediatek, linux-arm-kernel,
	linux-wireless
In-Reply-To: <20190504102247.43720-1-yuehaibing@huawei.com>

On 2019-05-04 12:22, YueHaibing wrote:
> Fix sparse warning:
> 
> drivers/net/wireless/mediatek/mt76/mt7615/pci.c:37:13:
>  warning: symbol 'mt7615_irq_handler' was not declared. Should it be static?
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Applied, thanks.

- Felix

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox