From 36530ba72afd7a1e33b4780faa898d28a1f9d9ee Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 12 Mar 2019 11:44:27 +0100 Subject: [PATCH] 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 --- ...ratelimited-variants-of-err-and-warn.patch | 39 ++++++++ ...atelimited-variants-dev_warn-dev_err.patch | 42 ++++++++ ...rt2x00-check-number-of-EPROTO-errors.patch | 96 +++++++++++++++++++ ...-not-print-error-when-queue-is-full.patch} | 20 +++- ...restore-old-mmio-txstatus-behaviour.patch} | 0 ...lush-implementation-for-SoC-devices.patch} | 0 ...t2800-move-txstatus-pending-routine.patch} | 0 ...-rt2800mmio-fetch-tx-status-changes.patch} | 0 ...mer-and-work-for-handling-tx-status.patch} | 0 ...9-rt2x00-remove-last_nostatus_check.patch} | 0 ...-rt2x00-remove-not-used-entry-field.patch} | 0 ...31-rt2x00mmio-remove-legacy-comment.patch} | 0 12 files changed, 192 insertions(+), 5 deletions(-) create mode 100644 package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch rename package/kernel/mac80211/patches/rt2x00/{020-rt2x00-do-not-print-error-when-queue-is-full.patch => 023-rt2x00-do-not-print-error-when-queue-is-full.patch} (62%) rename package/kernel/mac80211/patches/rt2x00/{021-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch => 024-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{022-rt2800-new-flush-implementation-for-SoC-devices.patch => 025-rt2800-new-flush-implementation-for-SoC-devices.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{023-rt2800-move-txstatus-pending-routine.patch => 026-rt2800-move-txstatus-pending-routine.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{024-rt2800mmio-fetch-tx-status-changes.patch => 027-rt2800mmio-fetch-tx-status-changes.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{025-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch => 028-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{026-rt2x00-remove-last_nostatus_check.patch => 029-rt2x00-remove-last_nostatus_check.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{027-rt2x00-remove-not-used-entry-field.patch => 030-rt2x00-remove-not-used-entry-field.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{028-rt2x00mmio-remove-legacy-comment.patch => 031-rt2x00mmio-remove-legacy-comment.patch} (100%) diff --git a/package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch b/package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch new file mode 100644 index 0000000000..ace01bb9be --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch @@ -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 +X-Patchwork-Id: 10848957 +X-Patchwork-Delegate: johannes@sipsolutions.net +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +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 +--- + 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) + diff --git a/package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch b/package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch new file mode 100644 index 0000000000..2d74a71e1f --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch @@ -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 +X-Patchwork-Id: 10848959 +X-Patchwork-Delegate: kvalo@adurom.com +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +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 +Signed-off-by: Stanislaw Gruszka +--- + 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, \ diff --git a/package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch b/package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch new file mode 100644 index 0000000000..251ac287bf --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch @@ -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 +X-Patchwork-Id: 10848961 +X-Patchwork-Delegate: kvalo@adurom.com +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +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 +Signed-off-by: Stanislaw Gruszka +--- + 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); diff --git a/package/kernel/mac80211/patches/rt2x00/020-rt2x00-do-not-print-error-when-queue-is-full.patch b/package/kernel/mac80211/patches/rt2x00/023-rt2x00-do-not-print-error-when-queue-is-full.patch similarity index 62% rename from package/kernel/mac80211/patches/rt2x00/020-rt2x00-do-not-print-error-when-queue-is-full.patch rename to package/kernel/mac80211/patches/rt2x00/023-rt2x00-do-not-print-error-when-queue-is-full.patch index 5098672ac3..7e2f2193be 100644 --- a/package/kernel/mac80211/patches/rt2x00/020-rt2x00-do-not-print-error-when-queue-is-full.patch +++ b/package/kernel/mac80211/patches/rt2x00/023-rt2x00-do-not-print-error-when-queue-is-full.patch @@ -1,10 +1,20 @@ -From 1a8a8989b779e51e4652a30e9f22c36a1b6ffc4b Mon Sep 17 00:00:00 2001 -From: Stanislaw Gruszka -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 -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 +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +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 diff --git a/package/kernel/mac80211/patches/rt2x00/021-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch b/package/kernel/mac80211/patches/rt2x00/024-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/021-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch rename to package/kernel/mac80211/patches/rt2x00/024-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch diff --git a/package/kernel/mac80211/patches/rt2x00/022-rt2800-new-flush-implementation-for-SoC-devices.patch b/package/kernel/mac80211/patches/rt2x00/025-rt2800-new-flush-implementation-for-SoC-devices.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/022-rt2800-new-flush-implementation-for-SoC-devices.patch rename to package/kernel/mac80211/patches/rt2x00/025-rt2800-new-flush-implementation-for-SoC-devices.patch diff --git a/package/kernel/mac80211/patches/rt2x00/023-rt2800-move-txstatus-pending-routine.patch b/package/kernel/mac80211/patches/rt2x00/026-rt2800-move-txstatus-pending-routine.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/023-rt2800-move-txstatus-pending-routine.patch rename to package/kernel/mac80211/patches/rt2x00/026-rt2800-move-txstatus-pending-routine.patch diff --git a/package/kernel/mac80211/patches/rt2x00/024-rt2800mmio-fetch-tx-status-changes.patch b/package/kernel/mac80211/patches/rt2x00/027-rt2800mmio-fetch-tx-status-changes.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/024-rt2800mmio-fetch-tx-status-changes.patch rename to package/kernel/mac80211/patches/rt2x00/027-rt2800mmio-fetch-tx-status-changes.patch diff --git a/package/kernel/mac80211/patches/rt2x00/025-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch b/package/kernel/mac80211/patches/rt2x00/028-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/025-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch rename to package/kernel/mac80211/patches/rt2x00/028-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch diff --git a/package/kernel/mac80211/patches/rt2x00/026-rt2x00-remove-last_nostatus_check.patch b/package/kernel/mac80211/patches/rt2x00/029-rt2x00-remove-last_nostatus_check.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/026-rt2x00-remove-last_nostatus_check.patch rename to package/kernel/mac80211/patches/rt2x00/029-rt2x00-remove-last_nostatus_check.patch diff --git a/package/kernel/mac80211/patches/rt2x00/027-rt2x00-remove-not-used-entry-field.patch b/package/kernel/mac80211/patches/rt2x00/030-rt2x00-remove-not-used-entry-field.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/027-rt2x00-remove-not-used-entry-field.patch rename to package/kernel/mac80211/patches/rt2x00/030-rt2x00-remove-not-used-entry-field.patch diff --git a/package/kernel/mac80211/patches/rt2x00/028-rt2x00mmio-remove-legacy-comment.patch b/package/kernel/mac80211/patches/rt2x00/031-rt2x00mmio-remove-legacy-comment.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/028-rt2x00mmio-remove-legacy-comment.patch rename to package/kernel/mac80211/patches/rt2x00/031-rt2x00mmio-remove-legacy-comment.patch -- 2.25.1