From 629d19442871f103e08690f2249d799d4b665fa3 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sat, 23 Oct 2021 21:28:44 -0400 Subject: [PATCH] Fixes for 5.10 Signed-off-by: Sasha Levin --- ...ix-clock-configuration-on-slave-mode.patch | 60 ++++ ...ug-fix-sg-checks-in-debug_dma_map_sg.patch | 79 +++++ ...-ili9881c-fix-sync-for-feixin-k101-i.patch | 50 ++++ ...-packet-loss-on-tiger-lake-and-later.patch | 72 +++++ .../ice-add-missing-e810-device-ids.patch | 67 +++++ .../ice-fix-getting-udp-tunnel-entry.patch | 50 ++++ ...ding-count-rx-stats-on-the-orig-netd.patch | 272 ++++++++++++++++++ queue-5.10/lan78xx-select-crc32.patch | 40 +++ ...lantiq_gswip-fix-register-definition.patch | 38 +++ ...ix-ethtool-counter-name-for-pm0_terr.patch | 39 +++ ...limit-ets-dwrr-bandwidth-cannot-be-0.patch | 46 +++ ...able-sriov-before-unload-hclge-layer.patch | 90 ++++++ ...3-fix-vf-reset-workqueue-cannot-exit.patch | 46 +++ ...hns3-reset-dwrr-of-unused-tc-to-zero.patch | 63 ++++ ...e-the-polling-again-when-allocation-.patch | 104 +++++++ .../net-stmmac-fix-e2e-delay-mechanism.patch | 56 ++++ ...p6t_rt-fix-rt0_hdr-parsing-in-rt_mt6.patch | 146 ++++++++++ ...ake-global-sysctl-readonly-in-non-in.patch | 40 +++ ...etimer-fix-panic-that-occurs-when-ti.patch | 87 ++++++ ...ags-rename-a-redefined-register-name.patch | 67 +++++ ...ot-decrement-idle-task-preempt-count.patch | 67 +++++ queue-5.10/series | 22 ++ ...overlap-between-vrf-and-non-vrf-keys.patch | 84 ++++++ 23 files changed, 1685 insertions(+) create mode 100644 queue-5.10/asoc-wm8960-fix-clock-configuration-on-slave-mode.patch create mode 100644 queue-5.10/dma-debug-fix-sg-checks-in-debug_dma_map_sg.patch create mode 100644 queue-5.10/drm-panel-ilitek-ili9881c-fix-sync-for-feixin-k101-i.patch create mode 100644 queue-5.10/e1000e-fix-packet-loss-on-tiger-lake-and-later.patch create mode 100644 queue-5.10/ice-add-missing-e810-device-ids.patch create mode 100644 queue-5.10/ice-fix-getting-udp-tunnel-entry.patch create mode 100644 queue-5.10/ipv6-when-forwarding-count-rx-stats-on-the-orig-netd.patch create mode 100644 queue-5.10/lan78xx-select-crc32.patch create mode 100644 queue-5.10/net-dsa-lantiq_gswip-fix-register-definition.patch create mode 100644 queue-5.10/net-enetc-fix-ethtool-counter-name-for-pm0_terr.patch create mode 100644 queue-5.10/net-hns3-add-limit-ets-dwrr-bandwidth-cannot-be-0.patch create mode 100644 queue-5.10/net-hns3-disable-sriov-before-unload-hclge-layer.patch create mode 100644 queue-5.10/net-hns3-fix-vf-reset-workqueue-cannot-exit.patch create mode 100644 queue-5.10/net-hns3-reset-dwrr-of-unused-tc-to-zero.patch create mode 100644 queue-5.10/net-hns3-schedule-the-polling-again-when-allocation-.patch create mode 100644 queue-5.10/net-stmmac-fix-e2e-delay-mechanism.patch create mode 100644 queue-5.10/netfilter-ip6t_rt-fix-rt0_hdr-parsing-in-rt_mt6.patch create mode 100644 queue-5.10/netfilter-ipvs-make-global-sysctl-readonly-in-non-in.patch create mode 100644 queue-5.10/netfilter-xt_idletimer-fix-panic-that-occurs-when-ti.patch create mode 100644 queue-5.10/nios2-irqflags-rename-a-redefined-register-name.patch create mode 100644 queue-5.10/powerpc-smp-do-not-decrement-idle-task-preempt-count.patch create mode 100644 queue-5.10/tcp-md5-fix-overlap-between-vrf-and-non-vrf-keys.patch diff --git a/queue-5.10/asoc-wm8960-fix-clock-configuration-on-slave-mode.patch b/queue-5.10/asoc-wm8960-fix-clock-configuration-on-slave-mode.patch new file mode 100644 index 00000000000..72152ddbe9b --- /dev/null +++ b/queue-5.10/asoc-wm8960-fix-clock-configuration-on-slave-mode.patch @@ -0,0 +1,60 @@ +From b2e4b42da32488a6a5038dbac097bbf429fea398 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Oct 2021 13:17:04 +0800 +Subject: ASoC: wm8960: Fix clock configuration on slave mode + +From: Shengjiu Wang + +[ Upstream commit 6b9b546dc00797c74bef491668ce5431ff54e1e2 ] + +There is a noise issue for 8kHz sample rate on slave mode. +Compared with master mode, the difference is the DACDIV +setting, after correcting the DACDIV, the noise is gone. + +There is no noise issue for 48kHz sample rate, because +the default value of DACDIV is correct for 48kHz. + +So wm8960_configure_clocking() should be functional for +ADC and DAC function even if it is slave mode. + +In order to be compatible for old use case, just add +condition for checking that sysclk is zero with +slave mode. + +Fixes: 0e50b51aa22f ("ASoC: wm8960: Let wm8960 driver configure its bit clock and frame clock") +Signed-off-by: Shengjiu Wang +Acked-by: Charles Keepax +Link: https://lore.kernel.org/r/1634102224-3922-1-git-send-email-shengjiu.wang@nxp.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/wm8960.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c +index 9d325555e219..618692e2e0e4 100644 +--- a/sound/soc/codecs/wm8960.c ++++ b/sound/soc/codecs/wm8960.c +@@ -742,9 +742,16 @@ static int wm8960_configure_clocking(struct snd_soc_component *component) + int i, j, k; + int ret; + +- if (!(iface1 & (1<<6))) { +- dev_dbg(component->dev, +- "Codec is slave mode, no need to configure clock\n"); ++ /* ++ * For Slave mode clocking should still be configured, ++ * so this if statement should be removed, but some platform ++ * may not work if the sysclk is not configured, to avoid such ++ * compatible issue, just add '!wm8960->sysclk' condition in ++ * this if statement. ++ */ ++ if (!(iface1 & (1 << 6)) && !wm8960->sysclk) { ++ dev_warn(component->dev, ++ "slave mode, but proceeding with no clock configuration\n"); + return 0; + } + +-- +2.33.0 + diff --git a/queue-5.10/dma-debug-fix-sg-checks-in-debug_dma_map_sg.patch b/queue-5.10/dma-debug-fix-sg-checks-in-debug_dma_map_sg.patch new file mode 100644 index 00000000000..7446e9dcb16 --- /dev/null +++ b/queue-5.10/dma-debug-fix-sg-checks-in-debug_dma_map_sg.patch @@ -0,0 +1,79 @@ +From 31141409a93c2777e04e0708f1b79a588c9114e6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Oct 2021 22:19:43 +0200 +Subject: dma-debug: fix sg checks in debug_dma_map_sg() + +From: Gerald Schaefer + +[ Upstream commit 293d92cbbd2418ca2ba43fed07f1b92e884d1c77 ] + +The following warning occurred sporadically on s390: +DMA-API: nvme 0006:00:00.0: device driver maps memory from kernel text or rodata [addr=0000000048cc5e2f] [len=131072] +WARNING: CPU: 4 PID: 825 at kernel/dma/debug.c:1083 check_for_illegal_area+0xa8/0x138 + +It is a false-positive warning, due to broken logic in debug_dma_map_sg(). +check_for_illegal_area() checks for overlay of sg elements with kernel text +or rodata. It is called with sg_dma_len(s) instead of s->length as +parameter. After the call to ->map_sg(), sg_dma_len() will contain the +length of possibly combined sg elements in the DMA address space, and not +the individual sg element length, which would be s->length. + +The check will then use the physical start address of an sg element, and +add the DMA length for the overlap check, which could result in the false +warning, because the DMA length can be larger than the actual single sg +element length. + +In addition, the call to check_for_illegal_area() happens in the iteration +over mapped_ents, which will not include all individual sg elements if +any of them were combined in ->map_sg(). + +Fix this by using s->length instead of sg_dma_len(s). Also put the call to +check_for_illegal_area() in a separate loop, iterating over all the +individual sg elements ("nents" instead of "mapped_ents"). + +While at it, as suggested by Robin Murphy, also move check_for_stack() +inside the new loop, as it is similarly concerned with validating the +individual sg elements. + +Link: https://lore.kernel.org/lkml/20210705185252.4074653-1-gerald.schaefer@linux.ibm.com +Fixes: 884d05970bfb ("dma-debug: use sg_dma_len accessor") +Signed-off-by: Gerald Schaefer +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + kernel/dma/debug.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c +index 445754529917..10d07ace46c1 100644 +--- a/kernel/dma/debug.c ++++ b/kernel/dma/debug.c +@@ -1300,6 +1300,12 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg, + if (unlikely(dma_debug_disabled())) + return; + ++ for_each_sg(sg, s, nents, i) { ++ check_for_stack(dev, sg_page(s), s->offset); ++ if (!PageHighMem(sg_page(s))) ++ check_for_illegal_area(dev, sg_virt(s), s->length); ++ } ++ + for_each_sg(sg, s, mapped_ents, i) { + entry = dma_entry_alloc(); + if (!entry) +@@ -1315,12 +1321,6 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg, + entry->sg_call_ents = nents; + entry->sg_mapped_ents = mapped_ents; + +- check_for_stack(dev, sg_page(s), s->offset); +- +- if (!PageHighMem(sg_page(s))) { +- check_for_illegal_area(dev, sg_virt(s), sg_dma_len(s)); +- } +- + check_sg_segment(dev, s); + + add_dma_entry(entry); +-- +2.33.0 + diff --git a/queue-5.10/drm-panel-ilitek-ili9881c-fix-sync-for-feixin-k101-i.patch b/queue-5.10/drm-panel-ilitek-ili9881c-fix-sync-for-feixin-k101-i.patch new file mode 100644 index 00000000000..3148f900bf3 --- /dev/null +++ b/queue-5.10/drm-panel-ilitek-ili9881c-fix-sync-for-feixin-k101-i.patch @@ -0,0 +1,50 @@ +From 1ec3c0af4f412d9589132515b831e91f2d4955e1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Aug 2021 23:48:18 +0200 +Subject: drm/panel: ilitek-ili9881c: Fix sync for Feixin K101-IM2BYL02 panel + +From: Dan Johansen + +[ Upstream commit 772970620a839141835eaf2bc507d957b10adcca ] + +This adjusts sync values according to the datasheet + +Fixes: 1c243751c095 ("drm/panel: ilitek-ili9881c: add support for Feixin K101-IM2BYL02 panel") +Co-developed-by: Marius Gripsgard +Signed-off-by: Dan Johansen +Signed-off-by: Sam Ravnborg +Link: https://patchwork.freedesktop.org/patch/msgid/20210818214818.298089-1-strit@manjaro.org +Signed-off-by: Maarten Lankhorst +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +index 0145129d7c66..534dd7414d42 100644 +--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c ++++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +@@ -590,14 +590,14 @@ static const struct drm_display_mode k101_im2byl02_default_mode = { + .clock = 69700, + + .hdisplay = 800, +- .hsync_start = 800 + 6, +- .hsync_end = 800 + 6 + 15, +- .htotal = 800 + 6 + 15 + 16, ++ .hsync_start = 800 + 52, ++ .hsync_end = 800 + 52 + 8, ++ .htotal = 800 + 52 + 8 + 48, + + .vdisplay = 1280, +- .vsync_start = 1280 + 8, +- .vsync_end = 1280 + 8 + 48, +- .vtotal = 1280 + 8 + 48 + 52, ++ .vsync_start = 1280 + 16, ++ .vsync_end = 1280 + 16 + 6, ++ .vtotal = 1280 + 16 + 6 + 15, + + .width_mm = 135, + .height_mm = 217, +-- +2.33.0 + diff --git a/queue-5.10/e1000e-fix-packet-loss-on-tiger-lake-and-later.patch b/queue-5.10/e1000e-fix-packet-loss-on-tiger-lake-and-later.patch new file mode 100644 index 00000000000..52d55b9b580 --- /dev/null +++ b/queue-5.10/e1000e-fix-packet-loss-on-tiger-lake-and-later.patch @@ -0,0 +1,72 @@ +From c8635c8a4b9827a5460d7361b9216e31ed9b183d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Sep 2021 09:55:42 +0300 +Subject: e1000e: Fix packet loss on Tiger Lake and later + +From: Sasha Neftin + +[ Upstream commit 639e298f432fb058a9496ea16863f53b1ce935fe ] + +Update the HW MAC initialization flow. Do not gate DMA clock from +the modPHY block. Keeping this clock will prevent dropped packets +sent in burst mode on the Kumeran interface. + +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=213651 +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=213377 +Fixes: fb776f5d57ee ("e1000e: Add support for Tiger Lake") +Signed-off-by: Sasha Neftin +Tested-by: Mark Pearson +Tested-by: Nechama Kraus +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/e1000e/ich8lan.c | 11 ++++++++++- + drivers/net/ethernet/intel/e1000e/ich8lan.h | 3 +++ + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c +index 854c585de2e1..3cbb8d1ed67f 100644 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c +@@ -4811,7 +4811,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) + static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) + { + struct e1000_mac_info *mac = &hw->mac; +- u32 ctrl_ext, txdctl, snoop; ++ u32 ctrl_ext, txdctl, snoop, fflt_dbg; + s32 ret_val; + u16 i; + +@@ -4870,6 +4870,15 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) + snoop = (u32)~(PCIE_NO_SNOOP_ALL); + e1000e_set_pcie_no_snoop(hw, snoop); + ++ /* Enable workaround for packet loss issue on TGP PCH ++ * Do not gate DMA clock from the modPHY block ++ */ ++ if (mac->type >= e1000_pch_tgp) { ++ fflt_dbg = er32(FFLT_DBG); ++ fflt_dbg |= E1000_FFLT_DBG_DONT_GATE_WAKE_DMA_CLK; ++ ew32(FFLT_DBG, fflt_dbg); ++ } ++ + ctrl_ext = er32(CTRL_EXT); + ctrl_ext |= E1000_CTRL_EXT_RO_DIS; + ew32(CTRL_EXT, ctrl_ext); +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h +index e757896287eb..8f2a8f4ce0ee 100644 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.h ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h +@@ -286,6 +286,9 @@ + /* Proprietary Latency Tolerance Reporting PCI Capability */ + #define E1000_PCI_LTR_CAP_LPT 0xA8 + ++/* Don't gate wake DMA clock */ ++#define E1000_FFLT_DBG_DONT_GATE_WAKE_DMA_CLK 0x1000 ++ + void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw); + void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, + bool state); +-- +2.33.0 + diff --git a/queue-5.10/ice-add-missing-e810-device-ids.patch b/queue-5.10/ice-add-missing-e810-device-ids.patch new file mode 100644 index 00000000000..70832105495 --- /dev/null +++ b/queue-5.10/ice-add-missing-e810-device-ids.patch @@ -0,0 +1,67 @@ +From 97c869029ac3539aa66fb5c2998c401c278e2086 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Oct 2021 13:04:16 -0700 +Subject: ice: Add missing E810 device ids + +From: Tony Nguyen + +[ Upstream commit 7dcf78b870be6418d72bb1c4d4924bf0f5ca5052 ] + +As part of support for E810 XXV devices, some device ids were +inadvertently left out. Add those missing ids. + +Fixes: 195fb97766da ("ice: add additional E810 device id") +Signed-off-by: Tony Nguyen +Acked-by: Jesse Brandeburg +Acked-by: Paul Menzel +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ice/ice_common.c | 2 ++ + drivers/net/ethernet/intel/ice/ice_devids.h | 4 ++++ + drivers/net/ethernet/intel/ice/ice_main.c | 2 ++ + 3 files changed, 8 insertions(+) + +diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c +index 2239a5f45e5a..64714757bd4f 100644 +--- a/drivers/net/ethernet/intel/ice/ice_common.c ++++ b/drivers/net/ethernet/intel/ice/ice_common.c +@@ -24,6 +24,8 @@ static enum ice_status ice_set_mac_type(struct ice_hw *hw) + case ICE_DEV_ID_E810C_BACKPLANE: + case ICE_DEV_ID_E810C_QSFP: + case ICE_DEV_ID_E810C_SFP: ++ case ICE_DEV_ID_E810_XXV_BACKPLANE: ++ case ICE_DEV_ID_E810_XXV_QSFP: + case ICE_DEV_ID_E810_XXV_SFP: + hw->mac_type = ICE_MAC_E810; + break; +diff --git a/drivers/net/ethernet/intel/ice/ice_devids.h b/drivers/net/ethernet/intel/ice/ice_devids.h +index 9d8194671f6a..ef4392e6e244 100644 +--- a/drivers/net/ethernet/intel/ice/ice_devids.h ++++ b/drivers/net/ethernet/intel/ice/ice_devids.h +@@ -21,6 +21,10 @@ + #define ICE_DEV_ID_E810C_QSFP 0x1592 + /* Intel(R) Ethernet Controller E810-C for SFP */ + #define ICE_DEV_ID_E810C_SFP 0x1593 ++/* Intel(R) Ethernet Controller E810-XXV for backplane */ ++#define ICE_DEV_ID_E810_XXV_BACKPLANE 0x1599 ++/* Intel(R) Ethernet Controller E810-XXV for QSFP */ ++#define ICE_DEV_ID_E810_XXV_QSFP 0x159A + /* Intel(R) Ethernet Controller E810-XXV for SFP */ + #define ICE_DEV_ID_E810_XXV_SFP 0x159B + /* Intel(R) Ethernet Connection E823-C for backplane */ +diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c +index 5d0dc1f811e0..66d92a0cfef3 100644 +--- a/drivers/net/ethernet/intel/ice/ice_main.c ++++ b/drivers/net/ethernet/intel/ice/ice_main.c +@@ -4773,6 +4773,8 @@ static const struct pci_device_id ice_pci_tbl[] = { + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E810C_BACKPLANE), 0 }, + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E810C_QSFP), 0 }, + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E810C_SFP), 0 }, ++ { PCI_VDEVICE(INTEL, ICE_DEV_ID_E810_XXV_BACKPLANE), 0 }, ++ { PCI_VDEVICE(INTEL, ICE_DEV_ID_E810_XXV_QSFP), 0 }, + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E810_XXV_SFP), 0 }, + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E823C_BACKPLANE), 0 }, + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E823C_QSFP), 0 }, +-- +2.33.0 + diff --git a/queue-5.10/ice-fix-getting-udp-tunnel-entry.patch b/queue-5.10/ice-fix-getting-udp-tunnel-entry.patch new file mode 100644 index 00000000000..f4755408517 --- /dev/null +++ b/queue-5.10/ice-fix-getting-udp-tunnel-entry.patch @@ -0,0 +1,50 @@ +From 29e56e7c9e5c53e86cffd977a282465383598fa8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Sep 2021 19:25:05 -0400 +Subject: ice: fix getting UDP tunnel entry + +From: Michal Swiatkowski + +[ Upstream commit e4c2efa1393c6f1fbfabf91d1d83fcb4ae691ccb ] + +Correct parameters order in call to ice_tunnel_idx_to_entry function. + +Entry in sparse port table is correct when the idx is 0. For idx 1 one +correct entry should be skipped, for idx 2 two of them should be skipped +etc. Change if condition to be true when idx is 0, which means that +previous valid entry of this tunnel type were skipped. + +Fixes: b20e6c17c468 ("ice: convert to new udp_tunnel infrastructure") +Signed-off-by: Michal Swiatkowski +Tested-by: Gurucharan G +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ice/ice_flex_pipe.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c +index 9095b4d274ad..a81be917f653 100644 +--- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c ++++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c +@@ -1669,7 +1669,7 @@ static u16 ice_tunnel_idx_to_entry(struct ice_hw *hw, enum ice_tunnel_type type, + for (i = 0; i < hw->tnl.count && i < ICE_TUNNEL_MAX_ENTRIES; i++) + if (hw->tnl.tbl[i].valid && + hw->tnl.tbl[i].type == type && +- idx--) ++ idx-- == 0) + return i; + + WARN_ON_ONCE(1); +@@ -1829,7 +1829,7 @@ int ice_udp_tunnel_set_port(struct net_device *netdev, unsigned int table, + u16 index; + + tnl_type = ti->type == UDP_TUNNEL_TYPE_VXLAN ? TNL_VXLAN : TNL_GENEVE; +- index = ice_tunnel_idx_to_entry(&pf->hw, idx, tnl_type); ++ index = ice_tunnel_idx_to_entry(&pf->hw, tnl_type, idx); + + status = ice_create_tunnel(&pf->hw, index, tnl_type, ntohs(ti->port)); + if (status) { +-- +2.33.0 + diff --git a/queue-5.10/ipv6-when-forwarding-count-rx-stats-on-the-orig-netd.patch b/queue-5.10/ipv6-when-forwarding-count-rx-stats-on-the-orig-netd.patch new file mode 100644 index 00000000000..d943017a4a5 --- /dev/null +++ b/queue-5.10/ipv6-when-forwarding-count-rx-stats-on-the-orig-netd.patch @@ -0,0 +1,272 @@ +From 80473e97a51e5365792df9c0f4ba810f6d3b4913 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Oct 2021 09:08:45 -0400 +Subject: ipv6: When forwarding count rx stats on the orig netdev + +From: Stephen Suryaputra + +[ Upstream commit 0857d6f8c759d95f89d0436f86cdfd189ef99f20 ] + +Commit bdb7cc643fc9 ("ipv6: Count interface receive statistics on the +ingress netdev") does not work when ip6_forward() executes on the skbs +with vrf-enslaved netdev. Use IP6CB(skb)->iif to get to the right one. + +Add a selftest script to verify. + +Fixes: bdb7cc643fc9 ("ipv6: Count interface receive statistics on the ingress netdev") +Signed-off-by: Stephen Suryaputra +Reviewed-by: David Ahern +Link: https://lore.kernel.org/r/20211014130845.410602-1-ssuryaextr@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv6/ip6_output.c | 3 +- + .../testing/selftests/net/forwarding/Makefile | 1 + + .../net/forwarding/forwarding.config.sample | 2 + + .../net/forwarding/ip6_forward_instats_vrf.sh | 172 ++++++++++++++++++ + tools/testing/selftests/net/forwarding/lib.sh | 8 + + 5 files changed, 185 insertions(+), 1 deletion(-) + create mode 100755 tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh + +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c +index 72a673a43a75..c2f8e69d7d7a 100644 +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -487,13 +487,14 @@ static bool ip6_pkt_too_big(const struct sk_buff *skb, unsigned int mtu) + + int ip6_forward(struct sk_buff *skb) + { +- struct inet6_dev *idev = __in6_dev_get_safely(skb->dev); + struct dst_entry *dst = skb_dst(skb); + struct ipv6hdr *hdr = ipv6_hdr(skb); + struct inet6_skb_parm *opt = IP6CB(skb); + struct net *net = dev_net(dst->dev); ++ struct inet6_dev *idev; + u32 mtu; + ++ idev = __in6_dev_get_safely(dev_get_by_index_rcu(net, IP6CB(skb)->iif)); + if (net->ipv6.devconf_all->forwarding == 0) + goto error; + +diff --git a/tools/testing/selftests/net/forwarding/Makefile b/tools/testing/selftests/net/forwarding/Makefile +index 250fbb2d1625..881e680c2e9c 100644 +--- a/tools/testing/selftests/net/forwarding/Makefile ++++ b/tools/testing/selftests/net/forwarding/Makefile +@@ -9,6 +9,7 @@ TEST_PROGS = bridge_igmp.sh \ + gre_inner_v4_multipath.sh \ + gre_inner_v6_multipath.sh \ + gre_multipath.sh \ ++ ip6_forward_instats_vrf.sh \ + ip6gre_inner_v4_multipath.sh \ + ip6gre_inner_v6_multipath.sh \ + ipip_flat_gre_key.sh \ +diff --git a/tools/testing/selftests/net/forwarding/forwarding.config.sample b/tools/testing/selftests/net/forwarding/forwarding.config.sample +index b802c14d2950..e5e2fbeca22e 100644 +--- a/tools/testing/selftests/net/forwarding/forwarding.config.sample ++++ b/tools/testing/selftests/net/forwarding/forwarding.config.sample +@@ -39,3 +39,5 @@ NETIF_CREATE=yes + # Timeout (in seconds) before ping exits regardless of how many packets have + # been sent or received + PING_TIMEOUT=5 ++# IPv6 traceroute utility name. ++TROUTE6=traceroute6 +diff --git a/tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh b/tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh +new file mode 100755 +index 000000000000..9f5b3e2e5e95 +--- /dev/null ++++ b/tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh +@@ -0,0 +1,172 @@ ++#!/bin/bash ++# SPDX-License-Identifier: GPL-2.0 ++ ++# Test ipv6 stats on the incoming if when forwarding with VRF ++ ++ALL_TESTS=" ++ ipv6_ping ++ ipv6_in_too_big_err ++ ipv6_in_hdr_err ++ ipv6_in_addr_err ++ ipv6_in_discard ++" ++ ++NUM_NETIFS=4 ++source lib.sh ++ ++h1_create() ++{ ++ simple_if_init $h1 2001:1:1::2/64 ++ ip -6 route add vrf v$h1 2001:1:2::/64 via 2001:1:1::1 ++} ++ ++h1_destroy() ++{ ++ ip -6 route del vrf v$h1 2001:1:2::/64 via 2001:1:1::1 ++ simple_if_fini $h1 2001:1:1::2/64 ++} ++ ++router_create() ++{ ++ vrf_create router ++ __simple_if_init $rtr1 router 2001:1:1::1/64 ++ __simple_if_init $rtr2 router 2001:1:2::1/64 ++ mtu_set $rtr2 1280 ++} ++ ++router_destroy() ++{ ++ mtu_restore $rtr2 ++ __simple_if_fini $rtr2 2001:1:2::1/64 ++ __simple_if_fini $rtr1 2001:1:1::1/64 ++ vrf_destroy router ++} ++ ++h2_create() ++{ ++ simple_if_init $h2 2001:1:2::2/64 ++ ip -6 route add vrf v$h2 2001:1:1::/64 via 2001:1:2::1 ++ mtu_set $h2 1280 ++} ++ ++h2_destroy() ++{ ++ mtu_restore $h2 ++ ip -6 route del vrf v$h2 2001:1:1::/64 via 2001:1:2::1 ++ simple_if_fini $h2 2001:1:2::2/64 ++} ++ ++setup_prepare() ++{ ++ h1=${NETIFS[p1]} ++ rtr1=${NETIFS[p2]} ++ ++ rtr2=${NETIFS[p3]} ++ h2=${NETIFS[p4]} ++ ++ vrf_prepare ++ h1_create ++ router_create ++ h2_create ++ ++ forwarding_enable ++} ++ ++cleanup() ++{ ++ pre_cleanup ++ ++ forwarding_restore ++ ++ h2_destroy ++ router_destroy ++ h1_destroy ++ vrf_cleanup ++} ++ ++ipv6_in_too_big_err() ++{ ++ RET=0 ++ ++ local t0=$(ipv6_stats_get $rtr1 Ip6InTooBigErrors) ++ local vrf_name=$(master_name_get $h1) ++ ++ # Send too big packets ++ ip vrf exec $vrf_name \ ++ $PING6 -s 1300 2001:1:2::2 -c 1 -w $PING_TIMEOUT &> /dev/null ++ ++ local t1=$(ipv6_stats_get $rtr1 Ip6InTooBigErrors) ++ test "$((t1 - t0))" -ne 0 ++ check_err $? ++ log_test "Ip6InTooBigErrors" ++} ++ ++ipv6_in_hdr_err() ++{ ++ RET=0 ++ ++ local t0=$(ipv6_stats_get $rtr1 Ip6InHdrErrors) ++ local vrf_name=$(master_name_get $h1) ++ ++ # Send packets with hop limit 1, easiest with traceroute6 as some ping6 ++ # doesn't allow hop limit to be specified ++ ip vrf exec $vrf_name \ ++ $TROUTE6 2001:1:2::2 &> /dev/null ++ ++ local t1=$(ipv6_stats_get $rtr1 Ip6InHdrErrors) ++ test "$((t1 - t0))" -ne 0 ++ check_err $? ++ log_test "Ip6InHdrErrors" ++} ++ ++ipv6_in_addr_err() ++{ ++ RET=0 ++ ++ local t0=$(ipv6_stats_get $rtr1 Ip6InAddrErrors) ++ local vrf_name=$(master_name_get $h1) ++ ++ # Disable forwarding temporary while sending the packet ++ sysctl -qw net.ipv6.conf.all.forwarding=0 ++ ip vrf exec $vrf_name \ ++ $PING6 2001:1:2::2 -c 1 -w $PING_TIMEOUT &> /dev/null ++ sysctl -qw net.ipv6.conf.all.forwarding=1 ++ ++ local t1=$(ipv6_stats_get $rtr1 Ip6InAddrErrors) ++ test "$((t1 - t0))" -ne 0 ++ check_err $? ++ log_test "Ip6InAddrErrors" ++} ++ ++ipv6_in_discard() ++{ ++ RET=0 ++ ++ local t0=$(ipv6_stats_get $rtr1 Ip6InDiscards) ++ local vrf_name=$(master_name_get $h1) ++ ++ # Add a policy to discard ++ ip xfrm policy add dst 2001:1:2::2/128 dir fwd action block ++ ip vrf exec $vrf_name \ ++ $PING6 2001:1:2::2 -c 1 -w $PING_TIMEOUT &> /dev/null ++ ip xfrm policy del dst 2001:1:2::2/128 dir fwd ++ ++ local t1=$(ipv6_stats_get $rtr1 Ip6InDiscards) ++ test "$((t1 - t0))" -ne 0 ++ check_err $? ++ log_test "Ip6InDiscards" ++} ++ipv6_ping() ++{ ++ RET=0 ++ ++ ping6_test $h1 2001:1:2::2 ++} ++ ++trap cleanup EXIT ++ ++setup_prepare ++setup_wait ++tests_run ++ ++exit $EXIT_STATUS +diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh +index 927f9ba49e08..be6fa808d219 100644 +--- a/tools/testing/selftests/net/forwarding/lib.sh ++++ b/tools/testing/selftests/net/forwarding/lib.sh +@@ -674,6 +674,14 @@ qdisc_parent_stats_get() + | jq '.[] | select(.parent == "'"$parent"'") | '"$selector" + } + ++ipv6_stats_get() ++{ ++ local dev=$1; shift ++ local stat=$1; shift ++ ++ cat /proc/net/dev_snmp6/$dev | grep "^$stat" | cut -f2 ++} ++ + humanize() + { + local speed=$1; shift +-- +2.33.0 + diff --git a/queue-5.10/lan78xx-select-crc32.patch b/queue-5.10/lan78xx-select-crc32.patch new file mode 100644 index 00000000000..aa55b70a7e6 --- /dev/null +++ b/queue-5.10/lan78xx-select-crc32.patch @@ -0,0 +1,40 @@ +From 2b69f46bce930d1dcab905ebde4e1f278730d384 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Oct 2021 15:07:54 +0200 +Subject: lan78xx: select CRC32 + +From: Vegard Nossum + +[ Upstream commit 46393d61a328d7c4e3264252dae891921126c674 ] + +Fix the following build/link error by adding a dependency on the CRC32 +routines: + + ld: drivers/net/usb/lan78xx.o: in function `lan78xx_set_multicast': + lan78xx.c:(.text+0x48cf): undefined reference to `crc32_le' + +The actual use of crc32_le() comes indirectly through ether_crc(). + +Fixes: 55d7de9de6c30 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver") +Signed-off-by: Vegard Nossum +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig +index 4efad42b9aa9..867ff2ee8ecf 100644 +--- a/drivers/net/usb/Kconfig ++++ b/drivers/net/usb/Kconfig +@@ -117,6 +117,7 @@ config USB_LAN78XX + select PHYLIB + select MICROCHIP_PHY + select FIXED_PHY ++ select CRC32 + help + This option adds support for Microchip LAN78XX based USB 2 + & USB 3 10/100/1000 Ethernet adapters. +-- +2.33.0 + diff --git a/queue-5.10/net-dsa-lantiq_gswip-fix-register-definition.patch b/queue-5.10/net-dsa-lantiq_gswip-fix-register-definition.patch new file mode 100644 index 00000000000..2a2b433276b --- /dev/null +++ b/queue-5.10/net-dsa-lantiq_gswip-fix-register-definition.patch @@ -0,0 +1,38 @@ +From a5e3766200eb86c774cbd7e530248211045700f4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 16 Oct 2021 00:10:20 +0200 +Subject: net: dsa: lantiq_gswip: fix register definition + +From: Aleksander Jan Bajkowski + +[ Upstream commit 66d262804a2276721eac86cf18fcd61046149193 ] + +I compared the register definitions with the D-Link DWR-966 +GPL sources and found that the PUAFD field definition was +incorrect. This definition is unused and causes no issues. + +Fixes: 14fceff4771e ("net: dsa: Add Lantiq / Intel DSA driver for vrx200") +Signed-off-by: Aleksander Jan Bajkowski +Acked-by: Hauke Mehrtens +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/lantiq_gswip.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c +index 95e634cbc4b6..4d23a7aba796 100644 +--- a/drivers/net/dsa/lantiq_gswip.c ++++ b/drivers/net/dsa/lantiq_gswip.c +@@ -229,7 +229,7 @@ + #define GSWIP_SDMA_PCTRLp(p) (0xBC0 + ((p) * 0x6)) + #define GSWIP_SDMA_PCTRL_EN BIT(0) /* SDMA Port Enable */ + #define GSWIP_SDMA_PCTRL_FCEN BIT(1) /* Flow Control Enable */ +-#define GSWIP_SDMA_PCTRL_PAUFWD BIT(1) /* Pause Frame Forwarding */ ++#define GSWIP_SDMA_PCTRL_PAUFWD BIT(3) /* Pause Frame Forwarding */ + + #define GSWIP_TABLE_ACTIVE_VLAN 0x01 + #define GSWIP_TABLE_VLAN_MAPPING 0x02 +-- +2.33.0 + diff --git a/queue-5.10/net-enetc-fix-ethtool-counter-name-for-pm0_terr.patch b/queue-5.10/net-enetc-fix-ethtool-counter-name-for-pm0_terr.patch new file mode 100644 index 00000000000..e96bb766789 --- /dev/null +++ b/queue-5.10/net-enetc-fix-ethtool-counter-name-for-pm0_terr.patch @@ -0,0 +1,39 @@ +From 1033769b14e710e71b042e40d25b5888bafb1e8a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Oct 2021 19:52:06 +0300 +Subject: net: enetc: fix ethtool counter name for PM0_TERR + +From: Vladimir Oltean + +[ Upstream commit fb8dc5fc8cbdfd62ecd16493848aee2f42ed84d9 ] + +There are two counters named "MAC tx frames", one of them is actually +incorrect. The correct name for that counter should be "MAC tx error +frames", which is symmetric to the existing "MAC rx error frames". + +Fixes: 16eb4c85c964 ("enetc: Add ethtool statistics") +Signed-off-by: Vladimir Oltean +Reviewed-by: +Link: https://lore.kernel.org/r/20211020165206.1069889-1-vladimir.oltean@nxp.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +index 89e558135432..9c1690f64a02 100644 +--- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c ++++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +@@ -157,7 +157,7 @@ static const struct { + { ENETC_PM0_TFRM, "MAC tx frames" }, + { ENETC_PM0_TFCS, "MAC tx fcs errors" }, + { ENETC_PM0_TVLAN, "MAC tx VLAN frames" }, +- { ENETC_PM0_TERR, "MAC tx frames" }, ++ { ENETC_PM0_TERR, "MAC tx frame errors" }, + { ENETC_PM0_TUCA, "MAC tx unicast frames" }, + { ENETC_PM0_TMCA, "MAC tx multicast frames" }, + { ENETC_PM0_TBCA, "MAC tx broadcast frames" }, +-- +2.33.0 + diff --git a/queue-5.10/net-hns3-add-limit-ets-dwrr-bandwidth-cannot-be-0.patch b/queue-5.10/net-hns3-add-limit-ets-dwrr-bandwidth-cannot-be-0.patch new file mode 100644 index 00000000000..680f8b8472d --- /dev/null +++ b/queue-5.10/net-hns3-add-limit-ets-dwrr-bandwidth-cannot-be-0.patch @@ -0,0 +1,46 @@ +From 3da7f7e9fdc449446d274039067637a5f41cf15a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Oct 2021 22:16:30 +0800 +Subject: net: hns3: add limit ets dwrr bandwidth cannot be 0 + +From: Guangbin Huang + +[ Upstream commit 731797fdffa3d083db536e2fdd07ceb050bb40b1 ] + +If ets dwrr bandwidth of tc is set to 0, the hardware will switch to SP +mode. In this case, this tc may occupy all the tx bandwidth if it has +huge traffic, so it violates the purpose of the user setting. + +To fix this problem, limit the ets dwrr bandwidth must greater than 0. + +Fixes: cacde272dd00 ("net: hns3: Add hclge_dcb module for the support of DCB feature") +Signed-off-by: Guangbin Huang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +index 28a90ead4795..8e6085753b9f 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +@@ -134,6 +134,15 @@ static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets, + *changed = true; + break; + case IEEE_8021QAZ_TSA_ETS: ++ /* The hardware will switch to sp mode if bandwidth is ++ * 0, so limit ets bandwidth must be greater than 0. ++ */ ++ if (!ets->tc_tx_bw[i]) { ++ dev_err(&hdev->pdev->dev, ++ "tc%u ets bw cannot be 0\n", i); ++ return -EINVAL; ++ } ++ + if (hdev->tm_info.tc_info[i].tc_sch_mode != + HCLGE_SCH_MODE_DWRR) + *changed = true; +-- +2.33.0 + diff --git a/queue-5.10/net-hns3-disable-sriov-before-unload-hclge-layer.patch b/queue-5.10/net-hns3-disable-sriov-before-unload-hclge-layer.patch new file mode 100644 index 00000000000..a7bc9461bc4 --- /dev/null +++ b/queue-5.10/net-hns3-disable-sriov-before-unload-hclge-layer.patch @@ -0,0 +1,90 @@ +From 500d998b9498a038439d82c1e074a9b303195c55 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Oct 2021 22:16:35 +0800 +Subject: net: hns3: disable sriov before unload hclge layer + +From: Peng Li + +[ Upstream commit 0dd8a25f355b4df2d41c08df1716340854c7d4c5 ] + +HNS3 driver includes hns3.ko, hnae3.ko and hclge.ko. +hns3.ko includes network stack and pci_driver, hclge.ko includes +HW device action, algo_ops and timer task, hnae3.ko includes some +register function. + +When SRIOV is enable and hclge.ko is removed, HW device is unloaded +but VF still exists, PF will not reply VF mbx messages, and cause +errors. + +This patch fix it by disable SRIOV before remove hclge.ko. + +Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support") +Signed-off-by: Peng Li +Signed-off-by: Guangbin Huang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/hisilicon/hns3/hnae3.c | 21 +++++++++++++++++++ + drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 + + .../hisilicon/hns3/hns3pf/hclge_main.c | 1 + + 3 files changed, 23 insertions(+) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.c b/drivers/net/ethernet/hisilicon/hns3/hnae3.c +index eef1b2764d34..67b0bf310daa 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.c +@@ -10,6 +10,27 @@ static LIST_HEAD(hnae3_ae_algo_list); + static LIST_HEAD(hnae3_client_list); + static LIST_HEAD(hnae3_ae_dev_list); + ++void hnae3_unregister_ae_algo_prepare(struct hnae3_ae_algo *ae_algo) ++{ ++ const struct pci_device_id *pci_id; ++ struct hnae3_ae_dev *ae_dev; ++ ++ if (!ae_algo) ++ return; ++ ++ list_for_each_entry(ae_dev, &hnae3_ae_dev_list, node) { ++ if (!hnae3_get_bit(ae_dev->flag, HNAE3_DEV_INITED_B)) ++ continue; ++ ++ pci_id = pci_match_id(ae_algo->pdev_id_table, ae_dev->pdev); ++ if (!pci_id) ++ continue; ++ if (IS_ENABLED(CONFIG_PCI_IOV)) ++ pci_disable_sriov(ae_dev->pdev); ++ } ++} ++EXPORT_SYMBOL(hnae3_unregister_ae_algo_prepare); ++ + /* we are keeping things simple and using single lock for all the + * list. This is a non-critical code so other updations, if happen + * in parallel, can wait. +diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h +index 912c51e327d6..4a9576a449e1 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h ++++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h +@@ -754,6 +754,7 @@ struct hnae3_handle { + int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev); + void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev); + ++void hnae3_unregister_ae_algo_prepare(struct hnae3_ae_algo *ae_algo); + void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo); + void hnae3_register_ae_algo(struct hnae3_ae_algo *ae_algo); + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +index 0e869f449f12..7b94764b4f5d 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +@@ -11518,6 +11518,7 @@ static int hclge_init(void) + + static void hclge_exit(void) + { ++ hnae3_unregister_ae_algo_prepare(&ae_algo); + hnae3_unregister_ae_algo(&ae_algo); + destroy_workqueue(hclge_wq); + } +-- +2.33.0 + diff --git a/queue-5.10/net-hns3-fix-vf-reset-workqueue-cannot-exit.patch b/queue-5.10/net-hns3-fix-vf-reset-workqueue-cannot-exit.patch new file mode 100644 index 00000000000..378325cd74b --- /dev/null +++ b/queue-5.10/net-hns3-fix-vf-reset-workqueue-cannot-exit.patch @@ -0,0 +1,46 @@ +From 5e71844528d35dfc002fafa22070254da915601b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Oct 2021 22:16:34 +0800 +Subject: net: hns3: fix vf reset workqueue cannot exit + +From: Yufeng Mo + +[ Upstream commit 1385cc81baeb3bd8cbbbcdc1557f038ac1712529 ] + +The task of VF reset is performed through the workqueue. It checks the +value of hdev->reset_pending to determine whether to exit the loop. +However, the value of hdev->reset_pending may also be assigned by +the interrupt function hclgevf_misc_irq_handle(), which may cause the +loop fail to exit and keep occupying the workqueue. This loop is not +necessary, so remove it and the workqueue will be rescheduled if the +reset needs to be retried or a new reset occurs. + +Fixes: 1cc9bc6e5867 ("net: hns3: split hclgevf_reset() into preparing and rebuilding part") +Signed-off-by: Yufeng Mo +Signed-off-by: Guangbin Huang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +index 3641d7c31451..a47f23f27a11 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +@@ -2160,9 +2160,9 @@ static void hclgevf_reset_service_task(struct hclgevf_dev *hdev) + hdev->reset_attempts = 0; + + hdev->last_reset_time = jiffies; +- while ((hdev->reset_type = +- hclgevf_get_reset_level(hdev, &hdev->reset_pending)) +- != HNAE3_NONE_RESET) ++ hdev->reset_type = ++ hclgevf_get_reset_level(hdev, &hdev->reset_pending); ++ if (hdev->reset_type != HNAE3_NONE_RESET) + hclgevf_reset(hdev); + } else if (test_and_clear_bit(HCLGEVF_RESET_REQUESTED, + &hdev->reset_state)) { +-- +2.33.0 + diff --git a/queue-5.10/net-hns3-reset-dwrr-of-unused-tc-to-zero.patch b/queue-5.10/net-hns3-reset-dwrr-of-unused-tc-to-zero.patch new file mode 100644 index 00000000000..e2385261e72 --- /dev/null +++ b/queue-5.10/net-hns3-reset-dwrr-of-unused-tc-to-zero.patch @@ -0,0 +1,63 @@ +From d915e3b0b681b70079075725ab1dce2a6b8b9e47 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Oct 2021 22:16:29 +0800 +Subject: net: hns3: reset DWRR of unused tc to zero + +From: Guangbin Huang + +[ Upstream commit b63fcaab959807282e9822e659034edf95fc8bd1 ] + +Currently, DWRR of tc will be initialized to a fixed value when this tc +is enabled, but it is not been reset to 0 when this tc is disabled. It +cause a problem that the DWRR of unused tc is not 0 after using tc tool +to add and delete multi-tc parameters. + +For examples, after enabling 4 TCs and restoring to 1 TC by follow +tc commands: + +$ tc qdisc add dev eth0 root mqprio num_tc 4 map 0 1 2 3 0 1 2 3 queues \ + 8@0 8@8 8@16 8@24 hw 1 mode channel +$ tc qdisc del dev eth0 root + +Now there is just one TC is enabled for eth0, but the tc info querying by +debugfs is shown as follow: + +$ cat /mnt/hns3/0000:7d:00.0/tm/tc_sch_info +enabled tc number: 1 +weight_offset: 14 +TC MODE WEIGHT +0 dwrr 100 +1 dwrr 100 +2 dwrr 100 +3 dwrr 100 +4 dwrr 0 +5 dwrr 0 +6 dwrr 0 +7 dwrr 0 + +This patch fixes it by resetting DWRR of tc to 0 when tc is disabled. + +Fixes: 848440544b41 ("net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver") +Signed-off-by: Guangbin Huang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +index 69d081515c60..71aa6d16fc19 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +@@ -671,6 +671,8 @@ static void hclge_tm_pg_info_init(struct hclge_dev *hdev) + hdev->tm_info.pg_info[i].tc_bit_map = hdev->hw_tc_map; + for (k = 0; k < hdev->tm_info.num_tc; k++) + hdev->tm_info.pg_info[i].tc_dwrr[k] = BW_PERCENT; ++ for (; k < HNAE3_MAX_TC; k++) ++ hdev->tm_info.pg_info[i].tc_dwrr[k] = 0; + } + } + +-- +2.33.0 + diff --git a/queue-5.10/net-hns3-schedule-the-polling-again-when-allocation-.patch b/queue-5.10/net-hns3-schedule-the-polling-again-when-allocation-.patch new file mode 100644 index 00000000000..a2329508a95 --- /dev/null +++ b/queue-5.10/net-hns3-schedule-the-polling-again-when-allocation-.patch @@ -0,0 +1,104 @@ +From 6c0d3eb70e653ff98722e0b6ecd94dd553bb72c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Oct 2021 22:16:33 +0800 +Subject: net: hns3: schedule the polling again when allocation fails + +From: Yunsheng Lin + +[ Upstream commit 68752b24f51a71d4f350a764d890b670f59062c5 ] + +Currently when there is a rx page allocation failure, it is +possible that polling may be stopped if there is no more packet +to be reveiced, which may cause queue stall problem under memory +pressure. + +This patch makes sure polling is scheduled again when there is +any rx page allocation failure, and polling will try to allocate +receive buffers until it succeeds. + +Now the allocation retry is added, it is unnecessary to do the rx +page allocation at the end of rx cleaning, so remove it. And reset +the unused_count to zero after calling hns3_nic_alloc_rx_buffers() +to avoid calling hns3_nic_alloc_rx_buffers() repeatedly under +memory pressure. + +Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") +Signed-off-by: Yunsheng Lin +Signed-off-by: Guangbin Huang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../net/ethernet/hisilicon/hns3/hns3_enet.c | 22 ++++++++++--------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +index 4777db2623cf..e2790deb6dab 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +@@ -2637,7 +2637,8 @@ static int hns3_desc_unused(struct hns3_enet_ring *ring) + return ((ntc >= ntu) ? 0 : ring->desc_num) + ntc - ntu; + } + +-static void hns3_nic_alloc_rx_buffers(struct hns3_enet_ring *ring, ++/* Return true if there is any allocation failure */ ++static bool hns3_nic_alloc_rx_buffers(struct hns3_enet_ring *ring, + int cleand_count) + { + struct hns3_desc_cb *desc_cb; +@@ -2662,7 +2663,10 @@ static void hns3_nic_alloc_rx_buffers(struct hns3_enet_ring *ring, + hns3_rl_err(ring_to_netdev(ring), + "alloc rx buffer failed: %d\n", + ret); +- break; ++ ++ writel(i, ring->tqp->io_base + ++ HNS3_RING_RX_RING_HEAD_REG); ++ return true; + } + hns3_replace_buffer(ring, ring->next_to_use, &res_cbs); + +@@ -2675,6 +2679,7 @@ static void hns3_nic_alloc_rx_buffers(struct hns3_enet_ring *ring, + } + + writel(i, ring->tqp->io_base + HNS3_RING_RX_RING_HEAD_REG); ++ return false; + } + + static bool hns3_page_is_reusable(struct page *page) +@@ -3218,6 +3223,7 @@ int hns3_clean_rx_ring(struct hns3_enet_ring *ring, int budget, + { + #define RCB_NOF_ALLOC_RX_BUFF_ONCE 16 + int unused_count = hns3_desc_unused(ring); ++ bool failure = false; + int recv_pkts = 0; + int err; + +@@ -3226,9 +3232,9 @@ int hns3_clean_rx_ring(struct hns3_enet_ring *ring, int budget, + while (recv_pkts < budget) { + /* Reuse or realloc buffers */ + if (unused_count >= RCB_NOF_ALLOC_RX_BUFF_ONCE) { +- hns3_nic_alloc_rx_buffers(ring, unused_count); +- unused_count = hns3_desc_unused(ring) - +- ring->pending_buf; ++ failure = failure || ++ hns3_nic_alloc_rx_buffers(ring, unused_count); ++ unused_count = 0; + } + + /* Poll one pkt */ +@@ -3247,11 +3253,7 @@ int hns3_clean_rx_ring(struct hns3_enet_ring *ring, int budget, + } + + out: +- /* Make all data has been write before submit */ +- if (unused_count > 0) +- hns3_nic_alloc_rx_buffers(ring, unused_count); +- +- return recv_pkts; ++ return failure ? budget : recv_pkts; + } + + static bool hns3_get_new_flow_lvl(struct hns3_enet_ring_group *ring_group) +-- +2.33.0 + diff --git a/queue-5.10/net-stmmac-fix-e2e-delay-mechanism.patch b/queue-5.10/net-stmmac-fix-e2e-delay-mechanism.patch new file mode 100644 index 00000000000..779420ae53a --- /dev/null +++ b/queue-5.10/net-stmmac-fix-e2e-delay-mechanism.patch @@ -0,0 +1,56 @@ +From e78269284d49e050abf7f443397a13d4c066dd54 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Oct 2021 09:04:33 +0200 +Subject: net: stmmac: Fix E2E delay mechanism + +From: Kurt Kanzenbach + +[ Upstream commit 3cb958027cb8b78d3ee639ce9af54c2ef1bf964f ] + +When utilizing End to End delay mechanism, the following error messages show up: + +|root@ehl1:~# ptp4l --tx_timestamp_timeout=50 -H -i eno2 -E -m +|ptp4l[950.573]: selected /dev/ptp3 as PTP clock +|ptp4l[950.586]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE +|ptp4l[950.586]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE +|ptp4l[952.879]: port 1: new foreign master 001395.fffe.4897b4-1 +|ptp4l[956.879]: selected best master clock 001395.fffe.4897b4 +|ptp4l[956.879]: port 1: assuming the grand master role +|ptp4l[956.879]: port 1: LISTENING to GRAND_MASTER on RS_GRAND_MASTER +|ptp4l[962.017]: port 1: received DELAY_REQ without timestamp +|ptp4l[962.273]: port 1: received DELAY_REQ without timestamp +|ptp4l[963.090]: port 1: received DELAY_REQ without timestamp + +Commit f2fb6b6275eb ("net: stmmac: enable timestamp snapshot for required PTP +packets in dwmac v5.10a") already addresses this problem for the dwmac +v5.10. However, same holds true for all dwmacs above version v4.10. Correct the +check accordingly. Afterwards everything works as expected. + +Tested on Intel Atom(R) x6414RE Processor. + +Fixes: 14f347334bf2 ("net: stmmac: Correctly take timestamp for PTPv2") +Fixes: f2fb6b6275eb ("net: stmmac: enable timestamp snapshot for required PTP packets in dwmac v5.10a") +Suggested-by: Ong Boon Leong +Signed-off-by: Kurt Kanzenbach +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 6133b2fe8a78..0ac61e7ab43c 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -605,7 +605,7 @@ static int stmmac_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) + config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; + ptp_v2 = PTP_TCR_TSVER2ENA; + snap_type_sel = PTP_TCR_SNAPTYPSEL_1; +- if (priv->synopsys_id != DWMAC_CORE_5_10) ++ if (priv->synopsys_id < DWMAC_CORE_4_10) + ts_event_en = PTP_TCR_TSEVNTENA; + ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; + ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; +-- +2.33.0 + diff --git a/queue-5.10/netfilter-ip6t_rt-fix-rt0_hdr-parsing-in-rt_mt6.patch b/queue-5.10/netfilter-ip6t_rt-fix-rt0_hdr-parsing-in-rt_mt6.patch new file mode 100644 index 00000000000..95ea8269dd6 --- /dev/null +++ b/queue-5.10/netfilter-ip6t_rt-fix-rt0_hdr-parsing-in-rt_mt6.patch @@ -0,0 +1,146 @@ +From 105d47e1ae94e010055d5d6d2331c9a51f92d550 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Oct 2021 08:18:13 -0400 +Subject: netfilter: ip6t_rt: fix rt0_hdr parsing in rt_mt6 + +From: Xin Long + +[ Upstream commit a482c5e00a9b5a194085bcd372ac36141028becb ] + +In rt_mt6(), when it's a nonlinear skb, the 1st skb_header_pointer() +only copies sizeof(struct ipv6_rt_hdr) to _route that rh points to. +The access by ((const struct rt0_hdr *)rh)->reserved will overflow +the buffer. So this access should be moved below the 2nd call to +skb_header_pointer(). + +Besides, after the 2nd skb_header_pointer(), its return value should +also be checked, othersize, *rp may cause null-pointer-ref. + +v1->v2: + - clean up some old debugging log. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Reported-by: Dan Carpenter +Signed-off-by: Xin Long +Acked-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/ipv6/netfilter/ip6t_rt.c | 48 +++++------------------------------- + 1 file changed, 6 insertions(+), 42 deletions(-) + +diff --git a/net/ipv6/netfilter/ip6t_rt.c b/net/ipv6/netfilter/ip6t_rt.c +index 733c83d38b30..4ad8b2032f1f 100644 +--- a/net/ipv6/netfilter/ip6t_rt.c ++++ b/net/ipv6/netfilter/ip6t_rt.c +@@ -25,12 +25,7 @@ MODULE_AUTHOR("Andras Kis-Szabo "); + static inline bool + segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert) + { +- bool r; +- pr_debug("segsleft_match:%c 0x%x <= 0x%x <= 0x%x\n", +- invert ? '!' : ' ', min, id, max); +- r = (id >= min && id <= max) ^ invert; +- pr_debug(" result %s\n", r ? "PASS" : "FAILED"); +- return r; ++ return (id >= min && id <= max) ^ invert; + } + + static bool rt_mt6(const struct sk_buff *skb, struct xt_action_param *par) +@@ -65,30 +60,6 @@ static bool rt_mt6(const struct sk_buff *skb, struct xt_action_param *par) + return false; + } + +- pr_debug("IPv6 RT LEN %u %u ", hdrlen, rh->hdrlen); +- pr_debug("TYPE %04X ", rh->type); +- pr_debug("SGS_LEFT %u %02X\n", rh->segments_left, rh->segments_left); +- +- pr_debug("IPv6 RT segsleft %02X ", +- segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1], +- rh->segments_left, +- !!(rtinfo->invflags & IP6T_RT_INV_SGS))); +- pr_debug("type %02X %02X %02X ", +- rtinfo->rt_type, rh->type, +- (!(rtinfo->flags & IP6T_RT_TYP) || +- ((rtinfo->rt_type == rh->type) ^ +- !!(rtinfo->invflags & IP6T_RT_INV_TYP)))); +- pr_debug("len %02X %04X %02X ", +- rtinfo->hdrlen, hdrlen, +- !(rtinfo->flags & IP6T_RT_LEN) || +- ((rtinfo->hdrlen == hdrlen) ^ +- !!(rtinfo->invflags & IP6T_RT_INV_LEN))); +- pr_debug("res %02X %02X %02X ", +- rtinfo->flags & IP6T_RT_RES, +- ((const struct rt0_hdr *)rh)->reserved, +- !((rtinfo->flags & IP6T_RT_RES) && +- (((const struct rt0_hdr *)rh)->reserved))); +- + ret = (segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1], + rh->segments_left, + !!(rtinfo->invflags & IP6T_RT_INV_SGS))) && +@@ -107,22 +78,22 @@ static bool rt_mt6(const struct sk_buff *skb, struct xt_action_param *par) + reserved), + sizeof(_reserved), + &_reserved); ++ if (!rp) { ++ par->hotdrop = true; ++ return false; ++ } + + ret = (*rp == 0); + } + +- pr_debug("#%d ", rtinfo->addrnr); + if (!(rtinfo->flags & IP6T_RT_FST)) { + return ret; + } else if (rtinfo->flags & IP6T_RT_FST_NSTRICT) { +- pr_debug("Not strict "); + if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { +- pr_debug("There isn't enough space\n"); + return false; + } else { + unsigned int i = 0; + +- pr_debug("#%d ", rtinfo->addrnr); + for (temp = 0; + temp < (unsigned int)((hdrlen - 8) / 16); + temp++) { +@@ -138,26 +109,20 @@ static bool rt_mt6(const struct sk_buff *skb, struct xt_action_param *par) + return false; + } + +- if (ipv6_addr_equal(ap, &rtinfo->addrs[i])) { +- pr_debug("i=%d temp=%d;\n", i, temp); ++ if (ipv6_addr_equal(ap, &rtinfo->addrs[i])) + i++; +- } + if (i == rtinfo->addrnr) + break; + } +- pr_debug("i=%d #%d\n", i, rtinfo->addrnr); + if (i == rtinfo->addrnr) + return ret; + else + return false; + } + } else { +- pr_debug("Strict "); + if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { +- pr_debug("There isn't enough space\n"); + return false; + } else { +- pr_debug("#%d ", rtinfo->addrnr); + for (temp = 0; temp < rtinfo->addrnr; temp++) { + ap = skb_header_pointer(skb, + ptr +@@ -173,7 +138,6 @@ static bool rt_mt6(const struct sk_buff *skb, struct xt_action_param *par) + if (!ipv6_addr_equal(ap, &rtinfo->addrs[temp])) + break; + } +- pr_debug("temp=%d #%d\n", temp, rtinfo->addrnr); + if (temp == rtinfo->addrnr && + temp == (unsigned int)((hdrlen - 8) / 16)) + return ret; +-- +2.33.0 + diff --git a/queue-5.10/netfilter-ipvs-make-global-sysctl-readonly-in-non-in.patch b/queue-5.10/netfilter-ipvs-make-global-sysctl-readonly-in-non-in.patch new file mode 100644 index 00000000000..acc80495e37 --- /dev/null +++ b/queue-5.10/netfilter-ipvs-make-global-sysctl-readonly-in-non-in.patch @@ -0,0 +1,40 @@ +From 312c1d34ea265c878023ad1627be3e2057501741 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Oct 2021 16:54:37 +0200 +Subject: netfilter: ipvs: make global sysctl readonly in non-init netns + +From: Antoine Tenart + +[ Upstream commit 174c376278949c44aad89c514a6b5db6cee8db59 ] + +Because the data pointer of net/ipv4/vs/debug_level is not updated per +netns, it must be marked as read-only in non-init netns. + +Fixes: c6d2d445d8de ("IPVS: netns, final patch enabling network name space.") +Signed-off-by: Antoine Tenart +Acked-by: Julian Anastasov +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/ipvs/ip_vs_ctl.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index c25097092a06..29ec3ef63edc 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -4090,6 +4090,11 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) + tbl[idx++].data = &ipvs->sysctl_conn_reuse_mode; + tbl[idx++].data = &ipvs->sysctl_schedule_icmp; + tbl[idx++].data = &ipvs->sysctl_ignore_tunneled; ++#ifdef CONFIG_IP_VS_DEBUG ++ /* Global sysctls must be ro in non-init netns */ ++ if (!net_eq(net, &init_net)) ++ tbl[idx++].mode = 0444; ++#endif + + ipvs->sysctl_hdr = register_net_sysctl(net, "net/ipv4/vs", tbl); + if (ipvs->sysctl_hdr == NULL) { +-- +2.33.0 + diff --git a/queue-5.10/netfilter-xt_idletimer-fix-panic-that-occurs-when-ti.patch b/queue-5.10/netfilter-xt_idletimer-fix-panic-that-occurs-when-ti.patch new file mode 100644 index 00000000000..a6ddf2a039f --- /dev/null +++ b/queue-5.10/netfilter-xt_idletimer-fix-panic-that-occurs-when-ti.patch @@ -0,0 +1,87 @@ +From 767beede8a40b3c850113b8d478df42d15f7e0c7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Oct 2021 21:14:38 +0900 +Subject: netfilter: xt_IDLETIMER: fix panic that occurs when timer_type has + garbage value + +From: Juhee Kang + +[ Upstream commit 902c0b1887522a099aa4e1e6b4b476c2fe5dd13e ] + +Currently, when the rule related to IDLETIMER is added, idletimer_tg timer +structure is initialized by kmalloc on executing idletimer_tg_create +function. However, in this process timer->timer_type is not defined to +a specific value. Thus, timer->timer_type has garbage value and it occurs +kernel panic. So, this commit fixes the panic by initializing +timer->timer_type using kzalloc instead of kmalloc. + +Test commands: + # iptables -A OUTPUT -j IDLETIMER --timeout 1 --label test + $ cat /sys/class/xt_idletimer/timers/test + Killed + +Splat looks like: + BUG: KASAN: user-memory-access in alarm_expires_remaining+0x49/0x70 + Read of size 8 at addr 0000002e8c7bc4c8 by task cat/917 + CPU: 12 PID: 917 Comm: cat Not tainted 5.14.0+ #3 79940a339f71eb14fc81aee1757a20d5bf13eb0e + Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014 + Call Trace: + dump_stack_lvl+0x6e/0x9c + kasan_report.cold+0x112/0x117 + ? alarm_expires_remaining+0x49/0x70 + __asan_load8+0x86/0xb0 + alarm_expires_remaining+0x49/0x70 + idletimer_tg_show+0xe5/0x19b [xt_IDLETIMER 11219304af9316a21bee5ba9d58f76a6b9bccc6d] + dev_attr_show+0x3c/0x60 + sysfs_kf_seq_show+0x11d/0x1f0 + ? device_remove_bin_file+0x20/0x20 + kernfs_seq_show+0xa4/0xb0 + seq_read_iter+0x29c/0x750 + kernfs_fop_read_iter+0x25a/0x2c0 + ? __fsnotify_parent+0x3d1/0x570 + ? iov_iter_init+0x70/0x90 + new_sync_read+0x2a7/0x3d0 + ? __x64_sys_llseek+0x230/0x230 + ? rw_verify_area+0x81/0x150 + vfs_read+0x17b/0x240 + ksys_read+0xd9/0x180 + ? vfs_write+0x460/0x460 + ? do_syscall_64+0x16/0xc0 + ? lockdep_hardirqs_on+0x79/0x120 + __x64_sys_read+0x43/0x50 + do_syscall_64+0x3b/0xc0 + entry_SYSCALL_64_after_hwframe+0x44/0xae + RIP: 0033:0x7f0cdc819142 + Code: c0 e9 c2 fe ff ff 50 48 8d 3d 3a ca 0a 00 e8 f5 19 02 00 0f 1f 44 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 0f 05 <48> 3d 00 f0 ff ff 77 56 c3 0f 1f 44 00 00 48 83 ec 28 48 89 54 24 + RSP: 002b:00007fff28eee5b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 + RAX: ffffffffffffffda RBX: 0000000000020000 RCX: 00007f0cdc819142 + RDX: 0000000000020000 RSI: 00007f0cdc032000 RDI: 0000000000000003 + RBP: 00007f0cdc032000 R08: 00007f0cdc031010 R09: 0000000000000000 + R10: 0000000000000022 R11: 0000000000000246 R12: 00005607e9ee31f0 + R13: 0000000000000003 R14: 0000000000020000 R15: 0000000000020000 + +Fixes: 68983a354a65 ("netfilter: xtables: Add snapshot of hardidletimer target") +Signed-off-by: Juhee Kang +Reviewed-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/xt_IDLETIMER.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c +index 7b2f359bfce4..2f7cf5ecebf4 100644 +--- a/net/netfilter/xt_IDLETIMER.c ++++ b/net/netfilter/xt_IDLETIMER.c +@@ -137,7 +137,7 @@ static int idletimer_tg_create(struct idletimer_tg_info *info) + { + int ret; + +- info->timer = kmalloc(sizeof(*info->timer), GFP_KERNEL); ++ info->timer = kzalloc(sizeof(*info->timer), GFP_KERNEL); + if (!info->timer) { + ret = -ENOMEM; + goto out; +-- +2.33.0 + diff --git a/queue-5.10/nios2-irqflags-rename-a-redefined-register-name.patch b/queue-5.10/nios2-irqflags-rename-a-redefined-register-name.patch new file mode 100644 index 00000000000..77d7e33a4c0 --- /dev/null +++ b/queue-5.10/nios2-irqflags-rename-a-redefined-register-name.patch @@ -0,0 +1,67 @@ +From d36effe22448b37cff2baa682d4256eb105d1b19 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Oct 2021 00:56:06 -0700 +Subject: NIOS2: irqflags: rename a redefined register name + +From: Randy Dunlap + +[ Upstream commit 4cce60f15c04d69eff6ffc539ab09137dbe15070 ] + +Both arch/nios2/ and drivers/mmc/host/tmio_mmc.c define a macro +with the name "CTL_STATUS". Change the one in arch/nios2/ to be +"CTL_FSTATUS" (flags status) to eliminate the build warning. + +In file included from ../drivers/mmc/host/tmio_mmc.c:22: +drivers/mmc/host/tmio_mmc.h:31: warning: "CTL_STATUS" redefined + 31 | #define CTL_STATUS 0x1c +arch/nios2/include/asm/registers.h:14: note: this is the location of the previous definition + 14 | #define CTL_STATUS 0 + +Fixes: b31ebd8055ea ("nios2: Nios2 registers") +Signed-off-by: Randy Dunlap +Cc: Dinh Nguyen +Signed-off-by: Dinh Nguyen +Signed-off-by: Sasha Levin +--- + arch/nios2/include/asm/irqflags.h | 4 ++-- + arch/nios2/include/asm/registers.h | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/nios2/include/asm/irqflags.h b/arch/nios2/include/asm/irqflags.h +index b3ec3e510706..25acf27862f9 100644 +--- a/arch/nios2/include/asm/irqflags.h ++++ b/arch/nios2/include/asm/irqflags.h +@@ -9,7 +9,7 @@ + + static inline unsigned long arch_local_save_flags(void) + { +- return RDCTL(CTL_STATUS); ++ return RDCTL(CTL_FSTATUS); + } + + /* +@@ -18,7 +18,7 @@ static inline unsigned long arch_local_save_flags(void) + */ + static inline void arch_local_irq_restore(unsigned long flags) + { +- WRCTL(CTL_STATUS, flags); ++ WRCTL(CTL_FSTATUS, flags); + } + + static inline void arch_local_irq_disable(void) +diff --git a/arch/nios2/include/asm/registers.h b/arch/nios2/include/asm/registers.h +index 183c720e454d..95b67dd16f81 100644 +--- a/arch/nios2/include/asm/registers.h ++++ b/arch/nios2/include/asm/registers.h +@@ -11,7 +11,7 @@ + #endif + + /* control register numbers */ +-#define CTL_STATUS 0 ++#define CTL_FSTATUS 0 + #define CTL_ESTATUS 1 + #define CTL_BSTATUS 2 + #define CTL_IENABLE 3 +-- +2.33.0 + diff --git a/queue-5.10/powerpc-smp-do-not-decrement-idle-task-preempt-count.patch b/queue-5.10/powerpc-smp-do-not-decrement-idle-task-preempt-count.patch new file mode 100644 index 00000000000..ffed387c59a --- /dev/null +++ b/queue-5.10/powerpc-smp-do-not-decrement-idle-task-preempt-count.patch @@ -0,0 +1,67 @@ +From cf0685a3b683e758e4dce4486d1332b2c4217233 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Oct 2021 12:39:02 -0500 +Subject: powerpc/smp: do not decrement idle task preempt count in CPU offline + +From: Nathan Lynch + +[ Upstream commit 787252a10d9422f3058df9a4821f389e5326c440 ] + +With PREEMPT_COUNT=y, when a CPU is offlined and then onlined again, we +get: + +BUG: scheduling while atomic: swapper/1/0/0x00000000 +no locks held by swapper/1/0. +CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.15.0-rc2+ #100 +Call Trace: + dump_stack_lvl+0xac/0x108 + __schedule_bug+0xac/0xe0 + __schedule+0xcf8/0x10d0 + schedule_idle+0x3c/0x70 + do_idle+0x2d8/0x4a0 + cpu_startup_entry+0x38/0x40 + start_secondary+0x2ec/0x3a0 + start_secondary_prolog+0x10/0x14 + +This is because powerpc's arch_cpu_idle_dead() decrements the idle task's +preempt count, for reasons explained in commit a7c2bb8279d2 ("powerpc: +Re-enable preemption before cpu_die()"), specifically "start_secondary() +expects a preempt_count() of 0." + +However, since commit 2c669ef6979c ("powerpc/preempt: Don't touch the idle +task's preempt_count during hotplug") and commit f1a0a376ca0c ("sched/core: +Initialize the idle task with preemption disabled"), that justification no +longer holds. + +The idle task isn't supposed to re-enable preemption, so remove the +vestigial preempt_enable() from the CPU offline path. + +Tested with pseries and powernv in qemu, and pseries on PowerVM. + +Fixes: 2c669ef6979c ("powerpc/preempt: Don't touch the idle task's preempt_count during hotplug") +Signed-off-by: Nathan Lynch +Reviewed-by: Valentin Schneider +Reviewed-by: Srikar Dronamraju +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20211015173902.2278118-1-nathanl@linux.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/smp.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c +index 91f274134884..452cbf98bfd7 100644 +--- a/arch/powerpc/kernel/smp.c ++++ b/arch/powerpc/kernel/smp.c +@@ -1578,8 +1578,6 @@ void __cpu_die(unsigned int cpu) + + void arch_cpu_idle_dead(void) + { +- sched_preempt_enable_no_resched(); +- + /* + * Disable on the down path. This will be re-enabled by + * start_secondary() via start_secondary_resume() below +-- +2.33.0 + diff --git a/queue-5.10/series b/queue-5.10/series index e311b74b2d3..74516ba6514 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -9,3 +9,25 @@ drm-amdgpu-display-fix-dependencies-for-drm_amd_dc_s.patch xtensa-xtfpga-use-config_use_of-instead-of-config_of.patch xtensa-xtfpga-try-software-restart-before-simulating.patch nfsd-keep-existing-listeners-on-portlist-error.patch +netfilter-xt_idletimer-fix-panic-that-occurs-when-ti.patch +dma-debug-fix-sg-checks-in-debug_dma_map_sg.patch +asoc-wm8960-fix-clock-configuration-on-slave-mode.patch +ice-fix-getting-udp-tunnel-entry.patch +netfilter-ip6t_rt-fix-rt0_hdr-parsing-in-rt_mt6.patch +netfilter-ipvs-make-global-sysctl-readonly-in-non-in.patch +lan78xx-select-crc32.patch +tcp-md5-fix-overlap-between-vrf-and-non-vrf-keys.patch +ipv6-when-forwarding-count-rx-stats-on-the-orig-netd.patch +net-dsa-lantiq_gswip-fix-register-definition.patch +nios2-irqflags-rename-a-redefined-register-name.patch +powerpc-smp-do-not-decrement-idle-task-preempt-count.patch +net-hns3-reset-dwrr-of-unused-tc-to-zero.patch +net-hns3-add-limit-ets-dwrr-bandwidth-cannot-be-0.patch +net-hns3-schedule-the-polling-again-when-allocation-.patch +net-hns3-fix-vf-reset-workqueue-cannot-exit.patch +net-hns3-disable-sriov-before-unload-hclge-layer.patch +net-stmmac-fix-e2e-delay-mechanism.patch +e1000e-fix-packet-loss-on-tiger-lake-and-later.patch +ice-add-missing-e810-device-ids.patch +drm-panel-ilitek-ili9881c-fix-sync-for-feixin-k101-i.patch +net-enetc-fix-ethtool-counter-name-for-pm0_terr.patch diff --git a/queue-5.10/tcp-md5-fix-overlap-between-vrf-and-non-vrf-keys.patch b/queue-5.10/tcp-md5-fix-overlap-between-vrf-and-non-vrf-keys.patch new file mode 100644 index 00000000000..4eb9fe19772 --- /dev/null +++ b/queue-5.10/tcp-md5-fix-overlap-between-vrf-and-non-vrf-keys.patch @@ -0,0 +1,84 @@ +From eaeb9a60ef06133e9355c5e6fd7c6e851c1ac433 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Oct 2021 10:26:04 +0300 +Subject: tcp: md5: Fix overlap between vrf and non-vrf keys + +From: Leonard Crestez + +[ Upstream commit 86f1e3a8489f6a0232c1f3bc2bdb379f5ccdecec ] + +With net.ipv4.tcp_l3mdev_accept=1 it is possible for a listen socket to +accept connection from the same client address in different VRFs. It is +also possible to set different MD5 keys for these clients which differ +only in the tcpm_l3index field. + +This appears to work when distinguishing between different VRFs but not +between non-VRF and VRF connections. In particular: + + * tcp_md5_do_lookup_exact will match a non-vrf key against a vrf key. +This means that adding a key with l3index != 0 after a key with l3index +== 0 will cause the earlier key to be deleted. Both keys can be present +if the non-vrf key is added later. + * _tcp_md5_do_lookup can match a non-vrf key before a vrf key. This +casues failures if the passwords differ. + +Fix this by making tcp_md5_do_lookup_exact perform an actual exact +comparison on l3index and by making __tcp_md5_do_lookup perfer +vrf-bound keys above other considerations like prefixlen. + +Fixes: dea53bb80e07 ("tcp: Add l3index to tcp_md5sig_key and md5 functions") +Signed-off-by: Leonard Crestez +Reviewed-by: David Ahern +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv4/tcp_ipv4.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c +index 71395e745bc5..017cd666387f 100644 +--- a/net/ipv4/tcp_ipv4.c ++++ b/net/ipv4/tcp_ipv4.c +@@ -1022,6 +1022,20 @@ static void tcp_v4_reqsk_destructor(struct request_sock *req) + DEFINE_STATIC_KEY_FALSE(tcp_md5_needed); + EXPORT_SYMBOL(tcp_md5_needed); + ++static bool better_md5_match(struct tcp_md5sig_key *old, struct tcp_md5sig_key *new) ++{ ++ if (!old) ++ return true; ++ ++ /* l3index always overrides non-l3index */ ++ if (old->l3index && new->l3index == 0) ++ return false; ++ if (old->l3index == 0 && new->l3index) ++ return true; ++ ++ return old->prefixlen < new->prefixlen; ++} ++ + /* Find the Key structure for an address. */ + struct tcp_md5sig_key *__tcp_md5_do_lookup(const struct sock *sk, int l3index, + const union tcp_md5_addr *addr, +@@ -1059,8 +1073,7 @@ struct tcp_md5sig_key *__tcp_md5_do_lookup(const struct sock *sk, int l3index, + match = false; + } + +- if (match && (!best_match || +- key->prefixlen > best_match->prefixlen)) ++ if (match && better_md5_match(best_match, key)) + best_match = key; + } + return best_match; +@@ -1090,7 +1103,7 @@ static struct tcp_md5sig_key *tcp_md5_do_lookup_exact(const struct sock *sk, + lockdep_sock_is_held(sk)) { + if (key->family != family) + continue; +- if (key->l3index && key->l3index != l3index) ++ if (key->l3index != l3index) + continue; + if (!memcmp(&key->addr, addr, size) && + key->prefixlen == prefixlen) +-- +2.33.0 + -- 2.47.3