From a531082ab84acb7173d25db1d802ce5d4abeb6cc Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 12 Mar 2021 14:05:00 +0100 Subject: [PATCH] 5.10-stable patches added patches: bnxt_en-reliably-allocate-irq-table-on-reset-to-avoid-crash.patch cipso-calipso-resolve-a-number-of-problems-with-the-doi-refcounts.patch ethtool-fix-the-check-logic-of-at-least-one-channel-for-rx-tx.patch ixgbe-fail-to-create-xfrm-offload-of-ipsec-tunnel-mode-sa.patch mlxsw-spectrum_ethtool-add-an-external-speed-to-ptys-register.patch net-bonding-fix-error-return-code-of-bond_neigh_init.patch net-davicom-fix-regulator-not-turned-off-on-driver-removal.patch net-davicom-fix-regulator-not-turned-off-on-failed-probe.patch net-dsa-sja1105-fix-sgmii-pcs-being-forced-to-speed_unknown-instead-of-speed_10.patch net-enetc-allow-hardware-timestamping-on-tx-queues-with-tc-etf-enabled.patch net-hns3-fix-bug-when-calculating-the-tcam-table-info.patch net-hns3-fix-query-vlan-mask-value-error-for-flow-director.patch net-lapbether-remove-netif_start_queue-netif_stop_queue.patch net-mscc-ocelot-properly-reject-destination-ip-keys-in-vcap-is1.patch net-phy-make-mdio_bus_phy_suspend-resume-as-__maybe_unused.patch net-qrtr-fix-error-return-code-of-qrtr_sendmsg.patch net-sched-avoid-duplicates-in-classes-dump.patch net-stmmac-fix-vlan-filter-delete-timeout-issue-in-intel-mgbe-sgmii.patch net-stmmac-fix-watchdog-timeout-during-suspend-resume-stress-test.patch net-stmmac-fix-wrongly-set-buffer2-valid-when-sph-unsupport.patch net-stmmac-stop-each-tx-channel-independently.patch net-usb-qmi_wwan-allow-qmimux-add-del-with-master-up.patch netdevsim-init-u64-stats-for-32bit-hardware.patch perf-build-fix-ccache-usage-in-cc-when-generating-arch-errno-table.patch perf-report-fix-f-for-branch-mem-modes.patch perf-traceevent-ensure-read-cmdlines-are-null-terminated.patch r8169-fix-r8168fp_adjust_ocp_cmd-function.patch s390-cio-return-efault-if-copy_to_user-fails.patch s390-qeth-fix-memory-leak-after-failed-tx-buffer-allocation.patch selftests-forwarding-fix-race-condition-in-mirror-installation.patch stmmac-intel-fixes-clock-registration-error-seen-for-multiple-interfaces.patch tools-resolve_btfids-fix-build-error-with-older-host-toolchains.patch --- ...te-irq-table-on-reset-to-avoid-crash.patch | 127 +++++++++++++++++ ...r-of-problems-with-the-doi-refcounts.patch | 134 ++++++++++++++++++ ...ic-of-at-least-one-channel-for-rx-tx.patch | 88 ++++++++++++ ...xfrm-offload-of-ipsec-tunnel-mode-sa.patch | 53 +++++++ ...d-an-external-speed-to-ptys-register.patch | 69 +++++++++ ...error-return-code-of-bond_neigh_init.patch | 42 ++++++ ...tor-not-turned-off-on-driver-removal.patch | 54 +++++++ ...lator-not-turned-off-on-failed-probe.patch | 55 +++++++ ...to-speed_unknown-instead-of-speed_10.patch | 38 +++++ ...ing-on-tx-queues-with-tc-etf-enabled.patch | 84 +++++++++++ ...when-calculating-the-tcam-table-info.patch | 37 +++++ ...n-mask-value-error-for-flow-director.patch | 53 +++++++ ...e-netif_start_queue-netif_stop_queue.patch | 61 ++++++++ ...ject-destination-ip-keys-in-vcap-is1.patch | 43 ++++++ ...phy_suspend-resume-as-__maybe_unused.patch | 66 +++++++++ ...ix-error-return-code-of-qrtr_sendmsg.patch | 36 +++++ ...hed-avoid-duplicates-in-classes-dump.patch | 60 ++++++++ ...te-timeout-issue-in-intel-mgbe-sgmii.patch | 52 +++++++ ...ut-during-suspend-resume-stress-test.patch | 43 ++++++ ...set-buffer2-valid-when-sph-unsupport.patch | 93 ++++++++++++ ...c-stop-each-tx-channel-independently.patch | 33 +++++ ...-allow-qmimux-add-del-with-master-up.patch | 60 ++++++++ ...im-init-u64-stats-for-32bit-hardware.patch | 86 +++++++++++ ...-cc-when-generating-arch-errno-table.patch | 46 ++++++ ...rf-report-fix-f-for-branch-mem-modes.patch | 67 +++++++++ ...re-read-cmdlines-are-null-terminated.patch | 36 +++++ ...-fix-r8168fp_adjust_ocp_cmd-function.patch | 31 ++++ ...-return-efault-if-copy_to_user-fails.patch | 42 ++++++ ...ak-after-failed-tx-buffer-allocation.patch | 97 +++++++++++++ ...ace-condition-in-mirror-installation.patch | 54 +++++++ queue-5.10/series | 32 +++++ ...n-error-seen-for-multiple-interfaces.patch | 56 ++++++++ ...ild-error-with-older-host-toolchains.patch | 41 ++++++ 33 files changed, 1969 insertions(+) create mode 100644 queue-5.10/bnxt_en-reliably-allocate-irq-table-on-reset-to-avoid-crash.patch create mode 100644 queue-5.10/cipso-calipso-resolve-a-number-of-problems-with-the-doi-refcounts.patch create mode 100644 queue-5.10/ethtool-fix-the-check-logic-of-at-least-one-channel-for-rx-tx.patch create mode 100644 queue-5.10/ixgbe-fail-to-create-xfrm-offload-of-ipsec-tunnel-mode-sa.patch create mode 100644 queue-5.10/mlxsw-spectrum_ethtool-add-an-external-speed-to-ptys-register.patch create mode 100644 queue-5.10/net-bonding-fix-error-return-code-of-bond_neigh_init.patch create mode 100644 queue-5.10/net-davicom-fix-regulator-not-turned-off-on-driver-removal.patch create mode 100644 queue-5.10/net-davicom-fix-regulator-not-turned-off-on-failed-probe.patch create mode 100644 queue-5.10/net-dsa-sja1105-fix-sgmii-pcs-being-forced-to-speed_unknown-instead-of-speed_10.patch create mode 100644 queue-5.10/net-enetc-allow-hardware-timestamping-on-tx-queues-with-tc-etf-enabled.patch create mode 100644 queue-5.10/net-hns3-fix-bug-when-calculating-the-tcam-table-info.patch create mode 100644 queue-5.10/net-hns3-fix-query-vlan-mask-value-error-for-flow-director.patch create mode 100644 queue-5.10/net-lapbether-remove-netif_start_queue-netif_stop_queue.patch create mode 100644 queue-5.10/net-mscc-ocelot-properly-reject-destination-ip-keys-in-vcap-is1.patch create mode 100644 queue-5.10/net-phy-make-mdio_bus_phy_suspend-resume-as-__maybe_unused.patch create mode 100644 queue-5.10/net-qrtr-fix-error-return-code-of-qrtr_sendmsg.patch create mode 100644 queue-5.10/net-sched-avoid-duplicates-in-classes-dump.patch create mode 100644 queue-5.10/net-stmmac-fix-vlan-filter-delete-timeout-issue-in-intel-mgbe-sgmii.patch create mode 100644 queue-5.10/net-stmmac-fix-watchdog-timeout-during-suspend-resume-stress-test.patch create mode 100644 queue-5.10/net-stmmac-fix-wrongly-set-buffer2-valid-when-sph-unsupport.patch create mode 100644 queue-5.10/net-stmmac-stop-each-tx-channel-independently.patch create mode 100644 queue-5.10/net-usb-qmi_wwan-allow-qmimux-add-del-with-master-up.patch create mode 100644 queue-5.10/netdevsim-init-u64-stats-for-32bit-hardware.patch create mode 100644 queue-5.10/perf-build-fix-ccache-usage-in-cc-when-generating-arch-errno-table.patch create mode 100644 queue-5.10/perf-report-fix-f-for-branch-mem-modes.patch create mode 100644 queue-5.10/perf-traceevent-ensure-read-cmdlines-are-null-terminated.patch create mode 100644 queue-5.10/r8169-fix-r8168fp_adjust_ocp_cmd-function.patch create mode 100644 queue-5.10/s390-cio-return-efault-if-copy_to_user-fails.patch create mode 100644 queue-5.10/s390-qeth-fix-memory-leak-after-failed-tx-buffer-allocation.patch create mode 100644 queue-5.10/selftests-forwarding-fix-race-condition-in-mirror-installation.patch create mode 100644 queue-5.10/stmmac-intel-fixes-clock-registration-error-seen-for-multiple-interfaces.patch create mode 100644 queue-5.10/tools-resolve_btfids-fix-build-error-with-older-host-toolchains.patch diff --git a/queue-5.10/bnxt_en-reliably-allocate-irq-table-on-reset-to-avoid-crash.patch b/queue-5.10/bnxt_en-reliably-allocate-irq-table-on-reset-to-avoid-crash.patch new file mode 100644 index 00000000000..23cebf37a3b --- /dev/null +++ b/queue-5.10/bnxt_en-reliably-allocate-irq-table-on-reset-to-avoid-crash.patch @@ -0,0 +1,127 @@ +From 20d7d1c5c9b11e9f538ed4a2289be106de970d3e Mon Sep 17 00:00:00 2001 +From: Edwin Peer +Date: Fri, 26 Feb 2021 04:43:10 -0500 +Subject: bnxt_en: reliably allocate IRQ table on reset to avoid crash + +From: Edwin Peer + +commit 20d7d1c5c9b11e9f538ed4a2289be106de970d3e upstream. + +The following trace excerpt corresponds with a NULL pointer dereference +of 'bp->irq_tbl' in bnxt_setup_inta() on an Aarch64 system after many +device resets: + + Unable to handle kernel NULL pointer dereference at ... 000000d + ... + pc : string+0x3c/0x80 + lr : vsnprintf+0x294/0x7e0 + sp : ffff00000f61ba70 pstate : 20000145 + x29: ffff00000f61ba70 x28: 000000000000000d + x27: ffff0000009c8b5a x26: ffff00000f61bb80 + x25: ffff0000009c8b5a x24: 0000000000000012 + x23: 00000000ffffffe0 x22: ffff000008990428 + x21: ffff00000f61bb80 x20: 000000000000000d + x19: 000000000000001f x18: 0000000000000000 + x17: 0000000000000000 x16: ffff800b6d0fb400 + x15: 0000000000000000 x14: ffff800b7fe31ae8 + x13: 00001ed16472c920 x12: ffff000008c6b1c9 + x11: ffff000008cf0580 x10: ffff00000f61bb80 + x9 : 00000000ffffffd8 x8 : 000000000000000c + x7 : ffff800b684b8000 x6 : 0000000000000000 + x5 : 0000000000000065 x4 : 0000000000000001 + x3 : ffff0a00ffffff04 x2 : 000000000000001f + x1 : 0000000000000000 x0 : 000000000000000d + Call trace: + string+0x3c/0x80 + vsnprintf+0x294/0x7e0 + snprintf+0x44/0x50 + __bnxt_open_nic+0x34c/0x928 [bnxt_en] + bnxt_open+0xe8/0x238 [bnxt_en] + __dev_open+0xbc/0x130 + __dev_change_flags+0x12c/0x168 + dev_change_flags+0x20/0x60 + ... + +Ordinarily, a call to bnxt_setup_inta() (not in trace due to inlining) +would not be expected on a system supporting MSIX at all. However, if +bnxt_init_int_mode() does not end up being called after the call to +bnxt_clear_int_mode() in bnxt_fw_reset_close(), then the driver will +think that only INTA is supported and bp->irq_tbl will be NULL, +causing the above crash. + +In the error recovery scenario, we call bnxt_clear_int_mode() in +bnxt_fw_reset_close() early in the sequence. Ordinarily, we will +call bnxt_init_int_mode() in bnxt_hwrm_if_change() after we +reestablish communication with the firmware after reset. However, +if the sequence has to abort before we call bnxt_init_int_mode() and +if the user later attempts to re-open the device, then it will cause +the crash above. + +We fix it in 2 ways: + +1. Check for bp->irq_tbl in bnxt_setup_int_mode(). If it is NULL, call +bnxt_init_init_mode(). + +2. If we need to abort in bnxt_hwrm_if_change() and cannot complete +the error recovery sequence, set the BNXT_STATE_ABORT_ERR flag. This +will cause more drastic recovery at the next attempt to re-open the +device, including a call to bnxt_init_int_mode(). + +Fixes: 3bc7d4a352ef ("bnxt_en: Add BNXT_STATE_IN_FW_RESET state.") +Reviewed-by: Scott Branden +Signed-off-by: Edwin Peer +Signed-off-by: Michael Chan +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +@@ -8430,10 +8430,18 @@ static void bnxt_setup_inta(struct bnxt + bp->irq_tbl[0].handler = bnxt_inta; + } + ++static int bnxt_init_int_mode(struct bnxt *bp); ++ + static int bnxt_setup_int_mode(struct bnxt *bp) + { + int rc; + ++ if (!bp->irq_tbl) { ++ rc = bnxt_init_int_mode(bp); ++ if (rc || !bp->irq_tbl) ++ return rc ?: -ENODEV; ++ } ++ + if (bp->flags & BNXT_FLAG_USING_MSIX) + bnxt_setup_msix(bp); + else +@@ -8618,7 +8626,7 @@ static int bnxt_init_inta(struct bnxt *b + + static int bnxt_init_int_mode(struct bnxt *bp) + { +- int rc = 0; ++ int rc = -ENODEV; + + if (bp->flags & BNXT_FLAG_MSIX_CAP) + rc = bnxt_init_msix(bp); +@@ -9339,7 +9347,8 @@ static int bnxt_hwrm_if_change(struct bn + { + struct hwrm_func_drv_if_change_output *resp = bp->hwrm_cmd_resp_addr; + struct hwrm_func_drv_if_change_input req = {0}; +- bool resc_reinit = false, fw_reset = false; ++ bool fw_reset = !bp->irq_tbl; ++ bool resc_reinit = false; + u32 flags = 0; + int rc; + +@@ -9367,6 +9376,7 @@ static int bnxt_hwrm_if_change(struct bn + + if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) && !fw_reset) { + netdev_err(bp->dev, "RESET_DONE not set during FW reset.\n"); ++ set_bit(BNXT_STATE_ABORT_ERR, &bp->state); + return -ENODEV; + } + if (resc_reinit || fw_reset) { diff --git a/queue-5.10/cipso-calipso-resolve-a-number-of-problems-with-the-doi-refcounts.patch b/queue-5.10/cipso-calipso-resolve-a-number-of-problems-with-the-doi-refcounts.patch new file mode 100644 index 00000000000..ca71479c7bc --- /dev/null +++ b/queue-5.10/cipso-calipso-resolve-a-number-of-problems-with-the-doi-refcounts.patch @@ -0,0 +1,134 @@ +From ad5d07f4a9cd671233ae20983848874731102c08 Mon Sep 17 00:00:00 2001 +From: Paul Moore +Date: Thu, 4 Mar 2021 16:29:51 -0500 +Subject: cipso,calipso: resolve a number of problems with the DOI refcounts + +From: Paul Moore + +commit ad5d07f4a9cd671233ae20983848874731102c08 upstream. + +The current CIPSO and CALIPSO refcounting scheme for the DOI +definitions is a bit flawed in that we: + +1. Don't correctly match gets/puts in netlbl_cipsov4_list(). +2. Decrement the refcount on each attempt to remove the DOI from the + DOI list, only removing it from the list once the refcount drops + to zero. + +This patch fixes these problems by adding the missing "puts" to +netlbl_cipsov4_list() and introduces a more conventional, i.e. +not-buggy, refcounting mechanism to the DOI definitions. Upon the +addition of a DOI to the DOI list, it is initialized with a refcount +of one, removing a DOI from the list removes it from the list and +drops the refcount by one; "gets" and "puts" behave as expected with +respect to refcounts, increasing and decreasing the DOI's refcount by +one. + +Fixes: b1edeb102397 ("netlabel: Replace protocol/NetLabel linking with refrerence counts") +Fixes: d7cce01504a0 ("netlabel: Add support for removing a CALIPSO DOI.") +Reported-by: syzbot+9ec037722d2603a9f52e@syzkaller.appspotmail.com +Signed-off-by: Paul Moore +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv4/cipso_ipv4.c | 11 +---------- + net/ipv6/calipso.c | 14 +++++--------- + net/netlabel/netlabel_cipso_v4.c | 3 +++ + 3 files changed, 9 insertions(+), 19 deletions(-) + +--- a/net/ipv4/cipso_ipv4.c ++++ b/net/ipv4/cipso_ipv4.c +@@ -519,16 +519,10 @@ int cipso_v4_doi_remove(u32 doi, struct + ret_val = -ENOENT; + goto doi_remove_return; + } +- if (!refcount_dec_and_test(&doi_def->refcount)) { +- spin_unlock(&cipso_v4_doi_list_lock); +- ret_val = -EBUSY; +- goto doi_remove_return; +- } + list_del_rcu(&doi_def->list); + spin_unlock(&cipso_v4_doi_list_lock); + +- cipso_v4_cache_invalidate(); +- call_rcu(&doi_def->rcu, cipso_v4_doi_free_rcu); ++ cipso_v4_doi_putdef(doi_def); + ret_val = 0; + + doi_remove_return: +@@ -585,9 +579,6 @@ void cipso_v4_doi_putdef(struct cipso_v4 + + if (!refcount_dec_and_test(&doi_def->refcount)) + return; +- spin_lock(&cipso_v4_doi_list_lock); +- list_del_rcu(&doi_def->list); +- spin_unlock(&cipso_v4_doi_list_lock); + + cipso_v4_cache_invalidate(); + call_rcu(&doi_def->rcu, cipso_v4_doi_free_rcu); +--- a/net/ipv6/calipso.c ++++ b/net/ipv6/calipso.c +@@ -83,6 +83,9 @@ struct calipso_map_cache_entry { + + static struct calipso_map_cache_bkt *calipso_cache; + ++static void calipso_cache_invalidate(void); ++static void calipso_doi_putdef(struct calipso_doi *doi_def); ++ + /* Label Mapping Cache Functions + */ + +@@ -444,15 +447,10 @@ static int calipso_doi_remove(u32 doi, s + ret_val = -ENOENT; + goto doi_remove_return; + } +- if (!refcount_dec_and_test(&doi_def->refcount)) { +- spin_unlock(&calipso_doi_list_lock); +- ret_val = -EBUSY; +- goto doi_remove_return; +- } + list_del_rcu(&doi_def->list); + spin_unlock(&calipso_doi_list_lock); + +- call_rcu(&doi_def->rcu, calipso_doi_free_rcu); ++ calipso_doi_putdef(doi_def); + ret_val = 0; + + doi_remove_return: +@@ -508,10 +506,8 @@ static void calipso_doi_putdef(struct ca + + if (!refcount_dec_and_test(&doi_def->refcount)) + return; +- spin_lock(&calipso_doi_list_lock); +- list_del_rcu(&doi_def->list); +- spin_unlock(&calipso_doi_list_lock); + ++ calipso_cache_invalidate(); + call_rcu(&doi_def->rcu, calipso_doi_free_rcu); + } + +--- a/net/netlabel/netlabel_cipso_v4.c ++++ b/net/netlabel/netlabel_cipso_v4.c +@@ -575,6 +575,7 @@ list_start: + + break; + } ++ cipso_v4_doi_putdef(doi_def); + rcu_read_unlock(); + + genlmsg_end(ans_skb, data); +@@ -583,12 +584,14 @@ list_start: + list_retry: + /* XXX - this limit is a guesstimate */ + if (nlsze_mult < 4) { ++ cipso_v4_doi_putdef(doi_def); + rcu_read_unlock(); + kfree_skb(ans_skb); + nlsze_mult *= 2; + goto list_start; + } + list_failure_lock: ++ cipso_v4_doi_putdef(doi_def); + rcu_read_unlock(); + list_failure: + kfree_skb(ans_skb); diff --git a/queue-5.10/ethtool-fix-the-check-logic-of-at-least-one-channel-for-rx-tx.patch b/queue-5.10/ethtool-fix-the-check-logic-of-at-least-one-channel-for-rx-tx.patch new file mode 100644 index 00000000000..f8a46e84c32 --- /dev/null +++ b/queue-5.10/ethtool-fix-the-check-logic-of-at-least-one-channel-for-rx-tx.patch @@ -0,0 +1,88 @@ +From a4fc088ad4ff4a99d01978aa41065132b574b4b2 Mon Sep 17 00:00:00 2001 +From: Yinjun Zhang +Date: Thu, 25 Feb 2021 13:51:02 +0100 +Subject: ethtool: fix the check logic of at least one channel for RX/TX + +From: Yinjun Zhang + +commit a4fc088ad4ff4a99d01978aa41065132b574b4b2 upstream. + +The command "ethtool -L combined 0" may clean the RX/TX channel +count and skip the error path, since the attrs +tb[ETHTOOL_A_CHANNELS_RX_COUNT] and tb[ETHTOOL_A_CHANNELS_TX_COUNT] +are NULL in this case when recent ethtool is used. + +Tested using ethtool v5.10. + +Fixes: 7be92514b99c ("ethtool: check if there is at least one channel for TX/RX in the core") +Signed-off-by: Yinjun Zhang +Signed-off-by: Simon Horman +Signed-off-by: Louis Peens +Link: https://lore.kernel.org/r/20210225125102.23989-1-simon.horman@netronome.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/ethtool/channels.c | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +--- a/net/ethtool/channels.c ++++ b/net/ethtool/channels.c +@@ -116,10 +116,9 @@ int ethnl_set_channels(struct sk_buff *s + struct ethtool_channels channels = {}; + struct ethnl_req_info req_info = {}; + struct nlattr **tb = info->attrs; +- const struct nlattr *err_attr; ++ u32 err_attr, max_rx_in_use = 0; + const struct ethtool_ops *ops; + struct net_device *dev; +- u32 max_rx_in_use = 0; + int ret; + + ret = ethnl_parse_header_dev_get(&req_info, +@@ -157,34 +156,35 @@ int ethnl_set_channels(struct sk_buff *s + + /* ensure new channel counts are within limits */ + if (channels.rx_count > channels.max_rx) +- err_attr = tb[ETHTOOL_A_CHANNELS_RX_COUNT]; ++ err_attr = ETHTOOL_A_CHANNELS_RX_COUNT; + else if (channels.tx_count > channels.max_tx) +- err_attr = tb[ETHTOOL_A_CHANNELS_TX_COUNT]; ++ err_attr = ETHTOOL_A_CHANNELS_TX_COUNT; + else if (channels.other_count > channels.max_other) +- err_attr = tb[ETHTOOL_A_CHANNELS_OTHER_COUNT]; ++ err_attr = ETHTOOL_A_CHANNELS_OTHER_COUNT; + else if (channels.combined_count > channels.max_combined) +- err_attr = tb[ETHTOOL_A_CHANNELS_COMBINED_COUNT]; ++ err_attr = ETHTOOL_A_CHANNELS_COMBINED_COUNT; + else +- err_attr = NULL; ++ err_attr = 0; + if (err_attr) { + ret = -EINVAL; +- NL_SET_ERR_MSG_ATTR(info->extack, err_attr, ++ NL_SET_ERR_MSG_ATTR(info->extack, tb[err_attr], + "requested channel count exceeds maximum"); + goto out_ops; + } + + /* ensure there is at least one RX and one TX channel */ + if (!channels.combined_count && !channels.rx_count) +- err_attr = tb[ETHTOOL_A_CHANNELS_RX_COUNT]; ++ err_attr = ETHTOOL_A_CHANNELS_RX_COUNT; + else if (!channels.combined_count && !channels.tx_count) +- err_attr = tb[ETHTOOL_A_CHANNELS_TX_COUNT]; ++ err_attr = ETHTOOL_A_CHANNELS_TX_COUNT; + else +- err_attr = NULL; ++ err_attr = 0; + if (err_attr) { + if (mod_combined) +- err_attr = tb[ETHTOOL_A_CHANNELS_COMBINED_COUNT]; ++ err_attr = ETHTOOL_A_CHANNELS_COMBINED_COUNT; + ret = -EINVAL; +- NL_SET_ERR_MSG_ATTR(info->extack, err_attr, "requested channel counts would result in no RX or TX channel being configured"); ++ NL_SET_ERR_MSG_ATTR(info->extack, tb[err_attr], ++ "requested channel counts would result in no RX or TX channel being configured"); + goto out_ops; + } + diff --git a/queue-5.10/ixgbe-fail-to-create-xfrm-offload-of-ipsec-tunnel-mode-sa.patch b/queue-5.10/ixgbe-fail-to-create-xfrm-offload-of-ipsec-tunnel-mode-sa.patch new file mode 100644 index 00000000000..a748b66f4e7 --- /dev/null +++ b/queue-5.10/ixgbe-fail-to-create-xfrm-offload-of-ipsec-tunnel-mode-sa.patch @@ -0,0 +1,53 @@ +From d785e1fec60179f534fbe8d006c890e5ad186e51 Mon Sep 17 00:00:00 2001 +From: Antony Antony +Date: Wed, 14 Oct 2020 16:17:48 +0200 +Subject: ixgbe: fail to create xfrm offload of IPsec tunnel mode SA + +From: Antony Antony + +commit d785e1fec60179f534fbe8d006c890e5ad186e51 upstream. + +Based on talks and indirect references ixgbe IPsec offlod do not +support IPsec tunnel mode offload. It can only support IPsec transport +mode offload. Now explicitly fail when creating non transport mode SA +with offload to avoid false performance expectations. + +Fixes: 63a67fe229ea ("ixgbe: add ipsec offload add and remove SA") +Signed-off-by: Antony Antony +Acked-by: Shannon Nelson +Tested-by: Tony Brelinski +Signed-off-by: Tony Nguyen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 5 +++++ + drivers/net/ethernet/intel/ixgbevf/ipsec.c | 5 +++++ + 2 files changed, 10 insertions(+) + +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +@@ -575,6 +575,11 @@ static int ixgbe_ipsec_add_sa(struct xfr + return -EINVAL; + } + ++ if (xs->props.mode != XFRM_MODE_TRANSPORT) { ++ netdev_err(dev, "Unsupported mode for ipsec offload\n"); ++ return -EINVAL; ++ } ++ + if (ixgbe_ipsec_check_mgmt_ip(xs)) { + netdev_err(dev, "IPsec IP addr clash with mgmt filters\n"); + return -EINVAL; +--- a/drivers/net/ethernet/intel/ixgbevf/ipsec.c ++++ b/drivers/net/ethernet/intel/ixgbevf/ipsec.c +@@ -272,6 +272,11 @@ static int ixgbevf_ipsec_add_sa(struct x + return -EINVAL; + } + ++ if (xs->props.mode != XFRM_MODE_TRANSPORT) { ++ netdev_err(dev, "Unsupported mode for ipsec offload\n"); ++ return -EINVAL; ++ } ++ + if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) { + struct rx_sa rsa; + diff --git a/queue-5.10/mlxsw-spectrum_ethtool-add-an-external-speed-to-ptys-register.patch b/queue-5.10/mlxsw-spectrum_ethtool-add-an-external-speed-to-ptys-register.patch new file mode 100644 index 00000000000..c0e8146825e --- /dev/null +++ b/queue-5.10/mlxsw-spectrum_ethtool-add-an-external-speed-to-ptys-register.patch @@ -0,0 +1,69 @@ +From ae9b24ddb69b4e31cda1b5e267a5a08a1db11717 Mon Sep 17 00:00:00 2001 +From: Danielle Ratson +Date: Thu, 25 Feb 2021 18:57:20 +0200 +Subject: mlxsw: spectrum_ethtool: Add an external speed to PTYS register + +From: Danielle Ratson + +commit ae9b24ddb69b4e31cda1b5e267a5a08a1db11717 upstream. + +Currently, only external bits are added to the PTYS register, whereas +there is one external bit that is wrongly marked as internal, and so was +recently removed from the register. + +Add that bit to the PTYS register again, as this bit is no longer +internal. + +Its removal resulted in '100000baseLR4_ER4/Full' link mode no longer +being supported, causing a regression on some setups. + +Fixes: 5bf01b571cf4 ("mlxsw: spectrum_ethtool: Remove internal speeds from PTYS register") +Signed-off-by: Danielle Ratson +Reported-by: Eddie Shklaer +Tested-by: Eddie Shklaer +Reviewed-by: Jiri Pirko +Signed-off-by: Ido Schimmel +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/mellanox/mlxsw/reg.h | 1 + + drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 5 +++++ + drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 3 ++- + 3 files changed, 8 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h ++++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h +@@ -4208,6 +4208,7 @@ MLXSW_ITEM32(reg, ptys, ext_eth_proto_ca + #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_CR4 BIT(20) + #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_SR4 BIT(21) + #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4 BIT(22) ++#define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4 BIT(23) + #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_CR BIT(27) + #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_KR BIT(28) + #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_SR BIT(29) +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +@@ -1171,6 +1171,11 @@ static const struct mlxsw_sp1_port_link_ + .mask_ethtool = ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT, + .speed = SPEED_100000, + }, ++ { ++ .mask = MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4, ++ .mask_ethtool = ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT, ++ .speed = SPEED_100000, ++ }, + }; + + #define MLXSW_SP1_PORT_LINK_MODE_LEN ARRAY_SIZE(mlxsw_sp1_port_link_mode) +--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c +@@ -612,7 +612,8 @@ static const struct mlxsw_sx_port_link_m + { + .mask = MLXSW_REG_PTYS_ETH_SPEED_100GBASE_CR4 | + MLXSW_REG_PTYS_ETH_SPEED_100GBASE_SR4 | +- MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4, ++ MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4 | ++ MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4, + .speed = 100000, + }, + }; diff --git a/queue-5.10/net-bonding-fix-error-return-code-of-bond_neigh_init.patch b/queue-5.10/net-bonding-fix-error-return-code-of-bond_neigh_init.patch new file mode 100644 index 00000000000..eafc26191f7 --- /dev/null +++ b/queue-5.10/net-bonding-fix-error-return-code-of-bond_neigh_init.patch @@ -0,0 +1,42 @@ +From 2055a99da8a253a357bdfd359b3338ef3375a26c Mon Sep 17 00:00:00 2001 +From: Jia-Ju Bai +Date: Sun, 7 Mar 2021 19:11:02 -0800 +Subject: net: bonding: fix error return code of bond_neigh_init() + +From: Jia-Ju Bai + +commit 2055a99da8a253a357bdfd359b3338ef3375a26c upstream. + +When slave is NULL or slave_ops->ndo_neigh_setup is NULL, no error +return code of bond_neigh_init() is assigned. +To fix this bug, ret is assigned with -EINVAL in these cases. + +Fixes: 9e99bfefdbce ("bonding: fix bond_neigh_init()") +Reported-by: TOTE Robot +Signed-off-by: Jia-Ju Bai +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/bonding/bond_main.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/net/bonding/bond_main.c ++++ b/drivers/net/bonding/bond_main.c +@@ -3918,11 +3918,15 @@ static int bond_neigh_init(struct neighb + + rcu_read_lock(); + slave = bond_first_slave_rcu(bond); +- if (!slave) ++ if (!slave) { ++ ret = -EINVAL; + goto out; ++ } + slave_ops = slave->dev->netdev_ops; +- if (!slave_ops->ndo_neigh_setup) ++ if (!slave_ops->ndo_neigh_setup) { ++ ret = -EINVAL; + goto out; ++ } + + /* TODO: find another way [1] to implement this. + * Passing a zeroed structure is fragile, diff --git a/queue-5.10/net-davicom-fix-regulator-not-turned-off-on-driver-removal.patch b/queue-5.10/net-davicom-fix-regulator-not-turned-off-on-driver-removal.patch new file mode 100644 index 00000000000..22a4c8169f3 --- /dev/null +++ b/queue-5.10/net-davicom-fix-regulator-not-turned-off-on-driver-removal.patch @@ -0,0 +1,54 @@ +From cf9e60aa69ae6c40d3e3e4c94dd6c8de31674e9b Mon Sep 17 00:00:00 2001 +From: Paul Cercueil +Date: Sun, 7 Mar 2021 13:17:48 +0000 +Subject: net: davicom: Fix regulator not turned off on driver removal + +From: Paul Cercueil + +commit cf9e60aa69ae6c40d3e3e4c94dd6c8de31674e9b upstream. + +We must disable the regulator that was enabled in the probe function. + +Fixes: 7994fe55a4a2 ("dm9000: Add regulator and reset support to dm9000") +Signed-off-by: Paul Cercueil +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/davicom/dm9000.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/davicom/dm9000.c ++++ b/drivers/net/ethernet/davicom/dm9000.c +@@ -133,6 +133,8 @@ struct board_info { + u32 wake_state; + + int ip_summed; ++ ++ struct regulator *power_supply; + }; + + /* debug code */ +@@ -1484,6 +1486,8 @@ dm9000_probe(struct platform_device *pde + + db->dev = &pdev->dev; + db->ndev = ndev; ++ if (!IS_ERR(power)) ++ db->power_supply = power; + + spin_lock_init(&db->lock); + mutex_init(&db->addr_lock); +@@ -1769,10 +1773,13 @@ static int + dm9000_drv_remove(struct platform_device *pdev) + { + struct net_device *ndev = platform_get_drvdata(pdev); ++ struct board_info *dm = to_dm9000_board(ndev); + + unregister_netdev(ndev); +- dm9000_release_board(pdev, netdev_priv(ndev)); ++ dm9000_release_board(pdev, dm); + free_netdev(ndev); /* free device structure */ ++ if (dm->power_supply) ++ regulator_disable(dm->power_supply); + + dev_dbg(&pdev->dev, "released and freed device\n"); + return 0; diff --git a/queue-5.10/net-davicom-fix-regulator-not-turned-off-on-failed-probe.patch b/queue-5.10/net-davicom-fix-regulator-not-turned-off-on-failed-probe.patch new file mode 100644 index 00000000000..106ea74cf02 --- /dev/null +++ b/queue-5.10/net-davicom-fix-regulator-not-turned-off-on-failed-probe.patch @@ -0,0 +1,55 @@ +From ac88c531a5b38877eba2365a3f28f0c8b513dc33 Mon Sep 17 00:00:00 2001 +From: Paul Cercueil +Date: Sun, 7 Mar 2021 13:17:47 +0000 +Subject: net: davicom: Fix regulator not turned off on failed probe + +From: Paul Cercueil + +commit ac88c531a5b38877eba2365a3f28f0c8b513dc33 upstream. + +When the probe fails or requests to be defered, we must disable the +regulator that was previously enabled. + +Fixes: 7994fe55a4a2 ("dm9000: Add regulator and reset support to dm9000") +Signed-off-by: Paul Cercueil +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/davicom/dm9000.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/davicom/dm9000.c ++++ b/drivers/net/ethernet/davicom/dm9000.c +@@ -1452,7 +1452,7 @@ dm9000_probe(struct platform_device *pde + if (ret) { + dev_err(dev, "failed to request reset gpio %d: %d\n", + reset_gpios, ret); +- return -ENODEV; ++ goto out_regulator_disable; + } + + /* According to manual PWRST# Low Period Min 1ms */ +@@ -1464,8 +1464,10 @@ dm9000_probe(struct platform_device *pde + + if (!pdata) { + pdata = dm9000_parse_dt(&pdev->dev); +- if (IS_ERR(pdata)) +- return PTR_ERR(pdata); ++ if (IS_ERR(pdata)) { ++ ret = PTR_ERR(pdata); ++ goto out_regulator_disable; ++ } + } + + /* Init network device */ +@@ -1706,6 +1708,10 @@ out: + dm9000_release_board(pdev, db); + free_netdev(ndev); + ++out_regulator_disable: ++ if (!IS_ERR(power)) ++ regulator_disable(power); ++ + return ret; + } + diff --git a/queue-5.10/net-dsa-sja1105-fix-sgmii-pcs-being-forced-to-speed_unknown-instead-of-speed_10.patch b/queue-5.10/net-dsa-sja1105-fix-sgmii-pcs-being-forced-to-speed_unknown-instead-of-speed_10.patch new file mode 100644 index 00000000000..de43ec7e35c --- /dev/null +++ b/queue-5.10/net-dsa-sja1105-fix-sgmii-pcs-being-forced-to-speed_unknown-instead-of-speed_10.patch @@ -0,0 +1,38 @@ +From 053d8ad10d585adf9891fcd049637536e2fe9ea7 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Thu, 4 Mar 2021 12:56:53 +0200 +Subject: net: dsa: sja1105: fix SGMII PCS being forced to SPEED_UNKNOWN instead of SPEED_10 + +From: Vladimir Oltean + +commit 053d8ad10d585adf9891fcd049637536e2fe9ea7 upstream. + +When using MLO_AN_PHY or MLO_AN_FIXED, the MII_BMCR of the SGMII PCS is +read before resetting the switch so it can be reprogrammed afterwards. +This works for the speeds of 1Gbps and 100Mbps, but not for 10Mbps, +because SPEED_10 is actually 0, so AND-ing anything with 0 is false, +therefore that last branch is dead code. + +Do what others do (genphy_read_status_fixed, phy_mii_ioctl) and just +remove the check for SPEED_10, let it fall into the default case. + +Fixes: ffe10e679cec ("net: dsa: sja1105: Add support for the SGMII port") +Signed-off-by: Vladimir Oltean +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/dsa/sja1105/sja1105_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/dsa/sja1105/sja1105_main.c ++++ b/drivers/net/dsa/sja1105/sja1105_main.c +@@ -1834,7 +1834,7 @@ out_unlock_ptp: + speed = SPEED_1000; + else if (bmcr & BMCR_SPEED100) + speed = SPEED_100; +- else if (bmcr & BMCR_SPEED10) ++ else + speed = SPEED_10; + + sja1105_sgmii_pcs_force_speed(priv, speed); diff --git a/queue-5.10/net-enetc-allow-hardware-timestamping-on-tx-queues-with-tc-etf-enabled.patch b/queue-5.10/net-enetc-allow-hardware-timestamping-on-tx-queues-with-tc-etf-enabled.patch new file mode 100644 index 00000000000..49d40144b72 --- /dev/null +++ b/queue-5.10/net-enetc-allow-hardware-timestamping-on-tx-queues-with-tc-etf-enabled.patch @@ -0,0 +1,84 @@ +From 29d98f54a4fe1b6a9089bec8715a1b89ff9ad59c Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Sun, 7 Mar 2021 15:23:39 +0200 +Subject: net: enetc: allow hardware timestamping on TX queues with tc-etf enabled + +From: Vladimir Oltean + +commit 29d98f54a4fe1b6a9089bec8715a1b89ff9ad59c upstream. + +The txtime is passed to the driver in skb->skb_mstamp_ns, which is +actually in a union with skb->tstamp (the place where software +timestamps are kept). + +Since commit b50a5c70ffa4 ("net: allow simultaneous SW and HW transmit +timestamping"), __sock_recv_timestamp has some logic for making sure +that the two calls to skb_tstamp_tx: + +skb_tx_timestamp(skb) # Software timestamp in the driver +-> skb_tstamp_tx(skb, NULL) + +and + +skb_tstamp_tx(skb, &shhwtstamps) # Hardware timestamp in the driver + +will both do the right thing and in a race-free manner, meaning that +skb_tx_timestamp will deliver a cmsg with the software timestamp only, +and skb_tstamp_tx with a non-NULL hwtstamps argument will deliver a cmsg +with the hardware timestamp only. + +Why are races even possible? Well, because although the software timestamp +skb->tstamp is private per skb, the hardware timestamp skb_hwtstamps(skb) +lives in skb_shinfo(skb), an area which is shared between skbs and their +clones. And skb_tstamp_tx works by cloning the packets when timestamping +them, therefore attempting to perform hardware timestamping on an skb's +clone will also change the hardware timestamp of the original skb. And +the original skb might have been yet again cloned for software +timestamping, at an earlier stage. + +So the logic in __sock_recv_timestamp can't be as simple as saying +"does this skb have a hardware timestamp? if yes I'll send the hardware +timestamp to the socket, otherwise I'll send the software timestamp", +precisely because the hardware timestamp is shared. +Instead, it's quite the other way around: __sock_recv_timestamp says +"does this skb have a software timestamp? if yes, I'll send the software +timestamp, otherwise the hardware one". This works because the software +timestamp is not shared with clones. + +But that means we have a problem when we attempt hardware timestamping +with skbs that don't have the skb->tstamp == 0. __sock_recv_timestamp +will say "oh, yeah, this must be some sort of odd clone" and will not +deliver the hardware timestamp to the socket. And this is exactly what +is happening when we have txtime enabled on the socket: as mentioned, +that is put in a union with skb->tstamp, so it is quite easy to mistake +it. + +Do what other drivers do (intel igb/igc) and write zero to skb->tstamp +before taking the hardware timestamp. It's of no use to us now (we're +already on the TX confirmation path). + +Fixes: 0d08c9ec7d6e ("enetc: add support time specific departure base on the qos etf") +Cc: Vinicius Costa Gomes +Signed-off-by: Vladimir Oltean +Acked-by: Vinicius Costa Gomes +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/freescale/enetc/enetc.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/ethernet/freescale/enetc/enetc.c ++++ b/drivers/net/ethernet/freescale/enetc/enetc.c +@@ -384,6 +384,12 @@ static void enetc_tstamp_tx(struct sk_bu + if (skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS) { + memset(&shhwtstamps, 0, sizeof(shhwtstamps)); + shhwtstamps.hwtstamp = ns_to_ktime(tstamp); ++ /* Ensure skb_mstamp_ns, which might have been populated with ++ * the txtime, is not mistaken for a software timestamp, ++ * because this will prevent the dispatch of our hardware ++ * timestamp to the socket. ++ */ ++ skb->tstamp = ktime_set(0, 0); + skb_tstamp_tx(skb, &shhwtstamps); + } + } diff --git a/queue-5.10/net-hns3-fix-bug-when-calculating-the-tcam-table-info.patch b/queue-5.10/net-hns3-fix-bug-when-calculating-the-tcam-table-info.patch new file mode 100644 index 00000000000..1266b5a0295 --- /dev/null +++ b/queue-5.10/net-hns3-fix-bug-when-calculating-the-tcam-table-info.patch @@ -0,0 +1,37 @@ +From b36fc875bcdee56865c444a2cdae17d354a6d5f5 Mon Sep 17 00:00:00 2001 +From: Jian Shen +Date: Sat, 27 Feb 2021 15:24:53 +0800 +Subject: net: hns3: fix bug when calculating the TCAM table info + +From: Jian Shen + +commit b36fc875bcdee56865c444a2cdae17d354a6d5f5 upstream. + +The function hclge_fd_convert_tuple() is used to convert tuples +and tuples mask to TCAM x and y. But it misuses the source mac +as source mac mask when convert INNER_SRC_MAC, which may cause +the flow director rule works unexpectedly. So fix it. + +Fixes: 117328680288 ("net: hns3: Add input key and action config support for flow director") +Signed-off-by: Jian Shen +Signed-off-by: Huazhong Tan +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +@@ -5115,9 +5115,9 @@ static bool hclge_fd_convert_tuple(u32 t + case BIT(INNER_SRC_MAC): + for (i = 0; i < ETH_ALEN; i++) { + calc_x(key_x[ETH_ALEN - 1 - i], rule->tuples.src_mac[i], +- rule->tuples.src_mac[i]); ++ rule->tuples_mask.src_mac[i]); + calc_y(key_y[ETH_ALEN - 1 - i], rule->tuples.src_mac[i], +- rule->tuples.src_mac[i]); ++ rule->tuples_mask.src_mac[i]); + } + + return true; diff --git a/queue-5.10/net-hns3-fix-query-vlan-mask-value-error-for-flow-director.patch b/queue-5.10/net-hns3-fix-query-vlan-mask-value-error-for-flow-director.patch new file mode 100644 index 00000000000..db00706868c --- /dev/null +++ b/queue-5.10/net-hns3-fix-query-vlan-mask-value-error-for-flow-director.patch @@ -0,0 +1,53 @@ +From c75ec148a316e8cf52274d16b9b422703b96f5ce Mon Sep 17 00:00:00 2001 +From: Jian Shen +Date: Sat, 27 Feb 2021 15:24:52 +0800 +Subject: net: hns3: fix query vlan mask value error for flow director + +From: Jian Shen + +commit c75ec148a316e8cf52274d16b9b422703b96f5ce upstream. + +Currently, the driver returns VLAN_VID_MASK for vlan mask field, +when get flow director rule information for rule doesn't use vlan. +It may cause the vlan mask value display as 0xf000 in this +case, like below: + +estuary:/$ ethtool -u eth1 +50 RX rings available +Total 1 rules + +Filter: 2 +Rule Type: TCP over IPv4 +Src IP addr: 0.0.0.0 mask: 255.255.255.255 +Dest IP addr: 0.0.0.0 mask: 255.255.255.255 +TOS: 0x0 mask: 0xff +Src port: 0 mask: 0xffff +Dest port: 0 mask: 0xffff +VLAN EtherType: 0x0 mask: 0xffff +VLAN: 0x0 mask: 0xf000 +User-defined: 0x1234 mask: 0x0 +Action: Direct to queue 3 + +Fix it by return 0. + +Fixes: 05c2314fe6a8 ("net: hns3: Add support for rule query of flow director") +Signed-off-by: Jian Shen +Signed-off-by: Huazhong Tan +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +@@ -6183,8 +6183,7 @@ static void hclge_fd_get_ext_info(struct + fs->h_ext.vlan_tci = cpu_to_be16(rule->tuples.vlan_tag1); + fs->m_ext.vlan_tci = + rule->unused_tuple & BIT(INNER_VLAN_TAG_FST) ? +- cpu_to_be16(VLAN_VID_MASK) : +- cpu_to_be16(rule->tuples_mask.vlan_tag1); ++ 0 : cpu_to_be16(rule->tuples_mask.vlan_tag1); + } + + if (fs->flow_type & FLOW_MAC_EXT) { diff --git a/queue-5.10/net-lapbether-remove-netif_start_queue-netif_stop_queue.patch b/queue-5.10/net-lapbether-remove-netif_start_queue-netif_stop_queue.patch new file mode 100644 index 00000000000..f2864b7ab63 --- /dev/null +++ b/queue-5.10/net-lapbether-remove-netif_start_queue-netif_stop_queue.patch @@ -0,0 +1,61 @@ +From f7d9d4854519fdf4d45c70a4d953438cd88e7e58 Mon Sep 17 00:00:00 2001 +From: Xie He +Date: Sun, 7 Mar 2021 03:33:07 -0800 +Subject: net: lapbether: Remove netif_start_queue / netif_stop_queue + +From: Xie He + +commit f7d9d4854519fdf4d45c70a4d953438cd88e7e58 upstream. + +For the devices in this driver, the default qdisc is "noqueue", +because their "tx_queue_len" is 0. + +In function "__dev_queue_xmit" in "net/core/dev.c", devices with the +"noqueue" qdisc are specially handled. Packets are transmitted without +being queued after a "dev->flags & IFF_UP" check. However, it's possible +that even if this check succeeds, "ops->ndo_stop" may still have already +been called. This is because in "__dev_close_many", "ops->ndo_stop" is +called before clearing the "IFF_UP" flag. + +If we call "netif_stop_queue" in "ops->ndo_stop", then it's possible in +"__dev_queue_xmit", it sees the "IFF_UP" flag is present, and then it +checks "netif_xmit_stopped" and finds that the queue is already stopped. +In this case, it will complain that: +"Virtual device ... asks to queue packet!" + +To prevent "__dev_queue_xmit" from generating this complaint, we should +not call "netif_stop_queue" in "ops->ndo_stop". + +We also don't need to call "netif_start_queue" in "ops->ndo_open", +because after a netdev is allocated and registered, the +"__QUEUE_STATE_DRV_XOFF" flag is initially not set, so there is no need +to call "netif_start_queue" to clear it. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Xie He +Acked-by: Martin Schiller +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wan/lapbether.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/net/wan/lapbether.c ++++ b/drivers/net/wan/lapbether.c +@@ -283,7 +283,6 @@ static int lapbeth_open(struct net_devic + return -ENODEV; + } + +- netif_start_queue(dev); + return 0; + } + +@@ -291,8 +290,6 @@ static int lapbeth_close(struct net_devi + { + int err; + +- netif_stop_queue(dev); +- + if ((err = lapb_unregister(dev)) != LAPB_OK) + pr_err("lapb_unregister error: %d\n", err); + diff --git a/queue-5.10/net-mscc-ocelot-properly-reject-destination-ip-keys-in-vcap-is1.patch b/queue-5.10/net-mscc-ocelot-properly-reject-destination-ip-keys-in-vcap-is1.patch new file mode 100644 index 00000000000..f623e739114 --- /dev/null +++ b/queue-5.10/net-mscc-ocelot-properly-reject-destination-ip-keys-in-vcap-is1.patch @@ -0,0 +1,43 @@ +From f1becbed411c6fa29d7ce3def3a1dcd4f63f2d74 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Thu, 4 Mar 2021 12:29:43 +0200 +Subject: net: mscc: ocelot: properly reject destination IP keys in VCAP IS1 + +From: Vladimir Oltean + +commit f1becbed411c6fa29d7ce3def3a1dcd4f63f2d74 upstream. + +An attempt is made to warn the user about the fact that VCAP IS1 cannot +offload keys matching on destination IP (at least given the current half +key format), but sadly that warning fails miserably in practice, due to +the fact that it operates on an uninitialized "match" variable. We must +first decode the keys from the flow rule. + +Fixes: 75944fda1dfe ("net: mscc: ocelot: offload ingress skbedit and vlan actions to VCAP IS1") +Reported-by: Colin Ian King +Signed-off-by: Vladimir Oltean +Reviewed-by: Colin Ian King +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/mscc/ocelot_flower.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mscc/ocelot_flower.c ++++ b/drivers/net/ethernet/mscc/ocelot_flower.c +@@ -540,13 +540,14 @@ ocelot_flower_parse_key(struct ocelot *o + return -EOPNOTSUPP; + } + ++ flow_rule_match_ipv4_addrs(rule, &match); ++ + if (filter->block_id == VCAP_IS1 && *(u32 *)&match.mask->dst) { + NL_SET_ERR_MSG_MOD(extack, + "Key type S1_NORMAL cannot match on destination IP"); + return -EOPNOTSUPP; + } + +- flow_rule_match_ipv4_addrs(rule, &match); + tmp = &filter->key.ipv4.sip.value.addr[0]; + memcpy(tmp, &match.key->src, 4); + diff --git a/queue-5.10/net-phy-make-mdio_bus_phy_suspend-resume-as-__maybe_unused.patch b/queue-5.10/net-phy-make-mdio_bus_phy_suspend-resume-as-__maybe_unused.patch new file mode 100644 index 00000000000..035c33c12b6 --- /dev/null +++ b/queue-5.10/net-phy-make-mdio_bus_phy_suspend-resume-as-__maybe_unused.patch @@ -0,0 +1,66 @@ +From 7f654157f0aefba04cd7f6297351c87b76b47b89 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Thu, 25 Feb 2021 15:57:27 +0100 +Subject: net: phy: make mdio_bus_phy_suspend/resume as __maybe_unused + +From: Arnd Bergmann + +commit 7f654157f0aefba04cd7f6297351c87b76b47b89 upstream. + +When CONFIG_PM_SLEEP is disabled, the compiler warns about unused +functions: + +drivers/net/phy/phy_device.c:273:12: error: unused function 'mdio_bus_phy_suspend' [-Werror,-Wunused-function] +static int mdio_bus_phy_suspend(struct device *dev) +drivers/net/phy/phy_device.c:293:12: error: unused function 'mdio_bus_phy_resume' [-Werror,-Wunused-function] +static int mdio_bus_phy_resume(struct device *dev) + +The logic is intentional, so just mark these two as __maybe_unused +and remove the incorrect #ifdef. + +Fixes: 4c0d2e96ba05 ("net: phy: consider that suspend2ram may cut off PHY power") +Signed-off-by: Arnd Bergmann +Reviewed-by: Andrew Lunn +Link: https://lore.kernel.org/r/20210225145748.404410-1-arnd@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/phy/phy_device.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -230,7 +230,6 @@ static struct phy_driver genphy_driver; + static LIST_HEAD(phy_fixup_list); + static DEFINE_MUTEX(phy_fixup_lock); + +-#ifdef CONFIG_PM + static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) + { + struct device_driver *drv = phydev->mdio.dev.driver; +@@ -270,7 +269,7 @@ out: + return !phydev->suspended; + } + +-static int mdio_bus_phy_suspend(struct device *dev) ++static __maybe_unused int mdio_bus_phy_suspend(struct device *dev) + { + struct phy_device *phydev = to_phy_device(dev); + +@@ -290,7 +289,7 @@ static int mdio_bus_phy_suspend(struct d + return phy_suspend(phydev); + } + +-static int mdio_bus_phy_resume(struct device *dev) ++static __maybe_unused int mdio_bus_phy_resume(struct device *dev) + { + struct phy_device *phydev = to_phy_device(dev); + int ret; +@@ -316,7 +315,6 @@ no_resume: + + static SIMPLE_DEV_PM_OPS(mdio_bus_phy_pm_ops, mdio_bus_phy_suspend, + mdio_bus_phy_resume); +-#endif /* CONFIG_PM */ + + /** + * phy_register_fixup - creates a new phy_fixup and adds it to the list diff --git a/queue-5.10/net-qrtr-fix-error-return-code-of-qrtr_sendmsg.patch b/queue-5.10/net-qrtr-fix-error-return-code-of-qrtr_sendmsg.patch new file mode 100644 index 00000000000..43faf2f06b5 --- /dev/null +++ b/queue-5.10/net-qrtr-fix-error-return-code-of-qrtr_sendmsg.patch @@ -0,0 +1,36 @@ +From 179d0ba0c454057a65929c46af0d6ad986754781 Mon Sep 17 00:00:00 2001 +From: Jia-Ju Bai +Date: Mon, 8 Mar 2021 01:13:55 -0800 +Subject: net: qrtr: fix error return code of qrtr_sendmsg() + +From: Jia-Ju Bai + +commit 179d0ba0c454057a65929c46af0d6ad986754781 upstream. + +When sock_alloc_send_skb() returns NULL to skb, no error return code of +qrtr_sendmsg() is assigned. +To fix this bug, rc is assigned with -ENOMEM in this case. + +Fixes: 194ccc88297a ("net: qrtr: Support decoding incoming v2 packets") +Reported-by: TOTE Robot +Signed-off-by: Jia-Ju Bai +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/qrtr/qrtr.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/net/qrtr/qrtr.c ++++ b/net/qrtr/qrtr.c +@@ -935,8 +935,10 @@ static int qrtr_sendmsg(struct socket *s + plen = (len + 3) & ~3; + skb = sock_alloc_send_skb(sk, plen + QRTR_HDR_MAX_SIZE, + msg->msg_flags & MSG_DONTWAIT, &rc); +- if (!skb) ++ if (!skb) { ++ rc = -ENOMEM; + goto out_node; ++ } + + skb_reserve(skb, QRTR_HDR_MAX_SIZE); + diff --git a/queue-5.10/net-sched-avoid-duplicates-in-classes-dump.patch b/queue-5.10/net-sched-avoid-duplicates-in-classes-dump.patch new file mode 100644 index 00000000000..b907195cf03 --- /dev/null +++ b/queue-5.10/net-sched-avoid-duplicates-in-classes-dump.patch @@ -0,0 +1,60 @@ +From bfc2560563586372212b0a8aeca7428975fa91fe Mon Sep 17 00:00:00 2001 +From: Maximilian Heyne +Date: Thu, 4 Mar 2021 14:43:17 +0000 +Subject: net: sched: avoid duplicates in classes dump + +From: Maximilian Heyne + +commit bfc2560563586372212b0a8aeca7428975fa91fe upstream. + +This is a follow up of commit ea3274695353 ("net: sched: avoid +duplicates in qdisc dump") which has fixed the issue only for the qdisc +dump. + +The duplicate printing also occurs when dumping the classes via + tc class show dev eth0 + +Fixes: 59cc1f61f09c ("net: sched: convert qdisc linked list to hashtable") +Signed-off-by: Maximilian Heyne +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/sched/sch_api.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/net/sched/sch_api.c ++++ b/net/sched/sch_api.c +@@ -2167,7 +2167,7 @@ static int tc_dump_tclass_qdisc(struct Q + + static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb, + struct tcmsg *tcm, struct netlink_callback *cb, +- int *t_p, int s_t) ++ int *t_p, int s_t, bool recur) + { + struct Qdisc *q; + int b; +@@ -2178,7 +2178,7 @@ static int tc_dump_tclass_root(struct Qd + if (tc_dump_tclass_qdisc(root, skb, tcm, cb, t_p, s_t) < 0) + return -1; + +- if (!qdisc_dev(root)) ++ if (!qdisc_dev(root) || !recur) + return 0; + + if (tcm->tcm_parent) { +@@ -2213,13 +2213,13 @@ static int tc_dump_tclass(struct sk_buff + s_t = cb->args[0]; + t = 0; + +- if (tc_dump_tclass_root(dev->qdisc, skb, tcm, cb, &t, s_t) < 0) ++ if (tc_dump_tclass_root(dev->qdisc, skb, tcm, cb, &t, s_t, true) < 0) + goto done; + + dev_queue = dev_ingress_queue(dev); + if (dev_queue && + tc_dump_tclass_root(dev_queue->qdisc_sleeping, skb, tcm, cb, +- &t, s_t) < 0) ++ &t, s_t, false) < 0) + goto done; + + done: diff --git a/queue-5.10/net-stmmac-fix-vlan-filter-delete-timeout-issue-in-intel-mgbe-sgmii.patch b/queue-5.10/net-stmmac-fix-vlan-filter-delete-timeout-issue-in-intel-mgbe-sgmii.patch new file mode 100644 index 00000000000..8b7d70db014 --- /dev/null +++ b/queue-5.10/net-stmmac-fix-vlan-filter-delete-timeout-issue-in-intel-mgbe-sgmii.patch @@ -0,0 +1,52 @@ +From 9a7b3950c7e15968e23d83be215e95ccc7c92a53 Mon Sep 17 00:00:00 2001 +From: Ong Boon Leong +Date: Fri, 5 Mar 2021 13:49:30 +0800 +Subject: net: stmmac: Fix VLAN filter delete timeout issue in Intel mGBE SGMII + +From: Ong Boon Leong + +commit 9a7b3950c7e15968e23d83be215e95ccc7c92a53 upstream. + +For Intel mGbE controller, MAC VLAN filter delete operation will time-out +if serdes power-down sequence happened first during driver remove() with +below message. + +[82294.764958] intel-eth-pci 0000:00:1e.4 eth2: stmmac_dvr_remove: removing driver +[82294.778677] intel-eth-pci 0000:00:1e.4 eth2: Timeout accessing MAC_VLAN_Tag_Filter +[82294.779997] intel-eth-pci 0000:00:1e.4 eth2: failed to kill vid 0081/0 +[82294.947053] intel-eth-pci 0000:00:1d.2 eth1: stmmac_dvr_remove: removing driver +[82295.002091] intel-eth-pci 0000:00:1d.1 eth0: stmmac_dvr_remove: removing driver + +Therefore, we delay the serdes power-down to be after unregister_netdev() +which triggers the VLAN filter delete. + +Fixes: b9663b7ca6ff ("net: stmmac: Enable SERDES power up/down sequence") +Signed-off-by: Ong Boon Leong +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -5114,13 +5114,16 @@ int stmmac_dvr_remove(struct device *dev + netdev_info(priv->dev, "%s: removing driver", __func__); + + stmmac_stop_all_dma(priv); ++ stmmac_mac_set(priv, priv->ioaddr, false); ++ netif_carrier_off(ndev); ++ unregister_netdev(ndev); + ++ /* Serdes power down needs to happen after VLAN filter ++ * is deleted that is triggered by unregister_netdev(). ++ */ + if (priv->plat->serdes_powerdown) + priv->plat->serdes_powerdown(ndev, priv->plat->bsp_priv); + +- stmmac_mac_set(priv, priv->ioaddr, false); +- netif_carrier_off(ndev); +- unregister_netdev(ndev); + #ifdef CONFIG_DEBUG_FS + stmmac_exit_fs(ndev); + #endif diff --git a/queue-5.10/net-stmmac-fix-watchdog-timeout-during-suspend-resume-stress-test.patch b/queue-5.10/net-stmmac-fix-watchdog-timeout-during-suspend-resume-stress-test.patch new file mode 100644 index 00000000000..0455c238af6 --- /dev/null +++ b/queue-5.10/net-stmmac-fix-watchdog-timeout-during-suspend-resume-stress-test.patch @@ -0,0 +1,43 @@ +From c511819d138de38e1637eedb645c207e09680d0f Mon Sep 17 00:00:00 2001 +From: Joakim Zhang +Date: Thu, 25 Feb 2021 17:01:11 +0800 +Subject: net: stmmac: fix watchdog timeout during suspend/resume stress test + +From: Joakim Zhang + +commit c511819d138de38e1637eedb645c207e09680d0f upstream. + +stmmac_xmit() call stmmac_tx_timer_arm() at the end to modify tx timer to +do the transmission cleanup work. Imagine such a situation, stmmac enters +suspend immediately after tx timer modified, it's expire callback +stmmac_tx_clean() would not be invoked. This could affect BQL, since +netdev_tx_sent_queue() has been called, but netdev_tx_completed_queue() +have not been involved, as a result, dql_avail(&dev_queue->dql) finally +always return a negative value. + +__dev_queue_xmit->__dev_xmit_skb->qdisc_run->__qdisc_run->qdisc_restart->dequeue_skb: + if ((q->flags & TCQ_F_ONETXQUEUE) && + netif_xmit_frozen_or_stopped(txq)) // __QUEUE_STATE_STACK_XOFF is set + +Net core will stop transmitting any more. Finillay, net watchdong would timeout. +To fix this issue, we should call netdev_tx_reset_queue() in stmmac_resume(). + +Fixes: 54139cf3bb33 ("net: stmmac: adding multiple buffers for rx") +Signed-off-by: Joakim Zhang +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -5230,6 +5230,8 @@ static void stmmac_reset_queues_param(st + tx_q->cur_tx = 0; + tx_q->dirty_tx = 0; + tx_q->mss = 0; ++ ++ netdev_tx_reset_queue(netdev_get_tx_queue(priv->dev, queue)); + } + } + diff --git a/queue-5.10/net-stmmac-fix-wrongly-set-buffer2-valid-when-sph-unsupport.patch b/queue-5.10/net-stmmac-fix-wrongly-set-buffer2-valid-when-sph-unsupport.patch new file mode 100644 index 00000000000..d4c4f127f65 --- /dev/null +++ b/queue-5.10/net-stmmac-fix-wrongly-set-buffer2-valid-when-sph-unsupport.patch @@ -0,0 +1,93 @@ +From 396e13e11577b614db77db0bbb6fca935b94eb1b Mon Sep 17 00:00:00 2001 +From: Joakim Zhang +Date: Thu, 25 Feb 2021 17:01:13 +0800 +Subject: net: stmmac: fix wrongly set buffer2 valid when sph unsupport + +From: Joakim Zhang + +commit 396e13e11577b614db77db0bbb6fca935b94eb1b upstream. + +In current driver, buffer2 available only when hardware supports split +header. Wrongly set buffer2 valid in stmmac_rx_refill when refill buffer +address. You can see that desc3 is 0x81000000 after initialization, but +turn out to be 0x83000000 after refill. + +Fixes: 67afd6d1cfdf ("net: stmmac: Add Split Header support and enable it in XGMAC cores") +Signed-off-by: Joakim Zhang +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 9 +++++++-- + drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 2 +- + drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++-- + 4 files changed, 15 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +@@ -499,10 +499,15 @@ static void dwmac4_get_rx_header_len(str + *len = le32_to_cpu(p->des2) & RDES2_HL; + } + +-static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr) ++static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr, bool buf2_valid) + { + p->des2 = cpu_to_le32(lower_32_bits(addr)); +- p->des3 = cpu_to_le32(upper_32_bits(addr) | RDES3_BUFFER2_VALID_ADDR); ++ p->des3 = cpu_to_le32(upper_32_bits(addr)); ++ ++ if (buf2_valid) ++ p->des3 |= cpu_to_le32(RDES3_BUFFER2_VALID_ADDR); ++ else ++ p->des3 &= cpu_to_le32(~RDES3_BUFFER2_VALID_ADDR); + } + + static void dwmac4_set_tbs(struct dma_edesc *p, u32 sec, u32 nsec) +--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +@@ -292,7 +292,7 @@ static void dwxgmac2_get_rx_header_len(s + *len = le32_to_cpu(p->des2) & XGMAC_RDES2_HL; + } + +-static void dwxgmac2_set_sec_addr(struct dma_desc *p, dma_addr_t addr) ++static void dwxgmac2_set_sec_addr(struct dma_desc *p, dma_addr_t addr, bool is_valid) + { + p->des2 = cpu_to_le32(lower_32_bits(addr)); + p->des3 = cpu_to_le32(upper_32_bits(addr)); +--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h ++++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h +@@ -91,7 +91,7 @@ struct stmmac_desc_ops { + int (*get_rx_hash)(struct dma_desc *p, u32 *hash, + enum pkt_hash_types *type); + void (*get_rx_header_len)(struct dma_desc *p, unsigned int *len); +- void (*set_sec_addr)(struct dma_desc *p, dma_addr_t addr); ++ void (*set_sec_addr)(struct dma_desc *p, dma_addr_t addr, bool buf2_valid); + void (*set_sarc)(struct dma_desc *p, u32 sarc_type); + void (*set_vlan_tag)(struct dma_desc *p, u16 tag, u16 inner_tag, + u32 inner_type); +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -1279,9 +1279,10 @@ static int stmmac_init_rx_buffers(struct + return -ENOMEM; + + buf->sec_addr = page_pool_get_dma_addr(buf->sec_page); +- stmmac_set_desc_sec_addr(priv, p, buf->sec_addr); ++ stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true); + } else { + buf->sec_page = NULL; ++ stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false); + } + + buf->addr = page_pool_get_dma_addr(buf->page); +@@ -3618,7 +3619,10 @@ static inline void stmmac_rx_refill(stru + DMA_FROM_DEVICE); + + stmmac_set_desc_addr(priv, p, buf->addr); +- stmmac_set_desc_sec_addr(priv, p, buf->sec_addr); ++ if (priv->sph) ++ stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true); ++ else ++ stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false); + stmmac_refill_desc3(priv, rx_q, p); + + rx_q->rx_count_frames++; diff --git a/queue-5.10/net-stmmac-stop-each-tx-channel-independently.patch b/queue-5.10/net-stmmac-stop-each-tx-channel-independently.patch new file mode 100644 index 00000000000..dd1033f988e --- /dev/null +++ b/queue-5.10/net-stmmac-stop-each-tx-channel-independently.patch @@ -0,0 +1,33 @@ +From a3e860a83397bf761ec1128a3f0ba186445992c6 Mon Sep 17 00:00:00 2001 +From: Joakim Zhang +Date: Thu, 25 Feb 2021 17:01:10 +0800 +Subject: net: stmmac: stop each tx channel independently + +From: Joakim Zhang + +commit a3e860a83397bf761ec1128a3f0ba186445992c6 upstream. + +If clear GMAC_CONFIG_TE bit, it would stop all tx channels, but users +may only want to stop specific tx channel. + +Fixes: 48863ce5940f ("stmmac: add DMA support for GMAC 4.xx") +Signed-off-by: Joakim Zhang +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 4 ---- + 1 file changed, 4 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +@@ -53,10 +53,6 @@ void dwmac4_dma_stop_tx(void __iomem *io + + value &= ~DMA_CONTROL_ST; + writel(value, ioaddr + DMA_CHAN_TX_CONTROL(chan)); +- +- value = readl(ioaddr + GMAC_CONFIG); +- value &= ~GMAC_CONFIG_TE; +- writel(value, ioaddr + GMAC_CONFIG); + } + + void dwmac4_dma_start_rx(void __iomem *ioaddr, u32 chan) diff --git a/queue-5.10/net-usb-qmi_wwan-allow-qmimux-add-del-with-master-up.patch b/queue-5.10/net-usb-qmi_wwan-allow-qmimux-add-del-with-master-up.patch new file mode 100644 index 00000000000..a767ff811d6 --- /dev/null +++ b/queue-5.10/net-usb-qmi_wwan-allow-qmimux-add-del-with-master-up.patch @@ -0,0 +1,60 @@ +From 6c59cff38e66584ae3ac6c2f0cbd8d039c710ba7 Mon Sep 17 00:00:00 2001 +From: Daniele Palmas +Date: Thu, 4 Mar 2021 14:15:13 +0100 +Subject: net: usb: qmi_wwan: allow qmimux add/del with master up +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Daniele Palmas + +commit 6c59cff38e66584ae3ac6c2f0cbd8d039c710ba7 upstream. + +There's no reason for preventing the creation and removal +of qmimux network interfaces when the underlying interface +is up. + +This makes qmi_wwan mux implementation more similar to the +rmnet one, simplifying userspace management of the same +logical interfaces. + +Fixes: c6adf77953bc ("net: usb: qmi_wwan: add qmap mux protocol support") +Reported-by: Aleksander Morgado +Signed-off-by: Daniele Palmas +Acked-by: Bjørn Mork +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/usb/qmi_wwan.c | 14 -------------- + 1 file changed, 14 deletions(-) + +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -419,13 +419,6 @@ static ssize_t add_mux_store(struct devi + goto err; + } + +- /* we don't want to modify a running netdev */ +- if (netif_running(dev->net)) { +- netdev_err(dev->net, "Cannot change a running device\n"); +- ret = -EBUSY; +- goto err; +- } +- + ret = qmimux_register_device(dev->net, mux_id); + if (!ret) { + info->flags |= QMI_WWAN_FLAG_MUX; +@@ -455,13 +448,6 @@ static ssize_t del_mux_store(struct devi + if (!rtnl_trylock()) + return restart_syscall(); + +- /* we don't want to modify a running netdev */ +- if (netif_running(dev->net)) { +- netdev_err(dev->net, "Cannot change a running device\n"); +- ret = -EBUSY; +- goto err; +- } +- + del_dev = qmimux_find_dev(dev, mux_id); + if (!del_dev) { + netdev_err(dev->net, "mux_id not present\n"); diff --git a/queue-5.10/netdevsim-init-u64-stats-for-32bit-hardware.patch b/queue-5.10/netdevsim-init-u64-stats-for-32bit-hardware.patch new file mode 100644 index 00000000000..70465e1646f --- /dev/null +++ b/queue-5.10/netdevsim-init-u64-stats-for-32bit-hardware.patch @@ -0,0 +1,86 @@ +From 863a42b289c22df63db62b10fc2c2ffc237e2125 Mon Sep 17 00:00:00 2001 +From: Hillf Danton +Date: Thu, 4 Mar 2021 10:30:09 -0800 +Subject: netdevsim: init u64 stats for 32bit hardware + +From: Hillf Danton + +commit 863a42b289c22df63db62b10fc2c2ffc237e2125 upstream. + +Init the u64 stats in order to avoid the lockdep prints on the 32bit +hardware like + + INFO: trying to register non-static key. + the code is fine but needs lockdep annotation. + turning off the locking correctness validator. + CPU: 0 PID: 4695 Comm: syz-executor.0 Not tainted 5.11.0-rc5-syzkaller #0 + Hardware name: ARM-Versatile Express + Backtrace: + [<826fc5b8>] (dump_backtrace) from [<826fc82c>] (show_stack+0x18/0x1c arch/arm/kernel/traps.c:252) + [<826fc814>] (show_stack) from [<8270d1f8>] (__dump_stack lib/dump_stack.c:79 [inline]) + [<826fc814>] (show_stack) from [<8270d1f8>] (dump_stack+0xa8/0xc8 lib/dump_stack.c:120) + [<8270d150>] (dump_stack) from [<802bf9c0>] (assign_lock_key kernel/locking/lockdep.c:935 [inline]) + [<8270d150>] (dump_stack) from [<802bf9c0>] (register_lock_class+0xabc/0xb68 kernel/locking/lockdep.c:1247) + [<802bef04>] (register_lock_class) from [<802baa2c>] (__lock_acquire+0x84/0x32d4 kernel/locking/lockdep.c:4711) + [<802ba9a8>] (__lock_acquire) from [<802be840>] (lock_acquire.part.0+0xf0/0x554 kernel/locking/lockdep.c:5442) + [<802be750>] (lock_acquire.part.0) from [<802bed10>] (lock_acquire+0x6c/0x74 kernel/locking/lockdep.c:5415) + [<802beca4>] (lock_acquire) from [<81560548>] (seqcount_lockdep_reader_access include/linux/seqlock.h:103 [inline]) + [<802beca4>] (lock_acquire) from [<81560548>] (__u64_stats_fetch_begin include/linux/u64_stats_sync.h:164 [inline]) + [<802beca4>] (lock_acquire) from [<81560548>] (u64_stats_fetch_begin include/linux/u64_stats_sync.h:175 [inline]) + [<802beca4>] (lock_acquire) from [<81560548>] (nsim_get_stats64+0xdc/0xf0 drivers/net/netdevsim/netdev.c:70) + [<8156046c>] (nsim_get_stats64) from [<81e2efa0>] (dev_get_stats+0x44/0xd0 net/core/dev.c:10405) + [<81e2ef5c>] (dev_get_stats) from [<81e53204>] (rtnl_fill_stats+0x38/0x120 net/core/rtnetlink.c:1211) + [<81e531cc>] (rtnl_fill_stats) from [<81e59d58>] (rtnl_fill_ifinfo+0x6d4/0x148c net/core/rtnetlink.c:1783) + [<81e59684>] (rtnl_fill_ifinfo) from [<81e5ceb4>] (rtmsg_ifinfo_build_skb+0x9c/0x108 net/core/rtnetlink.c:3798) + [<81e5ce18>] (rtmsg_ifinfo_build_skb) from [<81e5d0ac>] (rtmsg_ifinfo_event net/core/rtnetlink.c:3830 [inline]) + [<81e5ce18>] (rtmsg_ifinfo_build_skb) from [<81e5d0ac>] (rtmsg_ifinfo_event net/core/rtnetlink.c:3821 [inline]) + [<81e5ce18>] (rtmsg_ifinfo_build_skb) from [<81e5d0ac>] (rtmsg_ifinfo+0x44/0x70 net/core/rtnetlink.c:3839) + [<81e5d068>] (rtmsg_ifinfo) from [<81e45c2c>] (register_netdevice+0x664/0x68c net/core/dev.c:10103) + [<81e455c8>] (register_netdevice) from [<815608bc>] (nsim_create+0xf8/0x124 drivers/net/netdevsim/netdev.c:317) + [<815607c4>] (nsim_create) from [<81561184>] (__nsim_dev_port_add+0x108/0x188 drivers/net/netdevsim/dev.c:941) + [<8156107c>] (__nsim_dev_port_add) from [<815620d8>] (nsim_dev_port_add_all drivers/net/netdevsim/dev.c:990 [inline]) + [<8156107c>] (__nsim_dev_port_add) from [<815620d8>] (nsim_dev_probe+0x5cc/0x750 drivers/net/netdevsim/dev.c:1119) + [<81561b0c>] (nsim_dev_probe) from [<815661dc>] (nsim_bus_probe+0x10/0x14 drivers/net/netdevsim/bus.c:287) + [<815661cc>] (nsim_bus_probe) from [<811724c0>] (really_probe+0x100/0x50c drivers/base/dd.c:554) + [<811723c0>] (really_probe) from [<811729c4>] (driver_probe_device+0xf8/0x1c8 drivers/base/dd.c:740) + [<811728cc>] (driver_probe_device) from [<81172fe4>] (__device_attach_driver+0x8c/0xf0 drivers/base/dd.c:846) + [<81172f58>] (__device_attach_driver) from [<8116fee0>] (bus_for_each_drv+0x88/0xd8 drivers/base/bus.c:431) + [<8116fe58>] (bus_for_each_drv) from [<81172c6c>] (__device_attach+0xdc/0x1d0 drivers/base/dd.c:914) + [<81172b90>] (__device_attach) from [<8117305c>] (device_initial_probe+0x14/0x18 drivers/base/dd.c:961) + [<81173048>] (device_initial_probe) from [<81171358>] (bus_probe_device+0x90/0x98 drivers/base/bus.c:491) + [<811712c8>] (bus_probe_device) from [<8116e77c>] (device_add+0x320/0x824 drivers/base/core.c:3109) + [<8116e45c>] (device_add) from [<8116ec9c>] (device_register+0x1c/0x20 drivers/base/core.c:3182) + [<8116ec80>] (device_register) from [<81566710>] (nsim_bus_dev_new drivers/net/netdevsim/bus.c:336 [inline]) + [<8116ec80>] (device_register) from [<81566710>] (new_device_store+0x178/0x208 drivers/net/netdevsim/bus.c:215) + [<81566598>] (new_device_store) from [<8116fcb4>] (bus_attr_store+0x2c/0x38 drivers/base/bus.c:122) + [<8116fc88>] (bus_attr_store) from [<805b4b8c>] (sysfs_kf_write+0x48/0x54 fs/sysfs/file.c:139) + [<805b4b44>] (sysfs_kf_write) from [<805b3c90>] (kernfs_fop_write_iter+0x128/0x1ec fs/kernfs/file.c:296) + [<805b3b68>] (kernfs_fop_write_iter) from [<804d22fc>] (call_write_iter include/linux/fs.h:1901 [inline]) + [<805b3b68>] (kernfs_fop_write_iter) from [<804d22fc>] (new_sync_write fs/read_write.c:518 [inline]) + [<805b3b68>] (kernfs_fop_write_iter) from [<804d22fc>] (vfs_write+0x3dc/0x57c fs/read_write.c:605) + [<804d1f20>] (vfs_write) from [<804d2604>] (ksys_write+0x68/0xec fs/read_write.c:658) + [<804d259c>] (ksys_write) from [<804d2698>] (__do_sys_write fs/read_write.c:670 [inline]) + [<804d259c>] (ksys_write) from [<804d2698>] (sys_write+0x10/0x14 fs/read_write.c:667) + [<804d2688>] (sys_write) from [<80200060>] (ret_fast_syscall+0x0/0x2c arch/arm/mm/proc-v7.S:64) + +Fixes: 83c9e13aa39a ("netdevsim: add software driver for testing offloads") +Reported-by: syzbot+e74a6857f2d0efe3ad81@syzkaller.appspotmail.com +Tested-by: Dmitry Vyukov +Signed-off-by: Hillf Danton +Signed-off-by: Jakub Kicinski +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/netdevsim/netdev.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/netdevsim/netdev.c ++++ b/drivers/net/netdevsim/netdev.c +@@ -296,6 +296,7 @@ nsim_create(struct nsim_dev *nsim_dev, s + dev_net_set(dev, nsim_dev_net(nsim_dev)); + ns = netdev_priv(dev); + ns->netdev = dev; ++ u64_stats_init(&ns->syncp); + ns->nsim_dev = nsim_dev; + ns->nsim_dev_port = nsim_dev_port; + ns->nsim_bus_dev = nsim_dev->nsim_bus_dev; diff --git a/queue-5.10/perf-build-fix-ccache-usage-in-cc-when-generating-arch-errno-table.patch b/queue-5.10/perf-build-fix-ccache-usage-in-cc-when-generating-arch-errno-table.patch new file mode 100644 index 00000000000..94e5e7869a9 --- /dev/null +++ b/queue-5.10/perf-build-fix-ccache-usage-in-cc-when-generating-arch-errno-table.patch @@ -0,0 +1,46 @@ +From dacfc08dcafa7d443ab339592999e37bbb8a3ef0 Mon Sep 17 00:00:00 2001 +From: Antonio Terceiro +Date: Wed, 24 Feb 2021 10:00:46 -0300 +Subject: perf build: Fix ccache usage in $(CC) when generating arch errno table + +From: Antonio Terceiro + +commit dacfc08dcafa7d443ab339592999e37bbb8a3ef0 upstream. + +This was introduced by commit e4ffd066ff440a57 ("perf: Normalize gcc +parameter when generating arch errno table"). + +Assuming the first word of $(CC) is the actual compiler breaks usage +like CC="ccache gcc": the script ends up calling ccache directly with +gcc arguments, what fails. Instead of getting the first word, just +remove from $(CC) any word that starts with a "-". This maintains the +spirit of the original patch, while not breaking ccache users. + +Fixes: e4ffd066ff440a57 ("perf: Normalize gcc parameter when generating arch errno table") +Signed-off-by: Antonio Terceiro +Tested-by: Arnaldo Carvalho de Melo +Cc: Alexander Shishkin +Cc: He Zhe +Cc: Jiri Olsa +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: stable@vger.kernel.org +Link: http://lore.kernel.org/lkml/20210224130046.346977-1-antonio.terceiro@linaro.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/Makefile.perf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/Makefile.perf ++++ b/tools/perf/Makefile.perf +@@ -600,7 +600,7 @@ arch_errno_hdr_dir := $(srctree)/tools + arch_errno_tbl := $(srctree)/tools/perf/trace/beauty/arch_errno_names.sh + + $(arch_errno_name_array): $(arch_errno_tbl) +- $(Q)$(SHELL) '$(arch_errno_tbl)' $(firstword $(CC)) $(arch_errno_hdr_dir) > $@ ++ $(Q)$(SHELL) '$(arch_errno_tbl)' '$(patsubst -%,,$(CC))' $(arch_errno_hdr_dir) > $@ + + sync_file_range_arrays := $(beauty_outdir)/sync_file_range_arrays.c + sync_file_range_tbls := $(srctree)/tools/perf/trace/beauty/sync_file_range.sh diff --git a/queue-5.10/perf-report-fix-f-for-branch-mem-modes.patch b/queue-5.10/perf-report-fix-f-for-branch-mem-modes.patch new file mode 100644 index 00000000000..2279c7db13f --- /dev/null +++ b/queue-5.10/perf-report-fix-f-for-branch-mem-modes.patch @@ -0,0 +1,67 @@ +From 6740a4e70e5d1b9d8e7fe41fd46dd5656d65dadf Mon Sep 17 00:00:00 2001 +From: Ravi Bangoria +Date: Thu, 4 Mar 2021 11:59:58 +0530 +Subject: perf report: Fix -F for branch & mem modes + +From: Ravi Bangoria + +commit 6740a4e70e5d1b9d8e7fe41fd46dd5656d65dadf upstream. + +perf report fails to add valid additional fields with -F when +used with branch or mem modes. Fix it. + +Before patch: + + $ perf record -b + $ perf report -b -F +srcline_from --stdio + Error: + Invalid --fields key: `srcline_from' + +After patch: + + $ perf report -b -F +srcline_from --stdio + # Samples: 8K of event 'cycles' + # Event count (approx.): 8784 + ... + +Committer notes: + +There was an inversion: when looking at branch stack dimensions (keys) +it was checking if the sort mode was 'mem', not 'branch'. + +Fixes: aa6b3c99236b ("perf report: Make -F more strict like -s") +Reported-by: Athira Jajeev +Signed-off-by: Ravi Bangoria +Reviewed-by: Athira Jajeev +Tested-by: Arnaldo Carvalho de Melo +Tested-by: Athira Jajeev +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Namhyung Kim +Link: http://lore.kernel.org/lkml/20210304062958.85465-1-ravi.bangoria@linux.ibm.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/sort.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/tools/perf/util/sort.c ++++ b/tools/perf/util/sort.c +@@ -3003,7 +3003,7 @@ int output_field_add(struct perf_hpp_lis + if (strncasecmp(tok, sd->name, strlen(tok))) + continue; + +- if (sort__mode != SORT_MODE__MEMORY) ++ if (sort__mode != SORT_MODE__BRANCH) + return -EINVAL; + + return __sort_dimension__add_output(list, sd); +@@ -3015,7 +3015,7 @@ int output_field_add(struct perf_hpp_lis + if (strncasecmp(tok, sd->name, strlen(tok))) + continue; + +- if (sort__mode != SORT_MODE__BRANCH) ++ if (sort__mode != SORT_MODE__MEMORY) + return -EINVAL; + + return __sort_dimension__add_output(list, sd); diff --git a/queue-5.10/perf-traceevent-ensure-read-cmdlines-are-null-terminated.patch b/queue-5.10/perf-traceevent-ensure-read-cmdlines-are-null-terminated.patch new file mode 100644 index 00000000000..4b432598543 --- /dev/null +++ b/queue-5.10/perf-traceevent-ensure-read-cmdlines-are-null-terminated.patch @@ -0,0 +1,36 @@ +From 137a5258939aca56558f3a23eb229b9c4b293917 Mon Sep 17 00:00:00 2001 +From: Ian Rogers +Date: Fri, 26 Feb 2021 14:14:31 -0800 +Subject: perf traceevent: Ensure read cmdlines are null terminated. + +From: Ian Rogers + +commit 137a5258939aca56558f3a23eb229b9c4b293917 upstream. + +Issue detected by address sanitizer. + +Fixes: cd4ceb63438e9e28 ("perf util: Save pid-cmdline mapping into tracing header") +Signed-off-by: Ian Rogers +Acked-by: Namhyung Kim +Cc: Alexander Shishkin +Cc: Jiri Olsa +Cc: Mark Rutland +Cc: Peter Zijlstra +Cc: Stephane Eranian +Link: http://lore.kernel.org/lkml/20210226221431.1985458-1-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/trace-event-read.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/tools/perf/util/trace-event-read.c ++++ b/tools/perf/util/trace-event-read.c +@@ -361,6 +361,7 @@ static int read_saved_cmdline(struct tep + pr_debug("error reading saved cmdlines\n"); + goto out; + } ++ buf[ret] = '\0'; + + parse_saved_cmdline(pevent, buf, size); + ret = 0; diff --git a/queue-5.10/r8169-fix-r8168fp_adjust_ocp_cmd-function.patch b/queue-5.10/r8169-fix-r8168fp_adjust_ocp_cmd-function.patch new file mode 100644 index 00000000000..0110f77e405 --- /dev/null +++ b/queue-5.10/r8169-fix-r8168fp_adjust_ocp_cmd-function.patch @@ -0,0 +1,31 @@ +From abbf9a0ef8848dca58c5b97750c1c59bbee45637 Mon Sep 17 00:00:00 2001 +From: Hayes Wang +Date: Fri, 5 Mar 2021 17:34:41 +0800 +Subject: r8169: fix r8168fp_adjust_ocp_cmd function + +From: Hayes Wang + +commit abbf9a0ef8848dca58c5b97750c1c59bbee45637 upstream. + +The (0xBAF70000 & 0x00FFF000) << 6 should be (0xf70 << 18). + +Fixes: 561535b0f239 ("r8169: fix OCP access on RTL8117") +Signed-off-by: Hayes Wang +Acked-by: Heiner Kallweit +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/realtek/r8169_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -1042,7 +1042,7 @@ static void r8168fp_adjust_ocp_cmd(struc + { + /* based on RTL8168FP_OOBMAC_BASE in vendor driver */ + if (tp->mac_version == RTL_GIGA_MAC_VER_52 && type == ERIAR_OOB) +- *cmd |= 0x7f0 << 18; ++ *cmd |= 0xf70 << 18; + } + + DECLARE_RTL_COND(rtl_eriar_cond) diff --git a/queue-5.10/s390-cio-return-efault-if-copy_to_user-fails.patch b/queue-5.10/s390-cio-return-efault-if-copy_to_user-fails.patch new file mode 100644 index 00000000000..51fbfccb1e3 --- /dev/null +++ b/queue-5.10/s390-cio-return-efault-if-copy_to_user-fails.patch @@ -0,0 +1,42 @@ +From 51c44babdc19aaf882e1213325a0ba291573308f Mon Sep 17 00:00:00 2001 +From: Wang Qing +Date: Mon, 1 Mar 2021 20:01:33 +0800 +Subject: s390/cio: return -EFAULT if copy_to_user() fails + +From: Wang Qing + +commit 51c44babdc19aaf882e1213325a0ba291573308f upstream. + +The copy_to_user() function returns the number of bytes remaining to be +copied, but we want to return -EFAULT if the copy doesn't complete. + +Fixes: e01bcdd61320 ("vfio: ccw: realize VFIO_DEVICE_GET_REGION_INFO ioctl") +Signed-off-by: Wang Qing +Signed-off-by: Heiko Carstens +Link: https://lore.kernel.org/r/1614600093-13992-1-git-send-email-wangqing@vivo.com +Signed-off-by: Heiko Carstens +Signed-off-by: Greg Kroah-Hartman +--- + drivers/s390/cio/vfio_ccw_ops.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/s390/cio/vfio_ccw_ops.c ++++ b/drivers/s390/cio/vfio_ccw_ops.c +@@ -539,7 +539,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struc + if (ret) + return ret; + +- return copy_to_user((void __user *)arg, &info, minsz); ++ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; + } + case VFIO_DEVICE_GET_REGION_INFO: + { +@@ -557,7 +557,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struc + if (ret) + return ret; + +- return copy_to_user((void __user *)arg, &info, minsz); ++ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; + } + case VFIO_DEVICE_GET_IRQ_INFO: + { diff --git a/queue-5.10/s390-qeth-fix-memory-leak-after-failed-tx-buffer-allocation.patch b/queue-5.10/s390-qeth-fix-memory-leak-after-failed-tx-buffer-allocation.patch new file mode 100644 index 00000000000..12827addd6b --- /dev/null +++ b/queue-5.10/s390-qeth-fix-memory-leak-after-failed-tx-buffer-allocation.patch @@ -0,0 +1,97 @@ +From e7a36d27f6b9f389e41d8189a8a08919c6835732 Mon Sep 17 00:00:00 2001 +From: Julian Wiedmann +Date: Tue, 9 Mar 2021 17:52:18 +0100 +Subject: s390/qeth: fix memory leak after failed TX Buffer allocation + +From: Julian Wiedmann + +commit e7a36d27f6b9f389e41d8189a8a08919c6835732 upstream. + +When qeth_alloc_qdio_queues() fails to allocate one of the buffers that +back an Output Queue, the 'out_freeoutqbufs' path will free all +previously allocated buffers for this queue. But it misses to free the +half-finished queue struct itself. + +Move the buffer allocation into qeth_alloc_output_queue(), and deal with +such errors internally. + +Fixes: 0da9581ddb0f ("qeth: exploit asynchronous delivery of storage blocks") +Signed-off-by: Julian Wiedmann +Reviewed-by: Alexandra Winter +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/s390/net/qeth_core_main.c | 35 +++++++++++++++++------------------ + 1 file changed, 17 insertions(+), 18 deletions(-) + +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -2632,15 +2632,28 @@ static void qeth_free_output_queue(struc + static struct qeth_qdio_out_q *qeth_alloc_output_queue(void) + { + struct qeth_qdio_out_q *q = kzalloc(sizeof(*q), GFP_KERNEL); ++ unsigned int i; + + if (!q) + return NULL; + +- if (qdio_alloc_buffers(q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q)) { +- kfree(q); +- return NULL; ++ if (qdio_alloc_buffers(q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q)) ++ goto err_qdio_bufs; ++ ++ for (i = 0; i < QDIO_MAX_BUFFERS_PER_Q; i++) { ++ if (qeth_init_qdio_out_buf(q, i)) ++ goto err_out_bufs; + } ++ + return q; ++ ++err_out_bufs: ++ while (i > 0) ++ kmem_cache_free(qeth_qdio_outbuf_cache, q->bufs[--i]); ++ qdio_free_buffers(q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q); ++err_qdio_bufs: ++ kfree(q); ++ return NULL; + } + + static void qeth_tx_completion_timer(struct timer_list *timer) +@@ -2653,7 +2666,7 @@ static void qeth_tx_completion_timer(str + + static int qeth_alloc_qdio_queues(struct qeth_card *card) + { +- int i, j; ++ unsigned int i; + + QETH_CARD_TEXT(card, 2, "allcqdbf"); + +@@ -2687,13 +2700,6 @@ static int qeth_alloc_qdio_queues(struct + queue->coalesce_usecs = QETH_TX_COALESCE_USECS; + queue->max_coalesced_frames = QETH_TX_MAX_COALESCED_FRAMES; + queue->priority = QETH_QIB_PQUE_PRIO_DEFAULT; +- +- /* give outbound qeth_qdio_buffers their qdio_buffers */ +- for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) { +- WARN_ON(queue->bufs[j]); +- if (qeth_init_qdio_out_buf(queue, j)) +- goto out_freeoutqbufs; +- } + } + + /* completion */ +@@ -2702,13 +2708,6 @@ static int qeth_alloc_qdio_queues(struct + + return 0; + +-out_freeoutqbufs: +- while (j > 0) { +- --j; +- kmem_cache_free(qeth_qdio_outbuf_cache, +- card->qdio.out_qs[i]->bufs[j]); +- card->qdio.out_qs[i]->bufs[j] = NULL; +- } + out_freeoutq: + while (i > 0) { + qeth_free_output_queue(card->qdio.out_qs[--i]); diff --git a/queue-5.10/selftests-forwarding-fix-race-condition-in-mirror-installation.patch b/queue-5.10/selftests-forwarding-fix-race-condition-in-mirror-installation.patch new file mode 100644 index 00000000000..add5df4a4c2 --- /dev/null +++ b/queue-5.10/selftests-forwarding-fix-race-condition-in-mirror-installation.patch @@ -0,0 +1,54 @@ +From edcbf5137f093b5502f5f6b97cce3cbadbde27aa Mon Sep 17 00:00:00 2001 +From: Danielle Ratson +Date: Thu, 25 Feb 2021 18:57:19 +0200 +Subject: selftests: forwarding: Fix race condition in mirror installation + +From: Danielle Ratson + +commit edcbf5137f093b5502f5f6b97cce3cbadbde27aa upstream. + +When mirroring to a gretap in hardware the device expects to be +programmed with the egress port and all the encapsulating headers. This +requires the driver to resolve the path the packet will take in the +software data path and program the device accordingly. + +If the path cannot be resolved (in this case because of an unresolved +neighbor), then mirror installation fails until the path is resolved. +This results in a race that causes the test to sometimes fail. + +Fix this by setting the neighbor's state to permanent, so that it is +always valid. + +Fixes: b5b029399fa6d ("selftests: forwarding: mirror_gre_bridge_1d_vlan: Add STP test") +Signed-off-by: Danielle Ratson +Reviewed-by: Petr Machata +Signed-off-by: Ido Schimmel +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh ++++ b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh +@@ -86,11 +86,20 @@ test_ip6gretap() + + test_gretap_stp() + { ++ # Sometimes after mirror installation, the neighbor's state is not valid. ++ # The reason is that there is no SW datapath activity related to the ++ # neighbor for the remote GRE address. Therefore whether the corresponding ++ # neighbor will be valid is a matter of luck, and the test is thus racy. ++ # Set the neighbor's state to permanent, so it would be always valid. ++ ip neigh replace 192.0.2.130 lladdr $(mac_get $h3) \ ++ nud permanent dev br2 + full_test_span_gre_stp gt4 $swp3.555 "mirror to gretap" + } + + test_ip6gretap_stp() + { ++ ip neigh replace 2001:db8:2::2 lladdr $(mac_get $h3) \ ++ nud permanent dev br2 + full_test_span_gre_stp gt6 $swp3.555 "mirror to ip6gretap" + } + diff --git a/queue-5.10/series b/queue-5.10/series index 29c192b89d8..a293fd4e038 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -48,3 +48,35 @@ net-ethernet-mtk-star-emac-fix-wrong-unmap-in-rx-handling.patch net-mlx4_en-update-moderation-when-config-reset.patch net-stmmac-fix-incorrect-dma-channel-intr-enable-setting-of-eqos-v4.10.patch nexthop-do-not-flush-blackhole-nexthops-when-loopback-goes-down.patch +net-sched-avoid-duplicates-in-classes-dump.patch +net-mscc-ocelot-properly-reject-destination-ip-keys-in-vcap-is1.patch +net-dsa-sja1105-fix-sgmii-pcs-being-forced-to-speed_unknown-instead-of-speed_10.patch +net-usb-qmi_wwan-allow-qmimux-add-del-with-master-up.patch +netdevsim-init-u64-stats-for-32bit-hardware.patch +cipso-calipso-resolve-a-number-of-problems-with-the-doi-refcounts.patch +net-stmmac-fix-vlan-filter-delete-timeout-issue-in-intel-mgbe-sgmii.patch +stmmac-intel-fixes-clock-registration-error-seen-for-multiple-interfaces.patch +net-lapbether-remove-netif_start_queue-netif_stop_queue.patch +net-davicom-fix-regulator-not-turned-off-on-failed-probe.patch +net-davicom-fix-regulator-not-turned-off-on-driver-removal.patch +net-enetc-allow-hardware-timestamping-on-tx-queues-with-tc-etf-enabled.patch +net-bonding-fix-error-return-code-of-bond_neigh_init.patch +net-qrtr-fix-error-return-code-of-qrtr_sendmsg.patch +s390-qeth-fix-memory-leak-after-failed-tx-buffer-allocation.patch +r8169-fix-r8168fp_adjust_ocp_cmd-function.patch +ixgbe-fail-to-create-xfrm-offload-of-ipsec-tunnel-mode-sa.patch +tools-resolve_btfids-fix-build-error-with-older-host-toolchains.patch +perf-build-fix-ccache-usage-in-cc-when-generating-arch-errno-table.patch +net-stmmac-stop-each-tx-channel-independently.patch +net-stmmac-fix-watchdog-timeout-during-suspend-resume-stress-test.patch +net-stmmac-fix-wrongly-set-buffer2-valid-when-sph-unsupport.patch +ethtool-fix-the-check-logic-of-at-least-one-channel-for-rx-tx.patch +net-phy-make-mdio_bus_phy_suspend-resume-as-__maybe_unused.patch +selftests-forwarding-fix-race-condition-in-mirror-installation.patch +mlxsw-spectrum_ethtool-add-an-external-speed-to-ptys-register.patch +perf-traceevent-ensure-read-cmdlines-are-null-terminated.patch +perf-report-fix-f-for-branch-mem-modes.patch +net-hns3-fix-query-vlan-mask-value-error-for-flow-director.patch +net-hns3-fix-bug-when-calculating-the-tcam-table-info.patch +s390-cio-return-efault-if-copy_to_user-fails.patch +bnxt_en-reliably-allocate-irq-table-on-reset-to-avoid-crash.patch diff --git a/queue-5.10/stmmac-intel-fixes-clock-registration-error-seen-for-multiple-interfaces.patch b/queue-5.10/stmmac-intel-fixes-clock-registration-error-seen-for-multiple-interfaces.patch new file mode 100644 index 00000000000..d4d37535420 --- /dev/null +++ b/queue-5.10/stmmac-intel-fixes-clock-registration-error-seen-for-multiple-interfaces.patch @@ -0,0 +1,56 @@ +From 8eb37ab7cc045ec6305a6a1a9c32374695a1a977 Mon Sep 17 00:00:00 2001 +From: Wong Vee Khee +Date: Fri, 5 Mar 2021 14:03:42 +0800 +Subject: stmmac: intel: Fixes clock registration error seen for multiple interfaces + +From: Wong Vee Khee + +commit 8eb37ab7cc045ec6305a6a1a9c32374695a1a977 upstream. + +Issue seen when enumerating multiple Intel mGbE interfaces in EHL. + +[ 6.898141] intel-eth-pci 0000:00:1d.2: enabling device (0000 -> 0002) +[ 6.900971] intel-eth-pci 0000:00:1d.2: Fail to register stmmac-clk +[ 6.906434] intel-eth-pci 0000:00:1d.2: User ID: 0x51, Synopsys ID: 0x52 + +We fix it by making the clock name to be unique following the format +of stmmac-pci_name(pci_dev) so that we can differentiate the clock for +these Intel mGbE interfaces in EHL platform as follow: + + /sys/kernel/debug/clk/stmmac-0000:00:1d.1 + /sys/kernel/debug/clk/stmmac-0000:00:1d.2 + /sys/kernel/debug/clk/stmmac-0000:00:1e.4 + +Fixes: 58da0cfa6cf1 ("net: stmmac: create dwmac-intel.c to contain all Intel platform") +Signed-off-by: Wong Vee Khee +Signed-off-by: Voon Weifeng +Co-developed-by: Ong Boon Leong +Signed-off-by: Ong Boon Leong +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +@@ -233,6 +233,7 @@ static void common_default_data(struct p + static int intel_mgbe_common_data(struct pci_dev *pdev, + struct plat_stmmacenet_data *plat) + { ++ char clk_name[20]; + int ret; + int i; + +@@ -300,8 +301,10 @@ static int intel_mgbe_common_data(struct + plat->eee_usecs_rate = plat->clk_ptp_rate; + + /* Set system clock */ ++ sprintf(clk_name, "%s-%s", "stmmac", pci_name(pdev)); ++ + plat->stmmac_clk = clk_register_fixed_rate(&pdev->dev, +- "stmmac-clk", NULL, 0, ++ clk_name, NULL, 0, + plat->clk_ptp_rate); + + if (IS_ERR(plat->stmmac_clk)) { diff --git a/queue-5.10/tools-resolve_btfids-fix-build-error-with-older-host-toolchains.patch b/queue-5.10/tools-resolve_btfids-fix-build-error-with-older-host-toolchains.patch new file mode 100644 index 00000000000..be19b6097ff --- /dev/null +++ b/queue-5.10/tools-resolve_btfids-fix-build-error-with-older-host-toolchains.patch @@ -0,0 +1,41 @@ +From 41462c6e730ca0e63f5fed5a517052385d980c54 Mon Sep 17 00:00:00 2001 +From: Kun-Chuan Hsieh +Date: Wed, 24 Feb 2021 05:27:52 +0000 +Subject: tools/resolve_btfids: Fix build error with older host toolchains + +From: Kun-Chuan Hsieh + +commit 41462c6e730ca0e63f5fed5a517052385d980c54 upstream. + +Older libelf.h and glibc elf.h might not yet define the ELF compression +types. + +Checking and defining SHF_COMPRESSED fix the build error when compiling +with older toolchains. Also, the tool resolve_btfids is compiled with host +toolchain. The host toolchain is more likely to be older than the cross +compile toolchain. + +Fixes: 51f6463aacfb ("tools/resolve_btfids: Fix sections with wrong alignment") +Signed-off-by: Kun-Chuan Hsieh +Signed-off-by: Daniel Borkmann +Acked-by: Jiri Olsa +Link: https://lore.kernel.org/bpf/20210224052752.5284-1-jetswayss@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + tools/bpf/resolve_btfids/main.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/tools/bpf/resolve_btfids/main.c ++++ b/tools/bpf/resolve_btfids/main.c +@@ -258,6 +258,11 @@ static struct btf_id *add_symbol(struct + return btf_id__add(root, id, false); + } + ++/* Older libelf.h and glibc elf.h might not yet define the ELF compression types. */ ++#ifndef SHF_COMPRESSED ++#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */ ++#endif ++ + /* + * The data of compressed section should be aligned to 4 + * (for 32bit) or 8 (for 64 bit) bytes. The binutils ld -- 2.47.3