mac80211: rt2x00: import and update pending patches
Imported from patchwork, patches marked with '=' have already been in our tree: [v3,1/4] cfg80211: add ratelimited variants of err and warn [v3,2/4] rt2x00: use ratelimited variants dev_warn/dev_err [v3,3/4] rt2x00: check number of EPROTO errors =[v3,4/4] rt2x00: do not print error when queue is full Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
		| @@ -0,0 +1,39 @@ | ||||
| From patchwork Tue Mar 12 09:51:40 2019 | ||||
| Content-Type: text/plain; charset="utf-8" | ||||
| MIME-Version: 1.0 | ||||
| Content-Transfer-Encoding: 7bit | ||||
| X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| X-Patchwork-Id: 10848957 | ||||
| X-Patchwork-Delegate: johannes@sipsolutions.net | ||||
| From: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| To: linux-wireless@vger.kernel.org | ||||
| Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= <pozega.tomislav@gmail.com>, | ||||
|  Daniel Golle <daniel@makrotopia.org>, Felix Fietkau <nbd@nbd.name>, | ||||
|  Mathias Kresin <dev@kresin.me> | ||||
| Subject: [PATCH v3 1/4] cfg80211: add ratelimited variants of err and warn | ||||
| Date: Tue, 12 Mar 2019 10:51:40 +0100 | ||||
| Message-Id: <1552384303-29529-2-git-send-email-sgruszka@redhat.com> | ||||
| In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> | ||||
| References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> | ||||
|  | ||||
| wiphy_{err,warn}_ratelimited will be used by rt2x00 | ||||
|  | ||||
| Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| --- | ||||
|  include/net/cfg80211.h | 5 +++++ | ||||
|  1 file changed, 5 insertions(+) | ||||
|  | ||||
| --- a/include/net/cfg80211.h | ||||
| +++ b/include/net/cfg80211.h | ||||
| @@ -6588,6 +6588,11 @@ int cfg80211_external_auth_request(struc | ||||
|  #define wiphy_info(wiphy, format, args...)			\ | ||||
|  	dev_info(&(wiphy)->dev, format, ##args) | ||||
|   | ||||
| +#define wiphy_err_ratelimited(wiphy, format, args...)		\ | ||||
| +	dev_err_ratelimited(&(wiphy)->dev, format, ##args) | ||||
| +#define wiphy_warn_ratelimited(wiphy, format, args...)		\ | ||||
| +	dev_warn_ratelimited(&(wiphy)->dev, format, ##args) | ||||
| + | ||||
|  #define wiphy_debug(wiphy, format, args...)			\ | ||||
|  	wiphy_printk(KERN_DEBUG, wiphy, format, ##args) | ||||
|   | ||||
| @@ -0,0 +1,42 @@ | ||||
| From patchwork Tue Mar 12 09:51:41 2019 | ||||
| Content-Type: text/plain; charset="utf-8" | ||||
| MIME-Version: 1.0 | ||||
| Content-Transfer-Encoding: 7bit | ||||
| X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| X-Patchwork-Id: 10848959 | ||||
| X-Patchwork-Delegate: kvalo@adurom.com | ||||
| From: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| To: linux-wireless@vger.kernel.org | ||||
| Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= <pozega.tomislav@gmail.com>, | ||||
|  Daniel Golle <daniel@makrotopia.org>, Felix Fietkau <nbd@nbd.name>, | ||||
|  Mathias Kresin <dev@kresin.me> | ||||
| Subject: [PATCH v3 2/4] rt2x00: use ratelimited variants dev_warn/dev_err | ||||
| Date: Tue, 12 Mar 2019 10:51:41 +0100 | ||||
| Message-Id: <1552384303-29529-3-git-send-email-sgruszka@redhat.com> | ||||
| In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> | ||||
| References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> | ||||
|  | ||||
| As reported by Randy we can overwhelm logs on some USB error conditions. | ||||
| To avoid that use dev_warn_ratelimited() and dev_err_ratelimitd(). | ||||
|  | ||||
| Reported-and-tested-by: Randy Oostdyk <linux-kernel@oostdyk.com> | ||||
| Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| --- | ||||
|  drivers/net/wireless/ralink/rt2x00/rt2x00.h | 4 ++-- | ||||
|  1 file changed, 2 insertions(+), 2 deletions(-) | ||||
|  | ||||
| --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h | ||||
| +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h | ||||
| @@ -69,10 +69,10 @@ | ||||
|  	printk(KERN_ERR KBUILD_MODNAME ": %s: Error - " fmt,		\ | ||||
|  	       __func__, ##__VA_ARGS__) | ||||
|  #define rt2x00_err(dev, fmt, ...)					\ | ||||
| -	wiphy_err((dev)->hw->wiphy, "%s: Error - " fmt,			\ | ||||
| +	wiphy_err_ratelimited((dev)->hw->wiphy, "%s: Error - " fmt,	\ | ||||
|  		  __func__, ##__VA_ARGS__) | ||||
|  #define rt2x00_warn(dev, fmt, ...)					\ | ||||
| -	wiphy_warn((dev)->hw->wiphy, "%s: Warning - " fmt,		\ | ||||
| +	wiphy_warn_ratelimited((dev)->hw->wiphy, "%s: Warning - " fmt,	\ | ||||
|  		   __func__, ##__VA_ARGS__) | ||||
|  #define rt2x00_info(dev, fmt, ...)					\ | ||||
|  	wiphy_info((dev)->hw->wiphy, "%s: Info - " fmt,			\ | ||||
| @@ -0,0 +1,96 @@ | ||||
| From patchwork Tue Mar 12 09:51:42 2019 | ||||
| Content-Type: text/plain; charset="utf-8" | ||||
| MIME-Version: 1.0 | ||||
| Content-Transfer-Encoding: 7bit | ||||
| X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| X-Patchwork-Id: 10848961 | ||||
| X-Patchwork-Delegate: kvalo@adurom.com | ||||
| From: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| To: linux-wireless@vger.kernel.org | ||||
| Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= <pozega.tomislav@gmail.com>, | ||||
|  Daniel Golle <daniel@makrotopia.org>, Felix Fietkau <nbd@nbd.name>, | ||||
|  Mathias Kresin <dev@kresin.me> | ||||
| Subject: [PATCH v3 3/4] rt2x00: check number of EPROTO errors | ||||
| Date: Tue, 12 Mar 2019 10:51:42 +0100 | ||||
| Message-Id: <1552384303-29529-4-git-send-email-sgruszka@redhat.com> | ||||
| In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> | ||||
| References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> | ||||
|  | ||||
| Some USB host devices/drivers on some conditions can always return | ||||
| EPROTO error on submitted URBs. That can cause infinity loop in the | ||||
| rt2x00 driver. | ||||
|  | ||||
| Since we can have single EPROTO errors we can not mark as device as | ||||
| removed to avoid infinity loop. However we can count consecutive | ||||
| EPROTO errors and mark device as removed if get lot of it. | ||||
| I choose number 10 as threshold. | ||||
|  | ||||
| Reported-and-tested-by: Randy Oostdyk <linux-kernel@oostdyk.com> | ||||
| Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| --- | ||||
|  drivers/net/wireless/ralink/rt2x00/rt2x00.h    |  1 + | ||||
|  drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 22 +++++++++++++++++++--- | ||||
|  2 files changed, 20 insertions(+), 3 deletions(-) | ||||
|  | ||||
| --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h | ||||
| +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h | ||||
| @@ -1017,6 +1017,7 @@ struct rt2x00_dev { | ||||
|  	unsigned int extra_tx_headroom; | ||||
|   | ||||
|  	struct usb_anchor *anchor; | ||||
| +	unsigned int num_proto_errs; | ||||
|   | ||||
|  	/* Clock for System On Chip devices. */ | ||||
|  	struct clk *clk; | ||||
| --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | ||||
| +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | ||||
| @@ -31,6 +31,22 @@ | ||||
|  #include "rt2x00.h" | ||||
|  #include "rt2x00usb.h" | ||||
|   | ||||
| +static bool rt2x00usb_check_usb_error(struct rt2x00_dev *rt2x00dev, int status) | ||||
| +{ | ||||
| +	if (status == -ENODEV || status == -ENOENT) | ||||
| +		return true; | ||||
| + | ||||
| +	if (status == -EPROTO || status == -ETIMEDOUT) | ||||
| +		rt2x00dev->num_proto_errs++; | ||||
| +	else | ||||
| +		rt2x00dev->num_proto_errs = 0; | ||||
| + | ||||
| +	if (rt2x00dev->num_proto_errs > 3) | ||||
| +		return true; | ||||
| + | ||||
| +	return false; | ||||
| +} | ||||
| + | ||||
|  /* | ||||
|   * Interfacing with the HW. | ||||
|   */ | ||||
| @@ -57,7 +73,7 @@ int rt2x00usb_vendor_request(struct rt2x | ||||
|  		if (status >= 0) | ||||
|  			return 0; | ||||
|   | ||||
| -		if (status == -ENODEV || status == -ENOENT) { | ||||
| +		if (rt2x00usb_check_usb_error(rt2x00dev, status)) { | ||||
|  			/* Device has disappeared. */ | ||||
|  			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | ||||
|  			break; | ||||
| @@ -321,7 +337,7 @@ static bool rt2x00usb_kick_tx_entry(stru | ||||
|   | ||||
|  	status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC); | ||||
|  	if (status) { | ||||
| -		if (status == -ENODEV || status == -ENOENT) | ||||
| +		if (rt2x00usb_check_usb_error(rt2x00dev, status)) | ||||
|  			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | ||||
|  		set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); | ||||
|  		rt2x00lib_dmadone(entry); | ||||
| @@ -410,7 +426,7 @@ static bool rt2x00usb_kick_rx_entry(stru | ||||
|   | ||||
|  	status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC); | ||||
|  	if (status) { | ||||
| -		if (status == -ENODEV || status == -ENOENT) | ||||
| +		if (rt2x00usb_check_usb_error(rt2x00dev, status)) | ||||
|  			clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | ||||
|  		set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); | ||||
|  		rt2x00lib_dmadone(entry); | ||||
| @@ -1,10 +1,20 @@ | ||||
| From 1a8a8989b779e51e4652a30e9f22c36a1b6ffc4b Mon Sep 17 00:00:00 2001 | ||||
| From: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| Date: Thu, 20 Dec 2018 16:16:11 +0100 | ||||
| From patchwork Tue Mar 12 09:51:43 2019 | ||||
| Content-Type: text/plain; charset="utf-8" | ||||
| MIME-Version: 1.0 | ||||
| Content-Transfer-Encoding: 7bit | ||||
| X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| X-Patchwork-Id: 10739037 | ||||
| X-Patchwork-Id: 10848963 | ||||
| X-Patchwork-Delegate: kvalo@adurom.com | ||||
| Subject: [PATCH 20/28] rt2x00: do not print error when queue is full | ||||
| From: Stanislaw Gruszka <sgruszka@redhat.com> | ||||
| To: linux-wireless@vger.kernel.org | ||||
| Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= <pozega.tomislav@gmail.com>, | ||||
|  Daniel Golle <daniel@makrotopia.org>, Felix Fietkau <nbd@nbd.name>, | ||||
|  Mathias Kresin <dev@kresin.me> | ||||
| Subject: [PATCH v3 4/4] rt2x00: do not print error when queue is full | ||||
| Date: Tue, 12 Mar 2019 10:51:43 +0100 | ||||
| Message-Id: <1552384303-29529-5-git-send-email-sgruszka@redhat.com> | ||||
| In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> | ||||
| References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> | ||||
| 
 | ||||
| For unknown reasons printk() on some context can cause CPU hung on | ||||
| embedded MT7620 AP/router MIPS platforms. What can result on wifi | ||||
		Reference in New Issue
	
	Block a user
	 Daniel Golle
					Daniel Golle