mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	Add alpha version for kernel 6.12 support
This commit is contained in:
		
							parent
							
								
									2d47118221
								
							
						
					
					
						commit
						6e713f6367
					
				
					 281 changed files with 65491 additions and 0 deletions
				
			
		
							
								
								
									
										2
									
								
								6.12/include/kernel-6.12
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								6.12/include/kernel-6.12
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
LINUX_VERSION-6.12 = -rc6
 | 
			
		||||
LINUX_KERNEL_HASH-6.12-rc6 = 7932703bbf3859932f615c21de4c5ae56d99dc85525bc2361d543216cff7e4ca
 | 
			
		||||
							
								
								
									
										195
									
								
								6.12/include/kernel-defaults.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										195
									
								
								6.12/include/kernel-defaults.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,195 @@
 | 
			
		|||
# SPDX-License-Identifier: GPL-2.0-only
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2006-2020 OpenWrt.org
 | 
			
		||||
 | 
			
		||||
ifdef CONFIG_STRIP_KERNEL_EXPORTS
 | 
			
		||||
  KERNEL_MAKEOPTS_IMAGE += \
 | 
			
		||||
	EXTRA_LDSFLAGS="-I$(KERNEL_BUILD_DIR) -include symtab.h"
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
INITRAMFS_EXTRA_FILES ?= $(GENERIC_PLATFORM_DIR)/image/initramfs-base-files.txt
 | 
			
		||||
 | 
			
		||||
export HOST_EXTRACFLAGS=-I$(STAGING_DIR_HOST)/include
 | 
			
		||||
 | 
			
		||||
# defined in quilt.mk
 | 
			
		||||
Kernel/Patch:=$(Kernel/Patch/Default)
 | 
			
		||||
 | 
			
		||||
ifneq (,$(findstring .xz,$(LINUX_SOURCE)))
 | 
			
		||||
  LINUX_CAT:=xzcat
 | 
			
		||||
else
 | 
			
		||||
  LINUX_CAT:=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
 | 
			
		||||
  ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
 | 
			
		||||
    define Kernel/Prepare/Default
 | 
			
		||||
	$(LINUX_CAT) $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
 | 
			
		||||
	$(Kernel/Patch)
 | 
			
		||||
	$(if $(QUILT),touch $(LINUX_DIR)/.quilt_used)
 | 
			
		||||
    endef
 | 
			
		||||
  else
 | 
			
		||||
    define Kernel/Prepare/Default
 | 
			
		||||
	$(LINUX_CAT) $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
 | 
			
		||||
	$(Kernel/Patch)
 | 
			
		||||
	$(if $(QUILT),touch $(LINUX_DIR)/.quilt_used)
 | 
			
		||||
    endef
 | 
			
		||||
  endif
 | 
			
		||||
else
 | 
			
		||||
  define Kernel/Prepare/Default
 | 
			
		||||
	mkdir -p $(KERNEL_BUILD_DIR)
 | 
			
		||||
	if [ -d $(LINUX_DIR) ]; then \
 | 
			
		||||
		rmdir $(LINUX_DIR); \
 | 
			
		||||
	fi
 | 
			
		||||
	ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
 | 
			
		||||
	if [ -d $(LINUX_DIR)/user_headers ]; then \
 | 
			
		||||
		rm -rf $(LINUX_DIR)/user_headers; \
 | 
			
		||||
	fi
 | 
			
		||||
  endef
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
 | 
			
		||||
  ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
 | 
			
		||||
    define Kernel/SetInitramfs/PreConfigure
 | 
			
		||||
	grep -v -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
 | 
			
		||||
	echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
 | 
			
		||||
    endef
 | 
			
		||||
  else
 | 
			
		||||
  ifeq ($(strip $(CONFIG_EXTERNAL_CPIO)),"")
 | 
			
		||||
    define Kernel/SetInitramfs/PreConfigure
 | 
			
		||||
	grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
 | 
			
		||||
	echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR)/.config
 | 
			
		||||
    endef
 | 
			
		||||
  else
 | 
			
		||||
    define Kernel/SetInitramfs/PreConfigure
 | 
			
		||||
	grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
 | 
			
		||||
	echo 'CONFIG_INITRAMFS_SOURCE="$(call qstrip,$(CONFIG_EXTERNAL_CPIO))"' >> $(LINUX_DIR)/.config
 | 
			
		||||
    endef
 | 
			
		||||
  endif
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
  define Kernel/SetInitramfs
 | 
			
		||||
	rm -f $(LINUX_DIR)/.config.prev
 | 
			
		||||
	mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
 | 
			
		||||
	$(call Kernel/SetInitramfs/PreConfigure)
 | 
			
		||||
	echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config
 | 
			
		||||
  ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
 | 
			
		||||
	echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo "$(if $(CONFIG_TARGET_INITRAMFS_FORCE),CONFIG_INITRAMFS_FORCE=y,# CONFIG_INITRAMFS_FORCE is not set)" >> $(LINUX_DIR)/.config
 | 
			
		||||
  else
 | 
			
		||||
	echo "# CONFIG_INITRAMFS_FORCE is not set" >> $(LINUX_DIR)/.config
 | 
			
		||||
  endif
 | 
			
		||||
	echo "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_NONE),CONFIG_INITRAMFS_COMPRESSION_NONE=y,# CONFIG_INITRAMFS_COMPRESSION_NONE is not set)" >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),CONFIG_INITRAMFS_COMPRESSION_GZIP=y\nCONFIG_RD_GZIP=y,# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set\n# CONFIG_RD_GZIP is not set)" >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),CONFIG_INITRAMFS_COMPRESSION_BZIP2=y\nCONFIG_RD_BZIP2=y,# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set\n# CONFIG_RD_BZIP2 is not set)" >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),CONFIG_INITRAMFS_COMPRESSION_LZMA=y\nCONFIG_RD_LZMA=y,# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set\n# CONFIG_RD_LZMA is not set)" >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),CONFIG_INITRAMFS_COMPRESSION_LZO=y\nCONFIG_RD_LZO=y,# CONFIG_INITRAMFS_COMPRESSION_LZO is not set\n# CONFIG_RD_LZO is not set)" >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),CONFIG_INITRAMFS_COMPRESSION_XZ=y\nCONFIG_RD_XZ=y,# CONFIG_INITRAMFS_COMPRESSION_XZ is not set\n# CONFIG_RD_XZ is not set)" >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),CONFIG_INITRAMFS_COMPRESSION_LZ4=y\nCONFIG_RD_LZ4=y,# CONFIG_INITRAMFS_COMPRESSION_LZ4 is not set\n# CONFIG_RD_LZ4 is not set)" >> $(LINUX_DIR)/.config
 | 
			
		||||
	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),CONFIG_INITRAMFS_COMPRESSION_ZSTD=y\nCONFIG_RD_ZSTD=y,# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set\n# CONFIG_RD_ZSTD is not set)" >> $(LINUX_DIR)/.config
 | 
			
		||||
  endef
 | 
			
		||||
else
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
define Kernel/SetNoInitramfs
 | 
			
		||||
	mv $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.old
 | 
			
		||||
	grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
 | 
			
		||||
	echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set
 | 
			
		||||
	echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set
 | 
			
		||||
	echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config.set
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Kernel/Configure/Default
 | 
			
		||||
	rm -f $(LINUX_DIR)/localversion
 | 
			
		||||
	$(LINUX_CONF_CMD) > $(LINUX_DIR)/.config.target
 | 
			
		||||
# copy CONFIG_KERNEL_* settings over to .config.target
 | 
			
		||||
	awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' $(TOPDIR)/.config >> $(LINUX_DIR)/.config.target
 | 
			
		||||
	echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> $(LINUX_DIR)/.config.target
 | 
			
		||||
	echo "# CONFIG_KALLSYMS_ALL is not set" >> $(LINUX_DIR)/.config.target
 | 
			
		||||
	echo "CONFIG_KALLSYMS_UNCOMPRESSED=y" >> $(LINUX_DIR)/.config.target
 | 
			
		||||
	$(SCRIPT_DIR)/package-metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config $(KERNEL_PATCHVER) > $(LINUX_DIR)/.config.override
 | 
			
		||||
	$(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_DIR)/.config.target /dev/null $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config.set
 | 
			
		||||
	$(call Kernel/SetNoInitramfs)
 | 
			
		||||
	rm -rf $(KERNEL_BUILD_DIR)/modules
 | 
			
		||||
	cmp -s $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev || { \
 | 
			
		||||
		cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config; \
 | 
			
		||||
		cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \
 | 
			
		||||
	}
 | 
			
		||||
	$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) $(if $(findstring uml,$(BOARD)),ARCH=$(ARCH)) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
 | 
			
		||||
	grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Kernel/Configure/Initramfs
 | 
			
		||||
	$(call Kernel/SetInitramfs)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Kernel/CompileModules/Default
 | 
			
		||||
	rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
 | 
			
		||||
	+$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
 | 
			
		||||
	# If .config did not change, use the previous timestamp to avoid package rebuilds
 | 
			
		||||
	cmp -s $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save && \
 | 
			
		||||
		mv $(LINUX_DIR)/.config.modules.save $(LINUX_DIR)/.config; \
 | 
			
		||||
	$(CP) $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
 | 
			
		||||
 | 
			
		||||
# AMD64 shares the location with x86
 | 
			
		||||
ifeq ($(LINUX_KARCH),x86_64)
 | 
			
		||||
IMAGES_DIR:=../../x86/boot
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
define Kernel/CopyImage
 | 
			
		||||
	cmp -s $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug || { \
 | 
			
		||||
		$(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)$(1); \
 | 
			
		||||
		$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf; \
 | 
			
		||||
		$(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug; \
 | 
			
		||||
		$(foreach k, \
 | 
			
		||||
			$(if $(KERNEL_IMAGES),$(KERNEL_IMAGES),$(filter-out vmlinux dtbs,$(KERNELNAME))), \
 | 
			
		||||
			$(CP) $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/$(IMAGES_DIR)/$(k) $(KERNEL_BUILD_DIR)/$(k)$(1); \
 | 
			
		||||
		) \
 | 
			
		||||
	}
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Kernel/CompileImage/Default
 | 
			
		||||
	rm -f $(TARGET_DIR)/init
 | 
			
		||||
	+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all)
 | 
			
		||||
	$(call Kernel/CopyImage)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 | 
			
		||||
define Kernel/CompileImage/Initramfs
 | 
			
		||||
	$(call Kernel/Configure/Initramfs)
 | 
			
		||||
	$(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init
 | 
			
		||||
	$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(TARGET_DIR) $(TARGET_DIR)/init)
 | 
			
		||||
	rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio*
 | 
			
		||||
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
 | 
			
		||||
ifneq ($(call qstrip,$(CONFIG_EXTERNAL_CPIO)),)
 | 
			
		||||
	$(CP) $(CONFIG_EXTERNAL_CPIO) $(KERNEL_BUILD_DIR)/initrd.cpio
 | 
			
		||||
else
 | 
			
		||||
	( cd $(TARGET_DIR); find . | LC_ALL=C sort | $(STAGING_DIR_HOST)/bin/cpio --reproducible -o -H newc -R 0:0 > $(KERNEL_BUILD_DIR)/initrd.cpio )
 | 
			
		||||
endif
 | 
			
		||||
	$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(KERNEL_BUILD_DIR)/initrd.cpio)
 | 
			
		||||
	$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),$(STAGING_DIR_HOST)/bin/bzip2 -9 -c < $(KERNEL_BUILD_DIR)/initrd.cpio > $(KERNEL_BUILD_DIR)/initrd.cpio.bzip2)
 | 
			
		||||
	$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),$(STAGING_DIR_HOST)/bin/libdeflate-gzip -n -f -S .gzip -12 $(KERNEL_BUILD_DIR)/initrd.cpio)
 | 
			
		||||
	$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),$(STAGING_DIR_HOST)/bin/lz4c -l -c1 -fz --favor-decSpeed $(KERNEL_BUILD_DIR)/initrd.cpio)
 | 
			
		||||
	$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),$(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 $(KERNEL_BUILD_DIR)/initrd.cpio $(KERNEL_BUILD_DIR)/initrd.cpio.lzma)
 | 
			
		||||
	$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),$(STAGING_DIR_HOST)/bin/lzop -9 -f $(KERNEL_BUILD_DIR)/initrd.cpio)
 | 
			
		||||
	$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),$(STAGING_DIR_HOST)/bin/xz -T$(if $(filter 1,$(NPROC)),2,0) -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd.cpio)
 | 
			
		||||
	$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd.cpio.zstd $(KERNEL_BUILD_DIR)/initrd.cpio)
 | 
			
		||||
endif
 | 
			
		||||
	+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all)
 | 
			
		||||
	$(call Kernel/CopyImage,-initramfs)
 | 
			
		||||
endef
 | 
			
		||||
else
 | 
			
		||||
define Kernel/CompileImage/Initramfs
 | 
			
		||||
endef
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
define Kernel/Clean/Default
 | 
			
		||||
	rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.configured
 | 
			
		||||
	rm -f $(LINUX_KERNEL)
 | 
			
		||||
	$(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
 | 
			
		||||
endef
 | 
			
		||||
							
								
								
									
										127
									
								
								6.12/package/boot/uboot-envtools/files/mediatek_filogic
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								6.12/package/boot/uboot-envtools/files/mediatek_filogic
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,127 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright (C) 2021 OpenWrt.org
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
[ -e /etc/config/ubootenv ] && exit 0
 | 
			
		||||
 | 
			
		||||
touch /etc/config/ubootenv
 | 
			
		||||
 | 
			
		||||
. /lib/uboot-envtools.sh
 | 
			
		||||
. /lib/functions.sh
 | 
			
		||||
 | 
			
		||||
board=$(board_name)
 | 
			
		||||
 | 
			
		||||
case "$board" in
 | 
			
		||||
asus,rt-ax59u)
 | 
			
		||||
	ubootenv_add_uci_config "/dev/mtd0" "0x100000" "0x20000" "0x20000"
 | 
			
		||||
	;;
 | 
			
		||||
bananapi,bpi-r3)
 | 
			
		||||
	rootdev="$(cmdline_get_var root)"
 | 
			
		||||
	rootdev="${rootdev##*/}"
 | 
			
		||||
	rootdev="${rootdev%%p[0-9]*}"
 | 
			
		||||
	case "$rootdev" in
 | 
			
		||||
	mmc*)
 | 
			
		||||
		local envdev=$(find_mmc_part "ubootenv" $rootdev)
 | 
			
		||||
		ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
 | 
			
		||||
		ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
 | 
			
		||||
		;;
 | 
			
		||||
	mtd*)
 | 
			
		||||
		local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
 | 
			
		||||
		ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
 | 
			
		||||
		ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
 | 
			
		||||
		;;
 | 
			
		||||
	ubi*)
 | 
			
		||||
		. /lib/upgrade/nand.sh
 | 
			
		||||
		local envubi=$(nand_find_ubi ubi)
 | 
			
		||||
		local envdev=/dev/$(nand_find_volume $envubi ubootenv)
 | 
			
		||||
		local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
 | 
			
		||||
		ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
 | 
			
		||||
		ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
 | 
			
		||||
		;;
 | 
			
		||||
	esac
 | 
			
		||||
	;;
 | 
			
		||||
cmcc,rax3000m)
 | 
			
		||||
	case "$(cmdline_get_var root)" in
 | 
			
		||||
	/dev/mmc*)
 | 
			
		||||
		local envdev=$(find_mmc_part "ubootenv" "mmcblk0")
 | 
			
		||||
		ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
 | 
			
		||||
		ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
 | 
			
		||||
		;;
 | 
			
		||||
	*)
 | 
			
		||||
		. /lib/upgrade/nand.sh
 | 
			
		||||
		local envubi=$(nand_find_ubi ubi)
 | 
			
		||||
		local envdev=/dev/$(nand_find_volume $envubi ubootenv)
 | 
			
		||||
		local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
 | 
			
		||||
		ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
 | 
			
		||||
		ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
 | 
			
		||||
		;;
 | 
			
		||||
	esac
 | 
			
		||||
	;;
 | 
			
		||||
cetron,ct3003|\
 | 
			
		||||
netgear,wax220|\
 | 
			
		||||
zbtlink,zbt-z8102ax|\
 | 
			
		||||
z8102ax-128m|\
 | 
			
		||||
z8102ax-64m|\
 | 
			
		||||
zbtlink,zbt-z8103ax)
 | 
			
		||||
	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
 | 
			
		||||
	;;
 | 
			
		||||
h3c,magic-nx30-pro|\
 | 
			
		||||
jcg,q30-pro|\
 | 
			
		||||
qihoo,360t7|\
 | 
			
		||||
tplink,tl-xdr4288|\
 | 
			
		||||
tplink,tl-xdr6086|\
 | 
			
		||||
tplink,tl-xdr6088|\
 | 
			
		||||
xiaomi,mi-router-ax3000t-ubootmod|\
 | 
			
		||||
xiaomi,mi-router-wr30u-ubootmod|\
 | 
			
		||||
xiaomi,redmi-router-ax6000-ubootmod)
 | 
			
		||||
	. /lib/upgrade/nand.sh
 | 
			
		||||
	local envubi=$(nand_find_ubi ubi)
 | 
			
		||||
	local envdev=/dev/$(nand_find_volume $envubi ubootenv)
 | 
			
		||||
	local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
 | 
			
		||||
	ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
 | 
			
		||||
	ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
 | 
			
		||||
	;;
 | 
			
		||||
glinet,gl-mt2500|\
 | 
			
		||||
glinet,gl-mt6000)
 | 
			
		||||
	local envdev=$(find_mmc_part "u-boot-env")
 | 
			
		||||
	ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
 | 
			
		||||
	;;
 | 
			
		||||
glinet,gl-mt3000)
 | 
			
		||||
	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
 | 
			
		||||
	;;
 | 
			
		||||
mercusys,mr90x-v1|\
 | 
			
		||||
routerich,ax3000)
 | 
			
		||||
	local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
 | 
			
		||||
	ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
 | 
			
		||||
	;;
 | 
			
		||||
ubnt,unifi-6-plus)
 | 
			
		||||
	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
 | 
			
		||||
	;;
 | 
			
		||||
xiaomi,mi-router-ax3000t|\
 | 
			
		||||
xiaomi,mi-router-wr30u-112m-nmbm|\
 | 
			
		||||
xiaomi,mi-router-wr30u-stock|\
 | 
			
		||||
xiaomi,redmi-router-ax6000-stock)
 | 
			
		||||
	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
 | 
			
		||||
	ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
 | 
			
		||||
	;;
 | 
			
		||||
zyxel,ex5601-t0)
 | 
			
		||||
	local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
 | 
			
		||||
	ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
 | 
			
		||||
	;;
 | 
			
		||||
zyxel,ex5601-t0-ubootmod)
 | 
			
		||||
        . /lib/upgrade/nand.sh
 | 
			
		||||
        local envubi=$(nand_find_ubi ubi)
 | 
			
		||||
        local envdev=/dev/$(nand_find_volume $envubi ubootenv)
 | 
			
		||||
        local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
 | 
			
		||||
        ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
 | 
			
		||||
        ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
 | 
			
		||||
        ;;
 | 
			
		||||
zyxel,ex5700-telenor)
 | 
			
		||||
	ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
 | 
			
		||||
	;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
config_load ubootenv
 | 
			
		||||
config_foreach ubootenv_add_app_config
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
							
								
								
									
										1740
									
								
								6.12/package/boot/uboot-mediatek/patches/900-add-z8102ax.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1740
									
								
								6.12/package/boot/uboot-mediatek/patches/900-add-z8102ax.patch
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,26 @@
 | 
			
		|||
diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
 | 
			
		||||
index 1dd0ff2a1a1abf..8537a93d6a8d2f 100644
 | 
			
		||||
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
 | 
			
		||||
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
 | 
			
		||||
@@ -674,7 +674,11 @@ static void gpio_keys_irq_close(struct gpio_keys_button_dev *bdev)
 | 
			
		||||
 	}
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 | 
			
		||||
 static int gpio_keys_remove(struct platform_device *pdev)
 | 
			
		||||
+#else
 | 
			
		||||
+static void gpio_keys_remove(struct platform_device *pdev)
 | 
			
		||||
+#endif
 | 
			
		||||
 {
 | 
			
		||||
 	struct gpio_keys_button_dev *bdev = platform_get_drvdata(pdev);
 | 
			
		||||
 
 | 
			
		||||
@@ -685,7 +689,9 @@ static int gpio_keys_remove(struct platform_device *pdev)
 | 
			
		||||
 	else
 | 
			
		||||
 		gpio_keys_irq_close(bdev);
 | 
			
		||||
 
 | 
			
		||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 | 
			
		||||
 	return 0;
 | 
			
		||||
+#endif
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static struct platform_driver gpio_keys_driver = {
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,26 @@
 | 
			
		|||
diff --git a/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c b/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c
 | 
			
		||||
index eb1cf8494abe2..00dc4dcd9424f 100644
 | 
			
		||||
--- a/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c
 | 
			
		||||
+++ b/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c
 | 
			
		||||
@@ -300,7 +300,11 @@ static int nct5104d_gpio_probe(struct platform_device *pdev)
 | 
			
		||||
 	return err;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 | 
			
		||||
 static int nct5104d_gpio_remove(struct platform_device *pdev)
 | 
			
		||||
+#else
 | 
			
		||||
+static void nct5104d_gpio_remove(struct platform_device *pdev)
 | 
			
		||||
+#endif
 | 
			
		||||
 {
 | 
			
		||||
 	int i;
 | 
			
		||||
 	struct nct5104d_gpio_data *data = platform_get_drvdata(pdev);
 | 
			
		||||
@@ -311,7 +315,9 @@ static int nct5104d_gpio_remove(struct platform_device *pdev)
 | 
			
		||||
 		gpiochip_remove (&bank->chip);
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 | 
			
		||||
 	return 0;
 | 
			
		||||
+#endif
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static int __init nct5104d_find(int addr, struct nct5104d_sio *sio)
 | 
			
		||||
							
								
								
									
										723
									
								
								6.12/package/kernel/linux/modules/fs.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										723
									
								
								6.12/package/kernel/linux/modules/fs.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,723 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright (C) 2006-2011 OpenWrt.org
 | 
			
		||||
#
 | 
			
		||||
# This is free software, licensed under the GNU General Public License v2.
 | 
			
		||||
# See /LICENSE for more information.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
FS_MENU:=Filesystems
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-9p
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=Plan 9 Resource Sharing Support
 | 
			
		||||
  DEPENDS:=+kmod-9pnet +LINUX_6_1:kmod-fs-netfs +LINUX_6_6:kmod-fs-netfs
 | 
			
		||||
  KCONFIG:=\
 | 
			
		||||
	CONFIG_9P_FS \
 | 
			
		||||
	CONFIG_9P_FS_POSIX_ACL=n \
 | 
			
		||||
	CONFIG_9P_FS_SECURITY=n \
 | 
			
		||||
	CONFIG_9P_FSCACHE=n
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/9p/9p.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,9p)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-9p/description
 | 
			
		||||
  Kernel module for Plan 9 Resource Sharing Support support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-9p))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-afs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=Andrew FileSystem client
 | 
			
		||||
  DEFAULT:=n
 | 
			
		||||
  DEPENDS:=+kmod-rxrpc +kmod-dnsresolver +kmod-fs-fscache
 | 
			
		||||
  KCONFIG:=\
 | 
			
		||||
	CONFIG_AFS_FS=m \
 | 
			
		||||
	CONFIG_AFS_DEBUG=n \
 | 
			
		||||
	CONFIG_AFS_FSCACHE=y
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/afs/kafs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,kafs)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-afs/description
 | 
			
		||||
  Kernel module for Andrew FileSystem client support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-afs))
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-autofs4
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=AUTOFS4 filesystem support
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_AUTOFS4_FS \
 | 
			
		||||
	CONFIG_AUTOFS_FS
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	$(LINUX_DIR)/fs/autofs/autofs4.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,autofs4)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-autofs4/description
 | 
			
		||||
 Kernel module for AutoFS4 support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-autofs4))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-btrfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=BTRFS filesystem support
 | 
			
		||||
  DEPENDS:=+kmod-lib-crc32c +kmod-lib-lzo +kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +kmod-lib-raid6 +kmod-lib-xor +kmod-lib-zstd
 | 
			
		||||
  KCONFIG:=\
 | 
			
		||||
	CONFIG_BTRFS_FS \
 | 
			
		||||
	CONFIG_BTRFS_FS_CHECK_INTEGRITY=n
 | 
			
		||||
  FILES:=\
 | 
			
		||||
	$(LINUX_DIR)/fs/btrfs/btrfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,btrfs,1)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-btrfs/description
 | 
			
		||||
 Kernel module for BTRFS support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-btrfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-smbfs-common
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=SMBFS common dependencies support
 | 
			
		||||
  HIDDEN:=1
 | 
			
		||||
  DEPENDS:=+LINUX_6_6:kmod-fs-netfs +LINUX_6_6:kmod-nls-ucs2-utils
 | 
			
		||||
  KCONFIG:=\
 | 
			
		||||
	CONFIG_SMBFS_COMMON@lt6.1 \
 | 
			
		||||
	CONFIG_SMBFS@ge6.1
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	$(LINUX_DIR)/fs/smbfs_common/cifs_arc4.ko@lt6.1 \
 | 
			
		||||
	$(LINUX_DIR)/fs/smbfs_common/cifs_md4.ko@lt6.1 \
 | 
			
		||||
	$(LINUX_DIR)/fs/smb/common/cifs_arc4.ko@ge6.1 \
 | 
			
		||||
	$(LINUX_DIR)/fs/smb/common/cifs_md4.ko@ge6.1
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-smbfs-common/description
 | 
			
		||||
 Kernel module dependency for CIFS or SMB_SERVER support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-smbfs-common))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-cifs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=CIFS support
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_CIFS \
 | 
			
		||||
	CONFIG_CIFS_DFS_UPCALL=n \
 | 
			
		||||
	CONFIG_CIFS_UPCALL=n
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	$(LINUX_DIR)/fs/cifs/cifs.ko@lt6.1 \
 | 
			
		||||
	$(LINUX_DIR)/fs/smb/client/cifs.ko@ge6.1
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,cifs)
 | 
			
		||||
  $(call AddDepends/nls)
 | 
			
		||||
  DEPENDS+= \
 | 
			
		||||
    +kmod-fs-smbfs-common \
 | 
			
		||||
    +kmod-crypto-md5 \
 | 
			
		||||
    +kmod-crypto-sha256 \
 | 
			
		||||
    +kmod-crypto-sha512 \
 | 
			
		||||
    +kmod-crypto-cmac \
 | 
			
		||||
    +kmod-crypto-hmac \
 | 
			
		||||
    +kmod-crypto-aead \
 | 
			
		||||
    +kmod-crypto-ccm \
 | 
			
		||||
    +kmod-crypto-ecb \
 | 
			
		||||
    +kmod-crypto-des \
 | 
			
		||||
    +kmod-asn1-decoder \
 | 
			
		||||
    +kmod-oid-registry \
 | 
			
		||||
    +kmod-dnsresolver
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-cifs/description
 | 
			
		||||
 Kernel module for CIFS support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-cifs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-configfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=Configuration filesystem support
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_CONFIGFS_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/configfs/configfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,configfs)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-configfs/description
 | 
			
		||||
 Kernel module for configfs support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-configfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-cramfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=Compressed RAM/ROM filesystem support
 | 
			
		||||
  DEPENDS:=+kmod-lib-zlib-inflate
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_CRAMFS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/cramfs/cramfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,cramfs)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-cramfs/description
 | 
			
		||||
 Kernel module for cramfs support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-cramfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-efivarfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=efivar filesystem support
 | 
			
		||||
  KCONFIG:=CONFIG_EFIVAR_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/efivarfs/efivarfs.ko
 | 
			
		||||
  DEPENDS:=@(x86_64||x86)
 | 
			
		||||
  AUTOLOAD:=$(call Autoload,90,efivarfs)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-efivarfs/description
 | 
			
		||||
  Kernel module to support efivarfs file system mountpoint.
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-efivarfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-exfat
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=exFAT filesystem support
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_EXFAT_FS \
 | 
			
		||||
	CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"
 | 
			
		||||
  FILES:= $(LINUX_DIR)/fs/exfat/exfat.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,exfat,1)
 | 
			
		||||
  DEPENDS:=+kmod-nls-base
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-exfat/description
 | 
			
		||||
 Kernel module for exFAT filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-exfat))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-exportfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=exportfs kernel server support
 | 
			
		||||
  KCONFIG:=CONFIG_EXPORTFS
 | 
			
		||||
  FILES=$(LINUX_DIR)/fs/exportfs/exportfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,20,exportfs,1)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-exportfs/description
 | 
			
		||||
 Kernel module for exportfs. Needed for some other modules.
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-exportfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-ext4
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=EXT4 filesystem support
 | 
			
		||||
  DEPENDS := \
 | 
			
		||||
    +kmod-lib-crc16 \
 | 
			
		||||
    +kmod-crypto-hash \
 | 
			
		||||
    +kmod-crypto-crc32c
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_EXT4_FS \
 | 
			
		||||
	CONFIG_EXT4_ENCRYPTION=n \
 | 
			
		||||
	CONFIG_JBD2
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	$(LINUX_DIR)/fs/ext4/ext4.ko \
 | 
			
		||||
	$(LINUX_DIR)/fs/jbd2/jbd2.ko \
 | 
			
		||||
	$(LINUX_DIR)/fs/mbcache.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,mbcache jbd2 ext4,1)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-ext4/description
 | 
			
		||||
 Kernel module for EXT4 filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-ext4))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-f2fs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=F2FS filesystem support
 | 
			
		||||
  DEPENDS:= +kmod-crypto-hash +kmod-crypto-crc32 +kmod-nls-base
 | 
			
		||||
  KCONFIG:=CONFIG_F2FS_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/f2fs/f2fs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,f2fs,1)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-f2fs/description
 | 
			
		||||
 Kernel module for F2FS filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-f2fs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define KernelPackage/fs-fscache
 | 
			
		||||
#  SUBMENU:=$(FS_MENU)
 | 
			
		||||
#  TITLE:=General filesystem local cache manager
 | 
			
		||||
#  DEPENDS:=+kmod-fs-netfs
 | 
			
		||||
#  KCONFIG:=\
 | 
			
		||||
#	CONFIG_FSCACHE \
 | 
			
		||||
#	CONFIG_FSCACHE_STATS=y \
 | 
			
		||||
#	CONFIG_FSCACHE_HISTOGRAM=n \
 | 
			
		||||
#	CONFIG_FSCACHE_DEBUG=n \
 | 
			
		||||
#	CONFIG_FSCACHE_OBJECT_LIST=n \
 | 
			
		||||
#	CONFIG_CACHEFILES \
 | 
			
		||||
#	CONFIG_CACHEFILES_DEBUG=n \
 | 
			
		||||
#	CONFIG_CACHEFILES_HISTOGRAM=n \
 | 
			
		||||
#	CONFIG_CACHEFILES_ERROR_INJECTION=n@ge5.17 \
 | 
			
		||||
#	CONFIG_CACHEFILES_ONDEMAND=n@ge5.19
 | 
			
		||||
#  FILES:= \
 | 
			
		||||
#	$(LINUX_DIR)/fs/fscache/fscache.ko \
 | 
			
		||||
#	$(LINUX_DIR)/fs/cachefiles/cachefiles.ko
 | 
			
		||||
#  AUTOLOAD:=$(call AutoLoad,29,fscache cachefiles)
 | 
			
		||||
#endef
 | 
			
		||||
 | 
			
		||||
#$(eval $(call KernelPackage,fs-fscache))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-hfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=HFS filesystem support
 | 
			
		||||
  DEPENDS:=+kmod-cdrom
 | 
			
		||||
  KCONFIG:=CONFIG_HFS_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/hfs/hfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,hfs)
 | 
			
		||||
  $(call AddDepends/nls)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-hfs/description
 | 
			
		||||
 Kernel module for HFS filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-hfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-hfsplus
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=HFS+ filesystem support
 | 
			
		||||
  DEPENDS:=+kmod-cdrom
 | 
			
		||||
  KCONFIG:=CONFIG_HFSPLUS_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/hfsplus/hfsplus.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,hfsplus)
 | 
			
		||||
  $(call AddDepends/nls,utf8)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-hfsplus/description
 | 
			
		||||
 Kernel module for HFS+ filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-hfsplus))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-isofs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=ISO9660 filesystem support
 | 
			
		||||
  DEPENDS:=+kmod-lib-zlib-inflate +kmod-cdrom
 | 
			
		||||
  KCONFIG:=CONFIG_ISO9660_FS CONFIG_JOLIET=y CONFIG_ZISOFS=n
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/isofs/isofs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,isofs)
 | 
			
		||||
  $(call AddDepends/nls)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-isofs/description
 | 
			
		||||
 Kernel module for ISO9660 filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-isofs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-jfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=JFS filesystem support
 | 
			
		||||
  KCONFIG:=CONFIG_JFS_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/jfs/jfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,jfs,1)
 | 
			
		||||
  DEPENDS:=+LINUX_6_6:kmod-nls-ucs2-utils
 | 
			
		||||
  $(call AddDepends/nls)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-jfs/description
 | 
			
		||||
 Kernel module for JFS support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-jfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-ksmbd
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=SMB kernel server support
 | 
			
		||||
  DEPENDS:= \
 | 
			
		||||
	  +kmod-nls-base \
 | 
			
		||||
	  +kmod-nls-utf8 \
 | 
			
		||||
	  +kmod-crypto-md5 \
 | 
			
		||||
	  +kmod-crypto-hmac \
 | 
			
		||||
	  +kmod-crypto-ecb \
 | 
			
		||||
	  +kmod-crypto-des \
 | 
			
		||||
	  +kmod-crypto-sha256 \
 | 
			
		||||
	  +kmod-crypto-cmac \
 | 
			
		||||
	  +kmod-crypto-sha512 \
 | 
			
		||||
	  +kmod-crypto-aead \
 | 
			
		||||
	  +kmod-crypto-ccm \
 | 
			
		||||
	  +kmod-crypto-gcm \
 | 
			
		||||
	  +kmod-asn1-decoder \
 | 
			
		||||
	  +kmod-oid-registry \
 | 
			
		||||
	  +kmod-fs-smbfs-common
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_SMB_SERVER \
 | 
			
		||||
	CONFIG_SMB_SERVER_SMBDIRECT=n \
 | 
			
		||||
	CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN=n \
 | 
			
		||||
	CONFIG_SMB_SERVER_KERBEROS5=n
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	 $(LINUX_DIR)/fs/ksmbd/ksmbd.ko@lt6.1 \
 | 
			
		||||
	 $(LINUX_DIR)/fs/smb/server/ksmbd.ko@ge6.1
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,41,ksmbd)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-ksmbd/description
 | 
			
		||||
 Kernel module for SMB kernel server support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-ksmbd))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-minix
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=Minix filesystem support
 | 
			
		||||
  KCONFIG:=CONFIG_MINIX_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/minix/minix.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,minix)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-minix/description
 | 
			
		||||
 Kernel module for Minix filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-minix))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-msdos
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=MSDOS filesystem support
 | 
			
		||||
  DEPENDS:=+kmod-fs-vfat
 | 
			
		||||
  KCONFIG:=CONFIG_MSDOS_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/fat/msdos.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,40,msdos)
 | 
			
		||||
  $(call AddDepends/nls)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-msdos/description
 | 
			
		||||
 Kernel module for MSDOS filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-msdos))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-netfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=Network Filesystems support
 | 
			
		||||
  KCONFIG:= CONFIG_NETFS_SUPPORT
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/netfs/netfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,28,netfs)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-netfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=NFS filesystem client support
 | 
			
		||||
  DEPENDS:=+kmod-fs-nfs-common +kmod-dnsresolver
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_NFS_FS \
 | 
			
		||||
	CONFIG_NFS_USE_LEGACY_DNS=n \
 | 
			
		||||
	CONFIG_NFS_USE_NEW_IDMAPPER=n
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	$(LINUX_DIR)/fs/nfs/nfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,40,nfs)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfs/description
 | 
			
		||||
 Kernel module for NFS client support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-nfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfs-common
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=Common NFS filesystem modules
 | 
			
		||||
  DEPENDS:=+kmod-oid-registry
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_LOCKD \
 | 
			
		||||
	CONFIG_SUNRPC \
 | 
			
		||||
	CONFIG_GRACE_PERIOD \
 | 
			
		||||
	CONFIG_NFS_V4=y \
 | 
			
		||||
	CONFIG_NFS_V4_1=y \
 | 
			
		||||
	CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" \
 | 
			
		||||
	CONFIG_NFS_V4_1_MIGRATION=n \
 | 
			
		||||
	CONFIG_NFS_V4_2=y \
 | 
			
		||||
	CONFIG_NFS_V4_2_READ_PLUS=n
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	$(LINUX_DIR)/fs/lockd/lockd.ko \
 | 
			
		||||
	$(LINUX_DIR)/net/sunrpc/sunrpc.ko \
 | 
			
		||||
	$(LINUX_DIR)/fs/nfs_common/grace.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,grace sunrpc lockd)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-nfs-common))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfs-common-rpcsec
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=NFS Secure RPC
 | 
			
		||||
  DEPENDS:= \
 | 
			
		||||
	+kmod-fs-nfs-common \
 | 
			
		||||
	+kmod-crypto-des \
 | 
			
		||||
	+kmod-crypto-cbc \
 | 
			
		||||
	+kmod-crypto-cts \
 | 
			
		||||
	+kmod-crypto-md5 \
 | 
			
		||||
	+kmod-crypto-sha1 \
 | 
			
		||||
	+kmod-crypto-hmac \
 | 
			
		||||
	+kmod-crypto-ecb \
 | 
			
		||||
	+kmod-crypto-arc4
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_SUNRPC_GSS \
 | 
			
		||||
	CONFIG_RPCSEC_GSS_KRB5
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	$(LINUX_DIR)/net/sunrpc/auth_gss/auth_rpcgss.ko \
 | 
			
		||||
	$(LINUX_DIR)/net/sunrpc/auth_gss/rpcsec_gss_krb5.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,31,auth_rpcgss rpcsec_gss_krb5)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfs-common-rpcsec/description
 | 
			
		||||
 Kernel modules for NFS Secure RPC
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-nfs-common-rpcsec))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfs-v3
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=NFS3 filesystem client support
 | 
			
		||||
  DEPENDS:=+kmod-fs-nfs
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	$(LINUX_DIR)/fs/nfs/nfsv3.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,41,nfsv3)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfs-v3/description
 | 
			
		||||
 Kernel module for NFS v3 client support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-nfs-v3))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfs-v4
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=NFS4 filesystem client support
 | 
			
		||||
  DEPENDS:=+kmod-fs-nfs
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_NFS_V4=y
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	$(LINUX_DIR)/fs/nfs/nfsv4.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,41,nfsv4)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfs-v4/description
 | 
			
		||||
 Kernel module for NFS v4 client support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-nfs-v4))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfsd
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=NFS kernel server support
 | 
			
		||||
  DEPENDS:=+kmod-fs-nfs-common +kmod-fs-exportfs +kmod-fs-nfs-common-rpcsec
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_NFSD \
 | 
			
		||||
	CONFIG_NFSD_V4=y \
 | 
			
		||||
	CONFIG_NFSD_V4_SECURITY_LABEL=n \
 | 
			
		||||
	CONFIG_NFSD_BLOCKLAYOUT=n \
 | 
			
		||||
	CONFIG_NFSD_SCSILAYOUT=n \
 | 
			
		||||
	CONFIG_NFSD_FLEXFILELAYOUT=n \
 | 
			
		||||
	CONFIG_NFSD_FAULT_INJECTION=n \
 | 
			
		||||
	CONFIG_NFSD_V4_2_INTER_SSC=n
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/nfsd/nfsd.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,40,nfsd)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-nfsd/description
 | 
			
		||||
 Kernel module for NFS kernel server support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-nfsd))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define KernelPackage/fs-ntfs
 | 
			
		||||
#  SUBMENU:=$(FS_MENU)
 | 
			
		||||
#  TITLE:=NTFS filesystem read-only (old driver) support
 | 
			
		||||
#  KCONFIG:=CONFIG_NTFS_FS
 | 
			
		||||
#  FILES:=$(LINUX_DIR)/fs/ntfs/ntfs.ko
 | 
			
		||||
#  AUTOLOAD:=$(call AutoLoad,30,ntfs)
 | 
			
		||||
#  $(call AddDepends/nls)
 | 
			
		||||
#endef
 | 
			
		||||
 | 
			
		||||
#define KernelPackage/fs-ntfs/description
 | 
			
		||||
# Kernel module for limited NTFS filesystem support. Support for writing
 | 
			
		||||
# is extremely limited and disabled as a result.
 | 
			
		||||
#endef
 | 
			
		||||
 | 
			
		||||
#$(eval $(call KernelPackage,fs-ntfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-ntfs3
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=NTFS filesystem read & write (new driver) support
 | 
			
		||||
  KCONFIG:= CONFIG_NTFS3_FS CONFIG_NTFS3_FS_POSIX_ACL=y
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/ntfs3/ntfs3.ko
 | 
			
		||||
  $(call AddDepends/nls)
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,80,ntfs3)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-ntfs3/description
 | 
			
		||||
 Kernel module for fully functional NTFS filesystem support. It allows
 | 
			
		||||
 reading as well as writing.
 | 
			
		||||
 | 
			
		||||
 It supports NTFS versions up to 3.1.
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-ntfs3))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-reiserfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=ReiserFS filesystem support
 | 
			
		||||
  KCONFIG:=CONFIG_REISERFS_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/reiserfs/reiserfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,reiserfs,1)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-reiserfs/description
 | 
			
		||||
 Kernel module for ReiserFS support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-reiserfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-squashfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=SquashFS 4.0 filesystem support
 | 
			
		||||
  KCONFIG:=CONFIG_SQUASHFS \
 | 
			
		||||
	CONFIG_SQUASHFS_XZ=y
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/squashfs/squashfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,squashfs,1)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-squashfs/description
 | 
			
		||||
 Kernel module for SquashFS 4.0 support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-squashfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-udf
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=UDF filesystem support
 | 
			
		||||
  KCONFIG:=CONFIG_UDF_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/udf/udf.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,udf)
 | 
			
		||||
  DEPENDS:=+kmod-lib-crc-itu-t +kmod-cdrom
 | 
			
		||||
  $(call AddDepends/nls)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-udf/description
 | 
			
		||||
 Kernel module for UDF filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-udf))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-vfat
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=VFAT filesystem support
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_FAT_FS \
 | 
			
		||||
	CONFIG_VFAT_FS
 | 
			
		||||
  FILES:= \
 | 
			
		||||
	$(LINUX_DIR)/fs/fat/fat.ko \
 | 
			
		||||
	$(LINUX_DIR)/fs/fat/vfat.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,fat vfat,1)
 | 
			
		||||
  $(call AddDepends/nls,cp437 iso8859-1 utf8)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-vfat/description
 | 
			
		||||
 Kernel module for VFAT filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-vfat))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-xfs
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=XFS filesystem support
 | 
			
		||||
  KCONFIG:=CONFIG_XFS_FS
 | 
			
		||||
  DEPENDS:= +kmod-fs-exportfs +kmod-lib-crc32c
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/xfs/xfs.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,xfs,1)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fs-xfs/description
 | 
			
		||||
 Kernel module for XFS support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fs-xfs))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fuse
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=FUSE (Filesystem in Userspace) support
 | 
			
		||||
  KCONFIG:= CONFIG_FUSE_FS
 | 
			
		||||
  FILES:=$(LINUX_DIR)/fs/fuse/fuse.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,80,fuse)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/fuse/description
 | 
			
		||||
 Kernel module for userspace filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,fuse))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
define KernelPackage/pstore
 | 
			
		||||
  SUBMENU:=$(FS_MENU)
 | 
			
		||||
  TITLE:=Pstore file system
 | 
			
		||||
  DEFAULT:=m if ALL_KMODS
 | 
			
		||||
  KCONFIG:= \
 | 
			
		||||
	CONFIG_PSTORE \
 | 
			
		||||
	CONFIG_PSTORE_COMPRESS=y \
 | 
			
		||||
	CONFIG_PSTORE_COMPRESS_DEFAULT="deflate" \
 | 
			
		||||
	CONFIG_PSTORE_DEFLATE_COMPRESS=y \
 | 
			
		||||
	CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y
 | 
			
		||||
  FILES:= $(LINUX_DIR)/fs/pstore/pstore.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,30,pstore,1)
 | 
			
		||||
  DEPENDS:=+LINUX_6_6:kmod-lib-zlib-deflate +LINUX_6_6:kmod-lib-zlib-inflate
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/pstore/description
 | 
			
		||||
 Kernel module for pstore filesystem support
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,pstore))
 | 
			
		||||
							
								
								
									
										1153
									
								
								6.12/package/kernel/linux/modules/other.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1153
									
								
								6.12/package/kernel/linux/modules/other.mk
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										1269
									
								
								6.12/package/kernel/linux/modules/video.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1269
									
								
								6.12/package/kernel/linux/modules/video.mk
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,403 @@
 | 
			
		|||
--- a/drivers/net/wireless/ath/ath9k/channel.c
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/channel.c
 | 
			
		||||
@@ -15,6 +15,7 @@
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
 #include "ath9k.h"
 | 
			
		||||
+#include "hsr.h"
 | 
			
		||||
 
 | 
			
		||||
 /* Set/change channels.  If the channel is really being changed, it's done
 | 
			
		||||
  * by reseting the chip.  To accomplish this we must first cleanup any pending
 | 
			
		||||
@@ -22,6 +23,7 @@
 | 
			
		||||
  */
 | 
			
		||||
 static int ath_set_channel(struct ath_softc *sc)
 | 
			
		||||
 {
 | 
			
		||||
+	struct device_node *np = sc->dev->of_node;
 | 
			
		||||
 	struct ath_hw *ah = sc->sc_ah;
 | 
			
		||||
 	struct ath_common *common = ath9k_hw_common(ah);
 | 
			
		||||
 	struct ieee80211_hw *hw = sc->hw;
 | 
			
		||||
@@ -42,6 +44,11 @@ static int ath_set_channel(struct ath_so
 | 
			
		||||
 	ath_dbg(common, CONFIG, "Set channel: %d MHz width: %d\n",
 | 
			
		||||
 		chan->center_freq, chandef->width);
 | 
			
		||||
 
 | 
			
		||||
+	if (of_property_read_bool(np, "ubnt,hsr")) {
 | 
			
		||||
+		ath9k_hsr_enable(ah, chandef->width, chan->center_freq);
 | 
			
		||||
+		ath9k_hsr_status(ah);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	/* update survey stats for the old channel before switching */
 | 
			
		||||
 	spin_lock_irqsave(&common->cc_lock, flags);
 | 
			
		||||
 	ath_update_survey_stats(sc);
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/hsr.c
 | 
			
		||||
@@ -0,0 +1,247 @@
 | 
			
		||||
+/*
 | 
			
		||||
+ *
 | 
			
		||||
+ * The MIT License (MIT)
 | 
			
		||||
+ *
 | 
			
		||||
+ * Copyright (c) 2015 Kirill Berezin
 | 
			
		||||
+ *
 | 
			
		||||
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
+ * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
+ * in the Software without restriction, including without limitation the rights
 | 
			
		||||
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
+ * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
+ * furnished to do so, subject to the following conditions:
 | 
			
		||||
+ *
 | 
			
		||||
+ * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
+ * all copies or substantial portions of the Software.
 | 
			
		||||
+ *
 | 
			
		||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
+ * SOFTWARE.
 | 
			
		||||
+ *
 | 
			
		||||
+ */
 | 
			
		||||
+
 | 
			
		||||
+#include <linux/io.h>
 | 
			
		||||
+#include <linux/slab.h>
 | 
			
		||||
+#include <linux/module.h>
 | 
			
		||||
+#include <linux/time.h>
 | 
			
		||||
+#include <linux/bitops.h>
 | 
			
		||||
+#include <linux/etherdevice.h>
 | 
			
		||||
+#include <linux/rtnetlink.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
+
 | 
			
		||||
+#include "hw.h"
 | 
			
		||||
+#include "ath9k.h"
 | 
			
		||||
+
 | 
			
		||||
+#define HSR_GPIO_CSN 8
 | 
			
		||||
+#define HSR_GPIO_CLK 6
 | 
			
		||||
+#define HSR_GPIO_DOUT 7
 | 
			
		||||
+#define HSR_GPIO_DIN 5
 | 
			
		||||
+
 | 
			
		||||
+/* delays are in useconds */
 | 
			
		||||
+#define HSR_DELAY_HALF_TICK 100
 | 
			
		||||
+#define HSR_DELAY_PRE_WRITE 75
 | 
			
		||||
+#define HSR_DELAY_FINAL 20000
 | 
			
		||||
+#define HSR_DELAY_TRAILING 200
 | 
			
		||||
+
 | 
			
		||||
+void ath9k_hsr_init(struct ath_hw *ah)
 | 
			
		||||
+{
 | 
			
		||||
+	ath9k_hw_gpio_request_in(ah, HSR_GPIO_DIN, NULL);
 | 
			
		||||
+	ath9k_hw_gpio_request_out(ah, HSR_GPIO_CSN, NULL,
 | 
			
		||||
+				  AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
 | 
			
		||||
+	ath9k_hw_gpio_request_out(ah, HSR_GPIO_CLK, NULL,
 | 
			
		||||
+				  AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
 | 
			
		||||
+	ath9k_hw_gpio_request_out(ah, HSR_GPIO_DOUT, NULL,
 | 
			
		||||
+				  AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
 | 
			
		||||
+
 | 
			
		||||
+	ath9k_hw_set_gpio(ah, HSR_GPIO_CSN, 1);
 | 
			
		||||
+	ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 0);
 | 
			
		||||
+	ath9k_hw_set_gpio(ah, HSR_GPIO_DOUT, 0);
 | 
			
		||||
+
 | 
			
		||||
+	udelay(HSR_DELAY_TRAILING);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static u32 ath9k_hsr_write_byte(struct ath_hw *ah, int delay, u32 value)
 | 
			
		||||
+{
 | 
			
		||||
+	struct ath_common *common = ath9k_hw_common(ah);
 | 
			
		||||
+	int i;
 | 
			
		||||
+	u32 rval = 0;
 | 
			
		||||
+
 | 
			
		||||
+	udelay(delay);
 | 
			
		||||
+
 | 
			
		||||
+	ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 0);
 | 
			
		||||
+	udelay(HSR_DELAY_HALF_TICK);
 | 
			
		||||
+
 | 
			
		||||
+	ath9k_hw_set_gpio(ah, HSR_GPIO_CSN, 0);
 | 
			
		||||
+	udelay(HSR_DELAY_HALF_TICK);
 | 
			
		||||
+
 | 
			
		||||
+	for (i = 0; i < 8; ++i) {
 | 
			
		||||
+		rval = rval << 1;
 | 
			
		||||
+
 | 
			
		||||
+		/* pattern is left to right, that is 7-th bit runs first */
 | 
			
		||||
+		ath9k_hw_set_gpio(ah, HSR_GPIO_DOUT, (value >> (7 - i)) & 0x1);
 | 
			
		||||
+		udelay(HSR_DELAY_HALF_TICK);
 | 
			
		||||
+
 | 
			
		||||
+		ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 1);
 | 
			
		||||
+		udelay(HSR_DELAY_HALF_TICK);
 | 
			
		||||
+
 | 
			
		||||
+		rval |= ath9k_hw_gpio_get(ah, HSR_GPIO_DIN);
 | 
			
		||||
+
 | 
			
		||||
+		ath9k_hw_set_gpio(ah, HSR_GPIO_CLK, 0);
 | 
			
		||||
+		udelay(HSR_DELAY_HALF_TICK);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	ath9k_hw_set_gpio(ah, HSR_GPIO_CSN, 1);
 | 
			
		||||
+	udelay(HSR_DELAY_HALF_TICK);
 | 
			
		||||
+
 | 
			
		||||
+	ath_dbg(common, CONFIG, "ath9k_hsr_write_byte: write byte %d return value is %d %c\n",
 | 
			
		||||
+		value, rval, rval > 32 ? rval : '-');
 | 
			
		||||
+
 | 
			
		||||
+	return rval & 0xff;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int ath9k_hsr_write_a_chain(struct ath_hw *ah, char *chain, int items)
 | 
			
		||||
+{
 | 
			
		||||
+	int status = 0;
 | 
			
		||||
+	int i = 0;
 | 
			
		||||
+	int err;
 | 
			
		||||
+
 | 
			
		||||
+	/* a preamble */
 | 
			
		||||
+	ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0);
 | 
			
		||||
+	status = ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0);
 | 
			
		||||
+
 | 
			
		||||
+	/* clear HSR's reply buffer */
 | 
			
		||||
+	if (status) {
 | 
			
		||||
+		int loop = 0;
 | 
			
		||||
+
 | 
			
		||||
+		for (loop = 0; (loop < 42) && status; ++loop)
 | 
			
		||||
+			status = ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE,
 | 
			
		||||
+						      0);
 | 
			
		||||
+
 | 
			
		||||
+		if (loop >= 42) {
 | 
			
		||||
+			ATH_DBG_WARN(1,
 | 
			
		||||
+				     "ath9k_hsr_write_a_chain: can't clear an output buffer after a 42 cycles.\n");
 | 
			
		||||
+			return -1;
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	for (i = 0; (i < items) && (chain[i] != 0); ++i)
 | 
			
		||||
+		ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, (u32)chain[i]);
 | 
			
		||||
+
 | 
			
		||||
+	ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0);
 | 
			
		||||
+	mdelay(HSR_DELAY_FINAL / 1000);
 | 
			
		||||
+
 | 
			
		||||
+	/* reply */
 | 
			
		||||
+	memset(chain, 0, items);
 | 
			
		||||
+
 | 
			
		||||
+	ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0);
 | 
			
		||||
+	udelay(HSR_DELAY_TRAILING);
 | 
			
		||||
+
 | 
			
		||||
+	for (i = 0; i < (items - 1); ++i) {
 | 
			
		||||
+		u32 ret;
 | 
			
		||||
+
 | 
			
		||||
+		ret = ath9k_hsr_write_byte(ah, HSR_DELAY_PRE_WRITE, 0);
 | 
			
		||||
+		if (ret != 0)
 | 
			
		||||
+			chain[i] = (char)ret;
 | 
			
		||||
+		else
 | 
			
		||||
+			break;
 | 
			
		||||
+
 | 
			
		||||
+		udelay(HSR_DELAY_TRAILING);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	if (i <= 1)
 | 
			
		||||
+		return 0;
 | 
			
		||||
+
 | 
			
		||||
+	err = kstrtoint(chain + 1, 10, &i);
 | 
			
		||||
+	if (err)
 | 
			
		||||
+		return err;
 | 
			
		||||
+
 | 
			
		||||
+	return i;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+int ath9k_hsr_disable(struct ath_hw *ah)
 | 
			
		||||
+{
 | 
			
		||||
+	char cmd[10] = {'b', '4', '0', 0, 0, 0, 0, 0, 0, 0};
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd));
 | 
			
		||||
+	if ((ret > 0) && (*cmd == 'B'))
 | 
			
		||||
+		return 0;
 | 
			
		||||
+
 | 
			
		||||
+	return -1;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+int ath9k_hsr_enable(struct ath_hw *ah, int bw, int fq)
 | 
			
		||||
+{
 | 
			
		||||
+	char cmd[10];
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	/* Bandwidth argument is 0 sometimes. Assume default 802.11bgn
 | 
			
		||||
+	 * 20MHz on invalid values
 | 
			
		||||
+	 */
 | 
			
		||||
+	if ((bw != 5) && (bw != 10) && (bw != 20) && (bw != 40))
 | 
			
		||||
+		bw = 20;
 | 
			
		||||
+
 | 
			
		||||
+	memset(cmd, 0, sizeof(cmd));
 | 
			
		||||
+	*cmd = 'b';
 | 
			
		||||
+	snprintf(cmd + 1, 3, "%02d", bw);
 | 
			
		||||
+
 | 
			
		||||
+	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd));
 | 
			
		||||
+	if ((*cmd != 'B') || (ret != bw)) {
 | 
			
		||||
+		ATH_DBG_WARN(1,
 | 
			
		||||
+			     "ath9k_hsr_enable: failed changing bandwidth -> set (%d,%d) reply (%d, %d)\n",
 | 
			
		||||
+			     'b', bw, *cmd, ret);
 | 
			
		||||
+		return -1;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	memset(cmd, 0, sizeof(cmd));
 | 
			
		||||
+	*cmd = 'x';
 | 
			
		||||
+	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd));
 | 
			
		||||
+	if (*cmd != 'X') {
 | 
			
		||||
+		ATH_DBG_WARN(1,
 | 
			
		||||
+			     "ath9k_hsr_enable: failed 'x' command -> reply (%d, %d)\n",
 | 
			
		||||
+			     *cmd, ret);
 | 
			
		||||
+		return -1;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	memset(cmd, 0, sizeof(cmd));
 | 
			
		||||
+	*cmd = 'm';
 | 
			
		||||
+	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd));
 | 
			
		||||
+	if (*cmd != 'M') {
 | 
			
		||||
+		ATH_DBG_WARN(1,
 | 
			
		||||
+			     "ath9k_hsr_enable: failed 'm' command -> reply (%d, %d)\n",
 | 
			
		||||
+			     *cmd, ret);
 | 
			
		||||
+		return  -1;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	memset(cmd, 0, sizeof(cmd));
 | 
			
		||||
+	*cmd = 'f';
 | 
			
		||||
+	snprintf(cmd + 1, 6, "%05d", fq);
 | 
			
		||||
+	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd));
 | 
			
		||||
+	if ((*cmd != 'F') && (ret != fq)) {
 | 
			
		||||
+		ATH_DBG_WARN(1,
 | 
			
		||||
+			     "ath9k_hsr_enable: failed set frequency -> reply (%d, %d)\n",
 | 
			
		||||
+			     *cmd, ret);
 | 
			
		||||
+		return -1;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+int ath9k_hsr_status(struct ath_hw *ah)
 | 
			
		||||
+{
 | 
			
		||||
+	char cmd[10] = {'s', 0, 0, 0, 0, 0, 0, 0, 0, 0};
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	ret = ath9k_hsr_write_a_chain(ah, cmd, sizeof(cmd));
 | 
			
		||||
+	if (*cmd != 'S') {
 | 
			
		||||
+		ATH_DBG_WARN(1, "ath9k_hsr_status: returned %d,%d\n", *cmd,
 | 
			
		||||
+			     ret);
 | 
			
		||||
+		return -1;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/hsr.h
 | 
			
		||||
@@ -0,0 +1,48 @@
 | 
			
		||||
+/*
 | 
			
		||||
+ * The MIT License (MIT)
 | 
			
		||||
+ *
 | 
			
		||||
+ * Copyright (c) 2015 Kirill Berezin
 | 
			
		||||
+ *
 | 
			
		||||
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
+ * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
+ * in the Software without restriction, including without limitation the rights
 | 
			
		||||
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
+ * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
+ * furnished to do so, subject to the following conditions:
 | 
			
		||||
+ *
 | 
			
		||||
+ * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
+ * all copies or substantial portions of the Software.
 | 
			
		||||
+ *
 | 
			
		||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
+ * SOFTWARE.
 | 
			
		||||
+ */
 | 
			
		||||
+
 | 
			
		||||
+#ifndef HSR_H
 | 
			
		||||
+#define HSR_H
 | 
			
		||||
+
 | 
			
		||||
+#ifdef CPTCFG_ATH9K_UBNTHSR
 | 
			
		||||
+
 | 
			
		||||
+void ath9k_hsr_init(struct ath_hw *ah);
 | 
			
		||||
+int ath9k_hsr_disable(struct ath_hw *ah);
 | 
			
		||||
+int ath9k_hsr_enable(struct ath_hw *ah, int bw, int fq);
 | 
			
		||||
+int ath9k_hsr_status(struct ath_hw *ah);
 | 
			
		||||
+
 | 
			
		||||
+#else
 | 
			
		||||
+static inline void ath9k_hsr_init(struct ath_hw *ah) {}
 | 
			
		||||
+
 | 
			
		||||
+static inline int ath9k_hsr_enable(struct ath_hw *ah, int bw, int fq)
 | 
			
		||||
+{
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static inline int ath9k_hsr_disable(struct ath_hw *ah) { return 0; }
 | 
			
		||||
+static inline int ath9k_hsr_status(struct ath_hw *ah) { return 0; }
 | 
			
		||||
+
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
+#endif /* HSR_H */
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath9k/main.c
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/main.c
 | 
			
		||||
@@ -18,6 +18,7 @@
 | 
			
		||||
 #include <linux/delay.h>
 | 
			
		||||
 #include "ath9k.h"
 | 
			
		||||
 #include "btcoex.h"
 | 
			
		||||
+#include "hsr.h"
 | 
			
		||||
 
 | 
			
		||||
 static void ath9k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 | 
			
		||||
 			u32 queues, bool drop);
 | 
			
		||||
@@ -658,6 +659,7 @@ void ath_reset_work(struct work_struct *
 | 
			
		||||
 static int ath9k_start(struct ieee80211_hw *hw)
 | 
			
		||||
 {
 | 
			
		||||
 	struct ath_softc *sc = hw->priv;
 | 
			
		||||
+	struct device_node *np = sc->dev->of_node;
 | 
			
		||||
 	struct ath_hw *ah = sc->sc_ah;
 | 
			
		||||
 	struct ath_common *common = ath9k_hw_common(ah);
 | 
			
		||||
 	struct ieee80211_channel *curchan = sc->cur_chan->chandef.chan;
 | 
			
		||||
@@ -736,6 +738,11 @@ static int ath9k_start(struct ieee80211_
 | 
			
		||||
 					  AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+	if (of_property_read_bool(np, "ubnt,hsr")) {
 | 
			
		||||
+		ath9k_hsr_init(ah);
 | 
			
		||||
+		ath9k_hsr_disable(ah);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	/*
 | 
			
		||||
 	 * Reset key cache to sane defaults (all entries cleared) instead of
 | 
			
		||||
 	 * semi-random values after suspend/resume.
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath9k/Makefile
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/Makefile
 | 
			
		||||
@@ -17,6 +17,7 @@ ath9k-$(CPTCFG_ATH9K_DFS_CERTIFIED) += d
 | 
			
		||||
 ath9k-$(CPTCFG_ATH9K_TX99) += tx99.o
 | 
			
		||||
 ath9k-$(CPTCFG_ATH9K_WOW) += wow.o
 | 
			
		||||
 ath9k-$(CPTCFG_ATH9K_HWRNG) += rng.o
 | 
			
		||||
+ath9k-$(CPTCFG_ATH9K_UBNTHSR) += hsr.o
 | 
			
		||||
 
 | 
			
		||||
 ath9k-$(CPTCFG_ATH9K_DEBUGFS) += debug.o
 | 
			
		||||
 
 | 
			
		||||
--- a/local-symbols
 | 
			
		||||
+++ b/local-symbols
 | 
			
		||||
@@ -121,6 +121,7 @@ ATH9K_WOW=
 | 
			
		||||
 ATH9K_RFKILL=
 | 
			
		||||
 ATH9K_CHANNEL_CONTEXT=
 | 
			
		||||
 ATH9K_PCOEM=
 | 
			
		||||
+ATH9K_UBNTHSR=
 | 
			
		||||
 ATH9K_PCI_NO_EEPROM=
 | 
			
		||||
 ATH9K_HTC=
 | 
			
		||||
 ATH9K_HTC_DEBUGFS=
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath9k/Kconfig
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/Kconfig
 | 
			
		||||
@@ -58,6 +58,19 @@ config ATH9K_AHB
 | 
			
		||||
 	  Say Y, if you have a SoC with a compatible built-in
 | 
			
		||||
 	  wireless MAC. Say N if unsure.
 | 
			
		||||
 
 | 
			
		||||
+config ATH9K_UBNTHSR
 | 
			
		||||
+	bool "Ubiquiti UniFi Outdoor Plus HSR support"
 | 
			
		||||
+	depends on ATH9K
 | 
			
		||||
+	---help---
 | 
			
		||||
+	  This options enables code to control the HSR RF
 | 
			
		||||
+	  filter in the receive path of the Ubiquiti UniFi
 | 
			
		||||
+	  Outdoor Plus access point.
 | 
			
		||||
+
 | 
			
		||||
+	  Say Y if you want to use the access point. The
 | 
			
		||||
+	  code will only be used if the device is detected,
 | 
			
		||||
+	  so it does not harm other setup other than occupying
 | 
			
		||||
+	  a bit of memory.
 | 
			
		||||
+
 | 
			
		||||
 config ATH9K_DEBUGFS
 | 
			
		||||
 	bool "Atheros ath9k debugging"
 | 
			
		||||
 	depends on ATH9K && DEBUG_FS && MAC80211_DEBUGFS
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
--- a/drivers/net/wireless/ath/ath9k/gpio.c	2024-09-16 14:38:11.938379419 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/gpio.c	2024-09-16 14:38:30.390115635 +0200
 | 
			
		||||
@@ -111,7 +111,7 @@
 | 
			
		||||
 	gc->gchip.get = ath9k_gpio_pin_get;
 | 
			
		||||
 	gc->gchip.set = ath9k_gpio_pin_set;
 | 
			
		||||
 
 | 
			
		||||
-	if (gpiochip_add(&gc->gchip)) {
 | 
			
		||||
+	if (gpiochip_add_data(&gc->gchip, NULL)) {
 | 
			
		||||
 		kfree(gc);
 | 
			
		||||
 		return;
 | 
			
		||||
 	}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
--- a/backport-include/linux/acpi_amd_wbrf.h	2024-09-13 14:55:36.816379630 +0200
 | 
			
		||||
+++ b/backport-include/linux/acpi_amd_wbrf.h	2024-09-13 14:55:47.792224160 +0200
 | 
			
		||||
@@ -7,9 +7,6 @@
 | 
			
		||||
 #ifndef _ACPI_AMD_WBRF_H
 | 
			
		||||
 #define _ACPI_AMD_WBRF_H
 | 
			
		||||
 
 | 
			
		||||
-#if LINUX_VERSION_IS_GEQ(6,8,0)
 | 
			
		||||
-#include_next <linux/acpi_amd_wbrf.h>
 | 
			
		||||
-#else
 | 
			
		||||
 #include <linux/device.h>
 | 
			
		||||
 #include <linux/notifier.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -82,5 +79,4 @@
 | 
			
		||||
 	return -ENODEV;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
-#endif /* >=6,8,0 */
 | 
			
		||||
 #endif /* _ACPI_AMD_WBRF_H */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,541 @@
 | 
			
		|||
--- a/net/wireless/trace.h	2024-09-13 13:11:10.145025393 +0200
 | 
			
		||||
+++ b/net/wireless/trace.h	2024-09-13 13:14:21.774308452 +0200
 | 
			
		||||
@@ -372,7 +372,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
 		WIPHY_ASSIGN;
 | 
			
		||||
-		__assign_str(vir_intf_name, name ? name : "<noname>");
 | 
			
		||||
+		__assign_str(vir_intf_name);
 | 
			
		||||
 		__entry->type = type;
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_printk(WIPHY_PR_FMT ", virtual intf name: %s, type: %d",
 | 
			
		||||
--- a/net/mac80211/trace.h	2024-09-13 13:27:20.887264216 +0200
 | 
			
		||||
+++ b/net/mac80211/trace.h	2024-09-13 13:29:33.057391014 +0200
 | 
			
		||||
@@ -33,7 +33,7 @@
 | 
			
		||||
 			__string(vif_name, sdata->name)
 | 
			
		||||
 #define VIF_ASSIGN	__entry->vif_type = sdata->vif.type; __entry->sdata = sdata;	\
 | 
			
		||||
 			__entry->p2p = sdata->vif.p2p;					\
 | 
			
		||||
-			__assign_str(vif_name, sdata->name)
 | 
			
		||||
+			__assign_str(vif_name)
 | 
			
		||||
 #define VIF_PR_FMT	" vif:%s(%d%s)"
 | 
			
		||||
 #define VIF_PR_ARG	__get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : ""
 | 
			
		||||
 
 | 
			
		||||
--- a/drivers/bus/mhi/host/trace.h	2024-09-13 13:31:32.207702337 +0200
 | 
			
		||||
+++ b/drivers/bus/mhi/host/trace.h	2024-09-13 13:32:22.330991957 +0200
 | 
			
		||||
@@ -103,7 +103,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(name, mhi_cntrl->mhi_dev->name);
 | 
			
		||||
+		__assign_str(name);
 | 
			
		||||
 		__entry->ch_num = mhi_chan->chan;
 | 
			
		||||
 		__entry->wp = mhi_tre;
 | 
			
		||||
 		__entry->tre_ptr = mhi_tre->ptr;
 | 
			
		||||
@@ -131,7 +131,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(name, mhi_cntrl->mhi_dev->name);
 | 
			
		||||
+		__assign_str(name);
 | 
			
		||||
 		__entry->local_ee = mhi_cntrl->ee;
 | 
			
		||||
 		__entry->state = mhi_cntrl->dev_state;
 | 
			
		||||
 		__entry->dev_ee = dev_ee;
 | 
			
		||||
@@ -158,7 +158,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(name, mhi_cntrl->mhi_dev->name);
 | 
			
		||||
+		__assign_str(name);
 | 
			
		||||
 		if (pm_state)
 | 
			
		||||
 			pm_state = __fls(pm_state);
 | 
			
		||||
 		__entry->pm_state = pm_state;
 | 
			
		||||
@@ -184,7 +184,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(name, mhi_cntrl->mhi_dev->name);
 | 
			
		||||
+		__assign_str(name);
 | 
			
		||||
 		__entry->rp = rp;
 | 
			
		||||
 		__entry->ptr = rp->ptr;
 | 
			
		||||
 		__entry->dword0 = rp->dword[0];
 | 
			
		||||
@@ -226,7 +226,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(name, mhi_cntrl->mhi_dev->name);
 | 
			
		||||
+		__assign_str(name);
 | 
			
		||||
 		__entry->ch_num = mhi_chan->chan;
 | 
			
		||||
 		__entry->state = state;
 | 
			
		||||
 		__entry->reason = reason;
 | 
			
		||||
@@ -265,7 +265,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(name, mhi_cntrl->mhi_dev->name);
 | 
			
		||||
+		__assign_str(name);
 | 
			
		||||
 		__entry->state = state;
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath10k/trace.h	2024-09-13 13:31:32.087704038 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath10k/trace.h	2024-09-13 13:35:37.760222205 +0200
 | 
			
		||||
@@ -55,8 +55,8 @@
 | 
			
		||||
 		__vstring(msg, vaf->fmt, vaf->va)
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__assign_vstr(msg, vaf->fmt, vaf->va);
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_printk(
 | 
			
		||||
@@ -92,8 +92,8 @@
 | 
			
		||||
 		__vstring(msg, vaf->fmt, vaf->va)
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->level = level;
 | 
			
		||||
 		__assign_vstr(msg, vaf->fmt, vaf->va);
 | 
			
		||||
 	),
 | 
			
		||||
@@ -121,10 +121,10 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
-		__assign_str(msg, msg);
 | 
			
		||||
-		__assign_str(prefix, prefix);
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
+		__assign_str(msg);
 | 
			
		||||
+		__assign_str(prefix);
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(buf), buf, buf_len);
 | 
			
		||||
 	),
 | 
			
		||||
@@ -152,8 +152,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->id = id;
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(buf), buf, buf_len);
 | 
			
		||||
@@ -182,8 +182,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->id = id;
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(buf), buf, buf_len);
 | 
			
		||||
@@ -211,8 +211,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(buf), buf, buf_len);
 | 
			
		||||
 	),
 | 
			
		||||
@@ -239,8 +239,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->hw_type = ar->hw_rev;
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(buf), buf, buf_len);
 | 
			
		||||
@@ -269,8 +269,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->hw_type = ar->hw_rev;
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(pktlog), buf, buf_len);
 | 
			
		||||
@@ -301,8 +301,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->msdu_id = msdu_id;
 | 
			
		||||
 		__entry->msdu_len = msdu_len;
 | 
			
		||||
 		__entry->vdev_id = vdev_id;
 | 
			
		||||
@@ -332,8 +332,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->msdu_id = msdu_id;
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
@@ -358,8 +358,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->len = ath10k_frm_hdr_len(data, len);
 | 
			
		||||
 		memcpy(__get_dynamic_array(data), data, __entry->len);
 | 
			
		||||
 	),
 | 
			
		||||
@@ -386,8 +386,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->len = len - ath10k_frm_hdr_len(data, len);
 | 
			
		||||
 		memcpy(__get_dynamic_array(payload),
 | 
			
		||||
 		       data + ath10k_frm_hdr_len(data, len), __entry->len);
 | 
			
		||||
@@ -435,8 +435,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->hw_type = ar->hw_rev;
 | 
			
		||||
 		__entry->len = len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(rxdesc), data, len);
 | 
			
		||||
@@ -472,8 +472,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->type = type;
 | 
			
		||||
 		__entry->timestamp = timestamp;
 | 
			
		||||
 		__entry->code = code;
 | 
			
		||||
@@ -505,8 +505,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->len = len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(data), data, len);
 | 
			
		||||
 	),
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath11k/trace.h	2024-09-13 13:31:32.047704605 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath11k/trace.h	2024-09-13 13:37:29.026645264 +0200
 | 
			
		||||
@@ -48,8 +48,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		__entry->pktlog_checksum = pktlog_checksum;
 | 
			
		||||
 		memcpy(__get_dynamic_array(pktlog), buf, buf_len);
 | 
			
		||||
@@ -77,8 +77,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->len = len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(ppdu), data, len);
 | 
			
		||||
 	),
 | 
			
		||||
@@ -105,8 +105,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->len = len;
 | 
			
		||||
 		__entry->log_type = log_type;
 | 
			
		||||
 		memcpy(__get_dynamic_array(rxdesc), data, len);
 | 
			
		||||
@@ -130,8 +130,8 @@
 | 
			
		||||
 		__vstring(msg, vaf->fmt, vaf->va)
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__assign_vstr(msg, vaf->fmt, vaf->va);
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_printk(
 | 
			
		||||
@@ -171,8 +171,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->id = id;
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(buf), buf, buf_len);
 | 
			
		||||
@@ -201,8 +201,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->id = id;
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(buf), buf, buf_len);
 | 
			
		||||
@@ -230,8 +230,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->level = level;
 | 
			
		||||
 		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
 | 
			
		||||
 				       ATH11K_MSG_MAX, vaf->fmt,
 | 
			
		||||
@@ -262,10 +262,10 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ab->dev));
 | 
			
		||||
-		__assign_str(msg, msg);
 | 
			
		||||
-		__assign_str(prefix, prefix);
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
+		__assign_str(msg);
 | 
			
		||||
+		__assign_str(prefix);
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(buf), buf, buf_len);
 | 
			
		||||
 	),
 | 
			
		||||
@@ -292,8 +292,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->len = len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(data), data, len);
 | 
			
		||||
 	),
 | 
			
		||||
@@ -318,8 +318,8 @@
 | 
			
		||||
 			 __field(u32, peer_ps_timestamp)
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
-	TP_fast_assign(__assign_str(device, dev_name(ar->ab->dev));
 | 
			
		||||
-		       __assign_str(driver, dev_driver_string(ar->ab->dev));
 | 
			
		||||
+	TP_fast_assign(__assign_str(device);
 | 
			
		||||
+		       __assign_str(driver);
 | 
			
		||||
 		       memcpy(__get_dynamic_array(peer_addr), peer_addr,
 | 
			
		||||
 			      ETH_ALEN);
 | 
			
		||||
 		       __entry->peer_ps_state = peer_ps_state;
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath12k/trace.h	2024-09-13 13:31:32.071704265 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath12k/trace.h	2024-09-13 13:38:04.682139931 +0200
 | 
			
		||||
@@ -36,8 +36,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		__entry->pktlog_checksum = pktlog_checksum;
 | 
			
		||||
 		memcpy(__get_dynamic_array(pktlog), buf, buf_len);
 | 
			
		||||
@@ -73,8 +73,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->len = len;
 | 
			
		||||
 		__entry->info = ar->pdev->timestamp.info;
 | 
			
		||||
 		__entry->sync_tstmp_lo_us = ar->pdev->timestamp.sync_timestamp_hi_us;
 | 
			
		||||
@@ -117,8 +117,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ar->ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ar->ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->len = len;
 | 
			
		||||
 		__entry->type = type;
 | 
			
		||||
 		__entry->info = ar->pdev->timestamp.info;
 | 
			
		||||
@@ -153,8 +153,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(device, dev_name(ab->dev));
 | 
			
		||||
-		__assign_str(driver, dev_driver_string(ab->dev));
 | 
			
		||||
+		__assign_str(device);
 | 
			
		||||
+		__assign_str(driver);
 | 
			
		||||
 		__entry->len = len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(data), data, len);
 | 
			
		||||
 	),
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath6kl/trace.h	2024-09-13 13:31:32.079704151 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath6kl/trace.h	2024-09-13 13:33:01.462437360 +0200
 | 
			
		||||
@@ -304,8 +304,8 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(msg, msg);
 | 
			
		||||
-		__assign_str(prefix, prefix);
 | 
			
		||||
+		__assign_str(msg);
 | 
			
		||||
+		__assign_str(prefix);
 | 
			
		||||
 		__entry->buf_len = buf_len;
 | 
			
		||||
 		memcpy(__get_dynamic_array(buf), buf, buf_len);
 | 
			
		||||
 	),
 | 
			
		||||
--- a/drivers/net/wireless/ath/trace.h	2024-09-13 13:31:32.043704662 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/trace.h	2024-09-13 13:44:05.849032491 +0200
 | 
			
		||||
@@ -44,8 +44,8 @@
 | 
			
		||||
 	    ),
 | 
			
		||||
 
 | 
			
		||||
 	    TP_fast_assign(
 | 
			
		||||
-		    __assign_str(device, wiphy_name(wiphy));
 | 
			
		||||
-		    __assign_str(driver, KBUILD_MODNAME);
 | 
			
		||||
+		    __assign_str(device);
 | 
			
		||||
+		    __assign_str(driver);
 | 
			
		||||
 		    __assign_vstr(msg, vaf->fmt, vaf->va);
 | 
			
		||||
 	    ),
 | 
			
		||||
 
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h	2024-09-13 13:31:31.999705285 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h	2024-09-13 13:42:28.746405624 +0200
 | 
			
		||||
@@ -41,7 +41,7 @@
 | 
			
		||||
 		__vstring(msg, vaf->fmt, vaf->va)
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(func, func);
 | 
			
		||||
+		__assign_str(func);
 | 
			
		||||
 		__assign_vstr(msg, vaf->fmt, vaf->va);
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_printk("%s: %s", __get_str(func), __get_str(msg))
 | 
			
		||||
@@ -57,7 +57,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
 		__entry->level = level;
 | 
			
		||||
-		__assign_str(func, func);
 | 
			
		||||
+		__assign_str(func);
 | 
			
		||||
 		__assign_vstr(msg, vaf->fmt, vaf->va);
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_printk("%s: %s", __get_str(func), __get_str(msg))
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac.h	2024-09-13 13:31:32.011705114 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac.h	2024-09-13 13:42:44.218186836 +0200
 | 
			
		||||
@@ -81,7 +81,7 @@
 | 
			
		||||
 		__field(u32, mask)
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(dev, dev_name(dev));
 | 
			
		||||
+		__assign_str(dev);
 | 
			
		||||
 		__entry->in_isr = in_isr;
 | 
			
		||||
 		__entry->macintstatus = macintstatus;
 | 
			
		||||
 		__entry->mask = mask;
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h	2024-09-13 13:31:32.011705114 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h	2024-09-13 13:42:52.242073370 +0200
 | 
			
		||||
@@ -71,7 +71,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
 		__entry->level = level;
 | 
			
		||||
-		__assign_str(func, func);
 | 
			
		||||
+		__assign_str(func);
 | 
			
		||||
 		__assign_vstr(msg, vaf->fmt, vaf->va);
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_printk("%s: %s", __get_str(func), __get_str(msg))
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_tx.h	2024-09-13 13:31:32.011705114 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_tx.h	2024-09-13 13:43:12.721783766 +0200
 | 
			
		||||
@@ -31,7 +31,7 @@
 | 
			
		||||
 		__dynamic_array(u8, txh, txh_len)
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(dev, dev_name(dev));
 | 
			
		||||
+		__assign_str(dev);
 | 
			
		||||
 		memcpy(__get_dynamic_array(txh), txh, txh_len);
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_printk("[%s] txdesc", __get_str(dev))
 | 
			
		||||
@@ -54,7 +54,7 @@
 | 
			
		||||
 		__field(u16, ackphyrxsh)
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(dev, dev_name(dev));
 | 
			
		||||
+		__assign_str(dev);
 | 
			
		||||
 		__entry->framelen = framelen;
 | 
			
		||||
 		__entry->frameid = frameid;
 | 
			
		||||
 		__entry->status = status;
 | 
			
		||||
@@ -85,7 +85,7 @@
 | 
			
		||||
 		__field(u16, dma_len)
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(dev, dev_name(dev));
 | 
			
		||||
+		__assign_str(dev);
 | 
			
		||||
 		__entry->max_ampdu_len = max_ampdu_len;
 | 
			
		||||
 		__entry->max_ampdu_frames = max_ampdu_frames;
 | 
			
		||||
 		__entry->ampdu_len = ampdu_len;
 | 
			
		||||
--- a/drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h	2024-09-13 13:31:31.915706475 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h	2024-09-13 13:41:47.314991509 +0200
 | 
			
		||||
@@ -87,7 +87,7 @@
 | 
			
		||||
 #endif
 | 
			
		||||
 
 | 
			
		||||
 #define DEV_ENTRY	__string(dev, dev_name(dev))
 | 
			
		||||
-#define DEV_ASSIGN	__assign_str(dev, dev_name(dev))
 | 
			
		||||
+#define DEV_ASSIGN	__assign_str(dev)
 | 
			
		||||
 
 | 
			
		||||
 #include "iwl-devtrace-io.h"
 | 
			
		||||
 #include "iwl-devtrace-ucode.h"
 | 
			
		||||
--- a/drivers/net/wireless/intel/iwlwifi/iwl-devtrace-msg.h	2024-09-13 13:31:31.915706475 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-devtrace-msg.h	2024-09-13 13:41:36.363146379 +0200
 | 
			
		||||
@@ -57,7 +57,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
 		__entry->level = level;
 | 
			
		||||
-		__assign_str(function, function);
 | 
			
		||||
+		__assign_str(function);
 | 
			
		||||
 		__assign_vstr(msg, vaf->fmt, vaf->va);
 | 
			
		||||
 	),
 | 
			
		||||
 	TP_printk("%s", __get_str(msg))
 | 
			
		||||
--- a/include/trace/events/qrtr.h	2024-09-13 13:31:32.207702337 +0200
 | 
			
		||||
+++ b/include/trace/events/qrtr.h	2024-09-13 13:39:51.068635354 +0200
 | 
			
		||||
@@ -102,7 +102,7 @@
 | 
			
		||||
 	),
 | 
			
		||||
 
 | 
			
		||||
 	TP_fast_assign(
 | 
			
		||||
-		__assign_str(ctrl_pkt_str, ctrl_pkt_str);
 | 
			
		||||
+		__assign_str(ctrl_pkt_str);
 | 
			
		||||
 		__entry->sq_node = sq_node;
 | 
			
		||||
 		__entry->sq_port = sq_port;
 | 
			
		||||
 	),
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,798 @@
 | 
			
		|||
diff '--color=auto' -aurN a/backport-include/asm/unaligned.h b/backport-include/asm/unaligned.h
 | 
			
		||||
--- a/backport-include/asm/unaligned.h	2024-10-08 14:34:12.163916078 +0200
 | 
			
		||||
+++ b/backport-include/asm/unaligned.h	2024-10-08 14:35:43.894639195 +0200
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
 #ifndef __BACKPORT_ASM_GENERIC_UNALIGNED_H
 | 
			
		||||
 #define __BACKPORT_ASM_GENERIC_UNALIGNED_H
 | 
			
		||||
-#include_next <asm/unaligned.h>
 | 
			
		||||
+#include_next <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #if LINUX_VERSION_IS_LESS(5,7,0)
 | 
			
		||||
 static inline u32 __get_unaligned_be24(const u8 *p)
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
 | 
			
		||||
--- a/drivers/net/usb/sierra_net.c	2024-10-08 14:34:12.107916857 +0200
 | 
			
		||||
+++ b/drivers/net/usb/sierra_net.c	2024-10-08 14:35:43.982637970 +0200
 | 
			
		||||
@@ -30,7 +30,7 @@
 | 
			
		||||
 #include <linux/usb/cdc.h>
 | 
			
		||||
 #include <net/ip.h>
 | 
			
		||||
 #include <net/udp.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <linux/usb/usbnet.h>
 | 
			
		||||
 
 | 
			
		||||
 #define SWI_USB_REQUEST_GET_FW_ATTR	0x06
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath5k/base.c	2024-10-08 14:34:12.155916189 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath5k/base.c	2024-10-08 14:35:44.266634016 +0200
 | 
			
		||||
@@ -59,7 +59,7 @@
 | 
			
		||||
 #include <net/cfg80211.h>
 | 
			
		||||
 #include <net/ieee80211_radiotap.h>
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
 #include "base.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c	2024-10-08 14:34:12.155916189 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c	2024-10-08 14:35:44.342632959 +0200
 | 
			
		||||
@@ -44,7 +44,7 @@
 | 
			
		||||
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 | 
			
		||||
 
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "ath5k.h"
 | 
			
		||||
 #include "base.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath5k/pcu.c	2024-10-08 14:34:12.155916189 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath5k/pcu.c	2024-10-08 14:35:44.266634016 +0200
 | 
			
		||||
@@ -24,7 +24,7 @@
 | 
			
		||||
 * Protocol Control Unit Functions *
 | 
			
		||||
 \*********************************/
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "ath5k.h"
 | 
			
		||||
 #include "reg.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath5k/phy.c	2024-10-08 14:34:12.155916189 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath5k/phy.c	2024-10-08 14:35:44.342632959 +0200
 | 
			
		||||
@@ -27,7 +27,7 @@
 | 
			
		||||
 #include <linux/delay.h>
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <linux/sort.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "ath5k.h"
 | 
			
		||||
 #include "reg.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath5k/reset.c	2024-10-08 14:34:12.155916189 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath5k/reset.c	2024-10-08 14:35:44.266634016 +0200
 | 
			
		||||
@@ -25,7 +25,7 @@
 | 
			
		||||
 
 | 
			
		||||
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include <linux/pci.h>		/* To determine if a card is pci-e */
 | 
			
		||||
 #include <linux/log2.h>
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c	2024-10-08 14:34:12.151916244 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c	2024-10-08 14:35:44.038637190 +0200
 | 
			
		||||
@@ -21,7 +21,7 @@
 | 
			
		||||
 #include "hif-ops.h"
 | 
			
		||||
 #include "trace.h"
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #define CALC_TXRX_PADDED_LEN(dev, len)  (__ALIGN_MASK((len), (dev)->block_mask))
 | 
			
		||||
 
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c	2024-10-08 14:34:12.151916244 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c	2024-10-08 14:35:44.190635074 +0200
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <linux/kernel.h>
 | 
			
		||||
 #include "hw.h"
 | 
			
		||||
 #include "ar9003_phy.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath9k/debug.c	2024-10-08 14:34:12.151916244 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/debug.c	2024-10-08 14:35:44.190635074 +0200
 | 
			
		||||
@@ -17,7 +17,7 @@
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <linux/vmalloc.h>
 | 
			
		||||
 #include <linux/export.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "ath9k.h"
 | 
			
		||||
 
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c	2024-10-08 14:34:12.151916244 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c	2024-10-08 14:35:44.266634016 +0200
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "hw.h"
 | 
			
		||||
 #include "ar9002_phy.h"
 | 
			
		||||
 
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c	2024-10-08 14:34:12.151916244 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c	2024-10-08 14:35:44.190635074 +0200
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "hw.h"
 | 
			
		||||
 #include "ar9002_phy.h"
 | 
			
		||||
 
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c	2024-10-08 14:34:12.151916244 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c	2024-10-08 14:35:44.190635074 +0200
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "hw.h"
 | 
			
		||||
 #include "ar9002_phy.h"
 | 
			
		||||
 
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c	2024-10-08 14:34:12.151916244 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c	2024-10-08 14:35:44.190635074 +0200
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "htc.h"
 | 
			
		||||
 
 | 
			
		||||
 MODULE_FIRMWARE(HTC_7010_MODULE_FW);
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/ath9k/hw.c	2024-10-08 14:34:12.151916244 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/ath9k/hw.c	2024-10-08 14:35:44.106636244 +0200
 | 
			
		||||
@@ -21,7 +21,7 @@
 | 
			
		||||
 #include <linux/bitops.h>
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
 #include <linux/gpio.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "hw.h"
 | 
			
		||||
 #include "hw-ops.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/carl9170/mac.c b/drivers/net/wireless/ath/carl9170/mac.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/carl9170/mac.c	2024-10-08 14:34:12.151916244 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/carl9170/mac.c	2024-10-08 14:35:44.106636244 +0200
 | 
			
		||||
@@ -36,7 +36,7 @@
 | 
			
		||||
  *    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "carl9170.h"
 | 
			
		||||
 #include "cmd.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/hw.c b/drivers/net/wireless/ath/hw.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/hw.c	2024-10-08 14:34:12.143916356 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/hw.c	2024-10-08 14:35:44.106636244 +0200
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
 #include <linux/export.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "ath.h"
 | 
			
		||||
 #include "reg.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c
 | 
			
		||||
--- a/drivers/net/wireless/ath/key.c	2024-10-08 14:34:12.143916356 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ath/key.c	2024-10-08 14:35:44.106636244 +0200
 | 
			
		||||
@@ -16,7 +16,7 @@
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
 #include <linux/export.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "ath.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/b43/main.c	2024-10-08 14:34:12.131916523 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/b43/main.c	2024-10-08 14:35:44.418631901 +0200
 | 
			
		||||
@@ -30,7 +30,7 @@
 | 
			
		||||
 #include <linux/io.h>
 | 
			
		||||
 #include <linux/dma-mapping.h>
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "b43.h"
 | 
			
		||||
 #include "main.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/broadcom/b43legacy/main.c b/drivers/net/wireless/broadcom/b43legacy/main.c
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/b43legacy/main.c	2024-10-08 14:34:12.135916466 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/b43legacy/main.c	2024-10-08 14:35:44.342632959 +0200
 | 
			
		||||
@@ -27,7 +27,7 @@
 | 
			
		||||
 #include <linux/dma-mapping.h>
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <net/dst.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "b43legacy.h"
 | 
			
		||||
 #include "main.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h	2024-10-08 14:34:12.135916466 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h	2024-10-08 14:35:44.342632959 +0200
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
 #ifndef FWEH_H_
 | 
			
		||||
 #define FWEH_H_
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <linux/skbuff.h>
 | 
			
		||||
 #include <linux/if_ether.h>
 | 
			
		||||
 #include <linux/if.h>
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c	2024-10-08 14:34:12.135916466 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c	2024-10-08 14:35:44.418631901 +0200
 | 
			
		||||
@@ -16,7 +16,7 @@
 | 
			
		||||
 #include <linux/kthread.h>
 | 
			
		||||
 #include <linux/io.h>
 | 
			
		||||
 #include <linux/random.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include <soc.h>
 | 
			
		||||
 #include <chipcommon.h>
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c	2024-10-08 14:34:12.131916523 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c	2024-10-08 14:35:44.342632959 +0200
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
 #include <linux/bcma/bcma.h>
 | 
			
		||||
 #include <linux/debugfs.h>
 | 
			
		||||
 #include <linux/vmalloc.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <defs.h>
 | 
			
		||||
 #include <brcmu_wifi.h>
 | 
			
		||||
 #include <brcmu_utils.h>
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/xtlv.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/xtlv.c
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/xtlv.c	2024-10-08 14:34:12.135916466 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/xtlv.c	2024-10-08 14:35:44.342632959 +0200
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
  * Copyright (c) 2019 Broadcom
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include <linux/math.h>
 | 
			
		||||
 #include <linux/string.h>
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/intel/iwlegacy/3945.c b/drivers/net/wireless/intel/iwlegacy/3945.c
 | 
			
		||||
--- a/drivers/net/wireless/intel/iwlegacy/3945.c	2024-10-08 14:34:12.127916579 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/intel/iwlegacy/3945.c	2024-10-08 14:35:44.490630899 +0200
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
 #include <linux/netdevice.h>
 | 
			
		||||
 #include <linux/firmware.h>
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "common.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/intel/iwlegacy/4965.c b/drivers/net/wireless/intel/iwlegacy/4965.c
 | 
			
		||||
--- a/drivers/net/wireless/intel/iwlegacy/4965.c	2024-10-08 14:34:12.127916579 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/intel/iwlegacy/4965.c	2024-10-08 14:35:44.490630899 +0200
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
 #include <linux/units.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "common.h"
 | 
			
		||||
 #include "4965.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/intel/iwlwifi/dvm/led.c b/drivers/net/wireless/intel/iwlwifi/dvm/led.c
 | 
			
		||||
--- a/drivers/net/wireless/intel/iwlwifi/dvm/led.c	2024-10-08 14:34:12.123916635 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/led.c	2024-10-08 14:35:44.490630899 +0200
 | 
			
		||||
@@ -13,7 +13,7 @@
 | 
			
		||||
 #include <linux/netdevice.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "iwl-io.h"
 | 
			
		||||
 #include "iwl-trans.h"
 | 
			
		||||
 #include "iwl-modparams.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/intel/iwlwifi/dvm/rx.c b/drivers/net/wireless/intel/iwlwifi/dvm/rx.c
 | 
			
		||||
--- a/drivers/net/wireless/intel/iwlwifi/dvm/rx.c	2024-10-08 14:34:12.123916635 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/rx.c	2024-10-08 14:35:44.490630899 +0200
 | 
			
		||||
@@ -13,7 +13,7 @@
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <linux/sched.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "iwl-trans.h"
 | 
			
		||||
 #include "iwl-io.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
 | 
			
		||||
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c	2024-10-08 14:34:12.123916635 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c	2024-10-08 14:35:44.490630899 +0200
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
 | 
			
		||||
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
 | 
			
		||||
  */
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
 #include <linux/skbuff.h>
 | 
			
		||||
 #include "iwl-trans.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c
 | 
			
		||||
--- a/drivers/net/wireless/marvell/libertas/cfg.c	2024-10-08 14:34:12.127916579 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/marvell/libertas/cfg.c	2024-10-08 14:35:44.490630899 +0200
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <linux/ieee80211.h>
 | 
			
		||||
 #include <net/cfg80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "decl.h"
 | 
			
		||||
 #include "cfg.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/marvell/libertas/cmdresp.c b/drivers/net/wireless/marvell/libertas/cmdresp.c
 | 
			
		||||
--- a/drivers/net/wireless/marvell/libertas/cmdresp.c	2024-10-08 14:34:12.127916579 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/marvell/libertas/cmdresp.c	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <linux/delay.h>
 | 
			
		||||
 #include <linux/sched.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <net/cfg80211.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "cfg.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
 | 
			
		||||
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c	2024-10-08 14:34:12.131916523 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c	2024-10-08 14:35:44.490630899 +0200
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
  * Copyright 2011-2020 NXP
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "decl.h"
 | 
			
		||||
 #include "ioctl.h"
 | 
			
		||||
 #include "util.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
 | 
			
		||||
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c	2024-10-08 14:34:12.139916412 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -10,7 +10,7 @@
 | 
			
		||||
 #include <linux/mtd/mtd.h>
 | 
			
		||||
 #include <linux/mtd/partitions.h>
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "mt76x0.h"
 | 
			
		||||
 #include "eeprom.h"
 | 
			
		||||
 #include "../mt76x02_phy.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c
 | 
			
		||||
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c	2024-10-08 14:34:12.135916466 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
  * Copyright (C) 2018 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "mt76x02_eeprom.h"
 | 
			
		||||
 
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c
 | 
			
		||||
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c	2024-10-08 14:34:12.139916412 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
 
 | 
			
		||||
 #include <linux/module.h>
 | 
			
		||||
 #include <linux/of.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "mt76x2.h"
 | 
			
		||||
 #include "eeprom.h"
 | 
			
		||||
 
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/mediatek/mt7601u/dma.h b/drivers/net/wireless/mediatek/mt7601u/dma.h
 | 
			
		||||
--- a/drivers/net/wireless/mediatek/mt7601u/dma.h	2024-10-08 14:34:12.143916356 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/mediatek/mt7601u/dma.h	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
 #ifndef __MT7601U_DMA_H
 | 
			
		||||
 #define __MT7601U_DMA_H
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <linux/skbuff.h>
 | 
			
		||||
 
 | 
			
		||||
 #define MT_DMA_HDR_LEN			4
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/mediatek/mt7601u/eeprom.c b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
 | 
			
		||||
--- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c	2024-10-08 14:34:12.143916356 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 #include <linux/mtd/mtd.h>
 | 
			
		||||
 #include <linux/mtd/partitions.h>
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "mt7601u.h"
 | 
			
		||||
 #include "eeprom.h"
 | 
			
		||||
 #include "mac.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
 | 
			
		||||
--- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c	2024-10-08 14:34:12.119916691 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -17,7 +17,7 @@
 | 
			
		||||
 #include <linux/workqueue.h>
 | 
			
		||||
 #include <linux/module.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "zd_def.h"
 | 
			
		||||
 #include "zd_mac.h"
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
 | 
			
		||||
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c	2024-10-08 14:35:44.666628449 +0200
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
 
 | 
			
		||||
 #include <drv_types.h>
 | 
			
		||||
 #include <rtw_debug.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 void init_mlme_ap_info(struct adapter *padapter)
 | 
			
		||||
 {
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
 | 
			
		||||
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c	2024-10-08 14:35:44.610629228 +0200
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 #include <drv_types.h>
 | 
			
		||||
 #include <rtw_debug.h>
 | 
			
		||||
 #include <linux/of.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 u8 RTW_WPA_OUI_TYPE[] = { 0x00, 0x50, 0xf2, 1 };
 | 
			
		||||
 u16 RTW_WPA_VERSION = 1;
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
 | 
			
		||||
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
 #include <rtw_wifi_regd.h>
 | 
			
		||||
 #include <hal_btcoex.h>
 | 
			
		||||
 #include <linux/kernel.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 static struct mlme_handler mlme_sta_tbl[] = {
 | 
			
		||||
 	{WIFI_ASSOCREQ,		"OnAssocReq",	&OnAssocReq},
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
 | 
			
		||||
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
 #include <linux/jiffies.h>
 | 
			
		||||
 #include <rtw_recv.h>
 | 
			
		||||
 #include <net/cfg80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 static u8 SNAP_ETH_TYPE_IPX[2] = {0x81, 0x37};
 | 
			
		||||
 static u8 SNAP_ETH_TYPE_APPLETALK_AARP[2] = {0x80, 0xf3};
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c
 | 
			
		||||
--- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c	2024-10-08 14:34:12.107916857 +0200
 | 
			
		||||
+++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 #include <rtw_debug.h>
 | 
			
		||||
 #include <linux/jiffies.h>
 | 
			
		||||
 #include <net/cfg80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 void rtw_os_free_recvframe(union recv_frame *precvframe)
 | 
			
		||||
 {
 | 
			
		||||
diff '--color=auto' -aurN a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
 | 
			
		||||
--- a/drivers/usb/class/cdc-wdm.c	2024-10-08 14:34:12.159916134 +0200
 | 
			
		||||
+++ b/drivers/usb/class/cdc-wdm.c	2024-10-08 14:35:44.494630843 +0200
 | 
			
		||||
@@ -26,7 +26,7 @@
 | 
			
		||||
 #include <linux/usb/cdc.h>
 | 
			
		||||
 #include <linux/wwan.h>
 | 
			
		||||
 #include <asm/byteorder.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <linux/usb/cdc-wdm.h>
 | 
			
		||||
 
 | 
			
		||||
 #define DRIVER_AUTHOR "Oliver Neukum"
 | 
			
		||||
diff '--color=auto' -aurN a/include/linux/ieee80211.h b/include/linux/ieee80211.h
 | 
			
		||||
--- a/include/linux/ieee80211.h	2024-10-08 14:34:12.163916078 +0200
 | 
			
		||||
+++ b/include/linux/ieee80211.h	2024-10-08 14:35:44.734627502 +0200
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
 #include <linux/bitfield.h>
 | 
			
		||||
 #include <asm/byteorder.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
  * DS bit usage
 | 
			
		||||
diff '--color=auto' -aurN a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
 | 
			
		||||
--- a/include/net/ieee80211_radiotap.h	2024-10-08 14:34:12.159916134 +0200
 | 
			
		||||
+++ b/include/net/ieee80211_radiotap.h	2024-10-08 14:35:44.666628449 +0200
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
 #define __RADIOTAP_H
 | 
			
		||||
 
 | 
			
		||||
 #include <linux/kernel.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 /**
 | 
			
		||||
  * struct ieee80211_radiotap_header - base radiotap header
 | 
			
		||||
diff '--color=auto' -aurN a/include/net/mac80211.h b/include/net/mac80211.h
 | 
			
		||||
--- a/include/net/mac80211.h	2024-10-08 14:34:12.159916134 +0200
 | 
			
		||||
+++ b/include/net/mac80211.h	2024-10-08 14:35:44.666628449 +0200
 | 
			
		||||
@@ -22,7 +22,7 @@
 | 
			
		||||
 #include <net/cfg80211.h>
 | 
			
		||||
 #include <net/codel.h>
 | 
			
		||||
 #include <net/ieee80211_radiotap.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 /**
 | 
			
		||||
  * DOC: Introduction
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/key.c b/net/mac80211/key.c
 | 
			
		||||
--- a/net/mac80211/key.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/key.c	2024-10-08 14:35:44.734627502 +0200
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <linux/export.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "ieee80211_i.h"
 | 
			
		||||
 #include "driver-ops.h"
 | 
			
		||||
 #include "debugfs_key.h"
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/mesh.c b/net/mac80211/mesh.c
 | 
			
		||||
--- a/net/mac80211/mesh.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/mesh.c	2024-10-08 14:35:44.906625108 +0200
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "ieee80211_i.h"
 | 
			
		||||
 #include "mesh.h"
 | 
			
		||||
 #include "wme.h"
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
 | 
			
		||||
--- a/net/mac80211/mesh_hwmp.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/mesh_hwmp.c	2024-10-08 14:35:44.906625108 +0200
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
 
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "wme.h"
 | 
			
		||||
 #include "mesh.h"
 | 
			
		||||
 
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/michael.c b/net/mac80211/michael.c
 | 
			
		||||
--- a/net/mac80211/michael.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/michael.c	2024-10-08 14:35:44.734627502 +0200
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
 #include <linux/types.h>
 | 
			
		||||
 #include <linux/bitops.h>
 | 
			
		||||
 #include <linux/ieee80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "michael.h"
 | 
			
		||||
 
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/mlme.c b/net/mac80211/mlme.c
 | 
			
		||||
--- a/net/mac80211/mlme.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/mlme.c	2024-10-08 14:35:44.842625999 +0200
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <linux/export.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "ieee80211_i.h"
 | 
			
		||||
 #include "driver-ops.h"
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/ocb.c b/net/mac80211/ocb.c
 | 
			
		||||
--- a/net/mac80211/ocb.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/ocb.c	2024-10-08 14:35:44.906625108 +0200
 | 
			
		||||
@@ -16,7 +16,7 @@
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
 #include <linux/rtnetlink.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "ieee80211_i.h"
 | 
			
		||||
 #include "driver-ops.h"
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/rx.c b/net/mac80211/rx.c
 | 
			
		||||
--- a/net/mac80211/rx.c	2024-10-08 14:34:12.099916968 +0200
 | 
			
		||||
+++ b/net/mac80211/rx.c	2024-10-08 14:35:44.906625108 +0200
 | 
			
		||||
@@ -22,7 +22,7 @@
 | 
			
		||||
 #include <kunit/visibility.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
 #include <net/ieee80211_radiotap.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "ieee80211_i.h"
 | 
			
		||||
 #include "driver-ops.h"
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/status.c b/net/mac80211/status.c
 | 
			
		||||
--- a/net/mac80211/status.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/status.c	2024-10-08 14:35:44.734627502 +0200
 | 
			
		||||
@@ -11,7 +11,7 @@
 | 
			
		||||
 #include <linux/export.h>
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include "ieee80211_i.h"
 | 
			
		||||
 #include "rate.h"
 | 
			
		||||
 #include "mesh.h"
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/tkip.c b/net/mac80211/tkip.c
 | 
			
		||||
--- a/net/mac80211/tkip.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/tkip.c	2024-10-08 14:35:44.906625108 +0200
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
 #include <linux/types.h>
 | 
			
		||||
 #include <linux/netdevice.h>
 | 
			
		||||
 #include <linux/export.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
 #include "driver-ops.h"
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/tx.c b/net/mac80211/tx.c
 | 
			
		||||
--- a/net/mac80211/tx.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/tx.c	2024-10-08 14:35:44.734627502 +0200
 | 
			
		||||
@@ -24,7 +24,7 @@
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
 #include <net/codel.h>
 | 
			
		||||
 #include <net/codel_impl.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <net/fq_impl.h>
 | 
			
		||||
 #include <net/gso.h>
 | 
			
		||||
 
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/wep.c b/net/mac80211/wep.c
 | 
			
		||||
--- a/net/mac80211/wep.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/wep.c	2024-10-08 14:35:44.906625108 +0200
 | 
			
		||||
@@ -16,7 +16,7 @@
 | 
			
		||||
 #include <linux/mm.h>
 | 
			
		||||
 #include <linux/scatterlist.h>
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
 #include "ieee80211_i.h"
 | 
			
		||||
diff '--color=auto' -aurN a/net/mac80211/wpa.c b/net/mac80211/wpa.c
 | 
			
		||||
--- a/net/mac80211/wpa.c	2024-10-08 14:34:12.103916913 +0200
 | 
			
		||||
+++ b/net/mac80211/wpa.c	2024-10-08 14:35:44.906625108 +0200
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
 #include <linux/compiler.h>
 | 
			
		||||
 #include <linux/ieee80211.h>
 | 
			
		||||
 #include <linux/gfp.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
 #include <crypto/aes.h>
 | 
			
		||||
 #include <crypto/utils.h>
 | 
			
		||||
diff '--color=auto' -aurN a/net/wireless/radiotap.c b/net/wireless/radiotap.c
 | 
			
		||||
--- a/net/wireless/radiotap.c	2024-10-08 14:34:12.099916968 +0200
 | 
			
		||||
+++ b/net/wireless/radiotap.c	2024-10-08 14:35:44.906625108 +0200
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
 #include <linux/export.h>
 | 
			
		||||
 #include <net/cfg80211.h>
 | 
			
		||||
 #include <net/ieee80211_radiotap.h>
 | 
			
		||||
-#include <asm/unaligned.h>
 | 
			
		||||
+#include <linux/unaligned.h>
 | 
			
		||||
 
 | 
			
		||||
 /* function prototypes and related defs are in include/net/cfg80211.h */
 | 
			
		||||
 
 | 
			
		||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c	2024-10-08 14:34:12.135916466 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c	2024-10-08 14:55:42.245829406 +0200
 | 
			
		||||
@@ -1184,7 +1184,6 @@
 | 
			
		||||
 
 | 
			
		||||
 static const struct file_operations bus_reset_fops = {
 | 
			
		||||
 	.open	= simple_open,
 | 
			
		||||
-	.llseek	= no_llseek,
 | 
			
		||||
 	.write	= bus_reset_write,
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c	2024-10-08 14:34:12.123916635 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c	2024-10-08 14:56:04.293516668 +0200
 | 
			
		||||
@@ -3490,7 +3490,6 @@
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 const struct file_operations iwl_dbgfs_d3_test_ops = {
 | 
			
		||||
-	.llseek = no_llseek,
 | 
			
		||||
 	.open = iwl_mvm_d3_test_open,
 | 
			
		||||
 	.read = iwl_mvm_d3_test_read,
 | 
			
		||||
 	.release = iwl_mvm_d3_test_release,
 | 
			
		||||
diff '--color=auto' -aurN backports-6.9.9/net/wireless/core.c backports-6.9.9.old/net/wireless/core.c
 | 
			
		||||
--- a/net/wireless/core.c	2024-10-08 15:14:57.293440176 +0200
 | 
			
		||||
+++ b/net/wireless/core.c	2024-10-08 15:13:05.007033920 +0200
 | 
			
		||||
@@ -165,11 +165,11 @@
 | 
			
		||||
 	list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
 | 
			
		||||
 		if (!wdev->netdev)
 | 
			
		||||
 			continue;
 | 
			
		||||
-		wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
 | 
			
		||||
+		wdev->netdev->netns_local = false;
 | 
			
		||||
 		err = dev_change_net_namespace(wdev->netdev, net, "wlan%d");
 | 
			
		||||
 		if (err)
 | 
			
		||||
 			break;
 | 
			
		||||
-		wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
 | 
			
		||||
+		wdev->netdev->netns_local = true;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
 	if (err) {
 | 
			
		||||
@@ -181,11 +181,11 @@
 | 
			
		||||
 						     list) {
 | 
			
		||||
 			if (!wdev->netdev)
 | 
			
		||||
 				continue;
 | 
			
		||||
-			wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
 | 
			
		||||
+			wdev->netdev->netns_local = false;
 | 
			
		||||
 			err = dev_change_net_namespace(wdev->netdev, net,
 | 
			
		||||
 							"wlan%d");
 | 
			
		||||
 			WARN_ON(err);
 | 
			
		||||
-			wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
 | 
			
		||||
+			wdev->netdev->netns_local = true;
 | 
			
		||||
 		}
 | 
			
		||||
 
 | 
			
		||||
 		return err;
 | 
			
		||||
@@ -1453,7 +1453,7 @@
 | 
			
		||||
 		SET_NETDEV_DEVTYPE(dev, &wiphy_type);
 | 
			
		||||
 		wdev->netdev = dev;
 | 
			
		||||
 		/* can only change netns with wiphy */
 | 
			
		||||
-		dev->features |= NETIF_F_NETNS_LOCAL;
 | 
			
		||||
+		dev->netns_local = true;
 | 
			
		||||
 
 | 
			
		||||
 		cfg80211_init_wdev(wdev);
 | 
			
		||||
 		break;
 | 
			
		||||
diff '--color=auto' -aurN backports-6.9.9.old/net/mac80211/rc80211_minstrel_ht_debugfs.c backports-6.9.9/net/mac80211/rc80211_minstrel_ht_debugfs.c
 | 
			
		||||
--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c	2024-10-08 15:38:18.745318805 +0200
 | 
			
		||||
+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c	2024-10-08 15:38:44.340958803 +0200
 | 
			
		||||
@@ -187,7 +187,6 @@
 | 
			
		||||
 	.open = minstrel_ht_stats_open,
 | 
			
		||||
 	.read = minstrel_stats_read,
 | 
			
		||||
 	.release = minstrel_stats_release,
 | 
			
		||||
-	.llseek = no_llseek,
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 static char *
 | 
			
		||||
@@ -322,7 +322,6 @@
 | 
			
		||||
 	.open = minstrel_ht_stats_csv_open,
 | 
			
		||||
 	.read = minstrel_stats_read,
 | 
			
		||||
 	.release = minstrel_stats_release,
 | 
			
		||||
-	.llseek = no_llseek,
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 void
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h	2024-07-03 20:09:49.622279338 +0200
 | 
			
		||||
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h	2024-07-03 20:10:26.157677785 +0200
 | 
			
		||||
@@ -294,4 +294,5 @@
 | 
			
		||||
 			       unsigned short *rxwi_size);
 | 
			
		||||
 void rt2800_pre_reset_hw(struct rt2x00_dev *rt2x00dev);
 | 
			
		||||
 
 | 
			
		||||
+void rt6352_enable_pa_pin(struct rt2x00_dev *rt2x00dev, int enable);
 | 
			
		||||
 #endif /* RT2800LIB_H */
 | 
			
		||||
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h	2024-11-05 16:54:09.625006944 +0100
 | 
			
		||||
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h	2024-11-05 16:54:26.280764117 +0100
 | 
			
		||||
@@ -1504,6 +1504,8 @@
 | 
			
		||||
 			     u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
 | 
			
		||||
 bool rt2x00mac_tx_frames_pending(struct ieee80211_hw *hw);
 | 
			
		||||
 
 | 
			
		||||
+int rt2x00lib_read_eeprom(struct rt2x00_dev *rt2x00dev);
 | 
			
		||||
+
 | 
			
		||||
 /*
 | 
			
		||||
  * Driver allocation handlers.
 | 
			
		||||
  */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
--- a/debugfs.c	2024-09-06 11:08:19.656939190 +0200
 | 
			
		||||
+++ b/debugfs.c	2024-09-06 11:09:04.772324072 +0200
 | 
			
		||||
@@ -331,15 +331,19 @@
 | 
			
		||||
 				     size_t count, loff_t *ppos)
 | 
			
		||||
 {
 | 
			
		||||
 	struct mwl_priv *priv = (struct mwl_priv *)file->private_data;
 | 
			
		||||
+#if defined AARCH64
 | 
			
		||||
 	struct pcie_priv *pcie_priv = priv->hif.priv;
 | 
			
		||||
 	unsigned long flags;
 | 
			
		||||
+#endif
 | 
			
		||||
 	unsigned long page = get_zeroed_page(GFP_KERNEL);
 | 
			
		||||
 	int tx_num = 4, rx_num = 4;
 | 
			
		||||
 	char *p = (char *)page;
 | 
			
		||||
 	int len = 0, size = PAGE_SIZE;
 | 
			
		||||
 	ssize_t ret;
 | 
			
		||||
 	const struct hostcmd_get_hw_spec *get_hw_spec;
 | 
			
		||||
+#if defined AARCH64
 | 
			
		||||
 	int i;
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 	if (!p)
 | 
			
		||||
 		return -ENOMEM;
 | 
			
		||||
@@ -359,6 +359,7 @@
 | 
			
		||||
 	len += scnprintf(p + len, size - len,
 | 
			
		||||
 			 "num_wcb: %d\n", le32_to_cpu(get_hw_spec->num_wcb));
 | 
			
		||||
 
 | 
			
		||||
+#if defined AARCH64
 | 
			
		||||
 	if (priv->chip_type == MWL8864) {
 | 
			
		||||
 		len += scnprintf(p + len, size - len,
 | 
			
		||||
 			 "-----------------------=>  address| address|qlen|fw_desc_cnt\n");
 | 
			
		||||
@@ -370,6 +371,7 @@
 | 
			
		||||
 				"wcb_base[%2d]: %x => %8x|%8p|%4d|%d\n", i, get_hw_spec->wcb_base[i], *((unsigned int *)le32_to_cpu(get_hw_spec->wcb_base[i])),(void *)*((unsigned int *)le32_to_cpu(get_hw_spec->wcb_base[i])),skb_queue_len(&pcie_priv->txq[i + 1]),pcie_priv->fw_desc_cnt[i + 1]);
 | 
			
		||||
 		spin_unlock_irqrestore(&pcie_priv->tx_desc_lock, flags);
 | 
			
		||||
 	}
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 	len += scnprintf(p + len, size - len,
 | 
			
		||||
 			 "num_mcast_addr: %X\n", le16_to_cpu(get_hw_spec->num_mcast_addr));
 | 
			
		||||
							
								
								
									
										34
									
								
								6.12/package/kernel/nat46/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								6.12/package/kernel/nat46/Makefile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,34 @@
 | 
			
		|||
include $(TOPDIR)/rules.mk
 | 
			
		||||
include $(INCLUDE_DIR)/kernel.mk
 | 
			
		||||
 | 
			
		||||
PKG_NAME:=nat46
 | 
			
		||||
 | 
			
		||||
PKG_SOURCE_URL:=https://github.com/ayourtch/nat46.git
 | 
			
		||||
PKG_SOURCE_DATE:=2024-07-02
 | 
			
		||||
PKG_SOURCE_PROTO:=git
 | 
			
		||||
PKG_SOURCE_VERSION:=f367088db99c9235e16dea8164eb82cbd0d299ba
 | 
			
		||||
 | 
			
		||||
PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
 | 
			
		||||
PKG_LICENSE:=GPL-2.0
 | 
			
		||||
 | 
			
		||||
include $(INCLUDE_DIR)/package.mk
 | 
			
		||||
 | 
			
		||||
define KernelPackage/nat46
 | 
			
		||||
  DEPENDS:=@IPV6 +kmod-nf-conntrack6
 | 
			
		||||
  TITLE:=Stateless NAT46 translation kernel module
 | 
			
		||||
  SECTION:=kernel
 | 
			
		||||
  SUBMENU:=Network Support
 | 
			
		||||
  FILES:=$(PKG_BUILD_DIR)/nat46/modules/nat46.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoLoad,33,nat46)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
include $(INCLUDE_DIR)/kernel-defaults.mk
 | 
			
		||||
 | 
			
		||||
define Build/Compile
 | 
			
		||||
	$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)/nat46/modules" \
 | 
			
		||||
		MODFLAGS="-DMODULE -mlong-calls" \
 | 
			
		||||
		EXTRA_CFLAGS="-DNAT46_VERSION=\\\"$(PKG_SOURCE_VERSION)\\\"" \
 | 
			
		||||
		modules
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call KernelPackage,nat46))
 | 
			
		||||
							
								
								
									
										99
									
								
								6.12/package/kernel/nat46/patches/001-fix-kernel-6.10.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								6.12/package/kernel/nat46/patches/001-fix-kernel-6.10.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,99 @@
 | 
			
		|||
--- a/nat46/modules/nat46-netdev.c	2024-08-14 16:36:59.249437588 +0200
 | 
			
		||||
+++ b/nat46/modules/nat46-netdev.c	2024-08-14 16:39:28.523016026 +0200
 | 
			
		||||
@@ -193,7 +193,6 @@
 | 
			
		||||
 		return NULL;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
-	read_lock(&dev_base_lock);
 | 
			
		||||
 	dev = first_net_device(net);
 | 
			
		||||
 	while (dev) {
 | 
			
		||||
 		if((0 == strcmp(dev->name, name)) && is_nat46(dev)) {
 | 
			
		||||
@@ -205,7 +204,6 @@
 | 
			
		||||
 		}
 | 
			
		||||
 		dev = next_net_device(dev);
 | 
			
		||||
 	}
 | 
			
		||||
-	read_unlock(&dev_base_lock);
 | 
			
		||||
 	return out;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
@@ -300,7 +298,6 @@
 | 
			
		||||
 
 | 
			
		||||
 void nat64_show_all_configs(struct net *net, struct seq_file *m) {
 | 
			
		||||
         struct net_device *dev;
 | 
			
		||||
-	read_lock(&dev_base_lock);
 | 
			
		||||
 	dev = first_net_device(net);
 | 
			
		||||
 	while (dev) {
 | 
			
		||||
 		if(is_nat46(dev)) {
 | 
			
		||||
@@ -323,7 +320,6 @@
 | 
			
		||||
 		}
 | 
			
		||||
 		dev = next_net_device(dev);
 | 
			
		||||
 	}
 | 
			
		||||
-	read_unlock(&dev_base_lock);
 | 
			
		||||
 
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
@@ -331,7 +327,6 @@
 | 
			
		||||
         struct net_device *dev;
 | 
			
		||||
         struct net_device *nat46dev;
 | 
			
		||||
 	do {
 | 
			
		||||
-		read_lock(&dev_base_lock);
 | 
			
		||||
 		nat46dev = NULL;
 | 
			
		||||
 		dev = first_net_device(net);
 | 
			
		||||
 		while (dev) {
 | 
			
		||||
@@ -340,7 +335,6 @@
 | 
			
		||||
 			}
 | 
			
		||||
 			dev = next_net_device(dev);
 | 
			
		||||
 		}
 | 
			
		||||
-		read_unlock(&dev_base_lock);
 | 
			
		||||
 		if(nat46dev) {
 | 
			
		||||
 			nat46_netdev_destroy(nat46dev);
 | 
			
		||||
 		}
 | 
			
		||||
--- a/nat46/modules/nat46-netdev.h	2024-08-14 16:39:50.726655831 +0200
 | 
			
		||||
+++ b/nat46/modules/nat46-netdev.h	2024-08-14 16:40:25.954084361 +0200
 | 
			
		||||
@@ -25,4 +25,5 @@
 | 
			
		||||
 void nat64_show_all_configs(struct net *net, struct seq_file *m);
 | 
			
		||||
 void nat46_netdev_count_xmit(struct sk_buff *skb, struct net_device *dev);
 | 
			
		||||
 void *netdev_nat46_instance(struct net_device *dev);
 | 
			
		||||
-
 | 
			
		||||
+int nat46_netdev_create(struct net *net, char *basename, struct net_device **dev);
 | 
			
		||||
+void nat46_netdev_destroy(struct net_device *dev);
 | 
			
		||||
--- a/nat46/modules/nat46-core.h	2024-08-14 16:44:24.686211571 +0200
 | 
			
		||||
+++ b/nat46/modules/nat46-core.h	2024-08-14 16:50:42.464086457 +0200
 | 
			
		||||
@@ -82,4 +82,37 @@
 | 
			
		||||
 nat46_instance_t *alloc_nat46_instance(int npairs, nat46_instance_t *old, int from_ipair, int to_ipair, int remove_ipair);
 | 
			
		||||
 void release_nat46_instance(nat46_instance_t *nat46);
 | 
			
		||||
 
 | 
			
		||||
+void nat46debug_dump(nat46_instance_t *nat46, int level, void *addr, int len);
 | 
			
		||||
+int try_parse_ipv6_prefix(struct in6_addr *pref, int *pref_len, char *arg);
 | 
			
		||||
+int try_parse_ipv4_prefix(u32 *v4addr, int *pref_len, char *arg);
 | 
			
		||||
+int try_parse_rule_arg(nat46_xlate_rule_t *rule, char *arg_name, char **ptail);
 | 
			
		||||
+char *xlate_style_to_string(nat46_xlate_style_t style);
 | 
			
		||||
+void xlate_v4_to_nat64(nat46_instance_t *nat46, nat46_xlate_rule_t *rule, void *pipv4, void *pipv6);
 | 
			
		||||
+int xlate_nat64_to_v4(nat46_instance_t *nat46, nat46_xlate_rule_t *rule, void *pipv6, void *pipv4);
 | 
			
		||||
+int xlate_map_v4_to_v6(nat46_instance_t *nat46, nat46_xlate_rule_t *rule, void *pipv4, void *pipv6, uint16_t *pl4id, int map_version);
 | 
			
		||||
+int xlate_map_v6_to_v4(nat46_instance_t *nat46, nat46_xlate_rule_t *rule, void *pipv6, void *pipv4, int version);
 | 
			
		||||
+int xlate_v4_to_v6(nat46_instance_t *nat46, nat46_xlate_rule_t *rule, void *pipv4, void *pipv6, uint16_t *pl4id);
 | 
			
		||||
+int xlate_v6_to_v4(nat46_instance_t *nat46, nat46_xlate_rule_t *rule, void *pipv6, void *pipv4);
 | 
			
		||||
+__sum16 csum16_upd(__sum16 csum, u16 old, u16 new);
 | 
			
		||||
+__sum16 csum_tcpudp_remagic(__be32 saddr, __be32 daddr, u32 len, unsigned char proto, u16 csum);
 | 
			
		||||
+__sum16 csum_ipv6_unmagic(nat46_instance_t *nat46, const struct in6_addr *saddr, const struct in6_addr *daddr, __u32 len, unsigned short proto, __sum16 csum);
 | 
			
		||||
+void update_icmp6_type_code(nat46_instance_t *nat46, struct icmp6hdr *icmp6h, u8 type, u8 code);
 | 
			
		||||
+u16 get_next_ip_id(void);
 | 
			
		||||
+u16 fold_ipv6_frag_id(u32 v6id);
 | 
			
		||||
+void *add_offset(void *ptr, u16 offset);
 | 
			
		||||
+void *get_next_header_ptr6(void *pv6, int v6_len);
 | 
			
		||||
+void fill_v4hdr_from_v6hdr(struct iphdr * iph, struct ipv6hdr *ip6h, __u32 v4saddr, __u32 v4daddr, __u16 id, __u16 frag_off, __u16 proto, int l3_payload_len);
 | 
			
		||||
+u16 unchecksum16(void *p, int count, u16 csum);
 | 
			
		||||
+u16 rechecksum16(void *p, int count, u16 csum);
 | 
			
		||||
+int is_last_pair_in_group(nat46_xlate_rulepair_t *apair);
 | 
			
		||||
+void pairs_xlate_v6_to_v4_inner(nat46_instance_t *nat46, struct ipv6hdr *ip6h, __u32 *pv4saddr, __u32 *pv4daddr);
 | 
			
		||||
+int xlate_payload6_to4(nat46_instance_t *nat46, void *pv6, void *ptrans_hdr, int v6_len, u16 *ul_sum, int *ptailTruncSize);
 | 
			
		||||
+u8 *icmp_parameter_ptr(struct icmphdr *icmph);
 | 
			
		||||
+u32 *icmp6_parameter_ptr(struct icmp6hdr *icmp6h);
 | 
			
		||||
+int ip6_input_not_interested(nat46_instance_t *nat46, struct ipv6hdr *ip6h, struct sk_buff *old_skb);
 | 
			
		||||
+int pairs_xlate_v6_to_v4_outer(nat46_instance_t *nat46, struct ipv6hdr *ip6h, uint16_t proto, __u32 *pv4saddr, __u32 *pv4daddr);
 | 
			
		||||
+void ip6_update_csum(struct sk_buff * skb, struct ipv6hdr * ip6hdr, int do_atomic_frag);
 | 
			
		||||
+int ip4_input_not_interested(nat46_instance_t *nat46, struct iphdr *iph, struct sk_buff *old_skb);
 | 
			
		||||
+int pairs_xlate_v4_to_v6_outer(nat46_instance_t *nat46, struct iphdr *hdr4, uint16_t *sport, uint16_t *dport, void *v6saddr, void *v6daddr);
 | 
			
		||||
+int is_valid_nat46(nat46_instance_t *nat46);
 | 
			
		||||
 #endif
 | 
			
		||||
							
								
								
									
										10
									
								
								6.12/package/kernel/nat46/patches/002-fix-kernel-6.11.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								6.12/package/kernel/nat46/patches/002-fix-kernel-6.11.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
--- a/nat46/modules/nat46-netdev.c	2024-09-13 09:39:48.960815094 +0200
 | 
			
		||||
+++ b/nat46/modules/nat46-netdev.c	2024-09-13 09:40:11.128500472 +0200
 | 
			
		||||
@@ -110,7 +110,6 @@
 | 
			
		||||
 	dev->hard_header_len = 0;
 | 
			
		||||
 	dev->addr_len = 0;
 | 
			
		||||
 	dev->mtu = 16384; /* iptables does reassembly. Rather than using ETH_DATA_LEN, let's try to get as much mileage as we can with the Linux stack */
 | 
			
		||||
-	dev->features = NETIF_F_NETNS_LOCAL;
 | 
			
		||||
 	dev->flags = IFF_NOARP | IFF_POINTOPOINT;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,42 @@
 | 
			
		|||
--- a/ubootenv-nvram.c
 | 
			
		||||
+++ b/ubootenv-nvram.c
 | 
			
		||||
@@ -13,6 +13,7 @@
 | 
			
		||||
 #include <linux/of.h>
 | 
			
		||||
 #include <linux/of_reserved_mem.h>
 | 
			
		||||
 #include <linux/platform_device.h>
 | 
			
		||||
+#include <linux/version.h>
 | 
			
		||||
 
 | 
			
		||||
 #define NAME "ubootenv"
 | 
			
		||||
 
 | 
			
		||||
@@ -132,18 +133,30 @@ static int ubootenv_probe(struct platfor
 | 
			
		||||
 	return misc_register(&data->misc);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
-static int ubootenv_remove(struct platform_device *pdev)
 | 
			
		||||
+static
 | 
			
		||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
 | 
			
		||||
+int
 | 
			
		||||
+#else
 | 
			
		||||
+void
 | 
			
		||||
+#endif
 | 
			
		||||
+ubootenv_remove(struct platform_device *pdev)
 | 
			
		||||
 {
 | 
			
		||||
 	struct ubootenv_drvdata *data = platform_get_drvdata(pdev);
 | 
			
		||||
 
 | 
			
		||||
 	data->env = NULL;
 | 
			
		||||
 	misc_deregister(&data->misc);
 | 
			
		||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
 | 
			
		||||
 	return 0;
 | 
			
		||||
+#endif
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static struct platform_driver ubootenv_driver = {
 | 
			
		||||
 	.probe = ubootenv_probe,
 | 
			
		||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
 | 
			
		||||
 	.remove = ubootenv_remove,
 | 
			
		||||
+#else
 | 
			
		||||
+	.remove_new = ubootenv_remove,
 | 
			
		||||
+#endif
 | 
			
		||||
 	.driver = {
 | 
			
		||||
 		.name           = NAME,
 | 
			
		||||
 		.owner          = THIS_MODULE,
 | 
			
		||||
							
								
								
									
										76
									
								
								6.12/package/libs/libnftnl/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								6.12/package/libs/libnftnl/Makefile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,76 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright (C) 2014 OpenWrt.org
 | 
			
		||||
#
 | 
			
		||||
# This is free software, licensed under the GNU General Public License v2.
 | 
			
		||||
# See /LICENSE for more information.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
include $(TOPDIR)/rules.mk
 | 
			
		||||
 | 
			
		||||
PKG_NAME:=libnftnl
 | 
			
		||||
PKG_CPE_ID:=cpe:/a:netfilter:libnftnl
 | 
			
		||||
PKG_VERSION:=1.2.6
 | 
			
		||||
PKG_RELEASE:=2
 | 
			
		||||
 | 
			
		||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 | 
			
		||||
PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
 | 
			
		||||
PKG_HASH:=ceeaea2cd92147da19f13a35a7f1a4bc2767ff897e838e4b479cf54b59c777f4
 | 
			
		||||
 | 
			
		||||
PKG_MAINTAINER:=Steven Barth <steven@midlink.org>
 | 
			
		||||
PKG_LICENSE:=GPL-2.0-or-later
 | 
			
		||||
PKG_LICENSE_FILES:=COPYING
 | 
			
		||||
 | 
			
		||||
PKG_INSTALL:=1
 | 
			
		||||
PKG_BUILD_PARALLEL:=1
 | 
			
		||||
PKG_BUILD_FLAGS:=lto
 | 
			
		||||
PKG_FIXUP:=autoreconf
 | 
			
		||||
 | 
			
		||||
include $(INCLUDE_DIR)/package.mk
 | 
			
		||||
 | 
			
		||||
DISABLE_NLS:=
 | 
			
		||||
 | 
			
		||||
define Package/libnftnl
 | 
			
		||||
  SECTION:=libs
 | 
			
		||||
  CATEGORY:=Libraries
 | 
			
		||||
  DEPENDS:=+libmnl
 | 
			
		||||
  TITLE:=Low-level netlink library for the nf_tables subsystem
 | 
			
		||||
  URL:=http://www.netfilter.org/projects/libnftnl
 | 
			
		||||
  ABI_VERSION:=11
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/libnftnl/description
 | 
			
		||||
 libnftnl is a userspace library providing a low-level netlink
 | 
			
		||||
 programming interface (API) to the in-kernel nf_tables subsystem.
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
TARGET_CFLAGS += $(FPIC)
 | 
			
		||||
 | 
			
		||||
CONFIGURE_ARGS += \
 | 
			
		||||
	--enable-static \
 | 
			
		||||
	--enable-shared
 | 
			
		||||
 | 
			
		||||
define Build/InstallDev
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/include/libnftnl
 | 
			
		||||
	$(CP) \
 | 
			
		||||
		$(PKG_INSTALL_DIR)/usr/include/libnftnl/*.h \
 | 
			
		||||
		$(1)/usr/include/libnftnl/
 | 
			
		||||
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib
 | 
			
		||||
	$(CP) \
 | 
			
		||||
		$(PKG_INSTALL_DIR)/usr/lib/libnftnl.{so*,a,la} \
 | 
			
		||||
		$(1)/usr/lib/
 | 
			
		||||
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
 | 
			
		||||
	$(CP) \
 | 
			
		||||
		$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnftnl.pc \
 | 
			
		||||
		$(1)/usr/lib/pkgconfig/
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/libnftnl/install
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib
 | 
			
		||||
	$(CP) \
 | 
			
		||||
		$(PKG_INSTALL_DIR)/usr/lib/libnftnl.so.* \
 | 
			
		||||
		$(1)/usr/lib/
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call BuildPackage,libnftnl))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,254 @@
 | 
			
		|||
From 6c39f04febd7cfdbd474233379416babcd0fc341 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Syrone Wong <wong.syrone@gmail.com>
 | 
			
		||||
Date: Fri, 8 Apr 2022 23:52:11 +0800
 | 
			
		||||
Subject: [PATCH] libnftnl: add fullcone expression support
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
 include/libnftnl/expr.h             |   6 +
 | 
			
		||||
 include/linux/netfilter/nf_tables.h |  16 +++
 | 
			
		||||
 src/Makefile.am                     |   1 +
 | 
			
		||||
 src/expr/fullcone.c                 | 167 ++++++++++++++++++++++++++++
 | 
			
		||||
 src/expr_ops.c                      |   2 +
 | 
			
		||||
 5 files changed, 192 insertions(+)
 | 
			
		||||
 create mode 100644 src/expr/fullcone.c
 | 
			
		||||
 | 
			
		||||
--- a/include/libnftnl/expr.h
 | 
			
		||||
+++ b/include/libnftnl/expr.h
 | 
			
		||||
@@ -245,6 +245,12 @@ enum {
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 enum {
 | 
			
		||||
+	NFTNL_EXPR_FULLCONE_FLAGS		= NFTNL_EXPR_BASE,
 | 
			
		||||
+	NFTNL_EXPR_FULLCONE_REG_PROTO_MIN,
 | 
			
		||||
+	NFTNL_EXPR_FULLCONE_REG_PROTO_MAX,
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+enum {
 | 
			
		||||
 	NFTNL_EXPR_REDIR_REG_PROTO_MIN	= NFTNL_EXPR_BASE,
 | 
			
		||||
 	NFTNL_EXPR_REDIR_REG_PROTO_MAX,
 | 
			
		||||
 	NFTNL_EXPR_REDIR_FLAGS,
 | 
			
		||||
--- a/include/linux/netfilter/nf_tables.h
 | 
			
		||||
+++ b/include/linux/netfilter/nf_tables.h
 | 
			
		||||
@@ -1434,6 +1434,22 @@ enum nft_masq_attributes {
 | 
			
		||||
 #define NFTA_MASQ_MAX		(__NFTA_MASQ_MAX - 1)
 | 
			
		||||
 
 | 
			
		||||
 /**
 | 
			
		||||
+ * enum nft_fullcone_attributes - nf_tables fullcone expression attributes
 | 
			
		||||
+ *
 | 
			
		||||
+ * @NFTA_FULLCONE_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
 | 
			
		||||
+ * @NFTA_FULLCONE_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
 | 
			
		||||
+ * @NFTA_FULLCONE_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
 | 
			
		||||
+ */
 | 
			
		||||
+enum nft_fullcone_attributes {
 | 
			
		||||
+	NFTA_FULLCONE_UNSPEC,
 | 
			
		||||
+	NFTA_FULLCONE_FLAGS,
 | 
			
		||||
+	NFTA_FULLCONE_REG_PROTO_MIN,
 | 
			
		||||
+	NFTA_FULLCONE_REG_PROTO_MAX,
 | 
			
		||||
+	__NFTA_FULLCONE_MAX
 | 
			
		||||
+};
 | 
			
		||||
+#define NFTA_FULLCONE_MAX		(__NFTA_FULLCONE_MAX - 1)
 | 
			
		||||
+
 | 
			
		||||
+/**
 | 
			
		||||
  * enum nft_redir_attributes - nf_tables redirect expression netlink attributes
 | 
			
		||||
  *
 | 
			
		||||
  * @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
 | 
			
		||||
--- a/src/Makefile.am
 | 
			
		||||
+++ b/src/Makefile.am
 | 
			
		||||
@@ -54,6 +54,7 @@ libnftnl_la_SOURCES = utils.c		\
 | 
			
		||||
 		      expr/target.c	\
 | 
			
		||||
 		      expr/tunnel.c	\
 | 
			
		||||
 		      expr/masq.c	\
 | 
			
		||||
+		      expr/fullcone.c	\
 | 
			
		||||
 		      expr/redir.c	\
 | 
			
		||||
 		      expr/hash.c	\
 | 
			
		||||
 		      expr/socket.c	\
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/src/expr/fullcone.c
 | 
			
		||||
@@ -0,0 +1,168 @@
 | 
			
		||||
+/*
 | 
			
		||||
+ * (C) 2022 wongsyrone
 | 
			
		||||
+ *
 | 
			
		||||
+ * This program is free software; you can redistribute it and/or modify
 | 
			
		||||
+ * it under the terms of the GNU General Public License as published
 | 
			
		||||
+ * by the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
+ * (at your option) any later version.
 | 
			
		||||
+ */
 | 
			
		||||
+
 | 
			
		||||
+#include <stdio.h>
 | 
			
		||||
+#include <stdint.h>
 | 
			
		||||
+#include <arpa/inet.h>
 | 
			
		||||
+#include <errno.h>
 | 
			
		||||
+#include <inttypes.h>
 | 
			
		||||
+
 | 
			
		||||
+#include <linux/netfilter/nf_tables.h>
 | 
			
		||||
+
 | 
			
		||||
+#include "internal.h"
 | 
			
		||||
+#include <libmnl/libmnl.h>
 | 
			
		||||
+#include <libnftnl/expr.h>
 | 
			
		||||
+#include <libnftnl/rule.h>
 | 
			
		||||
+
 | 
			
		||||
+struct nftnl_expr_fullcone {
 | 
			
		||||
+	uint32_t		flags;
 | 
			
		||||
+	enum nft_registers	sreg_proto_min;
 | 
			
		||||
+	enum nft_registers	sreg_proto_max;
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+static int
 | 
			
		||||
+nftnl_expr_fullcone_set(struct nftnl_expr *e, uint16_t type,
 | 
			
		||||
+		       const void *data, uint32_t data_len)
 | 
			
		||||
+{
 | 
			
		||||
+	struct nftnl_expr_fullcone *fullcone = nftnl_expr_data(e);
 | 
			
		||||
+
 | 
			
		||||
+	switch (type) {
 | 
			
		||||
+	case NFTNL_EXPR_FULLCONE_FLAGS:
 | 
			
		||||
+		memcpy(&fullcone->flags, data, sizeof(fullcone->flags));
 | 
			
		||||
+		break;
 | 
			
		||||
+	case NFTNL_EXPR_FULLCONE_REG_PROTO_MIN:
 | 
			
		||||
+		memcpy(&fullcone->sreg_proto_min, data, sizeof(fullcone->sreg_proto_min));
 | 
			
		||||
+		break;
 | 
			
		||||
+	case NFTNL_EXPR_FULLCONE_REG_PROTO_MAX:
 | 
			
		||||
+		memcpy(&fullcone->sreg_proto_max, data, sizeof(fullcone->sreg_proto_max));
 | 
			
		||||
+		break;
 | 
			
		||||
+	default:
 | 
			
		||||
+		return -1;
 | 
			
		||||
+	}
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static const void *
 | 
			
		||||
+nftnl_expr_fullcone_get(const struct nftnl_expr *e, uint16_t type,
 | 
			
		||||
+		       uint32_t *data_len)
 | 
			
		||||
+{
 | 
			
		||||
+	struct nftnl_expr_fullcone *fullcone = nftnl_expr_data(e);
 | 
			
		||||
+
 | 
			
		||||
+	switch (type) {
 | 
			
		||||
+	case NFTNL_EXPR_FULLCONE_FLAGS:
 | 
			
		||||
+		*data_len = sizeof(fullcone->flags);
 | 
			
		||||
+		return &fullcone->flags;
 | 
			
		||||
+	case NFTNL_EXPR_FULLCONE_REG_PROTO_MIN:
 | 
			
		||||
+		*data_len = sizeof(fullcone->sreg_proto_min);
 | 
			
		||||
+		return &fullcone->sreg_proto_min;
 | 
			
		||||
+	case NFTNL_EXPR_FULLCONE_REG_PROTO_MAX:
 | 
			
		||||
+		*data_len = sizeof(fullcone->sreg_proto_max);
 | 
			
		||||
+		return &fullcone->sreg_proto_max;
 | 
			
		||||
+	}
 | 
			
		||||
+	return NULL;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int nftnl_expr_fullcone_cb(const struct nlattr *attr, void *data)
 | 
			
		||||
+{
 | 
			
		||||
+	const struct nlattr **tb = data;
 | 
			
		||||
+	int type = mnl_attr_get_type(attr);
 | 
			
		||||
+
 | 
			
		||||
+	if (mnl_attr_type_valid(attr, NFTA_FULLCONE_MAX) < 0)
 | 
			
		||||
+		return MNL_CB_OK;
 | 
			
		||||
+
 | 
			
		||||
+	switch (type) {
 | 
			
		||||
+	case NFTA_FULLCONE_REG_PROTO_MIN:
 | 
			
		||||
+	case NFTA_FULLCONE_REG_PROTO_MAX:
 | 
			
		||||
+	case NFTA_FULLCONE_FLAGS:
 | 
			
		||||
+		if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0)
 | 
			
		||||
+			abi_breakage();
 | 
			
		||||
+		break;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	tb[type] = attr;
 | 
			
		||||
+	return MNL_CB_OK;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void
 | 
			
		||||
+nftnl_expr_fullcone_build(struct nlmsghdr *nlh, const struct nftnl_expr *e)
 | 
			
		||||
+{
 | 
			
		||||
+	struct nftnl_expr_fullcone *fullcone = nftnl_expr_data(e);
 | 
			
		||||
+
 | 
			
		||||
+	if (e->flags & (1 << NFTNL_EXPR_FULLCONE_FLAGS))
 | 
			
		||||
+		mnl_attr_put_u32(nlh, NFTA_FULLCONE_FLAGS, htobe32(fullcone->flags));
 | 
			
		||||
+	if (e->flags & (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MIN))
 | 
			
		||||
+		mnl_attr_put_u32(nlh, NFTA_FULLCONE_REG_PROTO_MIN,
 | 
			
		||||
+				 htobe32(fullcone->sreg_proto_min));
 | 
			
		||||
+	if (e->flags & (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MAX))
 | 
			
		||||
+		mnl_attr_put_u32(nlh, NFTA_FULLCONE_REG_PROTO_MAX,
 | 
			
		||||
+				 htobe32(fullcone->sreg_proto_max));
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int
 | 
			
		||||
+nftnl_expr_fullcone_parse(struct nftnl_expr *e, struct nlattr *attr)
 | 
			
		||||
+{
 | 
			
		||||
+	struct nftnl_expr_fullcone *fullcone = nftnl_expr_data(e);
 | 
			
		||||
+	struct nlattr *tb[NFTA_FULLCONE_MAX+1] = {};
 | 
			
		||||
+
 | 
			
		||||
+	if (mnl_attr_parse_nested(attr, nftnl_expr_fullcone_cb, tb) < 0)
 | 
			
		||||
+		return -1;
 | 
			
		||||
+
 | 
			
		||||
+	if (tb[NFTA_FULLCONE_FLAGS]) {
 | 
			
		||||
+		fullcone->flags = be32toh(mnl_attr_get_u32(tb[NFTA_FULLCONE_FLAGS]));
 | 
			
		||||
+		e->flags |= (1 << NFTNL_EXPR_FULLCONE_FLAGS);
 | 
			
		||||
+        }
 | 
			
		||||
+	if (tb[NFTA_FULLCONE_REG_PROTO_MIN]) {
 | 
			
		||||
+		fullcone->sreg_proto_min =
 | 
			
		||||
+			be32toh(mnl_attr_get_u32(tb[NFTA_FULLCONE_REG_PROTO_MIN]));
 | 
			
		||||
+		e->flags |= (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MIN);
 | 
			
		||||
+	}
 | 
			
		||||
+	if (tb[NFTA_FULLCONE_REG_PROTO_MAX]) {
 | 
			
		||||
+		fullcone->sreg_proto_max =
 | 
			
		||||
+			be32toh(mnl_attr_get_u32(tb[NFTA_FULLCONE_REG_PROTO_MAX]));
 | 
			
		||||
+		e->flags |= (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MAX);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int nftnl_expr_fullcone_snprintf(char *buf, size_t remain,
 | 
			
		||||
+				    uint32_t flags, const struct nftnl_expr *e)
 | 
			
		||||
+{
 | 
			
		||||
+	struct nftnl_expr_fullcone *fullcone = nftnl_expr_data(e);
 | 
			
		||||
+	int offset = 0, ret = 0;
 | 
			
		||||
+
 | 
			
		||||
+	if (e->flags & (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MIN)) {
 | 
			
		||||
+		ret = snprintf(buf + offset, remain, "proto_min reg %u ",
 | 
			
		||||
+			       fullcone->sreg_proto_min);
 | 
			
		||||
+		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 | 
			
		||||
+	}
 | 
			
		||||
+	if (e->flags & (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MAX)) {
 | 
			
		||||
+		ret = snprintf(buf + offset, remain, "proto_max reg %u ",
 | 
			
		||||
+			       fullcone->sreg_proto_max);
 | 
			
		||||
+		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 | 
			
		||||
+	}
 | 
			
		||||
+	if (e->flags & (1 << NFTNL_EXPR_FULLCONE_FLAGS)) {
 | 
			
		||||
+		ret = snprintf(buf + offset, remain, "flags 0x%x ", fullcone->flags);
 | 
			
		||||
+		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return offset;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+struct expr_ops expr_ops_fullcone = {
 | 
			
		||||
+	.name		= "fullcone",
 | 
			
		||||
+	.alloc_len	= sizeof(struct nftnl_expr_fullcone),
 | 
			
		||||
+	.max_attr	= NFTA_FULLCONE_MAX,
 | 
			
		||||
+	.set		= nftnl_expr_fullcone_set,
 | 
			
		||||
+	.get		= nftnl_expr_fullcone_get,
 | 
			
		||||
+	.parse		= nftnl_expr_fullcone_parse,
 | 
			
		||||
+	.build		= nftnl_expr_fullcone_build,
 | 
			
		||||
+	.output		= nftnl_expr_fullcone_snprintf,
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
--- a/src/expr_ops.c
 | 
			
		||||
+++ b/src/expr_ops.c
 | 
			
		||||
@@ -19,6 +19,7 @@ extern struct expr_ops expr_ops_limit;
 | 
			
		||||
 extern struct expr_ops expr_ops_log;
 | 
			
		||||
 extern struct expr_ops expr_ops_lookup;
 | 
			
		||||
 extern struct expr_ops expr_ops_masq;
 | 
			
		||||
+extern struct expr_ops expr_ops_fullcone;
 | 
			
		||||
 extern struct expr_ops expr_ops_match;
 | 
			
		||||
 extern struct expr_ops expr_ops_meta;
 | 
			
		||||
 extern struct expr_ops expr_ops_ng;
 | 
			
		||||
@@ -63,6 +64,7 @@ static struct expr_ops *expr_ops[] = {
 | 
			
		||||
 	&expr_ops_log,
 | 
			
		||||
 	&expr_ops_lookup,
 | 
			
		||||
 	&expr_ops_masq,
 | 
			
		||||
+	&expr_ops_fullcone,
 | 
			
		||||
 	&expr_ops_match,
 | 
			
		||||
 	&expr_ops_meta,
 | 
			
		||||
 	&expr_ops_ng,
 | 
			
		||||
							
								
								
									
										11
									
								
								6.12/package/libs/libpcap/patches/999-fix-compilation.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								6.12/package/libs/libpcap/patches/999-fix-compilation.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
--- a/CMakeLists.txt	2024-10-08 08:04:55.220966217 +0200
 | 
			
		||||
+++ b/CMakeLists.txt	2024-10-08 08:09:03.593429433 +0200
 | 
			
		||||
@@ -350,7 +350,7 @@
 | 
			
		||||
     if(NOT ${CMAKE_C_COMPILER} MATCHES "clang*")
 | 
			
		||||
         set(C_ADDITIONAL_FLAGS "${C_ADDITIONAL_FLAGS} /utf-8")
 | 
			
		||||
     endif(NOT ${CMAKE_C_COMPILER} MATCHES "clang*")
 | 
			
		||||
-else(MSVC)
 | 
			
		||||
+elseif(FALSE)
 | 
			
		||||
     #
 | 
			
		||||
     # For checking if a compiler flag works, failing if it doesn't,
 | 
			
		||||
     # and adding it otherwise.
 | 
			
		||||
							
								
								
									
										200
									
								
								6.12/package/libs/mbedtls/Config.in
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								6.12/package/libs/mbedtls/Config.in
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,200 @@
 | 
			
		|||
if PACKAGE_libmbedtls
 | 
			
		||||
 | 
			
		||||
comment "Option details in source code: include/mbedtls/mbedtls_config.h"
 | 
			
		||||
 | 
			
		||||
comment "Ciphers - unselect old or less-used ciphers to reduce binary size"
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_AES_C
 | 
			
		||||
	bool "MBEDTLS_AES_C"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_CAMELLIA_C
 | 
			
		||||
	bool "MBEDTLS_CAMELLIA_C"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_CCM_C
 | 
			
		||||
	bool "MBEDTLS_CCM_C"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_CMAC_C
 | 
			
		||||
	bool "MBEDTLS_CMAC_C (old but used by hostapd)"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_DES_C
 | 
			
		||||
	bool "MBEDTLS_DES_C (old but used by hostapd)"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_GCM_C
 | 
			
		||||
	bool "MBEDTLS_GCM_C"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_NIST_KW_C
 | 
			
		||||
	bool "MBEDTLS_NIST_KW_C (old but used by hostapd)"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_RIPEMD160_C
 | 
			
		||||
	bool "MBEDTLS_RIPEMD160_C"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_XTEA_C
 | 
			
		||||
	bool "MBEDTLS_XTEA_C"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_RSA_NO_CRT
 | 
			
		||||
	bool "MBEDTLS_RSA_NO_CRT"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
 | 
			
		||||
	bool "MBEDTLS_KEY_EXCHANGE_PSK_ENABLED"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
 | 
			
		||||
	bool "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
 | 
			
		||||
	bool "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
 | 
			
		||||
	bool "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
 | 
			
		||||
	bool "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
 | 
			
		||||
	bool "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
 | 
			
		||||
	bool "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
 | 
			
		||||
	bool "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
 | 
			
		||||
	bool "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
 | 
			
		||||
	bool "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
comment "Curves - unselect old or less-used curves to reduce binary size"
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_SECP192R1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_SECP192R1_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_SECP224R1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_SECP224R1_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_SECP256R1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_SECP256R1_ENABLED"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_SECP384R1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_SECP384R1_ENABLED"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_SECP521R1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_SECP521R1_ENABLED"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_SECP192K1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_SECP192K1_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_SECP224K1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_SECP224K1_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_SECP256K1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_SECP256K1_ENABLED"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_BP256R1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_BP256R1_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_BP384R1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_BP384R1_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_BP512R1_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_BP512R1_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_CURVE25519_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_CURVE25519_ENABLED"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ECP_DP_CURVE448_ENABLED
 | 
			
		||||
	bool "MBEDTLS_ECP_DP_CURVE448_ENABLED"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
comment "Build Options - unselect features to reduce binary size"
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_CERTS_C
 | 
			
		||||
	bool "MBEDTLS_CERTS_C"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_CIPHER_MODE_OFB
 | 
			
		||||
	bool "MBEDTLS_CIPHER_MODE_OFB"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_CIPHER_MODE_XTS
 | 
			
		||||
	bool "MBEDTLS_CIPHER_MODE_XTS"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_DEBUG_C
 | 
			
		||||
	bool "MBEDTLS_DEBUG_C"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_HKDF_C
 | 
			
		||||
	bool "MBEDTLS_HKDF_C"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_PLATFORM_C
 | 
			
		||||
	bool "MBEDTLS_PLATFORM_C"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_SELF_TEST
 | 
			
		||||
	bool "MBEDTLS_SELF_TEST"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_SSL_TRUNCATED_HMAC
 | 
			
		||||
	bool "MBEDTLS_SSL_TRUNCATED_HMAC"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_THREADING_C
 | 
			
		||||
	bool "MBEDTLS_THREADING_C"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_THREADING_PTHREAD
 | 
			
		||||
	def_bool MBEDTLS_THREADING_C
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_VERSION_C
 | 
			
		||||
	bool "MBEDTLS_VERSION_C"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_VERSION_FEATURES
 | 
			
		||||
	bool "MBEDTLS_VERSION_FEATURES"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
comment "Build Options"
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_ENTROPY_FORCE_SHA256
 | 
			
		||||
	bool "MBEDTLS_ENTROPY_FORCE_SHA256"
 | 
			
		||||
	default y
 | 
			
		||||
 | 
			
		||||
config MBEDTLS_SSL_RENEGOTIATION
 | 
			
		||||
	bool "MBEDTLS_SSL_RENEGOTIATION"
 | 
			
		||||
	default n
 | 
			
		||||
 | 
			
		||||
endif
 | 
			
		||||
							
								
								
									
										164
									
								
								6.12/package/libs/mbedtls/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										164
									
								
								6.12/package/libs/mbedtls/Makefile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,164 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright (C) 2011-2015 OpenWrt.org
 | 
			
		||||
#
 | 
			
		||||
# This is free software, licensed under the GNU General Public License v2.
 | 
			
		||||
# See /LICENSE for more information.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
include $(TOPDIR)/rules.mk
 | 
			
		||||
 | 
			
		||||
PKG_NAME:=mbedtls
 | 
			
		||||
PKG_VERSION:=2.28.7
 | 
			
		||||
PKG_RELEASE:=2
 | 
			
		||||
PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto
 | 
			
		||||
 | 
			
		||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 | 
			
		||||
PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)?
 | 
			
		||||
PKG_HASH:=1df6073f0cf6a4e1953890bf5e0de2a8c7e6be50d6d6c69fa9fefcb1d14e981a
 | 
			
		||||
 | 
			
		||||
PKG_LICENSE:=GPL-2.0-or-later
 | 
			
		||||
PKG_LICENSE_FILES:=gpl-2.0.txt
 | 
			
		||||
PKG_CPE_ID:=cpe:/a:arm:mbed_tls
 | 
			
		||||
 | 
			
		||||
MBEDTLS_BUILD_OPTS_CURVES= \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_ECP_DP_CURVE448_ENABLED
 | 
			
		||||
 | 
			
		||||
MBEDTLS_BUILD_OPTS_CIPHERS= \
 | 
			
		||||
  CONFIG_MBEDTLS_AES_C \
 | 
			
		||||
  CONFIG_MBEDTLS_CAMELLIA_C \
 | 
			
		||||
  CONFIG_MBEDTLS_CCM_C \
 | 
			
		||||
  CONFIG_MBEDTLS_CMAC_C \
 | 
			
		||||
  CONFIG_MBEDTLS_DES_C \
 | 
			
		||||
  CONFIG_MBEDTLS_GCM_C \
 | 
			
		||||
  CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED \
 | 
			
		||||
  CONFIG_MBEDTLS_NIST_KW_C \
 | 
			
		||||
  CONFIG_MBEDTLS_RIPEMD160_C \
 | 
			
		||||
  CONFIG_MBEDTLS_RSA_NO_CRT \
 | 
			
		||||
  CONFIG_MBEDTLS_XTEA_C
 | 
			
		||||
 | 
			
		||||
MBEDTLS_BUILD_OPTS= \
 | 
			
		||||
  $(MBEDTLS_BUILD_OPTS_CURVES) \
 | 
			
		||||
  $(MBEDTLS_BUILD_OPTS_CIPHERS) \
 | 
			
		||||
  CONFIG_MBEDTLS_CERTS_C \
 | 
			
		||||
  CONFIG_MBEDTLS_CIPHER_MODE_OFB \
 | 
			
		||||
  CONFIG_MBEDTLS_CIPHER_MODE_XTS \
 | 
			
		||||
  CONFIG_MBEDTLS_DEBUG_C \
 | 
			
		||||
  CONFIG_MBEDTLS_ENTROPY_FORCE_SHA256 \
 | 
			
		||||
  CONFIG_MBEDTLS_HKDF_C \
 | 
			
		||||
  CONFIG_MBEDTLS_PLATFORM_C \
 | 
			
		||||
  CONFIG_MBEDTLS_SELF_TEST \
 | 
			
		||||
  CONFIG_MBEDTLS_SSL_RENEGOTIATION \
 | 
			
		||||
  CONFIG_MBEDTLS_SSL_TRUNCATED_HMAC \
 | 
			
		||||
  CONFIG_MBEDTLS_THREADING_C \
 | 
			
		||||
  CONFIG_MBEDTLS_THREADING_PTHREAD \
 | 
			
		||||
  CONFIG_MBEDTLS_VERSION_C \
 | 
			
		||||
  CONFIG_MBEDTLS_VERSION_FEATURES
 | 
			
		||||
 | 
			
		||||
PKG_CONFIG_DEPENDS := $(MBEDTLS_BUILD_OPTS)
 | 
			
		||||
 | 
			
		||||
include $(INCLUDE_DIR)/package.mk
 | 
			
		||||
include $(INCLUDE_DIR)/cmake.mk
 | 
			
		||||
 | 
			
		||||
define Package/mbedtls/Default
 | 
			
		||||
  TITLE:=Embedded SSL
 | 
			
		||||
  URL:=https://tls.mbed.org
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/mbedtls/Default/description
 | 
			
		||||
The aim of the mbedtls project is to provide a quality, open-source
 | 
			
		||||
cryptographic library written in C and targeted at embedded systems.
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/libmbedtls
 | 
			
		||||
$(call Package/mbedtls/Default)
 | 
			
		||||
  SECTION:=libs
 | 
			
		||||
  CATEGORY:=Libraries
 | 
			
		||||
  SUBMENU:=SSL
 | 
			
		||||
  TITLE+= (library)
 | 
			
		||||
  ABI_VERSION:=13
 | 
			
		||||
  MENU:=1
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/libmbedtls/config
 | 
			
		||||
	source "$(SOURCE)/Config.in"
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/mbedtls-util
 | 
			
		||||
$(call Package/mbedtls/Default)
 | 
			
		||||
  SECTION:=utils
 | 
			
		||||
  CATEGORY:=Utilities
 | 
			
		||||
  TITLE+= (utilities)
 | 
			
		||||
  DEPENDS:=+libmbedtls
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/libmbedtls/description
 | 
			
		||||
$(call Package/mbedtls/Default/description)
 | 
			
		||||
This package contains the mbedtls library.
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/mbedtls-util/description
 | 
			
		||||
$(call Package/mbedtls/Default/description)
 | 
			
		||||
This package contains mbedtls helper programs for private key and
 | 
			
		||||
CSR generation (gen_key, cert_req)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS))
 | 
			
		||||
 | 
			
		||||
CMAKE_OPTIONS += \
 | 
			
		||||
	-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
 | 
			
		||||
	-DUSE_SHARED_MBEDTLS_LIBRARY:Bool=ON \
 | 
			
		||||
	-DENABLE_TESTING:Bool=OFF \
 | 
			
		||||
	-DENABLE_PROGRAMS:Bool=ON
 | 
			
		||||
 | 
			
		||||
define Build/Prepare
 | 
			
		||||
       $(call Build/Prepare/Default)
 | 
			
		||||
 | 
			
		||||
       $(if $(strip $(foreach opt,$(MBEDTLS_BUILD_OPTS),$($(opt)))),
 | 
			
		||||
	 $(foreach opt,$(MBEDTLS_BUILD_OPTS),
 | 
			
		||||
	 $(PKG_BUILD_DIR)/scripts/config.py \
 | 
			
		||||
	 -f $(PKG_BUILD_DIR)/include/mbedtls/config.h \
 | 
			
		||||
	 $(if $($(opt)),set,unset) $(patsubst CONFIG_%,%,$(opt))),)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Build/InstallDev
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/include
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/include/mbedtls $(1)/usr/include/
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.a $(1)/usr/lib/
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/libmbedtls/install
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/mbedtls-util/install
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/bin
 | 
			
		||||
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gen_key $(1)/usr/bin/
 | 
			
		||||
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cert_req $(1)/usr/bin/
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call BuildPackage,libmbedtls))
 | 
			
		||||
$(eval $(call BuildPackage,mbedtls-util))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,197 @@
 | 
			
		|||
From eb9d4fdf1846e688d51d86a9a50f0312aca2af25 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Glenn Strauss <gstrauss@gluelogic.com>
 | 
			
		||||
Date: Sun, 23 Oct 2022 19:48:18 -0400
 | 
			
		||||
Subject: [PATCH] x509 crt verify SAN iPAddress
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
 | 
			
		||||
---
 | 
			
		||||
 include/mbedtls/x509_crt.h |   2 +-
 | 
			
		||||
 library/x509_crt.c         | 126 ++++++++++++++++++++++++++++++-------
 | 
			
		||||
 2 files changed, 103 insertions(+), 25 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/include/mbedtls/x509_crt.h
 | 
			
		||||
+++ b/include/mbedtls/x509_crt.h
 | 
			
		||||
@@ -608,7 +608,7 @@ int mbedtls_x509_crt_verify_info(char *b
 | 
			
		||||
  * \param cn       The expected Common Name. This will be checked to be
 | 
			
		||||
  *                 present in the certificate's subjectAltNames extension or,
 | 
			
		||||
  *                 if this extension is absent, as a CN component in its
 | 
			
		||||
- *                 Subject name. Currently only DNS names are supported. This
 | 
			
		||||
+ *                 Subject name. DNS names and IP addresses are supported. This
 | 
			
		||||
  *                 may be \c NULL if the CN need not be verified.
 | 
			
		||||
  * \param flags    The address at which to store the result of the verification.
 | 
			
		||||
  *                 If the verification couldn't be completed, the flag value is
 | 
			
		||||
--- a/library/x509_crt.c
 | 
			
		||||
+++ b/library/x509_crt.c
 | 
			
		||||
@@ -57,6 +57,10 @@
 | 
			
		||||
 
 | 
			
		||||
 #if defined(MBEDTLS_HAVE_TIME)
 | 
			
		||||
 #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
 | 
			
		||||
+#define WIN32_LEAN_AND_MEAN
 | 
			
		||||
+#ifndef _WIN32_WINNT
 | 
			
		||||
+#define _WIN32_WINNT 0x0600
 | 
			
		||||
+#endif
 | 
			
		||||
 #include <windows.h>
 | 
			
		||||
 #else
 | 
			
		||||
 #include <time.h>
 | 
			
		||||
@@ -3002,6 +3006,61 @@ find_parent:
 | 
			
		||||
     }
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+#ifdef _WIN32
 | 
			
		||||
+#ifdef _MSC_VER
 | 
			
		||||
+#pragma comment(lib, "ws2_32.lib")
 | 
			
		||||
+#include <winsock2.h>
 | 
			
		||||
+#include <ws2tcpip.h>
 | 
			
		||||
+#elif (defined(__MINGW32__) || defined(__MINGW64__)) && _WIN32_WINNT >= 0x0600
 | 
			
		||||
+#include <winsock2.h>
 | 
			
		||||
+#include <ws2tcpip.h>
 | 
			
		||||
+#endif
 | 
			
		||||
+#elif defined(__sun)
 | 
			
		||||
+/* Solaris requires -lsocket -lnsl for inet_pton() */
 | 
			
		||||
+#elif defined(__has_include)
 | 
			
		||||
+#if __has_include(<sys/socket.h>)
 | 
			
		||||
+#include <sys/socket.h>
 | 
			
		||||
+#endif
 | 
			
		||||
+#if __has_include(<arpa/inet.h>)
 | 
			
		||||
+#include <arpa/inet.h>
 | 
			
		||||
+#endif
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
+/* Use whether or not AF_INET6 is defined to indicate whether or not to use
 | 
			
		||||
+ * the platform inet_pton() or a local implementation (below).  The local
 | 
			
		||||
+ * implementation may be used even in cases where the platform provides
 | 
			
		||||
+ * inet_pton(), e.g. when there are different includes required and/or the
 | 
			
		||||
+ * platform implementation requires dependencies on additional libraries.
 | 
			
		||||
+ * Specifically, Windows requires custom includes and additional link
 | 
			
		||||
+ * dependencies, and Solaris requires additional link dependencies.
 | 
			
		||||
+ * Also, as a coarse heuristic, use the local implementation if the compiler
 | 
			
		||||
+ * does not support __has_include(), or if the definition of AF_INET6 is not
 | 
			
		||||
+ * provided by headers included (or not) via __has_include() above. */
 | 
			
		||||
+#ifndef AF_INET6
 | 
			
		||||
+
 | 
			
		||||
+#define x509_cn_inet_pton(cn, dst) (0)
 | 
			
		||||
+
 | 
			
		||||
+#else
 | 
			
		||||
+
 | 
			
		||||
+static int x509_inet_pton_ipv6(const char *src, void *dst)
 | 
			
		||||
+{
 | 
			
		||||
+    return inet_pton(AF_INET6, src, dst) == 1 ? 0 : -1;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int x509_inet_pton_ipv4(const char *src, void *dst)
 | 
			
		||||
+{
 | 
			
		||||
+    return inet_pton(AF_INET, src, dst) == 1 ? 0 : -1;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+#endif /* AF_INET6 */
 | 
			
		||||
+
 | 
			
		||||
+static size_t x509_cn_inet_pton(const char *cn, void *dst)
 | 
			
		||||
+{
 | 
			
		||||
+    return strchr(cn, ':') == NULL
 | 
			
		||||
+            ? x509_inet_pton_ipv4(cn, dst) == 0 ? 4 : 0
 | 
			
		||||
+            : x509_inet_pton_ipv6(cn, dst) == 0 ? 16 : 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 /*
 | 
			
		||||
  * Check for CN match
 | 
			
		||||
  */
 | 
			
		||||
@@ -3022,24 +3081,51 @@ static int x509_crt_check_cn(const mbedt
 | 
			
		||||
     return -1;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static int x509_crt_check_san_ip(const mbedtls_x509_sequence *san,
 | 
			
		||||
+                                 const char *cn, size_t cn_len)
 | 
			
		||||
+{
 | 
			
		||||
+    uint32_t ip[4];
 | 
			
		||||
+    cn_len = x509_cn_inet_pton(cn, ip);
 | 
			
		||||
+    if (cn_len == 0) {
 | 
			
		||||
+        return -1;
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    for (const mbedtls_x509_sequence *cur = san; cur != NULL; cur = cur->next) {
 | 
			
		||||
+        const unsigned char san_type = (unsigned char) cur->buf.tag &
 | 
			
		||||
+                                       MBEDTLS_ASN1_TAG_VALUE_MASK;
 | 
			
		||||
+        if (san_type == MBEDTLS_X509_SAN_IP_ADDRESS &&
 | 
			
		||||
+            cur->buf.len == cn_len && memcmp(cur->buf.p, ip, cn_len) == 0) {
 | 
			
		||||
+            return 0;
 | 
			
		||||
+        }
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    return -1;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 /*
 | 
			
		||||
  * Check for SAN match, see RFC 5280 Section 4.2.1.6
 | 
			
		||||
  */
 | 
			
		||||
-static int x509_crt_check_san(const mbedtls_x509_buf *name,
 | 
			
		||||
+static int x509_crt_check_san(const mbedtls_x509_sequence *san,
 | 
			
		||||
                               const char *cn, size_t cn_len)
 | 
			
		||||
 {
 | 
			
		||||
-    const unsigned char san_type = (unsigned char) name->tag &
 | 
			
		||||
-                                   MBEDTLS_ASN1_TAG_VALUE_MASK;
 | 
			
		||||
-
 | 
			
		||||
-    /* dNSName */
 | 
			
		||||
-    if (san_type == MBEDTLS_X509_SAN_DNS_NAME) {
 | 
			
		||||
-        return x509_crt_check_cn(name, cn, cn_len);
 | 
			
		||||
+    int san_ip = 0;
 | 
			
		||||
+    for (const mbedtls_x509_sequence *cur = san; cur != NULL; cur = cur->next) {
 | 
			
		||||
+        switch ((unsigned char) cur->buf.tag & MBEDTLS_ASN1_TAG_VALUE_MASK) {
 | 
			
		||||
+            case MBEDTLS_X509_SAN_DNS_NAME:                /* dNSName */
 | 
			
		||||
+                if (x509_crt_check_cn(&cur->buf, cn, cn_len) == 0) {
 | 
			
		||||
+                    return 0;
 | 
			
		||||
+                }
 | 
			
		||||
+                break;
 | 
			
		||||
+            case MBEDTLS_X509_SAN_IP_ADDRESS:              /* iPAddress */
 | 
			
		||||
+                san_ip = 1;
 | 
			
		||||
+                break;
 | 
			
		||||
+            /* (We may handle other types here later.) */
 | 
			
		||||
+            default: /* Unrecognized type */
 | 
			
		||||
+                break;
 | 
			
		||||
+        }
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
-    /* (We may handle other types here later.) */
 | 
			
		||||
-
 | 
			
		||||
-    /* Unrecognized type */
 | 
			
		||||
-    return -1;
 | 
			
		||||
+    return san_ip ? x509_crt_check_san_ip(san, cn, cn_len) : -1;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
@@ -3050,31 +3136,23 @@ static void x509_crt_verify_name(const m
 | 
			
		||||
                                  uint32_t *flags)
 | 
			
		||||
 {
 | 
			
		||||
     const mbedtls_x509_name *name;
 | 
			
		||||
-    const mbedtls_x509_sequence *cur;
 | 
			
		||||
     size_t cn_len = strlen(cn);
 | 
			
		||||
 
 | 
			
		||||
     if (crt->ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME) {
 | 
			
		||||
-        for (cur = &crt->subject_alt_names; cur != NULL; cur = cur->next) {
 | 
			
		||||
-            if (x509_crt_check_san(&cur->buf, cn, cn_len) == 0) {
 | 
			
		||||
-                break;
 | 
			
		||||
-            }
 | 
			
		||||
-        }
 | 
			
		||||
-
 | 
			
		||||
-        if (cur == NULL) {
 | 
			
		||||
-            *flags |= MBEDTLS_X509_BADCERT_CN_MISMATCH;
 | 
			
		||||
+        if (x509_crt_check_san(&crt->subject_alt_names, cn, cn_len) == 0) {
 | 
			
		||||
+            return;
 | 
			
		||||
         }
 | 
			
		||||
     } else {
 | 
			
		||||
         for (name = &crt->subject; name != NULL; name = name->next) {
 | 
			
		||||
             if (MBEDTLS_OID_CMP(MBEDTLS_OID_AT_CN, &name->oid) == 0 &&
 | 
			
		||||
                 x509_crt_check_cn(&name->val, cn, cn_len) == 0) {
 | 
			
		||||
-                break;
 | 
			
		||||
+                return;
 | 
			
		||||
             }
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
-        if (name == NULL) {
 | 
			
		||||
-            *flags |= MBEDTLS_X509_BADCERT_CN_MISMATCH;
 | 
			
		||||
-        }
 | 
			
		||||
     }
 | 
			
		||||
+
 | 
			
		||||
+    *flags |= MBEDTLS_X509_BADCERT_CN_MISMATCH;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
							
								
								
									
										15
									
								
								6.12/package/libs/mbedtls/patches/101-remove-test.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								6.12/package/libs/mbedtls/patches/101-remove-test.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
--- a/programs/CMakeLists.txt
 | 
			
		||||
+++ b/programs/CMakeLists.txt
 | 
			
		||||
@@ -1,12 +1,8 @@
 | 
			
		||||
 add_subdirectory(aes)
 | 
			
		||||
-if (NOT WIN32)
 | 
			
		||||
-    add_subdirectory(fuzz)
 | 
			
		||||
-endif()
 | 
			
		||||
 add_subdirectory(hash)
 | 
			
		||||
 add_subdirectory(pkey)
 | 
			
		||||
 add_subdirectory(psa)
 | 
			
		||||
 add_subdirectory(random)
 | 
			
		||||
 add_subdirectory(ssl)
 | 
			
		||||
-add_subdirectory(test)
 | 
			
		||||
 add_subdirectory(util)
 | 
			
		||||
 add_subdirectory(x509)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
--- a/tests/include/test/macros.h
 | 
			
		||||
+++ b/tests/include/test/macros.h
 | 
			
		||||
@@ -135,8 +135,8 @@
 | 
			
		||||
     do {                                                    \
 | 
			
		||||
         TEST_ASSERT((pointer) == NULL);                     \
 | 
			
		||||
         if ((item_count) != 0) {                            \
 | 
			
		||||
-            (pointer) = mbedtls_calloc(sizeof(*(pointer)),  \
 | 
			
		||||
-                                       (item_count));       \
 | 
			
		||||
+            (pointer) = mbedtls_calloc((item_count),        \
 | 
			
		||||
+                                       sizeof(*(pointer))); \
 | 
			
		||||
             TEST_ASSERT((pointer) != NULL);                 \
 | 
			
		||||
         }                                                   \
 | 
			
		||||
     } while (0)
 | 
			
		||||
@@ -153,8 +153,8 @@
 | 
			
		||||
     do {                                                    \
 | 
			
		||||
         TEST_ASSERT((pointer) == NULL);                     \
 | 
			
		||||
         if ((item_count) != 0) {                            \
 | 
			
		||||
-            (pointer) = mbedtls_calloc(sizeof(*(pointer)),  \
 | 
			
		||||
-                                       (item_count));       \
 | 
			
		||||
+            (pointer) = mbedtls_calloc((item_count),        \
 | 
			
		||||
+                                       sizeof(*(pointer))); \
 | 
			
		||||
             TEST_ASSUME((pointer) != NULL);                 \
 | 
			
		||||
         }                                                   \
 | 
			
		||||
     } while (0)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
--- a/root/usr/share/firewall4/templates/ruleset.uc	2023-07-28 18:55:05.492297782 +0200
 | 
			
		||||
+++ b/root/usr/share/firewall4/templates/ruleset.uc	2023-07-28 18:58:52.300598623 +0200
 | 
			
		||||
@@ -218,9 +218,7 @@
 | 
			
		||||
 {%  for (let rule in fw4.rules(`input_${zone.name}`)): %}
 | 
			
		||||
 		{%+ include("rule.uc", { fw4, rule }) %}
 | 
			
		||||
 {%  endfor %}
 | 
			
		||||
-{%  if (zone.dflags.dnat): %}
 | 
			
		||||
 		ct status dnat accept comment "!fw4: Accept port redirections"
 | 
			
		||||
-{%  endif %}
 | 
			
		||||
 {%  fw4.includes('chain-append', `input_${zone.name}`) %}
 | 
			
		||||
 		jump {{ zone.input }}_from_{{ zone.name }}
 | 
			
		||||
 	}
 | 
			
		||||
@@ -239,9 +237,7 @@
 | 
			
		||||
 {%  for (let rule in fw4.rules(`forward_${zone.name}`)): %}
 | 
			
		||||
 		{%+ include("rule.uc", { fw4, rule }) %}
 | 
			
		||||
 {%  endfor %}
 | 
			
		||||
-{%  if (zone.dflags.dnat): %}
 | 
			
		||||
 		ct status dnat accept comment "!fw4: Accept port forwards"
 | 
			
		||||
-{%  endif %}
 | 
			
		||||
 {%  fw4.includes('chain-append', `forward_${zone.name}`) %}
 | 
			
		||||
 		jump {{ zone.forward }}_to_{{ zone.name }}
 | 
			
		||||
 {%  if (fw4.forward_policy() != "accept" && (zone.log & 1)): %}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,248 @@
 | 
			
		|||
From d4081c498ddca184578903fe5199d390bbc0707b Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Syrone Wong <wong.syrone@gmail.com>
 | 
			
		||||
Date: Sat, 9 Apr 2022 13:24:19 +0800
 | 
			
		||||
Subject: [PATCH] firewall4: add fullcone support
 | 
			
		||||
 | 
			
		||||
fullcone is drop-in replacement of masq for non-udp traffic
 | 
			
		||||
 | 
			
		||||
add runtime fullcone rule check, disable it globally if fullcone expr is
 | 
			
		||||
invalid
 | 
			
		||||
 | 
			
		||||
defaults.fullcone is the global switch, while zone.fullcone4 and
 | 
			
		||||
zone.fullcone6 are switches for IPv4 and IPv6 respectively, most
 | 
			
		||||
IPv6 traffic do NOT need this FullCone NAT functionality.
 | 
			
		||||
---
 | 
			
		||||
 root/etc/config/firewall                      |  3 +
 | 
			
		||||
 root/usr/share/firewall4/templates/ruleset.uc | 16 +++-
 | 
			
		||||
 .../firewall4/templates/zone-fullcone.uc      |  4 +
 | 
			
		||||
 root/usr/share/ucode/fw4.uc                   | 76 ++++++++++++++++++-
 | 
			
		||||
 4 files changed, 96 insertions(+), 3 deletions(-)
 | 
			
		||||
 create mode 100644 root/usr/share/firewall4/templates/zone-fullcone.uc
 | 
			
		||||
 | 
			
		||||
diff --git a/root/etc/config/firewall b/root/etc/config/firewall
 | 
			
		||||
index b9a4647..7187723 100644
 | 
			
		||||
--- a/root/etc/config/firewall
 | 
			
		||||
+++ b/root/etc/config/firewall
 | 
			
		||||
@@ -5,6 +5,7 @@ config defaults
 | 
			
		||||
 	option forward		REJECT
 | 
			
		||||
 # Uncomment this line to disable ipv6 rules
 | 
			
		||||
 #	option disable_ipv6	1
 | 
			
		||||
+	option fullcone '0'
 | 
			
		||||
 
 | 
			
		||||
 config zone
 | 
			
		||||
 	option name		lan
 | 
			
		||||
@@ -20,6 +21,8 @@ config zone
 | 
			
		||||
 	option input		REJECT
 | 
			
		||||
 	option output		ACCEPT
 | 
			
		||||
 	option forward		REJECT
 | 
			
		||||
+	option fullcone4 '0'
 | 
			
		||||
+	option fullcone6 '0'
 | 
			
		||||
 	option masq		1
 | 
			
		||||
 	option mtu_fix		1
 | 
			
		||||
 
 | 
			
		||||
diff --git a/root/usr/share/firewall4/templates/ruleset.uc b/root/usr/share/firewall4/templates/ruleset.uc
 | 
			
		||||
index eaa1f04..e29eae6 100644
 | 
			
		||||
--- a/root/usr/share/firewall4/templates/ruleset.uc
 | 
			
		||||
+++ b/root/usr/share/firewall4/templates/ruleset.uc
 | 
			
		||||
@@ -310,6 +310,12 @@ table inet fw4 {
 | 
			
		||||
 {%   for (let redirect in fw4.redirects(`dstnat_${zone.name}`)): %}
 | 
			
		||||
 		{%+ include("redirect.uc", { fw4, redirect }) %}
 | 
			
		||||
 {%   endfor %}
 | 
			
		||||
+{%   if (zone.fullcone4): %}
 | 
			
		||||
+		{%+ include("zone-fullcone.uc", { fw4, zone, family: 4, direction: "dstnat" }) %}
 | 
			
		||||
+{%   endif %}
 | 
			
		||||
+{%   if (zone.fullcone6): %}
 | 
			
		||||
+		{%+ include("zone-fullcone.uc", { fw4, zone, family: 6, direction: "dstnat" }) %}
 | 
			
		||||
+{%   endif %}
 | 
			
		||||
 {%   fw4.includes('chain-append', `dstnat_${zone.name}`) %}
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
@@ -320,20 +326,26 @@ table inet fw4 {
 | 
			
		||||
 {%   for (let redirect in fw4.redirects(`srcnat_${zone.name}`)): %}
 | 
			
		||||
 		{%+ include("redirect.uc", { fw4, redirect }) %}
 | 
			
		||||
 {%   endfor %}
 | 
			
		||||
-{%   if (zone.masq): %}
 | 
			
		||||
+{%   if (zone.masq && !zone.fullcone4): %}
 | 
			
		||||
 {%    for (let saddrs in zone.masq4_src_subnets): %}
 | 
			
		||||
 {%     for (let daddrs in zone.masq4_dest_subnets): %}
 | 
			
		||||
 		{%+ include("zone-masq.uc", { fw4, zone, family: 4, saddrs, daddrs }) %}
 | 
			
		||||
 {%     endfor %}
 | 
			
		||||
 {%    endfor %}
 | 
			
		||||
 {%   endif %}
 | 
			
		||||
-{%   if (zone.masq6): %}
 | 
			
		||||
+{%   if (zone.masq6 && !zone.fullcone6): %}
 | 
			
		||||
 {%    for (let saddrs in zone.masq6_src_subnets): %}
 | 
			
		||||
 {%     for (let daddrs in zone.masq6_dest_subnets): %}
 | 
			
		||||
 		{%+ include("zone-masq.uc", { fw4, zone, family: 6, saddrs, daddrs }) %}
 | 
			
		||||
 {%     endfor %}
 | 
			
		||||
 {%    endfor %}
 | 
			
		||||
 {%   endif %}
 | 
			
		||||
+{%   if (zone.fullcone4): %}
 | 
			
		||||
+		{%+ include("zone-fullcone.uc", { fw4, zone, family: 4, direction: "srcnat" }) %}
 | 
			
		||||
+{%   endif %}
 | 
			
		||||
+{%   if (zone.fullcone6): %}
 | 
			
		||||
+		{%+ include("zone-fullcone.uc", { fw4, zone, family: 6, direction: "srcnat" }) %}
 | 
			
		||||
+{%   endif %}
 | 
			
		||||
 {%   fw4.includes('chain-append', `srcnat_${zone.name}`) %}
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
diff --git a/root/usr/share/firewall4/templates/zone-fullcone.uc b/root/usr/share/firewall4/templates/zone-fullcone.uc
 | 
			
		||||
new file mode 100644
 | 
			
		||||
index 0000000..77d9806
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/root/usr/share/firewall4/templates/zone-fullcone.uc
 | 
			
		||||
@@ -0,0 +1,4 @@
 | 
			
		||||
+{# /usr/share/firewall4/templates/zone-fullcone.uc #}
 | 
			
		||||
+		meta nfproto {{ fw4.nfproto(family) }} fullcone comment "!fw4: Handle {{
 | 
			
		||||
+		zone.name
 | 
			
		||||
+}} {{ fw4.nfproto(family, true) }} fullcone NAT {{ direction }} traffic"
 | 
			
		||||
diff --git a/root/usr/share/ucode/fw4.uc b/root/usr/share/ucode/fw4.uc
 | 
			
		||||
index 1b4764c..c5716da 100644
 | 
			
		||||
--- a/root/usr/share/ucode/fw4.uc
 | 
			
		||||
+++ b/root/usr/share/ucode/fw4.uc
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
+// /usr/share/ucode/fw4.uc
 | 
			
		||||
+
 | 
			
		||||
 const fs = require("fs");
 | 
			
		||||
 const uci = require("uci");
 | 
			
		||||
 const ubus = require("ubus");
 | 
			
		||||
@@ -428,6 +430,25 @@ function nft_try_hw_offload(devices) {
 | 
			
		||||
 	return (rc == 0);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+function nft_try_fullcone() {
 | 
			
		||||
+	let nft_test =
 | 
			
		||||
+		'add table inet fw4-fullcone-test; ' +
 | 
			
		||||
+		'add chain inet fw4-fullcone-test dstnat { ' +
 | 
			
		||||
+			'type nat hook prerouting priority -100; policy accept; ' +
 | 
			
		||||
+			'fullcone; ' +
 | 
			
		||||
+		'}; ' +
 | 
			
		||||
+		'add chain inet fw4-fullcone-test srcnat { ' +
 | 
			
		||||
+			'type nat hook postrouting priority -100; policy accept; ' +
 | 
			
		||||
+			'fullcone; ' +
 | 
			
		||||
+		'}; ';
 | 
			
		||||
+	let cmd = sprintf("/usr/sbin/nft -c '%s' 2>/dev/null", replace(nft_test, "'", "'\\''"));
 | 
			
		||||
+	let ok = system(cmd) == 0;
 | 
			
		||||
+	//if (!ok) {
 | 
			
		||||
+	//	warn("nft_try_fullcone: cmd "+ cmd + "\n");
 | 
			
		||||
+	//}
 | 
			
		||||
+	return ok;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 
 | 
			
		||||
 return {
 | 
			
		||||
 	read_kernel_version: function() {
 | 
			
		||||
@@ -765,6 +786,18 @@ return {
 | 
			
		||||
 			warn(`[!] ${msg}\n`);
 | 
			
		||||
 	},
 | 
			
		||||
 
 | 
			
		||||
+	myinfo: function(fmt, ...args) {
 | 
			
		||||
+		if (getenv("QUIET"))
 | 
			
		||||
+			return;
 | 
			
		||||
+
 | 
			
		||||
+		let msg = sprintf(fmt, ...args);
 | 
			
		||||
+
 | 
			
		||||
+		if (getenv("TTY"))
 | 
			
		||||
+			warn(`\033[32m${msg}\033[m\n`);
 | 
			
		||||
+		else
 | 
			
		||||
+			warn(`[I] ${msg}\n`);
 | 
			
		||||
+	},
 | 
			
		||||
+
 | 
			
		||||
 	get: function(sid, opt) {
 | 
			
		||||
 		return this.cursor.get("firewall", sid, opt);
 | 
			
		||||
 	},
 | 
			
		||||
@@ -946,6 +979,21 @@ return {
 | 
			
		||||
 		}
 | 
			
		||||
 	},
 | 
			
		||||
 
 | 
			
		||||
+	myinfo_section: function(s, msg) {
 | 
			
		||||
+		if (s[".name"]) {
 | 
			
		||||
+			if (s.name)
 | 
			
		||||
+				this.myinfo("Section %s (%s) %s", this.section_id(s[".name"]), s.name, msg);
 | 
			
		||||
+			else
 | 
			
		||||
+				this.myinfo("Section %s %s", this.section_id(s[".name"]), msg);
 | 
			
		||||
+		}
 | 
			
		||||
+		else {
 | 
			
		||||
+			if (s.name)
 | 
			
		||||
+				this.myinfo("ubus %s (%s) %s", s.type || "rule", s.name, msg);
 | 
			
		||||
+			else
 | 
			
		||||
+				this.myinfo("ubus %s %s", s.type || "rule", msg);
 | 
			
		||||
+		}
 | 
			
		||||
+	},
 | 
			
		||||
+
 | 
			
		||||
 	parse_policy: function(val) {
 | 
			
		||||
 		return this.parse_enum(val, [
 | 
			
		||||
 			"accept",
 | 
			
		||||
@@ -1385,6 +1433,7 @@ return {
 | 
			
		||||
 			"dnat",
 | 
			
		||||
 			"snat",
 | 
			
		||||
 			"masquerade",
 | 
			
		||||
+			"fullcone",
 | 
			
		||||
 			"accept",
 | 
			
		||||
 			"reject",
 | 
			
		||||
 			"drop"
 | 
			
		||||
@@ -1852,6 +1901,7 @@ return {
 | 
			
		||||
 		}
 | 
			
		||||
 
 | 
			
		||||
 		let defs = this.parse_options(data, {
 | 
			
		||||
+			fullcone: [ "bool", "0" ],
 | 
			
		||||
 			input: [ "policy", "drop" ],
 | 
			
		||||
 			output: [ "policy", "drop" ],
 | 
			
		||||
 			forward: [ "policy", "drop" ],
 | 
			
		||||
@@ -1884,6 +1934,11 @@ return {
 | 
			
		||||
 
 | 
			
		||||
 		delete defs.syn_flood;
 | 
			
		||||
 
 | 
			
		||||
+		if (!nft_try_fullcone()) {
 | 
			
		||||
+			delete defs.fullcone;
 | 
			
		||||
+			//warn("nft_try_fullcone failed, disable fullcone globally\n");
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
 		this.state.defaults = defs;
 | 
			
		||||
 	},
 | 
			
		||||
 
 | 
			
		||||
@@ -1908,6 +1963,8 @@ return {
 | 
			
		||||
 			masq_dest: [ "network", null, PARSE_LIST ],
 | 
			
		||||
 
 | 
			
		||||
 			masq6: [ "bool" ],
 | 
			
		||||
+			fullcone4: [ "bool", "0" ],
 | 
			
		||||
+			fullcone6: [ "bool", "0" ],
 | 
			
		||||
 
 | 
			
		||||
 			extra: [ "string", null, UNSUPPORTED ],
 | 
			
		||||
 			extra_src: [ "string", null, UNSUPPORTED ],
 | 
			
		||||
@@ -1940,6 +1997,18 @@ return {
 | 
			
		||||
 			}
 | 
			
		||||
 		}
 | 
			
		||||
 
 | 
			
		||||
+		if (this.state.defaults && !this.state.defaults.fullcone) {
 | 
			
		||||
+			//this.warn_section(data, "fullcone in defaults not enabled, ignore zone fullcone settings");
 | 
			
		||||
+			zone.fullcone4 = false;
 | 
			
		||||
+			zone.fullcone6 = false;
 | 
			
		||||
+		}
 | 
			
		||||
+		if (zone.fullcone4) {
 | 
			
		||||
+			this.myinfo_section(data, "IPv4 fullcone enabled for zone '" + zone.name + "'");
 | 
			
		||||
+		}
 | 
			
		||||
+		if (zone.fullcone6) {
 | 
			
		||||
+			this.myinfo_section(data, "IPv6 fullcone enabled for zone '" + zone.name + "'");
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
 		if (zone.mtu_fix && this.kernel < 0x040a0000) {
 | 
			
		||||
 			this.warn_section(data, "option 'mtu_fix' requires kernel 4.10 or later");
 | 
			
		||||
 			return;
 | 
			
		||||
@@ -2110,10 +2179,15 @@ return {
 | 
			
		||||
 		zone.related_subnets = related_subnets;
 | 
			
		||||
 		zone.related_physdevs = related_physdevs;
 | 
			
		||||
 
 | 
			
		||||
+		if (zone.fullcone4 || zone.fullcone6) {
 | 
			
		||||
+			zone.dflags.snat = true;
 | 
			
		||||
+			zone.dflags.dnat = true;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
 		if (zone.masq || zone.masq6)
 | 
			
		||||
 			zone.dflags.snat = true;
 | 
			
		||||
 
 | 
			
		||||
-		if ((zone.auto_helper && !(zone.masq || zone.masq6)) || length(zone.helper)) {
 | 
			
		||||
+		if ((zone.auto_helper && !(zone.masq || zone.masq6 || zone.fullcone4 || zone.fullcone6)) || length(zone.helper)) {
 | 
			
		||||
 			zone.dflags.helper = true;
 | 
			
		||||
 
 | 
			
		||||
 			for (let helper in (length(zone.helper) ? zone.helper : this.state.helpers)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
--- a/root/usr/share/firewall4/templates/ruleset.uc.old
 | 
			
		||||
+++ b/root/usr/share/firewall4/templates/ruleset.uc
 | 
			
		||||
@@ -181,7 +181,14 @@
 | 
			
		||||
 
 | 
			
		||||
 	chain prerouting {
 | 
			
		||||
 		type filter hook prerouting priority filter; policy accept;
 | 
			
		||||
+{% for (let rule in fw4.rules("forward")): %}
 | 
			
		||||
+		{%+ include("rule.uc", { fw4, zone: (rule.src?.zone?.log_limit ? rule.src.zone : rule.dest?.zone), rule }) %}
 | 
			
		||||
+{% endfor %}
 | 
			
		||||
+
 | 
			
		||||
 {% for (let zone in fw4.zones()): %}
 | 
			
		||||
+{%  for (let rule in fw4.rules(`forward_${zone.name}`)): %}
 | 
			
		||||
+		{%+ include("rule.uc", { fw4, zone, rule }) %}
 | 
			
		||||
+{%  endfor %}
 | 
			
		||||
 {%  if (zone.dflags.helper): %}
 | 
			
		||||
 {%   for (let rule in zone.match_rules): %}
 | 
			
		||||
 {%    let devices_pos = fw4.filter_loopback_devs(rule.devices_pos, false); %}
 | 
			
		||||
							
								
								
									
										1347
									
								
								6.12/package/network/services/dnsmasq/files/dnsmasq.init
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										1347
									
								
								6.12/package/network/services/dnsmasq/files/dnsmasq.init
									
										
									
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										85
									
								
								6.12/package/network/utils/nftables/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								6.12/package/network/utils/nftables/Makefile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,85 @@
 | 
			
		|||
# SPDX-License-Identifier: GPL-2.0-only
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2015 OpenWrt.org
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
include $(TOPDIR)/rules.mk
 | 
			
		||||
 | 
			
		||||
PKG_NAME:=nftables
 | 
			
		||||
PKG_VERSION:=1.0.7
 | 
			
		||||
PKG_RELEASE:=1
 | 
			
		||||
 | 
			
		||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 | 
			
		||||
PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
 | 
			
		||||
PKG_HASH:=c12ac941fff9adaedf17367d5ce213789b98a0d314277bc22b3d71e10891f412
 | 
			
		||||
 | 
			
		||||
PKG_MAINTAINER:=
 | 
			
		||||
PKG_LICENSE:=GPL-2.0
 | 
			
		||||
PKG_LICENSE_FILES:=COPYING
 | 
			
		||||
 | 
			
		||||
PKG_FIXUP:=autoreconf
 | 
			
		||||
PKG_INSTALL:=1
 | 
			
		||||
 | 
			
		||||
PKG_BUILD_FLAGS:=lto
 | 
			
		||||
 | 
			
		||||
include $(INCLUDE_DIR)/package.mk
 | 
			
		||||
 | 
			
		||||
DISABLE_NLS:=
 | 
			
		||||
 | 
			
		||||
CONFIGURE_ARGS += \
 | 
			
		||||
        --disable-debug \
 | 
			
		||||
        --disable-man-doc \
 | 
			
		||||
        --with-mini-gmp \
 | 
			
		||||
        --without-cli \
 | 
			
		||||
        --disable-python
 | 
			
		||||
 | 
			
		||||
define Package/nftables/Default
 | 
			
		||||
  SECTION:=net
 | 
			
		||||
  CATEGORY:=Network
 | 
			
		||||
  SUBMENU:=Firewall
 | 
			
		||||
  TITLE:=nftables userspace utility
 | 
			
		||||
  DEPENDS:=+kmod-nft-core +libnftnl
 | 
			
		||||
  URL:=http://netfilter.org/projects/nftables/
 | 
			
		||||
  PROVIDES:=nftables
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/nftables-nojson
 | 
			
		||||
  $(Package/nftables/Default)
 | 
			
		||||
  TITLE+= no JSON support
 | 
			
		||||
  VARIANT:=nojson
 | 
			
		||||
  DEFAULT_VARIANT:=1
 | 
			
		||||
  CONFLICTS:=nftables-json
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/nftables-json
 | 
			
		||||
  $(Package/nftables/Default)
 | 
			
		||||
  TITLE+= with JSON support
 | 
			
		||||
  VARIANT:=json
 | 
			
		||||
  DEPENDS+=+jansson
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
ifeq ($(BUILD_VARIANT),json)
 | 
			
		||||
  CONFIGURE_ARGS += --with-json
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
define Build/InstallDev
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/include/nftables $(1)/usr/include/
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnftables.pc \
 | 
			
		||||
		$(1)/usr/lib/pkgconfig/
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/nftables/install/Default
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/sbin
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/nft $(1)/usr/sbin/
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
Package/nftables-nojson/install = $(Package/nftables/install/Default)
 | 
			
		||||
Package/nftables-json/install = $(Package/nftables/install/Default)
 | 
			
		||||
 | 
			
		||||
$(eval $(call BuildPackage,nftables-nojson))
 | 
			
		||||
$(eval $(call BuildPackage,nftables-json))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,223 @@
 | 
			
		|||
From 58c89e8768711a959fdc6e953df3ea2254ff93c1 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Syrone Wong <wong.syrone@gmail.com>
 | 
			
		||||
Date: Sat, 9 Apr 2022 00:38:51 +0800
 | 
			
		||||
Subject: [PATCH] nftables: add fullcone expression support
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
 include/linux/netfilter/nf_tables.h | 16 ++++++++++
 | 
			
		||||
 include/statement.h                 |  1 +
 | 
			
		||||
 src/netlink_delinearize.c           | 48 +++++++++++++++++++++++++++++
 | 
			
		||||
 src/netlink_linearize.c             |  7 +++++
 | 
			
		||||
 src/parser_bison.y                  | 28 +++++++++++++++--
 | 
			
		||||
 src/scanner.l                       |  1 +
 | 
			
		||||
 src/statement.c                     |  1 +
 | 
			
		||||
 7 files changed, 100 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h
 | 
			
		||||
index 75df968..beab9d8 100644
 | 
			
		||||
--- a/include/linux/netfilter/nf_tables.h
 | 
			
		||||
+++ b/include/linux/netfilter/nf_tables.h
 | 
			
		||||
@@ -1409,6 +1409,22 @@ enum nft_masq_attributes {
 | 
			
		||||
 };
 | 
			
		||||
 #define NFTA_MASQ_MAX		(__NFTA_MASQ_MAX - 1)
 | 
			
		||||
 
 | 
			
		||||
+/**
 | 
			
		||||
+ * enum nft_fullcone_attributes - nf_tables fullcone expression attributes
 | 
			
		||||
+ *
 | 
			
		||||
+ * @NFTA_FULLCONE_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
 | 
			
		||||
+ * @NFTA_FULLCONE_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
 | 
			
		||||
+ * @NFTA_FULLCONE_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
 | 
			
		||||
+ */
 | 
			
		||||
+enum nft_fullcone_attributes {
 | 
			
		||||
+	NFTA_FULLCONE_UNSPEC,
 | 
			
		||||
+	NFTA_FULLCONE_FLAGS,
 | 
			
		||||
+	NFTA_FULLCONE_REG_PROTO_MIN,
 | 
			
		||||
+	NFTA_FULLCONE_REG_PROTO_MAX,
 | 
			
		||||
+	__NFTA_FULLCONE_MAX
 | 
			
		||||
+};
 | 
			
		||||
+#define NFTA_FULLCONE_MAX		(__NFTA_FULLCONE_MAX - 1)
 | 
			
		||||
+
 | 
			
		||||
 /**
 | 
			
		||||
  * enum nft_redir_attributes - nf_tables redirect expression netlink attributes
 | 
			
		||||
  *
 | 
			
		||||
diff --git a/include/statement.h b/include/statement.h
 | 
			
		||||
index 2a2d300..cbd48dd 100644
 | 
			
		||||
--- a/include/statement.h
 | 
			
		||||
+++ b/include/statement.h
 | 
			
		||||
@@ -122,6 +122,7 @@ enum nft_nat_etypes {
 | 
			
		||||
 	__NFT_NAT_SNAT = NFT_NAT_SNAT,
 | 
			
		||||
 	__NFT_NAT_DNAT = NFT_NAT_DNAT,
 | 
			
		||||
 	NFT_NAT_MASQ,
 | 
			
		||||
+	NFT_NAT_FULLCONE,
 | 
			
		||||
 	NFT_NAT_REDIR,
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
 | 
			
		||||
index 068c3bb..8513113 100644
 | 
			
		||||
--- a/src/netlink_delinearize.c
 | 
			
		||||
+++ b/src/netlink_delinearize.c
 | 
			
		||||
@@ -1369,6 +1369,53 @@ static void netlink_parse_masq(struct netlink_parse_ctx *ctx,
 | 
			
		||||
 	stmt_free(stmt);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static void netlink_parse_fullcone(struct netlink_parse_ctx *ctx,
 | 
			
		||||
+			       const struct location *loc,
 | 
			
		||||
+			       const struct nftnl_expr *nle)
 | 
			
		||||
+{
 | 
			
		||||
+	enum nft_registers reg1, reg2;
 | 
			
		||||
+	struct expr *proto;
 | 
			
		||||
+	struct stmt *stmt;
 | 
			
		||||
+	uint32_t flags = 0;
 | 
			
		||||
+
 | 
			
		||||
+	if (nftnl_expr_is_set(nle, NFTNL_EXPR_FULLCONE_FLAGS))
 | 
			
		||||
+		flags = nftnl_expr_get_u32(nle, NFTNL_EXPR_FULLCONE_FLAGS);
 | 
			
		||||
+
 | 
			
		||||
+	stmt = nat_stmt_alloc(loc, NFT_NAT_FULLCONE);
 | 
			
		||||
+	stmt->nat.flags = flags;
 | 
			
		||||
+
 | 
			
		||||
+	reg1 = netlink_parse_register(nle, NFTNL_EXPR_FULLCONE_REG_PROTO_MIN);
 | 
			
		||||
+	if (reg1) {
 | 
			
		||||
+		proto = netlink_get_register(ctx, loc, reg1);
 | 
			
		||||
+		if (proto == NULL) {
 | 
			
		||||
+			netlink_error(ctx, loc,
 | 
			
		||||
+				      "fullcone statement has no proto expression");
 | 
			
		||||
+			goto out_err;
 | 
			
		||||
+		}
 | 
			
		||||
+		expr_set_type(proto, &inet_service_type, BYTEORDER_BIG_ENDIAN);
 | 
			
		||||
+		stmt->nat.proto = proto;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	reg2 = netlink_parse_register(nle, NFTNL_EXPR_FULLCONE_REG_PROTO_MAX);
 | 
			
		||||
+	if (reg2 && reg2 != reg1) {
 | 
			
		||||
+		proto = netlink_get_register(ctx, loc, reg2);
 | 
			
		||||
+		if (proto == NULL) {
 | 
			
		||||
+			netlink_error(ctx, loc,
 | 
			
		||||
+				      "fullcone statement has no proto expression");
 | 
			
		||||
+			goto out_err;
 | 
			
		||||
+		}
 | 
			
		||||
+		expr_set_type(proto, &inet_service_type, BYTEORDER_BIG_ENDIAN);
 | 
			
		||||
+		if (stmt->nat.proto != NULL)
 | 
			
		||||
+			proto = range_expr_alloc(loc, stmt->nat.proto, proto);
 | 
			
		||||
+		stmt->nat.proto = proto;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	ctx->stmt = stmt;
 | 
			
		||||
+	return;
 | 
			
		||||
+out_err:
 | 
			
		||||
+	stmt_free(stmt);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static void netlink_parse_redir(struct netlink_parse_ctx *ctx,
 | 
			
		||||
 				const struct location *loc,
 | 
			
		||||
 				const struct nftnl_expr *nle)
 | 
			
		||||
@@ -1787,6 +1834,7 @@ static const struct expr_handler netlink_parsers[] = {
 | 
			
		||||
 	{ .name = "tproxy",	.parse = netlink_parse_tproxy },
 | 
			
		||||
 	{ .name = "notrack",	.parse = netlink_parse_notrack },
 | 
			
		||||
 	{ .name = "masq",	.parse = netlink_parse_masq },
 | 
			
		||||
+	{ .name = "fullcone",	.parse = netlink_parse_fullcone },
 | 
			
		||||
 	{ .name = "redir",	.parse = netlink_parse_redir },
 | 
			
		||||
 	{ .name = "dup",	.parse = netlink_parse_dup },
 | 
			
		||||
 	{ .name = "queue",	.parse = netlink_parse_queue },
 | 
			
		||||
diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
 | 
			
		||||
index c8bbcb7..505eafa 100644
 | 
			
		||||
--- a/src/netlink_linearize.c
 | 
			
		||||
+++ b/src/netlink_linearize.c
 | 
			
		||||
@@ -1140,6 +1140,13 @@ static void netlink_gen_nat_stmt(struct netlink_linearize_ctx *ctx,
 | 
			
		||||
 		nftnl_reg_pmin = NFTNL_EXPR_MASQ_REG_PROTO_MIN;
 | 
			
		||||
 		nftnl_reg_pmax = NFTNL_EXPR_MASQ_REG_PROTO_MAX;
 | 
			
		||||
 		break;
 | 
			
		||||
+	case NFT_NAT_FULLCONE:
 | 
			
		||||
+		nle = alloc_nft_expr("fullcone");
 | 
			
		||||
+
 | 
			
		||||
+		nftnl_flag_attr = NFTNL_EXPR_FULLCONE_FLAGS;
 | 
			
		||||
+		nftnl_reg_pmin = NFTNL_EXPR_FULLCONE_REG_PROTO_MIN;
 | 
			
		||||
+		nftnl_reg_pmax = NFTNL_EXPR_FULLCONE_REG_PROTO_MAX;
 | 
			
		||||
+		break;
 | 
			
		||||
 	case NFT_NAT_REDIR:
 | 
			
		||||
 		nle = alloc_nft_expr("redir");
 | 
			
		||||
 
 | 
			
		||||
diff --git a/src/parser_bison.y b/src/parser_bison.y
 | 
			
		||||
index ca5c488..ec9fc9b 100644
 | 
			
		||||
--- a/src/parser_bison.y
 | 
			
		||||
+++ b/src/parser_bison.y
 | 
			
		||||
@@ -571,6 +571,7 @@ int nft_lex(void *, void *, void *);
 | 
			
		||||
 %token SNAT			"snat"
 | 
			
		||||
 %token DNAT			"dnat"
 | 
			
		||||
 %token MASQUERADE		"masquerade"
 | 
			
		||||
+%token FULLCONE		"fullcone"
 | 
			
		||||
 %token REDIRECT			"redirect"
 | 
			
		||||
 %token RANDOM			"random"
 | 
			
		||||
 %token FULLY_RANDOM		"fully-random"
 | 
			
		||||
@@ -703,8 +704,8 @@ int nft_lex(void *, void *, void *);
 | 
			
		||||
 %type <val>			limit_burst_pkts limit_burst_bytes limit_mode limit_bytes time_unit quota_mode
 | 
			
		||||
 %type <stmt>			reject_stmt reject_stmt_alloc
 | 
			
		||||
 %destructor { stmt_free($$); }	reject_stmt reject_stmt_alloc
 | 
			
		||||
-%type <stmt>			nat_stmt nat_stmt_alloc masq_stmt masq_stmt_alloc redir_stmt redir_stmt_alloc
 | 
			
		||||
-%destructor { stmt_free($$); }	nat_stmt nat_stmt_alloc masq_stmt masq_stmt_alloc redir_stmt redir_stmt_alloc
 | 
			
		||||
+%type <stmt>			nat_stmt nat_stmt_alloc masq_stmt masq_stmt_alloc fullcone_stmt fullcone_stmt_alloc redir_stmt redir_stmt_alloc
 | 
			
		||||
+%destructor { stmt_free($$); }	nat_stmt nat_stmt_alloc masq_stmt masq_stmt_alloc fullcone_stmt fullcone_stmt_alloc redir_stmt redir_stmt_alloc
 | 
			
		||||
 %type <val>			nf_nat_flags nf_nat_flag offset_opt
 | 
			
		||||
 %type <stmt>			tproxy_stmt
 | 
			
		||||
 %destructor { stmt_free($$); }	tproxy_stmt
 | 
			
		||||
@@ -2853,6 +2854,7 @@ stmt			:	verdict_stmt
 | 
			
		||||
 			|	queue_stmt
 | 
			
		||||
 			|	ct_stmt
 | 
			
		||||
 			|	masq_stmt	close_scope_nat
 | 
			
		||||
+			|	fullcone_stmt	close_scope_nat
 | 
			
		||||
 			|	redir_stmt	close_scope_nat
 | 
			
		||||
 			|	dup_stmt	close_scope_dup
 | 
			
		||||
 			|	fwd_stmt	close_scope_fwd
 | 
			
		||||
@@ -3753,6 +3755,28 @@ masq_stmt_args		:	TO 	COLON	stmt_expr
 | 
			
		||||
 			}
 | 
			
		||||
 			;
 | 
			
		||||
 
 | 
			
		||||
+fullcone_stmt		:	fullcone_stmt_alloc		fullcone_stmt_args
 | 
			
		||||
+			|	fullcone_stmt_alloc
 | 
			
		||||
+			;
 | 
			
		||||
+
 | 
			
		||||
+fullcone_stmt_alloc		:	FULLCONE	{ $$ = nat_stmt_alloc(&@$, NFT_NAT_FULLCONE); }
 | 
			
		||||
+			;
 | 
			
		||||
+
 | 
			
		||||
+fullcone_stmt_args		:	TO 	COLON	stmt_expr
 | 
			
		||||
+			{
 | 
			
		||||
+				$<stmt>0->nat.proto = $3;
 | 
			
		||||
+			}
 | 
			
		||||
+			|	TO 	COLON	stmt_expr	nf_nat_flags
 | 
			
		||||
+			{
 | 
			
		||||
+				$<stmt>0->nat.proto = $3;
 | 
			
		||||
+				$<stmt>0->nat.flags = $4;
 | 
			
		||||
+			}
 | 
			
		||||
+			|	nf_nat_flags
 | 
			
		||||
+			{
 | 
			
		||||
+				$<stmt>0->nat.flags = $1;
 | 
			
		||||
+			}
 | 
			
		||||
+			;
 | 
			
		||||
+
 | 
			
		||||
 redir_stmt		:	redir_stmt_alloc	redir_stmt_arg
 | 
			
		||||
 			|	redir_stmt_alloc
 | 
			
		||||
 			;
 | 
			
		||||
diff --git a/src/scanner.l b/src/scanner.l
 | 
			
		||||
index 2154281..c389860 100644
 | 
			
		||||
--- a/src/scanner.l
 | 
			
		||||
+++ b/src/scanner.l
 | 
			
		||||
@@ -453,6 +453,7 @@ addrstring	({macaddr}|{ip4addr}|{ip6addr})
 | 
			
		||||
 "snat"			{ scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return SNAT; }
 | 
			
		||||
 "dnat"			{ scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return DNAT; }
 | 
			
		||||
 "masquerade"		{ scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return MASQUERADE; }
 | 
			
		||||
+"fullcone"		{ scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return FULLCONE; }
 | 
			
		||||
 "redirect"		{ scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return REDIRECT; }
 | 
			
		||||
 "random"		{ return RANDOM; }
 | 
			
		||||
 <SCANSTATE_STMT_NAT>{
 | 
			
		||||
diff --git a/src/statement.c b/src/statement.c
 | 
			
		||||
index 30caf9c..f4866c2 100644
 | 
			
		||||
--- a/src/statement.c
 | 
			
		||||
+++ b/src/statement.c
 | 
			
		||||
@@ -650,6 +650,7 @@ const char *nat_etype2str(enum nft_nat_etypes type)
 | 
			
		||||
 		[NFT_NAT_SNAT]	= "snat",
 | 
			
		||||
 		[NFT_NAT_DNAT]	= "dnat",
 | 
			
		||||
 		[NFT_NAT_MASQ]	= "masquerade",
 | 
			
		||||
+		[NFT_NAT_FULLCONE] = "fullcone",
 | 
			
		||||
 		[NFT_NAT_REDIR]	= "redirect",
 | 
			
		||||
 	};
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
From 03cb793b26834ddca170ba87057c8f883772dd45 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Christian Marangi <ansuelsmth@gmail.com>
 | 
			
		||||
Date: Thu, 3 Oct 2024 00:11:41 +0200
 | 
			
		||||
Subject: [PATCH 1/5] block: add support for defining read-only partitions
 | 
			
		||||
 | 
			
		||||
Add support for defining read-only partitions and complete support for
 | 
			
		||||
it in the cmdline partition parser as the additional "ro" after a
 | 
			
		||||
partition is scanned but never actually applied.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
 | 
			
		||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
 | 
			
		||||
Link: https://lore.kernel.org/r/20241002221306.4403-2-ansuelsmth@gmail.com
 | 
			
		||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
 | 
			
		||||
---
 | 
			
		||||
 block/blk.h                | 1 +
 | 
			
		||||
 block/partitions/cmdline.c | 3 +++
 | 
			
		||||
 block/partitions/core.c    | 3 +++
 | 
			
		||||
 3 files changed, 7 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/block/blk.h
 | 
			
		||||
+++ b/block/blk.h
 | 
			
		||||
@@ -424,6 +424,7 @@ void blk_free_ext_minor(unsigned int min
 | 
			
		||||
 #define ADDPART_FLAG_NONE	0
 | 
			
		||||
 #define ADDPART_FLAG_RAID	1
 | 
			
		||||
 #define ADDPART_FLAG_WHOLEDISK	2
 | 
			
		||||
+#define ADDPART_FLAG_READONLY	4
 | 
			
		||||
 int bdev_add_partition(struct gendisk *disk, int partno, sector_t start,
 | 
			
		||||
 		sector_t length);
 | 
			
		||||
 int bdev_del_partition(struct gendisk *disk, int partno);
 | 
			
		||||
--- a/block/partitions/cmdline.c
 | 
			
		||||
+++ b/block/partitions/cmdline.c
 | 
			
		||||
@@ -237,6 +237,9 @@ static int add_part(int slot, struct cmd
 | 
			
		||||
 	put_partition(state, slot, subpart->from >> 9,
 | 
			
		||||
 		      subpart->size >> 9);
 | 
			
		||||
 
 | 
			
		||||
+	if (subpart->flags & PF_RDONLY)
 | 
			
		||||
+		state->parts[slot].flags |= ADDPART_FLAG_READONLY;
 | 
			
		||||
+
 | 
			
		||||
 	info = &state->parts[slot].info;
 | 
			
		||||
 
 | 
			
		||||
 	strscpy(info->volname, subpart->name, sizeof(info->volname));
 | 
			
		||||
--- a/block/partitions/core.c
 | 
			
		||||
+++ b/block/partitions/core.c
 | 
			
		||||
@@ -392,6 +392,9 @@ static struct block_device *add_partitio
 | 
			
		||||
 			goto out_del;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+	if (flags & ADDPART_FLAG_READONLY)
 | 
			
		||||
+		bdev_set_flag(bdev, BD_READ_ONLY);
 | 
			
		||||
+
 | 
			
		||||
 	/* everything is up and running, commence */
 | 
			
		||||
 	err = xa_insert(&disk->part_tbl, partno, bdev, GFP_KERNEL);
 | 
			
		||||
 	if (err)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,94 @@
 | 
			
		|||
From e5f587242b6072ffab4f4a084a459a59f3035873 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Christian Marangi <ansuelsmth@gmail.com>
 | 
			
		||||
Date: Thu, 3 Oct 2024 00:11:43 +0200
 | 
			
		||||
Subject: [PATCH 3/5] block: introduce add_disk_fwnode()
 | 
			
		||||
 | 
			
		||||
Introduce add_disk_fwnode() as a replacement of device_add_disk() that
 | 
			
		||||
permits to pass and attach a fwnode to disk dev.
 | 
			
		||||
 | 
			
		||||
This variant can be useful for eMMC that might have the partition table
 | 
			
		||||
for the disk defined in DT. A parser can later make use of the attached
 | 
			
		||||
fwnode to parse the related table and init the hardcoded partition for
 | 
			
		||||
the disk.
 | 
			
		||||
 | 
			
		||||
device_add_disk() is converted to a simple wrapper of add_disk_fwnode()
 | 
			
		||||
with the fwnode entry set as NULL.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
 | 
			
		||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
 | 
			
		||||
Link: https://lore.kernel.org/r/20241002221306.4403-4-ansuelsmth@gmail.com
 | 
			
		||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
 | 
			
		||||
---
 | 
			
		||||
 block/genhd.c          | 28 ++++++++++++++++++++++++----
 | 
			
		||||
 include/linux/blkdev.h |  3 +++
 | 
			
		||||
 2 files changed, 27 insertions(+), 4 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/block/genhd.c
 | 
			
		||||
+++ b/block/genhd.c
 | 
			
		||||
@@ -383,16 +383,18 @@ int disk_scan_partitions(struct gendisk
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 /**
 | 
			
		||||
- * device_add_disk - add disk information to kernel list
 | 
			
		||||
+ * add_disk_fwnode - add disk information to kernel list with fwnode
 | 
			
		||||
  * @parent: parent device for the disk
 | 
			
		||||
  * @disk: per-device partitioning information
 | 
			
		||||
  * @groups: Additional per-device sysfs groups
 | 
			
		||||
+ * @fwnode: attached disk fwnode
 | 
			
		||||
  *
 | 
			
		||||
  * This function registers the partitioning information in @disk
 | 
			
		||||
- * with the kernel.
 | 
			
		||||
+ * with the kernel. Also attach a fwnode to the disk device.
 | 
			
		||||
  */
 | 
			
		||||
-int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
 | 
			
		||||
-				 const struct attribute_group **groups)
 | 
			
		||||
+int __must_check add_disk_fwnode(struct device *parent, struct gendisk *disk,
 | 
			
		||||
+				 const struct attribute_group **groups,
 | 
			
		||||
+				 struct fwnode_handle *fwnode)
 | 
			
		||||
 
 | 
			
		||||
 {
 | 
			
		||||
 	struct device *ddev = disk_to_dev(disk);
 | 
			
		||||
@@ -451,6 +453,8 @@ int __must_check device_add_disk(struct
 | 
			
		||||
 	ddev->parent = parent;
 | 
			
		||||
 	ddev->groups = groups;
 | 
			
		||||
 	dev_set_name(ddev, "%s", disk->disk_name);
 | 
			
		||||
+	if (fwnode)
 | 
			
		||||
+		device_set_node(ddev, fwnode);
 | 
			
		||||
 	if (!(disk->flags & GENHD_FL_HIDDEN))
 | 
			
		||||
 		ddev->devt = MKDEV(disk->major, disk->first_minor);
 | 
			
		||||
 	ret = device_add(ddev);
 | 
			
		||||
@@ -552,6 +556,22 @@ out_exit_elevator:
 | 
			
		||||
 		elevator_exit(disk->queue);
 | 
			
		||||
 	return ret;
 | 
			
		||||
 }
 | 
			
		||||
+EXPORT_SYMBOL_GPL(add_disk_fwnode);
 | 
			
		||||
+
 | 
			
		||||
+/**
 | 
			
		||||
+ * device_add_disk - add disk information to kernel list
 | 
			
		||||
+ * @parent: parent device for the disk
 | 
			
		||||
+ * @disk: per-device partitioning information
 | 
			
		||||
+ * @groups: Additional per-device sysfs groups
 | 
			
		||||
+ *
 | 
			
		||||
+ * This function registers the partitioning information in @disk
 | 
			
		||||
+ * with the kernel.
 | 
			
		||||
+ */
 | 
			
		||||
+int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
 | 
			
		||||
+				 const struct attribute_group **groups)
 | 
			
		||||
+{
 | 
			
		||||
+	return add_disk_fwnode(parent, disk, groups, NULL);
 | 
			
		||||
+}
 | 
			
		||||
 EXPORT_SYMBOL(device_add_disk);
 | 
			
		||||
 
 | 
			
		||||
 static void blk_report_disk_dead(struct gendisk *disk, bool surprise)
 | 
			
		||||
--- a/include/linux/blkdev.h
 | 
			
		||||
+++ b/include/linux/blkdev.h
 | 
			
		||||
@@ -741,6 +741,9 @@ static inline unsigned int blk_queue_dep
 | 
			
		||||
 #define for_each_bio(_bio)		\
 | 
			
		||||
 	for (; _bio; _bio = _bio->bi_next)
 | 
			
		||||
 
 | 
			
		||||
+int __must_check add_disk_fwnode(struct device *parent, struct gendisk *disk,
 | 
			
		||||
+				 const struct attribute_group **groups,
 | 
			
		||||
+				 struct fwnode_handle *fwnode);
 | 
			
		||||
 int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
 | 
			
		||||
 				 const struct attribute_group **groups);
 | 
			
		||||
 static inline int __must_check add_disk(struct gendisk *disk)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,104 @@
 | 
			
		|||
From 45ff6c340ddfc2dade74d5b7a8962c778ab7042c Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Christian Marangi <ansuelsmth@gmail.com>
 | 
			
		||||
Date: Thu, 3 Oct 2024 00:11:44 +0200
 | 
			
		||||
Subject: [PATCH 4/5] mmc: block: attach partitions fwnode if found in mmc-card
 | 
			
		||||
 | 
			
		||||
Attach partitions fwnode if found in mmc-card and register disk with it.
 | 
			
		||||
 | 
			
		||||
This permits block partition to reference the node and register a
 | 
			
		||||
partition table defined in DT for the special case for embedded device
 | 
			
		||||
that doesn't have a partition table flashed but have an hardcoded
 | 
			
		||||
partition table passed from the system.
 | 
			
		||||
 | 
			
		||||
JEDEC BOOT partition boot0/boot1 are supported but in DT we refer with
 | 
			
		||||
the JEDEC name of boot1 and boot2 to better adhere to documentation.
 | 
			
		||||
 | 
			
		||||
Also JEDEC GP partition gp0/1/2/3 are supported but in DT we refer with
 | 
			
		||||
the JEDEC name of gp1/2/3/4 to better adhere to documentration.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
 | 
			
		||||
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
 | 
			
		||||
Link: https://lore.kernel.org/r/20241002221306.4403-5-ansuelsmth@gmail.com
 | 
			
		||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
 | 
			
		||||
---
 | 
			
		||||
 drivers/mmc/core/block.c | 55 +++++++++++++++++++++++++++++++++++++++-
 | 
			
		||||
 1 file changed, 54 insertions(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/mmc/core/block.c
 | 
			
		||||
+++ b/drivers/mmc/core/block.c
 | 
			
		||||
@@ -2455,6 +2455,56 @@ static inline int mmc_blk_readonly(struc
 | 
			
		||||
 	       !(card->csd.cmdclass & CCC_BLOCK_WRITE);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+/*
 | 
			
		||||
+ * Search for a declared partitions node for the disk in mmc-card related node.
 | 
			
		||||
+ *
 | 
			
		||||
+ * This is to permit support for partition table defined in DT in special case
 | 
			
		||||
+ * where a partition table is not written in the disk and is expected to be
 | 
			
		||||
+ * passed from the running system.
 | 
			
		||||
+ *
 | 
			
		||||
+ * For the user disk, "partitions" node is searched.
 | 
			
		||||
+ * For the special HW disk, "partitions-" node with the appended name is used
 | 
			
		||||
+ * following this conversion table (to adhere to JEDEC naming)
 | 
			
		||||
+ * - boot0 -> partitions-boot1
 | 
			
		||||
+ * - boot1 -> partitions-boot2
 | 
			
		||||
+ * - gp0 -> partitions-gp1
 | 
			
		||||
+ * - gp1 -> partitions-gp2
 | 
			
		||||
+ * - gp2 -> partitions-gp3
 | 
			
		||||
+ * - gp3 -> partitions-gp4
 | 
			
		||||
+ */
 | 
			
		||||
+static struct fwnode_handle *mmc_blk_get_partitions_node(struct device *mmc_dev,
 | 
			
		||||
+							 const char *subname)
 | 
			
		||||
+{
 | 
			
		||||
+	const char *node_name = "partitions";
 | 
			
		||||
+
 | 
			
		||||
+	if (subname) {
 | 
			
		||||
+		mmc_dev = mmc_dev->parent;
 | 
			
		||||
+
 | 
			
		||||
+		/*
 | 
			
		||||
+		 * Check if we are allocating a BOOT disk boot0/1 disk.
 | 
			
		||||
+		 * In DT we use the JEDEC naming boot1/2.
 | 
			
		||||
+		 */
 | 
			
		||||
+		if (!strcmp(subname, "boot0"))
 | 
			
		||||
+			node_name = "partitions-boot1";
 | 
			
		||||
+		if (!strcmp(subname, "boot1"))
 | 
			
		||||
+			node_name = "partitions-boot2";
 | 
			
		||||
+		/*
 | 
			
		||||
+		 * Check if we are allocating a GP disk gp0/1/2/3 disk.
 | 
			
		||||
+		 * In DT we use the JEDEC naming gp1/2/3/4.
 | 
			
		||||
+		 */
 | 
			
		||||
+		if (!strcmp(subname, "gp0"))
 | 
			
		||||
+			node_name = "partitions-gp1";
 | 
			
		||||
+		if (!strcmp(subname, "gp1"))
 | 
			
		||||
+			node_name = "partitions-gp2";
 | 
			
		||||
+		if (!strcmp(subname, "gp2"))
 | 
			
		||||
+			node_name = "partitions-gp3";
 | 
			
		||||
+		if (!strcmp(subname, "gp3"))
 | 
			
		||||
+			node_name = "partitions-gp4";
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return device_get_named_child_node(mmc_dev, node_name);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 | 
			
		||||
 					      struct device *parent,
 | 
			
		||||
 					      sector_t size,
 | 
			
		||||
@@ -2463,6 +2513,7 @@ static struct mmc_blk_data *mmc_blk_allo
 | 
			
		||||
 					      int area_type,
 | 
			
		||||
 					      unsigned int part_type)
 | 
			
		||||
 {
 | 
			
		||||
+	struct fwnode_handle *disk_fwnode;
 | 
			
		||||
 	struct mmc_blk_data *md;
 | 
			
		||||
 	int devidx, ret;
 | 
			
		||||
 	char cap_str[10];
 | 
			
		||||
@@ -2568,7 +2619,9 @@ static struct mmc_blk_data *mmc_blk_allo
 | 
			
		||||
 	/* used in ->open, must be set before add_disk: */
 | 
			
		||||
 	if (area_type == MMC_BLK_DATA_AREA_MAIN)
 | 
			
		||||
 		dev_set_drvdata(&card->dev, md);
 | 
			
		||||
-	ret = device_add_disk(md->parent, md->disk, mmc_disk_attr_groups);
 | 
			
		||||
+	disk_fwnode = mmc_blk_get_partitions_node(parent, subname);
 | 
			
		||||
+	ret = add_disk_fwnode(md->parent, md->disk, mmc_disk_attr_groups,
 | 
			
		||||
+			      disk_fwnode);
 | 
			
		||||
 	if (ret)
 | 
			
		||||
 		goto err_put_disk;
 | 
			
		||||
 	return md;
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,200 @@
 | 
			
		|||
From 884555b557e5e6d41c866e2cd8d7b32f50ec974b Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Christian Marangi <ansuelsmth@gmail.com>
 | 
			
		||||
Date: Thu, 3 Oct 2024 00:11:45 +0200
 | 
			
		||||
Subject: [PATCH 5/5] block: add support for partition table defined in OF
 | 
			
		||||
 | 
			
		||||
Add support for partition table defined in Device Tree. Similar to how
 | 
			
		||||
it's done with MTD, add support for defining a fixed partition table in
 | 
			
		||||
device tree.
 | 
			
		||||
 | 
			
		||||
A common scenario for this is fixed block (eMMC) embedded devices that
 | 
			
		||||
have no MBR or GPT partition table to save storage space. Bootloader
 | 
			
		||||
access the block device with absolute address of data.
 | 
			
		||||
 | 
			
		||||
This is to complete the functionality with an equivalent implementation
 | 
			
		||||
with providing partition table with bootargs, for case where the booargs
 | 
			
		||||
can't be modified and tweaking the Device Tree is the only solution to
 | 
			
		||||
have an usabe partition table.
 | 
			
		||||
 | 
			
		||||
The implementation follow the fixed-partitions parser used on MTD
 | 
			
		||||
devices where a "partitions" node is expected to be declared with
 | 
			
		||||
"fixed-partitions" compatible in the OF node of the disk device
 | 
			
		||||
(mmc-card for eMMC for example) and each child node declare a label
 | 
			
		||||
and a reg with offset and size. If label is not declared, the node name
 | 
			
		||||
is used as fallback. Eventually is also possible to declare the read-only
 | 
			
		||||
property to flag the partition as read-only.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
 | 
			
		||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
 | 
			
		||||
Link: https://lore.kernel.org/r/20241002221306.4403-6-ansuelsmth@gmail.com
 | 
			
		||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
 | 
			
		||||
---
 | 
			
		||||
 block/partitions/Kconfig  |   9 ++++
 | 
			
		||||
 block/partitions/Makefile |   1 +
 | 
			
		||||
 block/partitions/check.h  |   1 +
 | 
			
		||||
 block/partitions/core.c   |   3 ++
 | 
			
		||||
 block/partitions/of.c     | 110 ++++++++++++++++++++++++++++++++++++++
 | 
			
		||||
 5 files changed, 124 insertions(+)
 | 
			
		||||
 create mode 100644 block/partitions/of.c
 | 
			
		||||
 | 
			
		||||
--- a/block/partitions/Kconfig
 | 
			
		||||
+++ b/block/partitions/Kconfig
 | 
			
		||||
@@ -270,4 +270,13 @@ config CMDLINE_PARTITION
 | 
			
		||||
 	  Say Y here if you want to read the partition table from bootargs.
 | 
			
		||||
 	  The format for the command line is just like mtdparts.
 | 
			
		||||
 
 | 
			
		||||
+config OF_PARTITION
 | 
			
		||||
+	bool "Device Tree partition support" if PARTITION_ADVANCED
 | 
			
		||||
+	depends on OF
 | 
			
		||||
+	help
 | 
			
		||||
+	  Say Y here if you want to enable support for partition table
 | 
			
		||||
+	  defined in Device Tree. (mainly for eMMC)
 | 
			
		||||
+	  The format for the device tree node is just like MTD fixed-partition
 | 
			
		||||
+	  schema.
 | 
			
		||||
+
 | 
			
		||||
 endmenu
 | 
			
		||||
--- a/block/partitions/Makefile
 | 
			
		||||
+++ b/block/partitions/Makefile
 | 
			
		||||
@@ -12,6 +12,7 @@ obj-$(CONFIG_CMDLINE_PARTITION) += cmdli
 | 
			
		||||
 obj-$(CONFIG_MAC_PARTITION) += mac.o
 | 
			
		||||
 obj-$(CONFIG_LDM_PARTITION) += ldm.o
 | 
			
		||||
 obj-$(CONFIG_MSDOS_PARTITION) += msdos.o
 | 
			
		||||
+obj-$(CONFIG_OF_PARTITION) += of.o
 | 
			
		||||
 obj-$(CONFIG_OSF_PARTITION) += osf.o
 | 
			
		||||
 obj-$(CONFIG_SGI_PARTITION) += sgi.o
 | 
			
		||||
 obj-$(CONFIG_SUN_PARTITION) += sun.o
 | 
			
		||||
--- a/block/partitions/check.h
 | 
			
		||||
+++ b/block/partitions/check.h
 | 
			
		||||
@@ -62,6 +62,7 @@ int karma_partition(struct parsed_partit
 | 
			
		||||
 int ldm_partition(struct parsed_partitions *state);
 | 
			
		||||
 int mac_partition(struct parsed_partitions *state);
 | 
			
		||||
 int msdos_partition(struct parsed_partitions *state);
 | 
			
		||||
+int of_partition(struct parsed_partitions *state);
 | 
			
		||||
 int osf_partition(struct parsed_partitions *state);
 | 
			
		||||
 int sgi_partition(struct parsed_partitions *state);
 | 
			
		||||
 int sun_partition(struct parsed_partitions *state);
 | 
			
		||||
--- a/block/partitions/core.c
 | 
			
		||||
+++ b/block/partitions/core.c
 | 
			
		||||
@@ -43,6 +43,9 @@ static int (*const check_part[])(struct
 | 
			
		||||
 #ifdef CONFIG_CMDLINE_PARTITION
 | 
			
		||||
 	cmdline_partition,
 | 
			
		||||
 #endif
 | 
			
		||||
+#ifdef CONFIG_OF_PARTITION
 | 
			
		||||
+	of_partition,		/* cmdline have priority to OF */
 | 
			
		||||
+#endif
 | 
			
		||||
 #ifdef CONFIG_EFI_PARTITION
 | 
			
		||||
 	efi_partition,		/* this must come before msdos */
 | 
			
		||||
 #endif
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/block/partitions/of.c
 | 
			
		||||
@@ -0,0 +1,110 @@
 | 
			
		||||
+// SPDX-License-Identifier: GPL-2.0
 | 
			
		||||
+
 | 
			
		||||
+#include <linux/blkdev.h>
 | 
			
		||||
+#include <linux/major.h>
 | 
			
		||||
+#include <linux/of.h>
 | 
			
		||||
+#include <linux/string.h>
 | 
			
		||||
+#include "check.h"
 | 
			
		||||
+
 | 
			
		||||
+static int validate_of_partition(struct device_node *np, int slot)
 | 
			
		||||
+{
 | 
			
		||||
+	u64 offset, size;
 | 
			
		||||
+	int len;
 | 
			
		||||
+
 | 
			
		||||
+	const __be32 *reg = of_get_property(np, "reg", &len);
 | 
			
		||||
+	int a_cells = of_n_addr_cells(np);
 | 
			
		||||
+	int s_cells = of_n_size_cells(np);
 | 
			
		||||
+
 | 
			
		||||
+	/* Make sure reg len match the expected addr and size cells */
 | 
			
		||||
+	if (len / sizeof(*reg) != a_cells + s_cells)
 | 
			
		||||
+		return -EINVAL;
 | 
			
		||||
+
 | 
			
		||||
+	/* Validate offset conversion from bytes to sectors */
 | 
			
		||||
+	offset = of_read_number(reg, a_cells);
 | 
			
		||||
+	if (offset % SECTOR_SIZE)
 | 
			
		||||
+		return -EINVAL;
 | 
			
		||||
+
 | 
			
		||||
+	/* Validate size conversion from bytes to sectors */
 | 
			
		||||
+	size = of_read_number(reg + a_cells, s_cells);
 | 
			
		||||
+	if (!size || size % SECTOR_SIZE)
 | 
			
		||||
+		return -EINVAL;
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void add_of_partition(struct parsed_partitions *state, int slot,
 | 
			
		||||
+			     struct device_node *np)
 | 
			
		||||
+{
 | 
			
		||||
+	struct partition_meta_info *info;
 | 
			
		||||
+	char tmp[sizeof(info->volname) + 4];
 | 
			
		||||
+	const char *partname;
 | 
			
		||||
+	int len;
 | 
			
		||||
+
 | 
			
		||||
+	const __be32 *reg = of_get_property(np, "reg", &len);
 | 
			
		||||
+	int a_cells = of_n_addr_cells(np);
 | 
			
		||||
+	int s_cells = of_n_size_cells(np);
 | 
			
		||||
+
 | 
			
		||||
+	/* Convert bytes to sector size */
 | 
			
		||||
+	u64 offset = of_read_number(reg, a_cells) / SECTOR_SIZE;
 | 
			
		||||
+	u64 size = of_read_number(reg + a_cells, s_cells) / SECTOR_SIZE;
 | 
			
		||||
+
 | 
			
		||||
+	put_partition(state, slot, offset, size);
 | 
			
		||||
+
 | 
			
		||||
+	if (of_property_read_bool(np, "read-only"))
 | 
			
		||||
+		state->parts[slot].flags |= ADDPART_FLAG_READONLY;
 | 
			
		||||
+
 | 
			
		||||
+	/*
 | 
			
		||||
+	 * Follow MTD label logic, search for label property,
 | 
			
		||||
+	 * fallback to node name if not found.
 | 
			
		||||
+	 */
 | 
			
		||||
+	info = &state->parts[slot].info;
 | 
			
		||||
+	partname = of_get_property(np, "label", &len);
 | 
			
		||||
+	if (!partname)
 | 
			
		||||
+		partname = of_get_property(np, "name", &len);
 | 
			
		||||
+	strscpy(info->volname, partname, sizeof(info->volname));
 | 
			
		||||
+
 | 
			
		||||
+	snprintf(tmp, sizeof(tmp), "(%s)", info->volname);
 | 
			
		||||
+	strlcat(state->pp_buf, tmp, PAGE_SIZE);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+int of_partition(struct parsed_partitions *state)
 | 
			
		||||
+{
 | 
			
		||||
+	struct device *ddev = disk_to_dev(state->disk);
 | 
			
		||||
+	struct device_node *np;
 | 
			
		||||
+	int slot;
 | 
			
		||||
+
 | 
			
		||||
+	struct device_node *partitions_np = of_node_get(ddev->of_node);
 | 
			
		||||
+
 | 
			
		||||
+	if (!partitions_np ||
 | 
			
		||||
+	    !of_device_is_compatible(partitions_np, "fixed-partitions"))
 | 
			
		||||
+		return 0;
 | 
			
		||||
+
 | 
			
		||||
+	slot = 1;
 | 
			
		||||
+	/* Validate parition offset and size */
 | 
			
		||||
+	for_each_child_of_node(partitions_np, np) {
 | 
			
		||||
+		if (validate_of_partition(np, slot)) {
 | 
			
		||||
+			of_node_put(np);
 | 
			
		||||
+			of_node_put(partitions_np);
 | 
			
		||||
+
 | 
			
		||||
+			return -1;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
+		slot++;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	slot = 1;
 | 
			
		||||
+	for_each_child_of_node(partitions_np, np) {
 | 
			
		||||
+		if (slot >= state->limit) {
 | 
			
		||||
+			of_node_put(np);
 | 
			
		||||
+			break;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
+		add_of_partition(state, slot, np);
 | 
			
		||||
+
 | 
			
		||||
+		slot++;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	strlcat(state->pp_buf, "\n", PAGE_SIZE);
 | 
			
		||||
+
 | 
			
		||||
+	return 1;
 | 
			
		||||
+}
 | 
			
		||||
							
								
								
									
										8490
									
								
								6.12/target/linux/generic/config-6.12
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8490
									
								
								6.12/target/linux/generic/config-6.12
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,41 @@
 | 
			
		|||
From 310e8e04a05d9eb43fa9dd7f00143300afcaa37a Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: David Bauer <mail@david-bauer.net>
 | 
			
		||||
Date: Fri, 11 Nov 2022 13:33:44 +0100
 | 
			
		||||
Subject: [PATCH] kconfig: abort configuration on unset symbol
 | 
			
		||||
 | 
			
		||||
When a target configuration has unset Kconfig symbols, the build will
 | 
			
		||||
fail when OpenWrt is compiled with V=s and stdin is connected to a tty.
 | 
			
		||||
 | 
			
		||||
In case OpenWrt is compiled without either of these preconditions, the
 | 
			
		||||
build will succeed with the symbols in question being unset.
 | 
			
		||||
 | 
			
		||||
Modify the kernel configuration in a way it fails on unset symbols
 | 
			
		||||
regardless of the aforementioned preconditions.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: David Bauer <mail@david-bauer.net>
 | 
			
		||||
---
 | 
			
		||||
 scripts/kconfig/conf.c | 6 ++++++
 | 
			
		||||
 1 file changed, 6 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/scripts/kconfig/conf.c
 | 
			
		||||
+++ b/scripts/kconfig/conf.c
 | 
			
		||||
@@ -338,6 +338,9 @@ static int conf_askvalue(struct symbol *
 | 
			
		||||
 		}
 | 
			
		||||
 		/* fall through */
 | 
			
		||||
 	default:
 | 
			
		||||
+		if (!tty_stdio && getenv("FAIL_ON_UNCONFIGURED")) {
 | 
			
		||||
+			exit(1);
 | 
			
		||||
+		}
 | 
			
		||||
 		fflush(stdout);
 | 
			
		||||
 		xfgets(line, sizeof(line), stdin);
 | 
			
		||||
 		break;
 | 
			
		||||
@@ -520,6 +523,9 @@ static int conf_choice(struct menu *menu
 | 
			
		||||
 			}
 | 
			
		||||
 			/* fall through */
 | 
			
		||||
 		case oldaskconfig:
 | 
			
		||||
+			if (!tty_stdio && getenv("FAIL_ON_UNCONFIGURED")) {
 | 
			
		||||
+				exit(1);
 | 
			
		||||
+			}
 | 
			
		||||
 			fflush(stdout);
 | 
			
		||||
 			xfgets(line, sizeof(line), stdin);
 | 
			
		||||
 			strip(line);
 | 
			
		||||
							
								
								
									
										3053
									
								
								6.12/target/linux/generic/hack-6.12/210-darwin_scripts_include.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3053
									
								
								6.12/target/linux/generic/hack-6.12/210-darwin_scripts_include.patch
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
From e44fc2af1ddc452b6659d08c16973d65c73b7d0a Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
 | 
			
		||||
Date: Wed, 5 Feb 2020 18:36:43 +0000
 | 
			
		||||
Subject: [PATCH] file2alias: build on macos
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
 | 
			
		||||
---
 | 
			
		||||
 scripts/mod/file2alias.c | 3 +++
 | 
			
		||||
 1 file changed, 3 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/scripts/mod/file2alias.c
 | 
			
		||||
+++ b/scripts/mod/file2alias.c
 | 
			
		||||
@@ -35,6 +35,9 @@ typedef uint32_t	__u32;
 | 
			
		||||
 typedef uint16_t	__u16;
 | 
			
		||||
 typedef unsigned char	__u8;
 | 
			
		||||
 
 | 
			
		||||
+#ifdef __APPLE__
 | 
			
		||||
+#define uuid_t compat_uuid_t
 | 
			
		||||
+#endif
 | 
			
		||||
 /* UUID types for backward compatibility, don't use in new code */
 | 
			
		||||
 typedef struct {
 | 
			
		||||
 	__u8 b[16];
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
From be9be95ff10e16a5b4ad36f903978d0cc5747024 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Fri, 7 Jul 2017 17:04:08 +0200
 | 
			
		||||
Subject: kernel: fix linux/spi/spidev.h portability issues with musl
 | 
			
		||||
 | 
			
		||||
Felix will try to get this define included into musl
 | 
			
		||||
 | 
			
		||||
lede-commit: 795e7cf60de19e7a076a46874fab7bb88b43bbff
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 include/uapi/linux/spi/spidev.h | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/include/uapi/linux/spi/spidev.h
 | 
			
		||||
+++ b/include/uapi/linux/spi/spidev.h
 | 
			
		||||
@@ -93,7 +93,7 @@ struct spi_ioc_transfer {
 | 
			
		||||
 
 | 
			
		||||
 /* not all platforms use <asm-generic/ioctl.h> or _IOC_TYPECHECK() ... */
 | 
			
		||||
 #define SPI_MSGSIZE(N) \
 | 
			
		||||
-	((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \
 | 
			
		||||
+	((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << 13)) \
 | 
			
		||||
 		? ((N)*(sizeof (struct spi_ioc_transfer))) : 0)
 | 
			
		||||
 #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)])
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
From b3d00b452467f621317953d9e4c6f9ae8dcfd271 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Imre Kaloz <kaloz@openwrt.org>
 | 
			
		||||
Date: Fri, 7 Jul 2017 17:06:55 +0200
 | 
			
		||||
Subject: use the openwrt lzma options for now
 | 
			
		||||
 | 
			
		||||
lede-commit: 548de949f392049420a6a1feeef118b30ab8ea8c
 | 
			
		||||
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
 | 
			
		||||
---
 | 
			
		||||
 lib/decompress.c              |  1 +
 | 
			
		||||
 scripts/Makefile.lib          |  2 +-
 | 
			
		||||
 usr/gen_initramfs_list.sh | 10 +++++-----
 | 
			
		||||
 3 files changed, 7 insertions(+), 6 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/lib/decompress.c
 | 
			
		||||
+++ b/lib/decompress.c
 | 
			
		||||
@@ -53,6 +53,7 @@ static const struct compress_format comp
 | 
			
		||||
 	{ {0x1f, 0x9e}, "gzip", gunzip },
 | 
			
		||||
 	{ {0x42, 0x5a}, "bzip2", bunzip2 },
 | 
			
		||||
 	{ {0x5d, 0x00}, "lzma", unlzma },
 | 
			
		||||
+	{ {0x6d, 0x00}, "lzma-openwrt", unlzma },
 | 
			
		||||
 	{ {0xfd, 0x37}, "xz", unxz },
 | 
			
		||||
 	{ {0x89, 0x4c}, "lzo", unlzo },
 | 
			
		||||
 	{ {0x02, 0x21}, "lz4", unlz4 },
 | 
			
		||||
--- a/scripts/Makefile.lib
 | 
			
		||||
+++ b/scripts/Makefile.lib
 | 
			
		||||
@@ -456,10 +456,10 @@ quiet_cmd_bzip2_with_size = BZIP2   $@
 | 
			
		||||
 # ---------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
 quiet_cmd_lzma = LZMA    $@
 | 
			
		||||
-      cmd_lzma = cat $(real-prereqs) | $(LZMA) -9 > $@
 | 
			
		||||
+      cmd_lzma = cat $(real-prereqs) | $(LZMA) e -d20 -lc1 -lp2 -pb2 -eos -si -so > $@
 | 
			
		||||
 
 | 
			
		||||
 quiet_cmd_lzma_with_size = LZMA    $@
 | 
			
		||||
-      cmd_lzma_with_size = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@
 | 
			
		||||
+      cmd_lzma_with_size = { cat $(real-prereqs) | $(LZMA) e -d20 -lc1 -lp2 -pb2 -eos -si -so; $(size_append); } > $@
 | 
			
		||||
 
 | 
			
		||||
 quiet_cmd_lzo = LZO     $@
 | 
			
		||||
       cmd_lzo = cat $(real-prereqs) | $(KLZOP) -9 > $@
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Subject: hack: net: remove bogus netfilter dependencies
 | 
			
		||||
 | 
			
		||||
lede-commit: 589d2a377dee27d206fc3725325309cf649e4df6
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 net/netfilter/Kconfig | 2 --
 | 
			
		||||
 1 file changed, 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/net/netfilter/Kconfig
 | 
			
		||||
+++ b/net/netfilter/Kconfig
 | 
			
		||||
@@ -259,7 +259,6 @@ config NF_CONNTRACK_FTP
 | 
			
		||||
 
 | 
			
		||||
 config NF_CONNTRACK_H323
 | 
			
		||||
 	tristate "H.323 protocol support"
 | 
			
		||||
-	depends on IPV6 || IPV6=n
 | 
			
		||||
 	depends on NETFILTER_ADVANCED
 | 
			
		||||
 	help
 | 
			
		||||
 	  H.323 is a VoIP signalling protocol from ITU-T. As one of the most
 | 
			
		||||
@@ -1120,7 +1119,6 @@ config NETFILTER_XT_TARGET_SECMARK
 | 
			
		||||
 
 | 
			
		||||
 config NETFILTER_XT_TARGET_TCPMSS
 | 
			
		||||
 	tristate '"TCPMSS" target support'
 | 
			
		||||
-	depends on IPV6 || IPV6=n
 | 
			
		||||
 	default m if NETFILTER_ADVANCED=n
 | 
			
		||||
 	help
 | 
			
		||||
 	  This option adds a `TCPMSS' target, which allows you to alter the
 | 
			
		||||
							
								
								
									
										157
									
								
								6.12/target/linux/generic/hack-6.12/251-kconfig.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										157
									
								
								6.12/target/linux/generic/hack-6.12/251-kconfig.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,157 @@
 | 
			
		|||
From da3c50704f14132f4adf80d48e9a4cd5d46e54c9 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: John Crispin <john@phrozen.org>
 | 
			
		||||
Date: Fri, 7 Jul 2017 17:09:21 +0200
 | 
			
		||||
Subject: kconfig: owrt specifc dependencies
 | 
			
		||||
 | 
			
		||||
Signed-off-by: John Crispin <john@phrozen.org>
 | 
			
		||||
---
 | 
			
		||||
 crypto/Kconfig        | 10 +++++-----
 | 
			
		||||
 drivers/bcma/Kconfig  |  1 +
 | 
			
		||||
 drivers/ssb/Kconfig   |  3 ++-
 | 
			
		||||
 lib/Kconfig           |  8 ++++----
 | 
			
		||||
 net/netfilter/Kconfig |  2 +-
 | 
			
		||||
 net/wireless/Kconfig  | 17 ++++++++++-------
 | 
			
		||||
 sound/core/Kconfig    |  4 ++--
 | 
			
		||||
 7 files changed, 25 insertions(+), 20 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/crypto/Kconfig
 | 
			
		||||
+++ b/crypto/Kconfig
 | 
			
		||||
@@ -55,7 +55,7 @@ config CRYPTO_FIPS_VERSION
 | 
			
		||||
 	  By default the KERNELRELEASE value is used.
 | 
			
		||||
 
 | 
			
		||||
 config CRYPTO_ALGAPI
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "ALGAPI"
 | 
			
		||||
 	select CRYPTO_ALGAPI2
 | 
			
		||||
 	help
 | 
			
		||||
 	  This option provides the API for cryptographic algorithms.
 | 
			
		||||
@@ -64,7 +64,7 @@ config CRYPTO_ALGAPI2
 | 
			
		||||
 	tristate
 | 
			
		||||
 
 | 
			
		||||
 config CRYPTO_AEAD
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "AEAD"
 | 
			
		||||
 	select CRYPTO_AEAD2
 | 
			
		||||
 	select CRYPTO_ALGAPI
 | 
			
		||||
 
 | 
			
		||||
@@ -82,7 +82,7 @@ config CRYPTO_SIG2
 | 
			
		||||
 	select CRYPTO_ALGAPI2
 | 
			
		||||
 
 | 
			
		||||
 config CRYPTO_SKCIPHER
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "SKCIPHER"
 | 
			
		||||
 	select CRYPTO_SKCIPHER2
 | 
			
		||||
 	select CRYPTO_ALGAPI
 | 
			
		||||
 
 | 
			
		||||
@@ -91,7 +91,7 @@ config CRYPTO_SKCIPHER2
 | 
			
		||||
 	select CRYPTO_ALGAPI2
 | 
			
		||||
 
 | 
			
		||||
 config CRYPTO_HASH
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "HASH"
 | 
			
		||||
 	select CRYPTO_HASH2
 | 
			
		||||
 	select CRYPTO_ALGAPI
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,7 @@ config CRYPTO_HASH2
 | 
			
		||||
 	select CRYPTO_ALGAPI2
 | 
			
		||||
 
 | 
			
		||||
 config CRYPTO_RNG
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "RNG"
 | 
			
		||||
 	select CRYPTO_RNG2
 | 
			
		||||
 	select CRYPTO_ALGAPI
 | 
			
		||||
 
 | 
			
		||||
--- a/drivers/bcma/Kconfig
 | 
			
		||||
+++ b/drivers/bcma/Kconfig
 | 
			
		||||
@@ -16,6 +16,7 @@ if BCMA
 | 
			
		||||
 # Support for Block-I/O. SELECT this from the driver that needs it.
 | 
			
		||||
 config BCMA_BLOCKIO
 | 
			
		||||
 	bool
 | 
			
		||||
+	default y
 | 
			
		||||
 
 | 
			
		||||
 config BCMA_HOST_PCI_POSSIBLE
 | 
			
		||||
 	bool
 | 
			
		||||
--- a/drivers/ssb/Kconfig
 | 
			
		||||
+++ b/drivers/ssb/Kconfig
 | 
			
		||||
@@ -29,6 +29,7 @@ config SSB_SPROM
 | 
			
		||||
 config SSB_BLOCKIO
 | 
			
		||||
 	bool
 | 
			
		||||
 	depends on SSB
 | 
			
		||||
+	default y
 | 
			
		||||
 
 | 
			
		||||
 config SSB_PCIHOST_POSSIBLE
 | 
			
		||||
 	bool
 | 
			
		||||
@@ -49,7 +50,7 @@ config SSB_PCIHOST
 | 
			
		||||
 config SSB_B43_PCI_BRIDGE
 | 
			
		||||
 	bool
 | 
			
		||||
 	depends on SSB_PCIHOST
 | 
			
		||||
-	default n
 | 
			
		||||
+	default y
 | 
			
		||||
 
 | 
			
		||||
 config SSB_PCMCIAHOST_POSSIBLE
 | 
			
		||||
 	bool
 | 
			
		||||
--- a/lib/Kconfig
 | 
			
		||||
+++ b/lib/Kconfig
 | 
			
		||||
@@ -460,16 +460,16 @@ config BCH_CONST_T
 | 
			
		||||
 # Textsearch support is select'ed if needed
 | 
			
		||||
 #
 | 
			
		||||
 config TEXTSEARCH
 | 
			
		||||
-	bool
 | 
			
		||||
+	bool "Textsearch support"
 | 
			
		||||
 
 | 
			
		||||
 config TEXTSEARCH_KMP
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "Textsearch KMP"
 | 
			
		||||
 
 | 
			
		||||
 config TEXTSEARCH_BM
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "Textsearch BM"
 | 
			
		||||
 
 | 
			
		||||
 config TEXTSEARCH_FSM
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "Textsearch FSM"
 | 
			
		||||
 
 | 
			
		||||
 config BTREE
 | 
			
		||||
 	bool
 | 
			
		||||
--- a/net/netfilter/Kconfig
 | 
			
		||||
+++ b/net/netfilter/Kconfig
 | 
			
		||||
@@ -22,7 +22,7 @@ config NETFILTER_SKIP_EGRESS
 | 
			
		||||
 	def_bool NETFILTER_EGRESS && (NET_CLS_ACT || IFB)
 | 
			
		||||
 
 | 
			
		||||
 config NETFILTER_NETLINK
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "Netfilter NFNETLINK interface"
 | 
			
		||||
 
 | 
			
		||||
 config NETFILTER_FAMILY_BRIDGE
 | 
			
		||||
 	bool
 | 
			
		||||
--- a/sound/core/Kconfig
 | 
			
		||||
+++ b/sound/core/Kconfig
 | 
			
		||||
@@ -17,7 +17,7 @@ config SND_DMAENGINE_PCM
 | 
			
		||||
 	tristate
 | 
			
		||||
 
 | 
			
		||||
 config SND_HWDEP
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "Sound hardware support"
 | 
			
		||||
 
 | 
			
		||||
 config SND_SEQ_DEVICE
 | 
			
		||||
 	tristate
 | 
			
		||||
@@ -40,7 +40,7 @@ config SND_UMP_LEGACY_RAWMIDI
 | 
			
		||||
 	  The device contains 16 substreams corresponding to UMP groups.
 | 
			
		||||
 
 | 
			
		||||
 config SND_COMPRESS_OFFLOAD
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "Compression offloading support"
 | 
			
		||||
 
 | 
			
		||||
 config SND_JACK
 | 
			
		||||
 	bool
 | 
			
		||||
--- a/net/Kconfig
 | 
			
		||||
+++ b/net/Kconfig
 | 
			
		||||
@@ -467,7 +467,7 @@ config NET_DEVLINK
 | 
			
		||||
 	default n
 | 
			
		||||
 
 | 
			
		||||
 config PAGE_POOL
 | 
			
		||||
-	bool
 | 
			
		||||
+	bool "Page pool support"
 | 
			
		||||
 
 | 
			
		||||
 config PAGE_POOL_STATS
 | 
			
		||||
 	default n
 | 
			
		||||
							
								
								
									
										32
									
								
								6.12/target/linux/generic/hack-6.12/253-ksmbd-config.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								6.12/target/linux/generic/hack-6.12/253-ksmbd-config.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
From dcd966fa7ca63f38cf7147e1184d13d66e2ca340 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
 | 
			
		||||
Date: Wed, 13 Jul 2022 13:33:30 +0200
 | 
			
		||||
Subject: [PATCH] Kconfig: add tristate for OID and ASNI string
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 init/Kconfig | 2 +-
 | 
			
		||||
 lib/Kconfig  | 2 +-
 | 
			
		||||
 2 files changed, 2 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/init/Kconfig
 | 
			
		||||
+++ b/init/Kconfig
 | 
			
		||||
@@ -1989,7 +1989,7 @@ config PADATA
 | 
			
		||||
 	bool
 | 
			
		||||
 
 | 
			
		||||
 config ASN1
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "ASN1"
 | 
			
		||||
 	help
 | 
			
		||||
 	  Build a simple ASN.1 grammar compiler that produces a bytecode output
 | 
			
		||||
 	  that can be interpreted by the ASN.1 stream decoder and used to
 | 
			
		||||
--- a/lib/Kconfig
 | 
			
		||||
+++ b/lib/Kconfig
 | 
			
		||||
@@ -647,7 +647,7 @@ config LIBFDT
 | 
			
		||||
 	bool
 | 
			
		||||
 
 | 
			
		||||
 config OID_REGISTRY
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "OID"
 | 
			
		||||
 	help
 | 
			
		||||
 	  Enable fast lookup object identifier registry.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										156
									
								
								6.12/target/linux/generic/hack-6.12/259-regmap_dynamic.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										156
									
								
								6.12/target/linux/generic/hack-6.12/259-regmap_dynamic.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,156 @@
 | 
			
		|||
From 811d9e2268a62b830cfe93cd8bc929afcb8b198b Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Sat, 15 Jul 2017 21:12:38 +0200
 | 
			
		||||
Subject: kernel: move regmap bloat out of the kernel image if it is only being used in modules
 | 
			
		||||
 | 
			
		||||
lede-commit: 96f39119815028073583e4fca3a9c5fe9141e998
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 drivers/base/regmap/Kconfig  | 15 ++++++++++-----
 | 
			
		||||
 drivers/base/regmap/Makefile | 12 ++++++++----
 | 
			
		||||
 drivers/base/regmap/regmap.c |  3 +++
 | 
			
		||||
 include/linux/regmap.h       |  2 +-
 | 
			
		||||
 4 files changed, 22 insertions(+), 10 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/base/regmap/Kconfig
 | 
			
		||||
+++ b/drivers/base/regmap/Kconfig
 | 
			
		||||
@@ -4,8 +4,7 @@
 | 
			
		||||
 # subsystems should select the appropriate symbols.
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP
 | 
			
		||||
-	bool
 | 
			
		||||
-	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SOUNDWIRE_MBQ || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM || REGMAP_MDIO || REGMAP_FSI)
 | 
			
		||||
+	tristate
 | 
			
		||||
 	select IRQ_DOMAIN if REGMAP_IRQ
 | 
			
		||||
 	select MDIO_BUS if REGMAP_MDIO
 | 
			
		||||
 	help
 | 
			
		||||
@@ -19,7 +18,7 @@ config REGMAP
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_KUNIT
 | 
			
		||||
 	tristate "KUnit tests for regmap"
 | 
			
		||||
-	depends on KUNIT && REGMAP
 | 
			
		||||
+	depends on KUNIT
 | 
			
		||||
 	default KUNIT_ALL_TESTS
 | 
			
		||||
 	select REGMAP_RAM
 | 
			
		||||
 
 | 
			
		||||
@@ -34,60 +33,76 @@ config REGMAP_BUILD
 | 
			
		||||
 	  normally enabled.
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_AC97
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_I2C
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on I2C
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_SLIMBUS
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on SLIMBUS
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_SPI
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on SPI
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_SPMI
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on SPMI
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_W1
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on W1
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_MDIO
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_MMIO
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_IRQ
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	bool
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_RAM
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_SOUNDWIRE
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on SOUNDWIRE
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_SOUNDWIRE_MBQ
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on SOUNDWIRE
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_SCCB
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on I2C
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_I3C
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on I3C
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_SPI_AVMM
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on SPI
 | 
			
		||||
 
 | 
			
		||||
 config REGMAP_FSI
 | 
			
		||||
+	select REGMAP
 | 
			
		||||
 	tristate
 | 
			
		||||
 	depends on FSI
 | 
			
		||||
--- a/drivers/base/regmap/Makefile
 | 
			
		||||
+++ b/drivers/base/regmap/Makefile
 | 
			
		||||
@@ -2,9 +2,11 @@
 | 
			
		||||
 # For include/trace/define_trace.h to include trace.h
 | 
			
		||||
 CFLAGS_regmap.o := -I$(src)
 | 
			
		||||
 
 | 
			
		||||
-obj-$(CONFIG_REGMAP) += regmap.o regcache.o
 | 
			
		||||
-obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o regcache-maple.o
 | 
			
		||||
-obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
 | 
			
		||||
+regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o regcache-maple.o
 | 
			
		||||
+ifdef CONFIG_DEBUG_FS
 | 
			
		||||
+regmap-core-objs += regmap-debugfs.o
 | 
			
		||||
+endif
 | 
			
		||||
+obj-$(CONFIG_REGMAP) += regmap-core.o
 | 
			
		||||
 obj-$(CONFIG_REGMAP_KUNIT) += regmap-kunit.o
 | 
			
		||||
 obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
 | 
			
		||||
 obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
 | 
			
		||||
--- a/drivers/base/regmap/regmap.c
 | 
			
		||||
+++ b/drivers/base/regmap/regmap.c
 | 
			
		||||
@@ -9,6 +9,7 @@
 | 
			
		||||
 #include <linux/device.h>
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <linux/export.h>
 | 
			
		||||
+#include <linux/module.h>
 | 
			
		||||
 #include <linux/mutex.h>
 | 
			
		||||
 #include <linux/err.h>
 | 
			
		||||
 #include <linux/property.h>
 | 
			
		||||
@@ -3470,3 +3471,5 @@ static int __init regmap_initcall(void)
 | 
			
		||||
 	return 0;
 | 
			
		||||
 }
 | 
			
		||||
 postcore_initcall(regmap_initcall);
 | 
			
		||||
+
 | 
			
		||||
+MODULE_LICENSE("GPL");
 | 
			
		||||
--- a/include/linux/regmap.h
 | 
			
		||||
+++ b/include/linux/regmap.h
 | 
			
		||||
@@ -197,7 +197,7 @@ struct reg_sequence {
 | 
			
		||||
 	__ret ?: __tmp; \
 | 
			
		||||
 })
 | 
			
		||||
 
 | 
			
		||||
-#ifdef CONFIG_REGMAP
 | 
			
		||||
+#if IS_REACHABLE(CONFIG_REGMAP)
 | 
			
		||||
 
 | 
			
		||||
 enum regmap_endian {
 | 
			
		||||
 	/* Unspecified -> 0 -> Backwards compatible default */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,54 @@
 | 
			
		|||
From fd1799b0bf5efa46dd3e6dfbbf3955564807e508 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Fri, 7 Jul 2017 17:12:51 +0200
 | 
			
		||||
Subject: kernel: prevent cryptomgr from pulling in useless extra dependencies for tests that are not run
 | 
			
		||||
 | 
			
		||||
Reduces kernel size after LZMA by about 5k on MIPS
 | 
			
		||||
 | 
			
		||||
lede-commit: 044c316167e076479a344c59905e5b435b84a77f
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 crypto/Kconfig   | 13 ++++++-------
 | 
			
		||||
 crypto/algboss.c |  4 ++++
 | 
			
		||||
 2 files changed, 10 insertions(+), 7 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/crypto/Kconfig
 | 
			
		||||
+++ b/crypto/Kconfig
 | 
			
		||||
@@ -148,15 +148,15 @@ config CRYPTO_MANAGER
 | 
			
		||||
 	  cbc(aes).
 | 
			
		||||
 
 | 
			
		||||
 config CRYPTO_MANAGER2
 | 
			
		||||
-	def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y)
 | 
			
		||||
-	select CRYPTO_ACOMP2
 | 
			
		||||
-	select CRYPTO_AEAD2
 | 
			
		||||
-	select CRYPTO_AKCIPHER2
 | 
			
		||||
-	select CRYPTO_SIG2
 | 
			
		||||
-	select CRYPTO_HASH2
 | 
			
		||||
-	select CRYPTO_KPP2
 | 
			
		||||
-	select CRYPTO_RNG2
 | 
			
		||||
-	select CRYPTO_SKCIPHER2
 | 
			
		||||
+	def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y && !CRYPTO_MANAGER_DISABLE_TESTS)
 | 
			
		||||
+	select CRYPTO_ACOMP2 if !CRYPTO_MANAGER_DISABLE_TESTS
 | 
			
		||||
+	select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS
 | 
			
		||||
+	select CRYPTO_AKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
 | 
			
		||||
+	select CRYPTO_SIG2 if !CRYPTO_MANAGER_DISABLE_TESTS
 | 
			
		||||
+	select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS
 | 
			
		||||
+	select CRYPTO_KPP2 if !CRYPTO_MANAGER_DISABLE_TESTS
 | 
			
		||||
+	select CRYPTO_RNG2 if !CRYPTO_MANAGER_DISABLE_TESTS
 | 
			
		||||
+	select CRYPTO_SKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
 | 
			
		||||
 
 | 
			
		||||
 config CRYPTO_USER
 | 
			
		||||
 	tristate "Userspace cryptographic algorithm configuration"
 | 
			
		||||
--- a/crypto/algboss.c
 | 
			
		||||
+++ b/crypto/algboss.c
 | 
			
		||||
@@ -204,6 +204,10 @@ static int cryptomgr_schedule_test(struc
 | 
			
		||||
 	memcpy(param->alg, alg->cra_name, sizeof(param->alg));
 | 
			
		||||
 	param->type = alg->cra_flags;
 | 
			
		||||
 
 | 
			
		||||
+#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
 | 
			
		||||
+	param->type |= CRYPTO_ALG_TESTED;
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
 	thread = kthread_run(cryptomgr_test, param, "cryptomgr_test");
 | 
			
		||||
 	if (IS_ERR(thread))
 | 
			
		||||
 		goto err_free_param;
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
From 241e5d3f7b0dd3c01f8c7fa83cbc9a3882286d53 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
 | 
			
		||||
Date: Wed, 13 Jul 2022 13:35:18 +0200
 | 
			
		||||
Subject: [PATCH] lib/crypto: add tristate string for ARC4
 | 
			
		||||
 | 
			
		||||
This makes it possible to select CONFIG_CRYPTO_LIB_ARC4 directly. We 
 | 
			
		||||
need this to be able to compile this into the kernel and make use of it 
 | 
			
		||||
from backports.
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 lib/crypto/Kconfig | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/lib/crypto/Kconfig
 | 
			
		||||
+++ b/lib/crypto/Kconfig
 | 
			
		||||
@@ -15,7 +15,7 @@ config CRYPTO_LIB_AESGCM
 | 
			
		||||
 	select CRYPTO_LIB_UTILS
 | 
			
		||||
 
 | 
			
		||||
 config CRYPTO_LIB_ARC4
 | 
			
		||||
-	tristate
 | 
			
		||||
+	tristate "ARC4 cipher library"
 | 
			
		||||
 
 | 
			
		||||
 config CRYPTO_LIB_GF128MUL
 | 
			
		||||
 	tristate
 | 
			
		||||
							
								
								
									
										84
									
								
								6.12/target/linux/generic/hack-6.12/280-rfkill-stubs.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								6.12/target/linux/generic/hack-6.12/280-rfkill-stubs.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,84 @@
 | 
			
		|||
From 236c1acdfef5958010ac9814a9872e0a46fd78ee Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: John Crispin <john@phrozen.org>
 | 
			
		||||
Date: Fri, 7 Jul 2017 17:13:44 +0200
 | 
			
		||||
Subject: rfkill: add fake rfkill support
 | 
			
		||||
 | 
			
		||||
allow building of modules depending on RFKILL even if RFKILL is not enabled.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: John Crispin <john@phrozen.org>
 | 
			
		||||
---
 | 
			
		||||
 include/linux/rfkill.h |  2 +-
 | 
			
		||||
 net/Makefile           |  2 +-
 | 
			
		||||
 net/rfkill/Kconfig     | 14 +++++++++-----
 | 
			
		||||
 net/rfkill/Makefile    |  2 +-
 | 
			
		||||
 4 files changed, 12 insertions(+), 8 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/include/linux/rfkill.h
 | 
			
		||||
+++ b/include/linux/rfkill.h
 | 
			
		||||
@@ -64,7 +64,7 @@ struct rfkill_ops {
 | 
			
		||||
 	int	(*set_block)(void *data, bool blocked);
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
 | 
			
		||||
+#if defined(CONFIG_RFKILL_FULL) || defined(CONFIG_RFKILL_FULL_MODULE)
 | 
			
		||||
 /**
 | 
			
		||||
  * rfkill_alloc - Allocate rfkill structure
 | 
			
		||||
  * @name: name of the struct -- the string is not copied internally
 | 
			
		||||
--- a/net/Makefile
 | 
			
		||||
+++ b/net/Makefile
 | 
			
		||||
@@ -52,7 +52,7 @@ obj-$(CONFIG_TIPC)		+= tipc/
 | 
			
		||||
 obj-$(CONFIG_NETLABEL)		+= netlabel/
 | 
			
		||||
 obj-$(CONFIG_IUCV)		+= iucv/
 | 
			
		||||
 obj-$(CONFIG_SMC)		+= smc/
 | 
			
		||||
-obj-$(CONFIG_RFKILL)		+= rfkill/
 | 
			
		||||
+obj-$(CONFIG_RFKILL_FULL)	+= rfkill/
 | 
			
		||||
 obj-$(CONFIG_NET_9P)		+= 9p/
 | 
			
		||||
 obj-$(CONFIG_CAIF)		+= caif/
 | 
			
		||||
 obj-$(CONFIG_DCB)		+= dcb/
 | 
			
		||||
--- a/net/rfkill/Kconfig
 | 
			
		||||
+++ b/net/rfkill/Kconfig
 | 
			
		||||
@@ -2,7 +2,11 @@
 | 
			
		||||
 #
 | 
			
		||||
 # RF switch subsystem configuration
 | 
			
		||||
 #
 | 
			
		||||
-menuconfig RFKILL
 | 
			
		||||
+config RFKILL
 | 
			
		||||
+	bool
 | 
			
		||||
+	default y
 | 
			
		||||
+
 | 
			
		||||
+menuconfig RFKILL_FULL
 | 
			
		||||
 	tristate "RF switch subsystem support"
 | 
			
		||||
 	help
 | 
			
		||||
 	  Say Y here if you want to have control over RF switches
 | 
			
		||||
@@ -14,19 +18,19 @@ menuconfig RFKILL
 | 
			
		||||
 # LED trigger support
 | 
			
		||||
 config RFKILL_LEDS
 | 
			
		||||
 	bool
 | 
			
		||||
-	depends on RFKILL
 | 
			
		||||
+	depends on RFKILL_FULL
 | 
			
		||||
 	depends on LEDS_TRIGGERS = y || RFKILL = LEDS_TRIGGERS
 | 
			
		||||
 	default y
 | 
			
		||||
 
 | 
			
		||||
 config RFKILL_INPUT
 | 
			
		||||
 	bool "RF switch input support" if EXPERT
 | 
			
		||||
-	depends on RFKILL
 | 
			
		||||
+	depends on RFKILL_FULL
 | 
			
		||||
 	depends on INPUT = y || RFKILL = INPUT
 | 
			
		||||
 	default y if !EXPERT
 | 
			
		||||
 
 | 
			
		||||
 config RFKILL_GPIO
 | 
			
		||||
 	tristate "GPIO RFKILL driver"
 | 
			
		||||
-	depends on RFKILL
 | 
			
		||||
+	depends on RFKILL_FULL
 | 
			
		||||
 	depends on GPIOLIB || COMPILE_TEST
 | 
			
		||||
 	default n
 | 
			
		||||
 	help
 | 
			
		||||
--- a/net/rfkill/Makefile
 | 
			
		||||
+++ b/net/rfkill/Makefile
 | 
			
		||||
@@ -5,5 +5,5 @@
 | 
			
		||||
 
 | 
			
		||||
 rfkill-y			+= core.o
 | 
			
		||||
 rfkill-$(CONFIG_RFKILL_INPUT)	+= input.o
 | 
			
		||||
-obj-$(CONFIG_RFKILL)		+= rfkill.o
 | 
			
		||||
+obj-$(CONFIG_RFKILL_FULL)	+= rfkill.o
 | 
			
		||||
 obj-$(CONFIG_RFKILL_GPIO)	+= rfkill-gpio.o
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,64 @@
 | 
			
		|||
From: Ben Menchaca <ben.menchaca@qca.qualcomm.com>
 | 
			
		||||
Date: Fri, 7 Jun 2013 18:35:22 -0500
 | 
			
		||||
Subject: MIPS: r4k_cache: use more efficient cache blast
 | 
			
		||||
 | 
			
		||||
Optimize the compiler output for larger cache blast cases that are
 | 
			
		||||
common for DMA-based networking.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Ben Menchaca <ben.menchaca@qca.qualcomm.com>
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
--- a/arch/mips/include/asm/r4kcache.h
 | 
			
		||||
+++ b/arch/mips/include/asm/r4kcache.h
 | 
			
		||||
@@ -286,14 +286,46 @@ static inline void prot##extra##blast_##
 | 
			
		||||
 						    unsigned long end)	\
 | 
			
		||||
 {									\
 | 
			
		||||
 	unsigned long lsize = cpu_##desc##_line_size();			\
 | 
			
		||||
+	unsigned long lsize_2 = lsize * 2;				\
 | 
			
		||||
+	unsigned long lsize_3 = lsize * 3;				\
 | 
			
		||||
+	unsigned long lsize_4 = lsize * 4;				\
 | 
			
		||||
+	unsigned long lsize_5 = lsize * 5;				\
 | 
			
		||||
+	unsigned long lsize_6 = lsize * 6;				\
 | 
			
		||||
+	unsigned long lsize_7 = lsize * 7;				\
 | 
			
		||||
+	unsigned long lsize_8 = lsize * 8;				\
 | 
			
		||||
 	unsigned long addr = start & ~(lsize - 1);			\
 | 
			
		||||
-	unsigned long aend = (end - 1) & ~(lsize - 1);			\
 | 
			
		||||
+	unsigned long aend = (end + lsize - 1) & ~(lsize - 1);		\
 | 
			
		||||
+	int lines = (aend - addr) / lsize;				\
 | 
			
		||||
 									\
 | 
			
		||||
-	while (1) {							\
 | 
			
		||||
+	while (lines >= 8) {						\
 | 
			
		||||
+		prot##cache_op(hitop, addr);				\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize);			\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize_2);			\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize_3);			\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize_4);			\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize_5);			\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize_6);			\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize_7);			\
 | 
			
		||||
+		addr += lsize_8;					\
 | 
			
		||||
+		lines -= 8;						\
 | 
			
		||||
+	}								\
 | 
			
		||||
+									\
 | 
			
		||||
+	if (lines & 0x4) {						\
 | 
			
		||||
+		prot##cache_op(hitop, addr);				\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize);			\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize_2);			\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize_3);			\
 | 
			
		||||
+		addr += lsize_4;					\
 | 
			
		||||
+	}								\
 | 
			
		||||
+									\
 | 
			
		||||
+	if (lines & 0x2) {						\
 | 
			
		||||
+		prot##cache_op(hitop, addr);				\
 | 
			
		||||
+		prot##cache_op(hitop, addr + lsize);			\
 | 
			
		||||
+		addr += lsize_2;					\
 | 
			
		||||
+	}								\
 | 
			
		||||
+									\
 | 
			
		||||
+	if (lines & 0x1) {						\
 | 
			
		||||
 		prot##cache_op(hitop, addr);				\
 | 
			
		||||
-		if (addr == aend)					\
 | 
			
		||||
-			break;						\
 | 
			
		||||
-		addr += lsize;						\
 | 
			
		||||
 	}								\
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,112 @@
 | 
			
		|||
From 0bccc3722bdd88e8ae995e77ef9f7b77ee4cbdee Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Daniel Golle <daniel@makrotopia.org>
 | 
			
		||||
Date: Wed, 7 Apr 2021 22:45:54 +0100
 | 
			
		||||
Subject: [PATCH 2/2] mtd: blktrans: call add disks after mtd device
 | 
			
		||||
To: linux-mtd@lists.infradead.org
 | 
			
		||||
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
 | 
			
		||||
    Richard Weinberger <richard@nod.at>,
 | 
			
		||||
    Miquel Raynal <miquel.raynal@bootlin.com>,
 | 
			
		||||
    David Woodhouse <dwmw2@infradead.org>
 | 
			
		||||
 | 
			
		||||
Calling device_add_disk while holding mtd_table_mutex leads
 | 
			
		||||
to deadlock in case part_bits!=0 as block partition parsers
 | 
			
		||||
will try to open the newly created disks, trying to acquire
 | 
			
		||||
mutex once again.
 | 
			
		||||
Move device_add_disk to additional function called after
 | 
			
		||||
add partitions of an MTD device have been added and locks
 | 
			
		||||
have been released.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 | 
			
		||||
---
 | 
			
		||||
 drivers/mtd/mtd_blkdevs.c    | 33 ++++++++++++++++++++++++++-------
 | 
			
		||||
 drivers/mtd/mtdcore.c        |  3 +++
 | 
			
		||||
 include/linux/mtd/blktrans.h |  1 +
 | 
			
		||||
 3 files changed, 30 insertions(+), 7 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/mtd/mtd_blkdevs.c
 | 
			
		||||
+++ b/drivers/mtd/mtd_blkdevs.c
 | 
			
		||||
@@ -386,19 +386,8 @@ int add_mtd_blktrans_dev(struct mtd_blkt
 | 
			
		||||
 	if (new->readonly)
 | 
			
		||||
 		set_disk_ro(gd, 1);
 | 
			
		||||
 
 | 
			
		||||
-	ret = device_add_disk(&new->mtd->dev, gd, NULL);
 | 
			
		||||
-	if (ret)
 | 
			
		||||
-		goto out_cleanup_disk;
 | 
			
		||||
-
 | 
			
		||||
-	if (new->disk_attributes) {
 | 
			
		||||
-		ret = sysfs_create_group(&disk_to_dev(gd)->kobj,
 | 
			
		||||
-					new->disk_attributes);
 | 
			
		||||
-		WARN_ON(ret);
 | 
			
		||||
-	}
 | 
			
		||||
 	return 0;
 | 
			
		||||
 
 | 
			
		||||
-out_cleanup_disk:
 | 
			
		||||
-	put_disk(new->disk);
 | 
			
		||||
 out_free_tag_set:
 | 
			
		||||
 	blk_mq_free_tag_set(new->tag_set);
 | 
			
		||||
 out_kfree_tag_set:
 | 
			
		||||
@@ -408,6 +397,35 @@ out_list_del:
 | 
			
		||||
 	return ret;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+void register_mtd_blktrans_devs(void)
 | 
			
		||||
+{
 | 
			
		||||
+	struct mtd_blktrans_ops *tr;
 | 
			
		||||
+	struct mtd_blktrans_dev *dev, *next;
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	list_for_each_entry(tr, &blktrans_majors, list) {
 | 
			
		||||
+		list_for_each_entry_safe(dev, next, &tr->devs, list) {
 | 
			
		||||
+			if (disk_live(dev->disk))
 | 
			
		||||
+				continue;
 | 
			
		||||
+
 | 
			
		||||
+			ret = device_add_disk(&dev->mtd->dev, dev->disk, NULL);
 | 
			
		||||
+			if (ret)
 | 
			
		||||
+				goto out_cleanup_disk;
 | 
			
		||||
+
 | 
			
		||||
+			if (dev->disk_attributes) {
 | 
			
		||||
+				ret = sysfs_create_group(&disk_to_dev(dev->disk)->kobj,
 | 
			
		||||
+							dev->disk_attributes);
 | 
			
		||||
+				WARN_ON(ret);
 | 
			
		||||
+			}
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return;
 | 
			
		||||
+
 | 
			
		||||
+out_cleanup_disk:
 | 
			
		||||
+	put_disk(dev->disk);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old)
 | 
			
		||||
 {
 | 
			
		||||
 	unsigned long flags;
 | 
			
		||||
--- a/drivers/mtd/mtdcore.c
 | 
			
		||||
+++ b/drivers/mtd/mtdcore.c
 | 
			
		||||
@@ -33,6 +33,7 @@
 | 
			
		||||
 
 | 
			
		||||
 #include <linux/mtd/mtd.h>
 | 
			
		||||
 #include <linux/mtd/partitions.h>
 | 
			
		||||
+#include <linux/mtd/blktrans.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "mtdcore.h"
 | 
			
		||||
 
 | 
			
		||||
@@ -1127,6 +1128,8 @@ int mtd_device_parse_register(struct mtd
 | 
			
		||||
 		register_reboot_notifier(&mtd->reboot_notifier);
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+	register_mtd_blktrans_devs();
 | 
			
		||||
+
 | 
			
		||||
 out:
 | 
			
		||||
 	if (ret) {
 | 
			
		||||
 		nvmem_unregister(mtd->otp_user_nvmem);
 | 
			
		||||
--- a/include/linux/mtd/blktrans.h
 | 
			
		||||
+++ b/include/linux/mtd/blktrans.h
 | 
			
		||||
@@ -76,6 +76,7 @@ extern int deregister_mtd_blktrans(struc
 | 
			
		||||
 extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
 | 
			
		||||
 extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
 | 
			
		||||
 extern int mtd_blktrans_cease_background(struct mtd_blktrans_dev *dev);
 | 
			
		||||
+extern void register_mtd_blktrans_devs(void);
 | 
			
		||||
 
 | 
			
		||||
 /**
 | 
			
		||||
  * module_mtd_blktrans() - Helper macro for registering a mtd blktrans driver
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,120 @@
 | 
			
		|||
From 6fa9e3678eb002246df1280322b6a024853950a5 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Ansuel Smith <ansuelsmth@gmail.com>
 | 
			
		||||
Date: Mon, 11 Oct 2021 00:53:14 +0200
 | 
			
		||||
Subject: [PATCH] drivers: mtd: parsers: add nvmem support to cmdlinepart
 | 
			
		||||
 | 
			
		||||
Assuming cmdlinepart is only one level deep partition scheme and that
 | 
			
		||||
static partition are also defined in DTS, we can assign an of_node for
 | 
			
		||||
partition declared from bootargs. cmdlinepart have priority than
 | 
			
		||||
fiexed-partition parser so in this specific case the parser doesn't
 | 
			
		||||
assign an of_node. Fix this by searching a defined of_node using a
 | 
			
		||||
similar fixed_partition parser and if a partition is found with the same
 | 
			
		||||
label, check that it has the same offset and size and return the DT
 | 
			
		||||
of_node to correctly use NVMEM cells.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
 drivers/mtd/parsers/cmdlinepart.c | 71 +++++++++++++++++++++++++++++++
 | 
			
		||||
 1 file changed, 71 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/mtd/parsers/cmdlinepart.c
 | 
			
		||||
+++ b/drivers/mtd/parsers/cmdlinepart.c
 | 
			
		||||
@@ -43,6 +43,7 @@
 | 
			
		||||
 #include <linux/mtd/partitions.h>
 | 
			
		||||
 #include <linux/module.h>
 | 
			
		||||
 #include <linux/err.h>
 | 
			
		||||
+#include <linux/of.h>
 | 
			
		||||
 
 | 
			
		||||
 /* debug macro */
 | 
			
		||||
 #if 0
 | 
			
		||||
@@ -323,6 +324,68 @@ static int mtdpart_setup_real(char *s)
 | 
			
		||||
 	return 0;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static int search_fixed_partition(struct mtd_info *master,
 | 
			
		||||
+				  struct mtd_partition *target_part,
 | 
			
		||||
+				  struct mtd_partition *fixed_part)
 | 
			
		||||
+{
 | 
			
		||||
+	struct device_node *mtd_node;
 | 
			
		||||
+	struct device_node *ofpart_node;
 | 
			
		||||
+	struct device_node *pp;
 | 
			
		||||
+	struct mtd_partition part;
 | 
			
		||||
+	const char *partname;
 | 
			
		||||
+
 | 
			
		||||
+	mtd_node = mtd_get_of_node(master);
 | 
			
		||||
+	if (!mtd_node)
 | 
			
		||||
+		return -EINVAL;
 | 
			
		||||
+
 | 
			
		||||
+	ofpart_node = of_get_child_by_name(mtd_node, "partitions");
 | 
			
		||||
+
 | 
			
		||||
+	for_each_child_of_node(ofpart_node,  pp) {
 | 
			
		||||
+		const __be32 *reg;
 | 
			
		||||
+		int len;
 | 
			
		||||
+		int a_cells, s_cells;
 | 
			
		||||
+
 | 
			
		||||
+		reg = of_get_property(pp, "reg", &len);
 | 
			
		||||
+		if (!reg) {
 | 
			
		||||
+			pr_debug("%s: ofpart partition %pOF (%pOF) missing reg property.\n",
 | 
			
		||||
+				 master->name, pp,
 | 
			
		||||
+				 mtd_node);
 | 
			
		||||
+			continue;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
+		a_cells = of_n_addr_cells(pp);
 | 
			
		||||
+		s_cells = of_n_size_cells(pp);
 | 
			
		||||
+		if (len / 4 != a_cells + s_cells) {
 | 
			
		||||
+			pr_debug("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n",
 | 
			
		||||
+				 master->name, pp,
 | 
			
		||||
+				 mtd_node);
 | 
			
		||||
+			continue;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
+		part.offset = of_read_number(reg, a_cells);
 | 
			
		||||
+		part.size = of_read_number(reg + a_cells, s_cells);
 | 
			
		||||
+		part.of_node = pp;
 | 
			
		||||
+
 | 
			
		||||
+		partname = of_get_property(pp, "label", &len);
 | 
			
		||||
+		if (!partname)
 | 
			
		||||
+			partname = of_get_property(pp, "name", &len);
 | 
			
		||||
+		part.name = partname;
 | 
			
		||||
+
 | 
			
		||||
+		if (!strncmp(target_part->name, part.name, len)) {
 | 
			
		||||
+			if (part.offset != target_part->offset)
 | 
			
		||||
+				return -EINVAL;
 | 
			
		||||
+
 | 
			
		||||
+			if (part.size != target_part->size)
 | 
			
		||||
+				return -EINVAL;
 | 
			
		||||
+
 | 
			
		||||
+			memcpy(fixed_part, &part, sizeof(struct mtd_partition));
 | 
			
		||||
+			return 0;
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return -EINVAL;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 /*
 | 
			
		||||
  * Main function to be called from the MTD mapping driver/device to
 | 
			
		||||
  * obtain the partitioning information. At this point the command line
 | 
			
		||||
@@ -338,6 +401,7 @@ static int parse_cmdline_partitions(stru
 | 
			
		||||
 	int i, err;
 | 
			
		||||
 	struct cmdline_mtd_partition *part;
 | 
			
		||||
 	const char *mtd_id = master->name;
 | 
			
		||||
+	struct mtd_partition fixed_part;
 | 
			
		||||
 
 | 
			
		||||
 	/* parse command line */
 | 
			
		||||
 	if (!cmdline_parsed) {
 | 
			
		||||
@@ -382,6 +446,13 @@ static int parse_cmdline_partitions(stru
 | 
			
		||||
 				sizeof(*part->parts) * (part->num_parts - i));
 | 
			
		||||
 			i--;
 | 
			
		||||
 		}
 | 
			
		||||
+
 | 
			
		||||
+		err = search_fixed_partition(master, &part->parts[i], &fixed_part);
 | 
			
		||||
+		if (!err) {
 | 
			
		||||
+			part->parts[i].of_node = fixed_part.of_node;
 | 
			
		||||
+			pr_info("Found partition defined in DT for %s. Assigning OF node to support nvmem.",
 | 
			
		||||
+				part->parts[i].name);
 | 
			
		||||
+		}
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
 	*pparts = kmemdup(part->parts, sizeof(*part->parts) * part->num_parts,
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
From ac84397efb3b3868c71c10ad7521161773228a17 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
 | 
			
		||||
Date: Wed, 13 Jul 2022 13:41:44 +0200
 | 
			
		||||
Subject: [PATCH] mtd/nand: add MediaTek NAND bad block managment table
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 drivers/mtd/nand/Kconfig  | 4 ++++
 | 
			
		||||
 drivers/mtd/nand/Makefile | 1 +
 | 
			
		||||
 2 files changed, 5 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/mtd/nand/Kconfig
 | 
			
		||||
+++ b/drivers/mtd/nand/Kconfig
 | 
			
		||||
@@ -46,6 +46,10 @@ config MTD_NAND_ECC_SW_BCH
 | 
			
		||||
 	  ECC codes. They are used with NAND devices requiring more than 1 bit
 | 
			
		||||
 	  of error correction.
 | 
			
		||||
 
 | 
			
		||||
+config MTD_NAND_MTK_BMT
 | 
			
		||||
+	bool "Support MediaTek NAND Bad-block Management Table"
 | 
			
		||||
+	default n
 | 
			
		||||
+
 | 
			
		||||
 config MTD_NAND_ECC_MXIC
 | 
			
		||||
 	bool "Macronix external hardware ECC engine"
 | 
			
		||||
 	depends on HAS_IOMEM
 | 
			
		||||
--- a/drivers/mtd/nand/Makefile
 | 
			
		||||
+++ b/drivers/mtd/nand/Makefile
 | 
			
		||||
@@ -3,6 +3,7 @@
 | 
			
		||||
 nandcore-objs := core.o bbt.o
 | 
			
		||||
 obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o
 | 
			
		||||
 obj-$(CONFIG_MTD_NAND_ECC_MEDIATEK) += ecc-mtk.o
 | 
			
		||||
+obj-$(CONFIG_MTD_NAND_MTK_BMT)	+= mtk_bmt.o mtk_bmt_v2.o mtk_bmt_bbt.o mtk_bmt_nmbm.o
 | 
			
		||||
 
 | 
			
		||||
 obj-y	+= onenand/
 | 
			
		||||
 obj-y	+= raw/
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Tue, 23 Apr 2024 12:35:21 +0200
 | 
			
		||||
Subject: [PATCH] net: enable fraglist GRO by default
 | 
			
		||||
 | 
			
		||||
This can significantly improve performance for packet forwarding/bridging
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
--- a/include/linux/netdev_features.h
 | 
			
		||||
+++ b/include/linux/netdev_features.h
 | 
			
		||||
@@ -242,10 +242,10 @@ static inline int find_next_netdev_featu
 | 
			
		||||
 #define NETIF_F_UPPER_DISABLES	NETIF_F_LRO
 | 
			
		||||
 
 | 
			
		||||
 /* changeable features with no special hardware requirements */
 | 
			
		||||
-#define NETIF_F_SOFT_FEATURES	(NETIF_F_GSO | NETIF_F_GRO)
 | 
			
		||||
+#define NETIF_F_SOFT_FEATURES	(NETIF_F_GSO | NETIF_F_GRO | NETIF_F_GRO_FRAGLIST)
 | 
			
		||||
 
 | 
			
		||||
 /* Changeable features with no special hardware requirements that defaults to off. */
 | 
			
		||||
-#define NETIF_F_SOFT_FEATURES_OFF	(NETIF_F_GRO_FRAGLIST | NETIF_F_GRO_UDP_FWD)
 | 
			
		||||
+#define NETIF_F_SOFT_FEATURES_OFF	(NETIF_F_GRO_UDP_FWD)
 | 
			
		||||
 
 | 
			
		||||
 #define NETIF_F_VLAN_FEATURES	(NETIF_F_HW_VLAN_CTAG_FILTER | \
 | 
			
		||||
 				 NETIF_F_HW_VLAN_CTAG_RX | \
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
From e38488fd0a8a11b4bae4ccad9a7a8cfcf9eb5ab7 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Murat Sezgin <msezgin@codeaurora.org>
 | 
			
		||||
Date: Mon, 6 Apr 2020 11:08:09 -0700
 | 
			
		||||
Subject: [PATCH] netfilter: export udp_get_timeouts function
 | 
			
		||||
 | 
			
		||||
This function is required for acceleration support.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
 | 
			
		||||
Change-Id: Ibca4f402735764e7e6fb3ce2678e670753c6ef9c
 | 
			
		||||
---
 | 
			
		||||
 include/net/netfilter/nf_conntrack_timeout.h | 1 +
 | 
			
		||||
 net/netfilter/nf_conntrack_proto_udp.c       | 3 ++-
 | 
			
		||||
 2 files changed, 3 insertions(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/include/net/netfilter/nf_conntrack_timeout.h
 | 
			
		||||
+++ b/include/net/netfilter/nf_conntrack_timeout.h
 | 
			
		||||
@@ -107,5 +107,6 @@ struct nf_ct_timeout_hooks {
 | 
			
		||||
 
 | 
			
		||||
 extern const struct nf_ct_timeout_hooks __rcu *nf_ct_timeout_hook;
 | 
			
		||||
 #endif
 | 
			
		||||
+extern unsigned int *udp_get_timeouts(struct net *net);
 | 
			
		||||
 
 | 
			
		||||
 #endif /* _NF_CONNTRACK_TIMEOUT_H */
 | 
			
		||||
--- a/net/netfilter/nf_conntrack_proto_udp.c
 | 
			
		||||
+++ b/net/netfilter/nf_conntrack_proto_udp.c
 | 
			
		||||
@@ -29,10 +29,11 @@ static const unsigned int udp_timeouts[U
 | 
			
		||||
 	[UDP_CT_REPLIED]	= 120*HZ,
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
-static unsigned int *udp_get_timeouts(struct net *net)
 | 
			
		||||
+unsigned int *udp_get_timeouts(struct net *net)
 | 
			
		||||
 {
 | 
			
		||||
 	return nf_udp_pernet(net)->timeouts;
 | 
			
		||||
 }
 | 
			
		||||
+EXPORT_SYMBOL(udp_get_timeouts);
 | 
			
		||||
 
 | 
			
		||||
 static void udp_error_log(const struct sk_buff *skb,
 | 
			
		||||
 			  const struct nf_hook_state *state,
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,812 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Tue, 20 Feb 2018 15:56:02 +0100
 | 
			
		||||
Subject: [PATCH] netfilter: add xt_FLOWOFFLOAD target
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 create mode 100644 net/netfilter/xt_OFFLOAD.c
 | 
			
		||||
 | 
			
		||||
--- a/net/netfilter/Kconfig
 | 
			
		||||
+++ b/net/netfilter/Kconfig
 | 
			
		||||
@@ -729,7 +729,6 @@ config NF_FLOW_TABLE
 | 
			
		||||
 	tristate "Netfilter flow table module"
 | 
			
		||||
 	depends on NETFILTER_INGRESS
 | 
			
		||||
 	depends on NF_CONNTRACK
 | 
			
		||||
-	depends on NF_TABLES
 | 
			
		||||
 	help
 | 
			
		||||
 	  This option adds the flow table core infrastructure.
 | 
			
		||||
 
 | 
			
		||||
@@ -1025,6 +1024,15 @@ config NETFILTER_XT_TARGET_NOTRACK
 | 
			
		||||
 	depends on NETFILTER_ADVANCED
 | 
			
		||||
 	select NETFILTER_XT_TARGET_CT
 | 
			
		||||
 
 | 
			
		||||
+config NETFILTER_XT_TARGET_FLOWOFFLOAD
 | 
			
		||||
+	tristate '"FLOWOFFLOAD" target support'
 | 
			
		||||
+	depends on NF_FLOW_TABLE
 | 
			
		||||
+	depends on NETFILTER_INGRESS
 | 
			
		||||
+	help
 | 
			
		||||
+	  This option adds a `FLOWOFFLOAD' target, which uses the nf_flow_offload
 | 
			
		||||
+	  module to speed up processing of packets by bypassing the usual
 | 
			
		||||
+	  netfilter chains
 | 
			
		||||
+
 | 
			
		||||
 config NETFILTER_XT_TARGET_RATEEST
 | 
			
		||||
 	tristate '"RATEEST" target support'
 | 
			
		||||
 	depends on NETFILTER_ADVANCED
 | 
			
		||||
--- a/net/netfilter/Makefile
 | 
			
		||||
+++ b/net/netfilter/Makefile
 | 
			
		||||
@@ -163,6 +163,7 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIF
 | 
			
		||||
 obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o
 | 
			
		||||
 obj-$(CONFIG_NETFILTER_XT_TARGET_CT) += xt_CT.o
 | 
			
		||||
 obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o
 | 
			
		||||
+obj-$(CONFIG_NETFILTER_XT_TARGET_FLOWOFFLOAD) += xt_FLOWOFFLOAD.o
 | 
			
		||||
 obj-$(CONFIG_NETFILTER_XT_TARGET_HL) += xt_HL.o
 | 
			
		||||
 obj-$(CONFIG_NETFILTER_XT_TARGET_HMARK) += xt_HMARK.o
 | 
			
		||||
 obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/net/netfilter/xt_FLOWOFFLOAD.c
 | 
			
		||||
@@ -0,0 +1,703 @@
 | 
			
		||||
+/*
 | 
			
		||||
+ * Copyright (C) 2018-2021 Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
+ *
 | 
			
		||||
+ * This program is free software; you can redistribute it and/or modify
 | 
			
		||||
+ * it under the terms of the GNU General Public License version 2 as
 | 
			
		||||
+ * published by the Free Software Foundation.
 | 
			
		||||
+ */
 | 
			
		||||
+#include <linux/module.h>
 | 
			
		||||
+#include <linux/init.h>
 | 
			
		||||
+#include <linux/netfilter.h>
 | 
			
		||||
+#include <linux/netfilter/xt_FLOWOFFLOAD.h>
 | 
			
		||||
+#include <linux/if_vlan.h>
 | 
			
		||||
+#include <net/ip.h>
 | 
			
		||||
+#include <net/netfilter/nf_conntrack.h>
 | 
			
		||||
+#include <net/netfilter/nf_conntrack_extend.h>
 | 
			
		||||
+#include <net/netfilter/nf_conntrack_helper.h>
 | 
			
		||||
+#include <net/netfilter/nf_flow_table.h>
 | 
			
		||||
+
 | 
			
		||||
+struct xt_flowoffload_hook {
 | 
			
		||||
+	struct hlist_node list;
 | 
			
		||||
+	struct nf_hook_ops ops;
 | 
			
		||||
+	struct net *net;
 | 
			
		||||
+	bool registered;
 | 
			
		||||
+	bool used;
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+struct xt_flowoffload_table {
 | 
			
		||||
+	struct nf_flowtable ft;
 | 
			
		||||
+	struct hlist_head hooks;
 | 
			
		||||
+	struct delayed_work work;
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+struct nf_forward_info {
 | 
			
		||||
+	const struct net_device *indev;
 | 
			
		||||
+	const struct net_device *outdev;
 | 
			
		||||
+	const struct net_device *hw_outdev;
 | 
			
		||||
+	struct id {
 | 
			
		||||
+		__u16	id;
 | 
			
		||||
+		__be16	proto;
 | 
			
		||||
+	} encap[NF_FLOW_TABLE_ENCAP_MAX];
 | 
			
		||||
+	u8 num_encaps;
 | 
			
		||||
+	u8 ingress_vlans;
 | 
			
		||||
+	u8 h_source[ETH_ALEN];
 | 
			
		||||
+	u8 h_dest[ETH_ALEN];
 | 
			
		||||
+	enum flow_offload_xmit_type xmit_type;
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+static DEFINE_SPINLOCK(hooks_lock);
 | 
			
		||||
+
 | 
			
		||||
+struct xt_flowoffload_table flowtable[2];
 | 
			
		||||
+
 | 
			
		||||
+static unsigned int
 | 
			
		||||
+xt_flowoffload_net_hook(void *priv, struct sk_buff *skb,
 | 
			
		||||
+			const struct nf_hook_state *state)
 | 
			
		||||
+{
 | 
			
		||||
+	struct vlan_ethhdr *veth;
 | 
			
		||||
+	__be16 proto;
 | 
			
		||||
+
 | 
			
		||||
+	switch (skb->protocol) {
 | 
			
		||||
+	case htons(ETH_P_8021Q):
 | 
			
		||||
+		veth = (struct vlan_ethhdr *)skb_mac_header(skb);
 | 
			
		||||
+		proto = veth->h_vlan_encapsulated_proto;
 | 
			
		||||
+		break;
 | 
			
		||||
+	case htons(ETH_P_PPP_SES):
 | 
			
		||||
+		if (!nf_flow_pppoe_proto(skb, &proto))
 | 
			
		||||
+			return NF_ACCEPT;
 | 
			
		||||
+		break;
 | 
			
		||||
+	default:
 | 
			
		||||
+		proto = skb->protocol;
 | 
			
		||||
+		break;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	switch (proto) {
 | 
			
		||||
+	case htons(ETH_P_IP):
 | 
			
		||||
+		return nf_flow_offload_ip_hook(priv, skb, state);
 | 
			
		||||
+	case htons(ETH_P_IPV6):
 | 
			
		||||
+		return nf_flow_offload_ipv6_hook(priv, skb, state);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return NF_ACCEPT;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int
 | 
			
		||||
+xt_flowoffload_create_hook(struct xt_flowoffload_table *table,
 | 
			
		||||
+			   struct net_device *dev)
 | 
			
		||||
+{
 | 
			
		||||
+	struct xt_flowoffload_hook *hook;
 | 
			
		||||
+	struct nf_hook_ops *ops;
 | 
			
		||||
+
 | 
			
		||||
+	hook = kzalloc(sizeof(*hook), GFP_ATOMIC);
 | 
			
		||||
+	if (!hook)
 | 
			
		||||
+		return -ENOMEM;
 | 
			
		||||
+
 | 
			
		||||
+	ops = &hook->ops;
 | 
			
		||||
+	ops->pf = NFPROTO_NETDEV;
 | 
			
		||||
+	ops->hooknum = NF_NETDEV_INGRESS;
 | 
			
		||||
+	ops->priority = 10;
 | 
			
		||||
+	ops->priv = &table->ft;
 | 
			
		||||
+	ops->hook = xt_flowoffload_net_hook;
 | 
			
		||||
+	ops->dev = dev;
 | 
			
		||||
+
 | 
			
		||||
+	hlist_add_head(&hook->list, &table->hooks);
 | 
			
		||||
+	mod_delayed_work(system_power_efficient_wq, &table->work, 0);
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static struct xt_flowoffload_hook *
 | 
			
		||||
+flow_offload_lookup_hook(struct xt_flowoffload_table *table,
 | 
			
		||||
+			 struct net_device *dev)
 | 
			
		||||
+{
 | 
			
		||||
+	struct xt_flowoffload_hook *hook;
 | 
			
		||||
+
 | 
			
		||||
+	hlist_for_each_entry(hook, &table->hooks, list) {
 | 
			
		||||
+		if (hook->ops.dev == dev)
 | 
			
		||||
+			return hook;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return NULL;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void
 | 
			
		||||
+xt_flowoffload_check_device(struct xt_flowoffload_table *table,
 | 
			
		||||
+			    struct net_device *dev)
 | 
			
		||||
+{
 | 
			
		||||
+	struct xt_flowoffload_hook *hook;
 | 
			
		||||
+
 | 
			
		||||
+	if (!dev)
 | 
			
		||||
+		return;
 | 
			
		||||
+
 | 
			
		||||
+	spin_lock_bh(&hooks_lock);
 | 
			
		||||
+	hook = flow_offload_lookup_hook(table, dev);
 | 
			
		||||
+	if (hook)
 | 
			
		||||
+		hook->used = true;
 | 
			
		||||
+	else
 | 
			
		||||
+		xt_flowoffload_create_hook(table, dev);
 | 
			
		||||
+	spin_unlock_bh(&hooks_lock);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void
 | 
			
		||||
+xt_flowoffload_register_hooks(struct xt_flowoffload_table *table)
 | 
			
		||||
+{
 | 
			
		||||
+	struct xt_flowoffload_hook *hook;
 | 
			
		||||
+
 | 
			
		||||
+restart:
 | 
			
		||||
+	hlist_for_each_entry(hook, &table->hooks, list) {
 | 
			
		||||
+		if (hook->registered)
 | 
			
		||||
+			continue;
 | 
			
		||||
+
 | 
			
		||||
+		hook->registered = true;
 | 
			
		||||
+		hook->net = dev_net(hook->ops.dev);
 | 
			
		||||
+		spin_unlock_bh(&hooks_lock);
 | 
			
		||||
+		nf_register_net_hook(hook->net, &hook->ops);
 | 
			
		||||
+		if (table->ft.flags & NF_FLOWTABLE_HW_OFFLOAD)
 | 
			
		||||
+			table->ft.type->setup(&table->ft, hook->ops.dev,
 | 
			
		||||
+					      FLOW_BLOCK_BIND);
 | 
			
		||||
+		spin_lock_bh(&hooks_lock);
 | 
			
		||||
+		goto restart;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static bool
 | 
			
		||||
+xt_flowoffload_cleanup_hooks(struct xt_flowoffload_table *table)
 | 
			
		||||
+{
 | 
			
		||||
+	struct xt_flowoffload_hook *hook;
 | 
			
		||||
+	bool active = false;
 | 
			
		||||
+
 | 
			
		||||
+restart:
 | 
			
		||||
+	spin_lock_bh(&hooks_lock);
 | 
			
		||||
+	hlist_for_each_entry(hook, &table->hooks, list) {
 | 
			
		||||
+		if (hook->used || !hook->registered) {
 | 
			
		||||
+			active = true;
 | 
			
		||||
+			continue;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
+		hlist_del(&hook->list);
 | 
			
		||||
+		spin_unlock_bh(&hooks_lock);
 | 
			
		||||
+		if (table->ft.flags & NF_FLOWTABLE_HW_OFFLOAD)
 | 
			
		||||
+			table->ft.type->setup(&table->ft, hook->ops.dev,
 | 
			
		||||
+					      FLOW_BLOCK_UNBIND);
 | 
			
		||||
+		nf_unregister_net_hook(hook->net, &hook->ops);
 | 
			
		||||
+		kfree(hook);
 | 
			
		||||
+		goto restart;
 | 
			
		||||
+	}
 | 
			
		||||
+	spin_unlock_bh(&hooks_lock);
 | 
			
		||||
+
 | 
			
		||||
+	return active;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void
 | 
			
		||||
+xt_flowoffload_check_hook(struct nf_flowtable *flowtable,
 | 
			
		||||
+			  struct flow_offload *flow, void *data)
 | 
			
		||||
+{
 | 
			
		||||
+	struct xt_flowoffload_table *table;
 | 
			
		||||
+	struct flow_offload_tuple *tuple0 = &flow->tuplehash[0].tuple;
 | 
			
		||||
+	struct flow_offload_tuple *tuple1 = &flow->tuplehash[1].tuple;
 | 
			
		||||
+	struct xt_flowoffload_hook *hook;
 | 
			
		||||
+
 | 
			
		||||
+	table = container_of(flowtable, struct xt_flowoffload_table, ft);
 | 
			
		||||
+
 | 
			
		||||
+	spin_lock_bh(&hooks_lock);
 | 
			
		||||
+	hlist_for_each_entry(hook, &table->hooks, list) {
 | 
			
		||||
+		if (hook->ops.dev->ifindex != tuple0->iifidx &&
 | 
			
		||||
+		    hook->ops.dev->ifindex != tuple1->iifidx)
 | 
			
		||||
+			continue;
 | 
			
		||||
+
 | 
			
		||||
+		hook->used = true;
 | 
			
		||||
+	}
 | 
			
		||||
+	spin_unlock_bh(&hooks_lock);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void
 | 
			
		||||
+xt_flowoffload_hook_work(struct work_struct *work)
 | 
			
		||||
+{
 | 
			
		||||
+	struct xt_flowoffload_table *table;
 | 
			
		||||
+	struct xt_flowoffload_hook *hook;
 | 
			
		||||
+	int err;
 | 
			
		||||
+
 | 
			
		||||
+	table = container_of(work, struct xt_flowoffload_table, work.work);
 | 
			
		||||
+
 | 
			
		||||
+	spin_lock_bh(&hooks_lock);
 | 
			
		||||
+	xt_flowoffload_register_hooks(table);
 | 
			
		||||
+	hlist_for_each_entry(hook, &table->hooks, list)
 | 
			
		||||
+		hook->used = false;
 | 
			
		||||
+	spin_unlock_bh(&hooks_lock);
 | 
			
		||||
+
 | 
			
		||||
+	err = nf_flow_table_iterate(&table->ft, xt_flowoffload_check_hook,
 | 
			
		||||
+				    NULL);
 | 
			
		||||
+	if (err && err != -EAGAIN)
 | 
			
		||||
+		goto out;
 | 
			
		||||
+
 | 
			
		||||
+	if (!xt_flowoffload_cleanup_hooks(table))
 | 
			
		||||
+		return;
 | 
			
		||||
+
 | 
			
		||||
+out:
 | 
			
		||||
+	queue_delayed_work(system_power_efficient_wq, &table->work, HZ);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static bool
 | 
			
		||||
+xt_flowoffload_skip(struct sk_buff *skb, int family)
 | 
			
		||||
+{
 | 
			
		||||
+	if (skb_sec_path(skb))
 | 
			
		||||
+		return true;
 | 
			
		||||
+
 | 
			
		||||
+	if (family == NFPROTO_IPV4) {
 | 
			
		||||
+		const struct ip_options *opt = &(IPCB(skb)->opt);
 | 
			
		||||
+
 | 
			
		||||
+		if (unlikely(opt->optlen))
 | 
			
		||||
+			return true;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return false;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static enum flow_offload_xmit_type nf_xmit_type(struct dst_entry *dst)
 | 
			
		||||
+{
 | 
			
		||||
+	if (dst_xfrm(dst))
 | 
			
		||||
+		return FLOW_OFFLOAD_XMIT_XFRM;
 | 
			
		||||
+
 | 
			
		||||
+	return FLOW_OFFLOAD_XMIT_NEIGH;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void nf_default_forward_path(struct nf_flow_route *route,
 | 
			
		||||
+				    struct dst_entry *dst_cache,
 | 
			
		||||
+				    enum ip_conntrack_dir dir,
 | 
			
		||||
+				    struct net_device **dev)
 | 
			
		||||
+{
 | 
			
		||||
+	dev[!dir] = dst_cache->dev;
 | 
			
		||||
+	route->tuple[!dir].in.ifindex	= dst_cache->dev->ifindex;
 | 
			
		||||
+	route->tuple[dir].dst		= dst_cache;
 | 
			
		||||
+	route->tuple[dir].xmit_type	= nf_xmit_type(dst_cache);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static bool nf_is_valid_ether_device(const struct net_device *dev)
 | 
			
		||||
+{
 | 
			
		||||
+	if (!dev || (dev->flags & IFF_LOOPBACK) || dev->type != ARPHRD_ETHER ||
 | 
			
		||||
+	    dev->addr_len != ETH_ALEN || !is_valid_ether_addr(dev->dev_addr))
 | 
			
		||||
+		return false;
 | 
			
		||||
+
 | 
			
		||||
+	return true;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void nf_dev_path_info(const struct net_device_path_stack *stack,
 | 
			
		||||
+			     struct nf_forward_info *info,
 | 
			
		||||
+			     unsigned char *ha)
 | 
			
		||||
+{
 | 
			
		||||
+	const struct net_device_path *path;
 | 
			
		||||
+	int i;
 | 
			
		||||
+
 | 
			
		||||
+	memcpy(info->h_dest, ha, ETH_ALEN);
 | 
			
		||||
+
 | 
			
		||||
+	for (i = 0; i < stack->num_paths; i++) {
 | 
			
		||||
+		path = &stack->path[i];
 | 
			
		||||
+		switch (path->type) {
 | 
			
		||||
+		case DEV_PATH_ETHERNET:
 | 
			
		||||
+		case DEV_PATH_DSA:
 | 
			
		||||
+		case DEV_PATH_VLAN:
 | 
			
		||||
+		case DEV_PATH_PPPOE:
 | 
			
		||||
+			info->indev = path->dev;
 | 
			
		||||
+			if (is_zero_ether_addr(info->h_source))
 | 
			
		||||
+				memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN);
 | 
			
		||||
+
 | 
			
		||||
+			if (path->type == DEV_PATH_ETHERNET)
 | 
			
		||||
+				break;
 | 
			
		||||
+			if (path->type == DEV_PATH_DSA) {
 | 
			
		||||
+				i = stack->num_paths;
 | 
			
		||||
+				break;
 | 
			
		||||
+			}
 | 
			
		||||
+
 | 
			
		||||
+			/* DEV_PATH_VLAN and DEV_PATH_PPPOE */
 | 
			
		||||
+			if (info->num_encaps >= NF_FLOW_TABLE_ENCAP_MAX) {
 | 
			
		||||
+				info->indev = NULL;
 | 
			
		||||
+				break;
 | 
			
		||||
+			}
 | 
			
		||||
+			if (!info->outdev)
 | 
			
		||||
+				info->outdev = path->dev;
 | 
			
		||||
+			info->encap[info->num_encaps].id = path->encap.id;
 | 
			
		||||
+			info->encap[info->num_encaps].proto = path->encap.proto;
 | 
			
		||||
+			info->num_encaps++;
 | 
			
		||||
+			if (path->type == DEV_PATH_PPPOE)
 | 
			
		||||
+				memcpy(info->h_dest, path->encap.h_dest, ETH_ALEN);
 | 
			
		||||
+			break;
 | 
			
		||||
+		case DEV_PATH_BRIDGE:
 | 
			
		||||
+			if (is_zero_ether_addr(info->h_source))
 | 
			
		||||
+				memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN);
 | 
			
		||||
+
 | 
			
		||||
+			switch (path->bridge.vlan_mode) {
 | 
			
		||||
+			case DEV_PATH_BR_VLAN_UNTAG_HW:
 | 
			
		||||
+				info->ingress_vlans |= BIT(info->num_encaps - 1);
 | 
			
		||||
+				break;
 | 
			
		||||
+			case DEV_PATH_BR_VLAN_TAG:
 | 
			
		||||
+				info->encap[info->num_encaps].id = path->bridge.vlan_id;
 | 
			
		||||
+				info->encap[info->num_encaps].proto = path->bridge.vlan_proto;
 | 
			
		||||
+				info->num_encaps++;
 | 
			
		||||
+				break;
 | 
			
		||||
+			case DEV_PATH_BR_VLAN_UNTAG:
 | 
			
		||||
+				info->num_encaps--;
 | 
			
		||||
+				break;
 | 
			
		||||
+			case DEV_PATH_BR_VLAN_KEEP:
 | 
			
		||||
+				break;
 | 
			
		||||
+			}
 | 
			
		||||
+			break;
 | 
			
		||||
+		default:
 | 
			
		||||
+			info->indev = NULL;
 | 
			
		||||
+			break;
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
+	if (!info->outdev)
 | 
			
		||||
+		info->outdev = info->indev;
 | 
			
		||||
+
 | 
			
		||||
+	info->hw_outdev = info->indev;
 | 
			
		||||
+
 | 
			
		||||
+	if (nf_is_valid_ether_device(info->indev))
 | 
			
		||||
+		info->xmit_type = FLOW_OFFLOAD_XMIT_DIRECT;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int nf_dev_fill_forward_path(const struct nf_flow_route *route,
 | 
			
		||||
+				     const struct dst_entry *dst_cache,
 | 
			
		||||
+				     const struct nf_conn *ct,
 | 
			
		||||
+				     enum ip_conntrack_dir dir, u8 *ha,
 | 
			
		||||
+				     struct net_device_path_stack *stack)
 | 
			
		||||
+{
 | 
			
		||||
+	const void *daddr = &ct->tuplehash[!dir].tuple.src.u3;
 | 
			
		||||
+	struct net_device *dev = dst_cache->dev;
 | 
			
		||||
+	struct neighbour *n;
 | 
			
		||||
+	u8 nud_state;
 | 
			
		||||
+
 | 
			
		||||
+	if (!nf_is_valid_ether_device(dev))
 | 
			
		||||
+		goto out;
 | 
			
		||||
+
 | 
			
		||||
+	n = dst_neigh_lookup(dst_cache, daddr);
 | 
			
		||||
+	if (!n)
 | 
			
		||||
+		return -1;
 | 
			
		||||
+
 | 
			
		||||
+	read_lock_bh(&n->lock);
 | 
			
		||||
+	nud_state = n->nud_state;
 | 
			
		||||
+	ether_addr_copy(ha, n->ha);
 | 
			
		||||
+	read_unlock_bh(&n->lock);
 | 
			
		||||
+	neigh_release(n);
 | 
			
		||||
+
 | 
			
		||||
+	if (!(nud_state & NUD_VALID))
 | 
			
		||||
+		return -1;
 | 
			
		||||
+
 | 
			
		||||
+out:
 | 
			
		||||
+	return dev_fill_forward_path(dev, ha, stack);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void nf_dev_forward_path(struct nf_flow_route *route,
 | 
			
		||||
+				const struct nf_conn *ct,
 | 
			
		||||
+				enum ip_conntrack_dir dir,
 | 
			
		||||
+				struct net_device **devs)
 | 
			
		||||
+{
 | 
			
		||||
+	const struct dst_entry *dst = route->tuple[dir].dst;
 | 
			
		||||
+	struct net_device_path_stack stack;
 | 
			
		||||
+	struct nf_forward_info info = {};
 | 
			
		||||
+	unsigned char ha[ETH_ALEN];
 | 
			
		||||
+	int i;
 | 
			
		||||
+
 | 
			
		||||
+	if (nf_dev_fill_forward_path(route, dst, ct, dir, ha, &stack) >= 0)
 | 
			
		||||
+		nf_dev_path_info(&stack, &info, ha);
 | 
			
		||||
+
 | 
			
		||||
+	devs[!dir] = (struct net_device *)info.indev;
 | 
			
		||||
+	if (!info.indev)
 | 
			
		||||
+		return;
 | 
			
		||||
+
 | 
			
		||||
+	route->tuple[!dir].in.ifindex = info.indev->ifindex;
 | 
			
		||||
+	for (i = 0; i < info.num_encaps; i++) {
 | 
			
		||||
+		route->tuple[!dir].in.encap[i].id = info.encap[i].id;
 | 
			
		||||
+		route->tuple[!dir].in.encap[i].proto = info.encap[i].proto;
 | 
			
		||||
+	}
 | 
			
		||||
+	route->tuple[!dir].in.num_encaps = info.num_encaps;
 | 
			
		||||
+	route->tuple[!dir].in.ingress_vlans = info.ingress_vlans;
 | 
			
		||||
+
 | 
			
		||||
+	if (info.xmit_type == FLOW_OFFLOAD_XMIT_DIRECT) {
 | 
			
		||||
+		memcpy(route->tuple[dir].out.h_source, info.h_source, ETH_ALEN);
 | 
			
		||||
+		memcpy(route->tuple[dir].out.h_dest, info.h_dest, ETH_ALEN);
 | 
			
		||||
+		route->tuple[dir].out.ifindex = info.outdev->ifindex;
 | 
			
		||||
+		route->tuple[dir].out.hw_ifindex = info.hw_outdev->ifindex;
 | 
			
		||||
+		route->tuple[dir].xmit_type = info.xmit_type;
 | 
			
		||||
+	}
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int
 | 
			
		||||
+xt_flowoffload_route(struct sk_buff *skb, const struct nf_conn *ct,
 | 
			
		||||
+		     const struct xt_action_param *par,
 | 
			
		||||
+		     struct nf_flow_route *route, enum ip_conntrack_dir dir,
 | 
			
		||||
+		     struct net_device **devs)
 | 
			
		||||
+{
 | 
			
		||||
+	struct dst_entry *this_dst = skb_dst(skb);
 | 
			
		||||
+	struct dst_entry *other_dst = NULL;
 | 
			
		||||
+	struct flowi fl;
 | 
			
		||||
+
 | 
			
		||||
+	memset(&fl, 0, sizeof(fl));
 | 
			
		||||
+	switch (xt_family(par)) {
 | 
			
		||||
+	case NFPROTO_IPV4:
 | 
			
		||||
+		fl.u.ip4.daddr = ct->tuplehash[dir].tuple.src.u3.ip;
 | 
			
		||||
+		fl.u.ip4.flowi4_oif = xt_in(par)->ifindex;
 | 
			
		||||
+		break;
 | 
			
		||||
+	case NFPROTO_IPV6:
 | 
			
		||||
+		fl.u.ip6.saddr = ct->tuplehash[!dir].tuple.dst.u3.in6;
 | 
			
		||||
+		fl.u.ip6.daddr = ct->tuplehash[dir].tuple.src.u3.in6;
 | 
			
		||||
+		fl.u.ip6.flowi6_oif = xt_in(par)->ifindex;
 | 
			
		||||
+		break;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	if (!dst_hold_safe(this_dst))
 | 
			
		||||
+		return -ENOENT;
 | 
			
		||||
+
 | 
			
		||||
+	nf_route(xt_net(par), &other_dst, &fl, false, xt_family(par));
 | 
			
		||||
+	if (!other_dst) {
 | 
			
		||||
+		dst_release(this_dst);
 | 
			
		||||
+		return -ENOENT;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	nf_default_forward_path(route, this_dst, dir, devs);
 | 
			
		||||
+	nf_default_forward_path(route, other_dst, !dir, devs);
 | 
			
		||||
+
 | 
			
		||||
+	if (route->tuple[dir].xmit_type	== FLOW_OFFLOAD_XMIT_NEIGH &&
 | 
			
		||||
+	    route->tuple[!dir].xmit_type == FLOW_OFFLOAD_XMIT_NEIGH) {
 | 
			
		||||
+		nf_dev_forward_path(route, ct, dir, devs);
 | 
			
		||||
+		nf_dev_forward_path(route, ct, !dir, devs);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static unsigned int
 | 
			
		||||
+flowoffload_tg(struct sk_buff *skb, const struct xt_action_param *par)
 | 
			
		||||
+{
 | 
			
		||||
+	struct xt_flowoffload_table *table;
 | 
			
		||||
+	const struct xt_flowoffload_target_info *info = par->targinfo;
 | 
			
		||||
+	struct tcphdr _tcph, *tcph = NULL;
 | 
			
		||||
+	enum ip_conntrack_info ctinfo;
 | 
			
		||||
+	enum ip_conntrack_dir dir;
 | 
			
		||||
+	struct nf_flow_route route = {};
 | 
			
		||||
+	struct flow_offload *flow = NULL;
 | 
			
		||||
+	struct net_device *devs[2] = {};
 | 
			
		||||
+	struct nf_conn *ct;
 | 
			
		||||
+	struct net *net;
 | 
			
		||||
+
 | 
			
		||||
+	if (xt_flowoffload_skip(skb, xt_family(par)))
 | 
			
		||||
+		return XT_CONTINUE;
 | 
			
		||||
+
 | 
			
		||||
+	ct = nf_ct_get(skb, &ctinfo);
 | 
			
		||||
+	if (ct == NULL)
 | 
			
		||||
+		return XT_CONTINUE;
 | 
			
		||||
+
 | 
			
		||||
+	switch (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum) {
 | 
			
		||||
+	case IPPROTO_TCP:
 | 
			
		||||
+		if (ct->proto.tcp.state != TCP_CONNTRACK_ESTABLISHED)
 | 
			
		||||
+			return XT_CONTINUE;
 | 
			
		||||
+
 | 
			
		||||
+		tcph = skb_header_pointer(skb, par->thoff,
 | 
			
		||||
+					  sizeof(_tcph), &_tcph);
 | 
			
		||||
+		if (unlikely(!tcph || tcph->fin || tcph->rst))
 | 
			
		||||
+			return XT_CONTINUE;
 | 
			
		||||
+		break;
 | 
			
		||||
+	case IPPROTO_UDP:
 | 
			
		||||
+		break;
 | 
			
		||||
+	default:
 | 
			
		||||
+		return XT_CONTINUE;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	if (nf_ct_ext_exist(ct, NF_CT_EXT_HELPER) ||
 | 
			
		||||
+	    ct->status & (IPS_SEQ_ADJUST | IPS_NAT_CLASH))
 | 
			
		||||
+		return XT_CONTINUE;
 | 
			
		||||
+
 | 
			
		||||
+	if (!nf_ct_is_confirmed(ct))
 | 
			
		||||
+		return XT_CONTINUE;
 | 
			
		||||
+
 | 
			
		||||
+	dir = CTINFO2DIR(ctinfo);
 | 
			
		||||
+
 | 
			
		||||
+	devs[dir] = xt_out(par);
 | 
			
		||||
+	devs[!dir] = xt_in(par);
 | 
			
		||||
+
 | 
			
		||||
+	if (!devs[dir] || !devs[!dir])
 | 
			
		||||
+		return XT_CONTINUE;
 | 
			
		||||
+
 | 
			
		||||
+	if (test_and_set_bit(IPS_OFFLOAD_BIT, &ct->status))
 | 
			
		||||
+		return XT_CONTINUE;
 | 
			
		||||
+
 | 
			
		||||
+	if (xt_flowoffload_route(skb, ct, par, &route, dir, devs) < 0)
 | 
			
		||||
+		goto err_flow_route;
 | 
			
		||||
+
 | 
			
		||||
+	flow = flow_offload_alloc(ct);
 | 
			
		||||
+	if (!flow)
 | 
			
		||||
+		goto err_flow_alloc;
 | 
			
		||||
+
 | 
			
		||||
+	flow_offload_route_init(flow, &route);
 | 
			
		||||
+
 | 
			
		||||
+	if (tcph) {
 | 
			
		||||
+		ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
 | 
			
		||||
+		ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	table = &flowtable[!!(info->flags & XT_FLOWOFFLOAD_HW)];
 | 
			
		||||
+
 | 
			
		||||
+	net = read_pnet(&table->ft.net);
 | 
			
		||||
+	if (!net)
 | 
			
		||||
+		write_pnet(&table->ft.net, xt_net(par));
 | 
			
		||||
+
 | 
			
		||||
+	__set_bit(NF_FLOW_HW_BIDIRECTIONAL, &flow->flags);
 | 
			
		||||
+	if (flow_offload_add(&table->ft, flow) < 0)
 | 
			
		||||
+		goto err_flow_add;
 | 
			
		||||
+
 | 
			
		||||
+	xt_flowoffload_check_device(table, devs[0]);
 | 
			
		||||
+	xt_flowoffload_check_device(table, devs[1]);
 | 
			
		||||
+
 | 
			
		||||
+	return XT_CONTINUE;
 | 
			
		||||
+
 | 
			
		||||
+err_flow_add:
 | 
			
		||||
+	flow_offload_free(flow);
 | 
			
		||||
+err_flow_alloc:
 | 
			
		||||
+	dst_release(route.tuple[dir].dst);
 | 
			
		||||
+	dst_release(route.tuple[!dir].dst);
 | 
			
		||||
+err_flow_route:
 | 
			
		||||
+	clear_bit(IPS_OFFLOAD_BIT, &ct->status);
 | 
			
		||||
+
 | 
			
		||||
+	return XT_CONTINUE;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int flowoffload_chk(const struct xt_tgchk_param *par)
 | 
			
		||||
+{
 | 
			
		||||
+	struct xt_flowoffload_target_info *info = par->targinfo;
 | 
			
		||||
+
 | 
			
		||||
+	if (info->flags & ~XT_FLOWOFFLOAD_MASK)
 | 
			
		||||
+		return -EINVAL;
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static struct xt_target offload_tg_reg __read_mostly = {
 | 
			
		||||
+	.family		= NFPROTO_UNSPEC,
 | 
			
		||||
+	.name		= "FLOWOFFLOAD",
 | 
			
		||||
+	.revision	= 0,
 | 
			
		||||
+	.targetsize	= sizeof(struct xt_flowoffload_target_info),
 | 
			
		||||
+	.usersize	= sizeof(struct xt_flowoffload_target_info),
 | 
			
		||||
+	.checkentry	= flowoffload_chk,
 | 
			
		||||
+	.target		= flowoffload_tg,
 | 
			
		||||
+	.me		= THIS_MODULE,
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+static int flow_offload_netdev_event(struct notifier_block *this,
 | 
			
		||||
+				     unsigned long event, void *ptr)
 | 
			
		||||
+{
 | 
			
		||||
+	struct xt_flowoffload_hook *hook0, *hook1;
 | 
			
		||||
+	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 | 
			
		||||
+
 | 
			
		||||
+	if (event != NETDEV_UNREGISTER)
 | 
			
		||||
+		return NOTIFY_DONE;
 | 
			
		||||
+
 | 
			
		||||
+	spin_lock_bh(&hooks_lock);
 | 
			
		||||
+	hook0 = flow_offload_lookup_hook(&flowtable[0], dev);
 | 
			
		||||
+	if (hook0)
 | 
			
		||||
+		hlist_del(&hook0->list);
 | 
			
		||||
+
 | 
			
		||||
+	hook1 = flow_offload_lookup_hook(&flowtable[1], dev);
 | 
			
		||||
+	if (hook1)
 | 
			
		||||
+		hlist_del(&hook1->list);
 | 
			
		||||
+	spin_unlock_bh(&hooks_lock);
 | 
			
		||||
+
 | 
			
		||||
+	if (hook0) {
 | 
			
		||||
+		nf_unregister_net_hook(hook0->net, &hook0->ops);
 | 
			
		||||
+		kfree(hook0);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	if (hook1) {
 | 
			
		||||
+		nf_unregister_net_hook(hook1->net, &hook1->ops);
 | 
			
		||||
+		kfree(hook1);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	nf_flow_table_cleanup(dev);
 | 
			
		||||
+
 | 
			
		||||
+	return NOTIFY_DONE;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static struct notifier_block flow_offload_netdev_notifier = {
 | 
			
		||||
+	.notifier_call	= flow_offload_netdev_event,
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+static int nf_flow_rule_route_inet(struct net *net,
 | 
			
		||||
+				   struct flow_offload *flow,
 | 
			
		||||
+				   enum flow_offload_tuple_dir dir,
 | 
			
		||||
+				   struct nf_flow_rule *flow_rule)
 | 
			
		||||
+{
 | 
			
		||||
+	const struct flow_offload_tuple *flow_tuple = &flow->tuplehash[dir].tuple;
 | 
			
		||||
+	int err;
 | 
			
		||||
+
 | 
			
		||||
+	switch (flow_tuple->l3proto) {
 | 
			
		||||
+	case NFPROTO_IPV4:
 | 
			
		||||
+		err = nf_flow_rule_route_ipv4(net, flow, dir, flow_rule);
 | 
			
		||||
+		break;
 | 
			
		||||
+	case NFPROTO_IPV6:
 | 
			
		||||
+		err = nf_flow_rule_route_ipv6(net, flow, dir, flow_rule);
 | 
			
		||||
+		break;
 | 
			
		||||
+	default:
 | 
			
		||||
+		err = -1;
 | 
			
		||||
+		break;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return err;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static struct nf_flowtable_type flowtable_inet = {
 | 
			
		||||
+	.family		= NFPROTO_INET,
 | 
			
		||||
+	.init		= nf_flow_table_init,
 | 
			
		||||
+	.setup		= nf_flow_table_offload_setup,
 | 
			
		||||
+	.action		= nf_flow_rule_route_inet,
 | 
			
		||||
+	.free		= nf_flow_table_free,
 | 
			
		||||
+	.hook		= xt_flowoffload_net_hook,
 | 
			
		||||
+	.owner		= THIS_MODULE,
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+static int init_flowtable(struct xt_flowoffload_table *tbl)
 | 
			
		||||
+{
 | 
			
		||||
+	INIT_DELAYED_WORK(&tbl->work, xt_flowoffload_hook_work);
 | 
			
		||||
+	tbl->ft.type = &flowtable_inet;
 | 
			
		||||
+	tbl->ft.flags = NF_FLOWTABLE_COUNTER;
 | 
			
		||||
+
 | 
			
		||||
+	return nf_flow_table_init(&tbl->ft);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int __init xt_flowoffload_tg_init(void)
 | 
			
		||||
+{
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	register_netdevice_notifier(&flow_offload_netdev_notifier);
 | 
			
		||||
+
 | 
			
		||||
+	ret = init_flowtable(&flowtable[0]);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	ret = init_flowtable(&flowtable[1]);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		goto cleanup;
 | 
			
		||||
+
 | 
			
		||||
+	flowtable[1].ft.flags |= NF_FLOWTABLE_HW_OFFLOAD;
 | 
			
		||||
+
 | 
			
		||||
+	ret = xt_register_target(&offload_tg_reg);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		goto cleanup2;
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+
 | 
			
		||||
+cleanup2:
 | 
			
		||||
+	nf_flow_table_free(&flowtable[1].ft);
 | 
			
		||||
+cleanup:
 | 
			
		||||
+	nf_flow_table_free(&flowtable[0].ft);
 | 
			
		||||
+	return ret;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void __exit xt_flowoffload_tg_exit(void)
 | 
			
		||||
+{
 | 
			
		||||
+	xt_unregister_target(&offload_tg_reg);
 | 
			
		||||
+	unregister_netdevice_notifier(&flow_offload_netdev_notifier);
 | 
			
		||||
+	nf_flow_table_free(&flowtable[0].ft);
 | 
			
		||||
+	nf_flow_table_free(&flowtable[1].ft);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+MODULE_LICENSE("GPL");
 | 
			
		||||
+module_init(xt_flowoffload_tg_init);
 | 
			
		||||
+module_exit(xt_flowoffload_tg_exit);
 | 
			
		||||
--- a/net/netfilter/nf_flow_table_core.c
 | 
			
		||||
+++ b/net/netfilter/nf_flow_table_core.c
 | 
			
		||||
@@ -7,7 +7,6 @@
 | 
			
		||||
 #include <linux/netdevice.h>
 | 
			
		||||
 #include <net/ip.h>
 | 
			
		||||
 #include <net/ip6_route.h>
 | 
			
		||||
-#include <net/netfilter/nf_tables.h>
 | 
			
		||||
 #include <net/netfilter/nf_flow_table.h>
 | 
			
		||||
 #include <net/netfilter/nf_conntrack.h>
 | 
			
		||||
 #include <net/netfilter/nf_conntrack_core.h>
 | 
			
		||||
@@ -377,8 +376,7 @@ flow_offload_lookup(struct nf_flowtable
 | 
			
		||||
 }
 | 
			
		||||
 EXPORT_SYMBOL_GPL(flow_offload_lookup);
 | 
			
		||||
 
 | 
			
		||||
-static int
 | 
			
		||||
-nf_flow_table_iterate(struct nf_flowtable *flow_table,
 | 
			
		||||
+int nf_flow_table_iterate(struct nf_flowtable *flow_table,
 | 
			
		||||
 		      void (*iter)(struct nf_flowtable *flowtable,
 | 
			
		||||
 				   struct flow_offload *flow, void *data),
 | 
			
		||||
 		      void *data)
 | 
			
		||||
@@ -439,6 +437,7 @@ static void nf_flow_offload_gc_step(stru
 | 
			
		||||
 		nf_flow_offload_stats(flow_table, flow);
 | 
			
		||||
 	}
 | 
			
		||||
 }
 | 
			
		||||
+EXPORT_SYMBOL_GPL(nf_flow_table_iterate);
 | 
			
		||||
 
 | 
			
		||||
 void nf_flow_table_gc_run(struct nf_flowtable *flow_table)
 | 
			
		||||
 {
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/include/uapi/linux/netfilter/xt_FLOWOFFLOAD.h
 | 
			
		||||
@@ -0,0 +1,17 @@
 | 
			
		||||
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 | 
			
		||||
+#ifndef _XT_FLOWOFFLOAD_H
 | 
			
		||||
+#define _XT_FLOWOFFLOAD_H
 | 
			
		||||
+
 | 
			
		||||
+#include <linux/types.h>
 | 
			
		||||
+
 | 
			
		||||
+enum {
 | 
			
		||||
+	XT_FLOWOFFLOAD_HW	= 1 << 0,
 | 
			
		||||
+
 | 
			
		||||
+	XT_FLOWOFFLOAD_MASK	= XT_FLOWOFFLOAD_HW
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+struct xt_flowoffload_target_info {
 | 
			
		||||
+	__u32 flags;
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+#endif /* _XT_FLOWOFFLOAD_H */
 | 
			
		||||
--- a/include/net/netfilter/nf_flow_table.h
 | 
			
		||||
+++ b/include/net/netfilter/nf_flow_table.h
 | 
			
		||||
@@ -293,6 +293,11 @@ void nf_flow_table_free(struct nf_flowta
 | 
			
		||||
 
 | 
			
		||||
 void flow_offload_teardown(struct flow_offload *flow);
 | 
			
		||||
 
 | 
			
		||||
+int nf_flow_table_iterate(struct nf_flowtable *flow_table,
 | 
			
		||||
+                      void (*iter)(struct nf_flowtable *flowtable,
 | 
			
		||||
+                                   struct flow_offload *flow, void *data),
 | 
			
		||||
+                      void *data);
 | 
			
		||||
+
 | 
			
		||||
 void nf_flow_snat_port(const struct flow_offload *flow,
 | 
			
		||||
 		       struct sk_buff *skb, unsigned int thoff,
 | 
			
		||||
 		       u8 protocol, enum flow_offload_tuple_dir dir);
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
From 6d3bc769657b0ee7c7506dad9911111c4226a7ea Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Imre Kaloz <kaloz@openwrt.org>
 | 
			
		||||
Date: Fri, 7 Jul 2017 17:21:05 +0200
 | 
			
		||||
Subject: mac80211: increase wireless mesh header size
 | 
			
		||||
 | 
			
		||||
lede-commit 3d4466cfd8f75f717efdb1f96fdde3c70d865fc1
 | 
			
		||||
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
 | 
			
		||||
---
 | 
			
		||||
 include/linux/netdevice.h | 4 ++--
 | 
			
		||||
 1 file changed, 2 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/include/linux/netdevice.h
 | 
			
		||||
+++ b/include/linux/netdevice.h
 | 
			
		||||
@@ -157,8 +157,8 @@ static inline bool dev_xmit_complete(int
 | 
			
		||||
 
 | 
			
		||||
 #if defined(CONFIG_HYPERV_NET)
 | 
			
		||||
 # define LL_MAX_HEADER 128
 | 
			
		||||
-#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
 | 
			
		||||
-# if defined(CONFIG_MAC80211_MESH)
 | 
			
		||||
+#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) || 1
 | 
			
		||||
+# if defined(CONFIG_MAC80211_MESH) || 1
 | 
			
		||||
 #  define LL_MAX_HEADER 128
 | 
			
		||||
 # else
 | 
			
		||||
 #  define LL_MAX_HEADER 96
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
From a6ccb238939b25851474a279b20367fd24a0e816 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Fri, 7 Jul 2017 17:21:53 +0200
 | 
			
		||||
Subject:  hack: net: fq_codel: tune defaults for small devices
 | 
			
		||||
 | 
			
		||||
Assume that x86_64 devices always have a big memory and do not need this 
 | 
			
		||||
optimization compared to devices with only 32 MB or 64 MB RAM.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 net/sched/sch_fq_codel.c | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/net/sched/sch_fq_codel.c
 | 
			
		||||
+++ b/net/sched/sch_fq_codel.c
 | 
			
		||||
@@ -471,7 +471,11 @@ static int fq_codel_init(struct Qdisc *s
 | 
			
		||||
 
 | 
			
		||||
 	sch->limit = 10*1024;
 | 
			
		||||
 	q->flows_cnt = 1024;
 | 
			
		||||
+#ifdef CONFIG_X86_64
 | 
			
		||||
 	q->memory_limit = 32 << 20; /* 32 MBytes */
 | 
			
		||||
+#else
 | 
			
		||||
+	q->memory_limit = 4 << 20; /* 4 MBytes */
 | 
			
		||||
+#endif
 | 
			
		||||
 	q->drop_batch_size = 64;
 | 
			
		||||
 	q->quantum = psched_mtu(qdisc_dev(sch));
 | 
			
		||||
 	INIT_LIST_HEAD(&q->new_flows);
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
From 804fbb3f2ec9283f7b778e057a68bfff440a0be6 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Rui Salvaterra <rsalvaterra@gmail.com>
 | 
			
		||||
Date: Wed, 30 Mar 2022 22:51:55 +0100
 | 
			
		||||
Subject: [PATCH] kernel: ct: size the hashtable more adequately
 | 
			
		||||
 | 
			
		||||
To set the default size of the connection tracking hash table, a divider of
 | 
			
		||||
16384 becomes inadequate for a router handling lots of connections. Divide by
 | 
			
		||||
2048 instead, making the default size scale better with the available RAM.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
 net/netfilter/nf_conntrack_core.c | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/net/netfilter/nf_conntrack_core.c
 | 
			
		||||
+++ b/net/netfilter/nf_conntrack_core.c
 | 
			
		||||
@@ -2682,7 +2682,7 @@ int nf_conntrack_init_start(void)
 | 
			
		||||
 
 | 
			
		||||
 	if (!nf_conntrack_htable_size) {
 | 
			
		||||
 		nf_conntrack_htable_size
 | 
			
		||||
-			= (((nr_pages << PAGE_SHIFT) / 16384)
 | 
			
		||||
+			= (((nr_pages << PAGE_SHIFT) / 2048)
 | 
			
		||||
 			   / sizeof(struct hlist_head));
 | 
			
		||||
 		if (BITS_PER_LONG >= 64 &&
 | 
			
		||||
 		    nr_pages > (4 * (1024 * 1024 * 1024 / PAGE_SIZE)))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
From ebd924d773223593142d417c41d4ee6fa16f1805 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
 | 
			
		||||
Date: Wed, 13 Jul 2022 13:45:56 +0200
 | 
			
		||||
Subject: [PATCH] net/dsa/mv88e6xxx: disable ATU violation
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 drivers/net/dsa/mv88e6xxx/chip.c | 3 +++
 | 
			
		||||
 1 file changed, 3 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/net/dsa/mv88e6xxx/chip.c
 | 
			
		||||
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
 | 
			
		||||
@@ -3375,6 +3375,9 @@ static int mv88e6xxx_setup_port(struct m
 | 
			
		||||
 	else
 | 
			
		||||
 		reg = 1 << port;
 | 
			
		||||
 
 | 
			
		||||
+	/* Disable ATU member violation interrupt */
 | 
			
		||||
+	reg |= MV88E6XXX_PORT_ASSOC_VECTOR_IGNORE_WRONG;
 | 
			
		||||
+
 | 
			
		||||
 	err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_ASSOC_VECTOR,
 | 
			
		||||
 				   reg);
 | 
			
		||||
 	if (err)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,117 @@
 | 
			
		|||
From 5f62951fba63a9f9cfff564209426bdea5fcc371 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Alex Marginean <alexandru.marginean@nxp.com>
 | 
			
		||||
Date: Tue, 27 Aug 2019 15:16:56 +0300
 | 
			
		||||
Subject: [PATCH] drivers: net: phy: aquantia: enable AQR112 and AQR412
 | 
			
		||||
 | 
			
		||||
Adds support for AQR112 and AQR412 which is mostly based on existing code
 | 
			
		||||
with the addition of code configuring the protocol on system side.
 | 
			
		||||
This allows changing the system side protocol without having to deploy a
 | 
			
		||||
different firmware on the PHY.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
 | 
			
		||||
---
 | 
			
		||||
 drivers/net/phy/aquantia/aquantia_main.c | 88 +++++++++++++++++++++++++++++++++++++++++
 | 
			
		||||
 1 file changed, 88 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/net/phy/aquantia/aquantia_main.c
 | 
			
		||||
+++ b/drivers/net/phy/aquantia/aquantia_main.c
 | 
			
		||||
@@ -127,6 +127,29 @@ struct aqr107_priv {
 | 
			
		||||
 	u64 sgmii_stats[AQR107_SGMII_STAT_SZ];
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+/* registers in MDIO_MMD_VEND1 region */
 | 
			
		||||
+#define AQUANTIA_VND1_GLOBAL_SC			0x000
 | 
			
		||||
+#define  AQUANTIA_VND1_GLOBAL_SC_LP		BIT(0xb)
 | 
			
		||||
+
 | 
			
		||||
+/* global start rate, the protocol associated with this speed is used by default
 | 
			
		||||
+ * on SI.
 | 
			
		||||
+ */
 | 
			
		||||
+#define AQUANTIA_VND1_GSTART_RATE		0x31a
 | 
			
		||||
+#define  AQUANTIA_VND1_GSTART_RATE_OFF		0
 | 
			
		||||
+#define  AQUANTIA_VND1_GSTART_RATE_100M		1
 | 
			
		||||
+#define  AQUANTIA_VND1_GSTART_RATE_1G		2
 | 
			
		||||
+#define  AQUANTIA_VND1_GSTART_RATE_10G		3
 | 
			
		||||
+#define  AQUANTIA_VND1_GSTART_RATE_2_5G		4
 | 
			
		||||
+#define  AQUANTIA_VND1_GSTART_RATE_5G		5
 | 
			
		||||
+
 | 
			
		||||
+/* SYSCFG registers for 100M, 1G, 2.5G, 5G, 10G */
 | 
			
		||||
+#define AQUANTIA_VND1_GSYSCFG_BASE		0x31b
 | 
			
		||||
+#define AQUANTIA_VND1_GSYSCFG_100M		0
 | 
			
		||||
+#define AQUANTIA_VND1_GSYSCFG_1G		1
 | 
			
		||||
+#define AQUANTIA_VND1_GSYSCFG_2_5G		2
 | 
			
		||||
+#define AQUANTIA_VND1_GSYSCFG_5G		3
 | 
			
		||||
+#define AQUANTIA_VND1_GSYSCFG_10G		4
 | 
			
		||||
+
 | 
			
		||||
 static int aqr107_get_sset_count(struct phy_device *phydev)
 | 
			
		||||
 {
 | 
			
		||||
 	return AQR107_SGMII_STAT_SZ;
 | 
			
		||||
@@ -233,6 +256,51 @@ static int aqr_config_aneg(struct phy_de
 | 
			
		||||
 	return genphy_c45_check_and_restart_aneg(phydev, changed);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static struct {
 | 
			
		||||
+	u16 syscfg;
 | 
			
		||||
+	int cnt;
 | 
			
		||||
+	u16 start_rate;
 | 
			
		||||
+} aquantia_syscfg[PHY_INTERFACE_MODE_MAX] = {
 | 
			
		||||
+	[PHY_INTERFACE_MODE_SGMII] =      {0x04b, AQUANTIA_VND1_GSYSCFG_1G,
 | 
			
		||||
+					   AQUANTIA_VND1_GSTART_RATE_1G},
 | 
			
		||||
+	[PHY_INTERFACE_MODE_2500BASEX] = {0x144, AQUANTIA_VND1_GSYSCFG_2_5G,
 | 
			
		||||
+					   AQUANTIA_VND1_GSTART_RATE_2_5G},
 | 
			
		||||
+	[PHY_INTERFACE_MODE_XGMII] =      {0x100, AQUANTIA_VND1_GSYSCFG_10G,
 | 
			
		||||
+					   AQUANTIA_VND1_GSTART_RATE_10G},
 | 
			
		||||
+	[PHY_INTERFACE_MODE_USXGMII] =    {0x080, AQUANTIA_VND1_GSYSCFG_10G,
 | 
			
		||||
+					   AQUANTIA_VND1_GSTART_RATE_10G},
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+/* Sets up protocol on system side before calling aqr_config_aneg */
 | 
			
		||||
+static int aqr_config_aneg_set_prot(struct phy_device *phydev)
 | 
			
		||||
+{
 | 
			
		||||
+	int if_type = phydev->interface;
 | 
			
		||||
+	int i;
 | 
			
		||||
+
 | 
			
		||||
+	if (!aquantia_syscfg[if_type].cnt)
 | 
			
		||||
+		return 0;
 | 
			
		||||
+
 | 
			
		||||
+	/* set PHY in low power mode so we can configure protocols */
 | 
			
		||||
+	phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GLOBAL_SC,
 | 
			
		||||
+		      AQUANTIA_VND1_GLOBAL_SC_LP);
 | 
			
		||||
+	mdelay(10);
 | 
			
		||||
+
 | 
			
		||||
+	/* set the default rate to enable the SI link */
 | 
			
		||||
+	phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GSTART_RATE,
 | 
			
		||||
+		      aquantia_syscfg[if_type].start_rate);
 | 
			
		||||
+
 | 
			
		||||
+	for (i = 0; i <= aquantia_syscfg[if_type].cnt; i++)
 | 
			
		||||
+		phy_write_mmd(phydev, MDIO_MMD_VEND1,
 | 
			
		||||
+			      AQUANTIA_VND1_GSYSCFG_BASE + i,
 | 
			
		||||
+			      aquantia_syscfg[if_type].syscfg);
 | 
			
		||||
+
 | 
			
		||||
+	/* wake PHY back up */
 | 
			
		||||
+	phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GLOBAL_SC, 0);
 | 
			
		||||
+	mdelay(10);
 | 
			
		||||
+
 | 
			
		||||
+	return aqr_config_aneg(phydev);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static int aqr_config_intr(struct phy_device *phydev)
 | 
			
		||||
 {
 | 
			
		||||
 	bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED;
 | 
			
		||||
@@ -838,7 +906,7 @@ static struct phy_driver aqr_driver[] =
 | 
			
		||||
 	PHY_ID_MATCH_MODEL(PHY_ID_AQR112),
 | 
			
		||||
 	.name		= "Aquantia AQR112",
 | 
			
		||||
 	.probe		= aqr107_probe,
 | 
			
		||||
-	.config_aneg    = aqr_config_aneg,
 | 
			
		||||
+	.config_aneg    = aqr_config_aneg_set_prot,
 | 
			
		||||
 	.config_intr	= aqr_config_intr,
 | 
			
		||||
 	.handle_interrupt = aqr_handle_interrupt,
 | 
			
		||||
 	.get_tunable    = aqr107_get_tunable,
 | 
			
		||||
@@ -863,7 +931,7 @@ static struct phy_driver aqr_driver[] =
 | 
			
		||||
 	PHY_ID_MATCH_MODEL(PHY_ID_AQR412),
 | 
			
		||||
 	.name		= "Aquantia AQR412",
 | 
			
		||||
 	.probe		= aqr107_probe,
 | 
			
		||||
-	.config_aneg    = aqr_config_aneg,
 | 
			
		||||
+	.config_aneg    = aqr_config_aneg_set_prot,
 | 
			
		||||
 	.config_intr	= aqr_config_intr,
 | 
			
		||||
 	.handle_interrupt = aqr_handle_interrupt,
 | 
			
		||||
 	.get_tunable    = aqr107_get_tunable,
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,34 @@
 | 
			
		|||
From 5f008cb22f60da4e10375f22266c1a4e20b1252e Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Alex Marginean <alexandru.marginean@nxp.com>
 | 
			
		||||
Date: Fri, 20 Sep 2019 18:22:52 +0300
 | 
			
		||||
Subject: [PATCH] drivers: net: phy: aquantia: fix system side protocol
 | 
			
		||||
 misconfiguration
 | 
			
		||||
 | 
			
		||||
Do not set up protocols for speeds that are not supported by FW.  Enabling
 | 
			
		||||
these protocols leads to link issues on system side.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
 | 
			
		||||
---
 | 
			
		||||
 drivers/net/phy/aquantia/aquantia_main.c | 8 +++++++-
 | 
			
		||||
 1 file changed, 7 insertions(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/net/phy/aquantia/aquantia_main.c
 | 
			
		||||
+++ b/drivers/net/phy/aquantia/aquantia_main.c
 | 
			
		||||
@@ -289,10 +289,16 @@ static int aqr_config_aneg_set_prot(stru
 | 
			
		||||
 	phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GSTART_RATE,
 | 
			
		||||
 		      aquantia_syscfg[if_type].start_rate);
 | 
			
		||||
 
 | 
			
		||||
-	for (i = 0; i <= aquantia_syscfg[if_type].cnt; i++)
 | 
			
		||||
+	for (i = 0; i <= aquantia_syscfg[if_type].cnt; i++) {
 | 
			
		||||
+		u16 reg = phy_read_mmd(phydev, MDIO_MMD_VEND1,
 | 
			
		||||
+				       AQUANTIA_VND1_GSYSCFG_BASE + i);
 | 
			
		||||
+		if (!reg)
 | 
			
		||||
+			continue;
 | 
			
		||||
+
 | 
			
		||||
 		phy_write_mmd(phydev, MDIO_MMD_VEND1,
 | 
			
		||||
 			      AQUANTIA_VND1_GSYSCFG_BASE + i,
 | 
			
		||||
 			      aquantia_syscfg[if_type].syscfg);
 | 
			
		||||
+	}
 | 
			
		||||
 
 | 
			
		||||
 	/* wake PHY back up */
 | 
			
		||||
 	phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GLOBAL_SC, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,63 @@
 | 
			
		|||
From 3b92ee7b7899b6beffb2b484c58326e36612a873 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Daniel Golle <daniel@makrotopia.org>
 | 
			
		||||
Date: Thu, 23 Dec 2021 14:52:56 +0000
 | 
			
		||||
Subject: [PATCH] net: phy: aquantia: add PHY_ID for AQR112R
 | 
			
		||||
 | 
			
		||||
As advised by Ian Chang this PHY is used in Puzzle devices.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 | 
			
		||||
---
 | 
			
		||||
 drivers/net/phy/aquantia/aquantia_main.c | 10 ++++++++++
 | 
			
		||||
 1 file changed, 10 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/net/phy/aquantia/aquantia_main.c
 | 
			
		||||
+++ b/drivers/net/phy/aquantia/aquantia_main.c
 | 
			
		||||
@@ -30,6 +30,8 @@
 | 
			
		||||
 #define PHY_ID_AQR113C	0x31c31c12
 | 
			
		||||
 #define PHY_ID_AQR114C	0x31c31c22
 | 
			
		||||
 #define PHY_ID_AQR813	0x31c31cb2
 | 
			
		||||
+#define PHY_ID_AQR112C	0x03a1b790
 | 
			
		||||
+#define PHY_ID_AQR112R	0x31c31d12
 | 
			
		||||
 
 | 
			
		||||
 #define MDIO_PHYXS_VEND_IF_STATUS		0xe812
 | 
			
		||||
 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK	GENMASK(7, 3)
 | 
			
		||||
@@ -1062,6 +1064,30 @@ static struct phy_driver aqr_driver[] =
 | 
			
		||||
 	.led_polarity_set = aqr_phy_led_polarity_set,
 | 
			
		||||
 #endif
 | 
			
		||||
 },
 | 
			
		||||
+{
 | 
			
		||||
+	PHY_ID_MATCH_MODEL(PHY_ID_AQR112C),
 | 
			
		||||
+	.name		= "Aquantia AQR112C",
 | 
			
		||||
+	.probe		= aqr107_probe,
 | 
			
		||||
+	.config_aneg	= aqr_config_aneg_set_prot,
 | 
			
		||||
+	.config_intr	= aqr_config_intr,
 | 
			
		||||
+	.handle_interrupt = aqr_handle_interrupt,
 | 
			
		||||
+	.read_status	= aqr107_read_status,
 | 
			
		||||
+	.get_sset_count	= aqr107_get_sset_count,
 | 
			
		||||
+	.get_strings	= aqr107_get_strings,
 | 
			
		||||
+	.get_stats	= aqr107_get_stats,
 | 
			
		||||
+},
 | 
			
		||||
+{
 | 
			
		||||
+	PHY_ID_MATCH_MODEL(PHY_ID_AQR112R),
 | 
			
		||||
+	.name		= "Aquantia AQR112R",
 | 
			
		||||
+	.probe		= aqr107_probe,
 | 
			
		||||
+	.config_aneg	= aqr_config_aneg_set_prot,
 | 
			
		||||
+	.config_intr	= aqr_config_intr,
 | 
			
		||||
+	.handle_interrupt = aqr_handle_interrupt,
 | 
			
		||||
+	.read_status	= aqr107_read_status,
 | 
			
		||||
+	.get_sset_count	= aqr107_get_sset_count,
 | 
			
		||||
+	.get_strings	= aqr107_get_strings,
 | 
			
		||||
+	.get_stats	= aqr107_get_stats,
 | 
			
		||||
+},
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 module_phy_driver(aqr_driver);
 | 
			
		||||
@@ -1082,6 +1108,8 @@ static struct mdio_device_id __maybe_unu
 | 
			
		||||
 	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) },
 | 
			
		||||
 	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) },
 | 
			
		||||
 	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR813) },
 | 
			
		||||
+	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR112C) },
 | 
			
		||||
+	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR112R) },
 | 
			
		||||
 	{ }
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,74 @@
 | 
			
		|||
From 82985725e071f2a5735052f18e109a32aeac3a0b Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: David Bauer <mail@david-bauer.net>
 | 
			
		||||
Date: Sun, 26 Jul 2020 02:38:31 +0200
 | 
			
		||||
Subject: [PATCH] net: usb: r8152: add LED configuration from OF
 | 
			
		||||
 | 
			
		||||
This adds the ability to configure the LED configuration register using
 | 
			
		||||
OF. This way, the correct value for board specific LED configuration can
 | 
			
		||||
be determined.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: David Bauer <mail@david-bauer.net>
 | 
			
		||||
---
 | 
			
		||||
 drivers/net/usb/r8152.c | 23 +++++++++++++++++++++++
 | 
			
		||||
 1 file changed, 23 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/net/usb/r8152.c
 | 
			
		||||
+++ b/drivers/net/usb/r8152.c
 | 
			
		||||
@@ -11,6 +11,7 @@
 | 
			
		||||
 #include <linux/mii.h>
 | 
			
		||||
 #include <linux/ethtool.h>
 | 
			
		||||
 #include <linux/usb.h>
 | 
			
		||||
+#include <linux/of.h>
 | 
			
		||||
 #include <linux/crc32.h>
 | 
			
		||||
 #include <linux/if_vlan.h>
 | 
			
		||||
 #include <linux/uaccess.h>
 | 
			
		||||
@@ -7035,6 +7036,22 @@ static void rtl_tally_reset(struct r8152
 | 
			
		||||
 	ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static int r8152_led_configuration(struct r8152 *tp)
 | 
			
		||||
+{
 | 
			
		||||
+	u32 led_data;
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	ret = of_property_read_u32(tp->udev->dev.of_node, "realtek,led-data",
 | 
			
		||||
+								&led_data);
 | 
			
		||||
+
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	ocp_write_word(tp, MCU_TYPE_PLA, PLA_LEDSEL, led_data);
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static void r8152b_init(struct r8152 *tp)
 | 
			
		||||
 {
 | 
			
		||||
 	u32 ocp_data;
 | 
			
		||||
@@ -7076,6 +7093,8 @@ static void r8152b_init(struct r8152 *tp
 | 
			
		||||
 	ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL);
 | 
			
		||||
 	ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN);
 | 
			
		||||
 	ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
 | 
			
		||||
+
 | 
			
		||||
+	r8152_led_configuration(tp);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static void r8153_init(struct r8152 *tp)
 | 
			
		||||
@@ -7216,6 +7235,8 @@ static void r8153_init(struct r8152 *tp)
 | 
			
		||||
 		tp->coalesce = COALESCE_SLOW;
 | 
			
		||||
 		break;
 | 
			
		||||
 	}
 | 
			
		||||
+
 | 
			
		||||
+	r8152_led_configuration(tp);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static void r8153b_init(struct r8152 *tp)
 | 
			
		||||
@@ -7298,6 +7319,8 @@ static void r8153b_init(struct r8152 *tp
 | 
			
		||||
 	rtl_tally_reset(tp);
 | 
			
		||||
 
 | 
			
		||||
 	tp->coalesce = 15000;	/* 15 us */
 | 
			
		||||
+
 | 
			
		||||
+	r8152_led_configuration(tp);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static void r8153c_init(struct r8152 *tp)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,54 @@
 | 
			
		|||
From 3ee05f4aa64fc86af3be5bc176ba5808de9260a7 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: David Bauer <mail@david-bauer.net>
 | 
			
		||||
Date: Sun, 26 Jul 2020 15:30:33 +0200
 | 
			
		||||
Subject: [PATCH] dt-bindings: net: add RTL8152 binding documentation
 | 
			
		||||
 | 
			
		||||
Add binding documentation for the Realtek RTL8152 / RTL8153 USB ethernet
 | 
			
		||||
adapters.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: David Bauer <mail@david-bauer.net>
 | 
			
		||||
---
 | 
			
		||||
 .../bindings/net/realtek,rtl8152.yaml         | 36 +++++++++++++++++++
 | 
			
		||||
 1 file changed, 36 insertions(+)
 | 
			
		||||
 create mode 100644 Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
 | 
			
		||||
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
 | 
			
		||||
@@ -0,0 +1,36 @@
 | 
			
		||||
+# SPDX-License-Identifier: GPL-2.0
 | 
			
		||||
+%YAML 1.2
 | 
			
		||||
+---
 | 
			
		||||
+$id: http://devicetree.org/schemas/net/realtek,rtl8152.yaml#
 | 
			
		||||
+$schema: http://devicetree.org/meta-schemas/core.yaml#
 | 
			
		||||
+
 | 
			
		||||
+title: Realtek RTL8152/RTL8153 series USB ethernet
 | 
			
		||||
+
 | 
			
		||||
+maintainers:
 | 
			
		||||
+  - David Bauer <mail@david-bauer.net>
 | 
			
		||||
+
 | 
			
		||||
+properties:
 | 
			
		||||
+  compatible:
 | 
			
		||||
+    oneOf:
 | 
			
		||||
+      - items:
 | 
			
		||||
+          - enum:
 | 
			
		||||
+              - realtek,rtl8152
 | 
			
		||||
+              - realtek,rtl8153
 | 
			
		||||
+
 | 
			
		||||
+  reg:
 | 
			
		||||
+    description: The device number on the USB bus
 | 
			
		||||
+
 | 
			
		||||
+  realtek,led-data:
 | 
			
		||||
+    description: Value to be written to the LED configuration register.
 | 
			
		||||
+
 | 
			
		||||
+required:
 | 
			
		||||
+  - compatible
 | 
			
		||||
+  - reg
 | 
			
		||||
+
 | 
			
		||||
+examples:
 | 
			
		||||
+  - |
 | 
			
		||||
+    usb-eth@2 {
 | 
			
		||||
+      compatible = "realtek,rtl8153";
 | 
			
		||||
+      reg = <2>;
 | 
			
		||||
+      realtek,led-data = <0x87>;
 | 
			
		||||
+    };
 | 
			
		||||
\ No newline at end of file
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,72 @@
 | 
			
		|||
From cc225d163b5a4f7a0d1968298bf7927306646a47 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: David Bauer <mail@david-bauer.net>
 | 
			
		||||
Date: Fri, 28 Apr 2023 01:53:01 +0200
 | 
			
		||||
Subject: [PATCH] net: phy: mediatek-ge: add LED configuration interface
 | 
			
		||||
 | 
			
		||||
This adds a small hack similar to the one used for ar8xxx switches to
 | 
			
		||||
read a reg:value map for configuring the LED configuration registers.
 | 
			
		||||
 | 
			
		||||
This allows OpenWrt to write device-specific LED action as well as blink
 | 
			
		||||
configurations. It is unlikely to be accepted upstream, as upstream
 | 
			
		||||
plans on integrating their own framework for handling these LEDs.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: David Bauer <mail@david-bauer.net>
 | 
			
		||||
---
 | 
			
		||||
 drivers/net/phy/mediatek-ge.c | 33 +++++++++++++++++++++++++++++++++
 | 
			
		||||
 1 file changed, 33 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/net/phy/mediatek-ge.c
 | 
			
		||||
+++ b/drivers/net/phy/mediatek-ge.c
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
 // SPDX-License-Identifier: GPL-2.0+
 | 
			
		||||
+#include <linux/of.h>
 | 
			
		||||
 #include <linux/bitfield.h>
 | 
			
		||||
 #include <linux/module.h>
 | 
			
		||||
 #include <linux/phy.h>
 | 
			
		||||
@@ -53,6 +54,36 @@ static int mt7530_phy_config_init(struct
 | 
			
		||||
 	return 0;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static int mt7530_led_config_of(struct phy_device *phydev)
 | 
			
		||||
+{
 | 
			
		||||
+	struct device_node *np = phydev->mdio.dev.of_node;
 | 
			
		||||
+	const __be32 *paddr;
 | 
			
		||||
+	int len;
 | 
			
		||||
+	int i;
 | 
			
		||||
+
 | 
			
		||||
+	paddr = of_get_property(np, "mediatek,led-config", &len);
 | 
			
		||||
+	if (!paddr)
 | 
			
		||||
+		return 0;
 | 
			
		||||
+
 | 
			
		||||
+	if (len < (2 * sizeof(*paddr)))
 | 
			
		||||
+		return -EINVAL;
 | 
			
		||||
+
 | 
			
		||||
+	len /= sizeof(*paddr);
 | 
			
		||||
+
 | 
			
		||||
+	phydev_warn(phydev, "Configure LED registers (num=%d)\n", len);
 | 
			
		||||
+	for (i = 0; i < len - 1; i += 2) {
 | 
			
		||||
+		u32 reg;
 | 
			
		||||
+		u32 val;
 | 
			
		||||
+
 | 
			
		||||
+		reg = be32_to_cpup(paddr + i);
 | 
			
		||||
+		val = be32_to_cpup(paddr + i + 1);
 | 
			
		||||
+
 | 
			
		||||
+		phy_write_mmd(phydev, MDIO_MMD_VEND2, reg, val);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static int mt7531_phy_config_init(struct phy_device *phydev)
 | 
			
		||||
 {
 | 
			
		||||
 	mtk_gephy_config_init(phydev);
 | 
			
		||||
@@ -65,6 +96,9 @@ static int mt7531_phy_config_init(struct
 | 
			
		||||
 	phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x13, 0x404);
 | 
			
		||||
 	phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x14, 0x404);
 | 
			
		||||
 
 | 
			
		||||
+	/* LED Config*/
 | 
			
		||||
+	mt7530_led_config_of(phydev);
 | 
			
		||||
+
 | 
			
		||||
 	return 0;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,98 @@
 | 
			
		|||
From 3cb240533ab787899dc7f17aa7d6c5b4810e2e58 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Hauke Mehrtens <hauke@hauke-m.de>
 | 
			
		||||
Date: Fri, 7 Jul 2017 17:26:01 +0200
 | 
			
		||||
Subject: bcm53xx: bgmac: use srab switch driver
 | 
			
		||||
 | 
			
		||||
use the srab switch driver on these SoCs.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 | 
			
		||||
---
 | 
			
		||||
 drivers/net/ethernet/broadcom/bgmac-bcma.c |  1 +
 | 
			
		||||
 drivers/net/ethernet/broadcom/bgmac.c      | 24 ++++++++++++++++++++++++
 | 
			
		||||
 drivers/net/ethernet/broadcom/bgmac.h      |  4 ++++
 | 
			
		||||
 3 files changed, 29 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
 | 
			
		||||
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
 | 
			
		||||
@@ -280,6 +280,7 @@ static int bgmac_probe(struct bcma_devic
 | 
			
		||||
 		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
 | 
			
		||||
 		bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
 | 
			
		||||
 		bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
 | 
			
		||||
+		bgmac->feature_flags |= BGMAC_FEAT_SRAB;
 | 
			
		||||
 		break;
 | 
			
		||||
 	default:
 | 
			
		||||
 		bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
 | 
			
		||||
--- a/drivers/net/ethernet/broadcom/bgmac.c
 | 
			
		||||
+++ b/drivers/net/ethernet/broadcom/bgmac.c
 | 
			
		||||
@@ -12,6 +12,7 @@
 | 
			
		||||
 #include <linux/bcma/bcma.h>
 | 
			
		||||
 #include <linux/etherdevice.h>
 | 
			
		||||
 #include <linux/interrupt.h>
 | 
			
		||||
+#include <linux/platform_data/b53.h>
 | 
			
		||||
 #include <linux/bcm47xx_nvram.h>
 | 
			
		||||
 #include <linux/phy.h>
 | 
			
		||||
 #include <linux/phy_fixed.h>
 | 
			
		||||
@@ -1408,6 +1409,17 @@ static const struct ethtool_ops bgmac_et
 | 
			
		||||
 	.set_link_ksettings     = phy_ethtool_set_link_ksettings,
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+static struct b53_platform_data bgmac_b53_pdata = {
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+static struct platform_device bgmac_b53_dev = {
 | 
			
		||||
+	.name		= "b53-srab-switch",
 | 
			
		||||
+	.id		= -1,
 | 
			
		||||
+	.dev		= {
 | 
			
		||||
+		.platform_data = &bgmac_b53_pdata,
 | 
			
		||||
+	},
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
 /**************************************************
 | 
			
		||||
  * MII
 | 
			
		||||
  **************************************************/
 | 
			
		||||
@@ -1546,6 +1558,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
 | 
			
		||||
 
 | 
			
		||||
 	bgmac->in_init = false;
 | 
			
		||||
 
 | 
			
		||||
+	if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) {
 | 
			
		||||
+		bgmac_b53_pdata.regs = ioremap(0x18007000, 0x1000);
 | 
			
		||||
+
 | 
			
		||||
+		err = platform_device_register(&bgmac_b53_dev);
 | 
			
		||||
+		if (!err)
 | 
			
		||||
+			bgmac->b53_device = &bgmac_b53_dev;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	err = register_netdev(bgmac->net_dev);
 | 
			
		||||
 	if (err) {
 | 
			
		||||
 		dev_err(bgmac->dev, "Cannot register net device\n");
 | 
			
		||||
@@ -1568,6 +1588,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
 | 
			
		||||
 
 | 
			
		||||
 void bgmac_enet_remove(struct bgmac *bgmac)
 | 
			
		||||
 {
 | 
			
		||||
+	if (bgmac->b53_device)
 | 
			
		||||
+		platform_device_unregister(&bgmac_b53_dev);
 | 
			
		||||
+	bgmac->b53_device = NULL;
 | 
			
		||||
+
 | 
			
		||||
 	unregister_netdev(bgmac->net_dev);
 | 
			
		||||
 	phy_disconnect(bgmac->net_dev->phydev);
 | 
			
		||||
 	netif_napi_del(&bgmac->napi);
 | 
			
		||||
--- a/drivers/net/ethernet/broadcom/bgmac.h
 | 
			
		||||
+++ b/drivers/net/ethernet/broadcom/bgmac.h
 | 
			
		||||
@@ -388,6 +388,7 @@
 | 
			
		||||
 #define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII	BIT(18)
 | 
			
		||||
 #define BGMAC_FEAT_CC7_IF_TYPE_RGMII	BIT(19)
 | 
			
		||||
 #define BGMAC_FEAT_IDM_MASK		BIT(20)
 | 
			
		||||
+#define BGMAC_FEAT_SRAB			BIT(21)
 | 
			
		||||
 
 | 
			
		||||
 struct bgmac_slot_info {
 | 
			
		||||
 	union {
 | 
			
		||||
@@ -495,6 +496,9 @@ struct bgmac {
 | 
			
		||||
 	void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
 | 
			
		||||
 			      u32 set);
 | 
			
		||||
 	int (*phy_connect)(struct bgmac *bgmac);
 | 
			
		||||
+
 | 
			
		||||
+	/* platform device for associated switch */
 | 
			
		||||
+	struct platform_device *b53_device;
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 struct bgmac *bgmac_alloc(struct device *dev);
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
From 9fabf60187f1fa19e6f6bb5441587d485bd534b0 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Daniel Golle <daniel@makrotopia.org>
 | 
			
		||||
Date: Tue, 9 Apr 2024 17:06:38 +0100
 | 
			
		||||
Subject: [PATCH] rndis_host: add a bunch of USB IDs
 | 
			
		||||
 | 
			
		||||
Add a bunch of USB IDs found in various places online to the
 | 
			
		||||
RNDIS USB network driver.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 | 
			
		||||
---
 | 
			
		||||
 drivers/net/usb/rndis_host.c | 40 ++++++++++++++++++++++
 | 
			
		||||
 1 file changed, 40 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/net/usb/rndis_host.c
 | 
			
		||||
+++ b/drivers/net/usb/rndis_host.c
 | 
			
		||||
@@ -630,6 +630,16 @@ static const struct driver_info	zte_rndi
 | 
			
		||||
 	.tx_fixup =	rndis_tx_fixup,
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+static const struct driver_info asr_rndis_info = {
 | 
			
		||||
+	.description =	"Asr RNDIS device",
 | 
			
		||||
+	.flags =	FLAG_WWAN | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT | FLAG_NOARP,
 | 
			
		||||
+	.bind =		rndis_bind,
 | 
			
		||||
+	.unbind =	rndis_unbind,
 | 
			
		||||
+	.status =	rndis_status,
 | 
			
		||||
+	.rx_fixup =	rndis_rx_fixup,
 | 
			
		||||
+	.tx_fixup =	rndis_tx_fixup,
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
 /*-------------------------------------------------------------------------*/
 | 
			
		||||
 
 | 
			
		||||
 static const struct usb_device_id	products [] = {
 | 
			
		||||
@@ -666,6 +676,36 @@ static const struct usb_device_id	produc
 | 
			
		||||
 	USB_INTERFACE_INFO(USB_CLASS_WIRELESS_CONTROLLER, 1, 3),
 | 
			
		||||
 	.driver_info = (unsigned long) &rndis_info,
 | 
			
		||||
 }, {
 | 
			
		||||
+	/* Quectel EG060V rndis device */
 | 
			
		||||
+	USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x6004,
 | 
			
		||||
+				      USB_CLASS_WIRELESS_CONTROLLER, 1, 3),
 | 
			
		||||
+	.driver_info = (unsigned long) &asr_rndis_info,
 | 
			
		||||
+}, {
 | 
			
		||||
+	/* Quectel EC200A rndis device */
 | 
			
		||||
+	USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x6005,
 | 
			
		||||
+				      USB_CLASS_WIRELESS_CONTROLLER, 1, 3),
 | 
			
		||||
+	.driver_info = (unsigned long) &asr_rndis_info,
 | 
			
		||||
+}, {
 | 
			
		||||
+	/* Quectel EC200T rndis device */
 | 
			
		||||
+	USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x6026,
 | 
			
		||||
+				      USB_CLASS_WIRELESS_CONTROLLER, 1, 3),
 | 
			
		||||
+	.driver_info = (unsigned long) &asr_rndis_info,
 | 
			
		||||
+}, {
 | 
			
		||||
+	/* Simcom A7906E rndis device */
 | 
			
		||||
+	USB_DEVICE_AND_INTERFACE_INFO(0x1e0e, 0x9011,
 | 
			
		||||
+				      USB_CLASS_WIRELESS_CONTROLLER, 1, 3),
 | 
			
		||||
+	.driver_info = (unsigned long) &asr_rndis_info,
 | 
			
		||||
+}, {
 | 
			
		||||
+	/* Meig SLM770A */
 | 
			
		||||
+	USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d57,
 | 
			
		||||
+				      USB_CLASS_WIRELESS_CONTROLLER, 1, 3),
 | 
			
		||||
+	.driver_info = (unsigned long) &asr_rndis_info,
 | 
			
		||||
+}, {
 | 
			
		||||
+	/* Meig SLM828 */
 | 
			
		||||
+	USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d49,
 | 
			
		||||
+				      USB_CLASS_WIRELESS_CONTROLLER, 1, 3),
 | 
			
		||||
+	.driver_info = (unsigned long) &asr_rndis_info,
 | 
			
		||||
+}, {
 | 
			
		||||
 	/* Novatel Verizon USB730L */
 | 
			
		||||
 	USB_INTERFACE_INFO(USB_CLASS_MISC, 4, 1),
 | 
			
		||||
 	.driver_info = (unsigned long) &rndis_info,
 | 
			
		||||
							
								
								
									
										181
									
								
								6.12/target/linux/generic/hack-6.12/901-debloat_sock_diag.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										181
									
								
								6.12/target/linux/generic/hack-6.12/901-debloat_sock_diag.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,181 @@
 | 
			
		|||
From 3b6115d6b57a263bdc8c9b1df273bd4a7955eead Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Sat, 8 Jul 2017 08:16:31 +0200
 | 
			
		||||
Subject: debloat: add some debloat patches, strip down procfs and make O_DIRECT support optional, saves ~15K after lzma on MIPS
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 net/Kconfig         | 3 +++
 | 
			
		||||
 net/core/Makefile   | 3 ++-
 | 
			
		||||
 net/core/sock.c     | 2 ++
 | 
			
		||||
 net/ipv4/Kconfig    | 1 +
 | 
			
		||||
 net/netlink/Kconfig | 1 +
 | 
			
		||||
 net/packet/Kconfig  | 1 +
 | 
			
		||||
 net/unix/Kconfig    | 1 +
 | 
			
		||||
 7 files changed, 11 insertions(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/net/Kconfig
 | 
			
		||||
+++ b/net/Kconfig
 | 
			
		||||
@@ -129,6 +129,9 @@ source "net/mptcp/Kconfig"
 | 
			
		||||
 
 | 
			
		||||
 endif # if INET
 | 
			
		||||
 
 | 
			
		||||
+config SOCK_DIAG
 | 
			
		||||
+	bool
 | 
			
		||||
+
 | 
			
		||||
 config NETWORK_SECMARK
 | 
			
		||||
 	bool "Security Marking"
 | 
			
		||||
 	help
 | 
			
		||||
--- a/net/core/Makefile
 | 
			
		||||
+++ b/net/core/Makefile
 | 
			
		||||
@@ -11,12 +11,13 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_core.
 | 
			
		||||
 
 | 
			
		||||
 obj-y		     += dev.o dev_addr_lists.o dst.o netevent.o \
 | 
			
		||||
 			neighbour.o rtnetlink.o utils.o link_watch.o filter.o \
 | 
			
		||||
-			sock_diag.o dev_ioctl.o tso.o sock_reuseport.o \
 | 
			
		||||
+			dev_ioctl.o tso.o sock_reuseport.o \
 | 
			
		||||
 			fib_notifier.o xdp.o flow_offload.o gro.o \
 | 
			
		||||
 			netdev-genl.o netdev-genl-gen.o gso.o
 | 
			
		||||
 
 | 
			
		||||
 obj-$(CONFIG_NETDEV_ADDR_LIST_TEST) += dev_addr_lists_test.o
 | 
			
		||||
 
 | 
			
		||||
+obj-$(CONFIG_SOCK_DIAG) += sock_diag.o
 | 
			
		||||
 obj-y += net-sysfs.o
 | 
			
		||||
 obj-$(CONFIG_PAGE_POOL) += page_pool.o
 | 
			
		||||
 obj-$(CONFIG_PROC_FS) += net-procfs.o
 | 
			
		||||
--- a/net/core/sock.c
 | 
			
		||||
+++ b/net/core/sock.c
 | 
			
		||||
@@ -118,6 +118,7 @@
 | 
			
		||||
 #include <linux/mroute.h>
 | 
			
		||||
 #include <linux/mroute6.h>
 | 
			
		||||
 #include <linux/icmpv6.h>
 | 
			
		||||
+#include <linux/cookie.h>
 | 
			
		||||
 
 | 
			
		||||
 #include <linux/uaccess.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -150,6 +151,7 @@
 | 
			
		||||
 
 | 
			
		||||
 static DEFINE_MUTEX(proto_list_mutex);
 | 
			
		||||
 static LIST_HEAD(proto_list);
 | 
			
		||||
+DEFINE_COOKIE(sock_cookie);
 | 
			
		||||
 
 | 
			
		||||
 static void sock_def_write_space_wfree(struct sock *sk);
 | 
			
		||||
 static void sock_def_write_space(struct sock *sk);
 | 
			
		||||
@@ -590,6 +592,21 @@ discard_and_relse:
 | 
			
		||||
 }
 | 
			
		||||
 EXPORT_SYMBOL(__sk_receive_skb);
 | 
			
		||||
 
 | 
			
		||||
+u64 __sock_gen_cookie(struct sock *sk)
 | 
			
		||||
+{
 | 
			
		||||
+	u64 res = atomic64_read(&sk->sk_cookie);
 | 
			
		||||
+
 | 
			
		||||
+	if (!res) {
 | 
			
		||||
+		u64 new = gen_cookie_next(&sock_cookie);
 | 
			
		||||
+
 | 
			
		||||
+		atomic64_cmpxchg(&sk->sk_cookie, res, new);
 | 
			
		||||
+
 | 
			
		||||
+		/* Another thread might have changed sk_cookie before us. */
 | 
			
		||||
+		res = atomic64_read(&sk->sk_cookie);
 | 
			
		||||
+	}
 | 
			
		||||
+	return res;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 INDIRECT_CALLABLE_DECLARE(struct dst_entry *ip6_dst_check(struct dst_entry *,
 | 
			
		||||
 							  u32));
 | 
			
		||||
 INDIRECT_CALLABLE_DECLARE(struct dst_entry *ipv4_dst_check(struct dst_entry *,
 | 
			
		||||
@@ -2247,9 +2264,11 @@ static void __sk_free(struct sock *sk)
 | 
			
		||||
 	if (likely(sk->sk_net_refcnt))
 | 
			
		||||
 		sock_inuse_add(sock_net(sk), -1);
 | 
			
		||||
 
 | 
			
		||||
+#ifdef CONFIG_SOCK_DIAG
 | 
			
		||||
 	if (unlikely(sk->sk_net_refcnt && sock_diag_has_destroy_listeners(sk)))
 | 
			
		||||
 		sock_diag_broadcast_destroy(sk);
 | 
			
		||||
 	else
 | 
			
		||||
+#endif
 | 
			
		||||
 		sk_destruct(sk);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
--- a/net/core/sock_diag.c
 | 
			
		||||
+++ b/net/core/sock_diag.c
 | 
			
		||||
@@ -12,7 +12,6 @@
 | 
			
		||||
 #include <linux/tcp.h>
 | 
			
		||||
 #include <linux/workqueue.h>
 | 
			
		||||
 #include <linux/nospec.h>
 | 
			
		||||
-#include <linux/cookie.h>
 | 
			
		||||
 #include <linux/inet_diag.h>
 | 
			
		||||
 #include <linux/sock_diag.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -21,23 +20,6 @@ static int (*inet_rcv_compat)(struct sk_
 | 
			
		||||
 static DEFINE_MUTEX(sock_diag_table_mutex);
 | 
			
		||||
 static struct workqueue_struct *broadcast_wq;
 | 
			
		||||
 
 | 
			
		||||
-DEFINE_COOKIE(sock_cookie);
 | 
			
		||||
-
 | 
			
		||||
-u64 __sock_gen_cookie(struct sock *sk)
 | 
			
		||||
-{
 | 
			
		||||
-	u64 res = atomic64_read(&sk->sk_cookie);
 | 
			
		||||
-
 | 
			
		||||
-	if (!res) {
 | 
			
		||||
-		u64 new = gen_cookie_next(&sock_cookie);
 | 
			
		||||
-
 | 
			
		||||
-		atomic64_cmpxchg(&sk->sk_cookie, res, new);
 | 
			
		||||
-
 | 
			
		||||
-		/* Another thread might have changed sk_cookie before us. */
 | 
			
		||||
-		res = atomic64_read(&sk->sk_cookie);
 | 
			
		||||
-	}
 | 
			
		||||
-	return res;
 | 
			
		||||
-}
 | 
			
		||||
-
 | 
			
		||||
 int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie)
 | 
			
		||||
 {
 | 
			
		||||
 	u64 res;
 | 
			
		||||
--- a/net/ipv4/Kconfig
 | 
			
		||||
+++ b/net/ipv4/Kconfig
 | 
			
		||||
@@ -423,6 +423,7 @@ config INET_TUNNEL
 | 
			
		||||
 
 | 
			
		||||
 config INET_DIAG
 | 
			
		||||
 	tristate "INET: socket monitoring interface"
 | 
			
		||||
+	select SOCK_DIAG
 | 
			
		||||
 	default y
 | 
			
		||||
 	help
 | 
			
		||||
 	  Support for INET (TCP, DCCP, etc) socket monitoring interface used by
 | 
			
		||||
--- a/net/netlink/Kconfig
 | 
			
		||||
+++ b/net/netlink/Kconfig
 | 
			
		||||
@@ -5,6 +5,7 @@
 | 
			
		||||
 
 | 
			
		||||
 config NETLINK_DIAG
 | 
			
		||||
 	tristate "NETLINK: socket monitoring interface"
 | 
			
		||||
+	select SOCK_DIAG
 | 
			
		||||
 	default n
 | 
			
		||||
 	help
 | 
			
		||||
 	  Support for NETLINK socket monitoring interface used by the ss tool.
 | 
			
		||||
--- a/net/packet/Kconfig
 | 
			
		||||
+++ b/net/packet/Kconfig
 | 
			
		||||
@@ -19,6 +19,7 @@ config PACKET
 | 
			
		||||
 config PACKET_DIAG
 | 
			
		||||
 	tristate "Packet: sockets monitoring interface"
 | 
			
		||||
 	depends on PACKET
 | 
			
		||||
+	select SOCK_DIAG
 | 
			
		||||
 	default n
 | 
			
		||||
 	help
 | 
			
		||||
 	  Support for PF_PACKET sockets monitoring interface used by the ss tool.
 | 
			
		||||
--- a/net/unix/Kconfig
 | 
			
		||||
+++ b/net/unix/Kconfig
 | 
			
		||||
@@ -29,6 +29,7 @@ config	AF_UNIX_OOB
 | 
			
		||||
 config UNIX_DIAG
 | 
			
		||||
 	tristate "UNIX: socket monitoring interface"
 | 
			
		||||
 	depends on UNIX
 | 
			
		||||
+	select SOCK_DIAG
 | 
			
		||||
 	default n
 | 
			
		||||
 	help
 | 
			
		||||
 	  Support for UNIX socket monitoring interface used by the ss tool.
 | 
			
		||||
--- a/net/xdp/Kconfig
 | 
			
		||||
+++ b/net/xdp/Kconfig
 | 
			
		||||
@@ -10,6 +10,7 @@ config XDP_SOCKETS
 | 
			
		||||
 config XDP_SOCKETS_DIAG
 | 
			
		||||
 	tristate "XDP sockets: monitoring interface"
 | 
			
		||||
 	depends on XDP_SOCKETS
 | 
			
		||||
+	select SOCK_DIAG
 | 
			
		||||
 	default n
 | 
			
		||||
 	help
 | 
			
		||||
 	  Support for PF_XDP sockets monitoring interface used by the ss tool.
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,93 @@
 | 
			
		|||
From e3692cb2fcd5ba1244512a0f43b8118f65f1c375 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Sat, 8 Jul 2017 08:20:43 +0200
 | 
			
		||||
Subject: debloat: dmabuf
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 drivers/base/Kconfig      |  2 +-
 | 
			
		||||
 drivers/dma-buf/Makefile  | 10 +++++++---
 | 
			
		||||
 drivers/dma-buf/dma-buf.c |  4 +++-
 | 
			
		||||
 kernel/sched/core.c       |  1 +
 | 
			
		||||
 4 files changed, 12 insertions(+), 5 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/base/Kconfig
 | 
			
		||||
+++ b/drivers/base/Kconfig
 | 
			
		||||
@@ -198,7 +198,7 @@ config SOC_BUS
 | 
			
		||||
 source "drivers/base/regmap/Kconfig"
 | 
			
		||||
 
 | 
			
		||||
 config DMA_SHARED_BUFFER
 | 
			
		||||
-	bool
 | 
			
		||||
+	tristate
 | 
			
		||||
 	default n
 | 
			
		||||
 	select IRQ_WORK
 | 
			
		||||
 	help
 | 
			
		||||
--- a/drivers/dma-buf/heaps/Makefile
 | 
			
		||||
+++ b/drivers/dma-buf/heaps/Makefile
 | 
			
		||||
@@ -1,3 +1,3 @@
 | 
			
		||||
 # SPDX-License-Identifier: GPL-2.0
 | 
			
		||||
-obj-$(CONFIG_DMABUF_HEAPS_SYSTEM)	+= system_heap.o
 | 
			
		||||
-obj-$(CONFIG_DMABUF_HEAPS_CMA)		+= cma_heap.o
 | 
			
		||||
+dma-buf-objs-$(CONFIG_DMABUF_HEAPS_SYSTEM)	+= system_heap.o
 | 
			
		||||
+dma-buf-objs-$(CONFIG_DMABUF_HEAPS_CMA)		+= cma_heap.o
 | 
			
		||||
--- a/drivers/dma-buf/Makefile
 | 
			
		||||
+++ b/drivers/dma-buf/Makefile
 | 
			
		||||
@@ -1,12 +1,14 @@
 | 
			
		||||
 # SPDX-License-Identifier: GPL-2.0-only
 | 
			
		||||
-obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
 | 
			
		||||
+obj-$(CONFIG_DMA_SHARED_BUFFER) := dma-shared-buffer.o
 | 
			
		||||
+
 | 
			
		||||
+dma-buf-objs-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
 | 
			
		||||
 	 dma-fence-unwrap.o dma-resv.o
 | 
			
		||||
-obj-$(CONFIG_DMABUF_HEAPS)	+= dma-heap.o
 | 
			
		||||
-obj-$(CONFIG_DMABUF_HEAPS)	+= heaps/
 | 
			
		||||
-obj-$(CONFIG_SYNC_FILE)		+= sync_file.o
 | 
			
		||||
-obj-$(CONFIG_SW_SYNC)		+= sw_sync.o sync_debug.o
 | 
			
		||||
-obj-$(CONFIG_UDMABUF)		+= udmabuf.o
 | 
			
		||||
-obj-$(CONFIG_DMABUF_SYSFS_STATS) += dma-buf-sysfs-stats.o
 | 
			
		||||
+dma-buf-objs-$(CONFIG_DMABUF_HEAPS)	+= dma-heap.o
 | 
			
		||||
+obj-$(CONFIG_DMABUF_HEAPS)		+= heaps/
 | 
			
		||||
+dma-buf-objs-$(CONFIG_SYNC_FILE)	+= sync_file.o
 | 
			
		||||
+dma-buf-objs-$(CONFIG_SW_SYNC)		+= sw_sync.o sync_debug.o
 | 
			
		||||
+dma-buf-objs-$(CONFIG_UDMABUF)		+= udmabuf.o
 | 
			
		||||
+dma-buf-objs-$(CONFIG_DMABUF_SYSFS_STATS) += dma-buf-sysfs-stats.o
 | 
			
		||||
 
 | 
			
		||||
 dmabuf_selftests-y := \
 | 
			
		||||
 	selftest.o \
 | 
			
		||||
@@ -15,4 +17,6 @@ dmabuf_selftests-y := \
 | 
			
		||||
 	st-dma-fence-unwrap.o \
 | 
			
		||||
 	st-dma-resv.o
 | 
			
		||||
 
 | 
			
		||||
-obj-$(CONFIG_DMABUF_SELFTESTS)	+= dmabuf_selftests.o
 | 
			
		||||
+dma-buf-objs-$(CONFIG_DMABUF_SELFTESTS)	+= dmabuf_selftests.o
 | 
			
		||||
+
 | 
			
		||||
+dma-shared-buffer-objs :=  $(dma-buf-objs-y)
 | 
			
		||||
--- a/drivers/dma-buf/dma-buf.c
 | 
			
		||||
+++ b/drivers/dma-buf/dma-buf.c
 | 
			
		||||
@@ -1731,4 +1731,5 @@ static void __exit dma_buf_deinit(void)
 | 
			
		||||
 	kern_unmount(dma_buf_mnt);
 | 
			
		||||
 	dma_buf_uninit_sysfs_statistics();
 | 
			
		||||
 }
 | 
			
		||||
-__exitcall(dma_buf_deinit);
 | 
			
		||||
+module_exit(dma_buf_deinit);
 | 
			
		||||
+MODULE_LICENSE("GPL");
 | 
			
		||||
--- a/kernel/sched/core.c
 | 
			
		||||
+++ b/kernel/sched/core.c
 | 
			
		||||
@@ -4487,6 +4487,7 @@ int wake_up_state(struct task_struct *p,
 | 
			
		||||
 {
 | 
			
		||||
 	return try_to_wake_up(p, state, 0);
 | 
			
		||||
 }
 | 
			
		||||
+EXPORT_SYMBOL_GPL(wake_up_state);
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
  * Perform scheduler related setup for a newly forked process p.
 | 
			
		||||
--- a/fs/d_path.c
 | 
			
		||||
+++ b/fs/d_path.c
 | 
			
		||||
@@ -314,6 +314,7 @@ char *dynamic_dname(char *buffer, int bu
 | 
			
		||||
 	buffer += buflen - sz;
 | 
			
		||||
 	return memcpy(buffer, temp, sz);
 | 
			
		||||
 }
 | 
			
		||||
+EXPORT_SYMBOL_GPL(dynamic_dname);
 | 
			
		||||
 
 | 
			
		||||
 char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
 | 
			
		||||
 {
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
From e08bcbbaa52fcc41f02743fd2e62a33255ce52da Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
 | 
			
		||||
Date: Wed, 13 Jul 2022 13:52:28 +0200
 | 
			
		||||
Subject: [PATCH] of/ftd: add device tree cmdline
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 drivers/of/fdt.c | 3 +++
 | 
			
		||||
 1 file changed, 3 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/of/fdt.c
 | 
			
		||||
+++ b/drivers/of/fdt.c
 | 
			
		||||
@@ -1185,6 +1185,9 @@ int __init early_init_dt_scan_chosen(cha
 | 
			
		||||
 	p = of_get_flat_dt_prop(node, "bootargs", &l);
 | 
			
		||||
 	if (p != NULL && l > 0)
 | 
			
		||||
 		strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
 | 
			
		||||
+	p = of_get_flat_dt_prop(node, "bootargs-append", &l);
 | 
			
		||||
+	if (p != NULL && l > 0)
 | 
			
		||||
+		strlcat(cmdline, p, min_t(int, strlen(cmdline) + (int)l, COMMAND_LINE_SIZE));
 | 
			
		||||
 
 | 
			
		||||
 handle_cmdline:
 | 
			
		||||
 	/*
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,235 @@
 | 
			
		|||
--- a/net/netfilter/nf_nat_masquerade.c
 | 
			
		||||
+++ b/net/netfilter/nf_nat_masquerade.c
 | 
			
		||||
@@ -8,6 +8,9 @@
 | 
			
		||||
 #include <linux/netfilter_ipv6.h>
 | 
			
		||||
 
 | 
			
		||||
 #include <net/netfilter/nf_nat_masquerade.h>
 | 
			
		||||
+#include <net/netfilter/nf_conntrack_zones.h>
 | 
			
		||||
+#include <net/netfilter/nf_conntrack_helper.h>
 | 
			
		||||
+#include <net/netfilter/nf_conntrack_core.h>
 | 
			
		||||
 
 | 
			
		||||
 struct masq_dev_work {
 | 
			
		||||
 	struct work_struct work;
 | 
			
		||||
@@ -24,6 +27,129 @@ static DEFINE_MUTEX(masq_mutex);
 | 
			
		||||
 static unsigned int masq_refcnt __read_mostly;
 | 
			
		||||
 static atomic_t masq_worker_count __read_mostly;
 | 
			
		||||
 
 | 
			
		||||
+static void bcm_nat_expect(struct nf_conn *ct,
 | 
			
		||||
+                          struct nf_conntrack_expect *exp)
 | 
			
		||||
+{
 | 
			
		||||
+       struct nf_nat_range2 range;
 | 
			
		||||
+
 | 
			
		||||
+       /* This must be a fresh one. */
 | 
			
		||||
+       BUG_ON(ct->status & IPS_NAT_DONE_MASK);
 | 
			
		||||
+
 | 
			
		||||
+       /* Change src to where new ct comes from */
 | 
			
		||||
+       range.flags = NF_NAT_RANGE_MAP_IPS;
 | 
			
		||||
+       range.min_addr = range.max_addr =
 | 
			
		||||
+               ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3;
 | 
			
		||||
+       nf_nat_setup_info(ct, &range, NF_NAT_MANIP_SRC);
 | 
			
		||||
+
 | 
			
		||||
+       /* For DST manip, map port here to where it's expected. */
 | 
			
		||||
+       range.flags = (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED);
 | 
			
		||||
+       range.min_proto = range.max_proto = exp->saved_proto;
 | 
			
		||||
+       range.min_addr = range.max_addr = exp->saved_addr;
 | 
			
		||||
+       nf_nat_setup_info(ct, &range, NF_NAT_MANIP_DST);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+/****************************************************************************/
 | 
			
		||||
+static int bcm_nat_help(struct sk_buff *skb, unsigned int protoff,
 | 
			
		||||
+                       struct nf_conn *ct, enum ip_conntrack_info ctinfo)
 | 
			
		||||
+{
 | 
			
		||||
+       int dir = CTINFO2DIR(ctinfo);
 | 
			
		||||
+       struct nf_conn_help *help = nfct_help(ct);
 | 
			
		||||
+       struct nf_conntrack_expect *exp;
 | 
			
		||||
+
 | 
			
		||||
+       if (dir != IP_CT_DIR_ORIGINAL ||
 | 
			
		||||
+           help->expecting[NF_CT_EXPECT_CLASS_DEFAULT])
 | 
			
		||||
+               return NF_ACCEPT;
 | 
			
		||||
+
 | 
			
		||||
+       pr_debug("bcm_nat: packet[%d bytes] ", skb->len);
 | 
			
		||||
+       nf_ct_dump_tuple(&ct->tuplehash[dir].tuple);
 | 
			
		||||
+       pr_debug("reply: ");
 | 
			
		||||
+       nf_ct_dump_tuple(&ct->tuplehash[!dir].tuple);
 | 
			
		||||
+
 | 
			
		||||
+       /* Create expect */
 | 
			
		||||
+       if ((exp = nf_ct_expect_alloc(ct)) == NULL)
 | 
			
		||||
+               return NF_ACCEPT;
 | 
			
		||||
+
 | 
			
		||||
+       nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, AF_INET, NULL,
 | 
			
		||||
+                         &ct->tuplehash[!dir].tuple.dst.u3, IPPROTO_UDP,
 | 
			
		||||
+                         NULL, &ct->tuplehash[!dir].tuple.dst.u.udp.port);
 | 
			
		||||
+       exp->flags = NF_CT_EXPECT_PERMANENT;
 | 
			
		||||
+       exp->saved_addr = ct->tuplehash[dir].tuple.src.u3;
 | 
			
		||||
+       exp->saved_proto.udp.port = ct->tuplehash[dir].tuple.src.u.udp.port;
 | 
			
		||||
+       exp->dir = !dir;
 | 
			
		||||
+       exp->expectfn = bcm_nat_expect;
 | 
			
		||||
+
 | 
			
		||||
+       /* Setup expect */
 | 
			
		||||
+       nf_ct_expect_related(exp, 0);
 | 
			
		||||
+       nf_ct_expect_put(exp);
 | 
			
		||||
+       pr_debug("bcm_nat: expect setup\n");
 | 
			
		||||
+
 | 
			
		||||
+       return NF_ACCEPT;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+/****************************************************************************/
 | 
			
		||||
+static struct nf_conntrack_expect_policy bcm_nat_exp_policy __read_mostly = {
 | 
			
		||||
+       .max_expected   = 1000,
 | 
			
		||||
+       .timeout        = 240,
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+/****************************************************************************/
 | 
			
		||||
+static struct nf_conntrack_helper nf_conntrack_helper_bcm_nat __read_mostly = {
 | 
			
		||||
+       .name = "BCM-NAT",
 | 
			
		||||
+       .me = THIS_MODULE,
 | 
			
		||||
+       .tuple.src.l3num = AF_INET,
 | 
			
		||||
+       .tuple.dst.protonum = IPPROTO_UDP,
 | 
			
		||||
+       .expect_policy = &bcm_nat_exp_policy,
 | 
			
		||||
+       .expect_class_max = 1,
 | 
			
		||||
+       .help = bcm_nat_help,
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+/****************************************************************************/
 | 
			
		||||
+static inline int find_exp(__be32 ip, __be16 port, struct nf_conn *ct)
 | 
			
		||||
+{
 | 
			
		||||
+       struct nf_conntrack_tuple tuple;
 | 
			
		||||
+       struct nf_conntrack_expect *i = NULL;
 | 
			
		||||
+
 | 
			
		||||
+
 | 
			
		||||
+       memset(&tuple, 0, sizeof(tuple));
 | 
			
		||||
+       tuple.src.l3num = AF_INET;
 | 
			
		||||
+       tuple.dst.protonum = IPPROTO_UDP;
 | 
			
		||||
+       tuple.dst.u3.ip = ip;
 | 
			
		||||
+       tuple.dst.u.udp.port = port;
 | 
			
		||||
+
 | 
			
		||||
+       rcu_read_lock();
 | 
			
		||||
+       i = __nf_ct_expect_find(nf_ct_net(ct), nf_ct_zone(ct), &tuple);
 | 
			
		||||
+       rcu_read_unlock();
 | 
			
		||||
+
 | 
			
		||||
+       return i != NULL;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+/****************************************************************************/
 | 
			
		||||
+static inline struct nf_conntrack_expect *find_fullcone_exp(struct nf_conn *ct)
 | 
			
		||||
+{
 | 
			
		||||
+       struct nf_conntrack_tuple * tp =
 | 
			
		||||
+               &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple;
 | 
			
		||||
+       struct nf_conntrack_expect * exp = NULL;
 | 
			
		||||
+       struct nf_conntrack_expect * i;
 | 
			
		||||
+       unsigned int h;
 | 
			
		||||
+
 | 
			
		||||
+       rcu_read_lock();
 | 
			
		||||
+       for (h = 0; h < nf_ct_expect_hsize; h++) {
 | 
			
		||||
+               hlist_for_each_entry_rcu(i, &nf_ct_expect_hash[h], hnode) {
 | 
			
		||||
+                       if (nf_inet_addr_cmp(&i->saved_addr, &tp->src.u3) &&
 | 
			
		||||
+                           i->saved_proto.all == tp->src.u.all &&
 | 
			
		||||
+                           i->tuple.dst.protonum == tp->dst.protonum &&
 | 
			
		||||
+                           i->tuple.src.u3.ip == 0 &&
 | 
			
		||||
+                           i->tuple.src.u.udp.port == 0) {
 | 
			
		||||
+                               exp = i;
 | 
			
		||||
+                               break;
 | 
			
		||||
+                       }
 | 
			
		||||
+               }
 | 
			
		||||
+       }
 | 
			
		||||
+       rcu_read_unlock();
 | 
			
		||||
+
 | 
			
		||||
+       return exp;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 unsigned int
 | 
			
		||||
 nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum,
 | 
			
		||||
 		       const struct nf_nat_range2 *range,
 | 
			
		||||
@@ -61,6 +187,72 @@ nf_nat_masquerade_ipv4(struct sk_buff *s
 | 
			
		||||
 	if (nat)
 | 
			
		||||
 		nat->masq_index = out->ifindex;
 | 
			
		||||
 
 | 
			
		||||
+/* RFC 4787 - 4.2.2.  Port Parity
 | 
			
		||||
+   i.e., an even port will be mapped to an even port, and an odd port will be mapped to an odd port.
 | 
			
		||||
+*/
 | 
			
		||||
+#define CHECK_PORT_PARITY(a, b) ((a%2)==(b%2))
 | 
			
		||||
+       if (range->min_addr.ip != 0 /* nat_mode == full cone */
 | 
			
		||||
+           && (nfct_help(ct) == NULL || nfct_help(ct)->helper == NULL)
 | 
			
		||||
+           && nf_ct_protonum(ct) == IPPROTO_UDP) {
 | 
			
		||||
+               unsigned int ret;
 | 
			
		||||
+               u_int16_t minport;
 | 
			
		||||
+               u_int16_t maxport;
 | 
			
		||||
+               struct nf_conntrack_expect *exp;
 | 
			
		||||
+
 | 
			
		||||
+               pr_debug("bcm_nat: need full cone NAT\n");
 | 
			
		||||
+
 | 
			
		||||
+               /* Choose port */
 | 
			
		||||
+               spin_lock_bh(&nf_conntrack_expect_lock);
 | 
			
		||||
+               /* Look for existing expectation */
 | 
			
		||||
+               exp = find_fullcone_exp(ct);
 | 
			
		||||
+               if (exp) {
 | 
			
		||||
+                       minport = maxport = exp->tuple.dst.u.udp.port;
 | 
			
		||||
+                       pr_debug("bcm_nat: existing mapped port = %hu\n",
 | 
			
		||||
+                                ntohs(minport));
 | 
			
		||||
+               } else { /* no previous expect */
 | 
			
		||||
+                       u_int16_t newport, tmpport, orgport;
 | 
			
		||||
+
 | 
			
		||||
+                       minport = range->min_proto.all == 0? 
 | 
			
		||||
+                               ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.
 | 
			
		||||
+                               u.udp.port : range->min_proto.all;
 | 
			
		||||
+                       maxport = range->max_proto.all == 0? 
 | 
			
		||||
+                               htons(65535) : range->max_proto.all;
 | 
			
		||||
+                        orgport = ntohs(minport);
 | 
			
		||||
+                       for (newport = ntohs(minport),tmpport = ntohs(maxport); 
 | 
			
		||||
+                            newport <= tmpport; newport++) {
 | 
			
		||||
+                               if (CHECK_PORT_PARITY(orgport, newport) && !find_exp(newsrc, htons(newport), ct)) {
 | 
			
		||||
+                                        pr_debug("bcm_nat: new mapped port = "
 | 
			
		||||
+                                                "%hu\n", newport);
 | 
			
		||||
+                                       minport = maxport = htons(newport);
 | 
			
		||||
+                                       break;
 | 
			
		||||
+                               }
 | 
			
		||||
+                       }
 | 
			
		||||
+               }
 | 
			
		||||
+               spin_unlock_bh(&nf_conntrack_expect_lock);
 | 
			
		||||
+
 | 
			
		||||
+
 | 
			
		||||
+       memset(&newrange.min_addr, 0, sizeof(newrange.min_addr));
 | 
			
		||||
+       memset(&newrange.max_addr, 0, sizeof(newrange.max_addr));
 | 
			
		||||
+
 | 
			
		||||
+               newrange.flags = range->flags | NF_NAT_RANGE_MAP_IPS |
 | 
			
		||||
+                       NF_NAT_RANGE_PROTO_SPECIFIED;
 | 
			
		||||
+               newrange.max_addr.ip = newrange.min_addr.ip = newsrc;
 | 
			
		||||
+               newrange.min_proto.udp.port = newrange.max_proto.udp.port = minport;
 | 
			
		||||
+
 | 
			
		||||
+               /* Set ct helper */
 | 
			
		||||
+               ret = nf_nat_setup_info(ct, &newrange, NF_NAT_MANIP_SRC);
 | 
			
		||||
+               if (ret == NF_ACCEPT) {
 | 
			
		||||
+                       struct nf_conn_help *help = nfct_help(ct);
 | 
			
		||||
+                       if (help == NULL)
 | 
			
		||||
+                               help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
 | 
			
		||||
+                       if (help != NULL) {
 | 
			
		||||
+                               help->helper = &nf_conntrack_helper_bcm_nat;
 | 
			
		||||
+                               pr_debug("bcm_nat: helper set\n");
 | 
			
		||||
+                       }
 | 
			
		||||
+               }
 | 
			
		||||
+               return ret;
 | 
			
		||||
+       }
 | 
			
		||||
+
 | 
			
		||||
 	/* Transfer from original range. */
 | 
			
		||||
 	memset(&newrange.min_addr, 0, sizeof(newrange.min_addr));
 | 
			
		||||
 	memset(&newrange.max_addr, 0, sizeof(newrange.max_addr));
 | 
			
		||||
@@ -352,6 +544,7 @@ EXPORT_SYMBOL_GPL(nf_nat_masquerade_inet
 | 
			
		||||
 
 | 
			
		||||
 void nf_nat_masquerade_inet_unregister_notifiers(void)
 | 
			
		||||
 {
 | 
			
		||||
+       nf_conntrack_helper_unregister(&nf_conntrack_helper_bcm_nat);
 | 
			
		||||
 	mutex_lock(&masq_mutex);
 | 
			
		||||
 	/* check if the notifiers still have clients */
 | 
			
		||||
 	if (--masq_refcnt > 0)
 | 
			
		||||
--- a/net/netfilter/xt_MASQUERADE.c
 | 
			
		||||
+++ b/net/netfilter/xt_MASQUERADE.c
 | 
			
		||||
@@ -42,6 +42,9 @@ masquerade_tg(struct sk_buff *skb, const
 | 
			
		||||
 	range.min_proto = mr->range[0].min;
 | 
			
		||||
 	range.max_proto = mr->range[0].max;
 | 
			
		||||
 
 | 
			
		||||
+       range.min_addr.ip = mr->range[0].min_ip;
 | 
			
		||||
+       range.max_addr.ip = mr->range[0].max_ip;
 | 
			
		||||
+
 | 
			
		||||
 	return nf_nat_masquerade_ipv4(skb, xt_hooknum(par), &range,
 | 
			
		||||
 				      xt_out(par));
 | 
			
		||||
 }
 | 
			
		||||
							
								
								
									
										4051
									
								
								6.12/target/linux/generic/hack-6.12/997-BBRv3.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4051
									
								
								6.12/target/linux/generic/hack-6.12/997-BBRv3.patch
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										14106
									
								
								6.12/target/linux/generic/hack-6.12/998-LRNG.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14106
									
								
								6.12/target/linux/generic/hack-6.12/998-LRNG.patch
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										81
									
								
								6.12/target/linux/generic/hack-6.12/998-ndpi-hook.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								6.12/target/linux/generic/hack-6.12/998-ndpi-hook.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,81 @@
 | 
			
		|||
diff -urpN linux-6.1.38.old/include/net/netfilter/nf_conntrack.h linux-6.1.38/include/net/netfilter/nf_conntrack.h
 | 
			
		||||
--- linux-6.1.38.old/include/net/netfilter/nf_conntrack.h	2023-07-05 23:27:38.000000000 +0600
 | 
			
		||||
+++ linux-6.1.38/include/net/netfilter/nf_conntrack.h	2023-07-14 12:34:56.663750711 +0600
 | 
			
		||||
@@ -362,6 +362,11 @@ static inline struct nf_conntrack_net *n
 | 
			
		||||
 	return net_generic(net, nf_conntrack_net_id);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+#ifdef CONFIG_NF_CONNTRACK_DESTROY_HOOK
 | 
			
		||||
+void register_nf_ct_destroy_hook(void (*hook)(struct nf_conn *));
 | 
			
		||||
+void unregister_nf_ct_destroy_hook(void);
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
 #define NF_CT_STAT_INC(net, count)	  __this_cpu_inc((net)->ct.stat->count)
 | 
			
		||||
 #define NF_CT_STAT_INC_ATOMIC(net, count) this_cpu_inc((net)->ct.stat->count)
 | 
			
		||||
 #define NF_CT_STAT_ADD_ATOMIC(net, count, v) this_cpu_add((net)->ct.stat->count, (v))
 | 
			
		||||
diff -urpN linux-6.1.38.old/net/netfilter/Kconfig linux-6.1.38/net/netfilter/Kconfig
 | 
			
		||||
--- linux-6.1.38.old/net/netfilter/Kconfig	2023-07-05 23:27:38.000000000 +0600
 | 
			
		||||
+++ linux-6.1.38/net/netfilter/Kconfig	2023-07-14 12:34:11.966879899 +0600
 | 
			
		||||
@@ -76,11 +76,15 @@ config NETFILTER_NETLINK_OSF
 | 
			
		||||
 	  If this option is enabled, the kernel will include support
 | 
			
		||||
 	  for passive OS fingerprint via NFNETLINK.
 | 
			
		||||
 
 | 
			
		||||
+config NF_CONNTRACK_DESTROY_HOOK
 | 
			
		||||
+	bool
 | 
			
		||||
+
 | 
			
		||||
 config NF_CONNTRACK
 | 
			
		||||
 	tristate "Netfilter connection tracking support"
 | 
			
		||||
 	default m if NETFILTER_ADVANCED=n
 | 
			
		||||
 	select NF_DEFRAG_IPV4
 | 
			
		||||
 	select NF_DEFRAG_IPV6 if IPV6 != n
 | 
			
		||||
+	select NF_CONNTRACK_DESTROY_HOOK
 | 
			
		||||
 	help
 | 
			
		||||
 	  Connection tracking keeps a record of what packets have passed
 | 
			
		||||
 	  through your machine, in order to figure out how they are related
 | 
			
		||||
diff -urpN linux-6.1.38.old/net/netfilter/nf_conntrack_core.c linux-6.1.38/net/netfilter/nf_conntrack_core.c
 | 
			
		||||
--- linux-6.1.38.old/net/netfilter/nf_conntrack_core.c	2023-07-05 23:27:38.000000000 +0600
 | 
			
		||||
+++ linux-6.1.38/net/netfilter/nf_conntrack_core.c	2023-07-14 12:33:45.580092713 +0600
 | 
			
		||||
@@ -582,9 +582,30 @@ static void destroy_gre_conntrack(struct
 | 
			
		||||
 #endif
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+#ifdef CONFIG_NF_CONNTRACK_DESTROY_HOOK
 | 
			
		||||
+
 | 
			
		||||
+static void (*nf_ct_destroy_hook)(struct nf_conn *) __rcu __read_mostly = NULL;
 | 
			
		||||
+
 | 
			
		||||
+void register_nf_ct_destroy_hook(void (*hook)(struct nf_conn *))
 | 
			
		||||
+{
 | 
			
		||||
+	rcu_assign_pointer(nf_ct_destroy_hook, hook);
 | 
			
		||||
+}
 | 
			
		||||
+EXPORT_SYMBOL(register_nf_ct_destroy_hook);
 | 
			
		||||
+
 | 
			
		||||
+void unregister_nf_ct_destroy_hook(void)
 | 
			
		||||
+{
 | 
			
		||||
+	rcu_assign_pointer(nf_ct_destroy_hook, NULL);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+EXPORT_SYMBOL(unregister_nf_ct_destroy_hook);
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
 void nf_ct_destroy(struct nf_conntrack *nfct)
 | 
			
		||||
 {
 | 
			
		||||
 	struct nf_conn *ct = (struct nf_conn *)nfct;
 | 
			
		||||
+#ifdef CONFIG_NF_CONNTRACK_DESTROY_HOOK
 | 
			
		||||
+	void (*hook)(struct nf_conn *);
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 	pr_debug("%s(%p)\n", __func__, ct);
 | 
			
		||||
 	WARN_ON(refcount_read(&nfct->use) != 0);
 | 
			
		||||
@@ -594,6 +615,12 @@ void nf_ct_destroy(struct nf_conntrack *
 | 
			
		||||
 		return;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+#ifdef CONFIG_NF_CONNTRACK_DESTROY_HOOK
 | 
			
		||||
+	hook = rcu_dereference(nf_ct_destroy_hook);
 | 
			
		||||
+	if (hook)
 | 
			
		||||
+		hook(ct);
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
 	if (unlikely(nf_ct_protonum(ct) == IPPROTO_GRE))
 | 
			
		||||
 		destroy_gre_conntrack(ct);
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,29 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Thu, 22 Oct 2020 22:00:03 +0200
 | 
			
		||||
Subject: [PATCH] compiler.h: only include asm/rwonce.h for kernel code
 | 
			
		||||
 | 
			
		||||
This header file is not in uapi, which makes any user space code that includes
 | 
			
		||||
linux/compiler.h to fail with the error 'asm/rwonce.h: No such file or directory'
 | 
			
		||||
 | 
			
		||||
Fixes: e506ea451254 ("compiler.h: Split {READ,WRITE}_ONCE definitions out into rwonce.h")
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
--- a/include/linux/compiler.h
 | 
			
		||||
+++ b/include/linux/compiler.h
 | 
			
		||||
@@ -202,6 +202,8 @@ void ftrace_likely_update(struct ftrace_
 | 
			
		||||
 	__v;								\
 | 
			
		||||
 })
 | 
			
		||||
 
 | 
			
		||||
+#include <asm/rwonce.h>
 | 
			
		||||
+
 | 
			
		||||
 #endif /* __KERNEL__ */
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
@@ -243,6 +245,4 @@ static inline void *offset_to_ptr(const
 | 
			
		||||
  */
 | 
			
		||||
 #define prevent_tail_call_optimization()	mb()
 | 
			
		||||
 
 | 
			
		||||
-#include <asm/rwonce.h>
 | 
			
		||||
-
 | 
			
		||||
 #endif /* __LINUX_COMPILER_H */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,57 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Wed, 18 Apr 2018 10:50:05 +0200
 | 
			
		||||
Subject: [PATCH] MIPS: only process negative stack offsets on stack traces
 | 
			
		||||
 | 
			
		||||
Fixes endless back traces in cases where the compiler emits a stack
 | 
			
		||||
pointer increase in a branch delay slot (probably for some form of
 | 
			
		||||
function return).
 | 
			
		||||
 | 
			
		||||
[    3.475442] BUG: MAX_STACK_TRACE_ENTRIES too low!
 | 
			
		||||
[    3.480070] turning off the locking correctness validator.
 | 
			
		||||
[    3.485521] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.34 #0
 | 
			
		||||
[    3.491475] Stack : 00000000 00000000 00000000 00000000 80e0fce2 00000034 00000000 00000000
 | 
			
		||||
[    3.499764]         87c3838c 80696377 8061047c 00000000 00000001 00000001 87c2d850 6534689f
 | 
			
		||||
[    3.508059]         00000000 00000000 80e10000 00000000 00000000 000000cf 0000000f 00000000
 | 
			
		||||
[    3.516353]         00000000 806a0000 00076891 00000000 00000000 00000000 ffffffff 00000000
 | 
			
		||||
[    3.524648]         806c0000 00000004 80e10000 806a0000 00000003 80690000 00000000 80700000
 | 
			
		||||
[    3.532942]         ...
 | 
			
		||||
[    3.535362] Call Trace:
 | 
			
		||||
[    3.537818] [<80010a48>] show_stack+0x58/0x100
 | 
			
		||||
[    3.542207] [<804c2f78>] dump_stack+0xe8/0x170
 | 
			
		||||
[    3.546613] [<80079f90>] save_trace+0xf0/0x110
 | 
			
		||||
[    3.551010] [<8007b1ec>] mark_lock+0x33c/0x78c
 | 
			
		||||
[    3.555413] [<8007bf48>] __lock_acquire+0x2ac/0x1a08
 | 
			
		||||
[    3.560337] [<8007de60>] lock_acquire+0x64/0x8c
 | 
			
		||||
[    3.564846] [<804e1570>] _raw_spin_lock_irqsave+0x54/0x78
 | 
			
		||||
[    3.570186] [<801b618c>] kernfs_notify+0x94/0xac
 | 
			
		||||
[    3.574770] [<801b7b10>] sysfs_notify+0x74/0xa0
 | 
			
		||||
[    3.579257] [<801b618c>] kernfs_notify+0x94/0xac
 | 
			
		||||
[    3.583839] [<801b7b10>] sysfs_notify+0x74/0xa0
 | 
			
		||||
[    3.588329] [<801b618c>] kernfs_notify+0x94/0xac
 | 
			
		||||
[    3.592911] [<801b7b10>] sysfs_notify+0x74/0xa0
 | 
			
		||||
[    3.597401] [<801b618c>] kernfs_notify+0x94/0xac
 | 
			
		||||
[    3.601983] [<801b7b10>] sysfs_notify+0x74/0xa0
 | 
			
		||||
[    3.606473] [<801b618c>] kernfs_notify+0x94/0xac
 | 
			
		||||
[    3.611055] [<801b7b10>] sysfs_notify+0x74/0xa0
 | 
			
		||||
[    3.615545] [<801b618c>] kernfs_notify+0x94/0xac
 | 
			
		||||
[    3.620125] [<801b7b10>] sysfs_notify+0x74/0xa0
 | 
			
		||||
[    3.624619] [<801b618c>] kernfs_notify+0x94/0xac
 | 
			
		||||
[    3.629197] [<801b7b10>] sysfs_notify+0x74/0xa0
 | 
			
		||||
[    3.633691] [<801b618c>] kernfs_notify+0x94/0xac
 | 
			
		||||
[    3.638269] [<801b7b10>] sysfs_notify+0x74/0xa0
 | 
			
		||||
[    3.642763] [<801b618c>] kernfs_notify+0x94/0xac
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
--- a/arch/mips/kernel/process.c
 | 
			
		||||
+++ b/arch/mips/kernel/process.c
 | 
			
		||||
@@ -395,6 +395,8 @@ static inline int is_sp_move_ins(union m
 | 
			
		||||
 
 | 
			
		||||
 	if (ip->i_format.opcode == addiu_op ||
 | 
			
		||||
 	    ip->i_format.opcode == daddiu_op) {
 | 
			
		||||
+		if (ip->i_format.simmediate > 0)
 | 
			
		||||
+			return 0;
 | 
			
		||||
 		*frame_size = -ip->i_format.simmediate;
 | 
			
		||||
 		return 1;
 | 
			
		||||
 	}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,75 @@
 | 
			
		|||
From bd1b9f66d5134e518419f4c4dacf1884c1616983 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
 | 
			
		||||
Date: Thu, 28 Apr 2022 11:13:23 +0200
 | 
			
		||||
Subject: [PATCH] watchdog: max63xx_wdt: Add support for specifying WDI logic
 | 
			
		||||
 via GPIO
 | 
			
		||||
MIME-Version: 1.0
 | 
			
		||||
Content-Type: text/plain; charset=UTF-8
 | 
			
		||||
Content-Transfer-Encoding: 8bit
 | 
			
		||||
 | 
			
		||||
On some boards is WDI logic of max6370 chip connected via GPIO.
 | 
			
		||||
So extend max63xx_wdt driver to allow specifying WDI logic via GPIO.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Pali Rohár <pali@kernel.org>
 | 
			
		||||
---
 | 
			
		||||
 drivers/watchdog/max63xx_wdt.c | 24 ++++++++++++++++++++++++
 | 
			
		||||
 1 file changed, 24 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/watchdog/max63xx_wdt.c
 | 
			
		||||
+++ b/drivers/watchdog/max63xx_wdt.c
 | 
			
		||||
@@ -24,6 +24,7 @@
 | 
			
		||||
 #include <linux/io.h>
 | 
			
		||||
 #include <linux/slab.h>
 | 
			
		||||
 #include <linux/property.h>
 | 
			
		||||
+#include <linux/gpio/consumer.h>
 | 
			
		||||
 
 | 
			
		||||
 #define DEFAULT_HEARTBEAT 60
 | 
			
		||||
 #define MAX_HEARTBEAT     60
 | 
			
		||||
@@ -50,6 +51,9 @@ struct max63xx_wdt {
 | 
			
		||||
 	void __iomem *base;
 | 
			
		||||
 	spinlock_t lock;
 | 
			
		||||
 
 | 
			
		||||
+	/* GPIOs */
 | 
			
		||||
+	struct gpio_desc *gpio_wdi;
 | 
			
		||||
+
 | 
			
		||||
 	/* WDI and WSET bits write access routines */
 | 
			
		||||
 	void (*ping)(struct max63xx_wdt *wdt);
 | 
			
		||||
 	void (*set)(struct max63xx_wdt *wdt, u8 set);
 | 
			
		||||
@@ -155,6 +159,17 @@ static const struct watchdog_info max63x
 | 
			
		||||
 	.identity = "max63xx Watchdog",
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+static void max63xx_gpio_ping(struct max63xx_wdt *wdt)
 | 
			
		||||
+{
 | 
			
		||||
+	spin_lock(&wdt->lock);
 | 
			
		||||
+
 | 
			
		||||
+	gpiod_set_value(wdt->gpio_wdi, 1);
 | 
			
		||||
+	udelay(1);
 | 
			
		||||
+	gpiod_set_value(wdt->gpio_wdi, 0);
 | 
			
		||||
+
 | 
			
		||||
+	spin_unlock(&wdt->lock);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static void max63xx_mmap_ping(struct max63xx_wdt *wdt)
 | 
			
		||||
 {
 | 
			
		||||
 	u8 val;
 | 
			
		||||
@@ -222,10 +237,19 @@ static int max63xx_wdt_probe(struct plat
 | 
			
		||||
 		return -EINVAL;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+	wdt->gpio_wdi = devm_gpiod_get(dev, NULL, GPIOD_FLAGS_BIT_DIR_OUT);
 | 
			
		||||
+	if (IS_ERR(wdt->gpio_wdi) && PTR_ERR(wdt->gpio_wdi) != -ENOENT)
 | 
			
		||||
+		return dev_err_probe(dev, PTR_ERR(wdt->gpio_wdi),
 | 
			
		||||
+				     "unable to request gpio: %ld\n",
 | 
			
		||||
+				     PTR_ERR(wdt->gpio_wdi));
 | 
			
		||||
+
 | 
			
		||||
 	err = max63xx_mmap_init(pdev, wdt);
 | 
			
		||||
 	if (err)
 | 
			
		||||
 		return err;
 | 
			
		||||
 
 | 
			
		||||
+	if (!IS_ERR(wdt->gpio_wdi))
 | 
			
		||||
+		wdt->ping = max63xx_gpio_ping;
 | 
			
		||||
+
 | 
			
		||||
 	platform_set_drvdata(pdev, &wdt->wdd);
 | 
			
		||||
 	watchdog_set_drvdata(&wdt->wdd, wdt);
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,82 @@
 | 
			
		|||
From: Tobias Wolf <dev-NTEO@vplace.de>
 | 
			
		||||
Subject: mm: Fix alloc_node_mem_map with ARCH_PFN_OFFSET calculation
 | 
			
		||||
 | 
			
		||||
An rt288x (ralink) based router (Belkin F5D8235 v1) does not boot with any
 | 
			
		||||
kernel beyond version 4.3 resulting in:
 | 
			
		||||
 | 
			
		||||
BUG: Bad page state in process swapper  pfn:086ac
 | 
			
		||||
 | 
			
		||||
bisect resulted in:
 | 
			
		||||
 | 
			
		||||
a1c34a3bf00af2cede839879502e12dc68491ad5 is the first bad commit
 | 
			
		||||
commit a1c34a3bf00af2cede839879502e12dc68491ad5
 | 
			
		||||
Author: Laura Abbott <laura@labbott.name>
 | 
			
		||||
Date:   Thu Nov 5 18:48:46 2015 -0800
 | 
			
		||||
 | 
			
		||||
    mm: Don't offset memmap for flatmem
 | 
			
		||||
 | 
			
		||||
    Srinivas Kandagatla reported bad page messages when trying to remove the
 | 
			
		||||
    bottom 2MB on an ARM based IFC6410 board
 | 
			
		||||
 | 
			
		||||
      BUG: Bad page state in process swapper  pfn:fffa8
 | 
			
		||||
      page:ef7fb500 count:0 mapcount:0 mapping:  (null) index:0x0
 | 
			
		||||
      flags: 0x96640253(locked|error|dirty|active|arch_1|reclaim|mlocked)
 | 
			
		||||
      page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set
 | 
			
		||||
      bad because of flags:
 | 
			
		||||
      flags: 0x200041(locked|active|mlocked)
 | 
			
		||||
      Modules linked in:
 | 
			
		||||
      CPU: 0 PID: 0 Comm: swapper Not tainted 3.19.0-rc3-00007-g412f9ba-dirty
 | 
			
		||||
#816
 | 
			
		||||
      Hardware name: Qualcomm (Flattened Device Tree)
 | 
			
		||||
        unwind_backtrace
 | 
			
		||||
        show_stack
 | 
			
		||||
        dump_stack
 | 
			
		||||
        bad_page
 | 
			
		||||
        free_pages_prepare
 | 
			
		||||
        free_hot_cold_page
 | 
			
		||||
        __free_pages
 | 
			
		||||
        free_highmem_page
 | 
			
		||||
        mem_init
 | 
			
		||||
        start_kernel
 | 
			
		||||
      Disabling lock debugging due to kernel taint
 | 
			
		||||
    [...]
 | 
			
		||||
:040000 040000 2de013c372345fd471cd58f0553c9b38b0ef1cc4
 | 
			
		||||
0a8156f848733dfa21e16c196dfb6c0a76290709 M      mm
 | 
			
		||||
 | 
			
		||||
This fix for ARM does not account ARCH_PFN_OFFSET for mem_map as later used by
 | 
			
		||||
page_to_pfn anymore.
 | 
			
		||||
 | 
			
		||||
The following output was generated with two hacked in printk statements:
 | 
			
		||||
 | 
			
		||||
printk("before %p vs. %p or %p\n", mem_map, mem_map - offset, mem_map -
 | 
			
		||||
(pgdat->node_start_pfn - ARCH_PFN_OFFSET));
 | 
			
		||||
		if (page_to_pfn(mem_map) != pgdat->node_start_pfn)
 | 
			
		||||
			mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET);
 | 
			
		||||
printk("after %p\n", mem_map);
 | 
			
		||||
 | 
			
		||||
Output:
 | 
			
		||||
 | 
			
		||||
[    0.000000] before 8861b280 vs. 8861b280 or 8851b280
 | 
			
		||||
[    0.000000] after 8851b280
 | 
			
		||||
 | 
			
		||||
As seen in the first line mem_map with subtraction of offset does not equal the
 | 
			
		||||
mem_map after subtraction of ARCH_PFN_OFFSET.
 | 
			
		||||
 | 
			
		||||
After adding the offset of ARCH_PFN_OFFSET as well to mem_map as the
 | 
			
		||||
previously calculated offset is zero for the named platform it is able to boot
 | 
			
		||||
4.4 and 4.9-rc7 again.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Tobias Wolf <dev-NTEO@vplace.de>
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
--- a/mm/mm_init.c
 | 
			
		||||
+++ b/mm/mm_init.c
 | 
			
		||||
@@ -1673,7 +1673,7 @@ static void __init alloc_node_mem_map(st
 | 
			
		||||
 	if (pgdat == NODE_DATA(0)) {
 | 
			
		||||
 		mem_map = NODE_DATA(0)->node_mem_map;
 | 
			
		||||
 		if (page_to_pfn(mem_map) != pgdat->node_start_pfn)
 | 
			
		||||
-			mem_map -= offset;
 | 
			
		||||
+			mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET);
 | 
			
		||||
 	}
 | 
			
		||||
 #endif
 | 
			
		||||
 }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,81 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Subject: jffs2: use .rename2 and add RENAME_WHITEOUT support
 | 
			
		||||
 | 
			
		||||
It is required for renames on overlayfs
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
--- a/fs/jffs2/dir.c
 | 
			
		||||
+++ b/fs/jffs2/dir.c
 | 
			
		||||
@@ -617,8 +617,8 @@ static int jffs2_rmdir (struct inode *di
 | 
			
		||||
 	return ret;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
-static int jffs2_mknod (struct mnt_idmap *idmap, struct inode *dir_i,
 | 
			
		||||
-		        struct dentry *dentry, umode_t mode, dev_t rdev)
 | 
			
		||||
+static int __jffs2_mknod (struct mnt_idmap *idmap, struct inode *dir_i,
 | 
			
		||||
+		          struct dentry *dentry, umode_t mode, dev_t rdev, bool whiteout)
 | 
			
		||||
 {
 | 
			
		||||
 	struct jffs2_inode_info *f, *dir_f;
 | 
			
		||||
 	struct jffs2_sb_info *c;
 | 
			
		||||
@@ -758,7 +758,11 @@ static int jffs2_mknod (struct mnt_idmap
 | 
			
		||||
 	mutex_unlock(&dir_f->sem);
 | 
			
		||||
 	jffs2_complete_reservation(c);
 | 
			
		||||
 
 | 
			
		||||
-	d_instantiate_new(dentry, inode);
 | 
			
		||||
+	if (!whiteout)
 | 
			
		||||
+		d_instantiate_new(dentry, inode);
 | 
			
		||||
+	else
 | 
			
		||||
+		unlock_new_inode(inode);
 | 
			
		||||
+
 | 
			
		||||
 	return 0;
 | 
			
		||||
 
 | 
			
		||||
  fail:
 | 
			
		||||
@@ -766,6 +770,19 @@ static int jffs2_mknod (struct mnt_idmap
 | 
			
		||||
 	return ret;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static int jffs2_mknod (struct mnt_idmap *idmap, struct inode *dir_i,
 | 
			
		||||
+			struct dentry *dentry, umode_t mode, dev_t rdev)
 | 
			
		||||
+{
 | 
			
		||||
+	return __jffs2_mknod(idmap, dir_i, dentry, mode, rdev, false);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int jffs2_whiteout (struct mnt_idmap *idmap, struct inode *old_dir,
 | 
			
		||||
+			   struct dentry *old_dentry)
 | 
			
		||||
+{
 | 
			
		||||
+	return __jffs2_mknod(idmap, old_dir, old_dentry, S_IFCHR | WHITEOUT_MODE,
 | 
			
		||||
+			     WHITEOUT_DEV, true);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static int jffs2_rename (struct mnt_idmap *idmap,
 | 
			
		||||
 			 struct inode *old_dir_i, struct dentry *old_dentry,
 | 
			
		||||
 			 struct inode *new_dir_i, struct dentry *new_dentry,
 | 
			
		||||
@@ -777,7 +794,7 @@ static int jffs2_rename (struct mnt_idma
 | 
			
		||||
 	uint8_t type;
 | 
			
		||||
 	uint32_t now;
 | 
			
		||||
 
 | 
			
		||||
-	if (flags & ~RENAME_NOREPLACE)
 | 
			
		||||
+	if (flags & ~(RENAME_NOREPLACE|RENAME_WHITEOUT))
 | 
			
		||||
 		return -EINVAL;
 | 
			
		||||
 
 | 
			
		||||
 	/* The VFS will check for us and prevent trying to rename a
 | 
			
		||||
@@ -843,9 +860,14 @@ static int jffs2_rename (struct mnt_idma
 | 
			
		||||
 	if (d_is_dir(old_dentry) && !victim_f)
 | 
			
		||||
 		inc_nlink(new_dir_i);
 | 
			
		||||
 
 | 
			
		||||
-	/* Unlink the original */
 | 
			
		||||
-	ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i),
 | 
			
		||||
-			      old_dentry->d_name.name, old_dentry->d_name.len, NULL, now);
 | 
			
		||||
+	if (flags & RENAME_WHITEOUT)
 | 
			
		||||
+		/* Replace with whiteout */
 | 
			
		||||
+		ret = jffs2_whiteout(idmap, old_dir_i, old_dentry);
 | 
			
		||||
+	else
 | 
			
		||||
+		/* Unlink the original */
 | 
			
		||||
+		ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i),
 | 
			
		||||
+				      old_dentry->d_name.name,
 | 
			
		||||
+				      old_dentry->d_name.len, NULL, now);
 | 
			
		||||
 
 | 
			
		||||
 	/* We don't touch inode->i_nlink */
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,73 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Subject: jffs2: add RENAME_EXCHANGE support
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
--- a/fs/jffs2/dir.c
 | 
			
		||||
+++ b/fs/jffs2/dir.c
 | 
			
		||||
@@ -791,18 +791,31 @@ static int jffs2_rename (struct mnt_idma
 | 
			
		||||
 	int ret;
 | 
			
		||||
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb);
 | 
			
		||||
 	struct jffs2_inode_info *victim_f = NULL;
 | 
			
		||||
+	struct inode *fst_inode = d_inode(old_dentry);
 | 
			
		||||
+	struct inode *snd_inode = d_inode(new_dentry);
 | 
			
		||||
 	uint8_t type;
 | 
			
		||||
 	uint32_t now;
 | 
			
		||||
 
 | 
			
		||||
-	if (flags & ~(RENAME_NOREPLACE|RENAME_WHITEOUT))
 | 
			
		||||
+	if (flags & ~(RENAME_NOREPLACE|RENAME_WHITEOUT|RENAME_EXCHANGE))
 | 
			
		||||
 		return -EINVAL;
 | 
			
		||||
 
 | 
			
		||||
+	if ((flags & RENAME_EXCHANGE) && (old_dir_i != new_dir_i)) {
 | 
			
		||||
+		if (S_ISDIR(fst_inode->i_mode) && !S_ISDIR(snd_inode->i_mode)) {
 | 
			
		||||
+			inc_nlink(new_dir_i);
 | 
			
		||||
+			drop_nlink(old_dir_i);
 | 
			
		||||
+		}
 | 
			
		||||
+		else if (!S_ISDIR(fst_inode->i_mode) && S_ISDIR(snd_inode->i_mode)) {
 | 
			
		||||
+			drop_nlink(new_dir_i);
 | 
			
		||||
+			inc_nlink(old_dir_i);
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	/* The VFS will check for us and prevent trying to rename a
 | 
			
		||||
 	 * file over a directory and vice versa, but if it's a directory,
 | 
			
		||||
 	 * the VFS can't check whether the victim is empty. The filesystem
 | 
			
		||||
 	 * needs to do that for itself.
 | 
			
		||||
 	 */
 | 
			
		||||
-	if (d_really_is_positive(new_dentry)) {
 | 
			
		||||
+	if (d_really_is_positive(new_dentry) && !(flags & RENAME_EXCHANGE)) {
 | 
			
		||||
 		victim_f = JFFS2_INODE_INFO(d_inode(new_dentry));
 | 
			
		||||
 		if (d_is_dir(new_dentry)) {
 | 
			
		||||
 			struct jffs2_full_dirent *fd;
 | 
			
		||||
@@ -837,7 +850,7 @@ static int jffs2_rename (struct mnt_idma
 | 
			
		||||
 	if (ret)
 | 
			
		||||
 		return ret;
 | 
			
		||||
 
 | 
			
		||||
-	if (victim_f) {
 | 
			
		||||
+	if (victim_f && !(flags & RENAME_EXCHANGE)) {
 | 
			
		||||
 		/* There was a victim. Kill it off nicely */
 | 
			
		||||
 		if (d_is_dir(new_dentry))
 | 
			
		||||
 			clear_nlink(d_inode(new_dentry));
 | 
			
		||||
@@ -863,6 +876,12 @@ static int jffs2_rename (struct mnt_idma
 | 
			
		||||
 	if (flags & RENAME_WHITEOUT)
 | 
			
		||||
 		/* Replace with whiteout */
 | 
			
		||||
 		ret = jffs2_whiteout(idmap, old_dir_i, old_dentry);
 | 
			
		||||
+	else if (flags & RENAME_EXCHANGE)
 | 
			
		||||
+		/* Replace the original */
 | 
			
		||||
+		ret = jffs2_do_link(c, JFFS2_INODE_INFO(old_dir_i),
 | 
			
		||||
+				    d_inode(new_dentry)->i_ino, type,
 | 
			
		||||
+				    old_dentry->d_name.name, old_dentry->d_name.len,
 | 
			
		||||
+				    now);
 | 
			
		||||
 	else
 | 
			
		||||
 		/* Unlink the original */
 | 
			
		||||
 		ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i),
 | 
			
		||||
@@ -895,7 +914,7 @@ static int jffs2_rename (struct mnt_idma
 | 
			
		||||
 		return ret;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
-	if (d_is_dir(old_dentry))
 | 
			
		||||
+	if (d_is_dir(old_dentry) && !(flags & RENAME_EXCHANGE))
 | 
			
		||||
 		drop_nlink(old_dir_i);
 | 
			
		||||
 
 | 
			
		||||
 	old_dir_i->i_mtime = inode_set_ctime_to_ts(old_dir_i, ITIME(now));
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Subject: jffs2: add splice ops
 | 
			
		||||
 | 
			
		||||
Add splice_read using generic_file_splice_read.
 | 
			
		||||
Add splice_write using iter_file_splice_write
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
--- a/fs/jffs2/file.c
 | 
			
		||||
+++ b/fs/jffs2/file.c
 | 
			
		||||
@@ -53,6 +53,8 @@ const struct file_operations jffs2_file_
 | 
			
		||||
 	.open =		generic_file_open,
 | 
			
		||||
  	.read_iter =	generic_file_read_iter,
 | 
			
		||||
  	.write_iter =	generic_file_write_iter,
 | 
			
		||||
+	.splice_read =	filemap_splice_read,
 | 
			
		||||
+	.splice_write =	iter_file_splice_write,
 | 
			
		||||
 	.unlocked_ioctl=jffs2_ioctl,
 | 
			
		||||
 	.mmap =		generic_file_readonly_mmap,
 | 
			
		||||
 	.fsync =	jffs2_fsync,
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
From: Stephen Hemminger <stephen@networkplumber.org>
 | 
			
		||||
Subject: bridge: allow receiption on disabled port
 | 
			
		||||
 | 
			
		||||
When an ethernet device is enslaved to a bridge, and the bridge STP
 | 
			
		||||
detects loss of carrier (or operational state down), then normally
 | 
			
		||||
packet receiption is blocked.
 | 
			
		||||
 | 
			
		||||
This breaks control applications like WPA which maybe expecting to
 | 
			
		||||
receive packets to negotiate to bring link up. The bridge needs to
 | 
			
		||||
block forwarding packets from these disabled ports, but there is no
 | 
			
		||||
hard requirement to not allow local packet delivery.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
 | 
			
		||||
--- a/net/bridge/br_input.c
 | 
			
		||||
+++ b/net/bridge/br_input.c
 | 
			
		||||
@@ -244,6 +244,9 @@ static void __br_handle_local_finish(str
 | 
			
		||||
 /* note: already called with rcu_read_lock */
 | 
			
		||||
 static int br_handle_local_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
 | 
			
		||||
 {
 | 
			
		||||
+	struct net_bridge_port *p = br_port_get_rcu(skb->dev);
 | 
			
		||||
+
 | 
			
		||||
+	if (p->state != BR_STATE_DISABLED)
 | 
			
		||||
 	__br_handle_local_finish(skb);
 | 
			
		||||
 
 | 
			
		||||
 	/* return 1 to signal the okfn() was called so it's ok to use the skb */
 | 
			
		||||
@@ -415,6 +418,17 @@ forward:
 | 
			
		||||
 		goto defer_stp_filtering;
 | 
			
		||||
 
 | 
			
		||||
 	switch (p->state) {
 | 
			
		||||
+	case BR_STATE_DISABLED:
 | 
			
		||||
+		if (ether_addr_equal(p->br->dev->dev_addr, dest))
 | 
			
		||||
+			skb->pkt_type = PACKET_HOST;
 | 
			
		||||
+
 | 
			
		||||
+		if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING,
 | 
			
		||||
+			dev_net(skb->dev), NULL, skb, skb->dev, NULL,
 | 
			
		||||
+			br_handle_local_finish) == 1) {
 | 
			
		||||
+			return RX_HANDLER_PASS;
 | 
			
		||||
+		}
 | 
			
		||||
+		break;
 | 
			
		||||
+
 | 
			
		||||
 	case BR_STATE_FORWARDING:
 | 
			
		||||
 	case BR_STATE_LEARNING:
 | 
			
		||||
 defer_stp_filtering:
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Date: Thu, 4 Jan 2024 15:21:21 +0100
 | 
			
		||||
Subject: [PATCH] net: bridge: do not send arp replies if src and target hw
 | 
			
		||||
 addr is the same
 | 
			
		||||
 | 
			
		||||
There are broken devices in the wild that handle duplicate IP address
 | 
			
		||||
detection by sending out ARP requests for the IP that they received from a
 | 
			
		||||
DHCP server and refuse the address if they get a reply.
 | 
			
		||||
When proxyarp is enabled, they would go into a loop of requesting an address
 | 
			
		||||
and then NAKing it again.
 | 
			
		||||
 | 
			
		||||
Link: https://github.com/openwrt/openwrt/issues/14309
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
--- a/net/bridge/br_arp_nd_proxy.c
 | 
			
		||||
+++ b/net/bridge/br_arp_nd_proxy.c
 | 
			
		||||
@@ -204,7 +204,10 @@ void br_do_proxy_suppress_arp(struct sk_
 | 
			
		||||
 			if ((p && (p->flags & BR_PROXYARP)) ||
 | 
			
		||||
 			    (f->dst && (f->dst->flags & BR_PROXYARP_WIFI)) ||
 | 
			
		||||
 			    br_is_neigh_suppress_enabled(f->dst, vid)) {
 | 
			
		||||
-				if (!vid)
 | 
			
		||||
+				replied = true;
 | 
			
		||||
+				if (!memcmp(n->ha, sha, dev->addr_len))
 | 
			
		||||
+					replied = false;
 | 
			
		||||
+				else if (!vid)
 | 
			
		||||
 					br_arp_send(br, p, skb->dev, sip, tip,
 | 
			
		||||
 						    sha, n->ha, sha, 0, 0);
 | 
			
		||||
 				else
 | 
			
		||||
@@ -212,7 +215,6 @@ void br_do_proxy_suppress_arp(struct sk_
 | 
			
		||||
 						    sha, n->ha, sha,
 | 
			
		||||
 						    skb->vlan_proto,
 | 
			
		||||
 						    skb_vlan_tag_get(skb));
 | 
			
		||||
-				replied = true;
 | 
			
		||||
 			}
 | 
			
		||||
 
 | 
			
		||||
 			/* If we have replied or as long as we know the
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,94 @@
 | 
			
		|||
From: Daniel González Cabanelas <dgcbueu@gmail.com>
 | 
			
		||||
Subject: [PATCH 1/2] rtc: rs5c372: support alarms up to 1 week
 | 
			
		||||
 | 
			
		||||
The Ricoh R2221x, R2223x, RS5C372, RV5C387A chips can handle 1 week
 | 
			
		||||
alarms.
 | 
			
		||||
 | 
			
		||||
Read the "wday" alarm register and convert it to a date to support up 1
 | 
			
		||||
week in our driver.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
 drivers/rtc/rtc-rs5c372.c | 48 ++++++++++++++++++++++++++++++++++-----
 | 
			
		||||
 1 file changed, 42 insertions(+), 6 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/rtc/rtc-rs5c372.c
 | 
			
		||||
+++ b/drivers/rtc/rtc-rs5c372.c
 | 
			
		||||
@@ -399,7 +399,9 @@ static int rs5c_read_alarm(struct device
 | 
			
		||||
 {
 | 
			
		||||
 	struct i2c_client	*client = to_i2c_client(dev);
 | 
			
		||||
 	struct rs5c372		*rs5c = i2c_get_clientdata(client);
 | 
			
		||||
-	int			status;
 | 
			
		||||
+	int			status, wday_offs;
 | 
			
		||||
+	struct rtc_time 	rtc;
 | 
			
		||||
+	unsigned long 		alarm_secs;
 | 
			
		||||
 
 | 
			
		||||
 	status = rs5c_get_regs(rs5c);
 | 
			
		||||
 	if (status < 0)
 | 
			
		||||
@@ -409,6 +411,30 @@ static int rs5c_read_alarm(struct device
 | 
			
		||||
 	t->time.tm_sec = 0;
 | 
			
		||||
 	t->time.tm_min = bcd2bin(rs5c->regs[RS5C_REG_ALARM_A_MIN] & 0x7f);
 | 
			
		||||
 	t->time.tm_hour = rs5c_reg2hr(rs5c, rs5c->regs[RS5C_REG_ALARM_A_HOURS]);
 | 
			
		||||
+	t->time.tm_wday = ffs(rs5c->regs[RS5C_REG_ALARM_A_WDAY] & 0x7f) - 1;
 | 
			
		||||
+
 | 
			
		||||
+	/* determine the day, month and year based on alarm wday, taking as a
 | 
			
		||||
+	 * reference the current time from the rtc
 | 
			
		||||
+	 */
 | 
			
		||||
+	status = rs5c372_rtc_read_time(dev, &rtc);
 | 
			
		||||
+	if (status < 0)
 | 
			
		||||
+		return status;
 | 
			
		||||
+
 | 
			
		||||
+	wday_offs = t->time.tm_wday - rtc.tm_wday;
 | 
			
		||||
+	alarm_secs = mktime64(rtc.tm_year + 1900,
 | 
			
		||||
+			      rtc.tm_mon + 1,
 | 
			
		||||
+			      rtc.tm_mday + wday_offs,
 | 
			
		||||
+			      t->time.tm_hour,
 | 
			
		||||
+			      t->time.tm_min,
 | 
			
		||||
+			      t->time.tm_sec);
 | 
			
		||||
+
 | 
			
		||||
+	if (wday_offs < 0 || (wday_offs == 0 &&
 | 
			
		||||
+			      (t->time.tm_hour < rtc.tm_hour ||
 | 
			
		||||
+			       (t->time.tm_hour == rtc.tm_hour &&
 | 
			
		||||
+				t->time.tm_min <= rtc.tm_min))))
 | 
			
		||||
+		alarm_secs += 7 * 86400;
 | 
			
		||||
+
 | 
			
		||||
+	rtc_time64_to_tm(alarm_secs, &t->time);
 | 
			
		||||
 
 | 
			
		||||
 	/* ... and status */
 | 
			
		||||
 	t->enabled = !!(rs5c->regs[RS5C_REG_CTRL1] & RS5C_CTRL1_AALE);
 | 
			
		||||
@@ -423,12 +449,20 @@ static int rs5c_set_alarm(struct device
 | 
			
		||||
 	struct rs5c372		*rs5c = i2c_get_clientdata(client);
 | 
			
		||||
 	int			status, addr, i;
 | 
			
		||||
 	unsigned char		buf[3];
 | 
			
		||||
+	struct rtc_time 	rtc_tm;
 | 
			
		||||
+	unsigned long 		rtc_secs, alarm_secs;
 | 
			
		||||
 
 | 
			
		||||
-	/* only handle up to 24 hours in the future, like RTC_ALM_SET */
 | 
			
		||||
-	if (t->time.tm_mday != -1
 | 
			
		||||
-			|| t->time.tm_mon != -1
 | 
			
		||||
-			|| t->time.tm_year != -1)
 | 
			
		||||
+	/* chip only can handle alarms up to one week in the future*/
 | 
			
		||||
+	status = rs5c372_rtc_read_time(dev, &rtc_tm);
 | 
			
		||||
+	if (status)
 | 
			
		||||
+		return status;
 | 
			
		||||
+	rtc_secs = rtc_tm_to_time64(&rtc_tm);
 | 
			
		||||
+	alarm_secs = rtc_tm_to_time64(&t->time);
 | 
			
		||||
+	if (alarm_secs >= rtc_secs + 7 * 86400) {
 | 
			
		||||
+		dev_err(dev, "%s: alarm maximum is one week in the future (%d)\n",
 | 
			
		||||
+			__func__, status);
 | 
			
		||||
 		return -EINVAL;
 | 
			
		||||
+	}
 | 
			
		||||
 
 | 
			
		||||
 	/* REVISIT: round up tm_sec */
 | 
			
		||||
 
 | 
			
		||||
@@ -449,7 +483,9 @@ static int rs5c_set_alarm(struct device
 | 
			
		||||
 	/* set alarm */
 | 
			
		||||
 	buf[0] = bin2bcd(t->time.tm_min);
 | 
			
		||||
 	buf[1] = rs5c_hr2reg(rs5c, t->time.tm_hour);
 | 
			
		||||
-	buf[2] = 0x7f;	/* any/all days */
 | 
			
		||||
+	/* each bit is the day of the week, 0x7f means all days */
 | 
			
		||||
+	buf[2] = (t->time.tm_wday >= 0 && t->time.tm_wday < 7) ?
 | 
			
		||||
+		  BIT(t->time.tm_wday) : 0x7f;
 | 
			
		||||
 
 | 
			
		||||
 	for (i = 0; i < sizeof(buf); i++) {
 | 
			
		||||
 		addr = RS5C_ADDR(RS5C_REG_ALARM_A_MIN + i);
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,41 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Subject: kernel: when KALLSYMS is disabled, print module address + size for matching backtrace entries
 | 
			
		||||
 | 
			
		||||
[john@phrozen.org: felix will add this to his upstream queue]
 | 
			
		||||
 | 
			
		||||
lede-commit 53827cdc824556cda910b23ce5030c363b8f1461
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 lib/vsprintf.c | 15 +++++++++++----
 | 
			
		||||
 1 file changed, 11 insertions(+), 4 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/lib/vsprintf.c
 | 
			
		||||
+++ b/lib/vsprintf.c
 | 
			
		||||
@@ -982,8 +982,10 @@ char *symbol_string(char *buf, char *end
 | 
			
		||||
 		    struct printf_spec spec, const char *fmt)
 | 
			
		||||
 {
 | 
			
		||||
 	unsigned long value;
 | 
			
		||||
-#ifdef CONFIG_KALLSYMS
 | 
			
		||||
 	char sym[KSYM_SYMBOL_LEN];
 | 
			
		||||
+#ifndef CONFIG_KALLSYMS
 | 
			
		||||
+	struct module *mod;
 | 
			
		||||
+	int len;
 | 
			
		||||
 #endif
 | 
			
		||||
 
 | 
			
		||||
 	if (fmt[1] == 'R')
 | 
			
		||||
@@ -1004,8 +1006,14 @@ char *symbol_string(char *buf, char *end
 | 
			
		||||
 
 | 
			
		||||
 	return string_nocheck(buf, end, sym, spec);
 | 
			
		||||
 #else
 | 
			
		||||
-	return special_hex_number(buf, end, value, sizeof(void *));
 | 
			
		||||
+	len = snprintf(sym, sizeof(sym), "0x%lx", value);
 | 
			
		||||
+	mod = __module_address(value);
 | 
			
		||||
+	if (mod)
 | 
			
		||||
+		snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]",
 | 
			
		||||
+			 mod->name, mod->mem[MOD_TEXT].base,
 | 
			
		||||
+			 mod->mem[MOD_TEXT].size);
 | 
			
		||||
 #endif
 | 
			
		||||
+	return string(buf, end, sym, spec);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static const struct printf_spec default_str_spec = {
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
From: Gabor Juhos <juhosg@openwrt.org>
 | 
			
		||||
Subject: usr: sanitize deps_initramfs list
 | 
			
		||||
 | 
			
		||||
If any filename in the intramfs dependency
 | 
			
		||||
list contains a colon, that causes a kernel
 | 
			
		||||
build error like this:
 | 
			
		||||
 | 
			
		||||
/devel/openwrt/build_dir/linux-ar71xx_generic/linux-3.6.6/usr/Makefile:58: *** multiple target patterns.  Stop.
 | 
			
		||||
make[5]: *** [usr] Error 2
 | 
			
		||||
 | 
			
		||||
Fix it by removing such filenames from the
 | 
			
		||||
deps_initramfs list.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 usr/Makefile | 8 +++++---
 | 
			
		||||
 1 file changed, 5 insertions(+), 3 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/usr/Makefile
 | 
			
		||||
+++ b/usr/Makefile
 | 
			
		||||
@@ -56,6 +56,8 @@ hostprogs := gen_init_cpio
 | 
			
		||||
 # The dependency list is generated by gen_initramfs.sh -l
 | 
			
		||||
 -include $(obj)/.initramfs_data.cpio.d
 | 
			
		||||
 
 | 
			
		||||
+deps_initramfs := $(foreach v,$(deps_initramfs),$(if $(findstring :,$(v)),,$(v)))
 | 
			
		||||
+
 | 
			
		||||
 # do not try to update files included in initramfs
 | 
			
		||||
 $(deps_initramfs): ;
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
From: Mark Miller <mark@mirell.org>
 | 
			
		||||
Subject: mips: expose CONFIG_BOOT_RAW
 | 
			
		||||
 | 
			
		||||
This exposes the CONFIG_BOOT_RAW symbol in Kconfig. This is needed on
 | 
			
		||||
certain Broadcom chipsets running CFE in order to load the kernel.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Mark Miller <mark@mirell.org>
 | 
			
		||||
Acked-by: Rob Landley <rob@landley.net>
 | 
			
		||||
---
 | 
			
		||||
--- a/arch/mips/Kconfig
 | 
			
		||||
+++ b/arch/mips/Kconfig
 | 
			
		||||
@@ -1013,9 +1013,6 @@ config FW_ARC
 | 
			
		||||
 config ARCH_MAY_HAVE_PC_FDC
 | 
			
		||||
 	bool
 | 
			
		||||
 
 | 
			
		||||
-config BOOT_RAW
 | 
			
		||||
-	bool
 | 
			
		||||
-
 | 
			
		||||
 config CEVT_BCM1480
 | 
			
		||||
 	bool
 | 
			
		||||
 
 | 
			
		||||
@@ -2996,6 +2993,18 @@ choice
 | 
			
		||||
 		bool "Extend builtin kernel arguments with bootloader arguments"
 | 
			
		||||
 endchoice
 | 
			
		||||
 
 | 
			
		||||
+config BOOT_RAW
 | 
			
		||||
+	bool "Enable the kernel to be executed from the load address"
 | 
			
		||||
+	default n
 | 
			
		||||
+	help
 | 
			
		||||
+	 Allow the kernel to be executed from the load address for
 | 
			
		||||
+	 bootloaders which cannot read the ELF format. This places
 | 
			
		||||
+	 a jump to start_kernel at the load address.
 | 
			
		||||
+
 | 
			
		||||
+	 If unsure, say N.
 | 
			
		||||
+
 | 
			
		||||
+
 | 
			
		||||
+
 | 
			
		||||
 endmenu
 | 
			
		||||
 
 | 
			
		||||
 config LOCKDEP_SUPPORT
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,71 @@
 | 
			
		|||
From e6e6ef4275978823ec3a84133fc91f4ffbef5c84 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Paul Burton <paul.burton@imgtec.com>
 | 
			
		||||
Date: Mon, 22 Feb 2016 18:09:44 +0000
 | 
			
		||||
Subject: [PATCH] MIPS: Add barriers between dcache & icache flushes
 | 
			
		||||
 | 
			
		||||
Index-based cache operations may be arbitrarily reordered by out of
 | 
			
		||||
order CPUs. Thus code which writes back the dcache & then invalidates
 | 
			
		||||
the icache using indexed cache ops must include a barrier between
 | 
			
		||||
operating on the 2 caches in order to prevent the scenario in which:
 | 
			
		||||
 | 
			
		||||
  - icache invalidation occurs.
 | 
			
		||||
 | 
			
		||||
  - icache fetch occurs, due to speculation.
 | 
			
		||||
 | 
			
		||||
  - dcache writeback occurs.
 | 
			
		||||
 | 
			
		||||
If the above were allowed to happen then the icache would contain stale
 | 
			
		||||
data. Forcing the dcache writeback to complete before the icache
 | 
			
		||||
invalidation avoids this.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
 | 
			
		||||
Cc: James Hogan <james.hogan@imgtec.com>
 | 
			
		||||
---
 | 
			
		||||
 arch/mips/mm/c-r4k.c | 13 +++++++++++--
 | 
			
		||||
 1 file changed, 11 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/arch/mips/mm/c-r4k.c
 | 
			
		||||
+++ b/arch/mips/mm/c-r4k.c
 | 
			
		||||
@@ -403,6 +403,7 @@ static inline void local_r4k___flush_cac
 | 
			
		||||
 
 | 
			
		||||
 	default:
 | 
			
		||||
 		r4k_blast_dcache();
 | 
			
		||||
+		mb(); /* cache instructions may be reordered */
 | 
			
		||||
 		r4k_blast_icache();
 | 
			
		||||
 		break;
 | 
			
		||||
 	}
 | 
			
		||||
@@ -483,8 +484,10 @@ static inline void local_r4k_flush_cache
 | 
			
		||||
 	if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc))
 | 
			
		||||
 		r4k_blast_dcache();
 | 
			
		||||
 	/* If executable, blast stale lines from icache */
 | 
			
		||||
-	if (exec)
 | 
			
		||||
+	if (exec) {
 | 
			
		||||
+		mb(); /* cache instructions may be reordered */
 | 
			
		||||
 		r4k_blast_icache();
 | 
			
		||||
+	}
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static void r4k_flush_cache_range(struct vm_area_struct *vma,
 | 
			
		||||
@@ -586,8 +589,13 @@ static inline void local_r4k_flush_cache
 | 
			
		||||
 	if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) {
 | 
			
		||||
 		vaddr ? r4k_blast_dcache_page(addr) :
 | 
			
		||||
 			r4k_blast_dcache_user_page(addr);
 | 
			
		||||
-		if (exec && !cpu_icache_snoops_remote_store)
 | 
			
		||||
+		if (exec)
 | 
			
		||||
+			mb(); /* cache instructions may be reordered */
 | 
			
		||||
+
 | 
			
		||||
+		if (exec && !cpu_icache_snoops_remote_store) {
 | 
			
		||||
 			r4k_blast_scache_page(addr);
 | 
			
		||||
+			mb(); /* cache instructions may be reordered */
 | 
			
		||||
+		}
 | 
			
		||||
 	}
 | 
			
		||||
 	if (exec) {
 | 
			
		||||
 		if (vaddr && cpu_has_vtag_icache && mm == current->active_mm) {
 | 
			
		||||
@@ -654,6 +662,7 @@ static inline void __local_r4k_flush_ica
 | 
			
		||||
 			else
 | 
			
		||||
 				blast_dcache_range(start, end);
 | 
			
		||||
 		}
 | 
			
		||||
+		mb(); /* cache instructions may be reordered */
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
 	if (type == R4K_INDEX ||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Subject: mips: use -mno-branch-likely for kernel and userspace
 | 
			
		||||
 | 
			
		||||
saves ~11k kernel size after lzma and ~12k squashfs size in the
 | 
			
		||||
 | 
			
		||||
lede-commit: 41a039f46450ffae9483d6216422098669da2900
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 arch/mips/Makefile | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/arch/mips/Makefile
 | 
			
		||||
+++ b/arch/mips/Makefile
 | 
			
		||||
@@ -94,7 +94,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
 | 
			
		||||
 # machines may also.  Since BFD is incredibly buggy with respect to
 | 
			
		||||
 # crossformat linking we rely on the elf2ecoff tool for format conversion.
 | 
			
		||||
 #
 | 
			
		||||
-cflags-y			+= -G 0 -mno-abicalls -fno-pic -pipe
 | 
			
		||||
+cflags-y			+= -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely
 | 
			
		||||
 cflags-y			+= -msoft-float -Wa,-msoft-float
 | 
			
		||||
 LDFLAGS_vmlinux			+= -G 0 -static -n -nostdlib
 | 
			
		||||
 KBUILD_AFLAGS_MODULE		+= -mlong-calls
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Subject: kernel: add -mtune=34kc to MIPS CFLAGS when building for mips32r2
 | 
			
		||||
 | 
			
		||||
This provides a good tradeoff across at least 24Kc-74Kc, while also
 | 
			
		||||
producing smaller code.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 arch/mips/Makefile | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/arch/mips/Makefile
 | 
			
		||||
+++ b/arch/mips/Makefile
 | 
			
		||||
@@ -163,7 +163,7 @@ cflags-$(CONFIG_CPU_R4300)	+= -march=r43
 | 
			
		||||
 cflags-$(CONFIG_CPU_R4X00)	+= -march=r4600 -Wa,--trap
 | 
			
		||||
 cflags-$(CONFIG_CPU_TX49XX)	+= -march=r4600 -Wa,--trap
 | 
			
		||||
 cflags-$(CONFIG_CPU_MIPS32_R1)	+= -march=mips32 -Wa,--trap
 | 
			
		||||
-cflags-$(CONFIG_CPU_MIPS32_R2)	+= -march=mips32r2 -Wa,--trap
 | 
			
		||||
+cflags-$(CONFIG_CPU_MIPS32_R2)	+= -march=mips32r2 -mtune=34kc -Wa,--trap
 | 
			
		||||
 cflags-$(CONFIG_CPU_MIPS32_R5)	+= -march=mips32r5 -Wa,--trap -modd-spreg
 | 
			
		||||
 cflags-$(CONFIG_CPU_MIPS32_R6)	+= -march=mips32r6 -Wa,--trap -modd-spreg
 | 
			
		||||
 cflags-$(CONFIG_CPU_MIPS64_R1)	+= -march=mips64 -Wa,--trap
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
From: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
Subject: fix errors in unresolved weak symbols on arm
 | 
			
		||||
 | 
			
		||||
lede-commit: 570699d4838a907c3ef9f2819bf19eb72997b32f
 | 
			
		||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
---
 | 
			
		||||
 arch/arm/kernel/module.c | 4 ++++
 | 
			
		||||
 1 file changed, 4 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/arch/arm/kernel/module.c
 | 
			
		||||
+++ b/arch/arm/kernel/module.c
 | 
			
		||||
@@ -146,6 +146,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons
 | 
			
		||||
 			return -ENOEXEC;
 | 
			
		||||
 		}
 | 
			
		||||
 
 | 
			
		||||
+		if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) &&
 | 
			
		||||
+		    ELF_ST_BIND(sym->st_info) == STB_WEAK)
 | 
			
		||||
+			continue;
 | 
			
		||||
+
 | 
			
		||||
 		loc = dstsec->sh_addr + rel->r_offset;
 | 
			
		||||
 
 | 
			
		||||
 		switch (ELF32_R_TYPE(rel->r_info)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,282 @@
 | 
			
		|||
From: Yousong Zhou <yszhou4tech@gmail.com>
 | 
			
		||||
Subject: MIPS: kexec: Accept command line parameters from userspace.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
 arch/mips/kernel/machine_kexec.c   |  153 +++++++++++++++++++++++++++++++-----
 | 
			
		||||
 arch/mips/kernel/machine_kexec.h   |   20 +++++
 | 
			
		||||
 arch/mips/kernel/relocate_kernel.S |   21 +++--
 | 
			
		||||
 3 files changed, 167 insertions(+), 27 deletions(-)
 | 
			
		||||
 create mode 100644 arch/mips/kernel/machine_kexec.h
 | 
			
		||||
 | 
			
		||||
--- a/arch/mips/kernel/machine_kexec.c
 | 
			
		||||
+++ b/arch/mips/kernel/machine_kexec.c
 | 
			
		||||
@@ -9,14 +9,11 @@
 | 
			
		||||
 #include <linux/delay.h>
 | 
			
		||||
 #include <linux/libfdt.h>
 | 
			
		||||
 
 | 
			
		||||
+#include <asm/bootinfo.h>
 | 
			
		||||
 #include <asm/cacheflush.h>
 | 
			
		||||
 #include <asm/page.h>
 | 
			
		||||
-
 | 
			
		||||
-extern const unsigned char relocate_new_kernel[];
 | 
			
		||||
-extern const size_t relocate_new_kernel_size;
 | 
			
		||||
-
 | 
			
		||||
-extern unsigned long kexec_start_address;
 | 
			
		||||
-extern unsigned long kexec_indirection_page;
 | 
			
		||||
+#include <linux/uaccess.h>
 | 
			
		||||
+#include "machine_kexec.h"
 | 
			
		||||
 
 | 
			
		||||
 static unsigned long reboot_code_buffer;
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +27,101 @@ void (*_crash_smp_send_stop)(void) = NUL
 | 
			
		||||
 void (*_machine_kexec_shutdown)(void) = NULL;
 | 
			
		||||
 void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL;
 | 
			
		||||
 
 | 
			
		||||
+static void machine_kexec_print_args(void)
 | 
			
		||||
+{
 | 
			
		||||
+	unsigned long argc = (int)kexec_args[0];
 | 
			
		||||
+	int i;
 | 
			
		||||
+
 | 
			
		||||
+	pr_info("kexec_args[0] (argc): %lu\n", argc);
 | 
			
		||||
+	pr_info("kexec_args[1] (argv): %p\n", (void *)kexec_args[1]);
 | 
			
		||||
+	pr_info("kexec_args[2] (env ): %p\n", (void *)kexec_args[2]);
 | 
			
		||||
+	pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]);
 | 
			
		||||
+
 | 
			
		||||
+	for (i = 0; i < argc; i++) {
 | 
			
		||||
+		pr_info("kexec_argv[%d] = %p, %s\n",
 | 
			
		||||
+				i, kexec_argv[i], kexec_argv[i]);
 | 
			
		||||
+	}
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void machine_kexec_init_argv(struct kimage *image)
 | 
			
		||||
+{
 | 
			
		||||
+	void __user *buf = NULL;
 | 
			
		||||
+	size_t bufsz;
 | 
			
		||||
+	size_t size;
 | 
			
		||||
+	int i;
 | 
			
		||||
+
 | 
			
		||||
+	bufsz = 0;
 | 
			
		||||
+	for (i = 0; i < image->nr_segments; i++) {
 | 
			
		||||
+		struct kexec_segment *seg;
 | 
			
		||||
+
 | 
			
		||||
+		seg = &image->segment[i];
 | 
			
		||||
+		if (seg->bufsz < 6)
 | 
			
		||||
+			continue;
 | 
			
		||||
+
 | 
			
		||||
+		if (strncmp((char *) seg->buf, "kexec ", 6))
 | 
			
		||||
+			continue;
 | 
			
		||||
+
 | 
			
		||||
+		buf = seg->buf;
 | 
			
		||||
+		bufsz = seg->bufsz;
 | 
			
		||||
+		break;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	if (!buf)
 | 
			
		||||
+		return;
 | 
			
		||||
+
 | 
			
		||||
+	size = KEXEC_COMMAND_LINE_SIZE;
 | 
			
		||||
+	size = min(size, bufsz);
 | 
			
		||||
+	if (size < bufsz)
 | 
			
		||||
+		pr_warn("kexec command line truncated to %zd bytes\n", size);
 | 
			
		||||
+
 | 
			
		||||
+	/* Copy to kernel space */
 | 
			
		||||
+	if (copy_from_user(kexec_argv_buf, buf, size))
 | 
			
		||||
+		pr_warn("kexec command line copy to kernel space failed\n");
 | 
			
		||||
+
 | 
			
		||||
+	kexec_argv_buf[size - 1] = 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void machine_kexec_parse_argv(struct kimage *image)
 | 
			
		||||
+{
 | 
			
		||||
+	char *reboot_code_buffer;
 | 
			
		||||
+	int reloc_delta;
 | 
			
		||||
+	char *ptr;
 | 
			
		||||
+	int argc;
 | 
			
		||||
+	int i;
 | 
			
		||||
+
 | 
			
		||||
+	ptr = kexec_argv_buf;
 | 
			
		||||
+	argc = 0;
 | 
			
		||||
+
 | 
			
		||||
+	/*
 | 
			
		||||
+	 * convert command line string to array of parameters
 | 
			
		||||
+	 * (as bootloader does).
 | 
			
		||||
+	 */
 | 
			
		||||
+	while (ptr && *ptr && (KEXEC_MAX_ARGC > argc)) {
 | 
			
		||||
+		if (*ptr == ' ') {
 | 
			
		||||
+			*ptr++ = '\0';
 | 
			
		||||
+			continue;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
+		kexec_argv[argc++] = ptr;
 | 
			
		||||
+		ptr = strchr(ptr, ' ');
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	if (!argc)
 | 
			
		||||
+		return;
 | 
			
		||||
+
 | 
			
		||||
+	kexec_args[0] = argc;
 | 
			
		||||
+	kexec_args[1] = (unsigned long)kexec_argv;
 | 
			
		||||
+	kexec_args[2] = 0;
 | 
			
		||||
+	kexec_args[3] = 0;
 | 
			
		||||
+
 | 
			
		||||
+	reboot_code_buffer = page_address(image->control_code_page);
 | 
			
		||||
+	reloc_delta = reboot_code_buffer - (char *)kexec_relocate_new_kernel;
 | 
			
		||||
+
 | 
			
		||||
+	kexec_args[1] += reloc_delta;
 | 
			
		||||
+	for (i = 0; i < argc; i++)
 | 
			
		||||
+		kexec_argv[i] += reloc_delta;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static void kexec_image_info(const struct kimage *kimage)
 | 
			
		||||
 {
 | 
			
		||||
 	unsigned long i;
 | 
			
		||||
@@ -99,6 +191,18 @@ machine_kexec_prepare(struct kimage *kim
 | 
			
		||||
 #endif
 | 
			
		||||
 
 | 
			
		||||
 	kexec_image_info(kimage);
 | 
			
		||||
+	/*
 | 
			
		||||
+	 * Whenever arguments passed from kexec-tools, Init the arguments as
 | 
			
		||||
+	 * the original ones to try avoiding booting failure.
 | 
			
		||||
+	 */
 | 
			
		||||
+
 | 
			
		||||
+	kexec_args[0] = fw_arg0;
 | 
			
		||||
+	kexec_args[1] = fw_arg1;
 | 
			
		||||
+	kexec_args[2] = fw_arg2;
 | 
			
		||||
+	kexec_args[3] = fw_arg3;
 | 
			
		||||
+
 | 
			
		||||
+	machine_kexec_init_argv(kimage);
 | 
			
		||||
+	machine_kexec_parse_argv(kimage);
 | 
			
		||||
 
 | 
			
		||||
 	if (_machine_kexec_prepare)
 | 
			
		||||
 		return _machine_kexec_prepare(kimage);
 | 
			
		||||
@@ -161,7 +265,7 @@ machine_crash_shutdown(struct pt_regs *r
 | 
			
		||||
 void kexec_nonboot_cpu_jump(void)
 | 
			
		||||
 {
 | 
			
		||||
 	local_flush_icache_range((unsigned long)relocated_kexec_smp_wait,
 | 
			
		||||
-				 reboot_code_buffer + relocate_new_kernel_size);
 | 
			
		||||
+				 reboot_code_buffer + KEXEC_RELOCATE_NEW_KERNEL_SIZE);
 | 
			
		||||
 
 | 
			
		||||
 	relocated_kexec_smp_wait(NULL);
 | 
			
		||||
 }
 | 
			
		||||
@@ -199,7 +303,7 @@ void kexec_reboot(void)
 | 
			
		||||
 	 * machine_kexec() CPU.
 | 
			
		||||
 	 */
 | 
			
		||||
 	local_flush_icache_range(reboot_code_buffer,
 | 
			
		||||
-				 reboot_code_buffer + relocate_new_kernel_size);
 | 
			
		||||
+				 reboot_code_buffer + KEXEC_RELOCATE_NEW_KERNEL_SIZE);
 | 
			
		||||
 
 | 
			
		||||
 	do_kexec = (void *)reboot_code_buffer;
 | 
			
		||||
 	do_kexec();
 | 
			
		||||
@@ -212,10 +316,12 @@ machine_kexec(struct kimage *image)
 | 
			
		||||
 	unsigned long *ptr;
 | 
			
		||||
 
 | 
			
		||||
 	reboot_code_buffer =
 | 
			
		||||
-	  (unsigned long)page_address(image->control_code_page);
 | 
			
		||||
+		(unsigned long)page_address(image->control_code_page);
 | 
			
		||||
+	pr_info("reboot_code_buffer = %p\n", (void *)reboot_code_buffer);
 | 
			
		||||
 
 | 
			
		||||
 	kexec_start_address =
 | 
			
		||||
 		(unsigned long) phys_to_virt(image->start);
 | 
			
		||||
+	pr_info("kexec_start_address = %p\n", (void *)kexec_start_address);
 | 
			
		||||
 
 | 
			
		||||
 	if (image->type == KEXEC_TYPE_DEFAULT) {
 | 
			
		||||
 		kexec_indirection_page =
 | 
			
		||||
@@ -223,9 +329,19 @@ machine_kexec(struct kimage *image)
 | 
			
		||||
 	} else {
 | 
			
		||||
 		kexec_indirection_page = (unsigned long)&image->head;
 | 
			
		||||
 	}
 | 
			
		||||
+	pr_info("kexec_indirection_page = %p\n", (void *)kexec_indirection_page);
 | 
			
		||||
 
 | 
			
		||||
-	memcpy((void*)reboot_code_buffer, relocate_new_kernel,
 | 
			
		||||
-	       relocate_new_kernel_size);
 | 
			
		||||
+	pr_info("Where is memcpy: %p\n", memcpy);
 | 
			
		||||
+	pr_info("kexec_relocate_new_kernel = %p, kexec_relocate_new_kernel_end = %p\n",
 | 
			
		||||
+		(void *)kexec_relocate_new_kernel, &kexec_relocate_new_kernel_end);
 | 
			
		||||
+	pr_info("Copy %lu bytes from %p to %p\n", KEXEC_RELOCATE_NEW_KERNEL_SIZE,
 | 
			
		||||
+		(void *)kexec_relocate_new_kernel, (void *)reboot_code_buffer);
 | 
			
		||||
+	memcpy((void*)reboot_code_buffer, kexec_relocate_new_kernel,
 | 
			
		||||
+	       KEXEC_RELOCATE_NEW_KERNEL_SIZE);
 | 
			
		||||
+
 | 
			
		||||
+	pr_info("Before _print_args().\n");
 | 
			
		||||
+	machine_kexec_print_args();
 | 
			
		||||
+	pr_info("Before eval loop.\n");
 | 
			
		||||
 
 | 
			
		||||
 	/*
 | 
			
		||||
 	 * The generic kexec code builds a page list with physical
 | 
			
		||||
@@ -256,7 +372,7 @@ machine_kexec(struct kimage *image)
 | 
			
		||||
 #ifdef CONFIG_SMP
 | 
			
		||||
 	/* All secondary cpus now may jump to kexec_wait cycle */
 | 
			
		||||
 	relocated_kexec_smp_wait = reboot_code_buffer +
 | 
			
		||||
-		(void *)(kexec_smp_wait - relocate_new_kernel);
 | 
			
		||||
+		(void *)(kexec_smp_wait - kexec_relocate_new_kernel);
 | 
			
		||||
 	smp_wmb();
 | 
			
		||||
 	atomic_set(&kexec_ready_to_reboot, 1);
 | 
			
		||||
 #endif
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/arch/mips/kernel/machine_kexec.h
 | 
			
		||||
@@ -0,0 +1,20 @@
 | 
			
		||||
+#ifndef _MACHINE_KEXEC_H
 | 
			
		||||
+#define _MACHINE_KEXEC_H
 | 
			
		||||
+
 | 
			
		||||
+#ifndef __ASSEMBLY__
 | 
			
		||||
+extern const unsigned char kexec_relocate_new_kernel[];
 | 
			
		||||
+extern unsigned long kexec_relocate_new_kernel_end;
 | 
			
		||||
+extern unsigned long kexec_start_address;
 | 
			
		||||
+extern unsigned long kexec_indirection_page;
 | 
			
		||||
+
 | 
			
		||||
+extern char kexec_argv_buf[];
 | 
			
		||||
+extern char *kexec_argv[];
 | 
			
		||||
+
 | 
			
		||||
+#define KEXEC_RELOCATE_NEW_KERNEL_SIZE	((unsigned long)&kexec_relocate_new_kernel_end - (unsigned long)kexec_relocate_new_kernel)
 | 
			
		||||
+#endif /* !__ASSEMBLY__ */
 | 
			
		||||
+
 | 
			
		||||
+#define KEXEC_COMMAND_LINE_SIZE		256
 | 
			
		||||
+#define KEXEC_ARGV_SIZE			(KEXEC_COMMAND_LINE_SIZE / 16)
 | 
			
		||||
+#define KEXEC_MAX_ARGC			(KEXEC_ARGV_SIZE / sizeof(long))
 | 
			
		||||
+
 | 
			
		||||
+#endif
 | 
			
		||||
--- a/arch/mips/kernel/relocate_kernel.S
 | 
			
		||||
+++ b/arch/mips/kernel/relocate_kernel.S
 | 
			
		||||
@@ -10,10 +10,11 @@
 | 
			
		||||
 #include <asm/mipsregs.h>
 | 
			
		||||
 #include <asm/stackframe.h>
 | 
			
		||||
 #include <asm/addrspace.h>
 | 
			
		||||
+#include "machine_kexec.h"
 | 
			
		||||
 
 | 
			
		||||
 #include <kernel-entry-init.h>
 | 
			
		||||
 
 | 
			
		||||
-LEAF(relocate_new_kernel)
 | 
			
		||||
+LEAF(kexec_relocate_new_kernel)
 | 
			
		||||
 	PTR_L a0,	arg0
 | 
			
		||||
 	PTR_L a1,	arg1
 | 
			
		||||
 	PTR_L a2,	arg2
 | 
			
		||||
@@ -98,7 +99,7 @@ done:
 | 
			
		||||
 #endif
 | 
			
		||||
 	/* jump to kexec_start_address */
 | 
			
		||||
 	j		s1
 | 
			
		||||
-	END(relocate_new_kernel)
 | 
			
		||||
+	END(kexec_relocate_new_kernel)
 | 
			
		||||
 
 | 
			
		||||
 #ifdef CONFIG_SMP
 | 
			
		||||
 /*
 | 
			
		||||
@@ -177,8 +178,15 @@ EXPORT(kexec_indirection_page)
 | 
			
		||||
 	PTR_WD		0
 | 
			
		||||
 	.size		kexec_indirection_page, PTRSIZE
 | 
			
		||||
 
 | 
			
		||||
-relocate_new_kernel_end:
 | 
			
		||||
+kexec_argv_buf:
 | 
			
		||||
+	EXPORT(kexec_argv_buf)
 | 
			
		||||
+	.skip		KEXEC_COMMAND_LINE_SIZE
 | 
			
		||||
+	.size		kexec_argv_buf, KEXEC_COMMAND_LINE_SIZE
 | 
			
		||||
+
 | 
			
		||||
+kexec_argv:
 | 
			
		||||
+	EXPORT(kexec_argv)
 | 
			
		||||
+	.skip		KEXEC_ARGV_SIZE
 | 
			
		||||
+	.size		kexec_argv, KEXEC_ARGV_SIZE
 | 
			
		||||
 
 | 
			
		||||
-EXPORT(relocate_new_kernel_size)
 | 
			
		||||
-	PTR_WD		relocate_new_kernel_end - relocate_new_kernel
 | 
			
		||||
-	.size		relocate_new_kernel_size, PTRSIZE
 | 
			
		||||
+kexec_relocate_new_kernel_end:
 | 
			
		||||
+	EXPORT(kexec_relocate_new_kernel_end)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,84 @@
 | 
			
		|||
From bb0c3b0175240bf152fd7c644821a0cf9f77c37c Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
 | 
			
		||||
Date: Fri, 15 Mar 2019 18:53:38 +0300
 | 
			
		||||
Subject: [PATCH] arc add OWRTDTB section
 | 
			
		||||
 | 
			
		||||
This change allows OpenWRT to patch resulting kernel binary with
 | 
			
		||||
external .dtb.
 | 
			
		||||
 | 
			
		||||
That allows us to re-use exactky the same vmlinux on different boards
 | 
			
		||||
given its ARC core configurations match (at least cache line sizes etc).
 | 
			
		||||
 | 
			
		||||
""patch-dtb" searches for ASCII "OWRTDTB:" strign and copies external
 | 
			
		||||
.dtb right after it, keeping the string in place.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
 | 
			
		||||
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
 | 
			
		||||
Signed-off-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
 | 
			
		||||
---
 | 
			
		||||
 arch/arc/kernel/head.S        | 10 ++++++++++
 | 
			
		||||
 arch/arc/kernel/setup.c       |  4 +++-
 | 
			
		||||
 arch/arc/kernel/vmlinux.lds.S | 13 +++++++++++++
 | 
			
		||||
 3 files changed, 26 insertions(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/arch/arc/kernel/head.S
 | 
			
		||||
+++ b/arch/arc/kernel/head.S
 | 
			
		||||
@@ -88,6 +88,16 @@
 | 
			
		||||
 	DSP_EARLY_INIT
 | 
			
		||||
 .endm
 | 
			
		||||
 
 | 
			
		||||
+	; Here "patch-dtb" will embed external .dtb
 | 
			
		||||
+	; Note "patch-dtb" searches for ASCII "OWRTDTB:" string
 | 
			
		||||
+	; and pastes .dtb right after it, hense the string precedes
 | 
			
		||||
+	; __image_dtb symbol.
 | 
			
		||||
+	.section .owrt, "aw",@progbits
 | 
			
		||||
+	.ascii  "OWRTDTB:"
 | 
			
		||||
+ENTRY(__image_dtb)
 | 
			
		||||
+	.fill   0x4000
 | 
			
		||||
+END(__image_dtb)
 | 
			
		||||
+
 | 
			
		||||
 	.section .init.text, "ax",@progbits
 | 
			
		||||
 
 | 
			
		||||
 ;----------------------------------------------------------------
 | 
			
		||||
--- a/arch/arc/kernel/setup.c
 | 
			
		||||
+++ b/arch/arc/kernel/setup.c
 | 
			
		||||
@@ -450,6 +450,8 @@ static inline bool uboot_arg_invalid(uns
 | 
			
		||||
 /* We always pass 0 as magic from U-boot */
 | 
			
		||||
 #define UBOOT_MAGIC_VALUE	0
 | 
			
		||||
 
 | 
			
		||||
+extern struct boot_param_header __image_dtb;
 | 
			
		||||
+
 | 
			
		||||
 void __init handle_uboot_args(void)
 | 
			
		||||
 {
 | 
			
		||||
 	bool use_embedded_dtb = true;
 | 
			
		||||
@@ -488,7 +490,7 @@ void __init handle_uboot_args(void)
 | 
			
		||||
 ignore_uboot_args:
 | 
			
		||||
 
 | 
			
		||||
 	if (use_embedded_dtb) {
 | 
			
		||||
-		machine_desc = setup_machine_fdt(__dtb_start);
 | 
			
		||||
+		machine_desc = setup_machine_fdt(&__image_dtb);
 | 
			
		||||
 		if (!machine_desc)
 | 
			
		||||
 			panic("Embedded DT invalid\n");
 | 
			
		||||
 	}
 | 
			
		||||
--- a/arch/arc/kernel/vmlinux.lds.S
 | 
			
		||||
+++ b/arch/arc/kernel/vmlinux.lds.S
 | 
			
		||||
@@ -27,6 +27,19 @@ SECTIONS
 | 
			
		||||
 
 | 
			
		||||
 	. = CONFIG_LINUX_LINK_BASE;
 | 
			
		||||
 
 | 
			
		||||
+	/*
 | 
			
		||||
+	* In OpenWRT we want to patch built binary embedding .dtb of choice.
 | 
			
		||||
+	* This is implemented with "patch-dtb" utility which searches for
 | 
			
		||||
+	* "OWRTDTB:" string in first 16k of image and if it is found
 | 
			
		||||
+	* copies .dtb right after mentioned string.
 | 
			
		||||
+	*
 | 
			
		||||
+	* Note: "OWRTDTB:" won't be overwritten with .dtb, .dtb will follow it.
 | 
			
		||||
+	*/
 | 
			
		||||
+	.owrt : {
 | 
			
		||||
+		*(.owrt)
 | 
			
		||||
+	. = ALIGN(PAGE_SIZE);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	_int_vec_base_lds = .;
 | 
			
		||||
 	.vector : {
 | 
			
		||||
 		*(.vector)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
From: Alexey Brodkin <abrodkin@synopsys.com>
 | 
			
		||||
Subject: arc: enable unaligned access in kernel mode
 | 
			
		||||
 | 
			
		||||
This enables misaligned access handling even in kernel mode.
 | 
			
		||||
Some wireless drivers (ath9k-htc and mt7601u) use misaligned accesses
 | 
			
		||||
here and there and to cope with that without fixing stuff in the drivers
 | 
			
		||||
we're just gracefully handling it on ARC.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
 | 
			
		||||
---
 | 
			
		||||
 arch/arc/kernel/unaligned.c | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/arch/arc/kernel/unaligned.c
 | 
			
		||||
+++ b/arch/arc/kernel/unaligned.c
 | 
			
		||||
@@ -202,7 +202,7 @@ int misaligned_fixup(unsigned long addre
 | 
			
		||||
 	char buf[TASK_COMM_LEN];
 | 
			
		||||
 
 | 
			
		||||
 	/* handle user mode only and only if enabled by sysadmin */
 | 
			
		||||
-	if (!user_mode(regs) || !unaligned_enabled)
 | 
			
		||||
+	if (!unaligned_enabled)
 | 
			
		||||
 		return 1;
 | 
			
		||||
 
 | 
			
		||||
 	if (no_unaligned_warning) {
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
From 66770a004afe10df11d3902e16eaa0c2c39436bb Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Pawel Dembicki <paweldembicki@gmail.com>
 | 
			
		||||
Date: Fri, 24 May 2019 17:56:19 +0200
 | 
			
		||||
Subject: [PATCH] powerpc: Enable kernel XZ compression option on PPC_85xx
 | 
			
		||||
 | 
			
		||||
Enable kernel XZ compression option on PPC_85xx. Tested with
 | 
			
		||||
simpleImage on TP-Link TL-WDR4900 (Freescale P1014 processor).
 | 
			
		||||
 | 
			
		||||
Suggested-by: Christian Lamparter <chunkeey@gmail.com>
 | 
			
		||||
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
 arch/powerpc/Kconfig | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
--- a/arch/powerpc/Kconfig
 | 
			
		||||
+++ b/arch/powerpc/Kconfig
 | 
			
		||||
@@ -251,7 +251,7 @@ config PPC
 | 
			
		||||
 	select HAVE_KERNEL_GZIP
 | 
			
		||||
 	select HAVE_KERNEL_LZMA			if DEFAULT_UIMAGE
 | 
			
		||||
 	select HAVE_KERNEL_LZO			if DEFAULT_UIMAGE
 | 
			
		||||
-	select HAVE_KERNEL_XZ			if PPC_BOOK3S || 44x
 | 
			
		||||
+	select HAVE_KERNEL_XZ			if PPC_BOOK3S || 44x || PPC_85xx
 | 
			
		||||
 	select HAVE_KPROBES
 | 
			
		||||
 	select HAVE_KPROBES_ON_FTRACE
 | 
			
		||||
 	select HAVE_KRETPROBES
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,74 @@
 | 
			
		|||
From: Shiji Yang <yangshiji66@outlook.com>
 | 
			
		||||
Date: Wed, 13 Mar 2024 20:28:37 +0800
 | 
			
		||||
Subject: [PATCH] mips: kernel: fix detect_memory_region() function
 | 
			
		||||
 | 
			
		||||
1. Do not use memcmp() on unallocated memory, as the new introduced
 | 
			
		||||
   fortify dynamic object size check[1] will report unexpected result.
 | 
			
		||||
2. Use a fixed pattern instead of a random function pointer as the
 | 
			
		||||
   magic value.
 | 
			
		||||
3. Flip magic value and double check it.
 | 
			
		||||
4. Enable this feature only for 32-bit CPUs. Currently, only ath79 and
 | 
			
		||||
   ralink CPUs are using it.
 | 
			
		||||
 | 
			
		||||
[1] 439a1bcac648 ("fortify: Use __builtin_dynamic_object_size() when available")
 | 
			
		||||
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
 | 
			
		||||
---
 | 
			
		||||
 arch/mips/include/asm/bootinfo.h |  2 ++
 | 
			
		||||
 arch/mips/kernel/setup.c         | 17 ++++++++++++-----
 | 
			
		||||
 2 files changed, 14 insertions(+), 5 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/arch/mips/include/asm/bootinfo.h
 | 
			
		||||
+++ b/arch/mips/include/asm/bootinfo.h
 | 
			
		||||
@@ -93,7 +93,9 @@ const char *get_system_type(void);
 | 
			
		||||
 
 | 
			
		||||
 extern unsigned long mips_machtype;
 | 
			
		||||
 
 | 
			
		||||
+#ifndef CONFIG_64BIT
 | 
			
		||||
 extern void detect_memory_region(phys_addr_t start, phys_addr_t sz_min,  phys_addr_t sz_max);
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 extern void prom_init(void);
 | 
			
		||||
 extern void prom_free_prom_memory(void);
 | 
			
		||||
--- a/arch/mips/kernel/setup.c
 | 
			
		||||
+++ b/arch/mips/kernel/setup.c
 | 
			
		||||
@@ -90,21 +90,27 @@ static struct resource bss_resource = {
 | 
			
		||||
 unsigned long __kaslr_offset __ro_after_init;
 | 
			
		||||
 EXPORT_SYMBOL(__kaslr_offset);
 | 
			
		||||
 
 | 
			
		||||
-static void *detect_magic __initdata = detect_memory_region;
 | 
			
		||||
-
 | 
			
		||||
 #ifdef CONFIG_MIPS_AUTO_PFN_OFFSET
 | 
			
		||||
 unsigned long ARCH_PFN_OFFSET;
 | 
			
		||||
 EXPORT_SYMBOL(ARCH_PFN_OFFSET);
 | 
			
		||||
 #endif
 | 
			
		||||
 
 | 
			
		||||
+#ifndef CONFIG_64BIT
 | 
			
		||||
+static u32 detect_magic __initdata;
 | 
			
		||||
+#define MIPS_MEM_TEST_PATTERN		0xaa5555aa
 | 
			
		||||
+
 | 
			
		||||
 void __init detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_addr_t sz_max)
 | 
			
		||||
 {
 | 
			
		||||
-	void *dm = &detect_magic;
 | 
			
		||||
+	void *dm = (void *)KSEG1ADDR(&detect_magic);
 | 
			
		||||
 	phys_addr_t size;
 | 
			
		||||
 
 | 
			
		||||
 	for (size = sz_min; size < sz_max; size <<= 1) {
 | 
			
		||||
-		if (!memcmp(dm, dm + size, sizeof(detect_magic)))
 | 
			
		||||
-			break;
 | 
			
		||||
+		__raw_writel(MIPS_MEM_TEST_PATTERN, dm);
 | 
			
		||||
+		if (__raw_readl(dm) == __raw_readl(dm + size)) {
 | 
			
		||||
+			__raw_writel(~MIPS_MEM_TEST_PATTERN, dm);
 | 
			
		||||
+			if (__raw_readl(dm) == __raw_readl(dm + size))
 | 
			
		||||
+				break;
 | 
			
		||||
+		}
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
 	pr_debug("Memory: %lluMB of RAM detected at 0x%llx (min: %lluMB, max: %lluMB)\n",
 | 
			
		||||
@@ -115,6 +121,7 @@ void __init detect_memory_region(phys_ad
 | 
			
		||||
 
 | 
			
		||||
 	memblock_add(start, size);
 | 
			
		||||
 }
 | 
			
		||||
+#endif /* CONFIG_64BIT */
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
  * Manage initrd
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,328 @@
 | 
			
		|||
From 39717277d5c87bdb183cf2f258957b44ba99b4df Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
 | 
			
		||||
Date: Wed, 13 Jul 2022 11:47:35 +0200
 | 
			
		||||
Subject: [PATCH] mtd: mtdsplit support
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 drivers/mtd/Kconfig            |  19 ++++
 | 
			
		||||
 drivers/mtd/Makefile           |   2 +
 | 
			
		||||
 drivers/mtd/mtdpart.c          | 169 ++++++++++++++++++++++++++++-----
 | 
			
		||||
 include/linux/mtd/mtd.h        |  25 +++++
 | 
			
		||||
 include/linux/mtd/partitions.h |   7 ++
 | 
			
		||||
 5 files changed, 197 insertions(+), 25 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/drivers/mtd/Kconfig
 | 
			
		||||
+++ b/drivers/mtd/Kconfig
 | 
			
		||||
@@ -12,6 +12,25 @@ menuconfig MTD
 | 
			
		||||
 
 | 
			
		||||
 if MTD
 | 
			
		||||
 
 | 
			
		||||
+menu "OpenWrt specific MTD options"
 | 
			
		||||
+
 | 
			
		||||
+config MTD_ROOTFS_ROOT_DEV
 | 
			
		||||
+	bool "Automatically set 'rootfs' partition to be root filesystem"
 | 
			
		||||
+	default y
 | 
			
		||||
+
 | 
			
		||||
+config MTD_SPLIT_FIRMWARE
 | 
			
		||||
+	bool "Automatically split firmware partition for kernel+rootfs"
 | 
			
		||||
+	default y
 | 
			
		||||
+
 | 
			
		||||
+config MTD_SPLIT_FIRMWARE_NAME
 | 
			
		||||
+	string "Firmware partition name"
 | 
			
		||||
+	depends on MTD_SPLIT_FIRMWARE
 | 
			
		||||
+	default "firmware"
 | 
			
		||||
+
 | 
			
		||||
+source "drivers/mtd/mtdsplit/Kconfig"
 | 
			
		||||
+
 | 
			
		||||
+endmenu
 | 
			
		||||
+
 | 
			
		||||
 config MTD_TESTS
 | 
			
		||||
 	tristate "MTD tests support (DANGEROUS)"
 | 
			
		||||
 	depends on m
 | 
			
		||||
--- a/drivers/mtd/Makefile
 | 
			
		||||
+++ b/drivers/mtd/Makefile
 | 
			
		||||
@@ -9,6 +9,8 @@ mtd-y				:= mtdcore.o mtdsuper.o mtdconc
 | 
			
		||||
 
 | 
			
		||||
 obj-y				+= parsers/
 | 
			
		||||
 
 | 
			
		||||
+obj-$(CONFIG_MTD_SPLIT)		+= mtdsplit/
 | 
			
		||||
+
 | 
			
		||||
 # 'Users' - code which presents functionality to userspace.
 | 
			
		||||
 obj-$(CONFIG_MTD_BLKDEVS)	+= mtd_blkdevs.o
 | 
			
		||||
 obj-$(CONFIG_MTD_BLOCK)		+= mtdblock.o
 | 
			
		||||
--- a/drivers/mtd/mtdpart.c
 | 
			
		||||
+++ b/drivers/mtd/mtdpart.c
 | 
			
		||||
@@ -15,11 +15,13 @@
 | 
			
		||||
 #include <linux/kmod.h>
 | 
			
		||||
 #include <linux/mtd/mtd.h>
 | 
			
		||||
 #include <linux/mtd/partitions.h>
 | 
			
		||||
+#include <linux/magic.h>
 | 
			
		||||
 #include <linux/err.h>
 | 
			
		||||
 #include <linux/of.h>
 | 
			
		||||
 #include <linux/of_platform.h>
 | 
			
		||||
 
 | 
			
		||||
 #include "mtdcore.h"
 | 
			
		||||
+#include "mtdsplit/mtdsplit.h"
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
  * MTD methods which simply translate the effective address and pass through
 | 
			
		||||
@@ -242,6 +244,147 @@ static int mtd_add_partition_attrs(struc
 | 
			
		||||
 	return ret;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static DEFINE_SPINLOCK(part_parser_lock);
 | 
			
		||||
+static LIST_HEAD(part_parsers);
 | 
			
		||||
+
 | 
			
		||||
+static struct mtd_part_parser *mtd_part_parser_get(const char *name)
 | 
			
		||||
+{
 | 
			
		||||
+	struct mtd_part_parser *p, *ret = NULL;
 | 
			
		||||
+
 | 
			
		||||
+	spin_lock(&part_parser_lock);
 | 
			
		||||
+
 | 
			
		||||
+	list_for_each_entry(p, &part_parsers, list)
 | 
			
		||||
+		if (!strcmp(p->name, name) && try_module_get(p->owner)) {
 | 
			
		||||
+			ret = p;
 | 
			
		||||
+			break;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
+	spin_unlock(&part_parser_lock);
 | 
			
		||||
+
 | 
			
		||||
+	return ret;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static inline void mtd_part_parser_put(const struct mtd_part_parser *p)
 | 
			
		||||
+{
 | 
			
		||||
+	module_put(p->owner);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static struct mtd_part_parser *
 | 
			
		||||
+get_partition_parser_by_type(enum mtd_parser_type type,
 | 
			
		||||
+			     struct mtd_part_parser *start)
 | 
			
		||||
+{
 | 
			
		||||
+	struct mtd_part_parser *p, *ret = NULL;
 | 
			
		||||
+
 | 
			
		||||
+	spin_lock(&part_parser_lock);
 | 
			
		||||
+
 | 
			
		||||
+	p = list_prepare_entry(start, &part_parsers, list);
 | 
			
		||||
+	if (start)
 | 
			
		||||
+		mtd_part_parser_put(start);
 | 
			
		||||
+
 | 
			
		||||
+	list_for_each_entry_continue(p, &part_parsers, list) {
 | 
			
		||||
+		if (p->type == type && try_module_get(p->owner)) {
 | 
			
		||||
+			ret = p;
 | 
			
		||||
+			break;
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	spin_unlock(&part_parser_lock);
 | 
			
		||||
+
 | 
			
		||||
+	return ret;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int parse_mtd_partitions_by_type(struct mtd_info *master,
 | 
			
		||||
+					enum mtd_parser_type type,
 | 
			
		||||
+					const struct mtd_partition **pparts,
 | 
			
		||||
+					struct mtd_part_parser_data *data)
 | 
			
		||||
+{
 | 
			
		||||
+	struct mtd_part_parser *prev = NULL;
 | 
			
		||||
+	int ret = 0;
 | 
			
		||||
+
 | 
			
		||||
+	while (1) {
 | 
			
		||||
+		struct mtd_part_parser *parser;
 | 
			
		||||
+
 | 
			
		||||
+		parser = get_partition_parser_by_type(type, prev);
 | 
			
		||||
+		if (!parser)
 | 
			
		||||
+			break;
 | 
			
		||||
+
 | 
			
		||||
+		ret = (*parser->parse_fn)(master, pparts, data);
 | 
			
		||||
+
 | 
			
		||||
+		if (ret > 0) {
 | 
			
		||||
+			mtd_part_parser_put(parser);
 | 
			
		||||
+			printk(KERN_NOTICE
 | 
			
		||||
+			       "%d %s partitions found on MTD device %s\n",
 | 
			
		||||
+			       ret, parser->name, master->name);
 | 
			
		||||
+			break;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
+		prev = parser;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return ret;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int
 | 
			
		||||
+run_parsers_by_type(struct mtd_info *child, enum mtd_parser_type type)
 | 
			
		||||
+{
 | 
			
		||||
+	struct mtd_partition *parts;
 | 
			
		||||
+	int nr_parts;
 | 
			
		||||
+	int i;
 | 
			
		||||
+
 | 
			
		||||
+	nr_parts = parse_mtd_partitions_by_type(child, type, (const struct mtd_partition **)&parts,
 | 
			
		||||
+						NULL);
 | 
			
		||||
+	if (nr_parts <= 0)
 | 
			
		||||
+		return nr_parts;
 | 
			
		||||
+
 | 
			
		||||
+	if (WARN_ON(!parts))
 | 
			
		||||
+		return 0;
 | 
			
		||||
+
 | 
			
		||||
+	for (i = 0; i < nr_parts; i++) {
 | 
			
		||||
+		/* adjust partition offsets */
 | 
			
		||||
+		parts[i].offset += child->part.offset;
 | 
			
		||||
+
 | 
			
		||||
+		mtd_add_partition(child->parent,
 | 
			
		||||
+				  parts[i].name,
 | 
			
		||||
+				  parts[i].offset,
 | 
			
		||||
+				  parts[i].size);
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	kfree(parts);
 | 
			
		||||
+
 | 
			
		||||
+	return nr_parts;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
 | 
			
		||||
+#define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME
 | 
			
		||||
+#else
 | 
			
		||||
+#define SPLIT_FIRMWARE_NAME	"unused"
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
+static void split_firmware(struct mtd_info *master, struct mtd_info *part)
 | 
			
		||||
+{
 | 
			
		||||
+	run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static void mtd_partition_split(struct mtd_info *master, struct mtd_info *part)
 | 
			
		||||
+{
 | 
			
		||||
+	static int rootfs_found = 0;
 | 
			
		||||
+
 | 
			
		||||
+	if (rootfs_found)
 | 
			
		||||
+		return;
 | 
			
		||||
+
 | 
			
		||||
+	if (of_find_property(mtd_get_of_node(part), "linux,rootfs", NULL) ||
 | 
			
		||||
+	    !strcmp(part->name, "rootfs")) {
 | 
			
		||||
+		run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS);
 | 
			
		||||
+
 | 
			
		||||
+		rootfs_found = 1;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	if (IS_ENABLED(CONFIG_MTD_SPLIT_FIRMWARE) &&
 | 
			
		||||
+	    !strcmp(part->name, SPLIT_FIRMWARE_NAME) &&
 | 
			
		||||
+	    !of_find_property(mtd_get_of_node(part), "compatible", NULL))
 | 
			
		||||
+		split_firmware(master, part);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 int mtd_add_partition(struct mtd_info *parent, const char *name,
 | 
			
		||||
 		      long long offset, long long length)
 | 
			
		||||
 {
 | 
			
		||||
@@ -280,6 +423,7 @@ int mtd_add_partition(struct mtd_info *p
 | 
			
		||||
 	if (ret)
 | 
			
		||||
 		goto err_remove_part;
 | 
			
		||||
 
 | 
			
		||||
+	mtd_partition_split(parent, child);
 | 
			
		||||
 	mtd_add_partition_attrs(child);
 | 
			
		||||
 
 | 
			
		||||
 	return 0;
 | 
			
		||||
@@ -423,6 +567,7 @@ int add_mtd_partitions(struct mtd_info *
 | 
			
		||||
 			goto err_del_partitions;
 | 
			
		||||
 		}
 | 
			
		||||
 
 | 
			
		||||
+		mtd_partition_split(master, child);
 | 
			
		||||
 		mtd_add_partition_attrs(child);
 | 
			
		||||
 
 | 
			
		||||
 		/* Look for subpartitions */
 | 
			
		||||
@@ -439,31 +584,6 @@ err_del_partitions:
 | 
			
		||||
 	return ret;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
-static DEFINE_SPINLOCK(part_parser_lock);
 | 
			
		||||
-static LIST_HEAD(part_parsers);
 | 
			
		||||
-
 | 
			
		||||
-static struct mtd_part_parser *mtd_part_parser_get(const char *name)
 | 
			
		||||
-{
 | 
			
		||||
-	struct mtd_part_parser *p, *ret = NULL;
 | 
			
		||||
-
 | 
			
		||||
-	spin_lock(&part_parser_lock);
 | 
			
		||||
-
 | 
			
		||||
-	list_for_each_entry(p, &part_parsers, list)
 | 
			
		||||
-		if (!strcmp(p->name, name) && try_module_get(p->owner)) {
 | 
			
		||||
-			ret = p;
 | 
			
		||||
-			break;
 | 
			
		||||
-		}
 | 
			
		||||
-
 | 
			
		||||
-	spin_unlock(&part_parser_lock);
 | 
			
		||||
-
 | 
			
		||||
-	return ret;
 | 
			
		||||
-}
 | 
			
		||||
-
 | 
			
		||||
-static inline void mtd_part_parser_put(const struct mtd_part_parser *p)
 | 
			
		||||
-{
 | 
			
		||||
-	module_put(p->owner);
 | 
			
		||||
-}
 | 
			
		||||
-
 | 
			
		||||
 /*
 | 
			
		||||
  * Many partition parsers just expected the core to kfree() all their data in
 | 
			
		||||
  * one chunk. Do that by default.
 | 
			
		||||
--- a/include/linux/mtd/mtd.h
 | 
			
		||||
+++ b/include/linux/mtd/mtd.h
 | 
			
		||||
@@ -615,6 +615,24 @@ static inline void mtd_align_erase_req(s
 | 
			
		||||
 		req->len += mtd->erasesize - mod;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static inline uint64_t mtd_roundup_to_eb(uint64_t sz, struct mtd_info *mtd)
 | 
			
		||||
+{
 | 
			
		||||
+	if (mtd_mod_by_eb(sz, mtd) == 0)
 | 
			
		||||
+		return sz;
 | 
			
		||||
+
 | 
			
		||||
+	/* Round up to next erase block */
 | 
			
		||||
+	return (mtd_div_by_eb(sz, mtd) + 1) * mtd->erasesize;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static inline uint64_t mtd_rounddown_to_eb(uint64_t sz, struct mtd_info *mtd)
 | 
			
		||||
+{
 | 
			
		||||
+	if (mtd_mod_by_eb(sz, mtd) == 0)
 | 
			
		||||
+		return sz;
 | 
			
		||||
+
 | 
			
		||||
+	/* Round down to the start of the current erase block */
 | 
			
		||||
+	return (mtd_div_by_eb(sz, mtd)) * mtd->erasesize;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd)
 | 
			
		||||
 {
 | 
			
		||||
 	if (mtd->writesize_shift)
 | 
			
		||||
@@ -688,6 +706,13 @@ extern struct mtd_info *of_get_mtd_devic
 | 
			
		||||
 extern struct mtd_info *get_mtd_device_nm(const char *name);
 | 
			
		||||
 extern void put_mtd_device(struct mtd_info *mtd);
 | 
			
		||||
 
 | 
			
		||||
+static inline uint64_t mtdpart_get_offset(const struct mtd_info *mtd)
 | 
			
		||||
+{
 | 
			
		||||
+	if (!mtd_is_partition(mtd))
 | 
			
		||||
+		return 0;
 | 
			
		||||
+
 | 
			
		||||
+	return mtd->part.offset;
 | 
			
		||||
+}
 | 
			
		||||
 
 | 
			
		||||
 struct mtd_notifier {
 | 
			
		||||
 	void (*add)(struct mtd_info *mtd);
 | 
			
		||||
--- a/include/linux/mtd/partitions.h
 | 
			
		||||
+++ b/include/linux/mtd/partitions.h
 | 
			
		||||
@@ -75,6 +75,12 @@ struct mtd_part_parser_data {
 | 
			
		||||
  * Functions dealing with the various ways of partitioning the space
 | 
			
		||||
  */
 | 
			
		||||
 
 | 
			
		||||
+enum mtd_parser_type {
 | 
			
		||||
+	MTD_PARSER_TYPE_DEVICE = 0,
 | 
			
		||||
+	MTD_PARSER_TYPE_ROOTFS,
 | 
			
		||||
+	MTD_PARSER_TYPE_FIRMWARE,
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
 struct mtd_part_parser {
 | 
			
		||||
 	struct list_head list;
 | 
			
		||||
 	struct module *owner;
 | 
			
		||||
@@ -83,6 +89,7 @@ struct mtd_part_parser {
 | 
			
		||||
 	int (*parse_fn)(struct mtd_info *, const struct mtd_partition **,
 | 
			
		||||
 			struct mtd_part_parser_data *);
 | 
			
		||||
 	void (*cleanup)(const struct mtd_partition *pparts, int nr_parts);
 | 
			
		||||
+	enum mtd_parser_type type;
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 /* Container for passing around a set of parsed partitions */
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue