Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branch 'torvalds/master' into perf/core

To pick up fixes from perf/urgent.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+1447 -568
+2
.mailmap
··· 205 205 Juha Yrjola <juha.yrjola@nokia.com> 206 206 Juha Yrjola <juha.yrjola@solidboot.com> 207 207 Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com> 208 + Kalle Valo <kvalo@kernel.org> <kvalo@codeaurora.org> 208 209 Kalyan Thota <quic_kalyant@quicinc.com> <kalyan_t@codeaurora.org> 209 210 Kay Sievers <kay.sievers@vrfy.org> 210 211 Kees Cook <keescook@chromium.org> <kees.cook@canonical.com> ··· 251 250 Martin Kepplinger <martink@posteo.de> <martin.kepplinger@ginzinger.com> 252 251 Martin Kepplinger <martink@posteo.de> <martin.kepplinger@puri.sm> 253 252 Martin Kepplinger <martink@posteo.de> <martin.kepplinger@theobroma-systems.com> 253 + Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@linux.intel.com> <martyna.szapar-mudlaw@intel.com> 254 254 Mathieu Othacehe <m.othacehe@gmail.com> 255 255 Matthew Wilcox <willy@infradead.org> <matthew.r.wilcox@intel.com> 256 256 Matthew Wilcox <willy@infradead.org> <matthew@wil.cx>
+3
Documentation/arm64/silicon-errata.rst
··· 189 189 +----------------+-----------------+-----------------+-----------------------------+ 190 190 | Qualcomm Tech. | Kryo4xx Silver | N/A | ARM64_ERRATUM_1024718 | 191 191 +----------------+-----------------+-----------------+-----------------------------+ 192 + | Qualcomm Tech. | Kryo4xx Gold | N/A | ARM64_ERRATUM_1286807 | 193 + +----------------+-----------------+-----------------+-----------------------------+ 194 + 192 195 +----------------+-----------------+-----------------+-----------------------------+ 193 196 | Fujitsu | A64FX | E#010001 | FUJITSU_ERRATUM_010001 | 194 197 +----------------+-----------------+-----------------+-----------------------------+
+4 -3
Documentation/process/embargoed-hardware-issues.rst
··· 244 244 an involved disclosed party. The current ambassadors list: 245 245 246 246 ============= ======================================================== 247 - ARM Grant Likely <grant.likely@arm.com> 248 247 AMD Tom Lendacky <tom.lendacky@amd.com> 249 - IBM Z Christian Borntraeger <borntraeger@de.ibm.com> 250 - IBM Power Anton Blanchard <anton@linux.ibm.com> 248 + Ampere Darren Hart <darren@os.amperecomputing.com> 249 + ARM Catalin Marinas <catalin.marinas@arm.com> 250 + IBM Power Anton Blanchard <anton@linux.ibm.com> 251 + IBM Z Christian Borntraeger <borntraeger@de.ibm.com> 251 252 Intel Tony Luck <tony.luck@intel.com> 252 253 Qualcomm Trilok Soni <tsoni@codeaurora.org> 253 254
+6 -3
MAINTAINERS
··· 3571 3571 L: netdev@vger.kernel.org 3572 3572 S: Supported 3573 3573 W: http://sourceforge.net/projects/bonding/ 3574 + F: Documentation/networking/bonding.rst 3574 3575 F: drivers/net/bonding/ 3575 - F: include/net/bonding.h 3576 + F: include/net/bond* 3576 3577 F: include/uapi/linux/if_bonding.h 3577 3578 3578 3579 BOSCH SENSORTEC BMA400 ACCELEROMETER IIO DRIVER ··· 5440 5439 5441 5440 DATA ACCESS MONITOR 5442 5441 M: SeongJae Park <sj@kernel.org> 5442 + L: damon@lists.linux.dev 5443 5443 L: linux-mm@kvack.org 5444 5444 S: Maintained 5445 5445 F: Documentation/ABI/testing/sysfs-kernel-mm-damon ··· 10133 10131 F: drivers/net/wireless/intel/iwlegacy/ 10134 10132 10135 10133 INTEL WIRELESS WIFI LINK (iwlwifi) 10136 - M: Luca Coelho <luciano.coelho@intel.com> 10134 + M: Gregory Greenman <gregory.greenman@intel.com> 10137 10135 L: linux-wireless@vger.kernel.org 10138 10136 S: Supported 10139 10137 W: https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi ··· 15477 15475 PERFORMANCE EVENTS TOOLING ARM64 15478 15476 R: John Garry <john.garry@huawei.com> 15479 15477 R: Will Deacon <will@kernel.org> 15480 - R: Mathieu Poirier <mathieu.poirier@linaro.org> 15478 + R: James Clark <james.clark@arm.com> 15479 + R: Mike Leach <mike.leach@linaro.org> 15481 15480 R: Leo Yan <leo.yan@linaro.org> 15482 15481 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 15483 15482 S: Supported
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 18 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc6 5 + EXTRAVERSION = -rc7 6 6 NAME = Superb Owl 7 7 8 8 # *DOCUMENTATION*
+3
arch/arm/include/asm/io.h
··· 440 440 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE 441 441 extern int valid_phys_addr_range(phys_addr_t addr, size_t size); 442 442 extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); 443 + extern bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size, 444 + unsigned long flags); 445 + #define arch_memremap_can_ram_remap arch_memremap_can_ram_remap 443 446 #endif 444 447 445 448 /*
+8
arch/arm/mm/ioremap.c
··· 493 493 { 494 494 early_ioremap_setup(); 495 495 } 496 + 497 + bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size, 498 + unsigned long flags) 499 + { 500 + unsigned long pfn = PHYS_PFN(offset); 501 + 502 + return memblock_is_map_memory(pfn); 503 + }
+4
arch/arm64/include/asm/io.h
··· 192 192 extern int valid_phys_addr_range(phys_addr_t addr, size_t size); 193 193 extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); 194 194 195 + extern bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size, 196 + unsigned long flags); 197 + #define arch_memremap_can_ram_remap arch_memremap_can_ram_remap 198 + 195 199 #endif /* __ASM_IO_H */
+4
arch/arm64/kernel/Makefile
··· 75 75 obj-y += vdso-wrap.o 76 76 obj-$(CONFIG_COMPAT_VDSO) += vdso32-wrap.o 77 77 78 + # Force dependency (vdso*-wrap.S includes vdso.so through incbin) 79 + $(obj)/vdso-wrap.o: $(obj)/vdso/vdso.so 80 + $(obj)/vdso32-wrap.o: $(obj)/vdso32/vdso.so 81 + 78 82 obj-y += probes/ 79 83 head-y := head.o 80 84 extra-y += $(head-y) vmlinux.lds
+2
arch/arm64/kernel/cpu_errata.c
··· 208 208 #ifdef CONFIG_ARM64_ERRATUM_1286807 209 209 { 210 210 ERRATA_MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 0), 211 + /* Kryo4xx Gold (rcpe to rfpe) => (r0p0 to r3p0) */ 212 + ERRATA_MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xe), 211 213 }, 212 214 #endif 213 215 {},
+1 -2
arch/arm64/kernel/cpufeature.c
··· 654 654 ARM64_FTR_REG(SYS_ID_AA64ISAR0_EL1, ftr_id_aa64isar0), 655 655 ARM64_FTR_REG_OVERRIDE(SYS_ID_AA64ISAR1_EL1, ftr_id_aa64isar1, 656 656 &id_aa64isar1_override), 657 - ARM64_FTR_REG(SYS_ID_AA64ISAR2_EL1, ftr_id_aa64isar2), 658 657 ARM64_FTR_REG_OVERRIDE(SYS_ID_AA64ISAR2_EL1, ftr_id_aa64isar2, 659 658 &id_aa64isar2_override), 660 659 ··· 809 810 * to sys_id for subsequent binary search in get_arm64_ftr_reg() 810 811 * to work correctly. 811 812 */ 812 - BUG_ON(arm64_ftr_regs[i].sys_id < arm64_ftr_regs[i - 1].sys_id); 813 + BUG_ON(arm64_ftr_regs[i].sys_id <= arm64_ftr_regs[i - 1].sys_id); 813 814 } 814 815 } 815 816
-3
arch/arm64/kernel/vdso/Makefile
··· 52 52 targets += vdso.lds 53 53 CPPFLAGS_vdso.lds += -P -C -U$(ARCH) 54 54 55 - # Force dependency (incbin is bad) 56 - $(obj)/vdso.o : $(obj)/vdso.so 57 - 58 55 # Link rule for the .so file, .lds has to be first 59 56 $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE 60 57 $(call if_changed,vdsold_and_vdso_check)
-3
arch/arm64/kernel/vdso32/Makefile
··· 131 131 targets += vdso.lds 132 132 CPPFLAGS_vdso.lds += -P -C -U$(ARCH) 133 133 134 - # Force dependency (vdso.s includes vdso.so through incbin) 135 - $(obj)/vdso.o: $(obj)/vdso.so 136 - 137 134 include/generated/vdso32-offsets.h: $(obj)/vdso.so.dbg FORCE 138 135 $(call if_changed,vdsosym) 139 136
+8
arch/arm64/mm/ioremap.c
··· 99 99 { 100 100 early_ioremap_setup(); 101 101 } 102 + 103 + bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size, 104 + unsigned long flags) 105 + { 106 + unsigned long pfn = PHYS_PFN(offset); 107 + 108 + return pfn_is_map_memory(pfn); 109 + }
+21 -5
arch/powerpc/kvm/book3s_32_sr.S
··· 122 122 123 123 /* 0x0 - 0xb */ 124 124 125 - /* 'current->mm' needs to be in r4 */ 126 - tophys(r4, r2) 127 - lwz r4, MM(r4) 128 - tophys(r4, r4) 129 - /* This only clobbers r0, r3, r4 and r5 */ 125 + /* switch_mmu_context() needs paging, let's enable it */ 126 + mfmsr r9 127 + ori r11, r9, MSR_DR 128 + mtmsr r11 129 + sync 130 + 131 + /* switch_mmu_context() clobbers r12, rescue it */ 132 + SAVE_GPR(12, r1) 133 + 134 + /* Calling switch_mmu_context(<inv>, current->mm, <inv>); */ 135 + lwz r4, MM(r2) 130 136 bl switch_mmu_context 137 + 138 + /* restore r12 */ 139 + REST_GPR(12, r1) 140 + 141 + /* Disable paging again */ 142 + mfmsr r9 143 + li r6, MSR_DR 144 + andc r9, r9, r6 145 + mtmsr r9 146 + sync 131 147 132 148 .endm
+3 -2
arch/x86/mm/init_64.c
··· 902 902 903 903 static void __meminit vmemmap_use_new_sub_pmd(unsigned long start, unsigned long end) 904 904 { 905 + const unsigned long page = ALIGN_DOWN(start, PMD_SIZE); 906 + 905 907 vmemmap_flush_unused_pmd(); 906 908 907 909 /* ··· 916 914 * Mark with PAGE_UNUSED the unused parts of the new memmap range 917 915 */ 918 916 if (!IS_ALIGNED(start, PMD_SIZE)) 919 - memset((void *)start, PAGE_UNUSED, 920 - start - ALIGN_DOWN(start, PMD_SIZE)); 917 + memset((void *)page, PAGE_UNUSED, start - page); 921 918 922 919 /* 923 920 * We want to avoid memset(PAGE_UNUSED) when populating the vmemmap of
+17
drivers/base/firmware_loader/main.c
··· 735 735 size_t offset, u32 opt_flags) 736 736 { 737 737 struct firmware *fw = NULL; 738 + struct cred *kern_cred = NULL; 739 + const struct cred *old_cred; 738 740 bool nondirect = false; 739 741 int ret; 740 742 ··· 752 750 offset, opt_flags); 753 751 if (ret <= 0) /* error or already assigned */ 754 752 goto out; 753 + 754 + /* 755 + * We are about to try to access the firmware file. Because we may have been 756 + * called by a driver when serving an unrelated request from userland, we use 757 + * the kernel credentials to read the file. 758 + */ 759 + kern_cred = prepare_kernel_cred(NULL); 760 + if (!kern_cred) { 761 + ret = -ENOMEM; 762 + goto out; 763 + } 764 + old_cred = override_creds(kern_cred); 755 765 756 766 ret = fw_get_filesystem_firmware(device, fw->priv, "", NULL); 757 767 ··· 789 775 opt_flags, ret); 790 776 } else 791 777 ret = assign_fw(fw, device); 778 + 779 + revert_creds(old_cred); 780 + put_cred(kern_cred); 792 781 793 782 out: 794 783 if (ret < 0) {
+4 -4
drivers/dma-buf/dma-buf.c
··· 543 543 file->f_mode |= FMODE_LSEEK; 544 544 dmabuf->file = file; 545 545 546 - ret = dma_buf_stats_setup(dmabuf); 547 - if (ret) 548 - goto err_sysfs; 549 - 550 546 mutex_init(&dmabuf->lock); 551 547 INIT_LIST_HEAD(&dmabuf->attachments); 552 548 553 549 mutex_lock(&db_list.lock); 554 550 list_add(&dmabuf->list_node, &db_list.head); 555 551 mutex_unlock(&db_list.lock); 552 + 553 + ret = dma_buf_stats_setup(dmabuf); 554 + if (ret) 555 + goto err_sysfs; 556 556 557 557 return dmabuf; 558 558
+5
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
··· 296 296 { 297 297 struct amdgpu_device *adev = ctx->adev; 298 298 enum amd_dpm_forced_level level; 299 + u32 current_stable_pstate; 299 300 int r; 300 301 301 302 mutex_lock(&adev->pm.stable_pstate_ctx_lock); ··· 304 303 r = -EBUSY; 305 304 goto done; 306 305 } 306 + 307 + r = amdgpu_ctx_get_stable_pstate(ctx, &current_stable_pstate); 308 + if (r || (stable_pstate == current_stable_pstate)) 309 + goto done; 307 310 308 311 switch (stable_pstate) { 309 312 case AMDGPU_CTX_STABLE_PSTATE_NONE:
+16 -1
drivers/gpu/drm/amd/amdgpu/vi.c
··· 81 81 #include "mxgpu_vi.h" 82 82 #include "amdgpu_dm.h" 83 83 84 + #if IS_ENABLED(CONFIG_X86) 85 + #include <asm/intel-family.h> 86 + #endif 87 + 84 88 #define ixPCIE_LC_L1_PM_SUBSTATE 0x100100C6 85 89 #define PCIE_LC_L1_PM_SUBSTATE__LC_L1_SUBSTATES_OVERRIDE_EN_MASK 0x00000001L 86 90 #define PCIE_LC_L1_PM_SUBSTATE__LC_PCI_PM_L1_2_OVERRIDE_MASK 0x00000002L ··· 1138 1134 WREG32_PCIE(ixPCIE_LC_CNTL, data); 1139 1135 } 1140 1136 1137 + static bool aspm_support_quirk_check(void) 1138 + { 1139 + #if IS_ENABLED(CONFIG_X86) 1140 + struct cpuinfo_x86 *c = &cpu_data(0); 1141 + 1142 + return !(c->x86 == 6 && c->x86_model == INTEL_FAM6_ALDERLAKE); 1143 + #else 1144 + return true; 1145 + #endif 1146 + } 1147 + 1141 1148 static void vi_program_aspm(struct amdgpu_device *adev) 1142 1149 { 1143 1150 u32 data, data1, orig; 1144 1151 bool bL1SS = false; 1145 1152 bool bClkReqSupport = true; 1146 1153 1147 - if (!amdgpu_device_should_use_aspm(adev)) 1154 + if (!amdgpu_device_should_use_aspm(adev) || !aspm_support_quirk_check()) 1148 1155 return; 1149 1156 1150 1157 if (adev->flags & AMD_IS_APU ||
-5
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c
··· 153 153 dc->hwss.init_hw = dcn20_fpga_init_hw; 154 154 dc->hwseq->funcs.init_pipes = NULL; 155 155 } 156 - if (dc->debug.disable_z10) { 157 - /*hw not support z10 or sw disable it*/ 158 - dc->hwss.z10_restore = NULL; 159 - dc->hwss.z10_save_init = NULL; 160 - } 161 156 }
+1 -7
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 1351 1351 { 1352 1352 struct amdgpu_device *adev = smu->adev; 1353 1353 int ret = 0; 1354 - /* 1355 - * TODO: (adev->in_suspend && !adev->in_s0ix) is added to pair 1356 - * the workaround which always reset the asic in suspend. 1357 - * It's likely that workaround will be dropped in the future. 1358 - * Then the change here should be dropped together. 1359 - */ 1360 1354 bool use_baco = !smu->is_apu && 1361 - (((amdgpu_in_reset(adev) || (adev->in_suspend && !adev->in_s0ix)) && 1355 + ((amdgpu_in_reset(adev) && 1362 1356 (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) || 1363 1357 ((adev->in_runpm || adev->in_s4) && amdgpu_asic_supports_baco(adev))); 1364 1358
+7 -4
drivers/gpu/drm/i915/i915_vma.c
··· 1605 1605 1606 1606 static void __i915_vma_remove_closed(struct i915_vma *vma) 1607 1607 { 1608 - struct intel_gt *gt = vma->vm->gt; 1609 - 1610 - spin_lock_irq(&gt->closed_lock); 1611 1608 list_del_init(&vma->closed_link); 1612 - spin_unlock_irq(&gt->closed_lock); 1613 1609 } 1614 1610 1615 1611 void i915_vma_reopen(struct i915_vma *vma) 1616 1612 { 1613 + struct intel_gt *gt = vma->vm->gt; 1614 + 1615 + spin_lock_irq(&gt->closed_lock); 1617 1616 if (i915_vma_is_closed(vma)) 1618 1617 __i915_vma_remove_closed(vma); 1618 + spin_unlock_irq(&gt->closed_lock); 1619 1619 } 1620 1620 1621 1621 void i915_vma_release(struct kref *ref) ··· 1641 1641 static void release_references(struct i915_vma *vma) 1642 1642 { 1643 1643 struct drm_i915_gem_object *obj = vma->obj; 1644 + struct intel_gt *gt = vma->vm->gt; 1644 1645 1645 1646 GEM_BUG_ON(i915_vma_is_active(vma)); 1646 1647 ··· 1651 1650 rb_erase(&vma->obj_node, &obj->vma.tree); 1652 1651 spin_unlock(&obj->vma.lock); 1653 1652 1653 + spin_lock_irq(&gt->closed_lock); 1654 1654 __i915_vma_remove_closed(vma); 1655 + spin_unlock_irq(&gt->closed_lock); 1655 1656 1656 1657 __i915_vma_put(vma); 1657 1658 }
+5 -4
drivers/gpu/drm/nouveau/nouveau_backlight.c
··· 46 46 nouveau_get_backlight_name(char backlight_name[BL_NAME_SIZE], 47 47 struct nouveau_backlight *bl) 48 48 { 49 - const int nb = ida_simple_get(&bl_ida, 0, 0, GFP_KERNEL); 50 - if (nb < 0 || nb >= 100) 49 + const int nb = ida_alloc_max(&bl_ida, 99, GFP_KERNEL); 50 + 51 + if (nb < 0) 51 52 return false; 52 53 if (nb > 0) 53 54 snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb); ··· 415 414 nv_encoder, ops, &props); 416 415 if (IS_ERR(bl->dev)) { 417 416 if (bl->id >= 0) 418 - ida_simple_remove(&bl_ida, bl->id); 417 + ida_free(&bl_ida, bl->id); 419 418 ret = PTR_ERR(bl->dev); 420 419 goto fail_alloc; 421 420 } ··· 443 442 return; 444 443 445 444 if (bl->id >= 0) 446 - ida_simple_remove(&bl_ida, bl->id); 445 + ida_free(&bl_ida, bl->id); 447 446 448 447 backlight_device_unregister(bl->dev); 449 448 nv_conn->backlight = NULL;
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
··· 123 123 124 124 mutex_init(&tdev->iommu.mutex); 125 125 126 - if (iommu_present(&platform_bus_type)) { 126 + if (device_iommu_mapped(dev)) { 127 127 tdev->iommu.domain = iommu_domain_alloc(&platform_bus_type); 128 128 if (!tdev->iommu.domain) 129 129 goto error;
+1
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 38 38 #include <drm/drm_scdc_helper.h> 39 39 #include <linux/clk.h> 40 40 #include <linux/component.h> 41 + #include <linux/gpio/consumer.h> 41 42 #include <linux/i2c.h> 42 43 #include <linux/of_address.h> 43 44 #include <linux/of_gpio.h>
+8 -5
drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
··· 528 528 *seqno = atomic_add_return(1, &dev_priv->marker_seq); 529 529 } while (*seqno == 0); 530 530 531 - if (!(vmw_fifo_caps(dev_priv) & SVGA_FIFO_CAP_FENCE)) { 531 + if (!vmw_has_fences(dev_priv)) { 532 532 533 533 /* 534 534 * Don't request hardware to send a fence. The ··· 675 675 */ 676 676 bool vmw_cmd_supported(struct vmw_private *vmw) 677 677 { 678 - if ((vmw->capabilities & (SVGA_CAP_COMMAND_BUFFERS | 679 - SVGA_CAP_CMD_BUFFERS_2)) != 0) 680 - return true; 678 + bool has_cmdbufs = 679 + (vmw->capabilities & (SVGA_CAP_COMMAND_BUFFERS | 680 + SVGA_CAP_CMD_BUFFERS_2)) != 0; 681 + if (vmw_is_svga_v3(vmw)) 682 + return (has_cmdbufs && 683 + (vmw->capabilities & SVGA_CAP_GBOBJECTS) != 0); 681 684 /* 682 685 * We have FIFO cmd's 683 686 */ 684 - return vmw->fifo_mem != NULL; 687 + return has_cmdbufs || vmw->fifo_mem != NULL; 685 688 }
+8
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
··· 1679 1679 outl(status, vmw->io_start + SVGA_IRQSTATUS_PORT); 1680 1680 } 1681 1681 1682 + static inline bool vmw_has_fences(struct vmw_private *vmw) 1683 + { 1684 + if ((vmw->capabilities & (SVGA_CAP_COMMAND_BUFFERS | 1685 + SVGA_CAP_CMD_BUFFERS_2)) != 0) 1686 + return true; 1687 + return (vmw_fifo_caps(vmw) & SVGA_FIFO_CAP_FENCE) != 0; 1688 + } 1689 + 1682 1690 #endif
+1 -1
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
··· 483 483 484 484 static int vmw_fb_kms_framebuffer(struct fb_info *info) 485 485 { 486 - struct drm_mode_fb_cmd2 mode_cmd; 486 + struct drm_mode_fb_cmd2 mode_cmd = {0}; 487 487 struct vmw_fb_par *par = info->par; 488 488 struct fb_var_screeninfo *var = &info->var; 489 489 struct drm_framebuffer *cur_fb;
+21 -7
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
··· 82 82 return container_of(fence->base.lock, struct vmw_fence_manager, lock); 83 83 } 84 84 85 + static u32 vmw_fence_goal_read(struct vmw_private *vmw) 86 + { 87 + if ((vmw->capabilities2 & SVGA_CAP2_EXTRA_REGS) != 0) 88 + return vmw_read(vmw, SVGA_REG_FENCE_GOAL); 89 + else 90 + return vmw_fifo_mem_read(vmw, SVGA_FIFO_FENCE_GOAL); 91 + } 92 + 93 + static void vmw_fence_goal_write(struct vmw_private *vmw, u32 value) 94 + { 95 + if ((vmw->capabilities2 & SVGA_CAP2_EXTRA_REGS) != 0) 96 + vmw_write(vmw, SVGA_REG_FENCE_GOAL, value); 97 + else 98 + vmw_fifo_mem_write(vmw, SVGA_FIFO_FENCE_GOAL, value); 99 + } 100 + 85 101 /* 86 102 * Note on fencing subsystem usage of irqs: 87 103 * Typically the vmw_fences_update function is called ··· 408 392 if (likely(!fman->seqno_valid)) 409 393 return false; 410 394 411 - goal_seqno = vmw_fifo_mem_read(fman->dev_priv, SVGA_FIFO_FENCE_GOAL); 395 + goal_seqno = vmw_fence_goal_read(fman->dev_priv); 412 396 if (likely(passed_seqno - goal_seqno >= VMW_FENCE_WRAP)) 413 397 return false; 414 398 ··· 416 400 list_for_each_entry(fence, &fman->fence_list, head) { 417 401 if (!list_empty(&fence->seq_passed_actions)) { 418 402 fman->seqno_valid = true; 419 - vmw_fifo_mem_write(fman->dev_priv, 420 - SVGA_FIFO_FENCE_GOAL, 421 - fence->base.seqno); 403 + vmw_fence_goal_write(fman->dev_priv, 404 + fence->base.seqno); 422 405 break; 423 406 } 424 407 } ··· 449 434 if (dma_fence_is_signaled_locked(&fence->base)) 450 435 return false; 451 436 452 - goal_seqno = vmw_fifo_mem_read(fman->dev_priv, SVGA_FIFO_FENCE_GOAL); 437 + goal_seqno = vmw_fence_goal_read(fman->dev_priv); 453 438 if (likely(fman->seqno_valid && 454 439 goal_seqno - fence->base.seqno < VMW_FENCE_WRAP)) 455 440 return false; 456 441 457 - vmw_fifo_mem_write(fman->dev_priv, SVGA_FIFO_FENCE_GOAL, 458 - fence->base.seqno); 442 + vmw_fence_goal_write(fman->dev_priv, fence->base.seqno); 459 443 fman->seqno_valid = true; 460 444 461 445 return true;
+18 -8
drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
··· 32 32 33 33 #define VMW_FENCE_WRAP (1 << 24) 34 34 35 + static u32 vmw_irqflag_fence_goal(struct vmw_private *vmw) 36 + { 37 + if ((vmw->capabilities2 & SVGA_CAP2_EXTRA_REGS) != 0) 38 + return SVGA_IRQFLAG_REG_FENCE_GOAL; 39 + else 40 + return SVGA_IRQFLAG_FENCE_GOAL; 41 + } 42 + 35 43 /** 36 44 * vmw_thread_fn - Deferred (process context) irq handler 37 45 * ··· 104 96 wake_up_all(&dev_priv->fifo_queue); 105 97 106 98 if ((masked_status & (SVGA_IRQFLAG_ANY_FENCE | 107 - SVGA_IRQFLAG_FENCE_GOAL)) && 99 + vmw_irqflag_fence_goal(dev_priv))) && 108 100 !test_and_set_bit(VMW_IRQTHREAD_FENCE, dev_priv->irqthread_pending)) 109 101 ret = IRQ_WAKE_THREAD; 110 102 ··· 145 137 if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP)) 146 138 return true; 147 139 148 - if (!(vmw_fifo_caps(dev_priv) & SVGA_FIFO_CAP_FENCE) && 149 - vmw_fifo_idle(dev_priv, seqno)) 140 + if (!vmw_has_fences(dev_priv) && vmw_fifo_idle(dev_priv, seqno)) 150 141 return true; 151 142 152 143 /** ··· 167 160 unsigned long timeout) 168 161 { 169 162 struct vmw_fifo_state *fifo_state = dev_priv->fifo; 163 + bool fifo_down = false; 170 164 171 165 uint32_t count = 0; 172 166 uint32_t signal_seq; ··· 184 176 */ 185 177 186 178 if (fifo_idle) { 187 - down_read(&fifo_state->rwsem); 188 179 if (dev_priv->cman) { 189 180 ret = vmw_cmdbuf_idle(dev_priv->cman, interruptible, 190 181 10*HZ); 191 182 if (ret) 192 183 goto out_err; 184 + } else if (fifo_state) { 185 + down_read(&fifo_state->rwsem); 186 + fifo_down = true; 193 187 } 194 188 } 195 189 ··· 228 218 } 229 219 } 230 220 finish_wait(&dev_priv->fence_queue, &__wait); 231 - if (ret == 0 && fifo_idle) 221 + if (ret == 0 && fifo_idle && fifo_state) 232 222 vmw_fence_write(dev_priv, signal_seq); 233 223 234 224 wake_up_all(&dev_priv->fence_queue); 235 225 out_err: 236 - if (fifo_idle) 226 + if (fifo_down) 237 227 up_read(&fifo_state->rwsem); 238 228 239 229 return ret; ··· 276 266 277 267 void vmw_goal_waiter_add(struct vmw_private *dev_priv) 278 268 { 279 - vmw_generic_waiter_add(dev_priv, SVGA_IRQFLAG_FENCE_GOAL, 269 + vmw_generic_waiter_add(dev_priv, vmw_irqflag_fence_goal(dev_priv), 280 270 &dev_priv->goal_queue_waiters); 281 271 } 282 272 283 273 void vmw_goal_waiter_remove(struct vmw_private *dev_priv) 284 274 { 285 - vmw_generic_waiter_remove(dev_priv, SVGA_IRQFLAG_FENCE_GOAL, 275 + vmw_generic_waiter_remove(dev_priv, vmw_irqflag_fence_goal(dev_priv), 286 276 &dev_priv->goal_queue_waiters); 287 277 } 288 278
+5 -3
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
··· 1344 1344 ret = vmw_kms_new_framebuffer_surface(dev_priv, surface, &vfb, 1345 1345 mode_cmd, 1346 1346 is_bo_proxy); 1347 - 1348 1347 /* 1349 1348 * vmw_create_bo_proxy() adds a reference that is no longer 1350 1349 * needed ··· 1384 1385 ret = vmw_user_lookup_handle(dev_priv, file_priv, 1385 1386 mode_cmd->handles[0], 1386 1387 &surface, &bo); 1387 - if (ret) 1388 + if (ret) { 1389 + DRM_ERROR("Invalid buffer object handle %u (0x%x).\n", 1390 + mode_cmd->handles[0], mode_cmd->handles[0]); 1388 1391 goto err_out; 1392 + } 1389 1393 1390 1394 1391 1395 if (!bo && 1392 1396 !vmw_kms_srf_ok(dev_priv, mode_cmd->width, mode_cmd->height)) { 1393 - DRM_ERROR("Surface size cannot exceed %dx%d", 1397 + DRM_ERROR("Surface size cannot exceed %dx%d\n", 1394 1398 dev_priv->texture_max_width, 1395 1399 dev_priv->texture_max_height); 1396 1400 goto err_out;
+1 -1
drivers/hwmon/Kconfig
··· 960 960 961 961 config SENSORS_LTQ_CPUTEMP 962 962 bool "Lantiq cpu temperature sensor driver" 963 - depends on LANTIQ 963 + depends on SOC_XWAY 964 964 help 965 965 If you say yes here you get support for the temperature 966 966 sensor inside your CPU.
+11
drivers/hwmon/tmp401.c
··· 708 708 return 0; 709 709 } 710 710 711 + static const struct of_device_id __maybe_unused tmp4xx_of_match[] = { 712 + { .compatible = "ti,tmp401", }, 713 + { .compatible = "ti,tmp411", }, 714 + { .compatible = "ti,tmp431", }, 715 + { .compatible = "ti,tmp432", }, 716 + { .compatible = "ti,tmp435", }, 717 + { }, 718 + }; 719 + MODULE_DEVICE_TABLE(of, tmp4xx_of_match); 720 + 711 721 static struct i2c_driver tmp401_driver = { 712 722 .class = I2C_CLASS_HWMON, 713 723 .driver = { 714 724 .name = "tmp401", 725 + .of_match_table = of_match_ptr(tmp4xx_of_match), 715 726 }, 716 727 .probe_new = tmp401_probe, 717 728 .id_table = tmp401_id,
+7 -1
drivers/interconnect/core.c
··· 1087 1087 { 1088 1088 struct device_node *child; 1089 1089 int count = 0; 1090 + const struct of_device_id __maybe_unused ignore_list[] = { 1091 + { .compatible = "qcom,sc7180-ipa-virt" }, 1092 + { .compatible = "qcom,sdx55-ipa-virt" }, 1093 + {} 1094 + }; 1090 1095 1091 1096 for_each_available_child_of_node(np, child) { 1092 - if (of_property_read_bool(child, "#interconnect-cells")) 1097 + if (of_property_read_bool(child, "#interconnect-cells") && 1098 + likely(!of_match_node(ignore_list, child))) 1093 1099 count++; 1094 1100 count += of_count_icc_providers(child); 1095 1101 }
+3
drivers/net/dsa/bcm_sf2.c
··· 809 809 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); 810 810 u32 reg, offset; 811 811 812 + if (priv->wol_ports_mask & BIT(port)) 813 + return; 814 + 812 815 if (port != core_readl(priv, CORE_IMP0_PRT_ID)) { 813 816 if (priv->type == BCM4908_DEVICE_ID || 814 817 priv->type == BCM7445_DEVICE_ID)
+6 -1
drivers/net/dsa/ocelot/felix.c
··· 403 403 { 404 404 struct ocelot *ocelot = ds->priv; 405 405 struct felix *felix = ocelot_to_felix(ocelot); 406 + struct ocelot_vcap_block *block_vcap_is2; 406 407 struct ocelot_vcap_filter *trap; 407 408 enum ocelot_mask_mode mask_mode; 408 409 unsigned long port_mask; ··· 423 422 /* We are sure that "cpu" was found, otherwise 424 423 * dsa_tree_setup_default_cpu() would have failed earlier. 425 424 */ 425 + block_vcap_is2 = &ocelot->block[VCAP_IS2]; 426 426 427 427 /* Make sure all traps are set up for that destination */ 428 - list_for_each_entry(trap, &ocelot->traps, trap_list) { 428 + list_for_each_entry(trap, &block_vcap_is2->rules, list) { 429 + if (!trap->is_trap) 430 + continue; 431 + 429 432 /* Figure out the current trapping destination */ 430 433 if (using_tag_8021q) { 431 434 /* Redirect to the tag_8021q CPU port. If timestamps
+2 -2
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
··· 449 449 450 450 static int aq_pm_suspend_poweroff(struct device *dev) 451 451 { 452 - return aq_suspend_common(dev, false); 452 + return aq_suspend_common(dev, true); 453 453 } 454 454 455 455 static int aq_pm_thaw(struct device *dev) ··· 459 459 460 460 static int aq_pm_resume_restore(struct device *dev) 461 461 { 462 - return atl_resume_common(dev, false); 462 + return atl_resume_common(dev, true); 463 463 } 464 464 465 465 static const struct dev_pm_ops aq_pm_ops = {
+11 -9
drivers/net/ethernet/aquantia/atlantic/aq_ring.c
··· 346 346 int budget) 347 347 { 348 348 struct net_device *ndev = aq_nic_get_ndev(self->aq_nic); 349 - bool is_rsc_completed = true; 350 349 int err = 0; 351 350 352 351 for (; (self->sw_head != self->hw_head) && budget; ··· 363 364 continue; 364 365 365 366 if (!buff->is_eop) { 367 + unsigned int frag_cnt = 0U; 366 368 buff_ = buff; 367 369 do { 370 + bool is_rsc_completed = true; 371 + 368 372 if (buff_->next >= self->size) { 369 373 err = -EIO; 370 374 goto err_exit; 371 375 } 376 + 377 + frag_cnt++; 372 378 next_ = buff_->next, 373 379 buff_ = &self->buff_ring[next_]; 374 380 is_rsc_completed = ··· 381 377 next_, 382 378 self->hw_head); 383 379 384 - if (unlikely(!is_rsc_completed)) 385 - break; 380 + if (unlikely(!is_rsc_completed) || 381 + frag_cnt > MAX_SKB_FRAGS) { 382 + err = 0; 383 + goto err_exit; 384 + } 386 385 387 386 buff->is_error |= buff_->is_error; 388 387 buff->is_cso_err |= buff_->is_cso_err; 389 388 390 389 } while (!buff_->is_eop); 391 390 392 - if (!is_rsc_completed) { 393 - err = 0; 394 - goto err_exit; 395 - } 396 391 if (buff->is_error || 397 392 (buff->is_lro && buff->is_cso_err)) { 398 393 buff_ = buff; ··· 449 446 ALIGN(hdr_len, sizeof(long))); 450 447 451 448 if (buff->len - hdr_len > 0) { 452 - skb_add_rx_frag(skb, 0, buff->rxdata.page, 449 + skb_add_rx_frag(skb, i++, buff->rxdata.page, 453 450 buff->rxdata.pg_off + hdr_len, 454 451 buff->len - hdr_len, 455 452 AQ_CFG_RX_FRAME_MAX); ··· 458 455 459 456 if (!buff->is_eop) { 460 457 buff_ = buff; 461 - i = 1U; 462 458 do { 463 459 next_ = buff_->next; 464 460 buff_ = &self->buff_ring[next_];
+7
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
··· 889 889 err = -ENXIO; 890 890 goto err_exit; 891 891 } 892 + 893 + /* Validate that the new hw_head_ is reasonable. */ 894 + if (hw_head_ >= ring->size) { 895 + err = -ENXIO; 896 + goto err_exit; 897 + } 898 + 892 899 ring->hw_head = hw_head_; 893 900 err = aq_hw_err_from_flags(self); 894 901
+4
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 3999 3999 goto err; 4000 4000 } 4001 4001 priv->wol_irq = platform_get_irq_optional(pdev, 2); 4002 + if (priv->wol_irq == -EPROBE_DEFER) { 4003 + err = priv->wol_irq; 4004 + goto err; 4005 + } 4002 4006 4003 4007 priv->base = devm_platform_ioremap_resource(pdev, 0); 4004 4008 if (IS_ERR(priv->base)) {
+5 -5
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
··· 2793 2793 goto out; 2794 2794 na = ret; 2795 2795 2796 - memcpy(p->id, vpd + id, min_t(int, id_len, ID_LEN)); 2796 + memcpy(p->id, vpd + id, min_t(unsigned int, id_len, ID_LEN)); 2797 2797 strim(p->id); 2798 - memcpy(p->sn, vpd + sn, min_t(int, sn_len, SERNUM_LEN)); 2798 + memcpy(p->sn, vpd + sn, min_t(unsigned int, sn_len, SERNUM_LEN)); 2799 2799 strim(p->sn); 2800 - memcpy(p->pn, vpd + pn, min_t(int, pn_len, PN_LEN)); 2800 + memcpy(p->pn, vpd + pn, min_t(unsigned int, pn_len, PN_LEN)); 2801 2801 strim(p->pn); 2802 - memcpy(p->na, vpd + na, min_t(int, na_len, MACADDR_LEN)); 2803 - strim((char *)p->na); 2802 + memcpy(p->na, vpd + na, min_t(unsigned int, na_len, MACADDR_LEN)); 2803 + strim(p->na); 2804 2804 2805 2805 out: 2806 2806 vfree(vpd);
+4 -1
drivers/net/ethernet/dec/tulip/tulip_core.c
··· 1399 1399 1400 1400 /* alloc_etherdev ensures aligned and zeroed private structures */ 1401 1401 dev = alloc_etherdev (sizeof (*tp)); 1402 - if (!dev) 1402 + if (!dev) { 1403 + pci_disable_device(pdev); 1403 1404 return -ENOMEM; 1405 + } 1404 1406 1405 1407 SET_NETDEV_DEV(dev, &pdev->dev); 1406 1408 if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) { ··· 1787 1785 1788 1786 err_out_free_netdev: 1789 1787 free_netdev (dev); 1788 + pci_disable_device(pdev); 1790 1789 return -ENODEV; 1791 1790 } 1792 1791
+14 -13
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 7549 7549 static int i40e_fwd_ring_up(struct i40e_vsi *vsi, struct net_device *vdev, 7550 7550 struct i40e_fwd_adapter *fwd) 7551 7551 { 7552 + struct i40e_channel *ch = NULL, *ch_tmp, *iter; 7552 7553 int ret = 0, num_tc = 1, i, aq_err; 7553 - struct i40e_channel *ch, *ch_tmp; 7554 7554 struct i40e_pf *pf = vsi->back; 7555 7555 struct i40e_hw *hw = &pf->hw; 7556 7556 7557 - if (list_empty(&vsi->macvlan_list)) 7558 - return -EINVAL; 7559 - 7560 7557 /* Go through the list and find an available channel */ 7561 - list_for_each_entry_safe(ch, ch_tmp, &vsi->macvlan_list, list) { 7562 - if (!i40e_is_channel_macvlan(ch)) { 7563 - ch->fwd = fwd; 7558 + list_for_each_entry_safe(iter, ch_tmp, &vsi->macvlan_list, list) { 7559 + if (!i40e_is_channel_macvlan(iter)) { 7560 + iter->fwd = fwd; 7564 7561 /* record configuration for macvlan interface in vdev */ 7565 7562 for (i = 0; i < num_tc; i++) 7566 7563 netdev_bind_sb_channel_queue(vsi->netdev, vdev, 7567 7564 i, 7568 - ch->num_queue_pairs, 7569 - ch->base_queue); 7570 - for (i = 0; i < ch->num_queue_pairs; i++) { 7565 + iter->num_queue_pairs, 7566 + iter->base_queue); 7567 + for (i = 0; i < iter->num_queue_pairs; i++) { 7571 7568 struct i40e_ring *tx_ring, *rx_ring; 7572 7569 u16 pf_q; 7573 7570 7574 - pf_q = ch->base_queue + i; 7571 + pf_q = iter->base_queue + i; 7575 7572 7576 7573 /* Get to TX ring ptr */ 7577 7574 tx_ring = vsi->tx_rings[pf_q]; 7578 - tx_ring->ch = ch; 7575 + tx_ring->ch = iter; 7579 7576 7580 7577 /* Get the RX ring ptr */ 7581 7578 rx_ring = vsi->rx_rings[pf_q]; 7582 - rx_ring->ch = ch; 7579 + rx_ring->ch = iter; 7583 7580 } 7581 + ch = iter; 7584 7582 break; 7585 7583 } 7586 7584 } 7585 + 7586 + if (!ch) 7587 + return -EINVAL; 7587 7588 7588 7589 /* Guarantee all rings are updated before we update the 7589 7590 * MAC address filter.
+1
drivers/net/ethernet/intel/ice/ice.h
··· 540 540 struct mutex avail_q_mutex; /* protects access to avail_[rx|tx]qs */ 541 541 struct mutex sw_mutex; /* lock for protecting VSI alloc flow */ 542 542 struct mutex tc_mutex; /* lock to protect TC changes */ 543 + struct mutex adev_mutex; /* lock to protect aux device access */ 543 544 u32 msg_enable; 544 545 struct ice_ptp ptp; 545 546 struct tty_driver *ice_gnss_tty_driver;
+17 -8
drivers/net/ethernet/intel/ice/ice_idc.c
··· 37 37 if (WARN_ON_ONCE(!in_task())) 38 38 return; 39 39 40 + mutex_lock(&pf->adev_mutex); 40 41 if (!pf->adev) 41 - return; 42 + goto finish; 42 43 43 44 device_lock(&pf->adev->dev); 44 45 iadrv = ice_get_auxiliary_drv(pf); 45 46 if (iadrv && iadrv->event_handler) 46 47 iadrv->event_handler(pf, event); 47 48 device_unlock(&pf->adev->dev); 49 + finish: 50 + mutex_unlock(&pf->adev_mutex); 48 51 } 49 52 50 53 /** ··· 293 290 return -ENOMEM; 294 291 295 292 adev = &iadev->adev; 296 - pf->adev = adev; 297 293 iadev->pf = pf; 298 294 299 295 adev->id = pf->aux_idx; ··· 302 300 303 301 ret = auxiliary_device_init(adev); 304 302 if (ret) { 305 - pf->adev = NULL; 306 303 kfree(iadev); 307 304 return ret; 308 305 } 309 306 310 307 ret = auxiliary_device_add(adev); 311 308 if (ret) { 312 - pf->adev = NULL; 313 309 auxiliary_device_uninit(adev); 314 310 return ret; 315 311 } 312 + 313 + mutex_lock(&pf->adev_mutex); 314 + pf->adev = adev; 315 + mutex_unlock(&pf->adev_mutex); 316 316 317 317 return 0; 318 318 } ··· 324 320 */ 325 321 void ice_unplug_aux_dev(struct ice_pf *pf) 326 322 { 327 - if (!pf->adev) 328 - return; 323 + struct auxiliary_device *adev; 329 324 330 - auxiliary_device_delete(pf->adev); 331 - auxiliary_device_uninit(pf->adev); 325 + mutex_lock(&pf->adev_mutex); 326 + adev = pf->adev; 332 327 pf->adev = NULL; 328 + mutex_unlock(&pf->adev_mutex); 329 + 330 + if (adev) { 331 + auxiliary_device_delete(adev); 332 + auxiliary_device_uninit(adev); 333 + } 333 334 } 334 335 335 336 /**
+2
drivers/net/ethernet/intel/ice/ice_main.c
··· 3769 3769 static void ice_deinit_pf(struct ice_pf *pf) 3770 3770 { 3771 3771 ice_service_task_stop(pf); 3772 + mutex_destroy(&pf->adev_mutex); 3772 3773 mutex_destroy(&pf->sw_mutex); 3773 3774 mutex_destroy(&pf->tc_mutex); 3774 3775 mutex_destroy(&pf->avail_q_mutex); ··· 3848 3847 3849 3848 mutex_init(&pf->sw_mutex); 3850 3849 mutex_init(&pf->tc_mutex); 3850 + mutex_init(&pf->adev_mutex); 3851 3851 3852 3852 INIT_HLIST_HEAD(&pf->aq_wait_list); 3853 3853 spin_lock_init(&pf->aq_wait_lock);
+8 -2
drivers/net/ethernet/intel/ice/ice_ptp.c
··· 2287 2287 2288 2288 /** 2289 2289 * ice_ptp_tx_tstamp_cleanup - Cleanup old timestamp requests that got dropped 2290 + * @hw: pointer to the hw struct 2290 2291 * @tx: PTP Tx tracker to clean up 2291 2292 * 2292 2293 * Loop through the Tx timestamp requests and see if any of them have been ··· 2296 2295 * timestamp will never be captured. This might happen if the packet gets 2297 2296 * discarded before it reaches the PHY timestamping block. 2298 2297 */ 2299 - static void ice_ptp_tx_tstamp_cleanup(struct ice_ptp_tx *tx) 2298 + static void ice_ptp_tx_tstamp_cleanup(struct ice_hw *hw, struct ice_ptp_tx *tx) 2300 2299 { 2301 2300 u8 idx; 2302 2301 ··· 2305 2304 2306 2305 for_each_set_bit(idx, tx->in_use, tx->len) { 2307 2306 struct sk_buff *skb; 2307 + u64 raw_tstamp; 2308 2308 2309 2309 /* Check if this SKB has been waiting for too long */ 2310 2310 if (time_is_after_jiffies(tx->tstamps[idx].start + 2 * HZ)) 2311 2311 continue; 2312 + 2313 + /* Read tstamp to be able to use this register again */ 2314 + ice_read_phy_tstamp(hw, tx->quad, idx + tx->quad_offset, 2315 + &raw_tstamp); 2312 2316 2313 2317 spin_lock(&tx->lock); 2314 2318 skb = tx->tstamps[idx].skb; ··· 2336 2330 2337 2331 ice_ptp_update_cached_phctime(pf); 2338 2332 2339 - ice_ptp_tx_tstamp_cleanup(&pf->ptp.port.tx); 2333 + ice_ptp_tx_tstamp_cleanup(&pf->hw, &pf->ptp.port.tx); 2340 2334 2341 2335 /* Run twice a second */ 2342 2336 kthread_queue_delayed_work(ptp->kworker, &ptp->work,
+50 -18
drivers/net/ethernet/intel/ice/ice_virtchnl.c
··· 1308 1308 } 1309 1309 1310 1310 /** 1311 + * ice_vf_vsi_dis_single_txq - disable a single Tx queue 1312 + * @vf: VF to disable queue for 1313 + * @vsi: VSI for the VF 1314 + * @q_id: VF relative (0-based) queue ID 1315 + * 1316 + * Attempt to disable the Tx queue passed in. If the Tx queue was successfully 1317 + * disabled then clear q_id bit in the enabled queues bitmap and return 1318 + * success. Otherwise return error. 1319 + */ 1320 + static int 1321 + ice_vf_vsi_dis_single_txq(struct ice_vf *vf, struct ice_vsi *vsi, u16 q_id) 1322 + { 1323 + struct ice_txq_meta txq_meta = { 0 }; 1324 + struct ice_tx_ring *ring; 1325 + int err; 1326 + 1327 + if (!test_bit(q_id, vf->txq_ena)) 1328 + dev_dbg(ice_pf_to_dev(vsi->back), "Queue %u on VSI %u is not enabled, but stopping it anyway\n", 1329 + q_id, vsi->vsi_num); 1330 + 1331 + ring = vsi->tx_rings[q_id]; 1332 + if (!ring) 1333 + return -EINVAL; 1334 + 1335 + ice_fill_txq_meta(vsi, ring, &txq_meta); 1336 + 1337 + err = ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, vf->vf_id, ring, &txq_meta); 1338 + if (err) { 1339 + dev_err(ice_pf_to_dev(vsi->back), "Failed to stop Tx ring %d on VSI %d\n", 1340 + q_id, vsi->vsi_num); 1341 + return err; 1342 + } 1343 + 1344 + /* Clear enabled queues flag */ 1345 + clear_bit(q_id, vf->txq_ena); 1346 + 1347 + return 0; 1348 + } 1349 + 1350 + /** 1311 1351 * ice_vc_dis_qs_msg 1312 1352 * @vf: pointer to the VF info 1313 1353 * @msg: pointer to the msg buffer 1314 1354 * 1315 - * called from the VF to disable all or specific 1316 - * queue(s) 1355 + * called from the VF to disable all or specific queue(s) 1317 1356 */ 1318 1357 static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) 1319 1358 { ··· 1389 1350 q_map = vqs->tx_queues; 1390 1351 1391 1352 for_each_set_bit(vf_q_id, &q_map, ICE_MAX_RSS_QS_PER_VF) { 1392 - struct ice_tx_ring *ring = vsi->tx_rings[vf_q_id]; 1393 - struct ice_txq_meta txq_meta = { 0 }; 1394 - 1395 1353 if (!ice_vc_isvalid_q_id(vf, vqs->vsi_id, vf_q_id)) { 1396 1354 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1397 1355 goto error_param; 1398 1356 } 1399 1357 1400 - if (!test_bit(vf_q_id, vf->txq_ena)) 1401 - dev_dbg(ice_pf_to_dev(vsi->back), "Queue %u on VSI %u is not enabled, but stopping it anyway\n", 1402 - vf_q_id, vsi->vsi_num); 1403 - 1404 - ice_fill_txq_meta(vsi, ring, &txq_meta); 1405 - 1406 - if (ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, vf->vf_id, 1407 - ring, &txq_meta)) { 1408 - dev_err(ice_pf_to_dev(vsi->back), "Failed to stop Tx ring %d on VSI %d\n", 1409 - vf_q_id, vsi->vsi_num); 1358 + if (ice_vf_vsi_dis_single_txq(vf, vsi, vf_q_id)) { 1410 1359 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1411 1360 goto error_param; 1412 1361 } 1413 - 1414 - /* Clear enabled queues flag */ 1415 - clear_bit(vf_q_id, vf->txq_ena); 1416 1362 } 1417 1363 } 1418 1364 ··· 1646 1622 if (qpi->txq.ring_len > 0) { 1647 1623 vsi->tx_rings[i]->dma = qpi->txq.dma_ring_addr; 1648 1624 vsi->tx_rings[i]->count = qpi->txq.ring_len; 1625 + 1626 + /* Disable any existing queue first */ 1627 + if (ice_vf_vsi_dis_single_txq(vf, vsi, q_idx)) { 1628 + v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1629 + goto error_param; 1630 + } 1631 + 1632 + /* Configure a queue with the requested settings */ 1649 1633 if (ice_vsi_cfg_single_txq(vsi, vsi->tx_rings, q_idx)) { 1650 1634 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1651 1635 goto error_param;
+1 -1
drivers/net/ethernet/mediatek/mtk_ppe.c
··· 395 395 static const u8 skip[] = { 12, 25, 38, 51, 76, 89, 102 }; 396 396 int i, k; 397 397 398 - memset(ppe->foe_table, 0, MTK_PPE_ENTRIES * sizeof(ppe->foe_table)); 398 + memset(ppe->foe_table, 0, MTK_PPE_ENTRIES * sizeof(*ppe->foe_table)); 399 399 400 400 if (!IS_ENABLED(CONFIG_SOC_MT7621)) 401 401 return;
+3 -8
drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
··· 568 568 mlxsw_sp2_ipip_rem_addr_set_gre6(struct mlxsw_sp *mlxsw_sp, 569 569 struct mlxsw_sp_ipip_entry *ipip_entry) 570 570 { 571 - struct __ip6_tnl_parm parms6; 572 - 573 - parms6 = mlxsw_sp_ipip_netdev_parms6(ipip_entry->ol_dev); 574 - return mlxsw_sp_ipv6_addr_kvdl_index_get(mlxsw_sp, &parms6.raddr, 571 + return mlxsw_sp_ipv6_addr_kvdl_index_get(mlxsw_sp, 572 + &ipip_entry->parms.daddr.addr6, 575 573 &ipip_entry->dip_kvdl_index); 576 574 } 577 575 ··· 577 579 mlxsw_sp2_ipip_rem_addr_unset_gre6(struct mlxsw_sp *mlxsw_sp, 578 580 const struct mlxsw_sp_ipip_entry *ipip_entry) 579 581 { 580 - struct __ip6_tnl_parm parms6; 581 - 582 - parms6 = mlxsw_sp_ipip_netdev_parms6(ipip_entry->ol_dev); 583 - mlxsw_sp_ipv6_addr_put(mlxsw_sp, &parms6.raddr); 582 + mlxsw_sp_ipv6_addr_put(mlxsw_sp, &ipip_entry->parms.daddr.addr6); 584 583 } 585 584 586 585 static const struct mlxsw_sp_ipip_ops mlxsw_sp2_ipip_gre6_ops = {
+3 -8
drivers/net/ethernet/mscc/ocelot.c
··· 1622 1622 trap->action.mask_mode = OCELOT_MASK_MODE_PERMIT_DENY; 1623 1623 trap->action.port_mask = 0; 1624 1624 trap->take_ts = take_ts; 1625 - list_add_tail(&trap->trap_list, &ocelot->traps); 1625 + trap->is_trap = true; 1626 1626 new = true; 1627 1627 } 1628 1628 ··· 1634 1634 err = ocelot_vcap_filter_replace(ocelot, trap); 1635 1635 if (err) { 1636 1636 trap->ingress_port_mask &= ~BIT(port); 1637 - if (!trap->ingress_port_mask) { 1638 - list_del(&trap->trap_list); 1637 + if (!trap->ingress_port_mask) 1639 1638 kfree(trap); 1640 - } 1641 1639 return err; 1642 1640 } 1643 1641 ··· 1655 1657 return 0; 1656 1658 1657 1659 trap->ingress_port_mask &= ~BIT(port); 1658 - if (!trap->ingress_port_mask) { 1659 - list_del(&trap->trap_list); 1660 - 1660 + if (!trap->ingress_port_mask) 1661 1661 return ocelot_vcap_filter_del(ocelot, trap); 1662 - } 1663 1662 1664 1663 return ocelot_vcap_filter_replace(ocelot, trap); 1665 1664 }
+4 -5
drivers/net/ethernet/mscc/ocelot_flower.c
··· 280 280 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; 281 281 break; 282 282 case FLOW_ACTION_TRAP: 283 - if (filter->block_id != VCAP_IS2) { 283 + if (filter->block_id != VCAP_IS2 || 284 + filter->lookup != 0) { 284 285 NL_SET_ERR_MSG_MOD(extack, 285 - "Trap action can only be offloaded to VCAP IS2"); 286 + "Trap action can only be offloaded to VCAP IS2 lookup 0"); 286 287 return -EOPNOTSUPP; 287 288 } 288 289 if (filter->goto_target != -1) { ··· 296 295 filter->action.cpu_copy_ena = true; 297 296 filter->action.cpu_qu_num = 0; 298 297 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; 299 - list_add_tail(&filter->trap_list, &ocelot->traps); 298 + filter->is_trap = true; 300 299 break; 301 300 case FLOW_ACTION_POLICE: 302 301 if (filter->block_id == PSFP_BLOCK_ID) { ··· 879 878 880 879 ret = ocelot_flower_parse(ocelot, port, ingress, f, filter); 881 880 if (ret) { 882 - if (!list_empty(&filter->trap_list)) 883 - list_del(&filter->trap_list); 884 881 kfree(filter); 885 882 return ret; 886 883 }
+8 -1
drivers/net/ethernet/mscc/ocelot_vcap.c
··· 374 374 OCELOT_VCAP_BIT_0); 375 375 vcap_key_set(vcap, &data, VCAP_IS2_HK_IGR_PORT_MASK, 0, 376 376 ~filter->ingress_port_mask); 377 - vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_FIRST, OCELOT_VCAP_BIT_ANY); 378 377 vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_HOST_MATCH, 379 378 OCELOT_VCAP_BIT_ANY); 380 379 vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_L2_MC, filter->dmac_mc); ··· 1216 1217 struct ocelot_vcap_filter *tmp; 1217 1218 1218 1219 tmp = ocelot_vcap_block_find_filter_by_index(block, i); 1220 + /* Read back the filter's counters before moving it */ 1221 + vcap_entry_get(ocelot, i - 1, tmp); 1219 1222 vcap_entry_set(ocelot, i, tmp); 1220 1223 } 1221 1224 ··· 1251 1250 struct ocelot_vcap_filter del_filter; 1252 1251 int i, index; 1253 1252 1253 + /* Need to inherit the block_id so that vcap_entry_set() 1254 + * does not get confused and knows where to install it. 1255 + */ 1254 1256 memset(&del_filter, 0, sizeof(del_filter)); 1257 + del_filter.block_id = filter->block_id; 1255 1258 1256 1259 /* Gets index of the filter */ 1257 1260 index = ocelot_vcap_block_get_filter_index(block, filter); ··· 1270 1265 struct ocelot_vcap_filter *tmp; 1271 1266 1272 1267 tmp = ocelot_vcap_block_find_filter_by_index(block, i); 1268 + /* Read back the filter's counters before moving it */ 1269 + vcap_entry_get(ocelot, i + 1, tmp); 1273 1270 vcap_entry_set(ocelot, i, tmp); 1274 1271 } 1275 1272
+2 -1
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
··· 256 256 257 257 err = ionic_map_bars(ionic); 258 258 if (err) 259 - goto err_out_pci_disable_device; 259 + goto err_out_pci_release_regions; 260 260 261 261 /* Configure the device */ 262 262 err = ionic_setup(ionic); ··· 360 360 361 361 err_out_unmap_bars: 362 362 ionic_unmap_bars(ionic); 363 + err_out_pci_release_regions: 363 364 pci_release_regions(pdev); 364 365 err_out_pci_disable_device: 365 366 pci_disable_device(pdev);
+5
drivers/net/ethernet/sfc/ef10.c
··· 3579 3579 n_parts++; 3580 3580 } 3581 3581 3582 + if (!n_parts) { 3583 + kfree(parts); 3584 + return 0; 3585 + } 3586 + 3582 3587 rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); 3583 3588 fail: 3584 3589 if (rc)
+6 -1
drivers/net/ethernet/sfc/efx_channels.c
··· 867 867 868 868 int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) 869 869 { 870 - struct efx_channel *other_channel[EFX_MAX_CHANNELS], *channel; 870 + struct efx_channel *other_channel[EFX_MAX_CHANNELS], *channel, 871 + *ptp_channel = efx_ptp_channel(efx); 872 + struct efx_ptp_data *ptp_data = efx->ptp_data; 871 873 unsigned int i, next_buffer_table = 0; 872 874 u32 old_rxq_entries, old_txq_entries; 873 875 int rc, rc2; ··· 940 938 941 939 efx_set_xdp_channels(efx); 942 940 out: 941 + efx->ptp_data = NULL; 943 942 /* Destroy unused channel structures */ 944 943 for (i = 0; i < efx->n_channels; i++) { 945 944 channel = other_channel[i]; ··· 951 948 } 952 949 } 953 950 951 + efx->ptp_data = ptp_data; 954 952 rc2 = efx_soft_enable_interrupts(efx); 955 953 if (rc2) { 956 954 rc = rc ? rc : rc2; ··· 970 966 efx->txq_entries = old_txq_entries; 971 967 for (i = 0; i < efx->n_channels; i++) 972 968 swap(efx->channel[i], other_channel[i]); 969 + efx_ptp_update_channel(efx, ptp_channel); 973 970 goto out; 974 971 } 975 972
+13 -1
drivers/net/ethernet/sfc/ptp.c
··· 45 45 #include "farch_regs.h" 46 46 #include "tx.h" 47 47 #include "nic.h" /* indirectly includes ptp.h */ 48 + #include "efx_channels.h" 48 49 49 50 /* Maximum number of events expected to make up a PTP event */ 50 51 #define MAX_EVENT_FRAGS 3 ··· 540 539 struct efx_channel *efx_ptp_channel(struct efx_nic *efx) 541 540 { 542 541 return efx->ptp_data ? efx->ptp_data->channel : NULL; 542 + } 543 + 544 + void efx_ptp_update_channel(struct efx_nic *efx, struct efx_channel *channel) 545 + { 546 + if (efx->ptp_data) 547 + efx->ptp_data->channel = channel; 543 548 } 544 549 545 550 static u32 last_sync_timestamp_major(struct efx_nic *efx) ··· 1450 1443 int rc = 0; 1451 1444 unsigned int pos; 1452 1445 1446 + if (efx->ptp_data) { 1447 + efx->ptp_data->channel = channel; 1448 + return 0; 1449 + } 1450 + 1453 1451 ptp = kzalloc(sizeof(struct efx_ptp_data), GFP_KERNEL); 1454 1452 efx->ptp_data = ptp; 1455 1453 if (!efx->ptp_data) ··· 2188 2176 .pre_probe = efx_ptp_probe_channel, 2189 2177 .post_remove = efx_ptp_remove_channel, 2190 2178 .get_name = efx_ptp_get_channel_name, 2191 - /* no copy operation; there is no need to reallocate this channel */ 2179 + .copy = efx_copy_channel, 2192 2180 .receive_skb = efx_ptp_rx, 2193 2181 .want_txqs = efx_ptp_want_txqs, 2194 2182 .keep_eventq = false,
+1
drivers/net/ethernet/sfc/ptp.h
··· 16 16 int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel); 17 17 void efx_ptp_defer_probe_with_channel(struct efx_nic *efx); 18 18 struct efx_channel *efx_ptp_channel(struct efx_nic *efx); 19 + void efx_ptp_update_channel(struct efx_nic *efx, struct efx_channel *channel); 19 20 void efx_ptp_remove(struct efx_nic *efx); 20 21 int efx_ptp_set_ts_config(struct efx_nic *efx, struct ifreq *ifr); 21 22 int efx_ptp_get_ts_config(struct efx_nic *efx, struct ifreq *ifr);
+1 -3
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
··· 181 181 return -ENOMEM; 182 182 183 183 /* Enable pci device */ 184 - ret = pci_enable_device(pdev); 184 + ret = pcim_enable_device(pdev); 185 185 if (ret) { 186 186 dev_err(&pdev->dev, "%s: ERROR: failed to enable device\n", 187 187 __func__); ··· 241 241 pcim_iounmap_regions(pdev, BIT(i)); 242 242 break; 243 243 } 244 - 245 - pci_disable_device(pdev); 246 244 } 247 245 248 246 static int __maybe_unused stmmac_pci_suspend(struct device *dev)
+5 -5
drivers/net/phy/micrel.c
··· 1743 1743 1744 1744 static int lanphy_read_page_reg(struct phy_device *phydev, int page, u32 addr) 1745 1745 { 1746 - u32 data; 1746 + int data; 1747 1747 1748 1748 phy_lock_mdio_bus(phydev); 1749 1749 __phy_write(phydev, LAN_EXT_PAGE_ACCESS_CONTROL, page); ··· 2444 2444 2445 2445 static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev) 2446 2446 { 2447 - u16 tsu_irq_status; 2448 - int irq_status; 2447 + int irq_status, tsu_irq_status; 2449 2448 2450 2449 irq_status = phy_read(phydev, LAN8814_INTS); 2451 2450 if (irq_status > 0 && (irq_status & LAN8814_INT_LINK)) ··· 2656 2657 .name = "Micrel KS8737", 2657 2658 /* PHY_BASIC_FEATURES */ 2658 2659 .driver_data = &ks8737_type, 2660 + .probe = kszphy_probe, 2659 2661 .config_init = kszphy_config_init, 2660 2662 .config_intr = kszphy_config_intr, 2661 2663 .handle_interrupt = kszphy_handle_interrupt, ··· 2782 2782 .config_init = ksz8061_config_init, 2783 2783 .config_intr = kszphy_config_intr, 2784 2784 .handle_interrupt = kszphy_handle_interrupt, 2785 - .suspend = kszphy_suspend, 2786 - .resume = kszphy_resume, 2785 + .suspend = genphy_suspend, 2786 + .resume = genphy_resume, 2787 2787 }, { 2788 2788 .phy_id = PHY_ID_KSZ9021, 2789 2789 .phy_id_mask = 0x000ffffe,
+6 -1
drivers/net/phy/phy.c
··· 970 970 { 971 971 struct phy_device *phydev = phy_dat; 972 972 struct phy_driver *drv = phydev->drv; 973 + irqreturn_t ret; 973 974 974 - return drv->handle_interrupt(phydev); 975 + mutex_lock(&phydev->lock); 976 + ret = drv->handle_interrupt(phydev); 977 + mutex_unlock(&phydev->lock); 978 + 979 + return ret; 975 980 } 976 981 977 982 /**
+1
drivers/net/wireless/ath/ath11k/core.c
··· 1288 1288 1289 1289 ieee80211_stop_queues(ar->hw); 1290 1290 ath11k_mac_drain_tx(ar); 1291 + complete(&ar->completed_11d_scan); 1291 1292 complete(&ar->scan.started); 1292 1293 complete(&ar->scan.completed); 1293 1294 complete(&ar->peer_assoc_done);
+10 -3
drivers/net/wireless/ath/ath11k/core.h
··· 38 38 39 39 extern unsigned int ath11k_frame_mode; 40 40 41 + #define ATH11K_SCAN_TIMEOUT_HZ (20 * HZ) 42 + 41 43 #define ATH11K_MON_TIMER_INTERVAL 10 42 44 43 45 enum ath11k_supported_bw { ··· 189 187 ATH11K_SCAN_STARTING, 190 188 ATH11K_SCAN_RUNNING, 191 189 ATH11K_SCAN_ABORTING, 190 + }; 191 + 192 + enum ath11k_11d_state { 193 + ATH11K_11D_IDLE, 194 + ATH11K_11D_PREPARING, 195 + ATH11K_11D_RUNNING, 192 196 }; 193 197 194 198 enum ath11k_dev_flags { ··· 615 607 bool dfs_block_radar_events; 616 608 struct ath11k_thermal thermal; 617 609 u32 vdev_id_11d_scan; 618 - struct completion finish_11d_scan; 619 - struct completion finish_11d_ch_list; 620 - bool pending_11d; 610 + struct completion completed_11d_scan; 611 + enum ath11k_11d_state state_11d; 621 612 bool regdom_set_by_user; 622 613 int hw_rate_code; 623 614 u8 twt_enabled;
+29 -42
drivers/net/wireless/ath/ath11k/mac.c
··· 3601 3601 if (ret) 3602 3602 goto exit; 3603 3603 3604 - /* Currently the pending_11d=true only happened 1 time while 3605 - * wlan interface up in ath11k_mac_11d_scan_start(), it is called by 3606 - * ath11k_mac_op_add_interface(), after wlan interface up, 3607 - * pending_11d=false always. 3608 - * If remove below wait, it always happened scan fail and lead connect 3609 - * fail while wlan interface up, because it has a 11d scan which is running 3610 - * in firmware, and lead this scan failed. 3611 - */ 3612 - if (ar->pending_11d) { 3613 - long time_left; 3614 - unsigned long timeout = 5 * HZ; 3615 - 3616 - if (ar->supports_6ghz) 3617 - timeout += 5 * HZ; 3618 - 3619 - time_left = wait_for_completion_timeout(&ar->finish_11d_ch_list, timeout); 3620 - ath11k_dbg(ar->ab, ATH11K_DBG_MAC, 3621 - "mac wait 11d channel list time left %ld\n", time_left); 3622 - } 3623 - 3624 3604 memset(&arg, 0, sizeof(arg)); 3625 3605 ath11k_wmi_start_scan_init(ar, &arg); 3626 3606 arg.vdev_id = arvif->vdev_id; ··· 3666 3686 kfree(arg.extraie.ptr); 3667 3687 3668 3688 mutex_unlock(&ar->conf_mutex); 3689 + 3690 + if (ar->state_11d == ATH11K_11D_PREPARING) 3691 + ath11k_mac_11d_scan_start(ar, arvif->vdev_id); 3692 + 3669 3693 return ret; 3670 3694 } 3671 3695 ··· 5798 5814 5799 5815 /* TODO: Do we need to enable ANI? */ 5800 5816 5801 - ath11k_reg_update_chan_list(ar); 5817 + ath11k_reg_update_chan_list(ar, false); 5802 5818 5803 5819 ar->num_started_vdevs = 0; 5804 5820 ar->num_created_vdevs = 0; ··· 5864 5880 cancel_work_sync(&ar->regd_update_work); 5865 5881 cancel_work_sync(&ar->ab->update_11d_work); 5866 5882 cancel_work_sync(&ar->ab->rfkill_work); 5883 + 5884 + if (ar->state_11d == ATH11K_11D_PREPARING) { 5885 + ar->state_11d = ATH11K_11D_IDLE; 5886 + complete(&ar->completed_11d_scan); 5887 + } 5867 5888 5868 5889 spin_lock_bh(&ar->data_lock); 5869 5890 list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { ··· 6040 6051 return false; 6041 6052 } 6042 6053 6043 - void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait) 6054 + void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id) 6044 6055 { 6045 6056 struct wmi_11d_scan_start_params param; 6046 6057 int ret; ··· 6068 6079 6069 6080 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac start 11d scan\n"); 6070 6081 6071 - if (wait) 6072 - reinit_completion(&ar->finish_11d_scan); 6073 - 6074 6082 ret = ath11k_wmi_send_11d_scan_start_cmd(ar, &param); 6075 6083 if (ret) { 6076 6084 ath11k_warn(ar->ab, "failed to start 11d scan vdev %d ret: %d\n", 6077 6085 vdev_id, ret); 6078 6086 } else { 6079 6087 ar->vdev_id_11d_scan = vdev_id; 6080 - if (wait) { 6081 - ar->pending_11d = true; 6082 - ret = wait_for_completion_timeout(&ar->finish_11d_scan, 6083 - 5 * HZ); 6084 - ath11k_dbg(ar->ab, ATH11K_DBG_MAC, 6085 - "mac 11d scan left time %d\n", ret); 6086 - 6087 - if (!ret) 6088 - ar->pending_11d = false; 6089 - } 6088 + if (ar->state_11d == ATH11K_11D_PREPARING) 6089 + ar->state_11d = ATH11K_11D_RUNNING; 6090 6090 } 6091 6091 6092 6092 fin: 6093 + if (ar->state_11d == ATH11K_11D_PREPARING) { 6094 + ar->state_11d = ATH11K_11D_IDLE; 6095 + complete(&ar->completed_11d_scan); 6096 + } 6097 + 6093 6098 mutex_unlock(&ar->ab->vdev_id_11d_lock); 6094 6099 } 6095 6100 ··· 6106 6123 vdev_id = ar->vdev_id_11d_scan; 6107 6124 6108 6125 ret = ath11k_wmi_send_11d_scan_stop_cmd(ar, vdev_id); 6109 - if (ret) 6126 + if (ret) { 6110 6127 ath11k_warn(ar->ab, 6111 6128 "failed to stopt 11d scan vdev %d ret: %d\n", 6112 6129 vdev_id, ret); 6113 - else 6130 + } else { 6114 6131 ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID; 6132 + ar->state_11d = ATH11K_11D_IDLE; 6133 + complete(&ar->completed_11d_scan); 6134 + } 6115 6135 } 6116 6136 mutex_unlock(&ar->ab->vdev_id_11d_lock); 6117 6137 } ··· 6310 6324 goto err_peer_del; 6311 6325 } 6312 6326 6313 - ath11k_mac_11d_scan_start(ar, arvif->vdev_id, true); 6314 - 6327 + if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map)) { 6328 + reinit_completion(&ar->completed_11d_scan); 6329 + ar->state_11d = ATH11K_11D_PREPARING; 6330 + } 6315 6331 break; 6316 6332 case WMI_VDEV_TYPE_MONITOR: 6317 6333 set_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); ··· 7178 7190 } 7179 7191 7180 7192 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) 7181 - ath11k_mac_11d_scan_start(ar, arvif->vdev_id, false); 7193 + ath11k_mac_11d_scan_start(ar, arvif->vdev_id); 7182 7194 7183 7195 mutex_unlock(&ar->conf_mutex); 7184 7196 } ··· 8659 8671 ar->monitor_vdev_id = -1; 8660 8672 clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); 8661 8673 ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID; 8662 - init_completion(&ar->finish_11d_scan); 8663 - init_completion(&ar->finish_11d_ch_list); 8674 + init_completion(&ar->completed_11d_scan); 8664 8675 } 8665 8676 8666 8677 return 0;
+1 -1
drivers/net/wireless/ath/ath11k/mac.h
··· 130 130 #define ATH11K_SCAN_11D_INTERVAL 600000 131 131 #define ATH11K_11D_INVALID_VDEV_ID 0xFFFF 132 132 133 - void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait); 133 + void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id); 134 134 void ath11k_mac_11d_scan_stop(struct ath11k *ar); 135 135 void ath11k_mac_11d_scan_stop_all(struct ath11k_base *ab); 136 136
+28 -15
drivers/net/wireless/ath/ath11k/reg.c
··· 102 102 ar->regdom_set_by_user = true; 103 103 } 104 104 105 - int ath11k_reg_update_chan_list(struct ath11k *ar) 105 + int ath11k_reg_update_chan_list(struct ath11k *ar, bool wait) 106 106 { 107 107 struct ieee80211_supported_band **bands; 108 108 struct scan_chan_list_params *params; ··· 111 111 struct channel_param *ch; 112 112 enum nl80211_band band; 113 113 int num_channels = 0; 114 - int i, ret; 114 + int i, ret, left; 115 + 116 + if (wait && ar->state_11d != ATH11K_11D_IDLE) { 117 + left = wait_for_completion_timeout(&ar->completed_11d_scan, 118 + ATH11K_SCAN_TIMEOUT_HZ); 119 + if (!left) { 120 + ath11k_dbg(ar->ab, ATH11K_DBG_REG, 121 + "failed to receive 11d scan complete: timed out\n"); 122 + ar->state_11d = ATH11K_11D_IDLE; 123 + } 124 + ath11k_dbg(ar->ab, ATH11K_DBG_REG, 125 + "reg 11d scan wait left time %d\n", left); 126 + } 127 + 128 + if (wait && 129 + (ar->scan.state == ATH11K_SCAN_STARTING || 130 + ar->scan.state == ATH11K_SCAN_RUNNING)) { 131 + left = wait_for_completion_timeout(&ar->scan.completed, 132 + ATH11K_SCAN_TIMEOUT_HZ); 133 + if (!left) 134 + ath11k_dbg(ar->ab, ATH11K_DBG_REG, 135 + "failed to receive hw scan complete: timed out\n"); 136 + 137 + ath11k_dbg(ar->ab, ATH11K_DBG_REG, 138 + "reg hw scan wait left time %d\n", left); 139 + } 115 140 116 141 bands = hw->wiphy->bands; 117 142 for (band = 0; band < NUM_NL80211_BANDS; band++) { ··· 218 193 ret = ath11k_wmi_send_scan_chan_list_cmd(ar, params); 219 194 kfree(params); 220 195 221 - if (ar->pending_11d) { 222 - complete(&ar->finish_11d_ch_list); 223 - ar->pending_11d = false; 224 - } 225 - 226 196 return ret; 227 197 } 228 198 ··· 283 263 goto err; 284 264 } 285 265 286 - if (ar->pending_11d) 287 - complete(&ar->finish_11d_scan); 288 - 289 266 rtnl_lock(); 290 267 wiphy_lock(ar->hw->wiphy); 291 - 292 - if (ar->pending_11d) 293 - reinit_completion(&ar->finish_11d_ch_list); 294 - 295 268 ret = regulatory_set_wiphy_regd_sync(ar->hw->wiphy, regd_copy); 296 269 wiphy_unlock(ar->hw->wiphy); 297 270 rtnl_unlock(); ··· 295 282 goto err; 296 283 297 284 if (ar->state == ATH11K_STATE_ON) { 298 - ret = ath11k_reg_update_chan_list(ar); 285 + ret = ath11k_reg_update_chan_list(ar, true); 299 286 if (ret) 300 287 goto err; 301 288 }
+1 -1
drivers/net/wireless/ath/ath11k/reg.h
··· 32 32 ath11k_reg_build_regd(struct ath11k_base *ab, 33 33 struct cur_regulatory_info *reg_info, bool intersect); 34 34 int ath11k_regd_update(struct ath11k *ar); 35 - int ath11k_reg_update_chan_list(struct ath11k *ar); 35 + int ath11k_reg_update_chan_list(struct ath11k *ar, bool wait); 36 36 #endif
+14 -2
drivers/net/wireless/ath/ath11k/wmi.c
··· 2015 2015 { 2016 2016 /* setup commonly used values */ 2017 2017 arg->scan_req_id = 1; 2018 - arg->scan_priority = WMI_SCAN_PRIORITY_LOW; 2018 + if (ar->state_11d == ATH11K_11D_PREPARING) 2019 + arg->scan_priority = WMI_SCAN_PRIORITY_MEDIUM; 2020 + else 2021 + arg->scan_priority = WMI_SCAN_PRIORITY_LOW; 2019 2022 arg->dwell_time_active = 50; 2020 2023 arg->dwell_time_active_2g = 0; 2021 2024 arg->dwell_time_passive = 150; ··· 6353 6350 static int ath11k_reg_11d_new_cc_event(struct ath11k_base *ab, struct sk_buff *skb) 6354 6351 { 6355 6352 const struct wmi_11d_new_cc_ev *ev; 6353 + struct ath11k *ar; 6354 + struct ath11k_pdev *pdev; 6356 6355 const void **tb; 6357 - int ret; 6356 + int ret, i; 6358 6357 6359 6358 tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); 6360 6359 if (IS_ERR(tb)) { ··· 6381 6376 ab->new_alpha2[1]); 6382 6377 6383 6378 kfree(tb); 6379 + 6380 + for (i = 0; i < ab->num_radios; i++) { 6381 + pdev = &ab->pdevs[i]; 6382 + ar = pdev->ar; 6383 + ar->state_11d = ATH11K_11D_IDLE; 6384 + complete(&ar->completed_11d_scan); 6385 + } 6384 6386 6385 6387 queue_work(ab->workqueue, &ab->update_11d_work); 6386 6388
+1 -1
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c
··· 371 371 struct iwl_dbg_tlv_timer_node *node, *tmp; 372 372 373 373 list_for_each_entry_safe(node, tmp, timer_list, list) { 374 - del_timer(&node->timer); 374 + del_timer_sync(&node->timer); 375 375 list_del(&node->list); 376 376 kfree(node); 377 377 }
+8 -2
drivers/net/wireless/mac80211_hwsim.c
··· 2202 2202 if (!data->use_chanctx) { 2203 2203 confbw = data->bw; 2204 2204 } else { 2205 - struct ieee80211_chanctx_conf *chanctx_conf = 2206 - rcu_dereference(vif->chanctx_conf); 2205 + struct ieee80211_chanctx_conf *chanctx_conf; 2206 + 2207 + rcu_read_lock(); 2208 + chanctx_conf = rcu_dereference(vif->chanctx_conf); 2207 2209 2208 2210 if (!WARN_ON(!chanctx_conf)) 2209 2211 confbw = chanctx_conf->def.width; 2212 + rcu_read_unlock(); 2210 2213 } 2211 2214 2212 2215 WARN(bw > hwsim_get_chanwidth(confbw), ··· 2478 2475 if (req->ie_len) 2479 2476 skb_put_data(probe, req->ie, req->ie_len); 2480 2477 2478 + rcu_read_lock(); 2481 2479 if (!ieee80211_tx_prepare_skb(hwsim->hw, 2482 2480 hwsim->hw_scan_vif, 2483 2481 probe, 2484 2482 hwsim->tmp_chan->band, 2485 2483 NULL)) { 2484 + rcu_read_unlock(); 2486 2485 kfree_skb(probe); 2487 2486 continue; 2488 2487 } ··· 2492 2487 local_bh_disable(); 2493 2488 mac80211_hwsim_tx_frame(hwsim->hw, probe, 2494 2489 hwsim->tmp_chan); 2490 + rcu_read_unlock(); 2495 2491 local_bh_enable(); 2496 2492 } 2497 2493 }
+1 -1
drivers/ptp/ptp_ocp.c
··· 1557 1557 start_ns = ktime_set(ts.tv_sec, ts.tv_nsec) + NSEC_PER_MSEC; 1558 1558 if (!s->start) { 1559 1559 /* roundup() does not work on 32-bit systems */ 1560 - s->start = DIV_ROUND_UP_ULL(start_ns, s->period); 1560 + s->start = DIV64_U64_ROUND_UP(start_ns, s->period); 1561 1561 s->start = ktime_add(s->start, s->phase); 1562 1562 } 1563 1563
+1 -5
drivers/s390/net/ctcm_mpc.c
··· 626 626 ctcm_clear_busy_do(dev); 627 627 } 628 628 629 - kfree(mpcginfo); 630 - 631 629 return; 632 630 633 631 } ··· 1190 1192 CTCM_FUNTAIL, dev->name); 1191 1193 priv->stats.rx_dropped++; 1192 1194 /* mpcginfo only used for non-data transfers */ 1193 - kfree(mpcginfo); 1194 1195 if (do_debug_data) 1195 1196 ctcmpc_dump_skb(pskb, -8); 1196 1197 } 1198 + kfree(mpcginfo); 1197 1199 } 1198 1200 done: 1199 1201 ··· 1975 1977 } 1976 1978 break; 1977 1979 } 1978 - kfree(mpcginfo); 1979 1980 1980 1981 CTCM_PR_DEBUG("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", 1981 1982 __func__, ch->id, grp->outstanding_xid2, ··· 2035 2038 mpc_validate_xid(mpcginfo); 2036 2039 break; 2037 2040 } 2038 - kfree(mpcginfo); 2039 2041 return; 2040 2042 } 2041 2043
+3 -2
drivers/s390/net/ctcm_sysfs.c
··· 39 39 struct ctcm_priv *priv = dev_get_drvdata(dev); 40 40 int rc; 41 41 42 - ndev = priv->channel[CTCM_READ]->netdev; 43 - if (!(priv && priv->channel[CTCM_READ] && ndev)) { 42 + if (!(priv && priv->channel[CTCM_READ] && 43 + priv->channel[CTCM_READ]->netdev)) { 44 44 CTCM_DBF_TEXT(SETUP, CTC_DBF_ERROR, "bfnondev"); 45 45 return -ENODEV; 46 46 } 47 + ndev = priv->channel[CTCM_READ]->netdev; 47 48 48 49 rc = kstrtouint(buf, 0, &bs1); 49 50 if (rc)
+4 -3
drivers/s390/net/lcs.c
··· 1736 1736 lcs_schedule_recovery(card); 1737 1737 break; 1738 1738 case LCS_CMD_STOPLAN: 1739 - pr_warn("Stoplan for %s initiated by LGW\n", 1740 - card->dev->name); 1741 - if (card->dev) 1739 + if (card->dev) { 1740 + pr_warn("Stoplan for %s initiated by LGW\n", 1741 + card->dev->name); 1742 1742 netif_carrier_off(card->dev); 1743 + } 1743 1744 break; 1744 1745 default: 1745 1746 LCS_DBF_TEXT(5, trace, "noLGWcmd");
+1 -2
drivers/scsi/device_handler/scsi_dh_alua.c
··· 1172 1172 case SCSI_ACCESS_STATE_OPTIMAL: 1173 1173 case SCSI_ACCESS_STATE_ACTIVE: 1174 1174 case SCSI_ACCESS_STATE_LBA: 1175 - return BLK_STS_OK; 1176 1175 case SCSI_ACCESS_STATE_TRANSITIONING: 1177 - return BLK_STS_AGAIN; 1176 + return BLK_STS_OK; 1178 1177 default: 1179 1178 req->rq_flags |= RQF_QUIET; 1180 1179 return BLK_STS_IOERR;
+1 -1
drivers/scsi/lpfc/lpfc_els.c
··· 1330 1330 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == 1331 1331 LPFC_SLI_INTF_IF_TYPE_0) { 1332 1332 /* FLOGI needs to be 3 for WQE FCFI */ 1333 - ct = ((SLI4_CT_FCFI >> 1) & 1) | (SLI4_CT_FCFI & 1); 1333 + ct = SLI4_CT_FCFI; 1334 1334 bf_set(wqe_ct, &wqe->els_req.wqe_com, ct); 1335 1335 1336 1336 /* Set the fcfi to the fcfi we registered with */
+3 -3
drivers/scsi/lpfc/lpfc_sli.c
··· 10720 10720 10721 10721 /* Words 0 - 2 */ 10722 10722 bde = (struct ulp_bde64_le *)&cmdwqe->generic.bde; 10723 - bde->addr_low = cpu_to_le32(putPaddrLow(bmp->phys)); 10724 - bde->addr_high = cpu_to_le32(putPaddrHigh(bmp->phys)); 10723 + bde->addr_low = bpl->addr_low; 10724 + bde->addr_high = bpl->addr_high; 10725 10725 bde->type_size = cpu_to_le32(xmit_len); 10726 - bde->type_size |= cpu_to_le32(ULP_BDE64_TYPE_BLP_64); 10726 + bde->type_size |= cpu_to_le32(ULP_BDE64_TYPE_BDE_64); 10727 10727 10728 10728 /* Word 3 */ 10729 10729 cmdwqe->gen_req.request_payload_len = xmit_len;
+3
drivers/scsi/qla2xxx/qla_target.c
··· 3826 3826 3827 3827 spin_lock_irqsave(&cmd->cmd_lock, flags); 3828 3828 if (cmd->aborted) { 3829 + if (cmd->sg_mapped) 3830 + qlt_unmap_sg(vha, cmd); 3831 + 3829 3832 spin_unlock_irqrestore(&cmd->cmd_lock, flags); 3830 3833 /* 3831 3834 * It's normal to see 2 calls in this path:
+2 -2
drivers/slimbus/qcom-ctrl.c
··· 510 510 } 511 511 512 512 ctrl->irq = platform_get_irq(pdev, 0); 513 - if (!ctrl->irq) { 513 + if (ctrl->irq < 0) { 514 514 dev_err(&pdev->dev, "no slimbus IRQ\n"); 515 - return -ENODEV; 515 + return ctrl->irq; 516 516 } 517 517 518 518 sctrl = &ctrl->ctrl;
+12 -8
drivers/tty/n_gsm.c
··· 137 137 int retries; 138 138 /* Uplink tty if active */ 139 139 struct tty_port port; /* The tty bound to this DLCI if there is one */ 140 + #define TX_SIZE 4096 /* Must be power of 2. */ 140 141 struct kfifo fifo; /* Queue fifo for the DLCI */ 141 142 int adaption; /* Adaption layer in use */ 142 143 int prev_adaption; ··· 1659 1658 if (len == 0) 1660 1659 return; 1661 1660 } 1661 + len--; 1662 1662 slen++; 1663 1663 tty = tty_port_tty_get(port); 1664 1664 if (tty) { ··· 1732 1730 return NULL; 1733 1731 spin_lock_init(&dlci->lock); 1734 1732 mutex_init(&dlci->mutex); 1735 - if (kfifo_alloc(&dlci->fifo, 4096, GFP_KERNEL) < 0) { 1733 + if (kfifo_alloc(&dlci->fifo, TX_SIZE, GFP_KERNEL) < 0) { 1736 1734 kfree(dlci); 1737 1735 return NULL; 1738 1736 } ··· 2353 2351 2354 2352 static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c) 2355 2353 { 2354 + int ret = 0; 2356 2355 int need_close = 0; 2357 2356 int need_restart = 0; 2358 2357 ··· 2421 2418 * FIXME: We need to separate activation/deactivation from adding 2422 2419 * and removing from the mux array 2423 2420 */ 2424 - if (need_restart) 2425 - gsm_activate_mux(gsm); 2426 - if (gsm->initiator && need_close) 2427 - gsm_dlci_begin_open(gsm->dlci[0]); 2421 + if (gsm->dead) { 2422 + ret = gsm_activate_mux(gsm); 2423 + if (ret) 2424 + return ret; 2425 + if (gsm->initiator) 2426 + gsm_dlci_begin_open(gsm->dlci[0]); 2427 + } 2428 2428 return 0; 2429 2429 } 2430 2430 ··· 2977 2971 * Virtual tty side 2978 2972 */ 2979 2973 2980 - #define TX_SIZE 512 2981 - 2982 2974 /** 2983 2975 * gsm_modem_upd_via_data - send modem bits via convergence layer 2984 2976 * @dlci: channel ··· 3216 3212 struct gsm_dlci *dlci = tty->driver_data; 3217 3213 if (dlci->state == DLCI_CLOSED) 3218 3214 return 0; 3219 - return TX_SIZE - kfifo_len(&dlci->fifo); 3215 + return kfifo_avail(&dlci->fifo); 3220 3216 } 3221 3217 3222 3218 static unsigned int gsmtty_chars_in_buffer(struct tty_struct *tty)
+20 -9
drivers/tty/serial/8250/8250_mtk.c
··· 37 37 #define MTK_UART_IER_RTSI 0x40 /* Enable RTS Modem status interrupt */ 38 38 #define MTK_UART_IER_CTSI 0x80 /* Enable CTS Modem status interrupt */ 39 39 40 + #define MTK_UART_EFR 38 /* I/O: Extended Features Register */ 40 41 #define MTK_UART_EFR_EN 0x10 /* Enable enhancement feature */ 41 42 #define MTK_UART_EFR_RTS 0x40 /* Enable hardware rx flow control */ 42 43 #define MTK_UART_EFR_CTS 0x80 /* Enable hardware tx flow control */ ··· 53 52 #define MTK_UART_RX_SIZE 0x8000 54 53 #define MTK_UART_TX_TRIGGER 1 55 54 #define MTK_UART_RX_TRIGGER MTK_UART_RX_SIZE 55 + 56 + #define MTK_UART_FEATURE_SEL 39 /* Feature Selection register */ 57 + #define MTK_UART_FEAT_NEWRMAP BIT(0) /* Use new register map */ 58 + 59 + #define MTK_UART_XON1 40 /* I/O: Xon character 1 */ 60 + #define MTK_UART_XOFF1 42 /* I/O: Xoff character 1 */ 56 61 57 62 #ifdef CONFIG_SERIAL_8250_DMA 58 63 enum dma_rx_status { ··· 176 169 MTK_UART_DMA_EN_RX | MTK_UART_DMA_EN_TX); 177 170 178 171 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 179 - serial_out(up, UART_EFR, UART_EFR_ECB); 172 + serial_out(up, MTK_UART_EFR, UART_EFR_ECB); 180 173 serial_out(up, UART_LCR, lcr); 181 174 182 175 if (dmaengine_slave_config(dma->rxchan, &dma->rxconf) != 0) ··· 239 232 int lcr = serial_in(up, UART_LCR); 240 233 241 234 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 242 - serial_out(up, UART_EFR, UART_EFR_ECB); 235 + serial_out(up, MTK_UART_EFR, UART_EFR_ECB); 243 236 serial_out(up, UART_LCR, lcr); 244 237 lcr = serial_in(up, UART_LCR); 245 238 ··· 248 241 serial_out(up, MTK_UART_ESCAPE_DAT, MTK_UART_ESCAPE_CHAR); 249 242 serial_out(up, MTK_UART_ESCAPE_EN, 0x00); 250 243 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 251 - serial_out(up, UART_EFR, serial_in(up, UART_EFR) & 244 + serial_out(up, MTK_UART_EFR, serial_in(up, MTK_UART_EFR) & 252 245 (~(MTK_UART_EFR_HW_FC | MTK_UART_EFR_SW_FC_MASK))); 253 246 serial_out(up, UART_LCR, lcr); 254 247 mtk8250_disable_intrs(up, MTK_UART_IER_XOFFI | ··· 262 255 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 263 256 264 257 /*enable hw flow control*/ 265 - serial_out(up, UART_EFR, MTK_UART_EFR_HW_FC | 266 - (serial_in(up, UART_EFR) & 258 + serial_out(up, MTK_UART_EFR, MTK_UART_EFR_HW_FC | 259 + (serial_in(up, MTK_UART_EFR) & 267 260 (~(MTK_UART_EFR_HW_FC | MTK_UART_EFR_SW_FC_MASK)))); 268 261 269 262 serial_out(up, UART_LCR, lcr); ··· 277 270 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 278 271 279 272 /*enable sw flow control */ 280 - serial_out(up, UART_EFR, MTK_UART_EFR_XON1_XOFF1 | 281 - (serial_in(up, UART_EFR) & 273 + serial_out(up, MTK_UART_EFR, MTK_UART_EFR_XON1_XOFF1 | 274 + (serial_in(up, MTK_UART_EFR) & 282 275 (~(MTK_UART_EFR_HW_FC | MTK_UART_EFR_SW_FC_MASK)))); 283 276 284 - serial_out(up, UART_XON1, START_CHAR(port->state->port.tty)); 285 - serial_out(up, UART_XOFF1, STOP_CHAR(port->state->port.tty)); 277 + serial_out(up, MTK_UART_XON1, START_CHAR(port->state->port.tty)); 278 + serial_out(up, MTK_UART_XOFF1, STOP_CHAR(port->state->port.tty)); 286 279 serial_out(up, UART_LCR, lcr); 287 280 mtk8250_disable_intrs(up, MTK_UART_IER_CTSI|MTK_UART_IER_RTSI); 288 281 mtk8250_enable_intrs(up, MTK_UART_IER_XOFFI); ··· 574 567 if (data->dma) 575 568 uart.dma = data->dma; 576 569 #endif 570 + 571 + /* Set AP UART new register map */ 572 + writel(MTK_UART_FEAT_NEWRMAP, uart.port.membase + 573 + (MTK_UART_FEATURE_SEL << uart.port.regshift)); 577 574 578 575 /* Disable Rate Fix function */ 579 576 writel(0x0, uart.port.membase +
+2 -3
drivers/tty/serial/digicolor-usart.c
··· 471 471 if (IS_ERR(uart_clk)) 472 472 return PTR_ERR(uart_clk); 473 473 474 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 475 - dp->port.mapbase = res->start; 476 - dp->port.membase = devm_ioremap_resource(&pdev->dev, res); 474 + dp->port.membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 477 475 if (IS_ERR(dp->port.membase)) 478 476 return PTR_ERR(dp->port.membase); 477 + dp->port.mapbase = res->start; 479 478 480 479 irq = platform_get_irq(pdev, 0); 481 480 if (irq < 0)
+9 -9
drivers/tty/serial/fsl_lpuart.c
··· 2664 2664 struct device_node *np = pdev->dev.of_node; 2665 2665 struct lpuart_port *sport; 2666 2666 struct resource *res; 2667 + irq_handler_t handler; 2667 2668 int ret; 2668 2669 2669 2670 sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); ··· 2742 2741 2743 2742 if (lpuart_is_32(sport)) { 2744 2743 lpuart_reg.cons = LPUART32_CONSOLE; 2745 - ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart32_int, 0, 2746 - DRIVER_NAME, sport); 2744 + handler = lpuart32_int; 2747 2745 } else { 2748 2746 lpuart_reg.cons = LPUART_CONSOLE; 2749 - ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart_int, 0, 2750 - DRIVER_NAME, sport); 2747 + handler = lpuart_int; 2751 2748 } 2752 - 2753 - if (ret) 2754 - goto failed_irq_request; 2755 - 2756 2749 ret = uart_add_one_port(&lpuart_reg, &sport->port); 2757 2750 if (ret) 2758 2751 goto failed_attach_port; ··· 2768 2773 2769 2774 sport->port.rs485_config(&sport->port, &sport->port.rs485); 2770 2775 2776 + ret = devm_request_irq(&pdev->dev, sport->port.irq, handler, 0, 2777 + DRIVER_NAME, sport); 2778 + if (ret) 2779 + goto failed_irq_request; 2780 + 2771 2781 return 0; 2772 2782 2783 + failed_irq_request: 2773 2784 failed_get_rs485: 2774 2785 failed_reset: 2775 2786 uart_remove_one_port(&lpuart_reg, &sport->port); 2776 2787 failed_attach_port: 2777 - failed_irq_request: 2778 2788 lpuart_disable_clks(sport); 2779 2789 failed_clock_enable: 2780 2790 failed_out_of_range:
+1
drivers/usb/class/cdc-wdm.c
··· 774 774 poison_urbs(desc); 775 775 spin_lock_irq(&desc->iuspin); 776 776 desc->resp_count = 0; 777 + clear_bit(WDM_RESPONDING, &desc->flags); 777 778 spin_unlock_irq(&desc->iuspin); 778 779 desc->manage_power(desc->intf, 0); 779 780 unpoison_urbs(desc);
+25
drivers/usb/gadget/function/f_uvc.c
··· 890 890 { 891 891 struct usb_composite_dev *cdev = c->cdev; 892 892 struct uvc_device *uvc = to_uvc(f); 893 + long wait_ret = 1; 893 894 894 895 uvcg_info(f, "%s()\n", __func__); 896 + 897 + /* If we know we're connected via v4l2, then there should be a cleanup 898 + * of the device from userspace either via UVC_EVENT_DISCONNECT or 899 + * though the video device removal uevent. Allow some time for the 900 + * application to close out before things get deleted. 901 + */ 902 + if (uvc->func_connected) { 903 + uvcg_dbg(f, "waiting for clean disconnect\n"); 904 + wait_ret = wait_event_interruptible_timeout(uvc->func_connected_queue, 905 + uvc->func_connected == false, msecs_to_jiffies(500)); 906 + uvcg_dbg(f, "done waiting with ret: %ld\n", wait_ret); 907 + } 895 908 896 909 device_remove_file(&uvc->vdev.dev, &dev_attr_function_name); 897 910 video_unregister_device(&uvc->vdev); 898 911 v4l2_device_unregister(&uvc->v4l2_dev); 912 + 913 + if (uvc->func_connected) { 914 + /* Wait for the release to occur to ensure there are no longer any 915 + * pending operations that may cause panics when resources are cleaned 916 + * up. 917 + */ 918 + uvcg_warn(f, "%s no clean disconnect, wait for release\n", __func__); 919 + wait_ret = wait_event_interruptible_timeout(uvc->func_connected_queue, 920 + uvc->func_connected == false, msecs_to_jiffies(1000)); 921 + uvcg_dbg(f, "done waiting for release with ret: %ld\n", wait_ret); 922 + } 899 923 900 924 usb_ep_free_request(cdev->gadget->ep0, uvc->control_req); 901 925 kfree(uvc->control_buf); ··· 939 915 940 916 mutex_init(&uvc->video.mutex); 941 917 uvc->state = UVC_STATE_DISCONNECTED; 918 + init_waitqueue_head(&uvc->func_connected_queue); 942 919 opts = fi_to_f_uvc_opts(fi); 943 920 944 921 mutex_lock(&opts->lock);
+2
drivers/usb/gadget/function/uvc.h
··· 14 14 #include <linux/spinlock.h> 15 15 #include <linux/usb/composite.h> 16 16 #include <linux/videodev2.h> 17 + #include <linux/wait.h> 17 18 18 19 #include <media/v4l2-device.h> 19 20 #include <media/v4l2-dev.h> ··· 130 129 struct usb_function func; 131 130 struct uvc_video video; 132 131 bool func_connected; 132 + wait_queue_head_t func_connected_queue; 133 133 134 134 /* Descriptors */ 135 135 struct {
+2 -1
drivers/usb/gadget/function/uvc_v4l2.c
··· 253 253 254 254 static void uvc_v4l2_disable(struct uvc_device *uvc) 255 255 { 256 - uvc->func_connected = false; 257 256 uvc_function_disconnect(uvc); 258 257 uvcg_video_enable(&uvc->video, 0); 259 258 uvcg_free_buffers(&uvc->video.queue); 259 + uvc->func_connected = false; 260 + wake_up_interruptible(&uvc->func_connected_queue); 260 261 } 261 262 262 263 static int
+2
drivers/usb/gadget/legacy/raw_gadget.c
··· 145 145 STATE_DEV_INVALID = 0, 146 146 STATE_DEV_OPENED, 147 147 STATE_DEV_INITIALIZED, 148 + STATE_DEV_REGISTERING, 148 149 STATE_DEV_RUNNING, 149 150 STATE_DEV_CLOSED, 150 151 STATE_DEV_FAILED ··· 509 508 ret = -EINVAL; 510 509 goto out_unlock; 511 510 } 511 + dev->state = STATE_DEV_REGISTERING; 512 512 spin_unlock_irqrestore(&dev->lock, flags); 513 513 514 514 ret = usb_gadget_probe_driver(&dev->driver);
+19 -71
drivers/usb/host/xhci-mtk-sch.c
··· 19 19 #define HS_BW_BOUNDARY 6144 20 20 /* usb2 spec section11.18.1: at most 188 FS bytes per microframe */ 21 21 #define FS_PAYLOAD_MAX 188 22 - /* 23 - * max number of microframes for split transfer, 24 - * for fs isoc in : 1 ss + 1 idle + 7 cs 25 - */ 26 - #define TT_MICROFRAMES_MAX 9 27 22 28 23 #define DBG_BUF_EN 64 29 24 ··· 237 242 238 243 static struct mu3h_sch_ep_info * 239 244 create_sch_ep(struct xhci_hcd_mtk *mtk, struct usb_device *udev, 240 - struct usb_host_endpoint *ep, struct xhci_ep_ctx *ep_ctx) 245 + struct usb_host_endpoint *ep) 241 246 { 242 247 struct mu3h_sch_ep_info *sch_ep; 243 248 struct mu3h_sch_bw_info *bw_info; 244 249 struct mu3h_sch_tt *tt = NULL; 245 - u32 len_bw_budget_table; 246 250 247 251 bw_info = get_bw_info(mtk, udev, ep); 248 252 if (!bw_info) 249 253 return ERR_PTR(-ENODEV); 250 254 251 - if (is_fs_or_ls(udev->speed)) 252 - len_bw_budget_table = TT_MICROFRAMES_MAX; 253 - else if ((udev->speed >= USB_SPEED_SUPER) 254 - && usb_endpoint_xfer_isoc(&ep->desc)) 255 - len_bw_budget_table = get_esit(ep_ctx); 256 - else 257 - len_bw_budget_table = 1; 258 - 259 - sch_ep = kzalloc(struct_size(sch_ep, bw_budget_table, 260 - len_bw_budget_table), 261 - GFP_KERNEL); 255 + sch_ep = kzalloc(sizeof(*sch_ep), GFP_KERNEL); 262 256 if (!sch_ep) 263 257 return ERR_PTR(-ENOMEM); 264 258 ··· 279 295 u32 mult; 280 296 u32 esit_pkts; 281 297 u32 max_esit_payload; 282 - u32 *bwb_table = sch_ep->bw_budget_table; 283 - int i; 284 298 285 299 ep_type = CTX_TO_EP_TYPE(le32_to_cpu(ep_ctx->ep_info2)); 286 300 maxpkt = MAX_PACKET_DECODED(le32_to_cpu(ep_ctx->ep_info2)); ··· 314 332 */ 315 333 sch_ep->pkts = max_burst + 1; 316 334 sch_ep->bw_cost_per_microframe = maxpkt * sch_ep->pkts; 317 - bwb_table[0] = sch_ep->bw_cost_per_microframe; 318 335 } else if (sch_ep->speed >= USB_SPEED_SUPER) { 319 336 /* usb3_r1 spec section4.4.7 & 4.4.8 */ 320 337 sch_ep->cs_count = 0; ··· 330 349 if (ep_type == INT_IN_EP || ep_type == INT_OUT_EP) { 331 350 sch_ep->pkts = esit_pkts; 332 351 sch_ep->num_budget_microframes = 1; 333 - bwb_table[0] = maxpkt * sch_ep->pkts; 334 352 } 335 353 336 354 if (ep_type == ISOC_IN_EP || ep_type == ISOC_OUT_EP) { ··· 346 366 DIV_ROUND_UP(esit_pkts, sch_ep->pkts); 347 367 348 368 sch_ep->repeat = !!(sch_ep->num_budget_microframes > 1); 349 - sch_ep->bw_cost_per_microframe = maxpkt * sch_ep->pkts; 350 - 351 - for (i = 0; i < sch_ep->num_budget_microframes - 1; i++) 352 - bwb_table[i] = sch_ep->bw_cost_per_microframe; 353 - 354 - /* last one <= bw_cost_per_microframe */ 355 - bwb_table[i] = maxpkt * esit_pkts 356 - - i * sch_ep->bw_cost_per_microframe; 357 369 } 370 + sch_ep->bw_cost_per_microframe = maxpkt * sch_ep->pkts; 358 371 } else if (is_fs_or_ls(sch_ep->speed)) { 359 372 sch_ep->pkts = 1; /* at most one packet for each microframe */ 360 373 ··· 357 384 */ 358 385 sch_ep->cs_count = DIV_ROUND_UP(maxpkt, FS_PAYLOAD_MAX); 359 386 sch_ep->num_budget_microframes = sch_ep->cs_count; 360 - sch_ep->bw_cost_per_microframe = 361 - (maxpkt < FS_PAYLOAD_MAX) ? maxpkt : FS_PAYLOAD_MAX; 362 - 363 - /* init budget table */ 364 - if (ep_type == ISOC_OUT_EP) { 365 - for (i = 0; i < sch_ep->num_budget_microframes; i++) 366 - bwb_table[i] = sch_ep->bw_cost_per_microframe; 367 - } else if (ep_type == INT_OUT_EP) { 368 - /* only first one consumes bandwidth, others as zero */ 369 - bwb_table[0] = sch_ep->bw_cost_per_microframe; 370 - } else { /* INT_IN_EP or ISOC_IN_EP */ 371 - bwb_table[0] = 0; /* start split */ 372 - bwb_table[1] = 0; /* idle */ 373 - /* 374 - * due to cs_count will be updated according to cs 375 - * position, assign all remainder budget array 376 - * elements as @bw_cost_per_microframe, but only first 377 - * @num_budget_microframes elements will be used later 378 - */ 379 - for (i = 2; i < TT_MICROFRAMES_MAX; i++) 380 - bwb_table[i] = sch_ep->bw_cost_per_microframe; 381 - } 387 + sch_ep->bw_cost_per_microframe = min_t(u32, maxpkt, FS_PAYLOAD_MAX); 382 388 } 383 389 } 384 390 ··· 374 422 375 423 for (j = 0; j < sch_ep->num_budget_microframes; j++) { 376 424 k = XHCI_MTK_BW_INDEX(base + j); 377 - bw = sch_bw->bus_bw[k] + sch_ep->bw_budget_table[j]; 425 + bw = sch_bw->bus_bw[k] + sch_ep->bw_cost_per_microframe; 378 426 if (bw > max_bw) 379 427 max_bw = bw; 380 428 } ··· 385 433 static void update_bus_bw(struct mu3h_sch_bw_info *sch_bw, 386 434 struct mu3h_sch_ep_info *sch_ep, bool used) 387 435 { 436 + int bw_updated; 388 437 u32 base; 389 - int i, j, k; 438 + int i, j; 439 + 440 + bw_updated = sch_ep->bw_cost_per_microframe * (used ? 1 : -1); 390 441 391 442 for (i = 0; i < sch_ep->num_esit; i++) { 392 443 base = sch_ep->offset + i * sch_ep->esit; 393 - for (j = 0; j < sch_ep->num_budget_microframes; j++) { 394 - k = XHCI_MTK_BW_INDEX(base + j); 395 - if (used) 396 - sch_bw->bus_bw[k] += sch_ep->bw_budget_table[j]; 397 - else 398 - sch_bw->bus_bw[k] -= sch_ep->bw_budget_table[j]; 399 - } 444 + for (j = 0; j < sch_ep->num_budget_microframes; j++) 445 + sch_bw->bus_bw[XHCI_MTK_BW_INDEX(base + j)] += bw_updated; 400 446 } 401 447 } 402 448 ··· 414 464 */ 415 465 for (j = 0; j < sch_ep->num_budget_microframes; j++) { 416 466 k = XHCI_MTK_BW_INDEX(base + j); 417 - tmp = tt->fs_bus_bw[k] + sch_ep->bw_budget_table[j]; 467 + tmp = tt->fs_bus_bw[k] + sch_ep->bw_cost_per_microframe; 418 468 if (tmp > FS_PAYLOAD_MAX) 419 469 return -ESCH_BW_OVERFLOW; 420 470 } ··· 488 538 static void update_sch_tt(struct mu3h_sch_ep_info *sch_ep, bool used) 489 539 { 490 540 struct mu3h_sch_tt *tt = sch_ep->sch_tt; 541 + int bw_updated; 491 542 u32 base; 492 - int i, j, k; 543 + int i, j; 544 + 545 + bw_updated = sch_ep->bw_cost_per_microframe * (used ? 1 : -1); 493 546 494 547 for (i = 0; i < sch_ep->num_esit; i++) { 495 548 base = sch_ep->offset + i * sch_ep->esit; 496 549 497 - for (j = 0; j < sch_ep->num_budget_microframes; j++) { 498 - k = XHCI_MTK_BW_INDEX(base + j); 499 - if (used) 500 - tt->fs_bus_bw[k] += sch_ep->bw_budget_table[j]; 501 - else 502 - tt->fs_bus_bw[k] -= sch_ep->bw_budget_table[j]; 503 - } 550 + for (j = 0; j < sch_ep->num_budget_microframes; j++) 551 + tt->fs_bus_bw[XHCI_MTK_BW_INDEX(base + j)] += bw_updated; 504 552 } 505 553 506 554 if (used) ··· 658 710 659 711 xhci_dbg(xhci, "%s %s\n", __func__, decode_ep(ep, udev->speed)); 660 712 661 - sch_ep = create_sch_ep(mtk, udev, ep, ep_ctx); 713 + sch_ep = create_sch_ep(mtk, udev, ep); 662 714 if (IS_ERR_OR_NULL(sch_ep)) 663 715 return -ENOMEM; 664 716
-2
drivers/usb/host/xhci-mtk.h
··· 83 83 * times; 1: distribute the (bMaxBurst+1)*(Mult+1) packets 84 84 * according to @pkts and @repeat. normal mode is used by 85 85 * default 86 - * @bw_budget_table: table to record bandwidth budget per microframe 87 86 */ 88 87 struct mu3h_sch_ep_info { 89 88 u32 esit; ··· 108 109 u32 pkts; 109 110 u32 cs_count; 110 111 u32 burst_mode; 111 - u32 bw_budget_table[]; 112 112 }; 113 113 114 114 #define MU3C_U3_PORT_MAX 4
+4
drivers/usb/serial/option.c
··· 2123 2123 .driver_info = RSVD(3) }, 2124 2124 { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */ 2125 2125 .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, 2126 + { USB_DEVICE(0x1782, 0x4d10) }, /* Fibocom L610 (AT mode) */ 2127 + { USB_DEVICE_INTERFACE_CLASS(0x1782, 0x4d11, 0xff) }, /* Fibocom L610 (ECM/RNDIS mode) */ 2126 2128 { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */ 2127 2129 .driver_info = RSVD(4) | RSVD(5) }, 2128 2130 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */ 2129 2131 .driver_info = RSVD(6) }, 2132 + { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0106, 0xff) }, /* Fibocom MA510 (ECM mode w/ diag intf.) */ 2133 + { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x010a, 0xff) }, /* Fibocom MA510 (ECM mode) */ 2130 2134 { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x010b, 0xff, 0xff, 0x30) }, /* Fibocom FG150 Diag */ 2131 2135 { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x010b, 0xff, 0, 0) }, /* Fibocom FG150 AT */ 2132 2136 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */
+1
drivers/usb/serial/pl2303.c
··· 106 106 { USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) }, 107 107 { USB_DEVICE(HP_VENDOR_ID, HP_LCM960_PRODUCT_ID) }, 108 108 { USB_DEVICE(HP_VENDOR_ID, HP_LM920_PRODUCT_ID) }, 109 + { USB_DEVICE(HP_VENDOR_ID, HP_LM930_PRODUCT_ID) }, 109 110 { USB_DEVICE(HP_VENDOR_ID, HP_LM940_PRODUCT_ID) }, 110 111 { USB_DEVICE(HP_VENDOR_ID, HP_TD620_PRODUCT_ID) }, 111 112 { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) },
+1
drivers/usb/serial/pl2303.h
··· 135 135 #define HP_TD620_PRODUCT_ID 0x0956 136 136 #define HP_LD960_PRODUCT_ID 0x0b39 137 137 #define HP_LD381_PRODUCT_ID 0x0f7f 138 + #define HP_LM930_PRODUCT_ID 0x0f9b 138 139 #define HP_LCM220_PRODUCT_ID 0x3139 139 140 #define HP_LCM960_PRODUCT_ID 0x3239 140 141 #define HP_LD220_PRODUCT_ID 0x3524
+2
drivers/usb/serial/qcserial.c
··· 166 166 {DEVICE_SWI(0x1199, 0x9090)}, /* Sierra Wireless EM7565 QDL */ 167 167 {DEVICE_SWI(0x1199, 0x9091)}, /* Sierra Wireless EM7565 */ 168 168 {DEVICE_SWI(0x1199, 0x90d2)}, /* Sierra Wireless EM9191 QDL */ 169 + {DEVICE_SWI(0x1199, 0xc080)}, /* Sierra Wireless EM7590 QDL */ 170 + {DEVICE_SWI(0x1199, 0xc081)}, /* Sierra Wireless EM7590 */ 169 171 {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ 170 172 {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ 171 173 {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
+1 -1
drivers/usb/typec/tcpm/tcpci.c
··· 877 877 /* Disable chip interrupts before unregistering port */ 878 878 err = tcpci_write16(chip->tcpci, TCPC_ALERT_MASK, 0); 879 879 if (err < 0) 880 - return err; 880 + dev_warn(&client->dev, "Failed to disable irqs (%pe)\n", ERR_PTR(err)); 881 881 882 882 tcpci_unregister_port(chip->tcpci); 883 883
+26
drivers/usb/typec/tcpm/tcpci_mt6360.c
··· 15 15 16 16 #include "tcpci.h" 17 17 18 + #define MT6360_REG_PHYCTRL1 0x80 19 + #define MT6360_REG_PHYCTRL3 0x82 20 + #define MT6360_REG_PHYCTRL7 0x86 18 21 #define MT6360_REG_VCONNCTRL1 0x8C 19 22 #define MT6360_REG_MODECTRL2 0x8F 20 23 #define MT6360_REG_SWRESET 0xA0 ··· 25 22 #define MT6360_REG_DRPCTRL1 0xA2 26 23 #define MT6360_REG_DRPCTRL2 0xA3 27 24 #define MT6360_REG_I2CTORST 0xBF 25 + #define MT6360_REG_PHYCTRL11 0xCA 26 + #define MT6360_REG_RXCTRL1 0xCE 28 27 #define MT6360_REG_RXCTRL2 0xCF 29 28 #define MT6360_REG_CTDCTRL2 0xEC 30 29 ··· 108 103 /* Enable Rpdet oneshot detection */ 109 104 ret = regmap_update_bits(regmap, MT6360_REG_CTDCTRL2, MT6360_RPONESHOT_ENABLE, 110 105 MT6360_RPONESHOT_ENABLE); 106 + if (ret) 107 + return ret; 108 + 109 + /* BMC PHY */ 110 + ret = mt6360_tcpc_write16(regmap, MT6360_REG_PHYCTRL1, 0x3A70); 111 + if (ret) 112 + return ret; 113 + 114 + ret = regmap_write(regmap, MT6360_REG_PHYCTRL3, 0x82); 115 + if (ret) 116 + return ret; 117 + 118 + ret = regmap_write(regmap, MT6360_REG_PHYCTRL7, 0x36); 119 + if (ret) 120 + return ret; 121 + 122 + ret = mt6360_tcpc_write16(regmap, MT6360_REG_PHYCTRL11, 0x3C60); 123 + if (ret) 124 + return ret; 125 + 126 + ret = regmap_write(regmap, MT6360_REG_RXCTRL1, 0xE8); 111 127 if (ret) 112 128 return ret; 113 129
+1 -4
drivers/video/fbdev/core/fbmem.c
··· 1434 1434 __acquires(&info->lock) 1435 1435 __releases(&info->lock) 1436 1436 { 1437 - struct fb_info * const info = file_fb_info(file); 1438 - 1439 - if (!info) 1440 - return -ENODEV; 1437 + struct fb_info * const info = file->private_data; 1441 1438 1442 1439 lock_fb_info(info); 1443 1440 if (info->fbops->fb_release)
+4
drivers/video/fbdev/core/fbsysfs.c
··· 80 80 { 81 81 if (!info) 82 82 return; 83 + 84 + if (WARN_ON(refcount_read(&info->count))) 85 + return; 86 + 83 87 kfree(info->apertures); 84 88 kfree(info); 85 89 }
+8 -1
drivers/video/fbdev/efifb.c
··· 243 243 static inline void efifb_show_boot_graphics(struct fb_info *info) {} 244 244 #endif 245 245 246 + /* 247 + * fb_ops.fb_destroy is called by the last put_fb_info() call at the end 248 + * of unregister_framebuffer() or fb_release(). Do any cleanup here. 249 + */ 246 250 static void efifb_destroy(struct fb_info *info) 247 251 { 248 252 if (efifb_pci_dev) ··· 258 254 else 259 255 memunmap(info->screen_base); 260 256 } 257 + 261 258 if (request_mem_succeeded) 262 259 release_mem_region(info->apertures->ranges[0].base, 263 260 info->apertures->ranges[0].size); 264 261 fb_dealloc_cmap(&info->cmap); 262 + 263 + framebuffer_release(info); 265 264 } 266 265 267 266 static const struct fb_ops efifb_ops = { ··· 627 620 { 628 621 struct fb_info *info = platform_get_drvdata(pdev); 629 622 623 + /* efifb_destroy takes care of info cleanup */ 630 624 unregister_framebuffer(info); 631 625 sysfs_remove_groups(&pdev->dev.kobj, efifb_groups); 632 - framebuffer_release(info); 633 626 634 627 return 0; 635 628 }
+7 -1
drivers/video/fbdev/simplefb.c
··· 84 84 static void simplefb_clocks_destroy(struct simplefb_par *par); 85 85 static void simplefb_regulators_destroy(struct simplefb_par *par); 86 86 87 + /* 88 + * fb_ops.fb_destroy is called by the last put_fb_info() call at the end 89 + * of unregister_framebuffer() or fb_release(). Do any cleanup here. 90 + */ 87 91 static void simplefb_destroy(struct fb_info *info) 88 92 { 89 93 struct simplefb_par *par = info->par; ··· 97 93 simplefb_clocks_destroy(info->par); 98 94 if (info->screen_base) 99 95 iounmap(info->screen_base); 96 + 97 + framebuffer_release(info); 100 98 101 99 if (mem) 102 100 release_mem_region(mem->start, resource_size(mem)); ··· 551 545 { 552 546 struct fb_info *info = platform_get_drvdata(pdev); 553 547 548 + /* simplefb_destroy takes care of info cleanup */ 554 549 unregister_framebuffer(info); 555 - framebuffer_release(info); 556 550 557 551 return 0; 558 552 }
+7 -1
drivers/video/fbdev/vesafb.c
··· 179 179 return err; 180 180 } 181 181 182 + /* 183 + * fb_ops.fb_destroy is called by the last put_fb_info() call at the end 184 + * of unregister_framebuffer() or fb_release(). Do any cleanup here. 185 + */ 182 186 static void vesafb_destroy(struct fb_info *info) 183 187 { 184 188 struct vesafb_par *par = info->par; ··· 192 188 if (info->screen_base) 193 189 iounmap(info->screen_base); 194 190 release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); 191 + 192 + framebuffer_release(info); 195 193 } 196 194 197 195 static struct fb_ops vesafb_ops = { ··· 490 484 { 491 485 struct fb_info *info = platform_get_drvdata(pdev); 492 486 487 + /* vesafb_destroy takes care of info cleanup */ 493 488 unregister_framebuffer(info); 494 489 if (((struct vesafb_par *)(info->par))->region) 495 490 release_region(0x3c0, 32); 496 - framebuffer_release(info); 497 491 498 492 return 0; 499 493 }
+7 -4
fs/ceph/addr.c
··· 85 85 if (folio_test_dirty(folio)) { 86 86 dout("%p dirty_folio %p idx %lu -- already dirty\n", 87 87 mapping->host, folio, folio->index); 88 - BUG_ON(!folio_get_private(folio)); 88 + VM_BUG_ON_FOLIO(!folio_test_private(folio), folio); 89 89 return false; 90 90 } 91 91 ··· 122 122 * Reference snap context in folio->private. Also set 123 123 * PagePrivate so that we get invalidate_folio callback. 124 124 */ 125 - BUG_ON(folio_get_private(folio)); 125 + VM_BUG_ON_FOLIO(folio_test_private(folio), folio); 126 126 folio_attach_private(folio, snapc); 127 127 128 128 return ceph_fscache_dirty_folio(mapping, folio); ··· 150 150 } 151 151 152 152 WARN_ON(!folio_test_locked(folio)); 153 - if (folio_get_private(folio)) { 153 + if (folio_test_private(folio)) { 154 154 dout("%p invalidate_folio idx %lu full dirty page\n", 155 155 inode, folio->index); 156 156 ··· 729 729 730 730 /* clean all pages */ 731 731 for (i = 0; i < req->r_num_ops; i++) { 732 - if (req->r_ops[i].op != CEPH_OSD_OP_WRITE) 732 + if (req->r_ops[i].op != CEPH_OSD_OP_WRITE) { 733 + pr_warn("%s incorrect op %d req %p index %d tid %llu\n", 734 + __func__, req->r_ops[i].op, req, i, req->r_tid); 733 735 break; 736 + } 734 737 735 738 osd_data = osd_req_op_extent_osd_data(req, i); 736 739 BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);
+13 -3
fs/ceph/file.c
··· 629 629 iinfo.change_attr = 1; 630 630 ceph_encode_timespec64(&iinfo.btime, &now); 631 631 632 - iinfo.xattr_len = ARRAY_SIZE(xattr_buf); 633 - iinfo.xattr_data = xattr_buf; 634 - memset(iinfo.xattr_data, 0, iinfo.xattr_len); 632 + if (req->r_pagelist) { 633 + iinfo.xattr_len = req->r_pagelist->length; 634 + iinfo.xattr_data = req->r_pagelist->mapped_tail; 635 + } else { 636 + /* fake it */ 637 + iinfo.xattr_len = ARRAY_SIZE(xattr_buf); 638 + iinfo.xattr_data = xattr_buf; 639 + memset(iinfo.xattr_data, 0, iinfo.xattr_len); 640 + } 635 641 636 642 in.ino = cpu_to_le64(vino.ino); 637 643 in.snapid = cpu_to_le64(CEPH_NOSNAP); ··· 749 743 err = ceph_security_init_secctx(dentry, mode, &as_ctx); 750 744 if (err < 0) 751 745 goto out_ctx; 746 + /* Async create can't handle more than a page of xattrs */ 747 + if (as_ctx.pagelist && 748 + !list_is_singular(&as_ctx.pagelist->head)) 749 + try_async = false; 752 750 } else if (!d_in_lookup(dentry)) { 753 751 /* If it's not being looked up, it's negative */ 754 752 return -ENOENT;
+4
fs/fs-writeback.c
··· 1712 1712 */ 1713 1713 if (!(inode->i_state & I_DIRTY_ALL)) 1714 1714 inode_cgwb_move_to_attached(inode, wb); 1715 + else if (!(inode->i_state & I_SYNC_QUEUED) && 1716 + (inode->i_state & I_DIRTY)) 1717 + redirty_tail_locked(inode, wb); 1718 + 1715 1719 spin_unlock(&wb->list_lock); 1716 1720 inode_sync_complete(inode); 1717 1721 out:
+5 -6
fs/gfs2/bmap.c
··· 1153 1153 1154 1154 if (length != written && (iomap->flags & IOMAP_F_NEW)) { 1155 1155 /* Deallocate blocks that were just allocated. */ 1156 - loff_t blockmask = i_blocksize(inode) - 1; 1157 - loff_t end = (pos + length) & ~blockmask; 1156 + loff_t hstart = round_up(pos + written, i_blocksize(inode)); 1157 + loff_t hend = iomap->offset + iomap->length; 1158 1158 1159 - pos = (pos + written + blockmask) & ~blockmask; 1160 - if (pos < end) { 1161 - truncate_pagecache_range(inode, pos, end - 1); 1162 - punch_hole(ip, pos, end - pos); 1159 + if (hstart < hend) { 1160 + truncate_pagecache_range(inode, hstart, hend - 1); 1161 + punch_hole(ip, hstart, hend - hstart); 1163 1162 } 1164 1163 } 1165 1164
+65 -78
fs/gfs2/file.c
··· 770 770 return ret ? ret : ret1; 771 771 } 772 772 773 - static inline bool should_fault_in_pages(ssize_t ret, struct iov_iter *i, 773 + static inline bool should_fault_in_pages(struct iov_iter *i, 774 + struct kiocb *iocb, 774 775 size_t *prev_count, 775 776 size_t *window_size) 776 777 { 777 778 size_t count = iov_iter_count(i); 778 779 size_t size, offs; 779 780 780 - if (likely(!count)) 781 - return false; 782 - if (ret <= 0 && ret != -EFAULT) 781 + if (!count) 783 782 return false; 784 783 if (!iter_is_iovec(i)) 785 784 return false; 786 785 787 786 size = PAGE_SIZE; 788 - offs = offset_in_page(i->iov[0].iov_base + i->iov_offset); 787 + offs = offset_in_page(iocb->ki_pos); 789 788 if (*prev_count != count || !*window_size) { 790 789 size_t nr_dirtied; 791 790 792 - size = ALIGN(offs + count, PAGE_SIZE); 793 - size = min_t(size_t, size, SZ_1M); 794 791 nr_dirtied = max(current->nr_dirtied_pause - 795 792 current->nr_dirtied, 8); 796 - size = min(size, nr_dirtied << PAGE_SHIFT); 793 + size = min_t(size_t, SZ_1M, nr_dirtied << PAGE_SHIFT); 797 794 } 798 795 799 796 *prev_count = count; ··· 804 807 struct file *file = iocb->ki_filp; 805 808 struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); 806 809 size_t prev_count = 0, window_size = 0; 807 - size_t written = 0; 810 + size_t read = 0; 808 811 ssize_t ret; 809 812 810 813 /* ··· 832 835 ret = gfs2_glock_nq(gh); 833 836 if (ret) 834 837 goto out_uninit; 835 - retry_under_glock: 836 838 pagefault_disable(); 837 839 to->nofault = true; 838 840 ret = iomap_dio_rw(iocb, to, &gfs2_iomap_ops, NULL, 839 - IOMAP_DIO_PARTIAL, written); 841 + IOMAP_DIO_PARTIAL, read); 840 842 to->nofault = false; 841 843 pagefault_enable(); 844 + if (ret <= 0 && ret != -EFAULT) 845 + goto out_unlock; 842 846 if (ret > 0) 843 - written = ret; 847 + read = ret; 844 848 845 - if (should_fault_in_pages(ret, to, &prev_count, &window_size)) { 846 - size_t leftover; 847 - 848 - gfs2_holder_allow_demote(gh); 849 - leftover = fault_in_iov_iter_writeable(to, window_size); 850 - gfs2_holder_disallow_demote(gh); 851 - if (leftover != window_size) { 852 - if (gfs2_holder_queued(gh)) 853 - goto retry_under_glock; 849 + if (should_fault_in_pages(to, iocb, &prev_count, &window_size)) { 850 + gfs2_glock_dq(gh); 851 + window_size -= fault_in_iov_iter_writeable(to, window_size); 852 + if (window_size) 854 853 goto retry; 855 - } 856 854 } 855 + out_unlock: 857 856 if (gfs2_holder_queued(gh)) 858 857 gfs2_glock_dq(gh); 859 858 out_uninit: 860 859 gfs2_holder_uninit(gh); 861 860 if (ret < 0) 862 861 return ret; 863 - return written; 862 + return read; 864 863 } 865 864 866 865 static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from, ··· 866 873 struct inode *inode = file->f_mapping->host; 867 874 struct gfs2_inode *ip = GFS2_I(inode); 868 875 size_t prev_count = 0, window_size = 0; 869 - size_t read = 0; 876 + size_t written = 0; 870 877 ssize_t ret; 871 878 872 879 /* ··· 894 901 goto out_uninit; 895 902 /* Silently fall back to buffered I/O when writing beyond EOF */ 896 903 if (iocb->ki_pos + iov_iter_count(from) > i_size_read(&ip->i_inode)) 897 - goto out; 898 - retry_under_glock: 904 + goto out_unlock; 899 905 900 906 from->nofault = true; 901 907 ret = iomap_dio_rw(iocb, from, &gfs2_iomap_ops, NULL, 902 - IOMAP_DIO_PARTIAL, read); 908 + IOMAP_DIO_PARTIAL, written); 903 909 from->nofault = false; 904 - 905 - if (ret == -ENOTBLK) 906 - ret = 0; 907 - if (ret > 0) 908 - read = ret; 909 - 910 - if (should_fault_in_pages(ret, from, &prev_count, &window_size)) { 911 - size_t leftover; 912 - 913 - gfs2_holder_allow_demote(gh); 914 - leftover = fault_in_iov_iter_readable(from, window_size); 915 - gfs2_holder_disallow_demote(gh); 916 - if (leftover != window_size) { 917 - if (gfs2_holder_queued(gh)) 918 - goto retry_under_glock; 919 - goto retry; 920 - } 910 + if (ret <= 0) { 911 + if (ret == -ENOTBLK) 912 + ret = 0; 913 + if (ret != -EFAULT) 914 + goto out_unlock; 921 915 } 922 - out: 916 + if (ret > 0) 917 + written = ret; 918 + 919 + if (should_fault_in_pages(from, iocb, &prev_count, &window_size)) { 920 + gfs2_glock_dq(gh); 921 + window_size -= fault_in_iov_iter_readable(from, window_size); 922 + if (window_size) 923 + goto retry; 924 + } 925 + out_unlock: 923 926 if (gfs2_holder_queued(gh)) 924 927 gfs2_glock_dq(gh); 925 928 out_uninit: 926 929 gfs2_holder_uninit(gh); 927 930 if (ret < 0) 928 931 return ret; 929 - return read; 932 + return written; 930 933 } 931 934 932 935 static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to) ··· 930 941 struct gfs2_inode *ip; 931 942 struct gfs2_holder gh; 932 943 size_t prev_count = 0, window_size = 0; 933 - size_t written = 0; 944 + size_t read = 0; 934 945 ssize_t ret; 935 946 936 947 /* ··· 951 962 if (ret >= 0) { 952 963 if (!iov_iter_count(to)) 953 964 return ret; 954 - written = ret; 965 + read = ret; 955 966 } else if (ret != -EFAULT) { 956 967 if (ret != -EAGAIN) 957 968 return ret; ··· 964 975 ret = gfs2_glock_nq(&gh); 965 976 if (ret) 966 977 goto out_uninit; 967 - retry_under_glock: 968 978 pagefault_disable(); 969 979 ret = generic_file_read_iter(iocb, to); 970 980 pagefault_enable(); 981 + if (ret <= 0 && ret != -EFAULT) 982 + goto out_unlock; 971 983 if (ret > 0) 972 - written += ret; 984 + read += ret; 973 985 974 - if (should_fault_in_pages(ret, to, &prev_count, &window_size)) { 975 - size_t leftover; 976 - 977 - gfs2_holder_allow_demote(&gh); 978 - leftover = fault_in_iov_iter_writeable(to, window_size); 979 - gfs2_holder_disallow_demote(&gh); 980 - if (leftover != window_size) { 981 - if (gfs2_holder_queued(&gh)) 982 - goto retry_under_glock; 986 + if (should_fault_in_pages(to, iocb, &prev_count, &window_size)) { 987 + gfs2_glock_dq(&gh); 988 + window_size -= fault_in_iov_iter_writeable(to, window_size); 989 + if (window_size) 983 990 goto retry; 984 - } 985 991 } 992 + out_unlock: 986 993 if (gfs2_holder_queued(&gh)) 987 994 gfs2_glock_dq(&gh); 988 995 out_uninit: 989 996 gfs2_holder_uninit(&gh); 990 - return written ? written : ret; 997 + return read ? read : ret; 991 998 } 992 999 993 1000 static ssize_t gfs2_file_buffered_write(struct kiocb *iocb, ··· 997 1012 struct gfs2_holder *statfs_gh = NULL; 998 1013 size_t prev_count = 0, window_size = 0; 999 1014 size_t orig_count = iov_iter_count(from); 1000 - size_t read = 0; 1015 + size_t written = 0; 1001 1016 ssize_t ret; 1002 1017 1003 1018 /* ··· 1015 1030 1016 1031 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, gh); 1017 1032 retry: 1033 + if (should_fault_in_pages(from, iocb, &prev_count, &window_size)) { 1034 + window_size -= fault_in_iov_iter_readable(from, window_size); 1035 + if (!window_size) { 1036 + ret = -EFAULT; 1037 + goto out_uninit; 1038 + } 1039 + from->count = min(from->count, window_size); 1040 + } 1018 1041 ret = gfs2_glock_nq(gh); 1019 1042 if (ret) 1020 1043 goto out_uninit; 1021 - retry_under_glock: 1044 + 1022 1045 if (inode == sdp->sd_rindex) { 1023 1046 struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); 1024 1047 ··· 1043 1050 current->backing_dev_info = NULL; 1044 1051 if (ret > 0) { 1045 1052 iocb->ki_pos += ret; 1046 - read += ret; 1053 + written += ret; 1047 1054 } 1048 1055 1049 1056 if (inode == sdp->sd_rindex) 1050 1057 gfs2_glock_dq_uninit(statfs_gh); 1051 1058 1052 - from->count = orig_count - read; 1053 - if (should_fault_in_pages(ret, from, &prev_count, &window_size)) { 1054 - size_t leftover; 1059 + if (ret <= 0 && ret != -EFAULT) 1060 + goto out_unlock; 1055 1061 1056 - gfs2_holder_allow_demote(gh); 1057 - leftover = fault_in_iov_iter_readable(from, window_size); 1058 - gfs2_holder_disallow_demote(gh); 1059 - if (leftover != window_size) { 1060 - from->count = min(from->count, window_size - leftover); 1061 - if (gfs2_holder_queued(gh)) 1062 - goto retry_under_glock; 1063 - goto retry; 1064 - } 1062 + from->count = orig_count - written; 1063 + if (should_fault_in_pages(from, iocb, &prev_count, &window_size)) { 1064 + gfs2_glock_dq(gh); 1065 + goto retry; 1065 1066 } 1066 1067 out_unlock: 1067 1068 if (gfs2_holder_queued(gh)) ··· 1064 1077 gfs2_holder_uninit(gh); 1065 1078 if (statfs_gh) 1066 1079 kfree(statfs_gh); 1067 - from->count = orig_count - read; 1068 - return read ? read : ret; 1080 + from->count = orig_count - written; 1081 + return written ? written : ret; 1069 1082 } 1070 1083 1071 1084 /**
+1 -1
fs/nfs/fs_context.c
··· 517 517 if (result.negated) 518 518 ctx->flags &= ~NFS_MOUNT_SOFTREVAL; 519 519 else 520 - ctx->flags &= NFS_MOUNT_SOFTREVAL; 520 + ctx->flags |= NFS_MOUNT_SOFTREVAL; 521 521 break; 522 522 case Opt_posix: 523 523 if (result.negated)
+13
fs/notify/fanotify/fanotify_user.c
··· 1657 1657 else 1658 1658 mnt = path.mnt; 1659 1659 1660 + /* 1661 + * FAN_RENAME is not allowed on non-dir (for now). 1662 + * We shouldn't have allowed setting any dirent events in mask of 1663 + * non-dir, but because we always allowed it, error only if group 1664 + * was initialized with the new flag FAN_REPORT_TARGET_FID. 1665 + */ 1666 + ret = -ENOTDIR; 1667 + if (inode && !S_ISDIR(inode->i_mode) && 1668 + ((mask & FAN_RENAME) || 1669 + ((mask & FANOTIFY_DIRENT_EVENTS) && 1670 + FAN_GROUP_FLAG(group, FAN_REPORT_TARGET_FID)))) 1671 + goto path_put_and_out; 1672 + 1660 1673 /* Mask out FAN_EVENT_ON_CHILD flag for sb/mount/non-dir marks */ 1661 1674 if (mnt || !S_ISDIR(inode->i_mode)) { 1662 1675 mask &= ~FAN_EVENT_ON_CHILD;
+22 -1
fs/proc/fd.c
··· 72 72 return 0; 73 73 } 74 74 75 - static int seq_fdinfo_open(struct inode *inode, struct file *file) 75 + static int proc_fdinfo_access_allowed(struct inode *inode) 76 76 { 77 77 bool allowed = false; 78 78 struct task_struct *task = get_proc_task(inode); ··· 85 85 86 86 if (!allowed) 87 87 return -EACCES; 88 + 89 + return 0; 90 + } 91 + 92 + static int seq_fdinfo_open(struct inode *inode, struct file *file) 93 + { 94 + int ret = proc_fdinfo_access_allowed(inode); 95 + 96 + if (ret) 97 + return ret; 88 98 89 99 return single_open(file, seq_show, inode); 90 100 } ··· 358 348 proc_fdinfo_instantiate); 359 349 } 360 350 351 + static int proc_open_fdinfo(struct inode *inode, struct file *file) 352 + { 353 + int ret = proc_fdinfo_access_allowed(inode); 354 + 355 + if (ret) 356 + return ret; 357 + 358 + return 0; 359 + } 360 + 361 361 const struct inode_operations proc_fdinfo_inode_operations = { 362 362 .lookup = proc_lookupfdinfo, 363 363 .setattr = proc_setattr, 364 364 }; 365 365 366 366 const struct file_operations proc_fdinfo_operations = { 367 + .open = proc_open_fdinfo, 367 368 .read = generic_read_dir, 368 369 .iterate_shared = proc_readfdinfo, 369 370 .llseek = generic_file_llseek,
+4 -4
fs/udf/namei.c
··· 75 75 76 76 if (fileident) { 77 77 if (adinicb || (offset + lfi < 0)) { 78 - memcpy(udf_get_fi_ident(sfi), fileident, lfi); 78 + memcpy(sfi->impUse + liu, fileident, lfi); 79 79 } else if (offset >= 0) { 80 80 memcpy(fibh->ebh->b_data + offset, fileident, lfi); 81 81 } else { 82 - memcpy(udf_get_fi_ident(sfi), fileident, -offset); 82 + memcpy(sfi->impUse + liu, fileident, -offset); 83 83 memcpy(fibh->ebh->b_data, fileident - offset, 84 84 lfi + offset); 85 85 } ··· 88 88 offset += lfi; 89 89 90 90 if (adinicb || (offset + padlen < 0)) { 91 - memset(udf_get_fi_ident(sfi) + lfi, 0x00, padlen); 91 + memset(sfi->impUse + liu + lfi, 0x00, padlen); 92 92 } else if (offset >= 0) { 93 93 memset(fibh->ebh->b_data + offset, 0x00, padlen); 94 94 } else { 95 - memset(udf_get_fi_ident(sfi) + lfi, 0x00, -offset); 95 + memset(sfi->impUse + liu + lfi, 0x00, -offset); 96 96 memset(fibh->ebh->b_data, 0x00, padlen + offset); 97 97 } 98 98
+2 -2
include/linux/netdev_features.h
··· 169 169 #define NETIF_F_HW_HSR_FWD __NETIF_F(HW_HSR_FWD) 170 170 #define NETIF_F_HW_HSR_DUP __NETIF_F(HW_HSR_DUP) 171 171 172 - /* Finds the next feature with the highest number of the range of start till 0. 172 + /* Finds the next feature with the highest number of the range of start-1 till 0. 173 173 */ 174 174 static inline int find_next_netdev_feature(u64 feature, unsigned long start) 175 175 { ··· 188 188 for ((bit) = find_next_netdev_feature((mask_addr), \ 189 189 NETDEV_FEATURE_COUNT); \ 190 190 (bit) >= 0; \ 191 - (bit) = find_next_netdev_feature((mask_addr), (bit) - 1)) 191 + (bit) = find_next_netdev_feature((mask_addr), (bit))) 192 192 193 193 /* Features valid for ethtool to change */ 194 194 /* = all defined minus driver/device-class-related */
+1 -1
include/linux/sunrpc/clnt.h
··· 160 160 #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) 161 161 #define RPC_CLNT_CREATE_SOFTERR (1UL << 10) 162 162 #define RPC_CLNT_CREATE_REUSEPORT (1UL << 11) 163 - #define RPC_CLNT_CREATE_IGNORE_NULL_UNAVAIL (1UL << 12) 163 + #define RPC_CLNT_CREATE_CONNECTED (1UL << 12) 164 164 165 165 struct rpc_clnt *rpc_create(struct rpc_create_args *args); 166 166 struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
+3
include/net/bluetooth/hci_core.h
··· 36 36 /* HCI priority */ 37 37 #define HCI_PRIO_MAX 7 38 38 39 + /* HCI maximum id value */ 40 + #define HCI_MAX_ID 10000 41 + 39 42 /* HCI Core structures */ 40 43 struct inquiry_data { 41 44 bdaddr_t bdaddr;
+1
include/net/tc_act/tc_pedit.h
··· 14 14 struct tc_action common; 15 15 unsigned char tcfp_nkeys; 16 16 unsigned char tcfp_flags; 17 + u32 tcfp_off_max_hint; 17 18 struct tc_pedit_key *tcfp_keys; 18 19 struct tcf_pedit_key_ex *tcfp_keys_ex; 19 20 };
+1 -1
include/soc/mscc/ocelot_vcap.h
··· 681 681 682 682 struct ocelot_vcap_filter { 683 683 struct list_head list; 684 - struct list_head trap_list; 685 684 686 685 enum ocelot_vcap_filter_type type; 687 686 int block_id; ··· 694 695 struct ocelot_vcap_stats stats; 695 696 /* For VCAP IS1 and IS2 */ 696 697 bool take_ts; 698 + bool is_trap; 697 699 unsigned long ingress_port_mask; 698 700 /* For VCAP ES0 */ 699 701 struct ocelot_vcap_port ingress_port;
+3 -3
include/trace/events/sched.h
··· 222 222 TRACE_EVENT(sched_switch, 223 223 224 224 TP_PROTO(bool preempt, 225 - unsigned int prev_state, 226 225 struct task_struct *prev, 227 - struct task_struct *next), 226 + struct task_struct *next, 227 + unsigned int prev_state), 228 228 229 - TP_ARGS(preempt, prev_state, prev, next), 229 + TP_ARGS(preempt, prev, next, prev_state), 230 230 231 231 TP_STRUCT__entry( 232 232 __array( char, prev_comm, TASK_COMM_LEN )
+1 -1
include/uapi/linux/rfkill.h
··· 184 184 #define RFKILL_IOC_NOINPUT 1 185 185 #define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT) 186 186 #define RFKILL_IOC_MAX_SIZE 2 187 - #define RFKILL_IOCTL_MAX_SIZE _IOW(RFKILL_IOC_MAGIC, RFKILL_IOC_EXT_SIZE, __u32) 187 + #define RFKILL_IOCTL_MAX_SIZE _IOW(RFKILL_IOC_MAGIC, RFKILL_IOC_MAX_SIZE, __u32) 188 188 189 189 /* and that's all userspace gets */ 190 190
+5 -2
kernel/cgroup/cpuset.c
··· 3390 3390 */ 3391 3391 void __init cpuset_init_smp(void) 3392 3392 { 3393 - cpumask_copy(top_cpuset.cpus_allowed, cpu_active_mask); 3394 - top_cpuset.mems_allowed = node_states[N_MEMORY]; 3393 + /* 3394 + * cpus_allowd/mems_allowed set to v2 values in the initial 3395 + * cpuset_bind() call will be reset to v1 values in another 3396 + * cpuset_bind() call when v1 cpuset is mounted. 3397 + */ 3395 3398 top_cpuset.old_mems_allowed = top_cpuset.mems_allowed; 3396 3399 3397 3400 cpumask_copy(top_cpuset.effective_cpus, cpu_active_mask);
-1
kernel/irq/irqdesc.c
··· 701 701 */ 702 702 int generic_handle_domain_irq(struct irq_domain *domain, unsigned int hwirq) 703 703 { 704 - WARN_ON_ONCE(!in_hardirq()); 705 704 return handle_irq_desc(irq_resolve_mapping(domain, hwirq)); 706 705 } 707 706 EXPORT_SYMBOL_GPL(generic_handle_domain_irq);
+1 -1
kernel/sched/core.c
··· 6382 6382 migrate_disable_switch(rq, prev); 6383 6383 psi_sched_switch(prev, next, !task_on_rq_queued(prev)); 6384 6384 6385 - trace_sched_switch(sched_mode & SM_MASK_PREEMPT, prev_state, prev, next); 6385 + trace_sched_switch(sched_mode & SM_MASK_PREEMPT, prev, next, prev_state); 6386 6386 6387 6387 /* Also unlocks the rq: */ 6388 6388 rq = context_switch(rq, prev, next, &rf);
+2 -2
kernel/trace/fgraph.c
··· 404 404 405 405 static void 406 406 ftrace_graph_probe_sched_switch(void *ignore, bool preempt, 407 - unsigned int prev_state, 408 407 struct task_struct *prev, 409 - struct task_struct *next) 408 + struct task_struct *next, 409 + unsigned int prev_state) 410 410 { 411 411 unsigned long long timestamp; 412 412 int index;
+2 -2
kernel/trace/ftrace.c
··· 7420 7420 7421 7421 static void 7422 7422 ftrace_filter_pid_sched_switch_probe(void *data, bool preempt, 7423 - unsigned int prev_state, 7424 7423 struct task_struct *prev, 7425 - struct task_struct *next) 7424 + struct task_struct *next, 7425 + unsigned int prev_state) 7426 7426 { 7427 7427 struct trace_array *tr = data; 7428 7428 struct trace_pid_list *pid_list;
+4 -4
kernel/trace/trace_events.c
··· 773 773 774 774 static void 775 775 event_filter_pid_sched_switch_probe_pre(void *data, bool preempt, 776 - unsigned int prev_state, 777 776 struct task_struct *prev, 778 - struct task_struct *next) 777 + struct task_struct *next, 778 + unsigned int prev_state) 779 779 { 780 780 struct trace_array *tr = data; 781 781 struct trace_pid_list *no_pid_list; ··· 799 799 800 800 static void 801 801 event_filter_pid_sched_switch_probe_post(void *data, bool preempt, 802 - unsigned int prev_state, 803 802 struct task_struct *prev, 804 - struct task_struct *next) 803 + struct task_struct *next, 804 + unsigned int prev_state) 805 805 { 806 806 struct trace_array *tr = data; 807 807 struct trace_pid_list *no_pid_list;
+2 -2
kernel/trace/trace_osnoise.c
··· 1168 1168 */ 1169 1169 static void 1170 1170 trace_sched_switch_callback(void *data, bool preempt, 1171 - unsigned int prev_state, 1172 1171 struct task_struct *p, 1173 - struct task_struct *n) 1172 + struct task_struct *n, 1173 + unsigned int prev_state) 1174 1174 { 1175 1175 struct osnoise_variables *osn_var = this_cpu_osn_var(); 1176 1176
+2 -2
kernel/trace/trace_sched_switch.c
··· 22 22 23 23 static void 24 24 probe_sched_switch(void *ignore, bool preempt, 25 - unsigned int prev_state, 26 - struct task_struct *prev, struct task_struct *next) 25 + struct task_struct *prev, struct task_struct *next, 26 + unsigned int prev_state) 27 27 { 28 28 int flags; 29 29
+2 -2
kernel/trace/trace_sched_wakeup.c
··· 426 426 427 427 static void notrace 428 428 probe_wakeup_sched_switch(void *ignore, bool preempt, 429 - unsigned int prev_state, 430 - struct task_struct *prev, struct task_struct *next) 429 + struct task_struct *prev, struct task_struct *next, 430 + unsigned int prev_state) 431 431 { 432 432 struct trace_array_cpu *data; 433 433 u64 T0, T1, delta;
+22 -22
lib/dim/net_dim.c
··· 12 12 * Each profile size must be of NET_DIM_PARAMS_NUM_PROFILES 13 13 */ 14 14 #define NET_DIM_PARAMS_NUM_PROFILES 5 15 - #define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256 16 - #define NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE 128 15 + #define NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE 256 16 + #define NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE 128 17 17 #define NET_DIM_DEF_PROFILE_CQE 1 18 18 #define NET_DIM_DEF_PROFILE_EQE 1 19 19 20 20 #define NET_DIM_RX_EQE_PROFILES { \ 21 - {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 22 - {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 23 - {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 24 - {128, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 25 - {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 21 + {.usec = 1, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,}, \ 22 + {.usec = 8, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,}, \ 23 + {.usec = 64, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,}, \ 24 + {.usec = 128, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,}, \ 25 + {.usec = 256, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,} \ 26 26 } 27 27 28 28 #define NET_DIM_RX_CQE_PROFILES { \ 29 - {2, 256}, \ 30 - {8, 128}, \ 31 - {16, 64}, \ 32 - {32, 64}, \ 33 - {64, 64} \ 29 + {.usec = 2, .pkts = 256,}, \ 30 + {.usec = 8, .pkts = 128,}, \ 31 + {.usec = 16, .pkts = 64,}, \ 32 + {.usec = 32, .pkts = 64,}, \ 33 + {.usec = 64, .pkts = 64,} \ 34 34 } 35 35 36 36 #define NET_DIM_TX_EQE_PROFILES { \ 37 - {1, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 38 - {8, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 39 - {32, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 40 - {64, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ 41 - {128, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE} \ 37 + {.usec = 1, .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,}, \ 38 + {.usec = 8, .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,}, \ 39 + {.usec = 32, .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,}, \ 40 + {.usec = 64, .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,}, \ 41 + {.usec = 128, .pkts = NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE,} \ 42 42 } 43 43 44 44 #define NET_DIM_TX_CQE_PROFILES { \ 45 - {5, 128}, \ 46 - {8, 64}, \ 47 - {16, 32}, \ 48 - {32, 32}, \ 49 - {64, 32} \ 45 + {.usec = 5, .pkts = 128,}, \ 46 + {.usec = 8, .pkts = 64,}, \ 47 + {.usec = 16, .pkts = 32,}, \ 48 + {.usec = 32, .pkts = 32,}, \ 49 + {.usec = 64, .pkts = 32,} \ 50 50 } 51 51 52 52 static const struct dim_cq_moder
+6 -1
mm/huge_memory.c
··· 2495 2495 struct address_space *mapping = NULL; 2496 2496 int extra_pins, ret; 2497 2497 pgoff_t end; 2498 + bool is_hzp; 2498 2499 2499 - VM_BUG_ON_PAGE(is_huge_zero_page(head), head); 2500 2500 VM_BUG_ON_PAGE(!PageLocked(head), head); 2501 2501 VM_BUG_ON_PAGE(!PageCompound(head), head); 2502 + 2503 + is_hzp = is_huge_zero_page(head); 2504 + VM_WARN_ON_ONCE_PAGE(is_hzp, head); 2505 + if (is_hzp) 2506 + return -EBUSY; 2502 2507 2503 2508 if (PageWriteback(head)) 2504 2509 return -EBUSY;
+10
mm/kfence/core.c
··· 621 621 * fails for the first page, and therefore expect addr==__kfence_pool in 622 622 * most failure cases. 623 623 */ 624 + for (char *p = (char *)addr; p < __kfence_pool + KFENCE_POOL_SIZE; p += PAGE_SIZE) { 625 + struct slab *slab = virt_to_slab(p); 626 + 627 + if (!slab) 628 + continue; 629 + #ifdef CONFIG_MEMCG 630 + slab->memcg_data = 0; 631 + #endif 632 + __folio_clear_slab(slab_folio(slab)); 633 + } 624 634 memblock_free_late(__pa(addr), KFENCE_POOL_SIZE - (addr - (unsigned long)__kfence_pool)); 625 635 __kfence_pool = NULL; 626 636 return false;
+1 -14
mm/memory-failure.c
··· 1274 1274 } 1275 1275 out: 1276 1276 if (ret == -EIO) 1277 - dump_page(p, "hwpoison: unhandlable page"); 1277 + pr_err("Memory failure: %#lx: unhandlable page.\n", page_to_pfn(p)); 1278 1278 1279 1279 return ret; 1280 1280 } ··· 1860 1860 } 1861 1861 1862 1862 if (PageTransHuge(hpage)) { 1863 - /* 1864 - * Bail out before SetPageHasHWPoisoned() if hpage is 1865 - * huge_zero_page, although PG_has_hwpoisoned is not 1866 - * checked in set_huge_zero_page(). 1867 - * 1868 - * TODO: Handle memory failure of huge_zero_page thoroughly. 1869 - */ 1870 - if (is_huge_zero_page(hpage)) { 1871 - action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED); 1872 - res = -EBUSY; 1873 - goto unlock_mutex; 1874 - } 1875 - 1876 1863 /* 1877 1864 * The flag must be set after the refcount is bumped 1878 1865 * otherwise it may race with THP split.
+1 -1
mm/mremap.c
··· 947 947 return -EINTR; 948 948 vma = vma_lookup(mm, addr); 949 949 if (!vma) { 950 - ret = EFAULT; 950 + ret = -EFAULT; 951 951 goto out; 952 952 } 953 953
+11
net/batman-adv/fragmentation.c
··· 475 475 goto free_skb; 476 476 } 477 477 478 + /* GRO might have added fragments to the fragment list instead of 479 + * frags[]. But this is not handled by skb_split and must be 480 + * linearized to avoid incorrect length information after all 481 + * batman-adv fragments were created and submitted to the 482 + * hard-interface 483 + */ 484 + if (skb_has_frag_list(skb) && __skb_linearize(skb)) { 485 + ret = -ENOMEM; 486 + goto free_skb; 487 + } 488 + 478 489 /* Create one header to be copied to all fragments */ 479 490 frag_header.packet_type = BATADV_UNICAST_FRAG; 480 491 frag_header.version = BATADV_COMPAT_VERSION;
+3 -3
net/bluetooth/hci_core.c
··· 2555 2555 */ 2556 2556 switch (hdev->dev_type) { 2557 2557 case HCI_PRIMARY: 2558 - id = ida_simple_get(&hci_index_ida, 0, 0, GFP_KERNEL); 2558 + id = ida_simple_get(&hci_index_ida, 0, HCI_MAX_ID, GFP_KERNEL); 2559 2559 break; 2560 2560 case HCI_AMP: 2561 - id = ida_simple_get(&hci_index_ida, 1, 0, GFP_KERNEL); 2561 + id = ida_simple_get(&hci_index_ida, 1, HCI_MAX_ID, GFP_KERNEL); 2562 2562 break; 2563 2563 default: 2564 2564 return -EINVAL; ··· 2567 2567 if (id < 0) 2568 2568 return id; 2569 2569 2570 - sprintf(hdev->name, "hci%d", id); 2570 + snprintf(hdev->name, sizeof(hdev->name), "hci%d", id); 2571 2571 hdev->id = id; 2572 2572 2573 2573 BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
+3 -1
net/core/skbuff.c
··· 3897 3897 unsigned int delta_len = 0; 3898 3898 struct sk_buff *tail = NULL; 3899 3899 struct sk_buff *nskb, *tmp; 3900 - int err; 3900 + int len_diff, err; 3901 3901 3902 3902 skb_push(skb, -skb_network_offset(skb) + offset); 3903 3903 ··· 3937 3937 skb_push(nskb, -skb_network_offset(nskb) + offset); 3938 3938 3939 3939 skb_release_head_state(nskb); 3940 + len_diff = skb_network_header_len(nskb) - skb_network_header_len(skb); 3940 3941 __copy_skb_header(nskb, skb); 3941 3942 3942 3943 skb_headers_offset_update(nskb, skb_headroom(nskb) - skb_headroom(skb)); 3944 + nskb->transport_header += len_diff; 3943 3945 skb_copy_from_linear_data_offset(skb, -tnl_hlen, 3944 3946 nskb->data - tnl_hlen, 3945 3947 offset + tnl_hlen);
+2 -2
net/decnet/dn_dev.c
··· 854 854 memcpy(msg->neighbor, dn_hiord, ETH_ALEN); 855 855 856 856 if (dn_db->router) { 857 - struct dn_neigh *dn = (struct dn_neigh *)dn_db->router; 857 + struct dn_neigh *dn = container_of(dn_db->router, struct dn_neigh, n); 858 858 dn_dn2eth(msg->neighbor, dn->addr); 859 859 } 860 860 ··· 902 902 { 903 903 int n; 904 904 struct dn_dev *dn_db = rcu_dereference_raw(dev->dn_ptr); 905 - struct dn_neigh *dn = (struct dn_neigh *)dn_db->router; 905 + struct dn_neigh *dn = container_of(dn_db->router, struct dn_neigh, n); 906 906 struct sk_buff *skb; 907 907 size_t size; 908 908 unsigned char *ptr;
+2 -1
net/decnet/dn_neigh.c
··· 426 426 if (!dn_db->router) { 427 427 dn_db->router = neigh_clone(neigh); 428 428 } else { 429 - if (msg->priority > ((struct dn_neigh *)dn_db->router)->priority) 429 + if (msg->priority > container_of(dn_db->router, 430 + struct dn_neigh, n)->priority) 430 431 neigh_release(xchg(&dn_db->router, neigh_clone(neigh))); 431 432 } 432 433 }
+2 -2
net/decnet/dn_route.c
··· 1120 1120 /* Ok then, we assume its directly connected and move on */ 1121 1121 select_source: 1122 1122 if (neigh) 1123 - gateway = ((struct dn_neigh *)neigh)->addr; 1123 + gateway = container_of(neigh, struct dn_neigh, n)->addr; 1124 1124 if (gateway == 0) 1125 1125 gateway = fld.daddr; 1126 1126 if (fld.saddr == 0) { ··· 1429 1429 /* Use the default router if there is one */ 1430 1430 neigh = neigh_clone(dn_db->router); 1431 1431 if (neigh) { 1432 - gateway = ((struct dn_neigh *)neigh)->addr; 1432 + gateway = container_of(neigh, struct dn_neigh, n)->addr; 1433 1433 goto make_route; 1434 1434 } 1435 1435
+1
net/dsa/port.c
··· 451 451 switchdev_bridge_port_unoffload(brport_dev, dp, 452 452 &dsa_slave_switchdev_notifier, 453 453 &dsa_slave_switchdev_blocking_notifier); 454 + dsa_flush_workqueue(); 454 455 out_rollback_unbridge: 455 456 dsa_broadcast(DSA_NOTIFIER_BRIDGE_LEAVE, &info); 456 457 out_rollback:
+11 -1
net/ipv4/ping.c
··· 305 305 struct net *net = sock_net(sk); 306 306 if (sk->sk_family == AF_INET) { 307 307 struct sockaddr_in *addr = (struct sockaddr_in *) uaddr; 308 + u32 tb_id = RT_TABLE_LOCAL; 308 309 int chk_addr_ret; 309 310 310 311 if (addr_len < sizeof(*addr)) ··· 319 318 pr_debug("ping_check_bind_addr(sk=%p,addr=%pI4,port=%d)\n", 320 319 sk, &addr->sin_addr.s_addr, ntohs(addr->sin_port)); 321 320 322 - chk_addr_ret = inet_addr_type(net, addr->sin_addr.s_addr); 321 + tb_id = l3mdev_fib_table_by_index(net, sk->sk_bound_dev_if) ? : tb_id; 322 + chk_addr_ret = inet_addr_type_table(net, addr->sin_addr.s_addr, tb_id); 323 323 324 324 if (!inet_addr_valid_or_nonlocal(net, inet_sk(sk), 325 325 addr->sin_addr.s_addr, ··· 352 350 rcu_read_lock(); 353 351 if (addr->sin6_scope_id) { 354 352 dev = dev_get_by_index_rcu(net, addr->sin6_scope_id); 353 + if (!dev) { 354 + rcu_read_unlock(); 355 + return -ENODEV; 356 + } 357 + } 358 + 359 + if (!dev && sk->sk_bound_dev_if) { 360 + dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if); 355 361 if (!dev) { 356 362 rcu_read_unlock(); 357 363 return -ENODEV;
+1
net/ipv4/route.c
··· 1753 1753 #endif 1754 1754 RT_CACHE_STAT_INC(in_slow_mc); 1755 1755 1756 + skb_dst_drop(skb); 1756 1757 skb_dst_set(skb, &rth->dst); 1757 1758 return 0; 1758 1759 }
+6
net/mac80211/mlme.c
··· 3657 3657 cbss->transmitted_bss->bssid); 3658 3658 bss_conf->bssid_indicator = cbss->max_bssid_indicator; 3659 3659 bss_conf->bssid_index = cbss->bssid_index; 3660 + } else { 3661 + bss_conf->nontransmitted = false; 3662 + memset(bss_conf->transmitter_bssid, 0, 3663 + sizeof(bss_conf->transmitter_bssid)); 3664 + bss_conf->bssid_indicator = 0; 3665 + bss_conf->bssid_index = 0; 3660 3666 } 3661 3667 3662 3668 /*
+1 -2
net/mac80211/rx.c
··· 1405 1405 goto dont_reorder; 1406 1406 1407 1407 /* not part of a BA session */ 1408 - if (ack_policy != IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK && 1409 - ack_policy != IEEE80211_QOS_CTL_ACK_POLICY_NORMAL) 1408 + if (ack_policy == IEEE80211_QOS_CTL_ACK_POLICY_NOACK) 1410 1409 goto dont_reorder; 1411 1410 1412 1411 /* new, potentially un-ordered, ampdu frame - process it */
-1
net/netlink/af_netlink.c
··· 1975 1975 copied = len; 1976 1976 } 1977 1977 1978 - skb_reset_transport_header(data_skb); 1979 1978 err = skb_copy_datagram_msg(data_skb, 0, msg, copied); 1980 1979 1981 1980 if (msg->msg_name) {
+9 -3
net/rds/tcp.c
··· 487 487 /* All module specific customizations to the RDS-TCP socket should be done in 488 488 * rds_tcp_tune() and applied after socket creation. 489 489 */ 490 - void rds_tcp_tune(struct socket *sock) 490 + bool rds_tcp_tune(struct socket *sock) 491 491 { 492 492 struct sock *sk = sock->sk; 493 493 struct net *net = sock_net(sk); 494 - struct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid); 494 + struct rds_tcp_net *rtn; 495 495 496 496 tcp_sock_set_nodelay(sock->sk); 497 497 lock_sock(sk); ··· 499 499 * a process which created this net namespace terminated. 500 500 */ 501 501 if (!sk->sk_net_refcnt) { 502 + if (!maybe_get_net(net)) { 503 + release_sock(sk); 504 + return false; 505 + } 502 506 sk->sk_net_refcnt = 1; 503 - get_net_track(net, &sk->ns_tracker, GFP_KERNEL); 507 + netns_tracker_alloc(net, &sk->ns_tracker, GFP_KERNEL); 504 508 sock_inuse_add(net, 1); 505 509 } 510 + rtn = net_generic(net, rds_tcp_netid); 506 511 if (rtn->sndbuf_size > 0) { 507 512 sk->sk_sndbuf = rtn->sndbuf_size; 508 513 sk->sk_userlocks |= SOCK_SNDBUF_LOCK; ··· 517 512 sk->sk_userlocks |= SOCK_RCVBUF_LOCK; 518 513 } 519 514 release_sock(sk); 515 + return true; 520 516 } 521 517 522 518 static void rds_tcp_accept_worker(struct work_struct *work)
+1 -1
net/rds/tcp.h
··· 49 49 }; 50 50 51 51 /* tcp.c */ 52 - void rds_tcp_tune(struct socket *sock); 52 + bool rds_tcp_tune(struct socket *sock); 53 53 void rds_tcp_set_callbacks(struct socket *sock, struct rds_conn_path *cp); 54 54 void rds_tcp_reset_callbacks(struct socket *sock, struct rds_conn_path *cp); 55 55 void rds_tcp_restore_callbacks(struct socket *sock,
+4 -1
net/rds/tcp_connect.c
··· 124 124 if (ret < 0) 125 125 goto out; 126 126 127 - rds_tcp_tune(sock); 127 + if (!rds_tcp_tune(sock)) { 128 + ret = -EINVAL; 129 + goto out; 130 + } 128 131 129 132 if (isv6) { 130 133 sin6.sin6_family = AF_INET6;
+4 -1
net/rds/tcp_listen.c
··· 133 133 __module_get(new_sock->ops->owner); 134 134 135 135 rds_tcp_keepalive(new_sock); 136 - rds_tcp_tune(new_sock); 136 + if (!rds_tcp_tune(new_sock)) { 137 + ret = -EINVAL; 138 + goto out; 139 + } 137 140 138 141 inet = inet_sk(new_sock->sk); 139 142
+22 -4
net/sched/act_pedit.c
··· 149 149 struct nlattr *pattr; 150 150 struct tcf_pedit *p; 151 151 int ret = 0, err; 152 - int ksize; 152 + int i, ksize; 153 153 u32 index; 154 154 155 155 if (!nla) { ··· 228 228 p->tcfp_nkeys = parm->nkeys; 229 229 } 230 230 memcpy(p->tcfp_keys, parm->keys, ksize); 231 + p->tcfp_off_max_hint = 0; 232 + for (i = 0; i < p->tcfp_nkeys; ++i) { 233 + u32 cur = p->tcfp_keys[i].off; 234 + 235 + /* The AT option can read a single byte, we can bound the actual 236 + * value with uchar max. 237 + */ 238 + cur += (0xff & p->tcfp_keys[i].offmask) >> p->tcfp_keys[i].shift; 239 + 240 + /* Each key touches 4 bytes starting from the computed offset */ 241 + p->tcfp_off_max_hint = max(p->tcfp_off_max_hint, cur + 4); 242 + } 231 243 232 244 p->tcfp_flags = parm->flags; 233 245 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); ··· 320 308 struct tcf_result *res) 321 309 { 322 310 struct tcf_pedit *p = to_pedit(a); 311 + u32 max_offset; 323 312 int i; 324 313 325 - if (skb_unclone(skb, GFP_ATOMIC)) 326 - return p->tcf_action; 327 - 328 314 spin_lock(&p->tcf_lock); 315 + 316 + max_offset = (skb_transport_header_was_set(skb) ? 317 + skb_transport_offset(skb) : 318 + skb_network_offset(skb)) + 319 + p->tcfp_off_max_hint; 320 + if (skb_ensure_writable(skb, min(skb->len, max_offset))) 321 + goto unlock; 329 322 330 323 tcf_lastuse_update(&p->tcf_tm); 331 324 ··· 420 403 p->tcf_qstats.overlimits++; 421 404 done: 422 405 bstats_update(&p->tcf_bstats, skb); 406 + unlock: 423 407 spin_unlock(&p->tcf_lock); 424 408 return p->tcf_action; 425 409 }
+2 -2
net/smc/smc_rx.c
··· 355 355 } 356 356 break; 357 357 } 358 + if (!timeo) 359 + return -EAGAIN; 358 360 if (signal_pending(current)) { 359 361 read_done = sock_intr_errno(timeo); 360 362 break; 361 363 } 362 - if (!timeo) 363 - return -EAGAIN; 364 364 } 365 365 366 366 if (!smc_rx_data_available(conn)) {
+2 -1
net/sunrpc/auth_gss/gss_rpc_upcall.c
··· 97 97 * timeout, which would result in reconnections being 98 98 * done without the correct namespace: 99 99 */ 100 - .flags = RPC_CLNT_CREATE_IGNORE_NULL_UNAVAIL | 100 + .flags = RPC_CLNT_CREATE_NOPING | 101 + RPC_CLNT_CREATE_CONNECTED | 101 102 RPC_CLNT_CREATE_NO_IDLE_TIMEOUT 102 103 }; 103 104 struct rpc_clnt *clnt;
+33 -3
net/sunrpc/clnt.c
··· 76 76 static int rpc_decode_header(struct rpc_task *task, 77 77 struct xdr_stream *xdr); 78 78 static int rpc_ping(struct rpc_clnt *clnt); 79 + static int rpc_ping_noreply(struct rpc_clnt *clnt); 79 80 static void rpc_check_timeout(struct rpc_task *task); 80 81 81 82 static void rpc_register_client(struct rpc_clnt *clnt) ··· 480 479 481 480 if (!(args->flags & RPC_CLNT_CREATE_NOPING)) { 482 481 int err = rpc_ping(clnt); 483 - if ((args->flags & RPC_CLNT_CREATE_IGNORE_NULL_UNAVAIL) && 484 - err == -EOPNOTSUPP) 485 - err = 0; 482 + if (err != 0) { 483 + rpc_shutdown_client(clnt); 484 + return ERR_PTR(err); 485 + } 486 + } else if (args->flags & RPC_CLNT_CREATE_CONNECTED) { 487 + int err = rpc_ping_noreply(clnt); 486 488 if (err != 0) { 487 489 rpc_shutdown_client(clnt); 488 490 return ERR_PTR(err); ··· 2716 2712 .p_decode = rpcproc_decode_null, 2717 2713 }; 2718 2714 2715 + static const struct rpc_procinfo rpcproc_null_noreply = { 2716 + .p_encode = rpcproc_encode_null, 2717 + }; 2718 + 2719 2719 static void 2720 2720 rpc_null_call_prepare(struct rpc_task *task, void *data) 2721 2721 { ··· 2766 2758 int status; 2767 2759 2768 2760 task = rpc_call_null_helper(clnt, NULL, NULL, 0, NULL, NULL); 2761 + if (IS_ERR(task)) 2762 + return PTR_ERR(task); 2763 + status = task->tk_status; 2764 + rpc_put_task(task); 2765 + return status; 2766 + } 2767 + 2768 + static int rpc_ping_noreply(struct rpc_clnt *clnt) 2769 + { 2770 + struct rpc_message msg = { 2771 + .rpc_proc = &rpcproc_null_noreply, 2772 + }; 2773 + struct rpc_task_setup task_setup_data = { 2774 + .rpc_client = clnt, 2775 + .rpc_message = &msg, 2776 + .callback_ops = &rpc_null_ops, 2777 + .flags = RPC_TASK_SOFT | RPC_TASK_SOFTCONN | RPC_TASK_NULLCREDS, 2778 + }; 2779 + struct rpc_task *task; 2780 + int status; 2781 + 2782 + task = rpc_run_task(&task_setup_data); 2769 2783 if (IS_ERR(task)) 2770 2784 return PTR_ERR(task); 2771 2785 status = task->tk_status;
+3
net/tls/tls_device.c
··· 1347 1347 1348 1348 /* Device contexts for RX and TX will be freed in on sk_destruct 1349 1349 * by tls_device_free_ctx. rx_conf and tx_conf stay in TLS_HW. 1350 + * Now release the ref taken above. 1350 1351 */ 1352 + if (refcount_dec_and_test(&ctx->refcount)) 1353 + tls_device_free_ctx(ctx); 1351 1354 } 1352 1355 1353 1356 up_write(&device_offload_lock);
+16 -2
net/wireless/nl80211.c
··· 3173 3173 } else if (attrs[NL80211_ATTR_CHANNEL_WIDTH]) { 3174 3174 chandef->width = 3175 3175 nla_get_u32(attrs[NL80211_ATTR_CHANNEL_WIDTH]); 3176 + if (chandef->chan->band == NL80211_BAND_S1GHZ) { 3177 + /* User input error for channel width doesn't match channel */ 3178 + if (chandef->width != ieee80211_s1g_channel_width(chandef->chan)) { 3179 + NL_SET_ERR_MSG_ATTR(extack, 3180 + attrs[NL80211_ATTR_CHANNEL_WIDTH], 3181 + "bad channel width"); 3182 + return -EINVAL; 3183 + } 3184 + } 3176 3185 if (attrs[NL80211_ATTR_CENTER_FREQ1]) { 3177 3186 chandef->center_freq1 = 3178 3187 nla_get_u32(attrs[NL80211_ATTR_CENTER_FREQ1]); ··· 11666 11657 struct cfg80211_bitrate_mask mask; 11667 11658 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 11668 11659 struct net_device *dev = info->user_ptr[1]; 11660 + struct wireless_dev *wdev = dev->ieee80211_ptr; 11669 11661 int err; 11670 11662 11671 11663 if (!rdev->ops->set_bitrate_mask) 11672 11664 return -EOPNOTSUPP; 11673 11665 11666 + wdev_lock(wdev); 11674 11667 err = nl80211_parse_tx_bitrate_mask(info, info->attrs, 11675 11668 NL80211_ATTR_TX_RATES, &mask, 11676 11669 dev, true); 11677 11670 if (err) 11678 - return err; 11671 + goto out; 11679 11672 11680 - return rdev_set_bitrate_mask(rdev, dev, NULL, &mask); 11673 + err = rdev_set_bitrate_mask(rdev, dev, NULL, &mask); 11674 + out: 11675 + wdev_unlock(wdev); 11676 + return err; 11681 11677 } 11682 11678 11683 11679 static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info)
+1 -1
net/wireless/scan.c
··· 1829 1829 if (tmp && tmp->datalen >= sizeof(struct ieee80211_s1g_oper_ie)) { 1830 1830 struct ieee80211_s1g_oper_ie *s1gop = (void *)tmp->data; 1831 1831 1832 - return s1gop->primary_ch; 1832 + return s1gop->oper_ch; 1833 1833 } 1834 1834 } else { 1835 1835 tmp = cfg80211_find_elem(WLAN_EID_DS_PARAMS, ie, ielen);
+3 -3
samples/trace_events/trace_custom_sched.h
··· 25 25 * that the custom event is using. 26 26 */ 27 27 TP_PROTO(bool preempt, 28 - unsigned int prev_state, 29 28 struct task_struct *prev, 30 - struct task_struct *next), 29 + struct task_struct *next, 30 + unsigned int prev_state), 31 31 32 - TP_ARGS(preempt, prev_state, prev, next), 32 + TP_ARGS(preempt, prev, next, prev_state), 33 33 34 34 /* 35 35 * The next fields are where the customization happens.
+9 -1
tools/include/uapi/linux/kvm.h
··· 445 445 #define KVM_SYSTEM_EVENT_RESET 2 446 446 #define KVM_SYSTEM_EVENT_CRASH 3 447 447 __u32 type; 448 - __u64 flags; 448 + __u32 ndata; 449 + union { 450 + #ifndef __KERNEL__ 451 + __u64 flags; 452 + #endif 453 + __u64 data[16]; 454 + }; 449 455 } system_event; 450 456 /* KVM_EXIT_S390_STSI */ 451 457 struct { ··· 1150 1144 #define KVM_CAP_S390_MEM_OP_EXTENSION 211 1151 1145 #define KVM_CAP_PMU_CAPABILITY 212 1152 1146 #define KVM_CAP_DISABLE_QUIRKS2 213 1147 + /* #define KVM_CAP_VM_TSC_CONTROL 214 */ 1148 + #define KVM_CAP_SYSTEM_EVENT_DATA 215 1153 1149 1154 1150 #ifdef KVM_CAP_IRQ_ROUTING 1155 1151
+2
tools/perf/bench/numa.c
··· 311 311 312 312 /* BUG_ON due to failure in allocation of orig_mask/mask */ 313 313 BUG_ON(-1); 314 + return NULL; 314 315 } 315 316 316 317 static cpu_set_t *bind_to_node(int target_node) ··· 365 364 366 365 /* BUG_ON due to failure in allocation of orig_mask/mask */ 367 366 BUG_ON(-1); 367 + return NULL; 368 368 } 369 369 370 370 static void bind_to_cpumask(cpu_set_t *mask)
-1
tools/perf/tests/shell/test_arm_coresight.sh
··· 29 29 rm -f ${file} 30 30 rm -f "${perfdata}.old" 31 31 trap - exit term int 32 - kill -2 $$ 33 32 exit $glb_err 34 33 } 35 34
+3
tools/testing/selftests/net/Makefile
··· 25 25 TEST_PROGS += amt.sh 26 26 TEST_PROGS += unicast_extensions.sh 27 27 TEST_PROGS += udpgro_fwd.sh 28 + TEST_PROGS += udpgro_frglist.sh 28 29 TEST_PROGS += veth.sh 29 30 TEST_PROGS += ioam6.sh 30 31 TEST_PROGS += gro.sh ··· 61 60 62 61 KSFT_KHDR_INSTALL := 1 63 62 include ../lib.mk 63 + 64 + include bpf/Makefile 64 65 65 66 $(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma 66 67 $(OUTPUT)/tcp_mmap: LDLIBS += -lpthread
+14
tools/testing/selftests/net/bpf/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + 3 + CLANG ?= clang 4 + CCINCLUDE += -I../../bpf 5 + CCINCLUDE += -I../../../../../usr/include/ 6 + 7 + TEST_CUSTOM_PROGS = $(OUTPUT)/bpf/nat6to4.o 8 + all: $(TEST_CUSTOM_PROGS) 9 + 10 + $(OUTPUT)/%.o: %.c 11 + $(CLANG) -O2 -target bpf -c $< $(CCINCLUDE) -o $@ 12 + 13 + clean: 14 + rm -f $(TEST_CUSTOM_PROGS)
+285
tools/testing/selftests/net/bpf/nat6to4.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * This code is taken from the Android Open Source Project and the author 4 + * (Maciej Żenczykowski) has gave permission to relicense it under the 5 + * GPLv2. Therefore this program is free software; 6 + * You can redistribute it and/or modify it under the terms of the GNU 7 + * General Public License version 2 as published by the Free Software 8 + * Foundation 9 + 10 + * The original headers, including the original license headers, are 11 + * included below for completeness. 12 + * 13 + * Copyright (C) 2019 The Android Open Source Project 14 + * 15 + * Licensed under the Apache License, Version 2.0 (the "License"); 16 + * you may not use this file except in compliance with the License. 17 + * You may obtain a copy of the License at 18 + * 19 + * http://www.apache.org/licenses/LICENSE-2.0 20 + * 21 + * Unless required by applicable law or agreed to in writing, software 22 + * distributed under the License is distributed on an "AS IS" BASIS, 23 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 + * See the License for the specific language governing permissions and 25 + * limitations under the License. 26 + */ 27 + #include <linux/bpf.h> 28 + #include <linux/if.h> 29 + #include <linux/if_ether.h> 30 + #include <linux/if_packet.h> 31 + #include <linux/in.h> 32 + #include <linux/in6.h> 33 + #include <linux/ip.h> 34 + #include <linux/ipv6.h> 35 + #include <linux/pkt_cls.h> 36 + #include <linux/swab.h> 37 + #include <stdbool.h> 38 + #include <stdint.h> 39 + 40 + 41 + #include <linux/udp.h> 42 + 43 + #include <bpf/bpf_helpers.h> 44 + #include <bpf/bpf_endian.h> 45 + 46 + #define IP_DF 0x4000 // Flag: "Don't Fragment" 47 + 48 + SEC("schedcls/ingress6/nat_6") 49 + int sched_cls_ingress6_nat_6_prog(struct __sk_buff *skb) 50 + { 51 + const int l2_header_size = sizeof(struct ethhdr); 52 + void *data = (void *)(long)skb->data; 53 + const void *data_end = (void *)(long)skb->data_end; 54 + const struct ethhdr * const eth = data; // used iff is_ethernet 55 + const struct ipv6hdr * const ip6 = (void *)(eth + 1); 56 + 57 + // Require ethernet dst mac address to be our unicast address. 58 + if (skb->pkt_type != PACKET_HOST) 59 + return TC_ACT_OK; 60 + 61 + // Must be meta-ethernet IPv6 frame 62 + if (skb->protocol != bpf_htons(ETH_P_IPV6)) 63 + return TC_ACT_OK; 64 + 65 + // Must have (ethernet and) ipv6 header 66 + if (data + l2_header_size + sizeof(*ip6) > data_end) 67 + return TC_ACT_OK; 68 + 69 + // Ethertype - if present - must be IPv6 70 + if (eth->h_proto != bpf_htons(ETH_P_IPV6)) 71 + return TC_ACT_OK; 72 + 73 + // IP version must be 6 74 + if (ip6->version != 6) 75 + return TC_ACT_OK; 76 + // Maximum IPv6 payload length that can be translated to IPv4 77 + if (bpf_ntohs(ip6->payload_len) > 0xFFFF - sizeof(struct iphdr)) 78 + return TC_ACT_OK; 79 + switch (ip6->nexthdr) { 80 + case IPPROTO_TCP: // For TCP & UDP the checksum neutrality of the chosen IPv6 81 + case IPPROTO_UDP: // address means there is no need to update their checksums. 82 + case IPPROTO_GRE: // We do not need to bother looking at GRE/ESP headers, 83 + case IPPROTO_ESP: // since there is never a checksum to update. 84 + break; 85 + default: // do not know how to handle anything else 86 + return TC_ACT_OK; 87 + } 88 + 89 + struct ethhdr eth2; // used iff is_ethernet 90 + 91 + eth2 = *eth; // Copy over the ethernet header (src/dst mac) 92 + eth2.h_proto = bpf_htons(ETH_P_IP); // But replace the ethertype 93 + 94 + struct iphdr ip = { 95 + .version = 4, // u4 96 + .ihl = sizeof(struct iphdr) / sizeof(__u32), // u4 97 + .tos = (ip6->priority << 4) + (ip6->flow_lbl[0] >> 4), // u8 98 + .tot_len = bpf_htons(bpf_ntohs(ip6->payload_len) + sizeof(struct iphdr)), // u16 99 + .id = 0, // u16 100 + .frag_off = bpf_htons(IP_DF), // u16 101 + .ttl = ip6->hop_limit, // u8 102 + .protocol = ip6->nexthdr, // u8 103 + .check = 0, // u16 104 + .saddr = 0x0201a8c0, // u32 105 + .daddr = 0x0101a8c0, // u32 106 + }; 107 + 108 + // Calculate the IPv4 one's complement checksum of the IPv4 header. 109 + __wsum sum4 = 0; 110 + 111 + for (int i = 0; i < sizeof(ip) / sizeof(__u16); ++i) 112 + sum4 += ((__u16 *)&ip)[i]; 113 + 114 + // Note that sum4 is guaranteed to be non-zero by virtue of ip.version == 4 115 + sum4 = (sum4 & 0xFFFF) + (sum4 >> 16); // collapse u32 into range 1 .. 0x1FFFE 116 + sum4 = (sum4 & 0xFFFF) + (sum4 >> 16); // collapse any potential carry into u16 117 + ip.check = (__u16)~sum4; // sum4 cannot be zero, so this is never 0xFFFF 118 + 119 + // Calculate the *negative* IPv6 16-bit one's complement checksum of the IPv6 header. 120 + __wsum sum6 = 0; 121 + // We'll end up with a non-zero sum due to ip6->version == 6 (which has '0' bits) 122 + for (int i = 0; i < sizeof(*ip6) / sizeof(__u16); ++i) 123 + sum6 += ~((__u16 *)ip6)[i]; // note the bitwise negation 124 + 125 + // Note that there is no L4 checksum update: we are relying on the checksum neutrality 126 + // of the ipv6 address chosen by netd's ClatdController. 127 + 128 + // Packet mutations begin - point of no return, but if this first modification fails 129 + // the packet is probably still pristine, so let clatd handle it. 130 + if (bpf_skb_change_proto(skb, bpf_htons(ETH_P_IP), 0)) 131 + return TC_ACT_OK; 132 + bpf_csum_update(skb, sum6); 133 + 134 + data = (void *)(long)skb->data; 135 + data_end = (void *)(long)skb->data_end; 136 + if (data + l2_header_size + sizeof(struct iphdr) > data_end) 137 + return TC_ACT_SHOT; 138 + 139 + struct ethhdr *new_eth = data; 140 + 141 + // Copy over the updated ethernet header 142 + *new_eth = eth2; 143 + 144 + // Copy over the new ipv4 header. 145 + *(struct iphdr *)(new_eth + 1) = ip; 146 + return bpf_redirect(skb->ifindex, BPF_F_INGRESS); 147 + } 148 + 149 + SEC("schedcls/egress4/snat4") 150 + int sched_cls_egress4_snat4_prog(struct __sk_buff *skb) 151 + { 152 + const int l2_header_size = sizeof(struct ethhdr); 153 + void *data = (void *)(long)skb->data; 154 + const void *data_end = (void *)(long)skb->data_end; 155 + const struct ethhdr *const eth = data; // used iff is_ethernet 156 + const struct iphdr *const ip4 = (void *)(eth + 1); 157 + 158 + // Must be meta-ethernet IPv4 frame 159 + if (skb->protocol != bpf_htons(ETH_P_IP)) 160 + return TC_ACT_OK; 161 + 162 + // Must have ipv4 header 163 + if (data + l2_header_size + sizeof(struct ipv6hdr) > data_end) 164 + return TC_ACT_OK; 165 + 166 + // Ethertype - if present - must be IPv4 167 + if (eth->h_proto != bpf_htons(ETH_P_IP)) 168 + return TC_ACT_OK; 169 + 170 + // IP version must be 4 171 + if (ip4->version != 4) 172 + return TC_ACT_OK; 173 + 174 + // We cannot handle IP options, just standard 20 byte == 5 dword minimal IPv4 header 175 + if (ip4->ihl != 5) 176 + return TC_ACT_OK; 177 + 178 + // Maximum IPv6 payload length that can be translated to IPv4 179 + if (bpf_htons(ip4->tot_len) > 0xFFFF - sizeof(struct ipv6hdr)) 180 + return TC_ACT_OK; 181 + 182 + // Calculate the IPv4 one's complement checksum of the IPv4 header. 183 + __wsum sum4 = 0; 184 + 185 + for (int i = 0; i < sizeof(*ip4) / sizeof(__u16); ++i) 186 + sum4 += ((__u16 *)ip4)[i]; 187 + 188 + // Note that sum4 is guaranteed to be non-zero by virtue of ip4->version == 4 189 + sum4 = (sum4 & 0xFFFF) + (sum4 >> 16); // collapse u32 into range 1 .. 0x1FFFE 190 + sum4 = (sum4 & 0xFFFF) + (sum4 >> 16); // collapse any potential carry into u16 191 + // for a correct checksum we should get *a* zero, but sum4 must be positive, ie 0xFFFF 192 + if (sum4 != 0xFFFF) 193 + return TC_ACT_OK; 194 + 195 + // Minimum IPv4 total length is the size of the header 196 + if (bpf_ntohs(ip4->tot_len) < sizeof(*ip4)) 197 + return TC_ACT_OK; 198 + 199 + // We are incapable of dealing with IPv4 fragments 200 + if (ip4->frag_off & ~bpf_htons(IP_DF)) 201 + return TC_ACT_OK; 202 + 203 + switch (ip4->protocol) { 204 + case IPPROTO_TCP: // For TCP & UDP the checksum neutrality of the chosen IPv6 205 + case IPPROTO_GRE: // address means there is no need to update their checksums. 206 + case IPPROTO_ESP: // We do not need to bother looking at GRE/ESP headers, 207 + break; // since there is never a checksum to update. 208 + 209 + case IPPROTO_UDP: // See above comment, but must also have UDP header... 210 + if (data + sizeof(*ip4) + sizeof(struct udphdr) > data_end) 211 + return TC_ACT_OK; 212 + const struct udphdr *uh = (const struct udphdr *)(ip4 + 1); 213 + // If IPv4/UDP checksum is 0 then fallback to clatd so it can calculate the 214 + // checksum. Otherwise the network or more likely the NAT64 gateway might 215 + // drop the packet because in most cases IPv6/UDP packets with a zero checksum 216 + // are invalid. See RFC 6935. TODO: calculate checksum via bpf_csum_diff() 217 + if (!uh->check) 218 + return TC_ACT_OK; 219 + break; 220 + 221 + default: // do not know how to handle anything else 222 + return TC_ACT_OK; 223 + } 224 + struct ethhdr eth2; // used iff is_ethernet 225 + 226 + eth2 = *eth; // Copy over the ethernet header (src/dst mac) 227 + eth2.h_proto = bpf_htons(ETH_P_IPV6); // But replace the ethertype 228 + 229 + struct ipv6hdr ip6 = { 230 + .version = 6, // __u8:4 231 + .priority = ip4->tos >> 4, // __u8:4 232 + .flow_lbl = {(ip4->tos & 0xF) << 4, 0, 0}, // __u8[3] 233 + .payload_len = bpf_htons(bpf_ntohs(ip4->tot_len) - 20), // __be16 234 + .nexthdr = ip4->protocol, // __u8 235 + .hop_limit = ip4->ttl, // __u8 236 + }; 237 + ip6.saddr.in6_u.u6_addr32[0] = bpf_htonl(0x20010db8); 238 + ip6.saddr.in6_u.u6_addr32[1] = 0; 239 + ip6.saddr.in6_u.u6_addr32[2] = 0; 240 + ip6.saddr.in6_u.u6_addr32[3] = bpf_htonl(1); 241 + ip6.daddr.in6_u.u6_addr32[0] = bpf_htonl(0x20010db8); 242 + ip6.daddr.in6_u.u6_addr32[1] = 0; 243 + ip6.daddr.in6_u.u6_addr32[2] = 0; 244 + ip6.daddr.in6_u.u6_addr32[3] = bpf_htonl(2); 245 + 246 + // Calculate the IPv6 16-bit one's complement checksum of the IPv6 header. 247 + __wsum sum6 = 0; 248 + // We'll end up with a non-zero sum due to ip6.version == 6 249 + for (int i = 0; i < sizeof(ip6) / sizeof(__u16); ++i) 250 + sum6 += ((__u16 *)&ip6)[i]; 251 + 252 + // Packet mutations begin - point of no return, but if this first modification fails 253 + // the packet is probably still pristine, so let clatd handle it. 254 + if (bpf_skb_change_proto(skb, bpf_htons(ETH_P_IPV6), 0)) 255 + return TC_ACT_OK; 256 + 257 + // This takes care of updating the skb->csum field for a CHECKSUM_COMPLETE packet. 258 + // In such a case, skb->csum is a 16-bit one's complement sum of the entire payload, 259 + // thus we need to subtract out the ipv4 header's sum, and add in the ipv6 header's sum. 260 + // However, we've already verified the ipv4 checksum is correct and thus 0. 261 + // Thus we only need to add the ipv6 header's sum. 262 + // 263 + // bpf_csum_update() always succeeds if the skb is CHECKSUM_COMPLETE and returns an error 264 + // (-ENOTSUPP) if it isn't. So we just ignore the return code (see above for more details). 265 + bpf_csum_update(skb, sum6); 266 + 267 + // bpf_skb_change_proto() invalidates all pointers - reload them. 268 + data = (void *)(long)skb->data; 269 + data_end = (void *)(long)skb->data_end; 270 + 271 + // I cannot think of any valid way for this error condition to trigger, however I do 272 + // believe the explicit check is required to keep the in kernel ebpf verifier happy. 273 + if (data + l2_header_size + sizeof(ip6) > data_end) 274 + return TC_ACT_SHOT; 275 + 276 + struct ethhdr *new_eth = data; 277 + 278 + // Copy over the updated ethernet header 279 + *new_eth = eth2; 280 + // Copy over the new ipv4 header. 281 + *(struct ipv6hdr *)(new_eth + 1) = ip6; 282 + return TC_ACT_OK; 283 + } 284 + 285 + char _license[] SEC("license") = ("GPL");
+12
tools/testing/selftests/net/fcnal-test.sh
··· 810 810 setup 811 811 set_sysctl net.ipv4.raw_l3mdev_accept=1 2>/dev/null 812 812 ipv4_ping_novrf 813 + setup 814 + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null 815 + ipv4_ping_novrf 813 816 814 817 log_subsection "With VRF" 815 818 setup "yes" 819 + ipv4_ping_vrf 820 + setup "yes" 821 + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null 816 822 ipv4_ping_vrf 817 823 } 818 824 ··· 2354 2348 log_subsection "No VRF" 2355 2349 setup 2356 2350 ipv6_ping_novrf 2351 + setup 2352 + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null 2353 + ipv6_ping_novrf 2357 2354 2358 2355 log_subsection "With VRF" 2359 2356 setup "yes" 2357 + ipv6_ping_vrf 2358 + setup "yes" 2359 + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null 2360 2360 ipv6_ping_vrf 2361 2361 } 2362 2362
+101
tools/testing/selftests/net/udpgro_frglist.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Run a series of udpgro benchmarks 5 + 6 + readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" 7 + 8 + cleanup() { 9 + local -r jobs="$(jobs -p)" 10 + local -r ns="$(ip netns list|grep $PEER_NS)" 11 + 12 + [ -n "${jobs}" ] && kill -INT ${jobs} 2>/dev/null 13 + [ -n "$ns" ] && ip netns del $ns 2>/dev/null 14 + } 15 + trap cleanup EXIT 16 + 17 + run_one() { 18 + # use 'rx' as separator between sender args and receiver args 19 + local -r all="$@" 20 + local -r tx_args=${all%rx*} 21 + local rx_args=${all#*rx} 22 + 23 + 24 + 25 + ip netns add "${PEER_NS}" 26 + ip -netns "${PEER_NS}" link set lo up 27 + ip link add type veth 28 + ip link set dev veth0 up 29 + ip addr add dev veth0 192.168.1.2/24 30 + ip addr add dev veth0 2001:db8::2/64 nodad 31 + 32 + ip link set dev veth1 netns "${PEER_NS}" 33 + ip -netns "${PEER_NS}" addr add dev veth1 192.168.1.1/24 34 + ip -netns "${PEER_NS}" addr add dev veth1 2001:db8::1/64 nodad 35 + ip -netns "${PEER_NS}" link set dev veth1 up 36 + ip netns exec "${PEER_NS}" ethtool -K veth1 rx-gro-list on 37 + 38 + 39 + ip -n "${PEER_NS}" link set veth1 xdp object ../bpf/xdp_dummy.o section xdp_dummy 40 + tc -n "${PEER_NS}" qdisc add dev veth1 clsact 41 + tc -n "${PEER_NS}" filter add dev veth1 ingress prio 4 protocol ipv6 bpf object-file ../bpf/nat6to4.o section schedcls/ingress6/nat_6 direct-action 42 + tc -n "${PEER_NS}" filter add dev veth1 egress prio 4 protocol ip bpf object-file ../bpf/nat6to4.o section schedcls/egress4/snat4 direct-action 43 + echo ${rx_args} 44 + ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} -r & 45 + 46 + # Hack: let bg programs complete the startup 47 + sleep 0.1 48 + ./udpgso_bench_tx ${tx_args} 49 + } 50 + 51 + run_in_netns() { 52 + local -r args=$@ 53 + echo ${args} 54 + ./in_netns.sh $0 __subprocess ${args} 55 + } 56 + 57 + run_udp() { 58 + local -r args=$@ 59 + 60 + echo "udp gso - over veth touching data" 61 + run_in_netns ${args} -u -S 0 rx -4 -v 62 + 63 + echo "udp gso and gro - over veth touching data" 64 + run_in_netns ${args} -S 0 rx -4 -G 65 + } 66 + 67 + run_tcp() { 68 + local -r args=$@ 69 + 70 + echo "tcp - over veth touching data" 71 + run_in_netns ${args} -t rx -4 -t 72 + } 73 + 74 + run_all() { 75 + local -r core_args="-l 4" 76 + local -r ipv4_args="${core_args} -4 -D 192.168.1.1" 77 + local -r ipv6_args="${core_args} -6 -D 2001:db8::1" 78 + 79 + echo "ipv6" 80 + run_tcp "${ipv6_args}" 81 + run_udp "${ipv6_args}" 82 + } 83 + 84 + if [ ! -f ../bpf/xdp_dummy.o ]; then 85 + echo "Missing xdp_dummy helper. Build bpf selftest first" 86 + exit -1 87 + fi 88 + 89 + if [ ! -f bpf/nat6to4.o ]; then 90 + echo "Missing nat6to4 helper. Build bpfnat6to4.o selftest first" 91 + exit -1 92 + fi 93 + 94 + if [[ $# -eq 0 ]]; then 95 + run_all 96 + elif [[ $1 == "__subprocess" ]]; then 97 + shift 98 + run_one $@ 99 + else 100 + run_in_netns $@ 101 + fi
+5 -5
tools/testing/selftests/vm/Makefile
··· 57 57 CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_64bit_program.c) 58 58 CAN_BUILD_WITH_NOPIE := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_program.c -no-pie) 59 59 60 - TARGETS := protection_keys 61 - BINARIES_32 := $(TARGETS:%=%_32) 62 - BINARIES_64 := $(TARGETS:%=%_64) 60 + VMTARGETS := protection_keys 61 + BINARIES_32 := $(VMTARGETS:%=%_32) 62 + BINARIES_64 := $(VMTARGETS:%=%_64) 63 63 64 64 ifeq ($(CAN_BUILD_WITH_NOPIE),1) 65 65 CFLAGS += -no-pie ··· 112 112 $(BINARIES_32): LDLIBS += -lrt -ldl -lm 113 113 $(BINARIES_32): $(OUTPUT)/%_32: %.c 114 114 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@ 115 - $(foreach t,$(TARGETS),$(eval $(call gen-target-rule-32,$(t)))) 115 + $(foreach t,$(VMTARGETS),$(eval $(call gen-target-rule-32,$(t)))) 116 116 endif 117 117 118 118 ifeq ($(CAN_BUILD_X86_64),1) ··· 120 120 $(BINARIES_64): LDLIBS += -lrt -ldl 121 121 $(BINARIES_64): $(OUTPUT)/%_64: %.c 122 122 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@ 123 - $(foreach t,$(TARGETS),$(eval $(call gen-target-rule-64,$(t)))) 123 + $(foreach t,$(VMTARGETS),$(eval $(call gen-target-rule-64,$(t)))) 124 124 endif 125 125 126 126 # x86_64 users should be encouraged to install 32-bit libraries