diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 347eb5a90cd..1c665cb8698 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,7 @@ jobs: outputs: owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} ccache_hash: ${{ steps.ccache_hash.outputs.ccache_hash }} + container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} steps: - name: Checkout @@ -50,12 +51,40 @@ jobs: | md5sum | awk '{ print $1 }') echo "ccache_hash=$CCACHE_HASH" >> $GITHUB_OUTPUT + # Per branch tools container tag + # By default stick to latest + # For official test targetting openwrt stable branch + # Get the branch or parse the tag and push dedicated tools containers + # For local test to use the correct container for stable release testing + # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]- + - name: Determine tools container tag + id: determine_tools_container + run: | + CONTAINER_TAG=latest + if [ -n "${{ github.base_ref }}" ]; then + if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then + CONTAINER_TAG="${{ github.base_ref }}" + fi + elif [ ${{ github.ref_type }} == "branch" ]; then + if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then + CONTAINER_TAG=${{ github.ref_name }} + elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then + CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" + fi + elif [ ${{ github.ref_type }} == "tag" ]; then + if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then + CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + fi + fi + echo "Tools container to use tools:$CONTAINER_TAG" + echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT + build: name: Build with external toolchain needs: setup_build runs-on: ubuntu-latest - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:latest + container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }} permissions: contents: read @@ -116,23 +145,61 @@ jobs: - name: Parse toolchain file if: inputs.build_toolchain == false + id: parse-toolchain working-directory: openwrt run: | - TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ - | grep ".*openwrt-toolchain.*tar.xz")" - TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') - TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) + TOOLCHAIN_PATH=snapshots + + if [ -n "${{ github.base_ref }}" ]; then + if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then + major_ver="$(echo ${{ github.base_ref }} | sed 's/^openwrt-/v/')" + fi + elif [ "${{ github.ref_type }}" = "branch" ]; then + if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then + major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-/v/')" + elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then + major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-\([0-9][0-9]\.[0-9][0-9]\)-.*/v\1/')" + fi + elif [ "${{ github.ref_type }}" = "tag" ]; then + if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then + major_ver="$(echo ${{ github.ref_name }} | sed 's/^\(v[0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + fi + fi + + if [ -n "$major_ver" ]; then + git fetch --tags + latest_tag="$(git tag --sort=-creatordate -l $major_ver* | head -n1)" + if [ -n "$latest_tag" ]; then + TOOLCHAIN_PATH=releases/$(echo $latest_tag | sed 's/^v//') + fi + fi + + SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" + if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then + TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")" + TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') + TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) + + echo "toolchain-type=external_toolchain" >> $GITHUB_OUTPUT + elif curl $SUMS_FILE | grep -q ".*openwrt-sdk.*tar.xz"; then + TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-sdk.*tar.xz")" + TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-sdk.*\).tar.xz/\1/p') + TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) + + echo "toolchain-type=external_sdk" >> $GITHUB_OUTPUT + fi echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV" + echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV" - - name: Cache external toolchain + - name: Cache external toolchain/sdk if: inputs.build_toolchain == false id: cache-external-toolchain uses: actions/cache@v3 with: path: openwrt/${{ env.TOOLCHAIN_FILE }} - key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }} + key: ${{ env.TOOLCHAIN_FILE }}-${{ steps.parse-toolchain.outputs.toolchain-type }}-${{ env.TOOLCHAIN_SHA256 }} - name: Cache ccache uses: actions/cache@v3 @@ -142,12 +209,12 @@ jobs: restore-keys: | ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}- - - name: Download external toolchain + - name: Download external toolchain/sdk if: inputs.build_toolchain == false && steps.cache-external-toolchain.outputs.cache-hit != 'true' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | - wget -O - https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ + wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \ | tar --xz -xf - - name: Extract prebuilt tools @@ -186,7 +253,7 @@ jobs: echo CONFIG_TARGET_ALL_PROFILES=y >> .config - name: Configure external toolchain - if: inputs.build_toolchain == false + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_toolchain' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | @@ -199,6 +266,48 @@ jobs: --overwrite-config \ --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + - name: Adapt external sdk to external toolchain format + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' && steps.cache-external-toolchain.outputs.cache-hit != 'true' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + TOOLCHAIN_DIR=${{ env.TOOLCHAIN_FILE }}/staging_dir/$(ls ${{ env.TOOLCHAIN_FILE }}/staging_dir | grep toolchain) + TOOLCHAIN_BIN=$TOOLCHAIN_DIR/bin + OPENWRT_DIR=$(pwd) + + # Find target name from toolchain info.mk + GNU_TARGET_NAME=$(cat $TOOLCHAIN_DIR/info.mk | grep TARGET_CROSS | sed 's/^TARGET_CROSS=\(.*\)-$/\1/') + + cd $TOOLCHAIN_BIN + + # Revert sdk wrapper scripts applied to all the bins + for app in $(find . -name "*.bin"); do + TARGET_APP=$(echo $app | sed 's/\.\/\.\(.*\)\.bin/\1/') + rm $TARGET_APP + mv .$TARGET_APP.bin $TARGET_APP + done + + # Setup the wrapper script in the sdk toolchain dir simulating an external toolchain build + cp $OPENWRT_DIR/target/toolchain/files/wrapper.sh $GNU_TARGET_NAME-wrapper.sh + for app in cc gcc g++ c++ cpp ld as ; do + [ -f $GNU_TARGET_NAME-$app ] && mv $GNU_TARGET_NAME-$app $GNU_TARGET_NAME-$app.bin + ln -sf $GNU_TARGET_NAME-wrapper.sh $GNU_TARGET_NAME-$app + done + + - name: Configure external toolchain with sdk + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_DEVEL=y >> .config + echo CONFIG_AUTOREMOVE=y >> .config + echo CONFIG_CCACHE=y >> .config + + ./scripts/ext-toolchain.sh \ + --toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \ + --overwrite-config \ + --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + - name: Configure internal toolchain if: inputs.build_toolchain == true shell: su buildbot -c "sh -e {0}" diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml index c04cb27b370..e5b619064f6 100644 --- a/.github/workflows/check-kernel-patches.yml +++ b/.github/workflows/check-kernel-patches.yml @@ -18,6 +18,7 @@ jobs: runs-on: ubuntu-latest outputs: owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} + container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} steps: - name: Set lower case owner name @@ -27,12 +28,40 @@ jobs: | tr '[:upper:]' '[:lower:]') echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT + # Per branch tools container tag + # By default stick to latest + # For official test targetting openwrt stable branch + # Get the branch or parse the tag and push dedicated tools containers + # For local test to use the correct container for stable release testing + # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]- + - name: Determine tools container tag + id: determine_tools_container + run: | + CONTAINER_TAG=latest + if [ -n "${{ github.base_ref }}" ]; then + if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then + CONTAINER_TAG="${{ github.base_ref }}" + fi + elif [ ${{ github.ref_type }} == "branch" ]; then + if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then + CONTAINER_TAG=${{ github.ref_name }} + elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then + CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" + fi + elif [ ${{ github.ref_type }} == "tag" ]; then + if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then + CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + fi + fi + echo "Tools container to use tools:$CONTAINER_TAG" + echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT + check-patch: name: Check Kernel patches needs: setup_build runs-on: ubuntu-latest - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:latest + container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }} permissions: contents: read diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 06efe14d5c5..0fd03749f3a 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -3,12 +3,16 @@ name: Build Kernel on: pull_request: paths: + - '.github/workflows/check-kernel-patches.yml' + - '.github/workflows/build.yml' - '.github/workflows/kernel.yml' - 'include/kernel*' - 'package/kernel/**' - 'target/linux/generic/**' push: paths: + - '.github/workflows/check-kernel-patches.yml' + - '.github/workflows/build.yml' - '.github/workflows/kernel.yml' - 'include/kernel*' - 'package/kernel/**' @@ -64,7 +68,6 @@ jobs: with: target: ${{ matrix.target }} build_all_kmods: true - include_feeds: true check-kernel-patches: name: Check Kernel patches diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index a374b370231..94982ba65bf 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -3,6 +3,7 @@ name: Build all core packages on: pull_request: paths: + - '.github/workflows/build.yml' - '.github/workflows/packages.yml' - 'config/**' - 'include/**' @@ -11,6 +12,7 @@ on: - 'toolchain/**' push: paths: + - '.github/workflows/build.yml' - '.github/workflows/packages.yml' - 'config/**' - 'include/**' diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index def01678c67..304b5f7d62a 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -174,6 +174,31 @@ jobs: run: | echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV" + # Per branch tools container tag + # By default stick to latest + # For official test targetting openwrt stable branch + # Get the branch or parse the tag and push dedicated tools containers + # Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9] + # will refresh the tools container with the matching tag. + # (example branch openwrt-22.03 -> tools:openwrt-22.03) + # (example branch openwrt-22.03-test -> tools:openwrt-22.03) + - name: Determine tools container tag + run: | + CONTAINER_TAG=latest + + if [ ${{ github.ref_type }} == "branch" ]; then + if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then + CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\).*/\1/')" + fi + elif [ ${{ github.ref_type }} == "tag" ]; then + if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then + CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + fi + fi + + echo "Tools container to push tools:$CONTAINER_TAG" + echo "CONTAINER_TAG=$CONTAINER_TAG" >> "$GITHUB_ENV" + - name: Checkout uses: actions/checkout@v3 with: @@ -197,5 +222,5 @@ jobs: with: context: openwrt push: true - tags: ghcr.io/${{ env.OWNER_LC }}/tools:latest + tags: ghcr.io/${{ env.OWNER_LC }}/tools:${{ env.CONTAINER_TAG }} file: openwrt/.github/workflows/Dockerfile.tools diff --git a/config/Config-images.in b/config/Config-images.in index aa238762590..0252ef64251 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -150,7 +150,7 @@ menu "Target Images" bool "squashfs" default y if USES_SQUASHFS help - Build a squashfs-lzma root filesystem. + Build a squashfs root filesystem. config TARGET_SQUASHFS_BLOCK_SIZE int "Block size (in KiB)" @@ -158,6 +158,9 @@ menu "Target Images" default 64 if LOW_MEMORY_FOOTPRINT default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT) default 256 + help + Select squashfs block size, must be one of: + 4, 8, 16, 32, 64, 128, 256, 512, 1024 menuconfig TARGET_ROOTFS_UBIFS bool "ubifs" diff --git a/include/image-commands.mk b/include/image-commands.mk index 1f6ba1c15a4..41e1c969485 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -53,6 +53,7 @@ define Build/append-image-stage cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta" fwtool -s /dev/null -t "$@.stripmeta" || : fwtool -i /dev/null -t "$@.stripmeta" || : + mkdir -p "$(STAGING_DIR_IMAGE)" dd if="$@.stripmeta" of="$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)" dd if="$@.stripmeta" >> "$@" rm "$@.stripmeta" diff --git a/include/kernel-5.10 b/include/kernel-5.10 index 16040014ff1..b7179b8567e 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .156 -LINUX_KERNEL_HASH-5.10.156 = 679e9964ca720027967391b61db990ceb7868e93e203f87724f18310f4955923 +LINUX_VERSION-5.10 = .158 +LINUX_KERNEL_HASH-5.10.158 = 1e0a24bb5510caa18b3601b25e12cc2a1ce123948de551f4f2cdbb40aea707e7 diff --git a/include/kernel-5.15 b/include/kernel-5.15 index a95ca029de1..18444aaa84a 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .80 -LINUX_KERNEL_HASH-5.15.80 = 3b321a6466d2021f60ed8d4e33bba21db2f23efc2ddd2d9fb775393d9afdfd4d +LINUX_VERSION-5.15 = .82 +LINUX_KERNEL_HASH-5.15.82 = fceef6bb79bac494663ccde34453521fc616cd94272fd30564752b3742381b65 diff --git a/include/prereq-build.mk b/include/prereq-build.mk index c5c2f1c8bb4..9c4ef547ad0 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -149,6 +149,9 @@ $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \ gstat -c%s $(TOPDIR)/Makefile, \ stat -c%s $(TOPDIR)/Makefile)) +$(eval $(call SetupHostCommand,gzip,Please install 'gzip', \ + gzip --version &1 | grep zipfile, \ unzip)) diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk index 46fc52b15e4..0b37c0f9438 100644 --- a/include/trusted-firmware-a.mk +++ b/include/trusted-firmware-a.mk @@ -81,6 +81,7 @@ define Build/Compile/Trusted-Firmware-A $(if $(DTC),DTC="$(DTC)") \ PLAT=$(PLAT) \ BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \ + $(if $(CONFIG_BINUTILS_VERSION_2_39),LDFLAGS="-no-warn-rwx-segments") \ $(TFA_MAKE_FLAGS) endef diff --git a/package/boot/uboot-bcm4908/Makefile b/package/boot/uboot-bcm4908/Makefile index 7eacd23a02c..70d14e375e3 100644 --- a/package/boot/uboot-bcm4908/Makefile +++ b/package/boot/uboot-bcm4908/Makefile @@ -7,9 +7,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://git.openwrt.org/project/bcm63xx/u-boot.git -PKG_SOURCE_DATE:=2022-03-15 -PKG_SOURCE_VERSION:=0625aad74d1f5b6f9c068955ad3fd7f6df635e50 -PKG_MIRROR_HASH:=0602e0e4f101ead206940eccca832b75191905c1e81290340a89b07dbee7a6ce +PKG_SOURCE_DATE:=2022-12-08 +PKG_SOURCE_VERSION:=4435700d18a791dca0d8d767e5414dfac9df4451 +PKG_MIRROR_HASH:=6062ce611d7222eb3b9768bb4944ff1c7bcf26b997280adf5ea8d7afe83f28a8 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/ath10k-ct/patches/100-api_update.patch b/package/kernel/ath10k-ct/patches/100-api_update.patch new file mode 100644 index 00000000000..5343c29eb9d --- /dev/null +++ b/package/kernel/ath10k-ct/patches/100-api_update.patch @@ -0,0 +1,618 @@ +--- a/ath10k-5.15/mac.c ++++ b/ath10k-5.15/mac.c +@@ -788,7 +788,7 @@ int ath10k_mac_vif_chan(struct ieee80211 + struct ieee80211_chanctx_conf *conf; + + rcu_read_lock(); +- conf = rcu_dereference(vif->chanctx_conf); ++ conf = rcu_dereference(vif->bss_conf.chanctx_conf); + if (!conf) { + rcu_read_unlock(); + return -ENOENT; +@@ -1764,8 +1764,8 @@ static int ath10k_vdev_start_restart(str + arg.channel.chan_radar = + !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); + } else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { +- arg.ssid = arvif->vif->bss_conf.ssid; +- arg.ssid_len = arvif->vif->bss_conf.ssid_len; ++ arg.ssid = arvif->vif->cfg.ssid; ++ arg.ssid_len = arvif->vif->cfg.ssid_len; + } + + ath10k_dbg(ar, ATH10K_DBG_MAC, +@@ -1890,7 +1890,7 @@ static int ath10k_mac_setup_bcn_tmpl(str + arvif->vdev_type != WMI_VDEV_TYPE_IBSS) + return 0; + +- bcn = ieee80211_beacon_get_template(hw, vif, &offs); ++ bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); + if (!bcn) { + ath10k_warn(ar, "failed to get beacon template from mac80211\n"); + return -EPERM; +@@ -2083,8 +2083,7 @@ static void ath10k_control_beaconing(str + } + + static void ath10k_control_ibss(struct ath10k_vif *arvif, +- struct ieee80211_bss_conf *info, +- const u8 self_peer[ETH_ALEN]) ++ struct ieee80211_vif *vif) + { + struct ath10k *ar = arvif->ar; + u32 vdev_param; +@@ -2092,7 +2091,7 @@ static void ath10k_control_ibss(struct a + + lockdep_assert_held(&arvif->ar->conf_mutex); + +- if (!info->ibss_joined) { ++ if (!vif->cfg.ibss_joined) { + if (is_zero_ether_addr(arvif->bssid)) + return; + +@@ -2298,7 +2297,7 @@ static void ath10k_mac_vif_ap_csa_count_ + if (arvif->vdev_type != WMI_VDEV_TYPE_AP) + return; + +- if (!vif->csa_active) ++ if (!vif->bss_conf.csa_active) + return; + + if (!arvif->is_up) +@@ -2433,7 +2432,7 @@ static void ath10k_peer_assoc_h_basic(st + lockdep_assert_held(&ar->conf_mutex); + + if (vif->type == NL80211_IFTYPE_STATION) +- aid = vif->bss_conf.aid; ++ aid = vif->cfg.aid; + else + aid = sta->aid; + +@@ -2463,7 +2462,8 @@ static void ath10k_peer_assoc_h_crypto(s + return; + + bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, +- info->ssid_len ? info->ssid : NULL, info->ssid_len, ++ vif->cfg.ssid_len ? vif->cfg.ssid : NULL, ++ vif->cfg.ssid_len, + IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); + if (bss) { + const struct cfg80211_bss_ies *ies; +@@ -2521,7 +2521,7 @@ static void ath10k_peer_assoc_h_rates(st + + band = def.chan->band; + sband = ar->hw->wiphy->bands[band]; +- ratemask = sta->supp_rates[band]; ++ ratemask = sta->deflink.supp_rates[band]; + ratemask &= arvif->bitrate_mask.control[band].legacy; + rates = sband->bitrates; + +@@ -2770,7 +2770,7 @@ static void ath10k_peer_assoc_h_ht(struc + struct ieee80211_sta *sta, + struct wmi_peer_assoc_complete_arg *arg) + { +- const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; ++ const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; + struct ath10k_vif *arvif = (void *)vif->drv_priv; + struct cfg80211_chan_def def; + enum nl80211_band band; +@@ -2814,7 +2814,7 @@ static void ath10k_peer_assoc_h_ht(struc + if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) + arg->peer_flags |= ar->wmi.peer_flags->ldbc; + +- if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) { ++ if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) { + arg->peer_flags |= ar->wmi.peer_flags->bw40; + arg->peer_rate_caps |= WMI_RC_CW40_FLAG; + } +@@ -2883,7 +2883,7 @@ static void ath10k_peer_assoc_h_ht(struc + arg->peer_ht_rates.rates[i] = i; + } else { + arg->peer_ht_rates.num_rates = n; +- arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); ++ arg->peer_num_spatial_streams = min(sta->deflink.rx_nss, max_nss); + } + + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ht peer %pM mcs cnt %d nss %d\n", +@@ -3045,7 +3045,7 @@ static void ath10k_peer_assoc_h_vht(stru + struct ieee80211_sta *sta, + struct wmi_peer_assoc_complete_arg *arg) + { +- const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; ++ const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; + struct ath10k_vif *arvif = (void *)vif->drv_priv; + struct ath10k_hw_params *hw = &ar->hw_params; + struct cfg80211_chan_def def; +@@ -3087,10 +3087,10 @@ static void ath10k_peer_assoc_h_vht(stru + (1U << (IEEE80211_HT_MAX_AMPDU_FACTOR + + ampdu_factor)) - 1); + +- if (sta->bandwidth == IEEE80211_STA_RX_BW_80) ++ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) + arg->peer_flags |= ar->wmi.peer_flags->bw80; + +- if (sta->bandwidth == IEEE80211_STA_RX_BW_160) ++ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) + arg->peer_flags |= ar->wmi.peer_flags->bw160; + + /* Calculate peer NSS capability from VHT capabilities if STA +@@ -3104,7 +3104,7 @@ static void ath10k_peer_assoc_h_vht(stru + vht_mcs_mask[i]) + max_nss = i + 1; + } +- arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); ++ arg->peer_num_spatial_streams = min(sta->deflink.rx_nss, max_nss); + arg->peer_vht_rates.rx_max_rate = + __le16_to_cpu(vht_cap->vht_mcs.rx_highest); + arg->peer_vht_rates.rx_mcs_set = +@@ -3266,7 +3266,7 @@ static bool ath10k_mac_sta_has_ofdm_only + { + struct ath10k_vif *arvif = (void *)vif->drv_priv; + u32 msk = arvif->bitrate_mask.control[NL80211_BAND_2GHZ].legacy & +- sta->supp_rates[NL80211_BAND_2GHZ]; ++ sta->deflink.supp_rates[NL80211_BAND_2GHZ]; + /* We have 12 bits of legacy rates, first 4 are /b (CCK) rates. */ + return (msk & 0xff0) && !(msk & 0xf); + } +@@ -3276,7 +3276,7 @@ static bool ath10k_mac_sta_has_ofdm_and_ + { + struct ath10k_vif *arvif = (void *)vif->drv_priv; + u32 msk = arvif->bitrate_mask.control[NL80211_BAND_2GHZ].legacy & +- sta->supp_rates[NL80211_BAND_2GHZ]; ++ sta->deflink.supp_rates[NL80211_BAND_2GHZ]; + /* We have 12 bits of legacy rates, first 4 are /b (CCK) rates. */ + return ((msk & 0xf) && (msk & 0xff0)); + } +@@ -3284,8 +3284,10 @@ static bool ath10k_mac_sta_has_ofdm_and_ + static enum wmi_phy_mode ath10k_mac_get_phymode_vht(struct ath10k *ar, + struct ieee80211_sta *sta) + { +- if (sta->bandwidth == IEEE80211_STA_RX_BW_160) { +- switch (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { ++ struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; ++ ++ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) { ++ switch (vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { + case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ: + return MODE_11AC_VHT160; + case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ: +@@ -3296,13 +3298,13 @@ static enum wmi_phy_mode ath10k_mac_get_ + } + } + +- if (sta->bandwidth == IEEE80211_STA_RX_BW_80) ++ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) + return MODE_11AC_VHT80; + +- if (sta->bandwidth == IEEE80211_STA_RX_BW_40) ++ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) + return MODE_11AC_VHT40; + +- if (sta->bandwidth == IEEE80211_STA_RX_BW_20) ++ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) + return MODE_11AC_VHT20; + + return MODE_UNKNOWN; +@@ -3329,15 +3331,15 @@ static void ath10k_peer_assoc_h_phymode( + + switch (band) { + case NL80211_BAND_2GHZ: +- if (sta->vht_cap.vht_supported && ++ if (sta->deflink.vht_cap.vht_supported && + !ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) { +- if (sta->bandwidth == IEEE80211_STA_RX_BW_40) ++ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) + phymode = MODE_11AC_VHT40; + else + phymode = MODE_11AC_VHT20; +- } else if (sta->ht_cap.ht_supported && ++ } else if (sta->deflink.ht_cap.ht_supported && + !ath10k_peer_assoc_h_ht_masked(ht_mcs_mask)) { +- if (sta->bandwidth == IEEE80211_STA_RX_BW_40) ++ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) + phymode = MODE_11NG_HT40; + else + phymode = MODE_11NG_HT20; +@@ -3354,12 +3356,12 @@ static void ath10k_peer_assoc_h_phymode( + /* + * Check VHT first. + */ +- if (sta->vht_cap.vht_supported && ++ if (sta->deflink.vht_cap.vht_supported && + !ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) { + phymode = ath10k_mac_get_phymode_vht(ar, sta); +- } else if (sta->ht_cap.ht_supported && ++ } else if (sta->deflink.ht_cap.ht_supported && + !ath10k_peer_assoc_h_ht_masked(ht_mcs_mask)) { +- if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ++ if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) + phymode = MODE_11NA_HT40; + else + phymode = MODE_11NA_HT20; +@@ -3373,8 +3375,8 @@ static void ath10k_peer_assoc_h_phymode( + } + + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac peer %pM phymode %s legacy-supp-rates: 0x%x arvif-legacy-rates: 0x%x vht-supp: %d\n", +- sta->addr, ath10k_wmi_phymode_str(phymode), sta->supp_rates[band], +- arvif->bitrate_mask.control[band].legacy, sta->vht_cap.vht_supported); ++ sta->addr, ath10k_wmi_phymode_str(phymode), sta->deflink.supp_rates[band], ++ arvif->bitrate_mask.control[band].legacy, sta->deflink.vht_cap.vht_supported); + + arg->peer_phymode = phymode; + WARN_ON(phymode == MODE_UNKNOWN); +@@ -3677,8 +3679,8 @@ static void ath10k_bss_assoc(struct ieee + /* ap_sta must be accessed only within rcu section which must be left + * before calling ath10k_setup_peer_smps() which might sleep. + */ +- ht_cap = ap_sta->ht_cap; +- vht_cap = ap_sta->vht_cap; ++ ht_cap = ap_sta->deflink.ht_cap; ++ vht_cap = ap_sta->deflink.vht_cap; + + ret = ath10k_peer_assoc_prepare(ar, vif, ap_sta, &peer_arg); + if (ret) { +@@ -3713,11 +3715,11 @@ static void ath10k_bss_assoc(struct ieee + + ath10k_dbg(ar, ATH10K_DBG_MAC, + "mac vdev %d up (associated) bssid %pM aid %d bandwidth %d\n", +- arvif->vdev_id, bss_conf->bssid, bss_conf->aid, ap_sta->bandwidth); ++ arvif->vdev_id, bss_conf->bssid, vif->cfg.aid, ap_sta->deflink.bandwidth); + + WARN_ON(arvif->is_up); + +- arvif->aid = bss_conf->aid; ++ arvif->aid = vif->cfg.aid; + ether_addr_copy(arvif->bssid, bss_conf->bssid); + + ret = ath10k_wmi_pdev_set_param(ar, +@@ -4022,7 +4024,7 @@ static int ath10k_station_assoc(struct a + */ + if (!reassoc) { + ret = ath10k_setup_peer_smps(ar, arvif, sta->addr, +- &sta->ht_cap); ++ &sta->deflink.ht_cap); + if (ret) { + ath10k_warn(ar, "failed to setup peer SMPS for vdev %d: %d\n", + arvif->vdev_id, ret); +@@ -6916,7 +6918,7 @@ static void ath10k_recalculate_mgmt_rate + static void ath10k_bss_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *info, +- u32 changed) ++ u64 changed) + { + struct ath10k *ar = hw->priv; + struct ath10k_vif *arvif = (void *)vif->drv_priv; +@@ -6930,7 +6932,7 @@ static void ath10k_bss_info_changed(stru + mutex_lock(&ar->conf_mutex); + + if (changed & BSS_CHANGED_IBSS) +- ath10k_control_ibss(arvif, info, vif->addr); ++ ath10k_control_ibss(arvif, vif); + + if (changed & BSS_CHANGED_BEACON_INT) { + arvif->beacon_interval = info->beacon_int; +@@ -6995,9 +6997,9 @@ static void ath10k_bss_info_changed(stru + + if (changed & BSS_CHANGED_SSID && + vif->type == NL80211_IFTYPE_AP) { +- arvif->u.ap.ssid_len = info->ssid_len; +- if (info->ssid_len) +- memcpy(arvif->u.ap.ssid, info->ssid, info->ssid_len); ++ arvif->u.ap.ssid_len = vif->cfg.ssid_len; ++ if (vif->cfg.ssid_len) ++ memcpy(arvif->u.ap.ssid, vif->cfg.ssid, vif->cfg.ssid_len); + arvif->u.ap.hidden_ssid = info->hidden_ssid; + } + +@@ -7074,7 +7076,7 @@ static void ath10k_bss_info_changed(stru + } + + if (changed & BSS_CHANGED_ASSOC) { +- if (info->assoc) { ++ if (vif->cfg.assoc) { + /* Workaround: Make sure monitor vdev is not running + * when associating to prevent some firmware revisions + * (e.g. 10.1 and 10.2) from crashing. +@@ -7099,7 +7101,7 @@ static void ath10k_bss_info_changed(stru + } + + if (changed & BSS_CHANGED_PS) { +- arvif->ps = vif->bss_conf.ps; ++ arvif->ps = vif->cfg.ps; + + ret = ath10k_config_ps(ar); + if (ret) +@@ -7699,7 +7701,7 @@ static void ath10k_sta_rc_update_wk(stru + + if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { + ath10k_dbg(ar, ATH10K_DBG_STA, "mac update sta %pM supp rates, bandwidth: %d\n", +- sta->addr, sta->bandwidth); ++ sta->addr, sta->deflink.bandwidth); + + err = ath10k_station_assoc(ar, arvif->vif, sta, true); + if (err) +@@ -7751,10 +7753,10 @@ static int ath10k_sta_set_txpwr(struct i + int ret = 0; + s16 txpwr; + +- if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC) { ++ if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC) { + txpwr = 0; + } else { +- txpwr = sta->txpwr.power; ++ txpwr = sta->deflink.txpwr.power; + if (!txpwr) + return -EINVAL; + } +@@ -7874,26 +7876,29 @@ static int ath10k_mac_validate_rate_mask + struct ieee80211_sta *sta, + u32 rate_ctrl_flag, u8 nss) + { +- if (nss > sta->rx_nss) { ++ struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; ++ struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; ++ ++ if (nss > sta->deflink.rx_nss) { + ath10k_warn(ar, "Invalid nss field, configured %u limit %u\n", +- nss, sta->rx_nss); ++ nss, sta->deflink.rx_nss); + return -EINVAL; + } + + if (ATH10K_HW_PREAMBLE(rate_ctrl_flag) == WMI_RATE_PREAMBLE_VHT) { +- if (!sta->vht_cap.vht_supported) { ++ if (!vht_cap->vht_supported) { + ath10k_warn(ar, "Invalid VHT rate for sta %pM\n", + sta->addr); + return -EINVAL; + } + } else if (ATH10K_HW_PREAMBLE(rate_ctrl_flag) == WMI_RATE_PREAMBLE_HT) { +- if (!sta->ht_cap.ht_supported || sta->vht_cap.vht_supported) { ++ if (!ht_cap->ht_supported || vht_cap->vht_supported) { + ath10k_warn(ar, "Invalid HT rate for sta %pM\n", + sta->addr); + return -EINVAL; + } + } else { +- if (sta->ht_cap.ht_supported || sta->vht_cap.vht_supported) ++ if (ht_cap->ht_supported || vht_cap->vht_supported) + return -EINVAL; + } + +@@ -8567,7 +8572,7 @@ static int ath10k_sta_state(struct ieee8 + * New association. + */ + ath10k_dbg(ar, ATH10K_DBG_STA, "mac sta %pM associated, bandwidth: %d\n", +- sta->addr, sta->bandwidth); ++ sta->addr, sta->deflink.bandwidth); + + ret = ath10k_station_assoc(ar, vif, sta, false); + if (ret) +@@ -8580,7 +8585,7 @@ static int ath10k_sta_state(struct ieee8 + * Tdls station authorized. + */ + ath10k_dbg(ar, ATH10K_DBG_STA, "mac tdls sta %pM authorized, bandwidth: %d\n", +- sta->addr, sta->bandwidth); ++ sta->addr, sta->deflink.bandwidth); + + ret = ath10k_station_assoc(ar, vif, sta, false); + if (ret) { +@@ -8721,8 +8726,8 @@ exit: + return ret; + } + +-static int ath10k_conf_tx(struct ieee80211_hw *hw, +- struct ieee80211_vif *vif, u16 ac, ++static int ath10k_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ++ unsigned int link_id, u16 ac, + const struct ieee80211_tx_queue_params *params) + { + struct ath10k *ar = hw->priv; +@@ -9308,7 +9313,7 @@ static bool ath10k_mac_set_vht_bitrate_m + u8 rate = arvif->vht_pfr; + + /* skip non vht and multiple rate peers */ +- if (!sta->vht_cap.vht_supported || arvif->vht_num_rates != 1) ++ if (!sta->deflink.vht_cap.vht_supported || arvif->vht_num_rates != 1) + return false; + + err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, +@@ -9349,7 +9354,7 @@ static void ath10k_mac_clr_bitrate_mask_ + int err; + + /* clear vht peers only */ +- if (arsta->arvif != arvif || !sta->vht_cap.vht_supported) ++ if (arsta->arvif != arvif || !sta->deflink.vht_cap.vht_supported) + return; + + err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, +@@ -9534,13 +9539,13 @@ static void ath10k_sta_rc_update(struct + + ath10k_dbg(ar, ATH10K_DBG_STA, + "mac sta rc update for %pM changed %08x bw %d nss %d smps %d\n", +- sta->addr, changed, sta->bandwidth, sta->rx_nss, +- sta->smps_mode); ++ sta->addr, changed, sta->deflink.bandwidth, sta->deflink.rx_nss, ++ sta->deflink.smps_mode); + + if (changed & IEEE80211_RC_BW_CHANGED) { + bw = WMI_PEER_CHWIDTH_20MHZ; + +- switch (sta->bandwidth) { ++ switch (sta->deflink.bandwidth) { + case IEEE80211_STA_RX_BW_20: + bw = WMI_PEER_CHWIDTH_20MHZ; + break; +@@ -9555,7 +9560,7 @@ static void ath10k_sta_rc_update(struct + break; + default: + ath10k_warn(ar, "Invalid bandwidth %d in rc update for %pM\n", +- sta->bandwidth, sta->addr); ++ sta->deflink.bandwidth, sta->addr); + bw = WMI_PEER_CHWIDTH_20MHZ; + break; + } +@@ -9564,12 +9569,12 @@ static void ath10k_sta_rc_update(struct + } + + if (changed & IEEE80211_RC_NSS_CHANGED) +- arsta->nss = sta->rx_nss; ++ arsta->nss = sta->deflink.rx_nss; + + if (changed & IEEE80211_RC_SMPS_CHANGED) { + smps = WMI_PEER_SMPS_PS_NONE; + +- switch (sta->smps_mode) { ++ switch (sta->deflink.smps_mode) { + case IEEE80211_SMPS_AUTOMATIC: + case IEEE80211_SMPS_OFF: + smps = WMI_PEER_SMPS_PS_NONE; +@@ -9582,7 +9587,7 @@ static void ath10k_sta_rc_update(struct + break; + case IEEE80211_SMPS_NUM_MODES: + ath10k_warn(ar, "Invalid smps %d in sta rc update for %pM\n", +- sta->smps_mode, sta->addr); ++ sta->deflink.smps_mode, sta->addr); + smps = WMI_PEER_SMPS_PS_NONE; + break; + } +@@ -9896,7 +9901,7 @@ ath10k_mac_change_chanctx_cnt_iter(void + { + struct ath10k_mac_change_chanctx_arg *arg = data; + +- if (rcu_access_pointer(vif->chanctx_conf) != arg->ctx) ++ if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx) + return; + + arg->n_vifs++; +@@ -9909,7 +9914,7 @@ ath10k_mac_change_chanctx_fill_iter(void + struct ath10k_mac_change_chanctx_arg *arg = data; + struct ieee80211_chanctx_conf *ctx; + +- ctx = rcu_access_pointer(vif->chanctx_conf); ++ ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf); + if (ctx != arg->ctx) + return; + +@@ -9982,6 +9987,7 @@ unlock: + static int + ath10k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, ++ struct ieee80211_bss_conf *link_conf, + struct ieee80211_chanctx_conf *ctx) + { + struct ath10k *ar = hw->priv; +@@ -10061,6 +10067,7 @@ err: + static void + ath10k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, ++ struct ieee80211_bss_conf *link_conf, + struct ieee80211_chanctx_conf *ctx) + { + struct ath10k *ar = hw->priv; +--- a/ath10k-5.15/txrx.c ++++ b/ath10k-5.15/txrx.c +@@ -260,7 +260,7 @@ int ath10k_txrx_tx_unref(struct ath10k_h + nf = ar->debug.nf_sum[0]; + #endif + info->status.ack_signal = nf + tx_done->ack_rssi; +- info->status.is_valid_ack_signal = true; ++ info->status.flags |= IEEE80211_TX_STATUS_ACK_SIGNAL_VALID; + } + + if (tx_done->tx_rate_code || tx_done->tx_rate_flags || ar->ok_tx_rate_status) { +--- a/ath10k-5.15/wmi.c ++++ b/ath10k-5.15/wmi.c +@@ -2587,7 +2587,7 @@ wmi_process_mgmt_tx_comp(struct ath10k * + info->flags |= IEEE80211_TX_STAT_ACK; + info->status.ack_signal = ath10k_get_noisefloor(0, ar) + + param->ack_rssi; +- info->status.is_valid_ack_signal = true; ++ info->status.flags |= IEEE80211_TX_STATUS_ACK_SIGNAL_VALID; + } + + ieee80211_tx_status_irqsafe(ar->hw, msdu); +@@ -4258,13 +4258,13 @@ void ath10k_wmi_event_host_swba(struct a + * Once CSA counter is completed stop sending beacons until + * actual channel switch is done + */ +- if (arvif->vif->csa_active && ++ if (arvif->vif->bss_conf.csa_active && + ieee80211_beacon_cntdwn_is_complete(arvif->vif)) { + ieee80211_csa_finish(arvif->vif); + continue; + } + +- bcn = ieee80211_beacon_get(ar->hw, arvif->vif); ++ bcn = ieee80211_beacon_get(ar->hw, arvif->vif, 0); + if (!bcn) { + ath10k_warn(ar, "could not get mac80211 beacon, vdev_id: %i addr: %pM\n", + arvif->vdev_id, arvif->vif->addr); +--- a/ath10k-5.15/htt_rx.c ++++ b/ath10k-5.15/htt_rx.c +@@ -4017,7 +4017,7 @@ ath10k_update_per_peer_tx_stats(struct a + switch (txrate.flags) { + case WMI_RATE_PREAMBLE_OFDM: + if (arsta->arvif && arsta->arvif->vif) +- conf = rcu_dereference(arsta->arvif->vif->chanctx_conf); ++ conf = rcu_dereference(arsta->arvif->vif->bss_conf.chanctx_conf); + if (conf && conf->def.chan->band == NL80211_BAND_5GHZ) + arsta->tx_info.status.rates[0].idx = rate_idx - 4; + break; +--- a/ath10k-5.15/wmi-tlv.c ++++ b/ath10k-5.15/wmi-tlv.c +@@ -205,7 +205,7 @@ static int ath10k_wmi_tlv_event_bcn_tx_s + } + + arvif = ath10k_get_arvif(ar, vdev_id); +- if (arvif && arvif->is_up && arvif->vif->csa_active) ++ if (arvif && arvif->is_up && arvif->vif->bss_conf.csa_active) + ieee80211_queue_work(ar->hw, &arvif->ap_csa_work); + + kfree(tb); +--- a/ath10k-5.15/core.c ++++ b/ath10k-5.15/core.c +@@ -4081,7 +4081,7 @@ static int ath10k_core_probe_fw(struct a + ath10k_debug_print_board_info(ar); + } + +- device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr)); ++ device_get_mac_address(ar->dev, ar->mac_addr); + + /* Try to get mac address from device node (from nvmem cell) */ + of_get_mac_address(ar->dev->of_node, ar->mac_addr); +--- a/ath10k-5.15/pci.c ++++ b/ath10k-5.15/pci.c +@@ -3547,8 +3547,7 @@ static void ath10k_pci_free_irq(struct a + + void ath10k_pci_init_napi(struct ath10k *ar) + { +- netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll, +- ATH10K_NAPI_BUDGET); ++ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll); + } + + static int ath10k_pci_init_irq(struct ath10k *ar) +--- a/ath10k-5.15/sdio.c ++++ b/ath10k-5.15/sdio.c +@@ -2531,8 +2531,7 @@ static int ath10k_sdio_probe(struct sdio + return -ENOMEM; + } + +- netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_sdio_napi_poll, +- ATH10K_NAPI_BUDGET); ++ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_sdio_napi_poll); + + ath10k_dbg(ar, ATH10K_DBG_BOOT, + "sdio new func %d vendor 0x%x device 0x%x block 0x%x/0x%x\n", +--- a/ath10k-5.15/snoc.c ++++ b/ath10k-5.15/snoc.c +@@ -1242,8 +1242,7 @@ static int ath10k_snoc_napi_poll(struct + + static void ath10k_snoc_init_napi(struct ath10k *ar) + { +- netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_snoc_napi_poll, +- ATH10K_NAPI_BUDGET); ++ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_snoc_napi_poll); + } + + static int ath10k_snoc_request_irq(struct ath10k *ar) diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch index fb8468b9c00..18c7930203c 100644 --- a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch @@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin if (ret) --- a/ath10k-5.15/mac.c +++ b/ath10k-5.15/mac.c -@@ -11544,7 +11544,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -11551,7 +11551,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 8ecbe304189..aa40e8818c7 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,11 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.15.81-1 +PKG_VERSION:=6.1-rc8 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.81/ -PKG_HASH:=5227d3c35ccebacfaee6b8180b3a87b9910f3c94ee768ebc5c0fef3c86b6146d +# PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.58/ +PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ +PKG_HASH:=7f3d96c2573183cd79d6a3ebe5e1b7b73c19d1326d443c85b69c4181f14e6e2b PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index ed2805213e4..0a7f787cff8 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -1033,7 +1033,7 @@ mac80211_setup_vif() { mesh) wireless_vif_parse_encryption [ -z "$htmode" ] && htmode="NOHT"; - if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then + if wpa_supplicant -vmesh || [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then mac80211_setup_supplicant $vif_enable || failed=1 else mac80211_setup_mesh $vif_enable diff --git a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch index 4ea33365d18..fd29fb372f8 100644 --- a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch +++ b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch @@ -82,7 +82,7 @@ help --- a/local-symbols +++ b/local-symbols -@@ -106,6 +106,7 @@ ADM8211= +@@ -110,6 +110,7 @@ ADM8211= ATH_COMMON= WLAN_VENDOR_ATH= ATH_DEBUG= diff --git a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch index c66301efa73..8d83921a3b8 100644 --- a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch +++ b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch @@ -1,6 +1,6 @@ --- a/net/wireless/reg.c +++ b/net/wireless/reg.c -@@ -3315,6 +3315,8 @@ void regulatory_hint_country_ie(struct w +@@ -3370,6 +3370,8 @@ void regulatory_hint_country_ie(struct w enum environment_cap env = ENVIRON_ANY; struct regulatory_request *request = NULL, *lr; @@ -9,7 +9,7 @@ /* IE len must be evenly divisible by 2 */ if (country_ie_len & 0x01) return; -@@ -3566,6 +3568,7 @@ static bool is_wiphy_all_set_reg_flag(en +@@ -3621,6 +3623,7 @@ static bool is_wiphy_all_set_reg_flag(en void regulatory_hint_disconnect(void) { diff --git a/package/kernel/mac80211/patches/ath/405-ath_regd_us.patch b/package/kernel/mac80211/patches/ath/405-ath_regd_us.patch index 088833199d0..6723721a47b 100644 --- a/package/kernel/mac80211/patches/ath/405-ath_regd_us.patch +++ b/package/kernel/mac80211/patches/ath/405-ath_regd_us.patch @@ -8,7 +8,7 @@ FRANCE_RES = 0x31, FCC3_FCCA = 0x3A, FCC3_WORLD = 0x3B, -@@ -172,6 +173,7 @@ static struct reg_dmn_pair_mapping regDo +@@ -173,6 +174,7 @@ static struct reg_dmn_pair_mapping regDo {FCC2_WORLD, CTL_FCC, CTL_ETSI}, {FCC2_ETSIC, CTL_FCC, CTL_ETSI}, {FCC3_FCCA, CTL_FCC, CTL_FCC}, @@ -16,7 +16,7 @@ {FCC3_WORLD, CTL_FCC, CTL_ETSI}, {FCC3_ETSIC, CTL_FCC, CTL_ETSI}, {FCC4_FCCA, CTL_FCC, CTL_FCC}, -@@ -483,6 +485,7 @@ static struct country_code_to_enum_rd al +@@ -486,6 +488,7 @@ static struct country_code_to_enum_rd al {CTRY_UAE, NULL1_WORLD, "AE"}, {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"}, {CTRY_UNITED_STATES, FCC3_FCCA, "US"}, diff --git a/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch b/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch index d9a3cd534c8..f89083b98ac 100644 --- a/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch +++ b/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch @@ -37,7 +37,7 @@ void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); --- a/local-symbols +++ b/local-symbols -@@ -165,6 +165,7 @@ ATH10K_SNOC= +@@ -169,6 +169,7 @@ ATH10K_SNOC= ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= diff --git a/package/kernel/mac80211/patches/ath10k/081-01-v6.0-ath10k-improve-tx-status-reporting.patch b/package/kernel/mac80211/patches/ath10k/081-01-v6.0-ath10k-improve-tx-status-reporting.patch deleted file mode 100644 index c0248509188..00000000000 --- a/package/kernel/mac80211/patches/ath10k/081-01-v6.0-ath10k-improve-tx-status-reporting.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 2587d5198aa5adcbd8896aae4a2404dc13d48637 Mon Sep 17 00:00:00 2001 -From: Sergey Ryazanov -Date: Wed, 18 May 2022 10:27:26 +0300 -Subject: ath10k: improve tx status reporting -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We use ieee80211_tx_status() to report each completed tx frame. -Internally, this function calls sta_info_get_by_addrs(), what has a -couple of drawbacks: -1. additional station lookup causes a performance degradation; -2. mac80211 can not properly account Ethernet encapsulated frames due - to the inability to properly determine the destination (station) MAC - address since ieee80211_tx_status() assumes the frame has a 802.11 - header. - -The latter is especially destructive if we want to use hardware frames -encapsulation. - -To fix both of these issues, replace ieee80211_tx_status() with -ieee80211_tx_status_ext() call and feed it station pointer from the tx -queue associated with the transmitted frame. - -Tested-on: QCA9888 hw2.0 PCI 10.4-3.9.0.2-00131 -Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1 - -Signed-off-by: Sergey Ryazanov -Tested-by: Oldřich Jedlička # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880) -Tested-by: Edward Matijevic # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1) -Tested-by: Edward Matijevic # QCA9377 PCI in Sta mode -Tested-by: Zhijun You # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159) -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220516032519.29831-2-ryazanov.s.a@gmail.com ---- - drivers/net/wireless/ath/ath10k/txrx.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath10k/txrx.c -+++ b/drivers/net/wireless/ath/ath10k/txrx.c -@@ -43,6 +43,7 @@ out: - int ath10k_txrx_tx_unref(struct ath10k_htt *htt, - const struct htt_tx_done *tx_done) - { -+ struct ieee80211_tx_status status; - struct ath10k *ar = htt->ar; - struct device *dev = ar->dev; - struct ieee80211_tx_info *info; -@@ -128,7 +129,19 @@ int ath10k_txrx_tx_unref(struct ath10k_h - info->status.is_valid_ack_signal = true; - } - -- ieee80211_tx_status(htt->ar->hw, msdu); -+ memset(&status, 0, sizeof(status)); -+ status.skb = msdu; -+ status.info = info; -+ -+ rcu_read_lock(); -+ -+ if (txq) -+ status.sta = txq->sta; -+ -+ ieee80211_tx_status_ext(htt->ar->hw, &status); -+ -+ rcu_read_unlock(); -+ - /* we do not own the msdu anymore */ - - return 0; diff --git a/package/kernel/mac80211/patches/ath10k/081-02-v6.0-ath10k-turn-rawmode-into-frame-mode.patch b/package/kernel/mac80211/patches/ath10k/081-02-v6.0-ath10k-turn-rawmode-into-frame-mode.patch deleted file mode 100644 index e6728155226..00000000000 --- a/package/kernel/mac80211/patches/ath10k/081-02-v6.0-ath10k-turn-rawmode-into-frame-mode.patch +++ /dev/null @@ -1,74 +0,0 @@ -From a09740548275a74b897654b3aca5af589289b57a Mon Sep 17 00:00:00 2001 -From: Sergey Ryazanov -Date: Mon, 16 May 2022 13:26:00 +0300 -Subject: ath10k: turn rawmode into frame_mode - -Turn boolean rawmode module param into integer frame_mode param that -contains value from ath10k_hw_txrx_mode enum. As earlier the default -param value is non-RAW (native Wi-Fi) encapsulation. The param name -is selected to be consistent with the similar ath11k param. - -This is a preparation step for upcoming encapsulation offloading -support. - -Signed-off-by: Sergey Ryazanov -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220516032519.29831-4-ryazanov.s.a@gmail.com ---- - drivers/net/wireless/ath/ath10k/core.c | 11 +++++++---- - drivers/net/wireless/ath/ath10k/core.h | 1 + - 2 files changed, 8 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath10k/core.c -+++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -32,9 +32,11 @@ EXPORT_SYMBOL(ath10k_debug_mask); - static unsigned int ath10k_cryptmode_param; - static bool uart_print; - static bool skip_otp; --static bool rawmode; - static bool fw_diag_log; - -+/* frame mode values are mapped as per enum ath10k_hw_txrx_mode */ -+unsigned int ath10k_frame_mode = ATH10K_HW_TXRX_NATIVE_WIFI; -+ - unsigned long ath10k_coredump_mask = BIT(ATH10K_FW_CRASH_DUMP_REGISTERS) | - BIT(ATH10K_FW_CRASH_DUMP_CE_DATA); - -@@ -43,15 +45,16 @@ module_param_named(debug_mask, ath10k_de - module_param_named(cryptmode, ath10k_cryptmode_param, uint, 0644); - module_param(uart_print, bool, 0644); - module_param(skip_otp, bool, 0644); --module_param(rawmode, bool, 0644); - module_param(fw_diag_log, bool, 0644); -+module_param_named(frame_mode, ath10k_frame_mode, uint, 0644); - module_param_named(coredump_mask, ath10k_coredump_mask, ulong, 0444); - - MODULE_PARM_DESC(debug_mask, "Debugging mask"); - MODULE_PARM_DESC(uart_print, "Uart target debugging"); - MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode"); - MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software"); --MODULE_PARM_DESC(rawmode, "Use raw 802.11 frame datapath"); -+MODULE_PARM_DESC(frame_mode, -+ "Datapath frame mode (0: raw, 1: native wifi (default))"); - MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file"); - MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging"); - -@@ -2487,7 +2490,7 @@ static int ath10k_core_init_firmware_fea - ar->htt.max_num_amsdu = ATH10K_HTT_MAX_NUM_AMSDU_DEFAULT; - ar->htt.max_num_ampdu = ATH10K_HTT_MAX_NUM_AMPDU_DEFAULT; - -- if (rawmode) { -+ if (ath10k_frame_mode == ATH10K_HW_TXRX_RAW) { - if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT, - fw_file->fw_features)) { - ath10k_err(ar, "rawmode = 1 requires support from firmware"); ---- a/drivers/net/wireless/ath/ath10k/core.h -+++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -1311,6 +1311,7 @@ static inline bool ath10k_peer_stats_ena - return false; - } - -+extern unsigned int ath10k_frame_mode; - extern unsigned long ath10k_coredump_mask; - - void ath10k_core_napi_sync_disable(struct ath10k *ar); diff --git a/package/kernel/mac80211/patches/ath10k/081-03-v6.0-ath10k-htt-tx-do-not-interpret-Eth-frames-as-WiFi.patch b/package/kernel/mac80211/patches/ath10k/081-03-v6.0-ath10k-htt-tx-do-not-interpret-Eth-frames-as-WiFi.patch deleted file mode 100644 index a669c77fe27..00000000000 --- a/package/kernel/mac80211/patches/ath10k/081-03-v6.0-ath10k-htt-tx-do-not-interpret-Eth-frames-as-WiFi.patch +++ /dev/null @@ -1,163 +0,0 @@ -From 70f119fb82af7f7417dc659faf02c91e1f853739 Mon Sep 17 00:00:00 2001 -From: Sergey Ryazanov -Date: Mon, 16 May 2022 13:26:00 +0300 -Subject: ath10k: htt_tx: do not interpret Eth frames as WiFi - -The xmit path for the Ethernet encapsulated frames become more or less -usable since d740d8fd2439 ("ath10k: unify tx mode and dispatch"). This -change reorganize the xmit path in a manageable way to properly support -various tx modes, but misses that the Ethernet encapsulated frame is a -special case. We do not have an IEEE 802.11 header at the begining of -them. But the HTT Tx handler still interprets first bytes of each frame -as an IEEE 802.11 Frame Control field. - -Than this code was copied by e62ee5c381c5 ("ath10k: Add support for -htt_data_tx_desc_64 descriptor") and a2097d6444c3 ("ath10k: htt: High -latency TX support") to another handlers. In fact the issue in the high -latency (HL) handler was introduced by 83ac260151e7 ("ath10k: add mic -bytes for pmf management packet"). - -Ethernet encapsulated frame tx mode stay unused until 75d85fd9993c -("ath10k: introduce basic tdls functionality") started using it for TDLS -frames to avoid key selection issue in some firmwares. - -Trying to interpret the begining of an Ethernet encapsulated frame as an -IEEE 802.11 header was not hurt us noticeably since we need to meet two -conditions: (1) xmit should be performed towards a TDLS peer, and (2) -the TDLS peer should have a specific OUI part of its MAC address. Looks -like that the rareness in TDLS communications of OUIs that can be -interpreted as an 802.11 management frame saves users from facing this -issue earlier. - -Improve Ethernet tx mode support in the HTT Tx handler by avoiding -interpreting its first bytes as an IEEE 802.11 header. While at it, make -the ieee80211_hdr variable local to the code block that is guarded by -!is_eth check. In this way, we clarify in which cases a frame can be -interpreted as IEEE 802.11, and saves us from similar issues in the -future. - -Credits: this change as part of xmit encapsulation offloading support -was originally made by QCA and then submitted for inclusion by John -Crispin [1]. But the whole work was not accepted due to the lack of a -part for 64-bits descriptors [2]. Zhijun You then pointed this out to me -in a reply to my initial RFC patch series. And I made this slightly -reworked version that covered all the HTT Tx handler variants. - -1. https://lore.kernel.org/all/20191216092207.31032-1-john@phrozen.org/ -2. https://patchwork.kernel.org/project/linux-wireless/patch/20191216092207.31032-1-john@phrozen.org/ - -Reported-by: Zhijun You -Signed-off-by: Vasanthakumar Thiagarajan -Signed-off-by: John Crispin -Signed-off-by: Sergey Ryazanov -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220516032519.29831-3-ryazanov.s.a@gmail.com ---- - drivers/net/wireless/ath/ath10k/htt_tx.c | 61 ++++++++++++++++++-------------- - 1 file changed, 35 insertions(+), 26 deletions(-) - ---- a/drivers/net/wireless/ath/ath10k/htt_tx.c -+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c -@@ -1295,7 +1295,6 @@ static int ath10k_htt_tx_hl(struct ath10 - struct ath10k *ar = htt->ar; - int res, data_len; - struct htt_cmd_hdr *cmd_hdr; -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; - struct htt_data_tx_desc *tx_desc; - struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu); - struct sk_buff *tmp_skb; -@@ -1306,11 +1305,15 @@ static int ath10k_htt_tx_hl(struct ath10 - u16 flags1 = 0; - u16 msdu_id = 0; - -- if ((ieee80211_is_action(hdr->frame_control) || -- ieee80211_is_deauth(hdr->frame_control) || -- ieee80211_is_disassoc(hdr->frame_control)) && -- ieee80211_has_protected(hdr->frame_control)) { -- skb_put(msdu, IEEE80211_CCMP_MIC_LEN); -+ if (!is_eth) { -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; -+ -+ if ((ieee80211_is_action(hdr->frame_control) || -+ ieee80211_is_deauth(hdr->frame_control) || -+ ieee80211_is_disassoc(hdr->frame_control)) && -+ ieee80211_has_protected(hdr->frame_control)) { -+ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); -+ } - } - - data_len = msdu->len; -@@ -1407,7 +1410,6 @@ static int ath10k_htt_tx_32(struct ath10 - { - struct ath10k *ar = htt->ar; - struct device *dev = ar->dev; -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu); - struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu); - struct ath10k_hif_sg_item sg_items[2]; -@@ -1439,15 +1441,19 @@ static int ath10k_htt_tx_32(struct ath10 - txbuf_paddr = htt->txbuf.paddr + - (sizeof(struct ath10k_htt_txbuf_32) * msdu_id); - -- if ((ieee80211_is_action(hdr->frame_control) || -- ieee80211_is_deauth(hdr->frame_control) || -- ieee80211_is_disassoc(hdr->frame_control)) && -- ieee80211_has_protected(hdr->frame_control)) { -- skb_put(msdu, IEEE80211_CCMP_MIC_LEN); -- } else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) && -- txmode == ATH10K_HW_TXRX_RAW && -- ieee80211_has_protected(hdr->frame_control)) { -- skb_put(msdu, IEEE80211_CCMP_MIC_LEN); -+ if (!is_eth) { -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; -+ -+ if ((ieee80211_is_action(hdr->frame_control) || -+ ieee80211_is_deauth(hdr->frame_control) || -+ ieee80211_is_disassoc(hdr->frame_control)) && -+ ieee80211_has_protected(hdr->frame_control)) { -+ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); -+ } else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) && -+ txmode == ATH10K_HW_TXRX_RAW && -+ ieee80211_has_protected(hdr->frame_control)) { -+ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); -+ } - } - - skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len, -@@ -1609,7 +1615,6 @@ static int ath10k_htt_tx_64(struct ath10 - { - struct ath10k *ar = htt->ar; - struct device *dev = ar->dev; -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu); - struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu); - struct ath10k_hif_sg_item sg_items[2]; -@@ -1641,15 +1646,19 @@ static int ath10k_htt_tx_64(struct ath10 - txbuf_paddr = htt->txbuf.paddr + - (sizeof(struct ath10k_htt_txbuf_64) * msdu_id); - -- if ((ieee80211_is_action(hdr->frame_control) || -- ieee80211_is_deauth(hdr->frame_control) || -- ieee80211_is_disassoc(hdr->frame_control)) && -- ieee80211_has_protected(hdr->frame_control)) { -- skb_put(msdu, IEEE80211_CCMP_MIC_LEN); -- } else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) && -- txmode == ATH10K_HW_TXRX_RAW && -- ieee80211_has_protected(hdr->frame_control)) { -- skb_put(msdu, IEEE80211_CCMP_MIC_LEN); -+ if (!is_eth) { -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; -+ -+ if ((ieee80211_is_action(hdr->frame_control) || -+ ieee80211_is_deauth(hdr->frame_control) || -+ ieee80211_is_disassoc(hdr->frame_control)) && -+ ieee80211_has_protected(hdr->frame_control)) { -+ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); -+ } else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) && -+ txmode == ATH10K_HW_TXRX_RAW && -+ ieee80211_has_protected(hdr->frame_control)) { -+ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); -+ } - } - - skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len, diff --git a/package/kernel/mac80211/patches/ath10k/081-04-v6.0-ath10k-add-encapsulation-offloading-support.patch b/package/kernel/mac80211/patches/ath10k/081-04-v6.0-ath10k-add-encapsulation-offloading-support.patch deleted file mode 100644 index e45a3ba860b..00000000000 --- a/package/kernel/mac80211/patches/ath10k/081-04-v6.0-ath10k-add-encapsulation-offloading-support.patch +++ /dev/null @@ -1,194 +0,0 @@ -From af6d8265c47e46881b80c6b073f53c8c4af52d28 Mon Sep 17 00:00:00 2001 -From: Sergey Ryazanov -Date: Mon, 16 May 2022 13:26:00 +0300 -Subject: ath10k: add encapsulation offloading support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Frame encapsulation from Ethernet into the IEEE 802.11 frame format -takes a considerable host CPU time on the xmit path. The firmware is -able to do this operation for us, so enable encapsulation offloading for -AP and Sta interface types to improve overall system performance. - -The driver is almost ready for encapsulation offloading support. There -are only a few places where the driver assumes the frame format is IEEE -802.11 that need to be fixed. - -Encapsulation offloading is currently disabled by default and the driver -utilizes mac80211 encapsulation support. To activate offloading, the -frame_mode=2 parameter should be passed during module loading. - -On a QCA9563+QCA9888-based access point in bridged mode, encapsulation -offloading increases TCP 16-streams DL throughput from 365 to 396 mbps -(+8%) and UDP DL throughput from 436 to 483 mbps (+11%). - -Tested-on: QCA9888 hw2.0 PCI 10.4-3.9.0.2-00131 -Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1 -Signed-off-by: Sergey Ryazanov -Tested-by: Oldřich Jedlička # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880) -Tested-by: Edward Matijevic # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1) -Tested-by: Edward Matijevic # QCA9377 PCI in Sta mode -Tested-by: Zhijun You # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159) -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com ---- - drivers/net/wireless/ath/ath10k/core.c | 2 +- - drivers/net/wireless/ath/ath10k/mac.c | 67 +++++++++++++++++++++++++++------- - 2 files changed, 55 insertions(+), 14 deletions(-) - ---- a/drivers/net/wireless/ath/ath10k/core.c -+++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -54,7 +54,7 @@ MODULE_PARM_DESC(uart_print, "Uart targe - MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode"); - MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software"); - MODULE_PARM_DESC(frame_mode, -- "Datapath frame mode (0: raw, 1: native wifi (default))"); -+ "Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)"); - MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file"); - MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging"); - ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -3717,6 +3717,9 @@ ath10k_mac_tx_h_get_txmode(struct ath10k - const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); - __le16 fc = hdr->frame_control; - -+ if (IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) -+ return ATH10K_HW_TXRX_ETHERNET; -+ - if (!vif || vif->type == NL80211_IFTYPE_MONITOR) - return ATH10K_HW_TXRX_RAW; - -@@ -3877,6 +3880,12 @@ static void ath10k_mac_tx_h_fill_cb(stru - bool noack = false; - - cb->flags = 0; -+ -+ if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { -+ cb->flags |= ATH10K_SKB_F_QOS; /* Assume data frames are QoS */ -+ goto finish_cb_fill; -+ } -+ - if (!ath10k_tx_h_use_hwcrypto(vif, skb)) - cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; - -@@ -3915,6 +3924,7 @@ static void ath10k_mac_tx_h_fill_cb(stru - cb->flags |= ATH10K_SKB_F_RAW_TX; - } - -+finish_cb_fill: - cb->vif = vif; - cb->txq = txq; - cb->airtime_est = airtime; -@@ -4038,7 +4048,11 @@ static int ath10k_mac_tx(struct ath10k * - ath10k_tx_h_seq_no(vif, skb); - break; - case ATH10K_HW_TXRX_ETHERNET: -- ath10k_tx_h_8023(skb); -+ /* Convert 802.11->802.3 header only if the frame was erlier -+ * encapsulated to 802.11 by mac80211. Otherwise pass it as is. -+ */ -+ if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) -+ ath10k_tx_h_8023(skb); - break; - case ATH10K_HW_TXRX_RAW: - if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) && -@@ -4650,12 +4664,10 @@ static void ath10k_mac_op_tx(struct ieee - struct ieee80211_vif *vif = info->control.vif; - struct ieee80211_sta *sta = control->sta; - struct ieee80211_txq *txq = NULL; -- struct ieee80211_hdr *hdr = (void *)skb->data; - enum ath10k_hw_txrx_mode txmode; - enum ath10k_mac_tx_path txpath; - bool is_htt; - bool is_mgmt; -- bool is_presp; - int ret; - u16 airtime; - -@@ -4669,8 +4681,14 @@ static void ath10k_mac_op_tx(struct ieee - is_mgmt = (txpath == ATH10K_MAC_TX_HTT_MGMT); - - if (is_htt) { -+ bool is_presp = false; -+ - spin_lock_bh(&ar->htt.tx_lock); -- is_presp = ieee80211_is_probe_resp(hdr->frame_control); -+ if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) { -+ struct ieee80211_hdr *hdr = (void *)skb->data; -+ -+ is_presp = ieee80211_is_probe_resp(hdr->frame_control); -+ } - - ret = ath10k_htt_tx_inc_pending(htt); - if (ret) { -@@ -5470,6 +5488,30 @@ static int ath10k_mac_set_txbf_conf(stru - ar->wmi.vdev_param->txbf, value); - } - -+static void ath10k_update_vif_offload(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif) -+{ -+ struct ath10k_vif *arvif = (void *)vif->drv_priv; -+ struct ath10k *ar = hw->priv; -+ u32 vdev_param; -+ int ret; -+ -+ if (ath10k_frame_mode != ATH10K_HW_TXRX_ETHERNET || -+ ar->wmi.vdev_param->tx_encap_type == WMI_VDEV_PARAM_UNSUPPORTED || -+ (vif->type != NL80211_IFTYPE_STATION && -+ vif->type != NL80211_IFTYPE_AP)) -+ vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; -+ -+ vdev_param = ar->wmi.vdev_param->tx_encap_type; -+ ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, -+ ATH10K_HW_TXRX_NATIVE_WIFI); -+ /* 10.X firmware does not support this VDEV parameter. Do not warn */ -+ if (ret && ret != -EOPNOTSUPP) { -+ ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n", -+ arvif->vdev_id, ret); -+ } -+} -+ - /* - * TODO: - * Figure out how to handle WMI_VDEV_SUBTYPE_P2P_DEVICE, -@@ -5679,15 +5721,7 @@ static int ath10k_add_interface(struct i - - arvif->def_wep_key_idx = -1; - -- vdev_param = ar->wmi.vdev_param->tx_encap_type; -- ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, -- ATH10K_HW_TXRX_NATIVE_WIFI); -- /* 10.X firmware does not support this VDEV parameter. Do not warn */ -- if (ret && ret != -EOPNOTSUPP) { -- ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n", -- arvif->vdev_id, ret); -- goto err_vdev_delete; -- } -+ ath10k_update_vif_offload(hw, vif); - - /* Configuring number of spatial stream for monitor interface is causing - * target assert in qca9888 and qca6174. -@@ -9372,6 +9406,7 @@ static const struct ieee80211_ops ath10k - .stop = ath10k_stop, - .config = ath10k_config, - .add_interface = ath10k_add_interface, -+ .update_vif_offload = ath10k_update_vif_offload, - .remove_interface = ath10k_remove_interface, - .configure_filter = ath10k_configure_filter, - .bss_info_changed = ath10k_bss_info_changed, -@@ -10041,6 +10076,12 @@ int ath10k_mac_register(struct ath10k *a - if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map)) - ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA); - -+ if (ath10k_frame_mode == ATH10K_HW_TXRX_ETHERNET) { -+ if (ar->wmi.vdev_param->tx_encap_type != -+ WMI_VDEV_PARAM_UNSUPPORTED) -+ ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD); -+ } -+ - ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; - ar->hw->wiphy->max_remain_on_channel_duration = 5000; diff --git a/package/kernel/mac80211/patches/ath10k/100-v5.19-ath10k-support-bus-and-device-specific-API-1-BDF-sel.patch b/package/kernel/mac80211/patches/ath10k/100-v5.19-ath10k-support-bus-and-device-specific-API-1-BDF-sel.patch deleted file mode 100644 index 7ef418e506a..00000000000 --- a/package/kernel/mac80211/patches/ath10k/100-v5.19-ath10k-support-bus-and-device-specific-API-1-BDF-sel.patch +++ /dev/null @@ -1,65 +0,0 @@ -From f2a7064a78b22f2b68b9fcbc8a6f4c5e61c5ba64 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Sun, 10 Oct 2021 00:17:11 +0200 -Subject: [PATCH] ath10k: support bus and device specific API 1 BDF selection - -Some ath10k IPQ40xx devices like the MikroTik hAP ac2 and ac3 require the -BDF-s to be extracted from the device storage instead of shipping packaged -API 2 BDF-s. - -This is required as MikroTik has started shipping boards that require BDF-s -to be updated, as otherwise their WLAN performance really suffers. -This is however impossible as the devices that require this are release -under the same revision and its not possible to differentiate them from -devices using the older BDF-s. - -In OpenWrt we are extracting the calibration data during runtime and we are -able to extract the BDF-s in the same manner, however we cannot package the -BDF-s to API 2 format on the fly and can only use API 1 to provide BDF-s on -the fly. -This is an issue as the ath10k driver explicitly looks only for the -board.bin file and not for something like board-bus-device.bin like it does -for pre-cal data. -Due to this we have no way of providing correct BDF-s on the fly, so lets -extend the ath10k driver to first look for BDF-s in the -board-bus-device.bin format, for example: board-ahb-a800000.wifi.bin -If that fails, look for the default board file name as defined previously. - -Signed-off-by: Robert Marko -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211009221711.2315352-1-robimarko@gmail.com ---- - drivers/net/wireless/ath/ath10k/core.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath10k/core.c -+++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -1202,6 +1202,7 @@ success: - static int ath10k_core_fetch_board_data_api_1(struct ath10k *ar, int bd_ie_type) - { - const struct firmware *fw; -+ char boardname[100]; - - if (bd_ie_type == ATH10K_BD_IE_BOARD) { - if (!ar->hw_params.fw.board) { -@@ -1209,9 +1210,19 @@ static int ath10k_core_fetch_board_data_ - return -EINVAL; - } - -+ scnprintf(boardname, sizeof(boardname), "board-%s-%s.bin", -+ ath10k_bus_str(ar->hif.bus), dev_name(ar->dev)); -+ - ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar, - ar->hw_params.fw.dir, -- ar->hw_params.fw.board); -+ boardname); -+ if (IS_ERR(ar->normal_mode_fw.board)) { -+ fw = ath10k_fetch_fw_file(ar, -+ ar->hw_params.fw.dir, -+ ar->hw_params.fw.board); -+ ar->normal_mode_fw.board = fw; -+ } -+ - if (IS_ERR(ar->normal_mode_fw.board)) - return PTR_ERR(ar->normal_mode_fw.board); - diff --git a/package/kernel/mac80211/patches/ath10k/120-v5.17-ath10k-fetch-calibration-data-via-nvmem-subsystem.patch b/package/kernel/mac80211/patches/ath10k/120-v5.17-ath10k-fetch-calibration-data-via-nvmem-subsystem.patch deleted file mode 100644 index c7a00b7e4bb..00000000000 --- a/package/kernel/mac80211/patches/ath10k/120-v5.17-ath10k-fetch-calibration-data-via-nvmem-subsystem.patch +++ /dev/null @@ -1,162 +0,0 @@ -From e2333703373e8b81294da5d1c73c30154f75b082 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Fri, 15 Oct 2021 18:56:33 +0200 -Subject: [PATCH] ath10k: fetch (pre-)calibration data via nvmem subsystem - -On most embedded ath10k devices (like range extenders, -routers, accesspoints, ...) the calibration data is -stored in a easily accessible MTD partitions named -"ART", "caldata", "calibration", etc... - -Since commit 4b361cfa8624 ("mtd: core: add OTP nvmem provider support"): -MTD partitions and portions of them can be specified -as potential nvmem-cells which are accessible through -the nvmem subsystem. - -This feature - together with an nvmem cell definition either -in the platform data or via device-tree allows drivers to get -the (pre-)calibration data which is required for initializing -the WIFI. - -Tested with Netgear EX6150v2 (IPQ4018) - -Cc: Robert Marko -Cc: Thibaut Varene -Signed-off-by: Christian Lamparter ---- ---- a/drivers/net/wireless/ath/ath10k/core.c -+++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - - #include "core.h" -@@ -955,7 +956,8 @@ static int ath10k_core_get_board_id_from - } - - if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT || -- ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE) -+ ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE || -+ ar->cal_mode == ATH10K_PRE_CAL_MODE_NVMEM) - bmi_board_id_param = BMI_PARAM_GET_FLASH_BOARD_ID; - else - bmi_board_id_param = BMI_PARAM_GET_EEPROM_BOARD_ID; -@@ -1757,7 +1759,8 @@ static int ath10k_download_and_run_otp(s - - /* As of now pre-cal is valid for 10_4 variants */ - if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT || -- ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE) -+ ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE || -+ ar->cal_mode == ATH10K_PRE_CAL_MODE_NVMEM) - bmi_otp_exe_param = BMI_PARAM_FLASH_SECTION_ALL; - - ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, &result); -@@ -1884,6 +1887,39 @@ out_free: - return ret; - } - -+static int ath10k_download_cal_nvmem(struct ath10k *ar, const char *cell_name) -+{ -+ struct nvmem_cell *cell; -+ void *buf; -+ size_t len; -+ int ret; -+ -+ cell = devm_nvmem_cell_get(ar->dev, cell_name); -+ if (IS_ERR(cell)) { -+ ret = PTR_ERR(cell); -+ return ret; -+ } -+ -+ buf = nvmem_cell_read(cell, &len); -+ if (IS_ERR(buf)) -+ return PTR_ERR(buf); -+ -+ if (ar->hw_params.cal_data_len != len) { -+ kfree(buf); -+ ath10k_warn(ar, "invalid calibration data length in nvmem-cell '%s': %zu != %u\n", -+ cell_name, len, ar->hw_params.cal_data_len); -+ return -EMSGSIZE; -+ } -+ -+ ret = ath10k_download_board_data(ar, buf, len); -+ kfree(buf); -+ if (ret) -+ ath10k_warn(ar, "failed to download calibration data from nvmem-cell '%s': %d\n", -+ cell_name, ret); -+ -+ return ret; -+} -+ - int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name, - struct ath10k_fw_file *fw_file) - { -@@ -2118,6 +2154,18 @@ static int ath10k_core_pre_cal_download( - { - int ret; - -+ ret = ath10k_download_cal_nvmem(ar, "pre-calibration"); -+ if (ret == 0) { -+ ar->cal_mode = ATH10K_PRE_CAL_MODE_NVMEM; -+ goto success; -+ } else if (ret == -EPROBE_DEFER) { -+ return ret; -+ } -+ -+ ath10k_dbg(ar, ATH10K_DBG_BOOT, -+ "boot did not find a pre-calibration nvmem-cell, try file next: %d\n", -+ ret); -+ - ret = ath10k_download_cal_file(ar, ar->pre_cal_file); - if (ret == 0) { - ar->cal_mode = ATH10K_PRE_CAL_MODE_FILE; -@@ -2184,6 +2232,18 @@ static int ath10k_download_cal_data(stru - "pre cal download procedure failed, try cal file: %d\n", - ret); - -+ ret = ath10k_download_cal_nvmem(ar, "calibration"); -+ if (ret == 0) { -+ ar->cal_mode = ATH10K_CAL_MODE_NVMEM; -+ goto done; -+ } else if (ret == -EPROBE_DEFER) { -+ return ret; -+ } -+ -+ ath10k_dbg(ar, ATH10K_DBG_BOOT, -+ "boot did not find a calibration nvmem-cell, try file next: %d\n", -+ ret); -+ - ret = ath10k_download_cal_file(ar, ar->cal_file); - if (ret == 0) { - ar->cal_mode = ATH10K_CAL_MODE_FILE; ---- a/drivers/net/wireless/ath/ath10k/core.h -+++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -877,8 +877,10 @@ enum ath10k_cal_mode { - ATH10K_CAL_MODE_FILE, - ATH10K_CAL_MODE_OTP, - ATH10K_CAL_MODE_DT, -+ ATH10K_CAL_MODE_NVMEM, - ATH10K_PRE_CAL_MODE_FILE, - ATH10K_PRE_CAL_MODE_DT, -+ ATH10K_PRE_CAL_MODE_NVMEM, - ATH10K_CAL_MODE_EEPROM, - }; - -@@ -898,10 +900,14 @@ static inline const char *ath10k_cal_mod - return "otp"; - case ATH10K_CAL_MODE_DT: - return "dt"; -+ case ATH10K_CAL_MODE_NVMEM: -+ return "nvmem"; - case ATH10K_PRE_CAL_MODE_FILE: - return "pre-cal-file"; - case ATH10K_PRE_CAL_MODE_DT: - return "pre-cal-dt"; -+ case ATH10K_PRE_CAL_MODE_NVMEM: -+ return "pre-cal-nvmem"; - case ATH10K_CAL_MODE_EEPROM: - return "eeprom"; - } diff --git a/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch index e47fb012fa3..7819835689e 100644 --- a/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -3443,6 +3443,16 @@ int ath10k_core_register(struct ath10k * +@@ -3500,6 +3500,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch index bc6f5dbc5c1..e8beed17e8f 100644 --- a/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -9898,6 +9898,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -9909,6 +9909,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -10256,6 +10271,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10267,6 +10282,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index 47b52416ab1..8236966586b 100644 --- a/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -114,7 +114,7 @@ v13: ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o --- a/local-symbols +++ b/local-symbols -@@ -166,6 +166,7 @@ ATH10K_DEBUG= +@@ -170,6 +170,7 @@ ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= ATH10K_THERMAL= @@ -140,7 +140,7 @@ v13: .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -138,6 +140,7 @@ static const struct ath10k_hw_params ath +@@ -144,6 +146,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9887_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9887 hw1.0", @@ -148,7 +148,7 @@ v13: .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -355,6 +358,7 @@ static const struct ath10k_hw_params ath +@@ -379,6 +382,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA99X0_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca99x0 hw2.0", @@ -156,7 +156,7 @@ v13: .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .otp_exe_param = 0x00000700, -@@ -397,6 +401,7 @@ static const struct ath10k_hw_params ath +@@ -424,6 +428,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9984_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9984/qca9994 hw1.0", @@ -164,7 +164,7 @@ v13: .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -446,6 +451,7 @@ static const struct ath10k_hw_params ath +@@ -476,6 +481,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9888_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9888 hw2.0", @@ -172,7 +172,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -3158,6 +3164,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -3215,6 +3221,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3416,9 +3426,18 @@ static void ath10k_core_register_work(st +@@ -3473,9 +3483,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -202,7 +202,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -3464,6 +3483,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3521,6 +3540,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -221,7 +221,7 @@ v13: #include "htt.h" #include "htc.h" -@@ -1256,6 +1257,13 @@ struct ath10k { +@@ -1253,6 +1254,13 @@ struct ath10k { } testmode; struct { @@ -237,7 +237,7 @@ v13: u32 fw_crash_counter; --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h -@@ -517,6 +517,7 @@ struct ath10k_hw_params { +@@ -519,6 +519,7 @@ struct ath10k_hw_params { const char *name; u32 patch_load_addr; int uart_pin; diff --git a/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch index 253fe96ddf8..4c1f9aa815c 100644 --- a/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch @@ -16,7 +16,7 @@ Signed-off-by: Mathias Kresin --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -1312,6 +1312,10 @@ struct ath10k { +@@ -1309,6 +1309,10 @@ struct ath10k { s32 tx_power_2g_limit; s32 tx_power_5g_limit; @@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin if (ret) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -10273,7 +10273,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -10284,7 +10284,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch b/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch index 424985f1149..3626debf198 100644 --- a/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch +++ b/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch @@ -89,7 +89,7 @@ Forwarded: no if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { arg.ssid = arvif->u.ap.ssid; -@@ -3434,7 +3470,8 @@ static int ath10k_update_channel_list(st +@@ -3437,7 +3473,8 @@ static int ath10k_update_channel_list(st ch->min_power = 0; ch->max_power = channel->max_power * 2; ch->max_reg_power = channel->max_reg_power * 2; diff --git a/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch b/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch index 80da07de8a4..d7187bad8af 100644 --- a/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch +++ b/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch @@ -26,9 +26,9 @@ Signed-off-by: Ansuel Smith #include #include #include -@@ -3334,6 +3335,8 @@ static int ath10k_core_probe_fw(struct a +@@ -3391,6 +3392,8 @@ static int ath10k_core_probe_fw(struct a - device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr)); + device_get_mac_address(ar->dev, ar->mac_addr); + of_get_mac_address(ar->dev->of_node, ar->mac_addr); + diff --git a/package/kernel/mac80211/patches/ath5k/201-ath5k-WAR-for-AR71xx-PCI-bug.patch b/package/kernel/mac80211/patches/ath5k/201-ath5k-WAR-for-AR71xx-PCI-bug.patch index 21516ffde90..4fc97dfaec9 100644 --- a/package/kernel/mac80211/patches/ath5k/201-ath5k-WAR-for-AR71xx-PCI-bug.patch +++ b/package/kernel/mac80211/patches/ath5k/201-ath5k-WAR-for-AR71xx-PCI-bug.patch @@ -17,7 +17,7 @@ { AR5K_RXNOFRM, 8 }, --- a/drivers/net/wireless/ath/ath5k/dma.c +++ b/drivers/net/wireless/ath/ath5k/dma.c -@@ -869,10 +869,18 @@ ath5k_hw_dma_init(struct ath5k_hw *ah) +@@ -854,10 +854,18 @@ ath5k_hw_dma_init(struct ath5k_hw *ah) * guess we can tweak it and see how it goes ;-) */ if (ah->ah_version != AR5K_AR5210) { diff --git a/package/kernel/mac80211/patches/ath5k/411-ath5k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/ath5k/411-ath5k_allow_adhoc_and_ap.patch index 35ed6ea5551..1df4aab57ee 100644 --- a/package/kernel/mac80211/patches/ath5k/411-ath5k_allow_adhoc_and_ap.patch +++ b/package/kernel/mac80211/patches/ath5k/411-ath5k_allow_adhoc_and_ap.patch @@ -18,7 +18,7 @@ goto end; --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c -@@ -1963,7 +1963,7 @@ ath5k_beacon_send(struct ath5k_hw *ah) +@@ -2009,7 +2009,7 @@ ath5k_beacon_send(struct ath5k_hw *ah) } if ((ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs + @@ -27,7 +27,7 @@ ah->opmode == NL80211_IFTYPE_MESH_POINT) { u64 tsf = ath5k_hw_get_tsf64(ah); u32 tsftu = TSF_TO_TU(tsf); -@@ -2049,7 +2049,7 @@ ath5k_beacon_update_timers(struct ath5k_ +@@ -2095,7 +2095,7 @@ ath5k_beacon_update_timers(struct ath5k_ intval = ah->bintval & AR5K_BEACON_PERIOD; if (ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs @@ -36,7 +36,7 @@ intval /= ATH_BCBUF; /* staggered multi-bss beacons */ if (intval < 15) ATH5K_WARN(ah, "intval %u is too low, min 15\n", -@@ -2515,6 +2515,7 @@ static const struct ieee80211_iface_limi +@@ -2561,6 +2561,7 @@ static const struct ieee80211_iface_limi BIT(NL80211_IFTYPE_MESH_POINT) | #endif BIT(NL80211_IFTYPE_AP) }, diff --git a/package/kernel/mac80211/patches/ath9k/040-v5.16-ath9k-support-DT-ieee80211-freq-limit-property-to-li.patch b/package/kernel/mac80211/patches/ath9k/040-v5.16-ath9k-support-DT-ieee80211-freq-limit-property-to-li.patch deleted file mode 100644 index 7d446817600..00000000000 --- a/package/kernel/mac80211/patches/ath9k/040-v5.16-ath9k-support-DT-ieee80211-freq-limit-property-to-li.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 03469e79fee9e8e908dae3bd1a80bcd9a66f2a88 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Mon, 11 Oct 2021 18:18:00 +0300 -Subject: ath9k: support DT ieee80211-freq-limit property to limit channels - -The common DT property can be used to limit the available channels -but ath9k has to manually call wiphy_read_of_freq_limits(). - -I would have put this into ath9k_of_init(). But it didn't work there. -The reason is that in ath9k_of_init() the channels and bands are not yet -registered in the wiphy struct. So there isn't any channel to flag as -disabled. - -Signed-off-by: Christian Lamparter -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211009212847.1781986-1-chunkeey@gmail.com ---- ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1038,6 +1038,8 @@ int ath9k_init_device(u16 devid, struct - ARRAY_SIZE(ath9k_tpt_blink)); - #endif - -+ wiphy_read_of_freq_limits(hw->wiphy); -+ - /* Register with mac80211 */ - error = ieee80211_register_hw(hw); - if (error) diff --git a/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch b/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch index 7405e594fe6..3eb57bb1cf5 100644 --- a/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch +++ b/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -47,7 +47,7 @@ int ath9k_modparam_nohwcrypt; +@@ -48,7 +48,7 @@ int ath9k_modparam_nohwcrypt; module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444); MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); diff --git a/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch index b355e8372f6..b2f2763e8e1 100644 --- a/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch +++ b/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -826,6 +826,7 @@ static const struct ieee80211_iface_limi +@@ -882,6 +882,7 @@ static const struct ieee80211_iface_limi BIT(NL80211_IFTYPE_AP) }, { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) }, diff --git a/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch b/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch index 284c88ff493..f424ca530be 100644 --- a/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch +++ b/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch @@ -14,7 +14,7 @@ Signed-off-by: David Bauer --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -907,6 +907,7 @@ static void ath9k_set_hw_capab(struct at +@@ -963,6 +963,7 @@ static void ath9k_set_hw_capab(struct at ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING); ieee80211_hw_set(hw, SUPPORT_FAST_XMIT); ieee80211_hw_set(hw, SUPPORTS_CLONED_SKBS); @@ -22,7 +22,7 @@ Signed-off-by: David Bauer if (ath9k_ps_enable) ieee80211_hw_set(hw, SUPPORTS_PS); -@@ -919,9 +920,6 @@ static void ath9k_set_hw_capab(struct at +@@ -975,9 +976,6 @@ static void ath9k_set_hw_capab(struct at IEEE80211_RADIOTAP_MCS_HAVE_STBC; } diff --git a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch index 48ccc813080..e2bbb4a1b1d 100644 --- a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1364,6 +1364,53 @@ void ath9k_deinit_debug(struct ath_softc +@@ -1413,6 +1413,53 @@ void ath9k_deinit_debug(struct ath_softc ath9k_cmn_spectral_deinit_debug(&sc->spec_priv); } @@ -54,7 +54,7 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -1383,6 +1430,8 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1432,6 +1479,8 @@ int ath9k_init_debug(struct ath_hw *ah) ath9k_tx99_init_debug(sc); ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); diff --git a/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch index 6ab7972b556..740ddc39dc3 100644 --- a/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch +++ b/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1122,25 +1122,25 @@ static int __init ath9k_init(void) +@@ -1178,25 +1178,25 @@ static int __init ath9k_init(void) { int error; diff --git a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch index 126d1d5c624..0c8b6920c4f 100644 --- a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1411,6 +1411,52 @@ static const struct file_operations fops +@@ -1460,6 +1460,52 @@ static const struct file_operations fops .owner = THIS_MODULE }; @@ -53,7 +53,7 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -1432,6 +1478,8 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1481,6 +1527,8 @@ int ath9k_init_debug(struct ath_hw *ah) debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, &fops_eeprom); diff --git a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch index c1612378276..1fe00410228 100644 --- a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch @@ -181,7 +181,7 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1032,7 +1032,7 @@ int ath9k_init_device(u16 devid, struct +@@ -1088,7 +1088,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ @@ -192,7 +192,7 @@ #endif --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1456,6 +1456,61 @@ static const struct file_operations fops +@@ -1505,6 +1505,61 @@ static const struct file_operations fops .llseek = default_llseek, }; @@ -254,7 +254,7 @@ int ath9k_init_debug(struct ath_hw *ah) { -@@ -1480,6 +1535,10 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1529,6 +1584,10 @@ int ath9k_init_debug(struct ath_hw *ah) &fops_eeprom); debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_chanbw); diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index 5b64f560fdc..70f7ee36592 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1512,6 +1512,50 @@ static const struct file_operations fops +@@ -1561,6 +1561,50 @@ static const struct file_operations fops #endif @@ -51,7 +51,7 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -1539,6 +1583,8 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1588,6 +1632,8 @@ int ath9k_init_debug(struct ath_hw *ah) debugfs_create_file("gpio_led", S_IWUSR, sc->debug.debugfs_phy, sc, &fops_gpio_led); #endif @@ -84,7 +84,7 @@ bool reset_power_on; bool htc_reset_init; -@@ -1077,6 +1085,7 @@ void ath9k_hw_check_nav(struct ath_hw *a +@@ -1079,6 +1087,7 @@ void ath9k_hw_check_nav(struct ath_hw *a bool ath9k_hw_check_alive(struct ath_hw *ah); bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); diff --git a/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch index ef4e6598707..6acc864d1e1 100644 --- a/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch +++ b/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch @@ -18,7 +18,7 @@ void (*spectral_scan_trigger)(struct ath_hw *ah); --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c -@@ -1927,6 +1927,26 @@ void ar9003_hw_init_rate_txpower(struct +@@ -1918,6 +1918,26 @@ void ar9003_hw_init_rate_txpower(struct } } @@ -45,7 +45,7 @@ void ar9003_hw_attach_phy_ops(struct ath_hw *ah) { struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); -@@ -1963,6 +1983,7 @@ void ar9003_hw_attach_phy_ops(struct ath +@@ -1954,6 +1974,7 @@ void ar9003_hw_attach_phy_ops(struct ath priv_ops->set_radar_params = ar9003_hw_set_radar_params; priv_ops->fast_chan_change = ar9003_hw_fast_chan_change; @@ -55,7 +55,7 @@ ops->spectral_scan_config = ar9003_hw_spectral_scan_config; --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -814,7 +814,8 @@ static void ath9k_init_txpower_limits(st +@@ -870,7 +870,8 @@ static void ath9k_init_txpower_limits(st if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ); @@ -65,7 +65,7 @@ } static const struct ieee80211_iface_limit if_limits[] = { -@@ -992,6 +993,18 @@ static void ath9k_set_hw_capab(struct at +@@ -1048,6 +1049,18 @@ static void ath9k_set_hw_capab(struct at wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); } @@ -84,7 +84,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -1039,6 +1052,8 @@ int ath9k_init_device(u16 devid, struct +@@ -1095,6 +1108,8 @@ int ath9k_init_device(u16 devid, struct wiphy_read_of_freq_limits(hw->wiphy); diff --git a/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch index 854bb3659a5..d3bf07ff922 100644 --- a/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch +++ b/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch @@ -79,7 +79,7 @@ static const u8 ofdm2pwr[] = { ALL_TARGET_LEGACY_6_24, ALL_TARGET_LEGACY_6_24, -@@ -1077,11 +1063,6 @@ static bool ar9003_hw_ani_control(struct +@@ -1068,11 +1054,6 @@ static bool ar9003_hw_ani_control(struct struct ath_common *common = ath9k_hw_common(ah); struct ath9k_channel *chan = ah->curchan; struct ar5416AniState *aniState = &ah->ani; @@ -91,7 +91,7 @@ s32 value, value2; switch (cmd & ah->ani_function) { -@@ -1095,61 +1076,6 @@ static bool ar9003_hw_ani_control(struct +@@ -1086,61 +1067,6 @@ static bool ar9003_hw_ani_control(struct */ u32 on = param ? 1 : 0; diff --git a/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch index 6b5c0dc5149..0fbc364c288 100644 --- a/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch +++ b/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch @@ -371,7 +371,7 @@ --- a/local-symbols +++ b/local-symbols -@@ -133,6 +133,7 @@ ATH9K_WOW= +@@ -137,6 +137,7 @@ ATH9K_WOW= ATH9K_RFKILL= ATH9K_CHANNEL_CONTEXT= ATH9K_PCOEM= diff --git a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch index 7ce8bc5b82e..57eef54e897 100644 --- a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch +++ b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch @@ -271,7 +271,7 @@ if (!dev_get_platdata(&pdev->dev)) { dev_err(&pdev->dev, "no platform data specified\n"); -@@ -122,13 +371,16 @@ static int ath_ahb_probe(struct platform +@@ -118,13 +367,16 @@ static int ath_ahb_probe(struct platform sc->mem = mem; sc->irq = irq; @@ -289,7 +289,7 @@ if (ret) { dev_err(&pdev->dev, "failed to initialize device\n"); goto err_irq; -@@ -159,6 +411,9 @@ static int ath_ahb_remove(struct platfor +@@ -155,6 +407,9 @@ static int ath_ahb_remove(struct platfor free_irq(sc->irq, sc); ieee80211_free_hw(sc->hw); } @@ -299,7 +299,7 @@ return 0; } -@@ -168,6 +423,9 @@ static struct platform_driver ath_ahb_dr +@@ -164,6 +419,9 @@ static struct platform_driver ath_ahb_dr .remove = ath_ahb_remove, .driver = { .name = "ath9k", diff --git a/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch b/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch index 80e0dc4c5ed..6d1820ecb72 100644 --- a/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch +++ b/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -644,6 +644,12 @@ static int ath9k_of_init(struct ath_soft +@@ -696,6 +696,12 @@ static int ath9k_of_init(struct ath_soft return 0; } @@ -13,7 +13,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -747,6 +753,9 @@ static int ath9k_init_softc(u16 devid, s +@@ -803,6 +809,9 @@ static int ath9k_init_softc(u16 devid, s if (ret) goto err_hw; diff --git a/package/kernel/mac80211/patches/ath9k/600-v5.16-ath9k-fetch-calibration-data-via-nvmem-subsystem.patch b/package/kernel/mac80211/patches/ath9k/600-v5.16-ath9k-fetch-calibration-data-via-nvmem-subsystem.patch deleted file mode 100644 index a250d2318ed..00000000000 --- a/package/kernel/mac80211/patches/ath9k/600-v5.16-ath9k-fetch-calibration-data-via-nvmem-subsystem.patch +++ /dev/null @@ -1,154 +0,0 @@ -From dab16ef495dbb3cabb355b6c80f0771a4a25e35d Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Fri, 20 Aug 2021 22:44:52 +0200 -Subject: [PATCH] ath9k: fetch calibration data via nvmem subsystem - -On most embedded ath9k devices (like range extenders, -routers, accesspoints, ...) the calibration data is -stored in a MTD partitions named "ART", or "caldata"/ -"calibration". - -Ever since commit -4b361cfa8624 ("mtd: core: add OTP nvmem provider support") -all MTD partitions are all automatically available through -the nvmem subsystem. This allows drivers like ath9k to read -the necessary data without needing any userspace helpers -that would do this extraction. - -Signed-off-by: Christian Lamparter ---- - -includes: - -From 57671351379b2051cfb07fc14e0bead9916a0880 Mon Sep 17 00:00:00 2001 -From: Dan Carpenter -Date: Mon, 11 Oct 2021 18:18:01 +0300 -Subject: ath9k: fix an IS_ERR() vs NULL check - -The devm_kmemdup() function doesn't return error pointers, it returns -NULL on error. - -Fixes: eb3a97a69be8 ("ath9k: fetch calibration data via nvmem subsystem") -Signed-off-by: Dan Carpenter -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211011123533.GA15188@kili - ---- - ---- a/drivers/net/wireless/ath/ath9k/eeprom.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c -@@ -135,13 +135,23 @@ static bool ath9k_hw_nvram_read_firmware - offset, data); - } - -+static bool ath9k_hw_nvram_read_nvmem(struct ath_hw *ah, off_t offset, -+ u16 *data) -+{ -+ return ath9k_hw_nvram_read_array(ah->nvmem_blob, -+ ah->nvmem_blob_len / sizeof(u16), -+ offset, data); -+} -+ - bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data) - { - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_platform_data *pdata = ah->dev->platform_data; - bool ret; - -- if (ah->eeprom_blob) -+ if (ah->nvmem_blob) -+ ret = ath9k_hw_nvram_read_nvmem(ah, off, data); -+ else if (ah->eeprom_blob) - ret = ath9k_hw_nvram_read_firmware(ah->eeprom_blob, off, data); - else if (pdata && !pdata->use_eeprom) - ret = ath9k_hw_nvram_read_pdata(pdata, off, data); ---- a/drivers/net/wireless/ath/ath9k/hw.h -+++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -988,6 +988,8 @@ struct ath_hw { - bool disable_5ghz; - - const struct firmware *eeprom_blob; -+ u16 *nvmem_blob; /* devres managed */ -+ size_t nvmem_blob_len; - - struct ath_dynack dynack; - ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -568,6 +569,57 @@ static void ath9k_eeprom_release(struct - release_firmware(sc->sc_ah->eeprom_blob); - } - -+static int ath9k_nvmem_request_eeprom(struct ath_softc *sc) -+{ -+ struct ath_hw *ah = sc->sc_ah; -+ struct nvmem_cell *cell; -+ void *buf; -+ size_t len; -+ int err; -+ -+ cell = devm_nvmem_cell_get(sc->dev, "calibration"); -+ if (IS_ERR(cell)) { -+ err = PTR_ERR(cell); -+ -+ /* nvmem cell might not be defined, or the nvmem -+ * subsystem isn't included. In this case, follow -+ * the established "just return 0;" convention of -+ * ath9k_init_platform to say: -+ * "All good. Nothing to see here. Please go on." -+ */ -+ if (err == -ENOENT || err == -EOPNOTSUPP) -+ return 0; -+ -+ return err; -+ } -+ -+ buf = nvmem_cell_read(cell, &len); -+ if (IS_ERR(buf)) -+ return PTR_ERR(buf); -+ -+ /* run basic sanity checks on the returned nvram cell length. -+ * That length has to be a multiple of a "u16" (i.e.: & 1). -+ * Furthermore, it has to be more than "let's say" 512 bytes -+ * but less than the maximum of AR9300_EEPROM_SIZE (16kb). -+ */ -+ if (((len & 1) == 1) || (len < 512) || (len >= AR9300_EEPROM_SIZE)) { -+ kfree(buf); -+ return -EINVAL; -+ } -+ -+ /* devres manages the calibration values release on shutdown */ -+ ah->nvmem_blob = (u16 *)devm_kmemdup(sc->dev, buf, len, GFP_KERNEL); -+ kfree(buf); -+ if (!ah->nvmem_blob) -+ return -ENOMEM; -+ -+ ah->nvmem_blob_len = len; -+ ah->ah_flags &= ~AH_USE_EEPROM; -+ ah->ah_flags |= AH_NO_EEP_SWAP; -+ -+ return 0; -+} -+ - static int ath9k_init_platform(struct ath_softc *sc) - { - struct ath9k_platform_data *pdata = sc->dev->platform_data; -@@ -710,6 +762,10 @@ static int ath9k_init_softc(u16 devid, s - if (ret) - return ret; - -+ ret = ath9k_nvmem_request_eeprom(sc); -+ if (ret) -+ return ret; -+ - if (ath9k_led_active_high != -1) - ah->config.led_active_high = ath9k_led_active_high == 1; - diff --git a/package/kernel/mac80211/patches/ath9k/601-v5.16-ath9k-owl-loader-fetch-pci-init-values-through-nvmem.patch b/package/kernel/mac80211/patches/ath9k/601-v5.16-ath9k-owl-loader-fetch-pci-init-values-through-nvmem.patch deleted file mode 100644 index 62c561d6193..00000000000 --- a/package/kernel/mac80211/patches/ath9k/601-v5.16-ath9k-owl-loader-fetch-pci-init-values-through-nvmem.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 9bf31835f11aa3c4fe5a9c1f7462c199c5d8e7ca Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Sat, 21 Aug 2021 00:22:39 +0200 -Subject: [PATCH] ath9k: owl-loader: fetch pci init values through nvmem - -extends the owl loader to fetch important pci initialization -values - which are stored together with the calibration data - -through the nvmem subsystem. - -This allows for much faster WIFI/ath9k initializations on devices -that do not require to perform any post-processing (like XOR'ing/ -reversal or unpacking) since no userspace helper is required. - -Signed-off-by: Christian Lamparter ---- - .../wireless/ath/ath9k/ath9k_pci_owl_loader.c | 105 +++++++++++++----- - 1 file changed, 76 insertions(+), 29 deletions(-) - ---- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c -+++ b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c -@@ -19,9 +19,14 @@ - #include - #include - #include -+#include -+#include - - struct owl_ctx { -+ struct pci_dev *pdev; - struct completion eeprom_load; -+ struct work_struct work; -+ struct nvmem_cell *cell; - }; - - #define EEPROM_FILENAME_LEN 100 -@@ -42,6 +47,12 @@ static int ath9k_pci_fixup(struct pci_de - u32 bar0; - bool swap_needed = false; - -+ /* also note that we are doing *u16 operations on the file */ -+ if (cal_len > 4096 || cal_len < 0x200 || (cal_len & 1) == 1) { -+ dev_err(&pdev->dev, "eeprom has an invalid size.\n"); -+ return -EINVAL; -+ } -+ - if (*cal_data != AR5416_EEPROM_MAGIC) { - if (*cal_data != swab16(AR5416_EEPROM_MAGIC)) { - dev_err(&pdev->dev, "invalid calibration data\n"); -@@ -99,38 +110,31 @@ static int ath9k_pci_fixup(struct pci_de - return 0; - } - --static void owl_fw_cb(const struct firmware *fw, void *context) -+static void owl_rescan(struct pci_dev *pdev) - { -- struct pci_dev *pdev = (struct pci_dev *)context; -- struct owl_ctx *ctx = (struct owl_ctx *)pci_get_drvdata(pdev); -- struct pci_bus *bus; -- -- complete(&ctx->eeprom_load); -- -- if (!fw) { -- dev_err(&pdev->dev, "no eeprom data received.\n"); -- goto release; -- } -- -- /* also note that we are doing *u16 operations on the file */ -- if (fw->size > 4096 || fw->size < 0x200 || (fw->size & 1) == 1) { -- dev_err(&pdev->dev, "eeprom file has an invalid size.\n"); -- goto release; -- } -- -- if (ath9k_pci_fixup(pdev, (const u16 *)fw->data, fw->size)) -- goto release; -+ struct pci_bus *bus = pdev->bus; - - pci_lock_rescan_remove(); -- bus = pdev->bus; - pci_stop_and_remove_bus_device(pdev); - /* the device should come back with the proper - * ProductId. But we have to initiate a rescan. - */ - pci_rescan_bus(bus); - pci_unlock_rescan_remove(); -+} -+ -+static void owl_fw_cb(const struct firmware *fw, void *context) -+{ -+ struct owl_ctx *ctx = (struct owl_ctx *)context; -+ -+ complete(&ctx->eeprom_load); - --release: -+ if (fw) { -+ ath9k_pci_fixup(ctx->pdev, (const u16 *)fw->data, fw->size); -+ owl_rescan(ctx->pdev); -+ } else { -+ dev_err(&ctx->pdev->dev, "no eeprom data received.\n"); -+ } - release_firmware(fw); - } - -@@ -152,6 +156,43 @@ static const char *owl_get_eeprom_name(s - return eeprom_name; - } - -+static void owl_nvmem_work(struct work_struct *work) -+{ -+ struct owl_ctx *ctx = container_of(work, struct owl_ctx, work); -+ void *buf; -+ size_t len; -+ -+ complete(&ctx->eeprom_load); -+ -+ buf = nvmem_cell_read(ctx->cell, &len); -+ if (!IS_ERR(buf)) { -+ ath9k_pci_fixup(ctx->pdev, buf, len); -+ kfree(buf); -+ owl_rescan(ctx->pdev); -+ } else { -+ dev_err(&ctx->pdev->dev, "no nvmem data received.\n"); -+ } -+} -+ -+static int owl_nvmem_probe(struct owl_ctx *ctx) -+{ -+ int err; -+ -+ ctx->cell = devm_nvmem_cell_get(&ctx->pdev->dev, "calibration"); -+ if (IS_ERR(ctx->cell)) { -+ err = PTR_ERR(ctx->cell); -+ if (err == -ENOENT || err == -EOPNOTSUPP) -+ return 1; /* not present, try firmware_request */ -+ -+ return err; -+ } -+ -+ INIT_WORK(&ctx->work, owl_nvmem_work); -+ schedule_work(&ctx->work); -+ -+ return 0; -+} -+ - static int owl_probe(struct pci_dev *pdev, - const struct pci_device_id *id) - { -@@ -164,21 +205,27 @@ static int owl_probe(struct pci_dev *pde - - pcim_pin_device(pdev); - -- eeprom_name = owl_get_eeprom_name(pdev); -- if (!eeprom_name) { -- dev_err(&pdev->dev, "no eeprom filename found.\n"); -- return -ENODEV; -- } -- - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); - if (!ctx) - return -ENOMEM; - - init_completion(&ctx->eeprom_load); -+ ctx->pdev = pdev; - - pci_set_drvdata(pdev, ctx); -+ -+ err = owl_nvmem_probe(ctx); -+ if (err <= 0) -+ return err; -+ -+ eeprom_name = owl_get_eeprom_name(pdev); -+ if (!eeprom_name) { -+ dev_err(&pdev->dev, "no eeprom filename found.\n"); -+ return -ENODEV; -+ } -+ - err = request_firmware_nowait(THIS_MODULE, true, eeprom_name, -- &pdev->dev, GFP_KERNEL, pdev, owl_fw_cb); -+ &pdev->dev, GFP_KERNEL, ctx, owl_fw_cb); - if (err) - dev_err(&pdev->dev, "failed to request caldata (%d).\n", err); - diff --git a/package/kernel/mac80211/patches/brcm/001-v5.19-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch b/package/kernel/mac80211/patches/brcm/001-v5.19-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch deleted file mode 100644 index e06e350b62d..00000000000 --- a/package/kernel/mac80211/patches/brcm/001-v5.19-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 716c220b4d990a4fe7800d0685ca69dee99e4e8f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Pavel=20L=C3=B6bl?= -Date: Fri, 6 May 2022 06:42:46 +0200 -Subject: [PATCH] brcmfmac: allow setting wlan MAC address using device tree -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This allows firmware to provide MAC address using device tree. Like in -case there is no MAC burned in wlan NVRAM. - -Signed-off-by: Pavel Löbl -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220506044246.67146-1-pavel@loebl.cz ---- - .../broadcom/brcm80211/brcmfmac/common.c | 23 ++++++++++++++----- - .../broadcom/brcm80211/brcmfmac/common.h | 1 + - .../broadcom/brcm80211/brcmfmac/core.c | 4 +++- - .../wireless/broadcom/brcm80211/brcmfmac/of.c | 3 +++ - 4 files changed, 24 insertions(+), 7 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -202,13 +202,24 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - char *ptr; - s32 err; - -- /* retreive mac address */ -- err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, -- sizeof(ifp->mac_addr)); -- if (err < 0) { -- bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err); -- goto done; -+ if (is_valid_ether_addr(ifp->mac_addr)) { -+ /* set mac address */ -+ err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr, -+ ETH_ALEN); -+ if (err < 0) { -+ bphy_err(ifp->drvr, "Setting cur_etheraddr failed, %d\n", err); -+ goto done; -+ } -+ } else { -+ /* retrieve mac address */ -+ err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, -+ sizeof(ifp->mac_addr)); -+ if (err < 0) { -+ bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err); -+ goto done; -+ } - } -+ - memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); - memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN); - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -@@ -50,6 +50,7 @@ struct brcmf_mp_device { - bool ignore_probe_fail; - struct brcmfmac_pd_cc *country_codes; - const char *board_type; -+ unsigned char mac[ETH_ALEN]; - union { - struct brcmfmac_sdio_pd sdio; - } bus; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -7,6 +7,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1227,7 +1228,8 @@ static int brcmf_bus_started(struct brcm - brcmf_dbg(TRACE, "\n"); - - /* add primary networking interface */ -- ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL); -+ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", -+ is_valid_ether_addr(drvr->settings->mac) ? drvr->settings->mac : NULL); - if (IS_ERR(ifp)) - return PTR_ERR(ifp); - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -@@ -5,6 +5,7 @@ - #include - #include - #include -+#include - - #include - #include "debug.h" -@@ -97,6 +98,8 @@ void brcmf_of_probe(struct device *dev, - if (err) - brcmf_err("failed to get OF country code map (err=%d)\n", err); - -+ of_get_mac_address(np, settings->mac); -+ - if (bus_type != BRCMF_BUSTYPE_SDIO) - return; - diff --git a/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch index 5dc04ecc88e..22b67c49d8e 100644 --- a/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch +++ b/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch @@ -20,7 +20,7 @@ if (phy->type == B43_PHYTYPE_B) { value16 = b43_read16(dev, 0x005E); -@@ -3985,7 +3985,6 @@ static int b43_op_config(struct ieee8021 +@@ -3986,7 +3986,6 @@ static int b43_op_config(struct ieee8021 struct b43_wldev *dev = wl->current_dev; struct b43_phy *phy = &dev->phy; struct ieee80211_conf *conf = &hw->conf; @@ -28,7 +28,7 @@ int err = 0; mutex_lock(&wl->mutex); -@@ -4028,11 +4027,9 @@ static int b43_op_config(struct ieee8021 +@@ -4029,11 +4028,9 @@ static int b43_op_config(struct ieee8021 } /* Antennas for RX and management frame TX. */ @@ -42,7 +42,7 @@ if (wl->radio_enabled != phy->radio_on) { if (wl->radio_enabled) { -@@ -5175,6 +5172,47 @@ static int b43_op_get_survey(struct ieee +@@ -5176,6 +5173,47 @@ static int b43_op_get_survey(struct ieee return 0; } @@ -89,8 +89,8 @@ + static const struct ieee80211_ops b43_hw_ops = { .tx = b43_op_tx, - .conf_tx = b43_op_conf_tx, -@@ -5196,6 +5234,8 @@ static const struct ieee80211_ops b43_hw + .wake_tx_queue = ieee80211_handle_wake_tx_queue, +@@ -5198,6 +5236,8 @@ static const struct ieee80211_ops b43_hw .sw_scan_complete = b43_op_sw_scan_complete_notifier, .get_survey = b43_op_get_survey, .rfkill_poll = b43_rfkill_poll, @@ -99,7 +99,7 @@ }; /* Hard-reset the chip. Do not call this directly. -@@ -5497,6 +5537,8 @@ static int b43_one_core_attach(struct b4 +@@ -5499,6 +5539,8 @@ static int b43_one_core_attach(struct b4 if (!wldev) goto out; @@ -108,7 +108,7 @@ wldev->use_pio = b43_modparam_pio; wldev->dev = dev; wldev->wl = wl; -@@ -5588,6 +5630,9 @@ static struct b43_wl *b43_wireless_init( +@@ -5590,6 +5632,9 @@ static struct b43_wl *b43_wireless_init( wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); diff --git a/package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch b/package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch index a8eae19413b..3700eaa1a06 100644 --- a/package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch +++ b/package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c -@@ -114,7 +114,7 @@ static int b43_modparam_pio = 0; +@@ -114,7 +114,7 @@ static int b43_modparam_pio; module_param_named(pio, b43_modparam_pio, int, 0644); MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO"); diff --git a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch index 7b9512f7410..9d0f3e20b1d 100644 --- a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch @@ -13,15 +13,15 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -431,6 +431,7 @@ struct brcmf_fw { - struct brcmf_fw_request *req; +@@ -459,6 +459,7 @@ struct brcmf_fw { u32 curpos; + unsigned int board_index; void (*done)(struct device *dev, int err, struct brcmf_fw_request *req); + struct completion *completion; }; #ifdef CONFIG_EFI -@@ -655,6 +656,8 @@ static void brcmf_fw_request_done(const +@@ -686,6 +687,8 @@ static void brcmf_fw_request_done(const fwctx->req = NULL; } fwctx->done(fwctx->dev, ret, fwctx->req); @@ -30,7 +30,7 @@ Signed-off-by: Rafał Miłecki kfree(fwctx); } -@@ -695,6 +698,8 @@ int brcmf_fw_get_firmwares(struct device +@@ -751,6 +754,8 @@ int brcmf_fw_get_firmwares(struct device { struct brcmf_fw_item *first = &req->items[0]; struct brcmf_fw *fwctx; @@ -39,7 +39,7 @@ Signed-off-by: Rafał Miłecki char *alt_path = NULL; int ret; -@@ -712,6 +717,9 @@ int brcmf_fw_get_firmwares(struct device +@@ -768,6 +773,9 @@ int brcmf_fw_get_firmwares(struct device fwctx->dev = dev; fwctx->req = req; fwctx->done = fw_cb; @@ -48,8 +48,8 @@ Signed-off-by: Rafał Miłecki + fwctx->completion = &completion; /* First try alternative board-specific path if any */ - if (fwctx->req->board_type) -@@ -730,6 +738,12 @@ int brcmf_fw_get_firmwares(struct device + if (fwctx->req->board_types[0]) +@@ -787,6 +795,12 @@ int brcmf_fw_get_firmwares(struct device if (ret < 0) brcmf_fw_request_done(NULL, fwctx); diff --git a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch index 7b4cb250f93..4db63f92e69 100644 --- a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch +++ b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -715,8 +715,36 @@ static struct wireless_dev *brcmf_cfg802 +@@ -710,8 +710,36 @@ static struct wireless_dev *brcmf_cfg802 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_pub *drvr = cfg->pub; struct wireless_dev *wdev; diff --git a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch index 88465f256be..16eef0e105a 100644 --- a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch +++ b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2974,6 +2974,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2973,6 +2973,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ diff --git a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch index 1ddc78f7ca9..cd202f65760 100644 --- a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch +++ b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch @@ -12,7 +12,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -@@ -59,6 +59,36 @@ static int brcmf_of_get_country_codes(st +@@ -65,6 +65,36 @@ static int brcmf_of_get_country_codes(st return 0; } @@ -49,7 +49,7 @@ Signed-off-by: Rafał Miłecki void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, struct brcmf_mp_device *settings) { -@@ -91,6 +121,8 @@ void brcmf_of_probe(struct device *dev, +@@ -105,6 +135,8 @@ void brcmf_of_probe(struct device *dev, of_node_put(root); } diff --git a/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch b/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch index 8adb8c42a10..7d0e730b692 100644 --- a/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch +++ b/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch @@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell #include "of.h" static int brcmf_of_get_country_codes(struct device *dev, -@@ -153,3 +154,38 @@ void brcmf_of_probe(struct device *dev, +@@ -167,3 +168,38 @@ void brcmf_of_probe(struct device *dev, sdio->oob_irq_nr = irq; sdio->oob_irq_flags = irqf; } @@ -92,7 +92,7 @@ Signed-off-by: Phil Elwell #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500) #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500) -@@ -633,7 +634,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "b +@@ -634,7 +635,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "b /* per-board firmware binaries */ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-sdio.*.bin"); @@ -101,7 +101,7 @@ Signed-off-by: Phil Elwell BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), -@@ -659,6 +660,9 @@ static const struct brcmf_firmware_mappi +@@ -662,6 +663,9 @@ static const struct brcmf_firmware_mappi BRCMF_FW_ENTRY(CY_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752) }; @@ -111,18 +111,9 @@ Signed-off-by: Phil Elwell #define TXCTL_CREDITS 2 static void pkt_align(struct sk_buff *p, int len, int align) -@@ -4140,7 +4144,7 @@ int brcmf_sdio_get_fwname(struct device - - fwreq = brcmf_fw_alloc_request(bus_if->chip, bus_if->chiprev, - brcmf_sdio_fwnames, -- ARRAY_SIZE(brcmf_sdio_fwnames), -+ brcmf_sdio_fwnames_count, - fwnames, ARRAY_SIZE(fwnames)); - if (!fwreq) - return -ENOMEM; -@@ -4196,6 +4200,9 @@ static const struct brcmf_bus_ops brcmf_ - #define BRCMF_SDIO_FW_CODE 0 +@@ -4192,6 +4196,9 @@ static const struct brcmf_bus_ops brcmf_ #define BRCMF_SDIO_FW_NVRAM 1 + #define BRCMF_SDIO_FW_CLM 2 +static struct brcmf_fw_request * +brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus); @@ -130,7 +121,7 @@ Signed-off-by: Phil Elwell static void brcmf_sdio_firmware_callback(struct device *dev, int err, struct brcmf_fw_request *fwreq) { -@@ -4211,6 +4218,22 @@ static void brcmf_sdio_firmware_callback +@@ -4207,6 +4214,22 @@ static void brcmf_sdio_firmware_callback brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); @@ -153,7 +144,7 @@ Signed-off-by: Phil Elwell if (err) goto fail; -@@ -4419,7 +4442,7 @@ brcmf_sdio_prepare_fw_request(struct brc +@@ -4417,7 +4440,7 @@ brcmf_sdio_prepare_fw_request(struct brc fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev, brcmf_sdio_fwnames, diff --git a/package/kernel/mac80211/patches/brcm/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch deleted file mode 100644 index 234a97b7bfc..00000000000 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ /dev/null @@ -1,148 +0,0 @@ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2921,6 +2921,63 @@ done: - } - - static int -+brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, -+ int idx, struct survey_info *survey) -+{ -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); -+ struct brcmf_if *ifp = netdev_priv(ndev); -+ struct brcmu_chan ch; -+ enum nl80211_band band = 0; -+ s32 err = 0; -+ int noise; -+ u32 freq; -+ u32 chanspec; -+ -+ memset(survey, 0, sizeof(struct survey_info)); -+ if (idx != 0) { -+ if (idx >= cfg->pub->num_chan_stats || cfg->pub->chan_stats == NULL) -+ return -ENOENT; -+ if (cfg->pub->chan_stats[idx].freq == 0) -+ return -ENOENT; -+ survey->filled = SURVEY_INFO_NOISE_DBM; -+ survey->channel = ieee80211_get_channel(wiphy, cfg->pub->chan_stats[idx].freq); -+ survey->noise = cfg->pub->chan_stats[idx].noise; -+ return 0; -+ } -+ -+ err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec); -+ if (err) { -+ brcmf_err("chanspec failed (%d)\n", err); -+ return err; -+ } -+ -+ ch.chspec = chanspec; -+ cfg->d11inf.decchspec(&ch); -+ -+ switch (ch.band) { -+ case BRCMU_CHAN_BAND_2G: -+ band = NL80211_BAND_2GHZ; -+ break; -+ case BRCMU_CHAN_BAND_5G: -+ band = NL80211_BAND_5GHZ; -+ break; -+ } -+ -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band); -+ survey->channel = ieee80211_get_channel(wiphy, freq); -+ -+ err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PHY_NOISE, &noise); -+ if (err) { -+ brcmf_err("Could not get noise (%d)\n", err); -+ return err; -+ } -+ -+ survey->filled = SURVEY_INFO_NOISE_DBM | SURVEY_INFO_IN_USE; -+ survey->noise = le32_to_cpu(noise); -+ return 0; -+} -+ -+static int - brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev, - int idx, u8 *mac, struct station_info *sinfo) - { -@@ -3021,6 +3078,7 @@ static s32 brcmf_inform_single_bss(struc - struct brcmu_chan ch; - u16 channel; - u32 freq; -+ int i; - u16 notify_capability; - u16 notify_interval; - u8 *notify_ie; -@@ -3045,6 +3103,17 @@ static s32 brcmf_inform_single_bss(struc - band = NL80211_BAND_5GHZ; - - freq = ieee80211_channel_to_frequency(channel, band); -+ for (i = 0;i < cfg->pub->num_chan_stats;i++) { -+ if (freq == cfg->pub->chan_stats[i].freq) -+ break; -+ if (cfg->pub->chan_stats[i].freq == 0) -+ break; -+ } -+ if (i < cfg->pub->num_chan_stats) { -+ cfg->pub->chan_stats[i].freq = freq; -+ cfg->pub->chan_stats[i].noise = bi->phy_noise; -+ } -+ - bss_data.chan = ieee80211_get_channel(wiphy, freq); - bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; - bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); -@@ -5573,6 +5642,7 @@ static struct cfg80211_ops brcmf_cfg8021 - .leave_ibss = brcmf_cfg80211_leave_ibss, - .get_station = brcmf_cfg80211_get_station, - .dump_station = brcmf_cfg80211_dump_station, -+ .dump_survey = brcmf_cfg80211_dump_survey, - .set_tx_power = brcmf_cfg80211_set_tx_power, - .get_tx_power = brcmf_cfg80211_get_tx_power, - .add_key = brcmf_cfg80211_add_key, ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1364,6 +1364,8 @@ int brcmf_attach(struct device *dev) - - /* Link to bus module */ - drvr->hdrlen = 0; -+ drvr->chan_stats = vzalloc(256 * sizeof(struct brcmf_chan_stats)); -+ drvr->num_chan_stats = 256; - - /* Attach and link in the protocol */ - ret = brcmf_proto_attach(drvr); -@@ -1446,6 +1448,12 @@ void brcmf_detach(struct device *dev) - if (drvr == NULL) - return; - -+ drvr->num_chan_stats = 0; -+ if (drvr->chan_stats) { -+ vfree(drvr->chan_stats); -+ drvr->chan_stats = NULL; -+ } -+ - #ifdef CONFIG_INET - unregister_inetaddr_notifier(&drvr->inetaddr_notifier); - #endif ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -91,6 +91,11 @@ struct brcmf_rev_info { - u32 nvramrev; - }; - -+struct brcmf_chan_stats { -+ u32 freq; -+ int noise; -+}; -+ - /* Common structure for module and instance linkage */ - struct brcmf_pub { - /* Linkage ponters */ -@@ -100,6 +105,9 @@ struct brcmf_pub { - struct cfg80211_ops *ops; - struct brcmf_cfg80211_info *config; - -+ int num_chan_stats; -+ struct brcmf_chan_stats *chan_stats; -+ - /* Internal brcmf items */ - uint hdrlen; /* Total BRCMF header length (proto + bus) */ - diff --git a/package/kernel/mac80211/patches/build/015-ipw200-mtu.patch b/package/kernel/mac80211/patches/build/015-ipw200-mtu.patch deleted file mode 100644 index 68db4f72d37..00000000000 --- a/package/kernel/mac80211/patches/build/015-ipw200-mtu.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c -+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c -@@ -11470,6 +11470,15 @@ static const struct attribute_group ipw_ - .attrs = ipw_sysfs_entries, - }; - -+#if LINUX_VERSION_IS_LESS(4,10,0) -+static int __change_mtu(struct net_device *ndev, int new_mtu){ -+ if (new_mtu < 68 || new_mtu > LIBIPW_DATA_LEN) -+ return -EINVAL; -+ ndev->mtu = new_mtu; -+ return 0; -+} -+#endif -+ - #ifdef CPTCFG_IPW2200_PROMISCUOUS - static int ipw_prom_open(struct net_device *dev) - { -@@ -11518,15 +11527,6 @@ static netdev_tx_t ipw_prom_hard_start_x - return NETDEV_TX_OK; - } - --#if LINUX_VERSION_IS_LESS(4,10,0) --static int __change_mtu(struct net_device *ndev, int new_mtu){ -- if (new_mtu < 68 || new_mtu > LIBIPW_DATA_LEN) -- return -EINVAL; -- ndev->mtu = new_mtu; -- return 0; --} --#endif -- - static const struct net_device_ops ipw_prom_netdev_ops = { - #if LINUX_VERSION_IS_LESS(4,10,0) - .ndo_change_mtu = __change_mtu, diff --git a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch index 089ff2117bd..4ad2ac081a6 100644 --- a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch +++ b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -451,43 +451,6 @@ USB_VL600= +@@ -470,43 +470,6 @@ USB_VL600= USB_NET_CH9200= USB_NET_AQC111= USB_RTL8153_ECM= @@ -99,7 +99,7 @@ return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev); #else return bus->chipco.dev; -@@ -4870,7 +4870,7 @@ static int b43_wireless_core_init(struct +@@ -4871,7 +4871,7 @@ static int b43_wireless_core_init(struct } if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ @@ -158,27 +158,6 @@ pcidev = bus->pcicore.dev; #endif gpiodev = bus->chipco.dev ? : pcidev; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h -@@ -24,7 +24,7 @@ struct brcms_led { - struct gpio_desc *gpiod; - }; - --#ifdef CPTCFG_BCMA_DRIVER_GPIO -+#ifdef CONFIG_BCMA_DRIVER_GPIO - void brcms_led_unregister(struct brcms_info *wl); - int brcms_led_register(struct brcms_info *wl); - #else ---- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile -@@ -42,6 +42,6 @@ brcmsmac-y := \ - brcms_trace_events.o \ - debug.o - --brcmsmac-$(CPTCFG_BCMA_DRIVER_GPIO) += led.o -+brcmsmac-$(CONFIG_BCMA_DRIVER_GPIO) += led.o - - obj-$(CPTCFG_BRCMSMAC) += brcmsmac.o --- a/drivers/net/wireless/broadcom/brcm80211/Kconfig +++ b/drivers/net/wireless/broadcom/brcm80211/Kconfig @@ -8,7 +8,7 @@ config BRCMSMAC @@ -187,12 +166,12 @@ depends on BCMA_POSSIBLE - select BCMA + depends on BCMA - select NEW_LEDS if BCMA_DRIVER_GPIO - select LEDS_CLASS if BCMA_DRIVER_GPIO select BRCMUTIL + depends on FW_LOADER + depends on CORDIC --- a/Kconfig.local +++ b/Kconfig.local -@@ -1357,117 +1357,6 @@ config BACKPORTED_USB_NET_AQC111 +@@ -1414,117 +1414,6 @@ config BACKPORTED_USB_NET_AQC111 config BACKPORTED_USB_RTL8153_ECM tristate default USB_RTL8153_ECM diff --git a/package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch b/package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch index 77b6e1de1c0..121b7faad93 100644 --- a/package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch +++ b/package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch @@ -5,6 +5,6 @@ depends on WLAN && MMC && CFG80211 depends on m - select CFG80211_WEXT + depends on CRYPTO select BPAUTO_CRYPTO_LIB_ARC4 help - This option enables support for RTL8723BS SDIO drivers, such as diff --git a/package/kernel/mac80211/patches/build/080-resv_start_op.patch b/package/kernel/mac80211/patches/build/080-resv_start_op.patch new file mode 100644 index 00000000000..67ccc73a484 --- /dev/null +++ b/package/kernel/mac80211/patches/build/080-resv_start_op.patch @@ -0,0 +1,24 @@ +--- a/drivers/net/wireless/mac80211_hwsim.c ++++ b/drivers/net/wireless/mac80211_hwsim.c +@@ -5363,7 +5363,9 @@ static struct genl_family hwsim_genl_fam + .module = THIS_MODULE, + .small_ops = hwsim_ops, + .n_small_ops = ARRAY_SIZE(hwsim_ops), ++#if LINUX_VERSION_IS_GEQ(6,1,0) + .resv_start_op = HWSIM_CMD_DEL_MAC_ADDR + 1, ++#endif + .mcgrps = hwsim_mcgrps, + .n_mcgrps = ARRAY_SIZE(hwsim_mcgrps), + }; +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -17232,7 +17232,9 @@ static struct genl_family nl80211_fam __ + .n_ops = ARRAY_SIZE(nl80211_ops), + .small_ops = nl80211_small_ops, + .n_small_ops = ARRAY_SIZE(nl80211_small_ops), ++#if LINUX_VERSION_IS_GEQ(6,1,0) + .resv_start_op = NL80211_CMD_REMOVE_LINK_STA + 1, ++#endif + .mcgrps = nl80211_mcgrps, + .n_mcgrps = ARRAY_SIZE(nl80211_mcgrps), + .parallel_ops = true, diff --git a/package/kernel/mac80211/patches/build/090-bcma-otp.patch b/package/kernel/mac80211/patches/build/090-bcma-otp.patch new file mode 100644 index 00000000000..39747761246 --- /dev/null +++ b/package/kernel/mac80211/patches/build/090-bcma-otp.patch @@ -0,0 +1,13 @@ +--- /dev/null ++++ b/backport-include/linux/bcma/bcma_driver_chipcommon.h +@@ -0,0 +1,10 @@ ++#ifndef __BACKPORT_BCMA_DRIVER_CHIPCOMMON_H ++#define __BACKPORT_BCMA_DRIVER_CHIPCOMMON_H ++ ++#include_next ++ ++#ifndef BCMA_CC_SROM_CONTROL_OTP_PRESENT ++#define BCMA_CC_SROM_CONTROL_OTP_PRESENT 0x00000020 ++#endif ++ ++#endif diff --git a/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch index 140949f9a88..11536651b5e 100644 --- a/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch +++ b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -5699,6 +5699,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") +@@ -5703,6 +5703,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API)); static const struct pci_device_id mwl8k_pci_id_table[] = { diff --git a/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch index dfa0e502fc5..2c426ab828f 100644 --- a/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch +++ b/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c -@@ -2053,6 +2053,8 @@ struct wireless_dev *lbs_cfg_alloc(struc +@@ -2052,6 +2052,8 @@ struct wireless_dev *lbs_cfg_alloc(struc goto err_wiphy_new; } @@ -11,7 +11,7 @@ err_wiphy_new: --- a/drivers/net/wireless/marvell/libertas/main.c +++ b/drivers/net/wireless/marvell/libertas/main.c -@@ -935,6 +935,7 @@ struct lbs_private *lbs_add_card(void *c +@@ -934,6 +934,7 @@ struct lbs_private *lbs_add_card(void *c goto err_adapter; } diff --git a/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch index c2d0a5890d2..b47aee54908 100644 --- a/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch +++ b/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c -@@ -2129,6 +2129,8 @@ int lbs_cfg_register(struct lbs_private +@@ -2128,6 +2128,8 @@ int lbs_cfg_register(struct lbs_private wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); wdev->wiphy->reg_notifier = lbs_reg_notifier; diff --git a/package/kernel/mac80211/patches/mwl/900-mwifiex-increase-the-global-limit-up-to-4-SSID.patch b/package/kernel/mac80211/patches/mwl/900-mwifiex-increase-the-global-limit-up-to-4-SSID.patch index 4115eeccbb3..caa139a2c6e 100644 --- a/package/kernel/mac80211/patches/mwl/900-mwifiex-increase-the-global-limit-up-to-4-SSID.patch +++ b/package/kernel/mac80211/patches/mwl/900-mwifiex-increase-the-global-limit-up-to-4-SSID.patch @@ -21,7 +21,7 @@ the card-specific structure. --- a/drivers/net/wireless/marvell/mwifiex/decl.h +++ b/drivers/net/wireless/marvell/mwifiex/decl.h -@@ -30,7 +30,7 @@ +@@ -18,7 +18,7 @@ #include #define MWIFIEX_BSS_COEX_COUNT 2 @@ -30,7 +30,7 @@ the card-specific structure. #define MWIFIEX_DMA_ALIGN_SZ 64 #define MWIFIEX_RX_HEADROOM 64 -@@ -112,7 +112,7 @@ +@@ -100,7 +100,7 @@ #define MWIFIEX_RATE_INDEX_OFDM0 4 #define MWIFIEX_MAX_STA_NUM 3 diff --git a/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch index 96b1ce77e94..c8d24283aad 100644 --- a/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -6285,6 +6285,8 @@ static int mwl8k_probe(struct pci_dev *p +@@ -6289,6 +6289,8 @@ static int mwl8k_probe(struct pci_dev *p priv->running_bsses = 0; @@ -9,7 +9,7 @@ return rc; err_stop_firmware: -@@ -6318,8 +6320,6 @@ static void mwl8k_remove(struct pci_dev +@@ -6322,8 +6324,6 @@ static void mwl8k_remove(struct pci_dev return; priv = hw->priv; diff --git a/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch b/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch index 396e66ac22e..98ed9e60e98 100644 --- a/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch +++ b/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch @@ -19,7 +19,7 @@ Signed-off-by: Pali Rohár --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c -@@ -28,6 +28,85 @@ +@@ -16,6 +16,85 @@ static void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter); @@ -105,7 +105,7 @@ Signed-off-by: Pali Rohár /* * This function initializes a command node. * -@@ -205,8 +284,8 @@ static int mwifiex_dnld_cmd_to_fw(struct +@@ -193,8 +272,8 @@ static int mwifiex_dnld_cmd_to_fw(struct cmd_code != HostCmd_CMD_FUNC_SHUTDOWN && cmd_code != HostCmd_CMD_FUNC_INIT) { mwifiex_dbg(adapter, ERROR, @@ -116,7 +116,7 @@ Signed-off-by: Pali Rohár mwifiex_recycle_cmd_node(adapter, cmd_node); queue_work(adapter->workqueue, &adapter->main_work); return -1; -@@ -660,8 +739,8 @@ int mwifiex_send_cmd(struct mwifiex_priv +@@ -653,8 +732,8 @@ int mwifiex_send_cmd(struct mwifiex_priv /* Return error, since the command preparation failed */ if (ret) { mwifiex_dbg(adapter, ERROR, @@ -127,7 +127,7 @@ Signed-off-by: Pali Rohár mwifiex_insert_cmd_to_free_q(adapter, cmd_node); return -1; } -@@ -900,8 +979,9 @@ int mwifiex_process_cmdresp(struct mwifi +@@ -902,8 +981,9 @@ int mwifiex_process_cmdresp(struct mwifi if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { if (ret) { mwifiex_dbg(adapter, ERROR, @@ -139,7 +139,7 @@ Signed-off-by: Pali Rohár mwifiex_init_fw_complete(adapter); return -1; } else if (adapter->last_init_cmd == cmdresp_no) -@@ -1264,8 +1344,8 @@ mwifiex_process_sleep_confirm_resp(struc +@@ -1273,8 +1353,8 @@ mwifiex_process_sleep_confirm_resp(struc if (command != HostCmd_CMD_802_11_PS_MODE_ENH) { mwifiex_dbg(adapter, ERROR, @@ -152,7 +152,7 @@ Signed-off-by: Pali Rohár --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h -@@ -1108,6 +1108,8 @@ void mwifiex_cancel_all_pending_cmd(stru +@@ -1099,6 +1099,8 @@ void mwifiex_cancel_all_pending_cmd(stru void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter); void mwifiex_cancel_scan(struct mwifiex_adapter *adapter); @@ -163,7 +163,7 @@ Signed-off-by: Pali Rohár --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c -@@ -48,8 +48,9 @@ mwifiex_process_cmdresp_error(struct mwi +@@ -36,8 +36,9 @@ mwifiex_process_cmdresp_error(struct mwi struct host_cmd_ds_802_11_ps_mode_enh *pm; mwifiex_dbg(adapter, ERROR, @@ -177,7 +177,7 @@ Signed-off-by: Pali Rohár adapter->cmd_wait_q.status = -1; --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c -@@ -806,7 +806,8 @@ int mwifiex_uap_prepare_cmd(struct mwifi +@@ -794,7 +794,8 @@ int mwifiex_uap_prepare_cmd(struct mwifi break; default: mwifiex_dbg(priv->adapter, ERROR, diff --git a/package/kernel/mac80211/patches/rt2x00/001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch b/package/kernel/mac80211/patches/rt2x00/001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch deleted file mode 100644 index 4d5b6702790..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch +++ /dev/null @@ -1,52 +0,0 @@ -From patchwork Sat Sep 17 20:26:27 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979242 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:26:27 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 01/16] rt2x00: define RF5592 in init_eeprom routine -Message-ID: - -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -From: Tomislav Požega - -Fix incorrect RF value encoded in EEPROM on devices with Ralink Rt5592 -PCIe radio (a single chip 2T2R 802.11abgn solution). - -Signed-off-by: Tomislav Požega -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9461,6 +9461,8 @@ static int rt2800_init_eeprom(struct rt2 - rf = RF3853; - else if (rt2x00_rt(rt2x00dev, RT5350)) - rf = RF5350; -+ else if (rt2x00_rt(rt2x00dev, RT5592)) -+ rf = RF5592; - else - rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE); - diff --git a/package/kernel/mac80211/patches/rt2x00/002-v6.1-rt2x00-add-throughput-LED-trigger.patch b/package/kernel/mac80211/patches/rt2x00/002-v6.1-rt2x00-add-throughput-LED-trigger.patch deleted file mode 100644 index 02d1f7a2e51..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/002-v6.1-rt2x00-add-throughput-LED-trigger.patch +++ /dev/null @@ -1,76 +0,0 @@ -From patchwork Sat Sep 17 20:26:40 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979243 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:26:40 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 02/16] rt2x00: add throughput LED trigger -Message-ID: - <73f5ba4134e621462a26186449400cf0c1ac1730.1663445157.git.daniel@makrotopia.org> -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -From: David Bauer - -This adds a (currently missing) throughput LED trigger for the rt2x00 -driver. Previously, LED triggers had to be assigned to the netdev, which -was limited to a single VAP. - -Tested-by: Christoph Krapp -Signed-off-by: David Bauer -Acked-by: Stanislaw Gruszka ---- - drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1093,6 +1093,19 @@ static void rt2x00lib_remove_hw(struct r - kfree(rt2x00dev->spec.channels_info); - } - -+static const struct ieee80211_tpt_blink rt2x00_tpt_blink[] = { -+ { .throughput = 0 * 1024, .blink_time = 334 }, -+ { .throughput = 1 * 1024, .blink_time = 260 }, -+ { .throughput = 2 * 1024, .blink_time = 220 }, -+ { .throughput = 5 * 1024, .blink_time = 190 }, -+ { .throughput = 10 * 1024, .blink_time = 170 }, -+ { .throughput = 25 * 1024, .blink_time = 150 }, -+ { .throughput = 54 * 1024, .blink_time = 130 }, -+ { .throughput = 120 * 1024, .blink_time = 110 }, -+ { .throughput = 265 * 1024, .blink_time = 80 }, -+ { .throughput = 586 * 1024, .blink_time = 50 }, -+}; -+ - static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) - { - struct hw_mode_spec *spec = &rt2x00dev->spec; -@@ -1174,6 +1187,11 @@ static int rt2x00lib_probe_hw(struct rt2 - - #undef RT2X00_TASKLET_INIT - -+ ieee80211_create_tpt_led_trigger(rt2x00dev->hw, -+ IEEE80211_TPT_LEDTRIG_FL_RADIO, -+ rt2x00_tpt_blink, -+ ARRAY_SIZE(rt2x00_tpt_blink)); -+ - /* - * Register HW. - */ diff --git a/package/kernel/mac80211/patches/rt2x00/003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch deleted file mode 100644 index 26c2020918f..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch +++ /dev/null @@ -1,125 +0,0 @@ -From patchwork Sat Sep 17 20:26:55 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979244 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:26:55 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 03/16] rt2x00: add support for external PA on MT7620 -Message-ID: - -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -Implement support for external PA connected to MT7620A. - -Signed-off-by: Tomislav Požega -[pozega.tomislav@gmail.com: use chanreg and dccal helpers.] -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- - drivers/net/wireless/ralink/rt2x00/rt2800.h | 1 + - .../net/wireless/ralink/rt2x00/rt2800lib.c | 52 ++++++++++++++++++- - 2 files changed, 52 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -2739,6 +2739,7 @@ enum rt2800_eeprom_word { - #define EEPROM_NIC_CONF2_RX_STREAM FIELD16(0x000f) - #define EEPROM_NIC_CONF2_TX_STREAM FIELD16(0x00f0) - #define EEPROM_NIC_CONF2_CRYSTAL FIELD16(0x0600) -+#define EEPROM_NIC_CONF2_EXTERNAL_PA FIELD16(0x8000) - - /* - * EEPROM LNA ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4372,6 +4372,43 @@ static void rt2800_config_channel(struct - rt2800_iq_calibrate(rt2x00dev, rf->channel); - } - -+ if (rt2x00_rt(rt2x00dev, RT6352)) { -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, -+ &rt2x00dev->cap_flags)) { -+ reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); -+ reg |= 0x00000101; -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); -+ -+ reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); -+ reg |= 0x00000101; -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); -+ -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); -+ -+ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, -+ 0x36303636); -+ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, -+ 0x6C6C6B6C); -+ rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, -+ 0x6C6C6B6C); -+ } -+ } -+ - bbp = rt2800_bbp_read(rt2x00dev, 4); - rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf)); - rt2800_bbp_write(rt2x00dev, 4, bbp); -@@ -9592,7 +9629,8 @@ static int rt2800_init_eeprom(struct rt2 - */ - eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); - -- if (rt2x00_rt(rt2x00dev, RT3352)) { -+ if (rt2x00_rt(rt2x00dev, RT3352) || -+ rt2x00_rt(rt2x00dev, RT6352)) { - if (rt2x00_get_field16(eeprom, - EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352)) - __set_bit(CAPABILITY_EXTERNAL_PA_TX0, -@@ -9603,6 +9641,18 @@ static int rt2800_init_eeprom(struct rt2 - &rt2x00dev->cap_flags); - } - -+ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2); -+ -+ if (rt2x00_rt(rt2x00dev, RT6352) && eeprom != 0 && eeprom != 0xffff) { -+ if (!rt2x00_get_field16(eeprom, -+ EEPROM_NIC_CONF2_EXTERNAL_PA)) { -+ __clear_bit(CAPABILITY_EXTERNAL_PA_TX0, -+ &rt2x00dev->cap_flags); -+ __clear_bit(CAPABILITY_EXTERNAL_PA_TX1, -+ &rt2x00dev->cap_flags); -+ } -+ } -+ - return 0; - } - diff --git a/package/kernel/mac80211/patches/rt2x00/004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch b/package/kernel/mac80211/patches/rt2x00/004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch deleted file mode 100644 index c9b0d82b649..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch +++ /dev/null @@ -1,178 +0,0 @@ -From patchwork Sat Sep 17 20:27:10 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979245 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:27:10 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 04/16] rt2x00: move up and reuse busy wait functions -Message-ID: - <3fdb9dc15e76a9f9c1948b4a3a1308a7a5677bb8.1663445157.git.daniel@makrotopia.org> -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -Move bbp_ready and rf_ready busy wait functions up in the code so they -can more easily be used. Allow specifying register mask in rf_ready -function which is useful for calibration routines which will be added -in follow-up commits. - -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- - .../net/wireless/ralink/rt2x00/rt2800lib.c | 99 +++++++++---------- - 1 file changed, 46 insertions(+), 53 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -2143,6 +2143,48 @@ void rt2800_config_erp(struct rt2x00_dev - } - EXPORT_SYMBOL_GPL(rt2800_config_erp); - -+static int rt2800_wait_bbp_rf_ready(struct rt2x00_dev *rt2x00dev, -+ const struct rt2x00_field32 mask) -+{ -+ unsigned int i; -+ u32 reg; -+ -+ for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -+ reg = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); -+ if (!rt2x00_get_field32(reg, mask)) -+ return 0; -+ -+ udelay(REGISTER_BUSY_DELAY); -+ } -+ -+ rt2x00_err(rt2x00dev, "BBP/RF register access failed, aborting\n"); -+ return -EACCES; -+} -+ -+static int rt2800_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) -+{ -+ unsigned int i; -+ u8 value; -+ -+ /* -+ * BBP was enabled after firmware was loaded, -+ * but we need to reactivate it now. -+ */ -+ rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); -+ rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); -+ msleep(1); -+ -+ for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -+ value = rt2800_bbp_read(rt2x00dev, 0); -+ if ((value != 0xff) && (value != 0x00)) -+ return 0; -+ udelay(REGISTER_BUSY_DELAY); -+ } -+ -+ rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n"); -+ return -EACCES; -+} -+ - static void rt2800_config_3572bt_ant(struct rt2x00_dev *rt2x00dev) - { - u32 reg; -@@ -3799,10 +3841,9 @@ static void rt2800_config_alc(struct rt2 - struct ieee80211_channel *chan, - int power_level) { - u16 eeprom, target_power, max_power; -- u32 mac_sys_ctrl, mac_status; -+ u32 mac_sys_ctrl; - u32 reg; - u8 bbp; -- int i; - - /* hardware unit is 0.5dBm, limited to 23.5dBm */ - power_level *= 2; -@@ -3838,16 +3879,8 @@ static void rt2800_config_alc(struct rt2 - /* Disable Tx/Rx */ - rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0); - /* Check MAC Tx/Rx idle */ -- for (i = 0; i < 10000; i++) { -- mac_status = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); -- if (mac_status & 0x3) -- usleep_range(50, 200); -- else -- break; -- } -- -- if (i == 10000) -- rt2x00_warn(rt2x00dev, "Wait MAC Status to MAX !!!\n"); -+ if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) -+ rt2x00_warn(rt2x00dev, "RF busy while configuring ALC\n"); - - if (chan->center_freq > 2457) { - bbp = rt2800_bbp_read(rt2x00dev, 30); -@@ -6275,46 +6308,6 @@ static int rt2800_init_registers(struct - return 0; - } - --static int rt2800_wait_bbp_rf_ready(struct rt2x00_dev *rt2x00dev) --{ -- unsigned int i; -- u32 reg; -- -- for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -- reg = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); -- if (!rt2x00_get_field32(reg, MAC_STATUS_CFG_BBP_RF_BUSY)) -- return 0; -- -- udelay(REGISTER_BUSY_DELAY); -- } -- -- rt2x00_err(rt2x00dev, "BBP/RF register access failed, aborting\n"); -- return -EACCES; --} -- --static int rt2800_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) --{ -- unsigned int i; -- u8 value; -- -- /* -- * BBP was enabled after firmware was loaded, -- * but we need to reactivate it now. -- */ -- rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); -- rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); -- msleep(1); -- -- for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -- value = rt2800_bbp_read(rt2x00dev, 0); -- if ((value != 0xff) && (value != 0x00)) -- return 0; -- udelay(REGISTER_BUSY_DELAY); -- } -- -- rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n"); -- return -EACCES; --} - - static void rt2800_bbp4_mac_if_ctrl(struct rt2x00_dev *rt2x00dev) - { -@@ -9136,7 +9129,7 @@ int rt2800_enable_radio(struct rt2x00_de - /* - * Wait BBP/RF to wake up. - */ -- if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev))) -+ if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) - return -EIO; - - /* diff --git a/package/kernel/mac80211/patches/rt2x00/005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch deleted file mode 100644 index 9ba16bee121..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch +++ /dev/null @@ -1,106 +0,0 @@ -From patchwork Sat Sep 17 20:27:26 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979246 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:27:26 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 05/16] rt2x00: add RF self TXDC calibration for MT7620 -Message-ID: - -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -From: Tomislav Požega - -Add TX self calibration based on mtk driver. - -Signed-off-by: Tomislav Požega -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- -v2: use ++i instead of i = i + 1 in loops - - .../net/wireless/ralink/rt2x00/rt2800lib.c | 48 +++++++++++++++++++ - 1 file changed, 48 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8454,6 +8454,53 @@ static void rt2800_init_rfcsr_5592(struc - rt2800_led_open_drain_enable(rt2x00dev); - } - -+static void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev) -+{ -+ u8 rfb5r1_org, rfb7r1_org, rfvalue; -+ u32 mac0518, mac051c, mac0528, mac052c; -+ u8 i; -+ -+ mac0518 = rt2800_register_read(rt2x00dev, RF_CONTROL0); -+ mac051c = rt2800_register_read(rt2x00dev, RF_BYPASS0); -+ mac0528 = rt2800_register_read(rt2x00dev, RF_CONTROL2); -+ mac052c = rt2800_register_read(rt2x00dev, RF_BYPASS2); -+ -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x0); -+ rt2800_register_write(rt2x00dev, RF_BYPASS2, 0x0); -+ -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0xC); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x3306); -+ rt2800_register_write(rt2x00dev, RF_CONTROL2, 0x3330); -+ rt2800_register_write(rt2x00dev, RF_BYPASS2, 0xfffff); -+ rfb5r1_org = rt2800_rfcsr_read_bank(rt2x00dev, 5, 1); -+ rfb7r1_org = rt2800_rfcsr_read_bank(rt2x00dev, 7, 1); -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 1, 0x4); -+ for (i = 0; i < 100; ++i) { -+ usleep_range(50, 100); -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 1); -+ if ((rfvalue & 0x04) != 0x4) -+ break; -+ } -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 1, rfb5r1_org); -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 1, 0x4); -+ for (i = 0; i < 100; ++i) { -+ usleep_range(50, 100); -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 1); -+ if ((rfvalue & 0x04) != 0x4) -+ break; -+ } -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 1, rfb7r1_org); -+ -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x0); -+ rt2800_register_write(rt2x00dev, RF_BYPASS2, 0x0); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, mac0518); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, mac051c); -+ rt2800_register_write(rt2x00dev, RF_CONTROL2, mac0528); -+ rt2800_register_write(rt2x00dev, RF_BYPASS2, mac052c); -+} -+ - static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, - bool set_bw, bool is_ht40) - { -@@ -9061,6 +9108,7 @@ static void rt2800_init_rfcsr_6352(struc - rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); - rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); - -+ rt2800_rf_self_txdc_cal(rt2x00dev); - rt2800_bw_filter_calibration(rt2x00dev, true); - rt2800_bw_filter_calibration(rt2x00dev, false); - } diff --git a/package/kernel/mac80211/patches/rt2x00/006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch deleted file mode 100644 index e15de28ea09..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch +++ /dev/null @@ -1,203 +0,0 @@ -From patchwork Sat Sep 17 20:27:41 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979247 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:27:41 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 06/16] rt2x00: add r calibration for MT7620 -Message-ID: - -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -From: Tomislav Požega - -Add r calibration code as found in mtk driver. - -Signed-off-by: Tomislav Požega -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- -v2: use rt2800_wait_bbp_rf_ready() - - drivers/net/wireless/ralink/rt2x00/rt2800.h | 2 + - .../net/wireless/ralink/rt2x00/rt2800lib.c | 133 ++++++++++++++++++ - 2 files changed, 135 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -1016,6 +1016,8 @@ - */ - #define MAC_STATUS_CFG 0x1200 - #define MAC_STATUS_CFG_BBP_RF_BUSY FIELD32(0x00000003) -+#define MAC_STATUS_CFG_BBP_RF_BUSY_TX FIELD32(0x00000001) -+#define MAC_STATUS_CFG_BBP_RF_BUSY_RX FIELD32(0x00000002) - - /* - * PWR_PIN_CFG: ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8501,6 +8501,138 @@ static void rt2800_rf_self_txdc_cal(stru - rt2800_register_write(rt2x00dev, RF_BYPASS2, mac052c); - } - -+static int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2) -+{ -+ int calcode = ((d2 - d1) * 1000) / 43; -+ -+ if ((calcode % 10) >= 5) -+ calcode += 10; -+ calcode = (calcode / 10); -+ -+ return calcode; -+} -+ -+static void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev) -+{ -+ u32 savemacsysctrl; -+ u8 saverfb0r1, saverfb0r34, saverfb0r35; -+ u8 saverfb5r4, saverfb5r17, saverfb5r18; -+ u8 saverfb5r19, saverfb5r20; -+ u8 savebbpr22, savebbpr47, savebbpr49; -+ u8 bytevalue = 0; -+ int rcalcode; -+ u8 r_cal_code = 0; -+ char d1 = 0, d2 = 0; -+ u8 rfvalue; -+ u32 MAC_RF_BYPASS0, MAC_RF_CONTROL0, MAC_PWR_PIN_CFG; -+ u32 maccfg; -+ -+ saverfb0r1 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); -+ saverfb0r34 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 34); -+ saverfb0r35 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 35); -+ saverfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); -+ saverfb5r17 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); -+ saverfb5r18 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 18); -+ saverfb5r19 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 19); -+ saverfb5r20 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 20); -+ -+ savebbpr22 = rt2800_bbp_read(rt2x00dev, 22); -+ savebbpr47 = rt2800_bbp_read(rt2x00dev, 47); -+ savebbpr49 = rt2800_bbp_read(rt2x00dev, 49); -+ -+ savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ MAC_RF_BYPASS0 = rt2800_register_read(rt2x00dev, RF_BYPASS0); -+ MAC_RF_CONTROL0 = rt2800_register_read(rt2x00dev, RF_CONTROL0); -+ MAC_PWR_PIN_CFG = rt2800_register_read(rt2x00dev, PWR_PIN_CFG); -+ -+ maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ maccfg &= (~0x04); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); -+ -+ if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_TX))) -+ rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n"); -+ -+ maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ maccfg &= (~0x04); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); -+ -+ if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) -+ rt2x00_warn(rt2x00dev, "Wait MAC Rx Status to MAX !!!\n"); -+ -+ rfvalue = (MAC_RF_BYPASS0 | 0x3004); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, rfvalue); -+ rfvalue = (MAC_RF_CONTROL0 | (~0x3002)); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, rfvalue); -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, 0x27); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, 0x80); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, 0x83); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, 0x00); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, 0x20); -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, 0x00); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 34, 0x13); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x00); -+ -+ rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x1); -+ -+ rt2800_bbp_write(rt2x00dev, 47, 0x04); -+ rt2800_bbp_write(rt2x00dev, 22, 0x80); -+ usleep_range(100, 200); -+ bytevalue = rt2800_bbp_read(rt2x00dev, 49); -+ if (bytevalue > 128) -+ d1 = bytevalue - 256; -+ else -+ d1 = (char)bytevalue; -+ rt2800_bbp_write(rt2x00dev, 22, 0x0); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x01); -+ -+ rt2800_bbp_write(rt2x00dev, 22, 0x80); -+ usleep_range(100, 200); -+ bytevalue = rt2800_bbp_read(rt2x00dev, 49); -+ if (bytevalue > 128) -+ d2 = bytevalue - 256; -+ else -+ d2 = (char)bytevalue; -+ rt2800_bbp_write(rt2x00dev, 22, 0x0); -+ -+ rcalcode = rt2800_calcrcalibrationcode(rt2x00dev, d1, d2); -+ if (rcalcode < 0) -+ r_cal_code = 256 + rcalcode; -+ else -+ r_cal_code = (u8)rcalcode; -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 7, r_cal_code); -+ -+ rt2800_bbp_write(rt2x00dev, 22, 0x0); -+ -+ bytevalue = rt2800_bbp_read(rt2x00dev, 21); -+ bytevalue |= 0x1; -+ rt2800_bbp_write(rt2x00dev, 21, bytevalue); -+ bytevalue = rt2800_bbp_read(rt2x00dev, 21); -+ bytevalue &= (~0x1); -+ rt2800_bbp_write(rt2x00dev, 21, bytevalue); -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, saverfb0r1); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 34, saverfb0r34); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, saverfb0r35); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r4); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, saverfb5r17); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, saverfb5r18); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, saverfb5r19); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, saverfb5r20); -+ -+ rt2800_bbp_write(rt2x00dev, 22, savebbpr22); -+ rt2800_bbp_write(rt2x00dev, 47, savebbpr47); -+ rt2800_bbp_write(rt2x00dev, 49, savebbpr49); -+ -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, MAC_RF_BYPASS0); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, MAC_RF_CONTROL0); -+ -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); -+ rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); -+} -+ - static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, - bool set_bw, bool is_ht40) - { -@@ -9108,6 +9240,7 @@ static void rt2800_init_rfcsr_6352(struc - rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); - rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); - -+ rt2800_r_calibration(rt2x00dev); - rt2800_rf_self_txdc_cal(rt2x00dev); - rt2800_bw_filter_calibration(rt2x00dev, true); - rt2800_bw_filter_calibration(rt2x00dev, false); diff --git a/package/kernel/mac80211/patches/rt2x00/007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch deleted file mode 100644 index a09d0abed01..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch +++ /dev/null @@ -1,117 +0,0 @@ -From patchwork Sat Sep 17 20:27:56 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979248 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:27:56 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 07/16] rt2x00: add RXDCOC calibration for MT7620 -Message-ID: - <850b30f652e88de30d79e968af4eb47aa5bc2511.1663445157.git.daniel@makrotopia.org> -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -From: Tomislav Požega - -Add RXDCOC calibration code from mtk driver. - -Signed-off-by: Tomislav Požega -[fixed typo reported by Serge Vasilugin ] -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- - .../net/wireless/ralink/rt2x00/rt2800lib.c | 60 +++++++++++++++++++ - 1 file changed, 60 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8633,6 +8633,65 @@ static void rt2800_r_calibration(struct - rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); - } - -+static void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev) -+{ -+ u8 bbpreg = 0; -+ u32 macvalue = 0; -+ u8 saverfb0r2, saverfb5r4, saverfb7r4, rfvalue; -+ int i; -+ -+ saverfb0r2 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); -+ rfvalue = saverfb0r2; -+ rfvalue |= 0x03; -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfvalue); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 141); -+ bbpreg = rt2800_bbp_read(rt2x00dev, 159); -+ bbpreg |= 0x10; -+ rt2800_bbp_write(rt2x00dev, 159, bbpreg); -+ -+ macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x8); -+ -+ if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_TX))) -+ rt2x00_warn(rt2x00dev, "RF TX busy in RX RXDCOC calibration\n"); -+ -+ saverfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); -+ saverfb7r4 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 4); -+ saverfb5r4 = saverfb5r4 & (~0x40); -+ saverfb7r4 = saverfb7r4 & (~0x40); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x64); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r4); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, saverfb7r4); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 141); -+ bbpreg = rt2800_bbp_read(rt2x00dev, 159); -+ bbpreg = bbpreg & (~0x40); -+ rt2800_bbp_write(rt2x00dev, 159, bbpreg); -+ bbpreg |= 0x48; -+ rt2800_bbp_write(rt2x00dev, 159, bbpreg); -+ -+ for (i = 0; i < 10000; i++) { -+ bbpreg = rt2800_bbp_read(rt2x00dev, 159); -+ if ((bbpreg & 0x40) == 0) -+ break; -+ usleep_range(50, 100); -+ } -+ -+ bbpreg = rt2800_bbp_read(rt2x00dev, 159); -+ bbpreg = bbpreg & (~0x40); -+ rt2800_bbp_write(rt2x00dev, 159, bbpreg); -+ -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 141); -+ bbpreg = rt2800_bbp_read(rt2x00dev, 159); -+ bbpreg &= (~0x10); -+ rt2800_bbp_write(rt2x00dev, 159, bbpreg); -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); -+} -+ - static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, - bool set_bw, bool is_ht40) - { -@@ -9242,6 +9301,7 @@ static void rt2800_init_rfcsr_6352(struc - - rt2800_r_calibration(rt2x00dev); - rt2800_rf_self_txdc_cal(rt2x00dev); -+ rt2800_rxdcoc_calibration(rt2x00dev); - rt2800_bw_filter_calibration(rt2x00dev, true); - rt2800_bw_filter_calibration(rt2x00dev, false); - } diff --git a/package/kernel/mac80211/patches/rt2x00/008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch deleted file mode 100644 index c532ba512bb..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch +++ /dev/null @@ -1,434 +0,0 @@ -From patchwork Sat Sep 17 20:28:10 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979249 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:28:10 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 08/16] rt2x00: add RXIQ calibration for MT7620 -Message-ID: - <033a39a697d51f6df258acea4c33608e0944fe4c.1663445157.git.daniel@makrotopia.org> -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -From: Tomislav Požega - -Add RXIQ calibration found in mtk driver. With old openwrt builds this -gets us ~8Mbps more of RX bandwidth (test with iPA/eLNA layout). - -Signed-off-by: Tomislav Požega -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- -v2: use rt2800_wait_bbp_rf_ready(), fix indentation - - .../net/wireless/ralink/rt2x00/rt2800lib.c | 375 ++++++++++++++++++ - 1 file changed, 375 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8692,6 +8692,380 @@ static void rt2800_rxdcoc_calibration(st - rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); - } - -+static u32 rt2800_do_sqrt_accumulation(u32 si) -+{ -+ u32 root, root_pre, bit; -+ char i; -+ -+ bit = 1 << 15; -+ root = 0; -+ for (i = 15; i >= 0; i = i - 1) { -+ root_pre = root + bit; -+ if ((root_pre * root_pre) <= si) -+ root = root_pre; -+ bit = bit >> 1; -+ } -+ -+ return root; -+} -+ -+static void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev) -+{ -+ u8 rfb0r1, rfb0r2, rfb0r42; -+ u8 rfb4r0, rfb4r19; -+ u8 rfb5r3, rfb5r4, rfb5r17, rfb5r18, rfb5r19, rfb5r20; -+ u8 rfb6r0, rfb6r19; -+ u8 rfb7r3, rfb7r4, rfb7r17, rfb7r18, rfb7r19, rfb7r20; -+ -+ u8 bbp1, bbp4; -+ u8 bbpr241, bbpr242; -+ u32 i; -+ u8 ch_idx; -+ u8 bbpval; -+ u8 rfval, vga_idx = 0; -+ int mi = 0, mq = 0, si = 0, sq = 0, riq = 0; -+ int sigma_i, sigma_q, r_iq, g_rx; -+ int g_imb; -+ int ph_rx; -+ u32 savemacsysctrl = 0; -+ u32 orig_RF_CONTROL0 = 0; -+ u32 orig_RF_BYPASS0 = 0; -+ u32 orig_RF_CONTROL1 = 0; -+ u32 orig_RF_BYPASS1 = 0; -+ u32 orig_RF_CONTROL3 = 0; -+ u32 orig_RF_BYPASS3 = 0; -+ u32 bbpval1 = 0; -+ static const u8 rf_vga_table[] = {0x20, 0x21, 0x22, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f}; -+ -+ savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ orig_RF_CONTROL0 = rt2800_register_read(rt2x00dev, RF_CONTROL0); -+ orig_RF_BYPASS0 = rt2800_register_read(rt2x00dev, RF_BYPASS0); -+ orig_RF_CONTROL1 = rt2800_register_read(rt2x00dev, RF_CONTROL1); -+ orig_RF_BYPASS1 = rt2800_register_read(rt2x00dev, RF_BYPASS1); -+ orig_RF_CONTROL3 = rt2800_register_read(rt2x00dev, RF_CONTROL3); -+ orig_RF_BYPASS3 = rt2800_register_read(rt2x00dev, RF_BYPASS3); -+ -+ bbp1 = rt2800_bbp_read(rt2x00dev, 1); -+ bbp4 = rt2800_bbp_read(rt2x00dev, 4); -+ -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x0); -+ -+ if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) -+ rt2x00_warn(rt2x00dev, "Timeout waiting for MAC status in RXIQ calibration\n"); -+ -+ bbpval = bbp4 & (~0x18); -+ bbpval = bbp4 | 0x00; -+ rt2800_bbp_write(rt2x00dev, 4, bbpval); -+ -+ bbpval = rt2800_bbp_read(rt2x00dev, 21); -+ bbpval = bbpval | 1; -+ rt2800_bbp_write(rt2x00dev, 21, bbpval); -+ bbpval = bbpval & 0xfe; -+ rt2800_bbp_write(rt2x00dev, 21, bbpval); -+ -+ rt2800_register_write(rt2x00dev, RF_CONTROL1, 0x00000202); -+ rt2800_register_write(rt2x00dev, RF_BYPASS1, 0x00000303); -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0101); -+ else -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0000); -+ -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, 0xf1f1); -+ -+ rfb0r1 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); -+ rfb0r2 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); -+ rfb0r42 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); -+ rfb4r0 = rt2800_rfcsr_read_bank(rt2x00dev, 4, 0); -+ rfb4r19 = rt2800_rfcsr_read_bank(rt2x00dev, 4, 19); -+ rfb5r3 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 3); -+ rfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); -+ rfb5r17 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); -+ rfb5r18 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 18); -+ rfb5r19 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 19); -+ rfb5r20 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 20); -+ -+ rfb6r0 = rt2800_rfcsr_read_bank(rt2x00dev, 6, 0); -+ rfb6r19 = rt2800_rfcsr_read_bank(rt2x00dev, 6, 19); -+ rfb7r3 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 3); -+ rfb7r4 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 4); -+ rfb7r17 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 17); -+ rfb7r18 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 18); -+ rfb7r19 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 19); -+ rfb7r20 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 20); -+ -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x87); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0x27); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 3, 0x38); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x38); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x80); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 18, 0xC1); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 19, 0x60); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 20, 0x00); -+ -+ rt2800_bbp_write(rt2x00dev, 23, 0x0); -+ rt2800_bbp_write(rt2x00dev, 24, 0x0); -+ -+ rt2800_bbp_dcoc_write(rt2x00dev, 5, 0x0); -+ -+ bbpr241 = rt2800_bbp_read(rt2x00dev, 241); -+ bbpr242 = rt2800_bbp_read(rt2x00dev, 242); -+ -+ rt2800_bbp_write(rt2x00dev, 241, 0x10); -+ rt2800_bbp_write(rt2x00dev, 242, 0x84); -+ rt2800_bbp_write(rt2x00dev, 244, 0x31); -+ -+ bbpval = rt2800_bbp_dcoc_read(rt2x00dev, 3); -+ bbpval = bbpval & (~0x7); -+ rt2800_bbp_dcoc_write(rt2x00dev, 3, bbpval); -+ -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); -+ udelay(1); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000006); -+ usleep_range(1, 200); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00003376); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001006); -+ udelay(1); -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { -+ rt2800_bbp_write(rt2x00dev, 23, 0x06); -+ rt2800_bbp_write(rt2x00dev, 24, 0x06); -+ } else { -+ rt2800_bbp_write(rt2x00dev, 23, 0x02); -+ rt2800_bbp_write(rt2x00dev, 24, 0x02); -+ } -+ -+ for (ch_idx = 0; ch_idx < 2; ch_idx = ch_idx + 1) { -+ if (ch_idx == 0) { -+ rfval = rfb0r1 & (~0x3); -+ rfval = rfb0r1 | 0x1; -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfval); -+ rfval = rfb0r2 & (~0x33); -+ rfval = rfb0r2 | 0x11; -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfval); -+ rfval = rfb0r42 & (~0x50); -+ rfval = rfb0r42 | 0x10; -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfval); -+ -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001006); -+ udelay(1); -+ -+ bbpval = bbp1 & (~0x18); -+ bbpval = bbpval | 0x00; -+ rt2800_bbp_write(rt2x00dev, 1, bbpval); -+ -+ rt2800_bbp_dcoc_write(rt2x00dev, 1, 0x00); -+ } else { -+ rfval = rfb0r1 & (~0x3); -+ rfval = rfb0r1 | 0x2; -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfval); -+ rfval = rfb0r2 & (~0x33); -+ rfval = rfb0r2 | 0x22; -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfval); -+ rfval = rfb0r42 & (~0x50); -+ rfval = rfb0r42 | 0x40; -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfval); -+ -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002006); -+ udelay(1); -+ -+ bbpval = bbp1 & (~0x18); -+ bbpval = bbpval | 0x08; -+ rt2800_bbp_write(rt2x00dev, 1, bbpval); -+ -+ rt2800_bbp_dcoc_write(rt2x00dev, 1, 0x01); -+ } -+ usleep_range(500, 1500); -+ -+ vga_idx = 0; -+ while (vga_idx < 11) { -+ rt2800_rfcsr_write_dccal(rt2x00dev, 3, rf_vga_table[vga_idx]); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 4, rf_vga_table[vga_idx]); -+ -+ rt2800_bbp_dcoc_write(rt2x00dev, 0, 0x93); -+ -+ for (i = 0; i < 10000; i++) { -+ bbpval = rt2800_bbp_read(rt2x00dev, 159); -+ if ((bbpval & 0xff) == 0x93) -+ usleep_range(50, 100); -+ else -+ break; -+ } -+ -+ if ((bbpval & 0xff) == 0x93) { -+ rt2x00_warn(rt2x00dev, "Fatal Error: Calibration doesn't finish"); -+ goto restore_value; -+ } -+ for (i = 0; i < 5; i++) { -+ u32 bbptemp = 0; -+ u8 value = 0; -+ int result = 0; -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x1e); -+ rt2800_bbp_write(rt2x00dev, 159, i); -+ rt2800_bbp_write(rt2x00dev, 158, 0x22); -+ value = rt2800_bbp_read(rt2x00dev, 159); -+ bbptemp = bbptemp + (value << 24); -+ rt2800_bbp_write(rt2x00dev, 158, 0x21); -+ value = rt2800_bbp_read(rt2x00dev, 159); -+ bbptemp = bbptemp + (value << 16); -+ rt2800_bbp_write(rt2x00dev, 158, 0x20); -+ value = rt2800_bbp_read(rt2x00dev, 159); -+ bbptemp = bbptemp + (value << 8); -+ rt2800_bbp_write(rt2x00dev, 158, 0x1f); -+ value = rt2800_bbp_read(rt2x00dev, 159); -+ bbptemp = bbptemp + value; -+ -+ if (i < 2 && (bbptemp & 0x800000)) -+ result = (bbptemp & 0xffffff) - 0x1000000; -+ else if (i == 4) -+ result = bbptemp; -+ else -+ result = bbptemp; -+ -+ if (i == 0) -+ mi = result / 4096; -+ else if (i == 1) -+ mq = result / 4096; -+ else if (i == 2) -+ si = bbptemp / 4096; -+ else if (i == 3) -+ sq = bbptemp / 4096; -+ else -+ riq = result / 4096; -+ } -+ -+ bbpval1 = si - mi * mi; -+ rt2x00_dbg(rt2x00dev, -+ "RXIQ si=%d, sq=%d, riq=%d, bbpval %d, vga_idx %d", -+ si, sq, riq, bbpval1, vga_idx); -+ -+ if (bbpval1 >= (100 * 100)) -+ break; -+ -+ if (bbpval1 <= 100) -+ vga_idx = vga_idx + 9; -+ else if (bbpval1 <= 158) -+ vga_idx = vga_idx + 8; -+ else if (bbpval1 <= 251) -+ vga_idx = vga_idx + 7; -+ else if (bbpval1 <= 398) -+ vga_idx = vga_idx + 6; -+ else if (bbpval1 <= 630) -+ vga_idx = vga_idx + 5; -+ else if (bbpval1 <= 1000) -+ vga_idx = vga_idx + 4; -+ else if (bbpval1 <= 1584) -+ vga_idx = vga_idx + 3; -+ else if (bbpval1 <= 2511) -+ vga_idx = vga_idx + 2; -+ else -+ vga_idx = vga_idx + 1; -+ } -+ -+ sigma_i = rt2800_do_sqrt_accumulation(100 * (si - mi * mi)); -+ sigma_q = rt2800_do_sqrt_accumulation(100 * (sq - mq * mq)); -+ r_iq = 10 * (riq - (mi * mq)); -+ -+ rt2x00_dbg(rt2x00dev, "Sigma_i=%d, Sigma_q=%d, R_iq=%d", sigma_i, sigma_q, r_iq); -+ -+ if (sigma_i <= 1400 && sigma_i >= 1000 && -+ (sigma_i - sigma_q) <= 112 && -+ (sigma_i - sigma_q) >= -112 && -+ mi <= 32 && mi >= -32 && -+ mq <= 32 && mq >= -32) { -+ r_iq = 10 * (riq - (mi * mq)); -+ rt2x00_dbg(rt2x00dev, "RXIQ Sigma_i=%d, Sigma_q=%d, R_iq=%d\n", -+ sigma_i, sigma_q, r_iq); -+ -+ g_rx = (1000 * sigma_q) / sigma_i; -+ g_imb = ((-2) * 128 * (1000 - g_rx)) / (1000 + g_rx); -+ ph_rx = (r_iq * 2292) / (sigma_i * sigma_q); -+ -+ if (ph_rx > 20 || ph_rx < -20) { -+ ph_rx = 0; -+ rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL"); -+ } -+ -+ if (g_imb > 12 || g_imb < -12) { -+ g_imb = 0; -+ rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL"); -+ } -+ } else { -+ g_imb = 0; -+ ph_rx = 0; -+ rt2x00_dbg(rt2x00dev, "RXIQ Sigma_i=%d, Sigma_q=%d, R_iq=%d\n", -+ sigma_i, sigma_q, r_iq); -+ rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL"); -+ } -+ -+ if (ch_idx == 0) { -+ rt2800_bbp_write(rt2x00dev, 158, 0x37); -+ rt2800_bbp_write(rt2x00dev, 159, g_imb & 0x3f); -+ rt2800_bbp_write(rt2x00dev, 158, 0x35); -+ rt2800_bbp_write(rt2x00dev, 159, ph_rx & 0x3f); -+ } else { -+ rt2800_bbp_write(rt2x00dev, 158, 0x55); -+ rt2800_bbp_write(rt2x00dev, 159, g_imb & 0x3f); -+ rt2800_bbp_write(rt2x00dev, 158, 0x53); -+ rt2800_bbp_write(rt2x00dev, 159, ph_rx & 0x3f); -+ } -+ } -+ -+restore_value: -+ rt2800_bbp_write(rt2x00dev, 158, 0x3); -+ bbpval = rt2800_bbp_read(rt2x00dev, 159); -+ rt2800_bbp_write(rt2x00dev, 159, (bbpval | 0x07)); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x00); -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ rt2800_bbp_write(rt2x00dev, 1, bbp1); -+ rt2800_bbp_write(rt2x00dev, 4, bbp4); -+ rt2800_bbp_write(rt2x00dev, 241, bbpr241); -+ rt2800_bbp_write(rt2x00dev, 242, bbpr242); -+ -+ rt2800_bbp_write(rt2x00dev, 244, 0x00); -+ bbpval = rt2800_bbp_read(rt2x00dev, 21); -+ bbpval |= 0x1; -+ rt2800_bbp_write(rt2x00dev, 21, bbpval); -+ usleep_range(10, 200); -+ bbpval &= 0xfe; -+ rt2800_bbp_write(rt2x00dev, 21, bbpval); -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfb0r1); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfb0r2); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfb0r42); -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 0, rfb4r0); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 19, rfb4r19); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, rfb5r3); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, rfb5r4); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, rfb5r17); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, rfb5r18); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, rfb5r19); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, rfb5r20); -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 0, rfb6r0); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 19, rfb6r19); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 3, rfb7r3); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, rfb7r4); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 17, rfb7r17); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 18, rfb7r18); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 19, rfb7r19); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 20, rfb7r20); -+ -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000006); -+ udelay(1); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); -+ udelay(1); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, orig_RF_CONTROL0); -+ udelay(1); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, orig_RF_BYPASS0); -+ rt2800_register_write(rt2x00dev, RF_CONTROL1, orig_RF_CONTROL1); -+ rt2800_register_write(rt2x00dev, RF_BYPASS1, orig_RF_BYPASS1); -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, orig_RF_CONTROL3); -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, orig_RF_BYPASS3); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); -+} -+ - static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, - bool set_bw, bool is_ht40) - { -@@ -9304,6 +9678,7 @@ static void rt2800_init_rfcsr_6352(struc - rt2800_rxdcoc_calibration(rt2x00dev); - rt2800_bw_filter_calibration(rt2x00dev, true); - rt2800_bw_filter_calibration(rt2x00dev, false); -+ rt2800_rxiq_calibration(rt2x00dev); - } - - static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) diff --git a/package/kernel/mac80211/patches/rt2x00/010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch deleted file mode 100644 index 092d91afb62..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch +++ /dev/null @@ -1,982 +0,0 @@ -From patchwork Sat Sep 17 20:28:43 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979251 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:28:43 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 10/16] rt2x00: add TX LOFT calibration for MT7620 -Message-ID: - -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -From: Tomislav Požega - -Add TX LOFT calibration from mtk driver. - -Signed-off-by: Tomislav Požega -Signed-off-by: Daniel Golle ---- -v2: use helper functions, make tables static const, remove useless - debug prints -v3: don't export function not used anywhere else -Reported-by: kernel test robot - - .../net/wireless/ralink/rt2x00/rt2800lib.c | 902 ++++++++++++++++++ - .../net/wireless/ralink/rt2x00/rt2800lib.h | 10 + - 2 files changed, 912 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9066,6 +9066,907 @@ restore_value: - rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); - } - -+static void rt2800_rf_configstore(struct rt2x00_dev *rt2x00dev, -+ struct rf_reg_pair rf_reg_record[][13], u8 chain) -+{ -+ u8 rfvalue = 0; -+ -+ if (chain == CHAIN_0) { -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); -+ rf_reg_record[CHAIN_0][0].bank = 0; -+ rf_reg_record[CHAIN_0][0].reg = 1; -+ rf_reg_record[CHAIN_0][0].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); -+ rf_reg_record[CHAIN_0][1].bank = 0; -+ rf_reg_record[CHAIN_0][1].reg = 2; -+ rf_reg_record[CHAIN_0][1].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 35); -+ rf_reg_record[CHAIN_0][2].bank = 0; -+ rf_reg_record[CHAIN_0][2].reg = 35; -+ rf_reg_record[CHAIN_0][2].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); -+ rf_reg_record[CHAIN_0][3].bank = 0; -+ rf_reg_record[CHAIN_0][3].reg = 42; -+ rf_reg_record[CHAIN_0][3].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 4, 0); -+ rf_reg_record[CHAIN_0][4].bank = 4; -+ rf_reg_record[CHAIN_0][4].reg = 0; -+ rf_reg_record[CHAIN_0][4].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 4, 2); -+ rf_reg_record[CHAIN_0][5].bank = 4; -+ rf_reg_record[CHAIN_0][5].reg = 2; -+ rf_reg_record[CHAIN_0][5].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 4, 34); -+ rf_reg_record[CHAIN_0][6].bank = 4; -+ rf_reg_record[CHAIN_0][6].reg = 34; -+ rf_reg_record[CHAIN_0][6].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 3); -+ rf_reg_record[CHAIN_0][7].bank = 5; -+ rf_reg_record[CHAIN_0][7].reg = 3; -+ rf_reg_record[CHAIN_0][7].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); -+ rf_reg_record[CHAIN_0][8].bank = 5; -+ rf_reg_record[CHAIN_0][8].reg = 4; -+ rf_reg_record[CHAIN_0][8].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); -+ rf_reg_record[CHAIN_0][9].bank = 5; -+ rf_reg_record[CHAIN_0][9].reg = 17; -+ rf_reg_record[CHAIN_0][9].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 18); -+ rf_reg_record[CHAIN_0][10].bank = 5; -+ rf_reg_record[CHAIN_0][10].reg = 18; -+ rf_reg_record[CHAIN_0][10].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 19); -+ rf_reg_record[CHAIN_0][11].bank = 5; -+ rf_reg_record[CHAIN_0][11].reg = 19; -+ rf_reg_record[CHAIN_0][11].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 20); -+ rf_reg_record[CHAIN_0][12].bank = 5; -+ rf_reg_record[CHAIN_0][12].reg = 20; -+ rf_reg_record[CHAIN_0][12].value = rfvalue; -+ } else if (chain == CHAIN_1) { -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); -+ rf_reg_record[CHAIN_1][0].bank = 0; -+ rf_reg_record[CHAIN_1][0].reg = 1; -+ rf_reg_record[CHAIN_1][0].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); -+ rf_reg_record[CHAIN_1][1].bank = 0; -+ rf_reg_record[CHAIN_1][1].reg = 2; -+ rf_reg_record[CHAIN_1][1].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 35); -+ rf_reg_record[CHAIN_1][2].bank = 0; -+ rf_reg_record[CHAIN_1][2].reg = 35; -+ rf_reg_record[CHAIN_1][2].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); -+ rf_reg_record[CHAIN_1][3].bank = 0; -+ rf_reg_record[CHAIN_1][3].reg = 42; -+ rf_reg_record[CHAIN_1][3].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 6, 0); -+ rf_reg_record[CHAIN_1][4].bank = 6; -+ rf_reg_record[CHAIN_1][4].reg = 0; -+ rf_reg_record[CHAIN_1][4].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 6, 2); -+ rf_reg_record[CHAIN_1][5].bank = 6; -+ rf_reg_record[CHAIN_1][5].reg = 2; -+ rf_reg_record[CHAIN_1][5].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 6, 34); -+ rf_reg_record[CHAIN_1][6].bank = 6; -+ rf_reg_record[CHAIN_1][6].reg = 34; -+ rf_reg_record[CHAIN_1][6].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 3); -+ rf_reg_record[CHAIN_1][7].bank = 7; -+ rf_reg_record[CHAIN_1][7].reg = 3; -+ rf_reg_record[CHAIN_1][7].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 4); -+ rf_reg_record[CHAIN_1][8].bank = 7; -+ rf_reg_record[CHAIN_1][8].reg = 4; -+ rf_reg_record[CHAIN_1][8].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 17); -+ rf_reg_record[CHAIN_1][9].bank = 7; -+ rf_reg_record[CHAIN_1][9].reg = 17; -+ rf_reg_record[CHAIN_1][9].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 18); -+ rf_reg_record[CHAIN_1][10].bank = 7; -+ rf_reg_record[CHAIN_1][10].reg = 18; -+ rf_reg_record[CHAIN_1][10].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 19); -+ rf_reg_record[CHAIN_1][11].bank = 7; -+ rf_reg_record[CHAIN_1][11].reg = 19; -+ rf_reg_record[CHAIN_1][11].value = rfvalue; -+ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 20); -+ rf_reg_record[CHAIN_1][12].bank = 7; -+ rf_reg_record[CHAIN_1][12].reg = 20; -+ rf_reg_record[CHAIN_1][12].value = rfvalue; -+ } else { -+ rt2x00_warn(rt2x00dev, "Unknown chain = %u\n", chain); -+ } -+} -+ -+static void rt2800_rf_configrecover(struct rt2x00_dev *rt2x00dev, -+ struct rf_reg_pair rf_record[][13]) -+{ -+ u8 chain_index = 0, record_index = 0; -+ u8 bank = 0, rf_register = 0, value = 0; -+ -+ for (chain_index = 0; chain_index < 2; chain_index++) { -+ for (record_index = 0; record_index < 13; record_index++) { -+ bank = rf_record[chain_index][record_index].bank; -+ rf_register = rf_record[chain_index][record_index].reg; -+ value = rf_record[chain_index][record_index].value; -+ rt2800_rfcsr_write_bank(rt2x00dev, bank, rf_register, value); -+ rt2x00_dbg(rt2x00dev, "bank: %d, rf_register: %d, value: %x\n", -+ bank, rf_register, value); -+ } -+ } -+} -+ -+static void rt2800_setbbptonegenerator(struct rt2x00_dev *rt2x00dev) -+{ -+ rt2800_bbp_write(rt2x00dev, 158, 0xAA); -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xAB); -+ rt2800_bbp_write(rt2x00dev, 159, 0x0A); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xAC); -+ rt2800_bbp_write(rt2x00dev, 159, 0x3F); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xAD); -+ rt2800_bbp_write(rt2x00dev, 159, 0x3F); -+ -+ rt2800_bbp_write(rt2x00dev, 244, 0x40); -+} -+ -+static u32 rt2800_do_fft_accumulation(struct rt2x00_dev *rt2x00dev, u8 tidx, u8 read_neg) -+{ -+ u32 macvalue = 0; -+ int fftout_i = 0, fftout_q = 0; -+ u32 ptmp = 0, pint = 0; -+ u8 bbp = 0; -+ u8 tidxi; -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x00); -+ rt2800_bbp_write(rt2x00dev, 159, 0x9b); -+ -+ bbp = 0x9b; -+ -+ while (bbp == 0x9b) { -+ usleep_range(10, 50); -+ bbp = rt2800_bbp_read(rt2x00dev, 159); -+ bbp = bbp & 0xff; -+ } -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xba); -+ rt2800_bbp_write(rt2x00dev, 159, tidx); -+ rt2800_bbp_write(rt2x00dev, 159, tidx); -+ rt2800_bbp_write(rt2x00dev, 159, tidx); -+ -+ macvalue = rt2800_register_read(rt2x00dev, 0x057C); -+ -+ fftout_i = (macvalue >> 16); -+ fftout_i = (fftout_i & 0x8000) ? (fftout_i - 0x10000) : fftout_i; -+ fftout_q = (macvalue & 0xffff); -+ fftout_q = (fftout_q & 0x8000) ? (fftout_q - 0x10000) : fftout_q; -+ ptmp = (fftout_i * fftout_i); -+ ptmp = ptmp + (fftout_q * fftout_q); -+ pint = ptmp; -+ rt2x00_dbg(rt2x00dev, "I = %d, Q = %d, power = %x\n", fftout_i, fftout_q, pint); -+ if (read_neg) { -+ pint = pint >> 1; -+ tidxi = 0x40 - tidx; -+ tidxi = tidxi & 0x3f; -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xba); -+ rt2800_bbp_write(rt2x00dev, 159, tidxi); -+ rt2800_bbp_write(rt2x00dev, 159, tidxi); -+ rt2800_bbp_write(rt2x00dev, 159, tidxi); -+ -+ macvalue = rt2800_register_read(rt2x00dev, 0x057C); -+ -+ fftout_i = (macvalue >> 16); -+ fftout_i = (fftout_i & 0x8000) ? (fftout_i - 0x10000) : fftout_i; -+ fftout_q = (macvalue & 0xffff); -+ fftout_q = (fftout_q & 0x8000) ? (fftout_q - 0x10000) : fftout_q; -+ ptmp = (fftout_i * fftout_i); -+ ptmp = ptmp + (fftout_q * fftout_q); -+ ptmp = ptmp >> 1; -+ pint = pint + ptmp; -+ } -+ -+ return pint; -+} -+ -+static u32 rt2800_read_fft_accumulation(struct rt2x00_dev *rt2x00dev, u8 tidx) -+{ -+ u32 macvalue = 0; -+ int fftout_i = 0, fftout_q = 0; -+ u32 ptmp = 0, pint = 0; -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xBA); -+ rt2800_bbp_write(rt2x00dev, 159, tidx); -+ rt2800_bbp_write(rt2x00dev, 159, tidx); -+ rt2800_bbp_write(rt2x00dev, 159, tidx); -+ -+ macvalue = rt2800_register_read(rt2x00dev, 0x057C); -+ -+ fftout_i = (macvalue >> 16); -+ fftout_i = (fftout_i & 0x8000) ? (fftout_i - 0x10000) : fftout_i; -+ fftout_q = (macvalue & 0xffff); -+ fftout_q = (fftout_q & 0x8000) ? (fftout_q - 0x10000) : fftout_q; -+ ptmp = (fftout_i * fftout_i); -+ ptmp = ptmp + (fftout_q * fftout_q); -+ pint = ptmp; -+ -+ return pint; -+} -+ -+static void rt2800_write_dc(struct rt2x00_dev *rt2x00dev, u8 ch_idx, u8 alc, u8 iorq, u8 dc) -+{ -+ u8 bbp = 0; -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xb0); -+ bbp = alc | 0x80; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+ -+ if (ch_idx == 0) -+ bbp = (iorq == 0) ? 0xb1 : 0xb2; -+ else -+ bbp = (iorq == 0) ? 0xb8 : 0xb9; -+ -+ rt2800_bbp_write(rt2x00dev, 158, bbp); -+ bbp = dc; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+} -+ -+static void rt2800_loft_search(struct rt2x00_dev *rt2x00dev, u8 ch_idx, -+ u8 alc_idx, u8 dc_result[][RF_ALC_NUM][2]) -+{ -+ u32 p0 = 0, p1 = 0, pf = 0; -+ char idx0 = 0, idx1 = 0; -+ u8 idxf[] = {0x00, 0x00}; -+ u8 ibit = 0x20; -+ u8 iorq; -+ char bidx; -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xb0); -+ rt2800_bbp_write(rt2x00dev, 159, 0x80); -+ -+ for (bidx = 5; bidx >= 0; bidx--) { -+ for (iorq = 0; iorq <= 1; iorq++) { -+ if (idxf[iorq] == 0x20) { -+ idx0 = 0x20; -+ p0 = pf; -+ } else { -+ idx0 = idxf[iorq] - ibit; -+ idx0 = idx0 & 0x3F; -+ rt2800_write_dc(rt2x00dev, ch_idx, 0, iorq, idx0); -+ p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); -+ } -+ -+ idx1 = idxf[iorq] + (bidx == 5 ? 0 : ibit); -+ idx1 = idx1 & 0x3F; -+ rt2800_write_dc(rt2x00dev, ch_idx, 0, iorq, idx1); -+ p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); -+ -+ rt2x00_dbg(rt2x00dev, "alc=%u, IorQ=%u, idx_final=%2x\n", -+ alc_idx, iorq, idxf[iorq]); -+ rt2x00_dbg(rt2x00dev, "p0=%x, p1=%x, pf=%x, idx_0=%x, idx_1=%x, ibit=%x\n", -+ p0, p1, pf, idx0, idx1, ibit); -+ -+ if (bidx != 5 && pf <= p0 && pf < p1) { -+ idxf[iorq] = idxf[iorq]; -+ } else if (p0 < p1) { -+ pf = p0; -+ idxf[iorq] = idx0 & 0x3F; -+ } else { -+ pf = p1; -+ idxf[iorq] = idx1 & 0x3F; -+ } -+ rt2x00_dbg(rt2x00dev, "IorQ=%u, idx_final[%u]:%x, pf:%8x\n", -+ iorq, iorq, idxf[iorq], pf); -+ -+ rt2800_write_dc(rt2x00dev, ch_idx, 0, iorq, idxf[iorq]); -+ } -+ ibit = ibit >> 1; -+ } -+ dc_result[ch_idx][alc_idx][0] = idxf[0]; -+ dc_result[ch_idx][alc_idx][1] = idxf[1]; -+} -+ -+static void rt2800_iq_search(struct rt2x00_dev *rt2x00dev, u8 ch_idx, u8 *ges, u8 *pes) -+{ -+ u32 p0 = 0, p1 = 0, pf = 0; -+ char perr = 0, gerr = 0, iq_err = 0; -+ char pef = 0, gef = 0; -+ char psta, pend; -+ char gsta, gend; -+ -+ u8 ibit = 0x20; -+ u8 first_search = 0x00, touch_neg_max = 0x00; -+ char idx0 = 0, idx1 = 0; -+ u8 gop; -+ u8 bbp = 0; -+ char bidx; -+ -+ for (bidx = 5; bidx >= 1; bidx--) { -+ for (gop = 0; gop < 2; gop++) { -+ if (gop == 1 || bidx < 4) { -+ if (gop == 0) -+ iq_err = gerr; -+ else -+ iq_err = perr; -+ -+ first_search = (gop == 0) ? (bidx == 3) : (bidx == 5); -+ touch_neg_max = (gop) ? ((iq_err & 0x0F) == 0x08) : -+ ((iq_err & 0x3F) == 0x20); -+ -+ if (touch_neg_max) { -+ p0 = pf; -+ idx0 = iq_err; -+ } else { -+ idx0 = iq_err - ibit; -+ bbp = (ch_idx == 0) ? ((gop == 0) ? 0x28 : 0x29) : -+ ((gop == 0) ? 0x46 : 0x47); -+ -+ rt2800_bbp_write(rt2x00dev, 158, bbp); -+ rt2800_bbp_write(rt2x00dev, 159, idx0); -+ -+ p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 1); -+ } -+ -+ idx1 = iq_err + (first_search ? 0 : ibit); -+ idx1 = (gop == 0) ? (idx1 & 0x0F) : (idx1 & 0x3F); -+ -+ bbp = (ch_idx == 0) ? (gop == 0) ? 0x28 : 0x29 : -+ (gop == 0) ? 0x46 : 0x47; -+ -+ rt2800_bbp_write(rt2x00dev, 158, bbp); -+ rt2800_bbp_write(rt2x00dev, 159, idx1); -+ -+ p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 1); -+ -+ rt2x00_dbg(rt2x00dev, -+ "p0=%x, p1=%x, pwer_final=%x, idx0=%x, idx1=%x, iq_err=%x, gop=%d, ibit=%x\n", -+ p0, p1, pf, idx0, idx1, iq_err, gop, ibit); -+ -+ if (!(!first_search && pf <= p0 && pf < p1)) { -+ if (p0 < p1) { -+ pf = p0; -+ iq_err = idx0; -+ } else { -+ pf = p1; -+ iq_err = idx1; -+ } -+ } -+ -+ bbp = (ch_idx == 0) ? (gop == 0) ? 0x28 : 0x29 : -+ (gop == 0) ? 0x46 : 0x47; -+ -+ rt2800_bbp_write(rt2x00dev, 158, bbp); -+ rt2800_bbp_write(rt2x00dev, 159, iq_err); -+ -+ if (gop == 0) -+ gerr = iq_err; -+ else -+ perr = iq_err; -+ -+ rt2x00_dbg(rt2x00dev, "IQCalibration pf=%8x (%2x, %2x) !\n", -+ pf, gerr & 0x0F, perr & 0x3F); -+ } -+ } -+ -+ if (bidx > 0) -+ ibit = (ibit >> 1); -+ } -+ gerr = (gerr & 0x08) ? (gerr & 0x0F) - 0x10 : (gerr & 0x0F); -+ perr = (perr & 0x20) ? (perr & 0x3F) - 0x40 : (perr & 0x3F); -+ -+ gerr = (gerr < -0x07) ? -0x07 : (gerr > 0x05) ? 0x05 : gerr; -+ gsta = gerr - 1; -+ gend = gerr + 2; -+ -+ perr = (perr < -0x1f) ? -0x1f : (perr > 0x1d) ? 0x1d : perr; -+ psta = perr - 1; -+ pend = perr + 2; -+ -+ for (gef = gsta; gef <= gend; gef = gef + 1) -+ for (pef = psta; pef <= pend; pef = pef + 1) { -+ bbp = (ch_idx == 0) ? 0x28 : 0x46; -+ rt2800_bbp_write(rt2x00dev, 158, bbp); -+ rt2800_bbp_write(rt2x00dev, 159, gef & 0x0F); -+ -+ bbp = (ch_idx == 0) ? 0x29 : 0x47; -+ rt2800_bbp_write(rt2x00dev, 158, bbp); -+ rt2800_bbp_write(rt2x00dev, 159, pef & 0x3F); -+ -+ p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 1); -+ if (gef == gsta && pef == psta) { -+ pf = p1; -+ gerr = gef; -+ perr = pef; -+ } else if (pf > p1) { -+ pf = p1; -+ gerr = gef; -+ perr = pef; -+ } -+ rt2x00_dbg(rt2x00dev, "Fine IQCalibration p1=%8x pf=%8x (%2x, %2x) !\n", -+ p1, pf, gef & 0x0F, pef & 0x3F); -+ } -+ -+ ges[ch_idx] = gerr & 0x0F; -+ pes[ch_idx] = perr & 0x3F; -+} -+ -+static void rt2800_rf_aux_tx0_loopback(struct rt2x00_dev *rt2x00dev) -+{ -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, 0x21); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, 0x10); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x00); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, 0x1b); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 0, 0x81); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 2, 0x81); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 34, 0xee); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, 0x2d); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, 0x2d); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, 0x80); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, 0xd7); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, 0xa2); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, 0x20); -+} -+ -+static void rt2800_rf_aux_tx1_loopback(struct rt2x00_dev *rt2x00dev) -+{ -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, 0x22); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, 0x20); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x00); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, 0x4b); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 0, 0x81); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 2, 0x81); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 34, 0xee); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 3, 0x2d); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, 0x2d); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 17, 0x80); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 18, 0xd7); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 19, 0xa2); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 20, 0x20); -+} -+ -+static void rt2800_loft_iq_calibration(struct rt2x00_dev *rt2x00dev) -+{ -+ struct rf_reg_pair rf_store[CHAIN_NUM][13]; -+ u32 macorg1 = 0; -+ u32 macorg2 = 0; -+ u32 macorg3 = 0; -+ u32 macorg4 = 0; -+ u32 macorg5 = 0; -+ u32 orig528 = 0; -+ u32 orig52c = 0; -+ -+ u32 savemacsysctrl = 0; -+ u32 macvalue = 0; -+ u32 mac13b8 = 0; -+ u32 p0 = 0, p1 = 0; -+ u32 p0_idx10 = 0, p1_idx10 = 0; -+ -+ u8 rfvalue; -+ u8 loft_dc_search_result[CHAIN_NUM][RF_ALC_NUM][2]; -+ u8 ger[CHAIN_NUM], per[CHAIN_NUM]; -+ -+ u8 vga_gain[] = {14, 14}; -+ u8 bbp = 0, ch_idx = 0, rf_alc_idx = 0, idx = 0; -+ u8 bbpr30, rfb0r39, rfb0r42; -+ u8 bbpr1; -+ u8 bbpr4; -+ u8 bbpr241, bbpr242; -+ u8 count_step; -+ -+ static const u8 rf_gain[] = {0x00, 0x01, 0x02, 0x04, 0x08, 0x0c}; -+ static const u8 rfvga_gain_table[] = {0x24, 0x25, 0x26, 0x27, 0x28, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, -+ 0x31, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3F}; -+ static const u8 bbp_2324gain[] = {0x16, 0x14, 0x12, 0x10, 0x0c, 0x08}; -+ -+ savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ macorg1 = rt2800_register_read(rt2x00dev, TX_PIN_CFG); -+ macorg2 = rt2800_register_read(rt2x00dev, RF_CONTROL0); -+ macorg3 = rt2800_register_read(rt2x00dev, RF_BYPASS0); -+ macorg4 = rt2800_register_read(rt2x00dev, RF_CONTROL3); -+ macorg5 = rt2800_register_read(rt2x00dev, RF_BYPASS3); -+ mac13b8 = rt2800_register_read(rt2x00dev, 0x13b8); -+ orig528 = rt2800_register_read(rt2x00dev, RF_CONTROL2); -+ orig52c = rt2800_register_read(rt2x00dev, RF_BYPASS2); -+ -+ macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ macvalue &= (~0x04); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); -+ -+ if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_TX))) -+ rt2x00_warn(rt2x00dev, "RF TX busy in LOFT IQ calibration\n"); -+ -+ macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ macvalue &= (~0x08); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); -+ -+ if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) -+ rt2x00_warn(rt2x00dev, "RF RX busy in LOFT IQ calibration\n"); -+ -+ for (ch_idx = 0; ch_idx < 2; ch_idx++) -+ rt2800_rf_configstore(rt2x00dev, rf_store, ch_idx); -+ -+ bbpr30 = rt2800_bbp_read(rt2x00dev, 30); -+ rfb0r39 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 39); -+ rfb0r42 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); -+ -+ rt2800_bbp_write(rt2x00dev, 30, 0x1F); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 39, 0x80); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, 0x5B); -+ -+ rt2800_bbp_write(rt2x00dev, 23, 0x00); -+ rt2800_bbp_write(rt2x00dev, 24, 0x00); -+ -+ rt2800_setbbptonegenerator(rt2x00dev); -+ -+ for (ch_idx = 0; ch_idx < 2; ch_idx++) { -+ rt2800_bbp_write(rt2x00dev, 23, 0x00); -+ rt2800_bbp_write(rt2x00dev, 24, 0x00); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00); -+ rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x0000000F); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00003306); -+ rt2800_register_write(rt2x00dev, 0x13b8, 0x10); -+ udelay(1); -+ -+ if (ch_idx == 0) -+ rt2800_rf_aux_tx0_loopback(rt2x00dev); -+ else -+ rt2800_rf_aux_tx1_loopback(rt2x00dev); -+ -+ udelay(1); -+ -+ if (ch_idx == 0) -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001004); -+ else -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002004); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x05); -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x01); -+ if (ch_idx == 0) -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ else -+ rt2800_bbp_write(rt2x00dev, 159, 0x01); -+ -+ vga_gain[ch_idx] = 18; -+ for (rf_alc_idx = 0; rf_alc_idx < 3; rf_alc_idx++) { -+ rt2800_bbp_write(rt2x00dev, 23, bbp_2324gain[rf_alc_idx]); -+ rt2800_bbp_write(rt2x00dev, 24, bbp_2324gain[rf_alc_idx]); -+ -+ macvalue = rt2800_register_read(rt2x00dev, RF_CONTROL3); -+ macvalue &= (~0x0000F1F1); -+ macvalue |= (rf_gain[rf_alc_idx] << 4); -+ macvalue |= (rf_gain[rf_alc_idx] << 12); -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, macvalue); -+ macvalue = (0x0000F1F1); -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, macvalue); -+ -+ if (rf_alc_idx == 0) { -+ rt2800_write_dc(rt2x00dev, ch_idx, 0, 1, 0x21); -+ for (; vga_gain[ch_idx] > 0; -+ vga_gain[ch_idx] = vga_gain[ch_idx] - 2) { -+ rfvalue = rfvga_gain_table[vga_gain[ch_idx]]; -+ rt2800_rfcsr_write_dccal(rt2x00dev, 3, rfvalue); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 4, rfvalue); -+ rt2800_write_dc(rt2x00dev, ch_idx, 0, 1, 0x00); -+ rt2800_write_dc(rt2x00dev, ch_idx, 0, 0, 0x00); -+ p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); -+ rt2800_write_dc(rt2x00dev, ch_idx, 0, 0, 0x21); -+ p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); -+ rt2x00_dbg(rt2x00dev, "LOFT AGC %d %d\n", p0, p1); -+ if ((p0 < 7000 * 7000) && (p1 < (7000 * 7000))) -+ break; -+ } -+ -+ rt2800_write_dc(rt2x00dev, ch_idx, 0, 0, 0x00); -+ rt2800_write_dc(rt2x00dev, ch_idx, 0, 1, 0x00); -+ -+ rt2x00_dbg(rt2x00dev, "Used VGA %d %x\n", vga_gain[ch_idx], -+ rfvga_gain_table[vga_gain[ch_idx]]); -+ -+ if (vga_gain[ch_idx] < 0) -+ vga_gain[ch_idx] = 0; -+ } -+ -+ rfvalue = rfvga_gain_table[vga_gain[ch_idx]]; -+ -+ rt2800_rfcsr_write_dccal(rt2x00dev, 3, rfvalue); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 4, rfvalue); -+ -+ rt2800_loft_search(rt2x00dev, ch_idx, rf_alc_idx, loft_dc_search_result); -+ } -+ } -+ -+ for (rf_alc_idx = 0; rf_alc_idx < 3; rf_alc_idx++) { -+ for (idx = 0; idx < 4; idx++) { -+ rt2800_bbp_write(rt2x00dev, 158, 0xB0); -+ bbp = (idx << 2) + rf_alc_idx; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+ rt2x00_dbg(rt2x00dev, " ALC %2x,", bbp); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xb1); -+ bbp = loft_dc_search_result[CHAIN_0][rf_alc_idx][0x00]; -+ bbp = bbp & 0x3F; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+ rt2x00_dbg(rt2x00dev, " I0 %2x,", bbp); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xb2); -+ bbp = loft_dc_search_result[CHAIN_0][rf_alc_idx][0x01]; -+ bbp = bbp & 0x3F; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+ rt2x00_dbg(rt2x00dev, " Q0 %2x,", bbp); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xb8); -+ bbp = loft_dc_search_result[CHAIN_1][rf_alc_idx][0x00]; -+ bbp = bbp & 0x3F; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+ rt2x00_dbg(rt2x00dev, " I1 %2x,", bbp); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0xb9); -+ bbp = loft_dc_search_result[CHAIN_1][rf_alc_idx][0x01]; -+ bbp = bbp & 0x3F; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+ rt2x00_dbg(rt2x00dev, " Q1 %2x\n", bbp); -+ } -+ } -+ -+ rt2800_bbp_write(rt2x00dev, 23, 0x00); -+ rt2800_bbp_write(rt2x00dev, 24, 0x00); -+ -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x00); -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ -+ bbp = 0x00; -+ rt2800_bbp_write(rt2x00dev, 244, 0x00); -+ -+ rt2800_bbp_write(rt2x00dev, 21, 0x01); -+ udelay(1); -+ rt2800_bbp_write(rt2x00dev, 21, 0x00); -+ -+ rt2800_rf_configrecover(rt2x00dev, rf_store); -+ -+ rt2800_register_write(rt2x00dev, TX_PIN_CFG, macorg1); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, macorg2); -+ udelay(1); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, macorg3); -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, macorg4); -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, macorg5); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); -+ rt2800_register_write(rt2x00dev, RF_CONTROL2, orig528); -+ rt2800_register_write(rt2x00dev, RF_BYPASS2, orig52c); -+ rt2800_register_write(rt2x00dev, 0x13b8, mac13b8); -+ -+ savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ macorg1 = rt2800_register_read(rt2x00dev, TX_PIN_CFG); -+ macorg2 = rt2800_register_read(rt2x00dev, RF_CONTROL0); -+ macorg3 = rt2800_register_read(rt2x00dev, RF_BYPASS0); -+ macorg4 = rt2800_register_read(rt2x00dev, RF_CONTROL3); -+ macorg5 = rt2800_register_read(rt2x00dev, RF_BYPASS3); -+ -+ bbpr1 = rt2800_bbp_read(rt2x00dev, 1); -+ bbpr4 = rt2800_bbp_read(rt2x00dev, 4); -+ bbpr241 = rt2800_bbp_read(rt2x00dev, 241); -+ bbpr242 = rt2800_bbp_read(rt2x00dev, 242); -+ mac13b8 = rt2800_register_read(rt2x00dev, 0x13b8); -+ -+ macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ macvalue &= (~0x04); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); -+ -+ if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_TX))) -+ rt2x00_warn(rt2x00dev, "RF TX busy in LOFT IQ calibration\n"); -+ -+ macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -+ macvalue &= (~0x08); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); -+ -+ if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) -+ rt2x00_warn(rt2x00dev, "RF RX busy in LOFT IQ calibration\n"); -+ -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x00000101); -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0000F1F1); -+ } -+ -+ rt2800_bbp_write(rt2x00dev, 23, 0x00); -+ rt2800_bbp_write(rt2x00dev, 24, 0x00); -+ -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { -+ rt2800_bbp_write(rt2x00dev, 4, bbpr4 & (~0x18)); -+ rt2800_bbp_write(rt2x00dev, 21, 0x01); -+ udelay(1); -+ rt2800_bbp_write(rt2x00dev, 21, 0x00); -+ -+ rt2800_bbp_write(rt2x00dev, 241, 0x14); -+ rt2800_bbp_write(rt2x00dev, 242, 0x80); -+ rt2800_bbp_write(rt2x00dev, 244, 0x31); -+ } else { -+ rt2800_setbbptonegenerator(rt2x00dev); -+ } -+ -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00003306); -+ udelay(1); -+ -+ rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x0000000F); -+ -+ if (!test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x00000000); -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0000F1F1); -+ } -+ -+ rt2800_register_write(rt2x00dev, 0x13b8, 0x00000010); -+ -+ for (ch_idx = 0; ch_idx < 2; ch_idx++) -+ rt2800_rf_configstore(rt2x00dev, rf_store, ch_idx); -+ -+ rt2800_rfcsr_write_dccal(rt2x00dev, 3, 0x3B); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x3B); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x03); -+ rt2800_bbp_write(rt2x00dev, 159, 0x60); -+ rt2800_bbp_write(rt2x00dev, 158, 0xB0); -+ rt2800_bbp_write(rt2x00dev, 159, 0x80); -+ -+ for (ch_idx = 0; ch_idx < 2; ch_idx++) { -+ rt2800_bbp_write(rt2x00dev, 23, 0x00); -+ rt2800_bbp_write(rt2x00dev, 24, 0x00); -+ -+ if (ch_idx == 0) { -+ rt2800_bbp_write(rt2x00dev, 158, 0x01); -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { -+ bbp = bbpr1 & (~0x18); -+ bbp = bbp | 0x00; -+ rt2800_bbp_write(rt2x00dev, 1, bbp); -+ } -+ rt2800_rf_aux_tx0_loopback(rt2x00dev); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001004); -+ } else { -+ rt2800_bbp_write(rt2x00dev, 158, 0x01); -+ rt2800_bbp_write(rt2x00dev, 159, 0x01); -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX1, &rt2x00dev->cap_flags)) { -+ bbp = bbpr1 & (~0x18); -+ bbp = bbp | 0x08; -+ rt2800_bbp_write(rt2x00dev, 1, bbp); -+ } -+ rt2800_rf_aux_tx1_loopback(rt2x00dev); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002004); -+ } -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x05); -+ rt2800_bbp_write(rt2x00dev, 159, 0x04); -+ -+ bbp = (ch_idx == 0) ? 0x28 : 0x46; -+ rt2800_bbp_write(rt2x00dev, 158, bbp); -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { -+ rt2800_bbp_write(rt2x00dev, 23, 0x06); -+ rt2800_bbp_write(rt2x00dev, 24, 0x06); -+ count_step = 1; -+ } else { -+ rt2800_bbp_write(rt2x00dev, 23, 0x1F); -+ rt2800_bbp_write(rt2x00dev, 24, 0x1F); -+ count_step = 2; -+ } -+ -+ for (; vga_gain[ch_idx] < 19; vga_gain[ch_idx] = (vga_gain[ch_idx] + count_step)) { -+ rfvalue = rfvga_gain_table[vga_gain[ch_idx]]; -+ rt2800_rfcsr_write_dccal(rt2x00dev, 3, rfvalue); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 4, rfvalue); -+ -+ bbp = (ch_idx == 0) ? 0x29 : 0x47; -+ rt2800_bbp_write(rt2x00dev, 158, bbp); -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 0); -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) -+ p0_idx10 = rt2800_read_fft_accumulation(rt2x00dev, 0x0A); -+ -+ bbp = (ch_idx == 0) ? 0x29 : 0x47; -+ rt2800_bbp_write(rt2x00dev, 158, bbp); -+ rt2800_bbp_write(rt2x00dev, 159, 0x21); -+ p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 0); -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX1, &rt2x00dev->cap_flags)) -+ p1_idx10 = rt2800_read_fft_accumulation(rt2x00dev, 0x0A); -+ -+ rt2x00_dbg(rt2x00dev, "IQ AGC %d %d\n", p0, p1); -+ -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { -+ rt2x00_dbg(rt2x00dev, "IQ AGC IDX 10 %d %d\n", p0_idx10, p1_idx10); -+ if ((p0_idx10 > 7000 * 7000) || (p1_idx10 > 7000 * 7000)) { -+ if (vga_gain[ch_idx] != 0) -+ vga_gain[ch_idx] = vga_gain[ch_idx] - 1; -+ break; -+ } -+ } -+ -+ if ((p0 > 2500 * 2500) || (p1 > 2500 * 2500)) -+ break; -+ } -+ -+ if (vga_gain[ch_idx] > 18) -+ vga_gain[ch_idx] = 18; -+ rt2x00_dbg(rt2x00dev, "Used VGA %d %x\n", vga_gain[ch_idx], -+ rfvga_gain_table[vga_gain[ch_idx]]); -+ -+ bbp = (ch_idx == 0) ? 0x29 : 0x47; -+ rt2800_bbp_write(rt2x00dev, 158, bbp); -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ -+ rt2800_iq_search(rt2x00dev, ch_idx, ger, per); -+ } -+ -+ rt2800_bbp_write(rt2x00dev, 23, 0x00); -+ rt2800_bbp_write(rt2x00dev, 24, 0x00); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x28); -+ bbp = ger[CHAIN_0] & 0x0F; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x29); -+ bbp = per[CHAIN_0] & 0x3F; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x46); -+ bbp = ger[CHAIN_1] & 0x0F; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x47); -+ bbp = per[CHAIN_1] & 0x3F; -+ rt2800_bbp_write(rt2x00dev, 159, bbp); -+ -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { -+ rt2800_bbp_write(rt2x00dev, 1, bbpr1); -+ rt2800_bbp_write(rt2x00dev, 241, bbpr241); -+ rt2800_bbp_write(rt2x00dev, 242, bbpr242); -+ } -+ rt2800_bbp_write(rt2x00dev, 244, 0x00); -+ -+ rt2800_bbp_write(rt2x00dev, 158, 0x00); -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ rt2800_bbp_write(rt2x00dev, 158, 0xB0); -+ rt2800_bbp_write(rt2x00dev, 159, 0x00); -+ -+ rt2800_bbp_write(rt2x00dev, 30, bbpr30); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 39, rfb0r39); -+ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfb0r42); -+ -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) -+ rt2800_bbp_write(rt2x00dev, 4, bbpr4); -+ -+ rt2800_bbp_write(rt2x00dev, 21, 0x01); -+ udelay(1); -+ rt2800_bbp_write(rt2x00dev, 21, 0x00); -+ -+ rt2800_rf_configrecover(rt2x00dev, rf_store); -+ -+ rt2800_register_write(rt2x00dev, TX_PIN_CFG, macorg1); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00); -+ rt2800_register_write(rt2x00dev, RF_CONTROL0, macorg2); -+ udelay(1); -+ rt2800_register_write(rt2x00dev, RF_BYPASS0, macorg3); -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, macorg4); -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, macorg5); -+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); -+ rt2800_register_write(rt2x00dev, 0x13b8, mac13b8); -+} -+ - static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, - bool set_bw, bool is_ht40) - { -@@ -9678,6 +10579,7 @@ static void rt2800_init_rfcsr_6352(struc - rt2800_rxdcoc_calibration(rt2x00dev); - rt2800_bw_filter_calibration(rt2x00dev, true); - rt2800_bw_filter_calibration(rt2x00dev, false); -+ rt2800_loft_iq_calibration(rt2x00dev); - rt2800_rxiq_calibration(rt2x00dev); - } - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -17,6 +17,16 @@ - #define WCID_START 33 - #define WCID_END 222 - #define STA_IDS_SIZE (WCID_END - WCID_START + 2) -+#define CHAIN_0 0x0 -+#define CHAIN_1 0x1 -+#define RF_ALC_NUM 6 -+#define CHAIN_NUM 2 -+ -+struct rf_reg_pair { -+ u8 bank; -+ u8 reg; -+ u8 value; -+}; - - /* RT2800 driver data structure */ - struct rt2800_drv_data { diff --git a/package/kernel/mac80211/patches/rt2x00/011-v6.1-rt2x00-move-helper-functions-up-in-file.patch b/package/kernel/mac80211/patches/rt2x00/011-v6.1-rt2x00-move-helper-functions-up-in-file.patch deleted file mode 100644 index b07d449d6d9..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/011-v6.1-rt2x00-move-helper-functions-up-in-file.patch +++ /dev/null @@ -1,94 +0,0 @@ -From patchwork Sat Sep 17 20:28:58 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979252 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:28:58 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 11/16] rt2x00: move helper functions up in file -Message-ID: - -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -Move register access helper functions up to the head of the file so -they can be used in all functions. - -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- - .../net/wireless/ralink/rt2x00/rt2800lib.c | 40 +++++++++---------- - 1 file changed, 20 insertions(+), 20 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -198,6 +198,26 @@ static void rt2800_rfcsr_write_dccal(str - rt2800_rfcsr_write_bank(rt2x00dev, 7, reg, value); - } - -+static void rt2800_bbp_dcoc_write(struct rt2x00_dev *rt2x00dev, -+ const u8 reg, const u8 value) -+{ -+ rt2800_bbp_write(rt2x00dev, 158, reg); -+ rt2800_bbp_write(rt2x00dev, 159, value); -+} -+ -+static u8 rt2800_bbp_dcoc_read(struct rt2x00_dev *rt2x00dev, const u8 reg) -+{ -+ rt2800_bbp_write(rt2x00dev, 158, reg); -+ return rt2800_bbp_read(rt2x00dev, 159); -+} -+ -+static void rt2800_bbp_glrt_write(struct rt2x00_dev *rt2x00dev, -+ const u8 reg, const u8 value) -+{ -+ rt2800_bbp_write(rt2x00dev, 195, reg); -+ rt2800_bbp_write(rt2x00dev, 196, value); -+} -+ - static u8 rt2800_rfcsr_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word) - { -@@ -6972,26 +6992,6 @@ static void rt2800_init_bbp_5592(struct - rt2800_bbp_write(rt2x00dev, 103, 0xc0); - } - --static void rt2800_bbp_glrt_write(struct rt2x00_dev *rt2x00dev, -- const u8 reg, const u8 value) --{ -- rt2800_bbp_write(rt2x00dev, 195, reg); -- rt2800_bbp_write(rt2x00dev, 196, value); --} -- --static void rt2800_bbp_dcoc_write(struct rt2x00_dev *rt2x00dev, -- const u8 reg, const u8 value) --{ -- rt2800_bbp_write(rt2x00dev, 158, reg); -- rt2800_bbp_write(rt2x00dev, 159, value); --} -- --static u8 rt2800_bbp_dcoc_read(struct rt2x00_dev *rt2x00dev, const u8 reg) --{ -- rt2800_bbp_write(rt2x00dev, 158, reg); -- return rt2800_bbp_read(rt2x00dev, 159); --} -- - static void rt2800_init_bbp_6352(struct rt2x00_dev *rt2x00dev) - { - u8 bbp; diff --git a/package/kernel/mac80211/patches/rt2x00/012-v6.1-rt2x00-fix-HT20-HT40-bandwidth-switch-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/012-v6.1-rt2x00-fix-HT20-HT40-bandwidth-switch-on-MT7620.patch deleted file mode 100644 index e989205ba22..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/012-v6.1-rt2x00-fix-HT20-HT40-bandwidth-switch-on-MT7620.patch +++ /dev/null @@ -1,56 +0,0 @@ -From patchwork Sat Sep 17 20:29:13 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979253 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:29:13 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 12/16] rt2x00: fix HT20/HT40 bandwidth switch on MT7620 -Message-ID: - <1664d89ba149f7b0bcec18b2a2abaedf49654507.1663445157.git.daniel@makrotopia.org> -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -Add missing configuration of the channel bandwidth filter to the -channel setup function for MT7620. - -Reported-by: Serge Vasilugin -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3855,6 +3855,14 @@ static void rt2800_config_channel_rf7620 - rfcsr |= tx_agc_fc; - rt2800_rfcsr_write_bank(rt2x00dev, 7, 59, rfcsr); - } -+ -+ if (conf_is_ht40(conf)) { -+ rt2800_bbp_glrt_write(rt2x00dev, 141, 0x10); -+ rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2f); -+ } else { -+ rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1a); -+ rt2800_bbp_glrt_write(rt2x00dev, 157, 0x40); -+ } - } - - static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev, diff --git a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch index ba16e855107..7d6e0cef2cd 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -345,6 +345,7 @@ RT2X00_LIB_FIRMWARE= +@@ -354,6 +354,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= @@ -95,7 +95,7 @@ /* Firmware functions */ static char *rt2800soc_get_firmware_name(struct rt2x00_dev *rt2x00dev) { -@@ -167,7 +154,6 @@ static const struct rt2800_ops rt2800soc +@@ -168,7 +155,6 @@ static const struct rt2800_ops rt2800soc .register_multiread = rt2x00mmio_register_multiread, .register_multiwrite = rt2x00mmio_register_multiwrite, .regbusy_read = rt2x00mmio_regbusy_read, diff --git a/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch b/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch index 38f8b771768..8964f8bf105 100644 --- a/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch +++ b/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -@@ -224,10 +224,17 @@ static int rt2800soc_probe(struct platfo +@@ -225,10 +225,17 @@ static int rt2800soc_probe(struct platfo return rt2x00soc_probe(pdev, &rt2800soc_ops); } diff --git a/package/kernel/mac80211/patches/rt2x00/995-rt2x00-mt7620-introduce-accessors-for-CHIP_VER-register.patch b/package/kernel/mac80211/patches/rt2x00/995-rt2x00-mt7620-introduce-accessors-for-CHIP_VER-register.patch index 76114fe9ae2..97a56de2b3d 100644 --- a/package/kernel/mac80211/patches/rt2x00/995-rt2x00-mt7620-introduce-accessors-for-CHIP_VER-register.patch +++ b/package/kernel/mac80211/patches/rt2x00/995-rt2x00-mt7620-introduce-accessors-for-CHIP_VER-register.patch @@ -50,8 +50,8 @@ + static const struct ieee80211_ops rt2800pci_mac80211_ops = { .tx = rt2x00mac_tx, - .start = rt2x00mac_start, -@@ -328,6 +332,9 @@ static const struct rt2800_ops rt2800pci + .wake_tx_queue = ieee80211_handle_wake_tx_queue, +@@ -329,6 +333,9 @@ static const struct rt2800_ops rt2800pci .drv_init_registers = rt2800mmio_init_registers, .drv_get_txwi = rt2800mmio_get_txwi, .drv_get_dma_done = rt2800mmio_get_dma_done, @@ -103,8 +103,8 @@ + static const struct ieee80211_ops rt2800soc_mac80211_ops = { .tx = rt2x00mac_tx, - .start = rt2x00mac_start, -@@ -159,6 +186,9 @@ static const struct rt2800_ops rt2800soc + .wake_tx_queue = ieee80211_handle_wake_tx_queue, +@@ -160,6 +187,9 @@ static const struct rt2800_ops rt2800soc .drv_init_registers = rt2800mmio_init_registers, .drv_get_txwi = rt2800mmio_get_txwi, .drv_get_dma_done = rt2800mmio_get_dma_done, @@ -126,8 +126,8 @@ + static const struct ieee80211_ops rt2800usb_mac80211_ops = { .tx = rt2x00mac_tx, - .start = rt2x00mac_start, -@@ -671,6 +675,9 @@ static const struct rt2800_ops rt2800usb + .wake_tx_queue = ieee80211_handle_wake_tx_queue, +@@ -672,6 +676,9 @@ static const struct rt2800_ops rt2800usb .drv_init_registers = rt2800usb_init_registers, .drv_get_txwi = rt2800usb_get_txwi, .drv_get_dma_done = rt2800usb_get_dma_done, diff --git a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch index 397026b80b2..4dd26da2ec7 100644 --- a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch +++ b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch @@ -9,11 +9,11 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnect --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1319,7 +1319,6 @@ static int ieee80211_stop_ap(struct wiph - sdata->vif.bss_conf.ftmr_params = NULL; +@@ -1512,7 +1512,6 @@ static int ieee80211_stop_ap(struct wiph + link_conf->ftmr_params = NULL; __sta_info_flush(sdata, true); - ieee80211_free_keys(sdata, true); - sdata->vif.bss_conf.enable_beacon = false; + link_conf->enable_beacon = false; sdata->beacon_rate_set = false; diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch deleted file mode 100644 index 7ad5427ceb6..00000000000 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ /dev/null @@ -1,75 +0,0 @@ -From: Felix Fietkau -Date: Sun, 24 Feb 2013 00:00:00 +0100 -Subject: [PATCH] mac80211: disable ipv4/ipv6 address notifiers - ---- - net/mac80211/main.c | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -337,7 +337,7 @@ void ieee80211_restart_hw(struct ieee802 - } - EXPORT_SYMBOL(ieee80211_restart_hw); - --#ifdef CONFIG_INET -+#ifdef __disabled__CONFIG_INET - static int ieee80211_ifa_changed(struct notifier_block *nb, - unsigned long data, void *arg) - { -@@ -396,7 +396,7 @@ static int ieee80211_ifa_changed(struct - } - #endif - --#if IS_ENABLED(CONFIG_IPV6) -+#if IS_ENABLED(__disabled__CONFIG_IPV6) - static int ieee80211_ifa6_changed(struct notifier_block *nb, - unsigned long data, void *arg) - { -@@ -1321,14 +1321,14 @@ int ieee80211_register_hw(struct ieee802 - wiphy_unlock(hw->wiphy); - rtnl_unlock(); - --#ifdef CONFIG_INET -+#ifdef __disabled__CONFIG_INET - local->ifa_notifier.notifier_call = ieee80211_ifa_changed; - result = register_inetaddr_notifier(&local->ifa_notifier); - if (result) - goto fail_ifa; - #endif - --#if IS_ENABLED(CONFIG_IPV6) -+#if IS_ENABLED(__disabled__CONFIG_IPV6) - local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; - result = register_inet6addr_notifier(&local->ifa6_notifier); - if (result) -@@ -1337,13 +1337,13 @@ int ieee80211_register_hw(struct ieee802 - - return 0; - --#if IS_ENABLED(CONFIG_IPV6) -+#if IS_ENABLED(__disabled__CONFIG_IPV6) - fail_ifa6: --#ifdef CONFIG_INET -+#ifdef __disabled__CONFIG_INET - unregister_inetaddr_notifier(&local->ifa_notifier); - #endif - #endif --#if defined(CONFIG_INET) || defined(CONFIG_IPV6) -+#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6) - fail_ifa: - #endif - wiphy_unregister(local->hw.wiphy); -@@ -1373,10 +1373,10 @@ void ieee80211_unregister_hw(struct ieee - tasklet_kill(&local->tx_pending_tasklet); - tasklet_kill(&local->tasklet); - --#ifdef CONFIG_INET -+#ifdef __disabled__CONFIG_INET - unregister_inetaddr_notifier(&local->ifa_notifier); - #endif --#if IS_ENABLED(CONFIG_IPV6) -+#if IS_ENABLED(__disabled__CONFIG_IPV6) - unregister_inet6addr_notifier(&local->ifa6_notifier); - #endif - diff --git a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch index 9b8e084232c..bfbb28c55cc 100644 --- a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch @@ -8,12 +8,12 @@ Subject: [PATCH] mac80211: allow scans in access point mode (for site survey) --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2497,7 +2497,7 @@ static int ieee80211_scan(struct wiphy * - * the frames sent while scanning on other channel will be - * lost) +@@ -2720,6 +2720,8 @@ static int ieee80211_scan(struct wiphy * */ -- if (sdata->u.ap.beacon && -+ if (0 && sdata->u.ap.beacon && - (!(wiphy->features & NL80211_FEATURE_AP_SCAN) || - !(req->flags & NL80211_SCAN_FLAG_AP))) - return -EOPNOTSUPP; + fallthrough; + case NL80211_IFTYPE_AP: ++ /* skip check */ ++ break; + /* + * If the scan has been forced (and the driver supports + * forcing), don't care about being beaconing already. diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch index d09d70725e5..63b21774719 100644 --- a/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch +++ b/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch @@ -28,7 +28,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -357,6 +357,7 @@ struct sta_info *sta_info_alloc(struct i +@@ -554,6 +554,7 @@ __sta_info_alloc(struct ieee80211_sub_if INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames); INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); mutex_init(&sta->ampdu_mlme.mtx); diff --git a/package/kernel/mac80211/patches/subsys/309-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch b/package/kernel/mac80211/patches/subsys/302-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch similarity index 100% rename from package/kernel/mac80211/patches/subsys/309-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch rename to package/kernel/mac80211/patches/subsys/302-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch diff --git a/package/kernel/mac80211/patches/subsys/310-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch b/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch similarity index 94% rename from package/kernel/mac80211/patches/subsys/310-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch rename to package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch index 3be43b87828..f26477e8112 100644 --- a/package/kernel/mac80211/patches/subsys/310-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch +++ b/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel_ht-reduce-fluctuations-in-rate-pro.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -703,7 +703,8 @@ minstrel_ht_calc_rate_stats(struct minst +@@ -769,7 +769,8 @@ minstrel_ht_calc_rate_stats(struct minst unsigned int cur_prob; if (unlikely(mrs->attempts > 0)) { diff --git a/package/kernel/mac80211/patches/subsys/303-v5.16-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch b/package/kernel/mac80211/patches/subsys/303-v5.16-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch deleted file mode 100644 index 159aad564b7..00000000000 --- a/package/kernel/mac80211/patches/subsys/303-v5.16-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: Xing Song -Date: Tue, 23 Nov 2021 11:31:23 +0800 -Subject: [PATCH] mac80211: set up the fwd_skb->dev for mesh forwarding - -Mesh forwarding requires that the fwd_skb->dev is set up for TX handling, -otherwise the following warning will be generated, so set it up for the -pending frames. - -[ 72.835674 ] WARNING: CPU: 0 PID: 1193 at __skb_flow_dissect+0x284/0x1298 -[ 72.842379 ] Modules linked in: ksmbd pppoe ppp_async l2tp_ppp ... -[ 72.962020 ] CPU: 0 PID: 1193 Comm: kworker/u5:1 Tainted: P S 5.4.137 #0 -[ 72.969938 ] Hardware name: MT7622_MT7531 RFB (DT) -[ 72.974659 ] Workqueue: napi_workq napi_workfn -[ 72.979025 ] pstate: 60000005 (nZCv daif -PAN -UAO) -[ 72.983822 ] pc : __skb_flow_dissect+0x284/0x1298 -[ 72.988444 ] lr : __skb_flow_dissect+0x54/0x1298 -[ 72.992977 ] sp : ffffffc010c738c0 -[ 72.996293 ] x29: ffffffc010c738c0 x28: 0000000000000000 -[ 73.001615 ] x27: 000000000000ffc2 x26: ffffff800c2eb818 -[ 73.006937 ] x25: ffffffc010a987c8 x24: 00000000000000ce -[ 73.012259 ] x23: ffffffc010c73a28 x22: ffffffc010a99c60 -[ 73.017581 ] x21: 000000000000ffc2 x20: ffffff80094da800 -[ 73.022903 ] x19: 0000000000000000 x18: 0000000000000014 -[ 73.028226 ] x17: 00000000084d16af x16: 00000000d1fc0bab -[ 73.033548 ] x15: 00000000715f6034 x14: 000000009dbdd301 -[ 73.038870 ] x13: 00000000ea4dcbc3 x12: 0000000000000040 -[ 73.044192 ] x11: 000000000eb00ff0 x10: 0000000000000000 -[ 73.049513 ] x9 : 000000000eb00073 x8 : 0000000000000088 -[ 73.054834 ] x7 : 0000000000000000 x6 : 0000000000000001 -[ 73.060155 ] x5 : 0000000000000000 x4 : 0000000000000000 -[ 73.065476 ] x3 : ffffffc010a98000 x2 : 0000000000000000 -[ 73.070797 ] x1 : 0000000000000000 x0 : 0000000000000000 -[ 73.076120 ] Call trace: -[ 73.078572 ] __skb_flow_dissect+0x284/0x1298 -[ 73.082846 ] __skb_get_hash+0x7c/0x228 -[ 73.086629 ] ieee80211_txq_may_transmit+0x7fc/0x17b8 [mac80211] -[ 73.092564 ] ieee80211_tx_prepare_skb+0x20c/0x268 [mac80211] -[ 73.098238 ] ieee80211_tx_pending+0x144/0x330 [mac80211] -[ 73.103560 ] tasklet_action_common.isra.16+0xb4/0x158 -[ 73.108618 ] tasklet_action+0x2c/0x38 -[ 73.112286 ] __do_softirq+0x168/0x3b0 -[ 73.115954 ] do_softirq.part.15+0x88/0x98 -[ 73.119969 ] __local_bh_enable_ip+0xb0/0xb8 -[ 73.124156 ] napi_workfn+0x58/0x90 -[ 73.127565 ] process_one_work+0x20c/0x478 -[ 73.131579 ] worker_thread+0x50/0x4f0 -[ 73.135249 ] kthread+0x124/0x128 -[ 73.138484 ] ret_from_fork+0x10/0x1c - -Signed-off-by: Xing Song ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2950,6 +2950,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 - if (!fwd_skb) - goto out; - -+ fwd_skb->dev = sdata->dev; - fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; - fwd_hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_RETRY); - info = IEEE80211_SKB_CB(fwd_skb); diff --git a/package/kernel/mac80211/patches/subsys/311-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch b/package/kernel/mac80211/patches/subsys/304-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch similarity index 89% rename from package/kernel/mac80211/patches/subsys/311-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch rename to package/kernel/mac80211/patches/subsys/304-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch index 13bed48ec63..9b3cc3a664a 100644 --- a/package/kernel/mac80211/patches/subsys/311-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch +++ b/package/kernel/mac80211/patches/subsys/304-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -514,6 +514,14 @@ minstrel_ht_set_best_prob_rate(struct mi +@@ -580,6 +580,14 @@ minstrel_ht_set_best_prob_rate(struct mi int cur_tp_avg, cur_group, cur_idx; int max_gpr_group, max_gpr_idx; int max_gpr_tp_avg, max_gpr_prob; @@ -33,7 +33,7 @@ Signed-off-by: Felix Fietkau cur_group = MI_RATE_GROUP(index); cur_idx = MI_RATE_IDX(index); -@@ -535,11 +543,6 @@ minstrel_ht_set_best_prob_rate(struct mi +@@ -601,11 +609,6 @@ minstrel_ht_set_best_prob_rate(struct mi !minstrel_ht_is_legacy_group(max_tp_group)) return; @@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau max_gpr_group = MI_RATE_GROUP(mg->max_group_prob_rate); max_gpr_idx = MI_RATE_IDX(mg->max_group_prob_rate); max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_avg; -@@ -597,40 +600,6 @@ minstrel_ht_assign_best_tp_rates(struct +@@ -663,40 +666,6 @@ minstrel_ht_assign_best_tp_rates(struct } @@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau - int tmp_max_streams, group, tmp_idx, tmp_prob; - int tmp_tp = 0; - -- if (!mi->sta->ht_cap.ht_supported) +- if (!mi->sta->deflink.ht_cap.ht_supported) - return; - - group = MI_RATE_GROUP(mi->max_tp_rate[0]); @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau static u16 __minstrel_ht_get_sample_rate(struct minstrel_ht_sta *mi, enum minstrel_sample_type type) -@@ -1110,8 +1079,6 @@ minstrel_ht_update_stats(struct minstrel +@@ -1176,8 +1145,6 @@ minstrel_ht_update_stats(struct minstrel mi->max_prob_rate = tmp_max_prob_rate; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau minstrel_ht_refill_sample_rates(mi); #ifdef CPTCFG_MAC80211_DEBUGFS -@@ -1156,7 +1123,7 @@ minstrel_ht_txstat_valid(struct minstrel +@@ -1256,7 +1223,7 @@ minstrel_ht_ri_txstat_valid(struct minst } static void @@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau { int group, orig_group; -@@ -1171,11 +1138,7 @@ minstrel_downgrade_rate(struct minstrel_ +@@ -1271,11 +1238,7 @@ minstrel_downgrade_rate(struct minstrel_ minstrel_mcs_groups[orig_group].streams) continue; @@ -117,7 +117,7 @@ Signed-off-by: Felix Fietkau } } -@@ -1186,7 +1149,7 @@ minstrel_ht_tx_status(void *priv, struct +@@ -1286,7 +1249,7 @@ minstrel_ht_tx_status(void *priv, struct struct ieee80211_tx_info *info = st->info; struct minstrel_ht_sta *mi = priv_sta; struct ieee80211_tx_rate *ar = info->status.rates; @@ -126,7 +126,7 @@ Signed-off-by: Felix Fietkau struct minstrel_priv *mp = priv; u32 update_interval = mp->update_interval; bool last, update = false; -@@ -1236,18 +1199,13 @@ minstrel_ht_tx_status(void *priv, struct +@@ -1354,18 +1317,13 @@ minstrel_ht_tx_status(void *priv, struct /* * check for sudden death of spatial multiplexing, * downgrade to a lower number of streams if necessary. diff --git a/package/kernel/mac80211/patches/subsys/337-mac80211-increase-quantum-for-airtime-scheduler.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch similarity index 89% rename from package/kernel/mac80211/patches/subsys/337-mac80211-increase-quantum-for-airtime-scheduler.patch rename to package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch index 74e857679eb..d541b621fdb 100644 --- a/package/kernel/mac80211/patches/subsys/337-mac80211-increase-quantum-for-airtime-scheduler.patch +++ b/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch @@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3894,7 +3894,7 @@ struct ieee80211_txq *ieee80211_next_txq +@@ -3976,7 +3976,7 @@ struct ieee80211_txq *ieee80211_next_txq if (deficit < 0) sta->airtime[txqi->txq.ac].deficit += @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau if (deficit < 0 || !aql_check) { list_move_tail(&txqi->schedule_order, -@@ -4037,7 +4037,8 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4119,7 +4119,8 @@ bool ieee80211_txq_may_transmit(struct i } sta = container_of(iter->txq.sta, struct sta_info, sta); if (ieee80211_sta_deficit(sta, ac) < 0) @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); } -@@ -4045,7 +4046,7 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4127,7 +4128,7 @@ bool ieee80211_txq_may_transmit(struct i if (sta->airtime[ac].deficit >= 0) goto out; diff --git a/package/kernel/mac80211/patches/subsys/306-01-wifi-mac80211-add-internal-handler-for-wake_tx_queue.patch b/package/kernel/mac80211/patches/subsys/306-01-wifi-mac80211-add-internal-handler-for-wake_tx_queue.patch new file mode 100644 index 00000000000..76869830ce2 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/306-01-wifi-mac80211-add-internal-handler-for-wake_tx_queue.patch @@ -0,0 +1,192 @@ +From: Alexander Wetzel +Date: Sun, 9 Oct 2022 18:30:38 +0200 +Subject: [PATCH] wifi: mac80211: add internal handler for wake_tx_queue + +Start to align the TX handling to only use internal TX queues (iTXQs): + +Provide a handler for drivers not having a custom wake_tx_queue +callback and update the documentation. + +Signed-off-by: Alexander Wetzel +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -89,15 +89,13 @@ + /** + * DOC: mac80211 software tx queueing + * +- * mac80211 provides an optional intermediate queueing implementation designed +- * to allow the driver to keep hardware queues short and provide some fairness +- * between different stations/interfaces. +- * In this model, the driver pulls data frames from the mac80211 queue instead +- * of letting mac80211 push them via drv_tx(). +- * Other frames (e.g. control or management) are still pushed using drv_tx(). ++ * mac80211 uses an intermediate queueing implementation, designed to allow the ++ * driver to keep hardware queues short and to provide some fairness between ++ * different stations/interfaces. + * +- * Drivers indicate that they use this model by implementing the .wake_tx_queue +- * driver operation. ++ * Drivers must provide the .wake_tx_queue driver operation by either ++ * linking it to ieee80211_handle_wake_tx_queue() or implementing a custom ++ * handler. + * + * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with + * another per-sta for non-data/non-mgmt and bufferable management frames, and +@@ -106,9 +104,12 @@ + * The driver is expected to initialize its private per-queue data for stations + * and interfaces in the .add_interface and .sta_add ops. + * +- * The driver can't access the queue directly. To dequeue a frame from a +- * txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a +- * queue, it calls the .wake_tx_queue driver op. ++ * The driver can't access the internal TX queues (iTXQs) directly. ++ * Whenever mac80211 adds a new frame to a queue, it calls the .wake_tx_queue ++ * driver op. ++ * Drivers implementing a custom .wake_tx_queue op can get them by calling ++ * ieee80211_tx_dequeue(). Drivers using ieee80211_handle_wake_tx_queue() will ++ * simply get the individual frames pushed via the .tx driver operation. + * + * Drivers can optionally delegate responsibility for scheduling queues to + * mac80211, to take advantage of airtime fairness accounting. In this case, to +@@ -1826,7 +1827,7 @@ struct ieee80211_vif_cfg { + * for this interface. + * @drv_priv: data area for driver use, will always be aligned to + * sizeof(void \*). +- * @txq: the multicast data TX queue (if driver uses the TXQ abstraction) ++ * @txq: the multicast data TX queue + * @txqs_stopped: per AC flag to indicate that intermediate TXQs are stopped, + * protected by fq->lock. + * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see +@@ -2252,8 +2253,8 @@ struct ieee80211_link_sta { + * For non MLO STA it will point to the deflink data. For MLO STA + * ieee80211_sta_recalc_aggregates() must be called to update it. + * @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not. +- * @txq: per-TID data TX queues (if driver uses the TXQ abstraction); note that +- * the last entry (%IEEE80211_NUM_TIDS) is used for non-data frames ++ * @txq: per-TID data TX queues; note that the last entry (%IEEE80211_NUM_TIDS) ++ * is used for non-data frames + * @deflink: This holds the default link STA information, for non MLO STA all link + * specific STA information is accessed through @deflink or through + * link[0] which points to address of @deflink. For MLO Link STA +@@ -5691,7 +5692,7 @@ void ieee80211_key_replay(struct ieee802 + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * @queue: queue number (counted from zero). + * +- * Drivers should use this function instead of netif_wake_queue. ++ * Drivers must use this function instead of netif_wake_queue. + */ + void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue); + +@@ -5700,7 +5701,7 @@ void ieee80211_wake_queue(struct ieee802 + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * @queue: queue number (counted from zero). + * +- * Drivers should use this function instead of netif_stop_queue. ++ * Drivers must use this function instead of netif_stop_queue. + */ + void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); + +@@ -5709,7 +5710,7 @@ void ieee80211_stop_queue(struct ieee802 + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * @queue: queue number (counted from zero). + * +- * Drivers should use this function instead of netif_stop_queue. ++ * Drivers must use this function instead of netif_queue_stopped. + * + * Return: %true if the queue is stopped. %false otherwise. + */ +@@ -5720,7 +5721,7 @@ int ieee80211_queue_stopped(struct ieee8 + * ieee80211_stop_queues - stop all queues + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * +- * Drivers should use this function instead of netif_stop_queue. ++ * Drivers must use this function instead of netif_tx_stop_all_queues. + */ + void ieee80211_stop_queues(struct ieee80211_hw *hw); + +@@ -5728,7 +5729,7 @@ void ieee80211_stop_queues(struct ieee80 + * ieee80211_wake_queues - wake all queues + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * +- * Drivers should use this function instead of netif_wake_queue. ++ * Drivers must use this function instead of netif_tx_wake_all_queues. + */ + void ieee80211_wake_queues(struct ieee80211_hw *hw); + +@@ -6950,6 +6951,18 @@ static inline struct sk_buff *ieee80211_ + } + + /** ++ * ieee80211_handle_wake_tx_queue - mac80211 handler for wake_tx_queue callback ++ * ++ * @hw: pointer as obtained from wake_tx_queue() callback(). ++ * @txq: pointer as obtained from wake_tx_queue() callback(). ++ * ++ * Drivers can use this function for the mandatory mac80211 wake_tx_queue ++ * callback in struct ieee80211_ops. They should not call this function. ++ */ ++void ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq); ++ ++/** + * ieee80211_next_txq - get next tx queue to pull packets from + * + * @hw: pointer as obtained from ieee80211_alloc_hw() +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -288,6 +288,52 @@ __le16 ieee80211_ctstoself_duration(stru + } + EXPORT_SYMBOL(ieee80211_ctstoself_duration); + ++static void wake_tx_push_queue(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct ieee80211_txq *queue) ++{ ++ int q = sdata->vif.hw_queue[queue->ac]; ++ struct ieee80211_tx_control control = { ++ .sta = queue->sta, ++ }; ++ struct sk_buff *skb; ++ unsigned long flags; ++ bool q_stopped; ++ ++ while (1) { ++ spin_lock_irqsave(&local->queue_stop_reason_lock, flags); ++ q_stopped = local->queue_stop_reasons[q]; ++ spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); ++ ++ if (q_stopped) ++ break; ++ ++ skb = ieee80211_tx_dequeue(&local->hw, queue); ++ if (!skb) ++ break; ++ ++ drv_tx(local, &control, skb); ++ } ++} ++ ++/* wake_tx_queue handler for driver not implementing a custom one*/ ++void ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif); ++ struct ieee80211_txq *queue; ++ ++ /* Use ieee80211_next_txq() for airtime fairness accounting */ ++ ieee80211_txq_schedule_start(hw, txq->ac); ++ while ((queue = ieee80211_next_txq(hw, txq->ac))) { ++ wake_tx_push_queue(local, sdata, queue); ++ ieee80211_return_txq(hw, queue, false); ++ } ++ ieee80211_txq_schedule_end(hw, txq->ac); ++} ++EXPORT_SYMBOL(ieee80211_handle_wake_tx_queue); ++ + static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) + { + struct ieee80211_local *local = sdata->local; diff --git a/package/kernel/mac80211/patches/subsys/306-02-wifi-mac80211-add-wake_tx_queue-callback-to-drivers.patch b/package/kernel/mac80211/patches/subsys/306-02-wifi-mac80211-add-wake_tx_queue-callback-to-drivers.patch new file mode 100644 index 00000000000..8e2c2050598 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/306-02-wifi-mac80211-add-wake_tx_queue-callback-to-drivers.patch @@ -0,0 +1,396 @@ +From: Alexander Wetzel +Date: Sun, 9 Oct 2022 18:30:39 +0200 +Subject: [PATCH] wifi: mac80211: add wake_tx_queue callback to drivers + +mac80211 is fully switching over to the internal TX queue (iTXQ) +implementation. Update all drivers not yet providing the now mandatory +wake_tx_queue() callback. + +As an side effect the netdev interfaces of all updated drivers will +switch to the noqueue qdisc. + +Signed-off-by: Alexander Wetzel +[add staging drivers] +Signed-off-by: Johannes Berg +--- + +--- a/drivers/net/wireless/admtek/adm8211.c ++++ b/drivers/net/wireless/admtek/adm8211.c +@@ -1760,6 +1760,7 @@ static int adm8211_alloc_rings(struct ie + + static const struct ieee80211_ops adm8211_ops = { + .tx = adm8211_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = adm8211_start, + .stop = adm8211_stop, + .add_interface = adm8211_add_interface, +--- a/drivers/net/wireless/ath/ar5523/ar5523.c ++++ b/drivers/net/wireless/ath/ar5523/ar5523.c +@@ -1355,6 +1355,7 @@ static const struct ieee80211_ops ar5523 + .start = ar5523_start, + .stop = ar5523_stop, + .tx = ar5523_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .set_rts_threshold = ar5523_set_rts_threshold, + .add_interface = ar5523_add_interface, + .remove_interface = ar5523_remove_interface, +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -8539,6 +8539,7 @@ err_fallback: + + static const struct ieee80211_ops ath11k_ops = { + .tx = ath11k_mac_op_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = ath11k_mac_op_start, + .stop = ath11k_mac_op_stop, + .reconfig_complete = ath11k_mac_op_reconfig_complete, +--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c ++++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c +@@ -781,6 +781,7 @@ static int ath5k_set_ringparam(struct ie + + const struct ieee80211_ops ath5k_hw_ops = { + .tx = ath5k_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = ath5k_start, + .stop = ath5k_stop, + .add_interface = ath5k_add_interface, +--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c +@@ -1870,6 +1870,7 @@ static void ath9k_htc_channel_switch_bea + + struct ieee80211_ops ath9k_htc_ops = { + .tx = ath9k_htc_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = ath9k_htc_start, + .stop = ath9k_htc_stop, + .add_interface = ath9k_htc_add_interface, +--- a/drivers/net/wireless/ath/carl9170/main.c ++++ b/drivers/net/wireless/ath/carl9170/main.c +@@ -1715,6 +1715,7 @@ static const struct ieee80211_ops carl91 + .start = carl9170_op_start, + .stop = carl9170_op_stop, + .tx = carl9170_op_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .flush = carl9170_op_flush, + .add_interface = carl9170_op_add_interface, + .remove_interface = carl9170_op_remove_interface, +--- a/drivers/net/wireless/ath/wcn36xx/main.c ++++ b/drivers/net/wireless/ath/wcn36xx/main.c +@@ -1362,6 +1362,7 @@ static const struct ieee80211_ops wcn36x + .prepare_multicast = wcn36xx_prepare_multicast, + .configure_filter = wcn36xx_configure_filter, + .tx = wcn36xx_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .set_key = wcn36xx_set_key, + .hw_scan = wcn36xx_hw_scan, + .cancel_hw_scan = wcn36xx_cancel_hw_scan, +--- a/drivers/net/wireless/atmel/at76c50x-usb.c ++++ b/drivers/net/wireless/atmel/at76c50x-usb.c +@@ -2187,6 +2187,7 @@ static int at76_set_key(struct ieee80211 + + static const struct ieee80211_ops at76_ops = { + .tx = at76_mac80211_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .add_interface = at76_add_interface, + .remove_interface = at76_remove_interface, + .config = at76_config, +--- a/drivers/net/wireless/broadcom/b43/main.c ++++ b/drivers/net/wireless/broadcom/b43/main.c +@@ -5171,6 +5171,7 @@ static int b43_op_get_survey(struct ieee + + static const struct ieee80211_ops b43_hw_ops = { + .tx = b43_op_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .conf_tx = b43_op_conf_tx, + .add_interface = b43_op_add_interface, + .remove_interface = b43_op_remove_interface, +--- a/drivers/net/wireless/broadcom/b43legacy/main.c ++++ b/drivers/net/wireless/broadcom/b43legacy/main.c +@@ -3532,6 +3532,7 @@ static int b43legacy_op_get_survey(struc + + static const struct ieee80211_ops b43legacy_hw_ops = { + .tx = b43legacy_op_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .conf_tx = b43legacy_op_conf_tx, + .add_interface = b43legacy_op_add_interface, + .remove_interface = b43legacy_op_remove_interface, +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +@@ -962,6 +962,7 @@ static int brcms_ops_beacon_set_tim(stru + + static const struct ieee80211_ops brcms_ops = { + .tx = brcms_ops_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = brcms_ops_start, + .stop = brcms_ops_stop, + .add_interface = brcms_ops_add_interface, +--- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c ++++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c +@@ -3435,6 +3435,7 @@ static const struct attribute_group il39 + + static struct ieee80211_ops il3945_mac_ops __ro_after_init = { + .tx = il3945_mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = il3945_mac_start, + .stop = il3945_mac_stop, + .add_interface = il_mac_add_interface, +--- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c ++++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c +@@ -6304,6 +6304,7 @@ il4965_tx_queue_set_status(struct il_pri + + static const struct ieee80211_ops il4965_mac_ops = { + .tx = il4965_mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = il4965_mac_start, + .stop = il4965_mac_stop, + .add_interface = il_mac_add_interface, +--- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c ++++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c +@@ -1571,6 +1571,7 @@ static void iwlagn_mac_sta_notify(struct + + const struct ieee80211_ops iwlagn_hw_ops = { + .tx = iwlagn_mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = iwlagn_mac_start, + .stop = iwlagn_mac_stop, + #ifdef CONFIG_PM_SLEEP +--- a/drivers/net/wireless/intersil/p54/main.c ++++ b/drivers/net/wireless/intersil/p54/main.c +@@ -705,6 +705,7 @@ static void p54_set_coverage_class(struc + + static const struct ieee80211_ops p54_ops = { + .tx = p54_tx_80211, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = p54_start, + .stop = p54_stop, + .add_interface = p54_add_interface, +--- a/drivers/net/wireless/mac80211_hwsim.c ++++ b/drivers/net/wireless/mac80211_hwsim.c +@@ -3109,6 +3109,7 @@ static int mac80211_hwsim_change_sta_lin + + #define HWSIM_COMMON_OPS \ + .tx = mac80211_hwsim_tx, \ ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, \ + .start = mac80211_hwsim_start, \ + .stop = mac80211_hwsim_stop, \ + .add_interface = mac80211_hwsim_add_interface, \ +--- a/drivers/net/wireless/marvell/libertas_tf/main.c ++++ b/drivers/net/wireless/marvell/libertas_tf/main.c +@@ -474,6 +474,7 @@ static int lbtf_op_get_survey(struct iee + + static const struct ieee80211_ops lbtf_ops = { + .tx = lbtf_op_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = lbtf_op_start, + .stop = lbtf_op_stop, + .add_interface = lbtf_op_add_interface, +--- a/drivers/net/wireless/marvell/mwl8k.c ++++ b/drivers/net/wireless/marvell/mwl8k.c +@@ -5611,6 +5611,7 @@ static void mwl8k_sw_scan_complete(struc + + static const struct ieee80211_ops mwl8k_ops = { + .tx = mwl8k_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = mwl8k_start, + .stop = mwl8k_stop, + .add_interface = mwl8k_add_interface, +--- a/drivers/net/wireless/mediatek/mt7601u/main.c ++++ b/drivers/net/wireless/mediatek/mt7601u/main.c +@@ -406,6 +406,7 @@ out: + + const struct ieee80211_ops mt7601u_ops = { + .tx = mt7601u_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = mt7601u_start, + .stop = mt7601u_stop, + .add_interface = mt7601u_add_interface, +--- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c +@@ -1706,6 +1706,7 @@ static int rt2400pci_tx_last_beacon(stru + + static const struct ieee80211_ops rt2400pci_mac80211_ops = { + .tx = rt2x00mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rt2x00mac_start, + .stop = rt2x00mac_stop, + .add_interface = rt2x00mac_add_interface, +--- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c +@@ -2004,6 +2004,7 @@ static int rt2500pci_tx_last_beacon(stru + + static const struct ieee80211_ops rt2500pci_mac80211_ops = { + .tx = rt2x00mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rt2x00mac_start, + .stop = rt2x00mac_stop, + .add_interface = rt2x00mac_add_interface, +--- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c +@@ -1795,6 +1795,7 @@ static int rt2500usb_probe_hw(struct rt2 + + static const struct ieee80211_ops rt2500usb_mac80211_ops = { + .tx = rt2x00mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rt2x00mac_start, + .stop = rt2x00mac_stop, + .add_interface = rt2x00mac_add_interface, +--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c +@@ -288,6 +288,7 @@ static int rt2800pci_read_eeprom(struct + + static const struct ieee80211_ops rt2800pci_mac80211_ops = { + .tx = rt2x00mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rt2x00mac_start, + .stop = rt2x00mac_stop, + .add_interface = rt2x00mac_add_interface, +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +@@ -133,6 +133,7 @@ static int rt2800soc_write_firmware(stru + + static const struct ieee80211_ops rt2800soc_mac80211_ops = { + .tx = rt2x00mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rt2x00mac_start, + .stop = rt2x00mac_stop, + .add_interface = rt2x00mac_add_interface, +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c +@@ -630,6 +630,7 @@ static int rt2800usb_probe_hw(struct rt2 + + static const struct ieee80211_ops rt2800usb_mac80211_ops = { + .tx = rt2x00mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rt2x00mac_start, + .stop = rt2x00mac_stop, + .add_interface = rt2x00mac_add_interface, +--- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c +@@ -2873,6 +2873,7 @@ static u64 rt61pci_get_tsf(struct ieee80 + + static const struct ieee80211_ops rt61pci_mac80211_ops = { + .tx = rt2x00mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rt2x00mac_start, + .stop = rt2x00mac_stop, + .add_interface = rt2x00mac_add_interface, +--- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c +@@ -2292,6 +2292,7 @@ static u64 rt73usb_get_tsf(struct ieee80 + + static const struct ieee80211_ops rt73usb_mac80211_ops = { + .tx = rt2x00mac_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rt2x00mac_start, + .stop = rt2x00mac_stop, + .add_interface = rt2x00mac_add_interface, +--- a/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c ++++ b/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c +@@ -1608,6 +1608,7 @@ static void rtl8180_configure_filter(str + + static const struct ieee80211_ops rtl8180_ops = { + .tx = rtl8180_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rtl8180_start, + .stop = rtl8180_stop, + .add_interface = rtl8180_add_interface, +--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c ++++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +@@ -1378,6 +1378,7 @@ static int rtl8187_conf_tx(struct ieee80 + + static const struct ieee80211_ops rtl8187_ops = { + .tx = rtl8187_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rtl8187_start, + .stop = rtl8187_stop, + .add_interface = rtl8187_add_interface, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6561,6 +6561,7 @@ static void rtl8xxxu_stop(struct ieee802 + + static const struct ieee80211_ops rtl8xxxu_ops = { + .tx = rtl8xxxu_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .add_interface = rtl8xxxu_add_interface, + .remove_interface = rtl8xxxu_remove_interface, + .config = rtl8xxxu_config, +--- a/drivers/net/wireless/realtek/rtlwifi/core.c ++++ b/drivers/net/wireless/realtek/rtlwifi/core.c +@@ -1912,6 +1912,7 @@ const struct ieee80211_ops rtl_ops = { + .start = rtl_op_start, + .stop = rtl_op_stop, + .tx = rtl_op_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .add_interface = rtl_op_add_interface, + .remove_interface = rtl_op_remove_interface, + .change_interface = rtl_op_change_interface, +--- a/drivers/net/wireless/realtek/rtw88/mac80211.c ++++ b/drivers/net/wireless/realtek/rtw88/mac80211.c +@@ -896,6 +896,7 @@ static void rtw_ops_sta_rc_update(struct + + const struct ieee80211_ops rtw_ops = { + .tx = rtw_ops_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .wake_tx_queue = rtw_ops_wake_tx_queue, + .start = rtw_ops_start, + .stop = rtw_ops_stop, +--- a/drivers/net/wireless/realtek/rtw89/mac80211.c ++++ b/drivers/net/wireless/realtek/rtw89/mac80211.c +@@ -918,6 +918,7 @@ static int rtw89_ops_set_tid_config(stru + + const struct ieee80211_ops rtw89_ops = { + .tx = rtw89_ops_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .wake_tx_queue = rtw89_ops_wake_tx_queue, + .start = rtw89_ops_start, + .stop = rtw89_ops_stop, +--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c ++++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c +@@ -1958,6 +1958,7 @@ static int rsi_mac80211_resume(struct ie + + static const struct ieee80211_ops mac80211_ops = { + .tx = rsi_mac80211_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = rsi_mac80211_start, + .stop = rsi_mac80211_stop, + .add_interface = rsi_mac80211_add_interface, +--- a/drivers/net/wireless/st/cw1200/main.c ++++ b/drivers/net/wireless/st/cw1200/main.c +@@ -209,6 +209,7 @@ static const struct ieee80211_ops cw1200 + .remove_interface = cw1200_remove_interface, + .change_interface = cw1200_change_interface, + .tx = cw1200_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .hw_scan = cw1200_hw_scan, + .set_tim = cw1200_set_tim, + .sta_notify = cw1200_sta_notify, +--- a/drivers/net/wireless/ti/wl1251/main.c ++++ b/drivers/net/wireless/ti/wl1251/main.c +@@ -1359,6 +1359,7 @@ static const struct ieee80211_ops wl1251 + .prepare_multicast = wl1251_op_prepare_multicast, + .configure_filter = wl1251_op_configure_filter, + .tx = wl1251_op_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .set_key = wl1251_op_set_key, + .hw_scan = wl1251_op_hw_scan, + .bss_info_changed = wl1251_op_bss_info_changed, +--- a/drivers/net/wireless/ti/wlcore/main.c ++++ b/drivers/net/wireless/ti/wlcore/main.c +@@ -5942,6 +5942,7 @@ static const struct ieee80211_ops wl1271 + .prepare_multicast = wl1271_op_prepare_multicast, + .configure_filter = wl1271_op_configure_filter, + .tx = wl1271_op_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .set_key = wlcore_op_set_key, + .hw_scan = wl1271_op_hw_scan, + .cancel_hw_scan = wl1271_op_cancel_hw_scan, +--- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c ++++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c +@@ -1344,6 +1344,7 @@ static u64 zd_op_get_tsf(struct ieee8021 + + static const struct ieee80211_ops zd_ops = { + .tx = zd_op_tx, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .start = zd_op_start, + .stop = zd_op_stop, + .add_interface = zd_op_add_interface, diff --git a/package/kernel/mac80211/patches/subsys/306-03-wifi-mac80211-Drop-support-for-TX-push-path.patch b/package/kernel/mac80211/patches/subsys/306-03-wifi-mac80211-Drop-support-for-TX-push-path.patch new file mode 100644 index 00000000000..9d58345555a --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/306-03-wifi-mac80211-Drop-support-for-TX-push-path.patch @@ -0,0 +1,655 @@ +From: Alexander Wetzel +Date: Sun, 9 Oct 2022 18:30:40 +0200 +Subject: [PATCH] wifi: mac80211: Drop support for TX push path + +All drivers are now using mac80211 internal queues (iTXQs). +Drop mac80211 internal support for the old push path. + +Signed-off-by: Alexander Wetzel +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -4339,9 +4339,6 @@ static int ieee80211_get_txq_stats(struc + struct ieee80211_sub_if_data *sdata; + int ret = 0; + +- if (!local->ops->wake_tx_queue) +- return 1; +- + spin_lock_bh(&local->fq.lock); + rcu_read_lock(); + +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -663,9 +663,7 @@ void debugfs_hw_add(struct ieee80211_loc + DEBUGFS_ADD_MODE(force_tx_status, 0600); + DEBUGFS_ADD_MODE(aql_enable, 0600); + DEBUGFS_ADD(aql_pending); +- +- if (local->ops->wake_tx_queue) +- DEBUGFS_ADD_MODE(aqm, 0600); ++ DEBUGFS_ADD_MODE(aqm, 0600); + + DEBUGFS_ADD_MODE(airtime_flags, 0600); + +--- a/net/mac80211/debugfs_netdev.c ++++ b/net/mac80211/debugfs_netdev.c +@@ -677,8 +677,7 @@ static void add_common_files(struct ieee + DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz); + DEBUGFS_ADD(hw_queues); + +- if (sdata->local->ops->wake_tx_queue && +- sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && ++ if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && + sdata->vif.type != NL80211_IFTYPE_NAN) + DEBUGFS_ADD(aqm); + } +--- a/net/mac80211/debugfs_sta.c ++++ b/net/mac80211/debugfs_sta.c +@@ -1056,10 +1056,8 @@ void ieee80211_sta_debugfs_add(struct st + DEBUGFS_ADD_COUNTER(rx_fragments, deflink.rx_stats.fragments); + DEBUGFS_ADD_COUNTER(tx_filtered, deflink.status_stats.filtered); + +- if (local->ops->wake_tx_queue) { +- DEBUGFS_ADD(aqm); +- DEBUGFS_ADD(airtime); +- } ++ DEBUGFS_ADD(aqm); ++ DEBUGFS_ADD(airtime); + + if (wiphy_ext_feature_isset(local->hw.wiphy, + NL80211_EXT_FEATURE_AQL)) +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -2290,7 +2290,6 @@ void ieee80211_wake_queue_by_reason(stru + void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, + enum queue_stop_reason reason, + bool refcounted); +-void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue); + void ieee80211_add_pending_skb(struct ieee80211_local *local, + struct sk_buff *skb); + void ieee80211_add_pending_skbs(struct ieee80211_local *local, +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -458,12 +458,6 @@ static void ieee80211_do_stop(struct iee + if (cancel_scan) + ieee80211_scan_cancel(local); + +- /* +- * Stop TX on this interface first. +- */ +- if (!local->ops->wake_tx_queue && sdata->dev) +- netif_tx_stop_all_queues(sdata->dev); +- + ieee80211_roc_purge(local, sdata); + + switch (sdata->vif.type) { +@@ -811,13 +805,6 @@ static void ieee80211_uninit(struct net_ + ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev)); + } + +-static u16 ieee80211_netdev_select_queue(struct net_device *dev, +- struct sk_buff *skb, +- struct net_device *sb_dev) +-{ +- return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb); +-} +- + static void + ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) + { +@@ -831,7 +818,6 @@ static const struct net_device_ops ieee8 + .ndo_start_xmit = ieee80211_subif_start_xmit, + .ndo_set_rx_mode = ieee80211_set_multicast_list, + .ndo_set_mac_address = ieee80211_change_mac, +- .ndo_select_queue = ieee80211_netdev_select_queue, + .ndo_get_stats64 = ieee80211_get_stats64, + }; + +@@ -939,7 +925,6 @@ static const struct net_device_ops ieee8 + .ndo_start_xmit = ieee80211_subif_start_xmit_8023, + .ndo_set_rx_mode = ieee80211_set_multicast_list, + .ndo_set_mac_address = ieee80211_change_mac, +- .ndo_select_queue = ieee80211_netdev_select_queue, + .ndo_get_stats64 = ieee80211_get_stats64, + .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, + }; +@@ -1441,35 +1426,6 @@ int ieee80211_do_open(struct wireless_de + + ieee80211_recalc_ps(local); + +- if (sdata->vif.type == NL80211_IFTYPE_MONITOR || +- sdata->vif.type == NL80211_IFTYPE_AP_VLAN || +- local->ops->wake_tx_queue) { +- /* XXX: for AP_VLAN, actually track AP queues */ +- if (dev) +- netif_tx_start_all_queues(dev); +- } else if (dev) { +- unsigned long flags; +- int n_acs = IEEE80211_NUM_ACS; +- int ac; +- +- if (local->hw.queues < IEEE80211_NUM_ACS) +- n_acs = 1; +- +- spin_lock_irqsave(&local->queue_stop_reason_lock, flags); +- if (sdata->vif.cab_queue == IEEE80211_INVAL_HW_QUEUE || +- (local->queue_stop_reasons[sdata->vif.cab_queue] == 0 && +- skb_queue_empty(&local->pending[sdata->vif.cab_queue]))) { +- for (ac = 0; ac < n_acs; ac++) { +- int ac_queue = sdata->vif.hw_queue[ac]; +- +- if (local->queue_stop_reasons[ac_queue] == 0 && +- skb_queue_empty(&local->pending[ac_queue])) +- netif_start_subqueue(dev, ac); +- } +- } +- spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); +- } +- + set_bit(SDATA_STATE_RUNNING, &sdata->state); + + return 0; +@@ -1499,17 +1455,12 @@ static void ieee80211_if_setup(struct ne + { + ether_setup(dev); + dev->priv_flags &= ~IFF_TX_SKB_SHARING; ++ dev->priv_flags |= IFF_NO_QUEUE; + dev->netdev_ops = &ieee80211_dataif_ops; + dev->needs_free_netdev = true; + dev->priv_destructor = ieee80211_if_free; + } + +-static void ieee80211_if_setup_no_queue(struct net_device *dev) +-{ +- ieee80211_if_setup(dev); +- dev->priv_flags |= IFF_NO_QUEUE; +-} +- + static void ieee80211_iface_process_skb(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb) +@@ -2094,9 +2045,7 @@ int ieee80211_if_add(struct ieee80211_lo + struct net_device *ndev = NULL; + struct ieee80211_sub_if_data *sdata = NULL; + struct txq_info *txqi; +- void (*if_setup)(struct net_device *dev); + int ret, i; +- int txqs = 1; + + ASSERT_RTNL(); + +@@ -2119,30 +2068,18 @@ int ieee80211_if_add(struct ieee80211_lo + sizeof(void *)); + int txq_size = 0; + +- if (local->ops->wake_tx_queue && +- type != NL80211_IFTYPE_AP_VLAN && ++ if (type != NL80211_IFTYPE_AP_VLAN && + (type != NL80211_IFTYPE_MONITOR || + (params->flags & MONITOR_FLAG_ACTIVE))) + txq_size += sizeof(struct txq_info) + + local->hw.txq_data_size; + +- if (local->ops->wake_tx_queue) { +- if_setup = ieee80211_if_setup_no_queue; +- } else { +- if_setup = ieee80211_if_setup; +- if (local->hw.queues >= IEEE80211_NUM_ACS) +- txqs = IEEE80211_NUM_ACS; +- } +- + ndev = alloc_netdev_mqs(size + txq_size, + name, name_assign_type, +- if_setup, txqs, 1); ++ ieee80211_if_setup, 1, 1); + if (!ndev) + return -ENOMEM; + +- if (!local->ops->wake_tx_queue && local->hw.wiphy->tx_queue_len) +- ndev->tx_queue_len = local->hw.wiphy->tx_queue_len; +- + dev_net_set(ndev, wiphy_net(local->hw.wiphy)); + + ndev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -630,7 +630,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + + if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config || + !ops->add_interface || !ops->remove_interface || +- !ops->configure_filter)) ++ !ops->configure_filter || !ops->wake_tx_queue)) + return NULL; + + if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) +@@ -719,9 +719,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + if (!ops->set_key) + wiphy->flags |= WIPHY_FLAG_IBSS_RSN; + +- if (ops->wake_tx_queue) +- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_TXQS); +- ++ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_TXQS); + wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_RRM); + + wiphy->bss_priv_size = sizeof(struct ieee80211_bss); +@@ -834,10 +832,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + atomic_set(&local->agg_queue_stop[i], 0); + } + tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending); +- +- if (ops->wake_tx_queue) +- tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs); +- ++ tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs); + tasklet_setup(&local->tasklet, ieee80211_tasklet_handler); + + skb_queue_head_init(&local->skb_queue); +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -1571,9 +1571,6 @@ static void sta_ps_start(struct sta_info + + ieee80211_clear_fast_xmit(sta); + +- if (!sta->sta.txq[0]) +- return; +- + for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) { + struct ieee80211_txq *txq = sta->sta.txq[tid]; + struct txq_info *txqi = to_txq_info(txq); +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -140,17 +140,15 @@ static void __cleanup_single_sta(struct + atomic_dec(&ps->num_sta_ps); + } + +- if (sta->sta.txq[0]) { +- for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { +- struct txq_info *txqi; ++ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { ++ struct txq_info *txqi; + +- if (!sta->sta.txq[i]) +- continue; ++ if (!sta->sta.txq[i]) ++ continue; + +- txqi = to_txq_info(sta->sta.txq[i]); ++ txqi = to_txq_info(sta->sta.txq[i]); + +- ieee80211_txq_purge(local, txqi); +- } ++ ieee80211_txq_purge(local, txqi); + } + + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { +@@ -425,8 +423,7 @@ void sta_info_free(struct ieee80211_loca + + sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr); + +- if (sta->sta.txq[0]) +- kfree(to_txq_info(sta->sta.txq[0])); ++ kfree(to_txq_info(sta->sta.txq[0])); + kfree(rcu_dereference_raw(sta->sta.rates)); + #ifdef CPTCFG_MAC80211_MESH + kfree(sta->mesh); +@@ -527,6 +524,8 @@ __sta_info_alloc(struct ieee80211_sub_if + struct ieee80211_local *local = sdata->local; + struct ieee80211_hw *hw = &local->hw; + struct sta_info *sta; ++ void *txq_data; ++ int size; + int i; + + sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp); +@@ -597,21 +596,18 @@ __sta_info_alloc(struct ieee80211_sub_if + + sta->last_connected = ktime_get_seconds(); + +- if (local->ops->wake_tx_queue) { +- void *txq_data; +- int size = sizeof(struct txq_info) + +- ALIGN(hw->txq_data_size, sizeof(void *)); ++ size = sizeof(struct txq_info) + ++ ALIGN(hw->txq_data_size, sizeof(void *)); + +- txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp); +- if (!txq_data) +- goto free; ++ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp); ++ if (!txq_data) ++ goto free; + +- for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { +- struct txq_info *txq = txq_data + i * size; ++ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { ++ struct txq_info *txq = txq_data + i * size; + +- /* might not do anything for the bufferable MMPDU TXQ */ +- ieee80211_txq_init(sdata, sta, txq, i); +- } ++ /* might not do anything for the (bufferable) MMPDU TXQ */ ++ ieee80211_txq_init(sdata, sta, txq, i); + } + + if (sta_prepare_rate_control(local, sta, gfp)) +@@ -685,8 +681,7 @@ __sta_info_alloc(struct ieee80211_sub_if + return sta; + + free_txq: +- if (sta->sta.txq[0]) +- kfree(to_txq_info(sta->sta.txq[0])); ++ kfree(to_txq_info(sta->sta.txq[0])); + free: + sta_info_free_link(&sta->deflink); + #ifdef CPTCFG_MAC80211_MESH +@@ -1959,9 +1954,6 @@ ieee80211_sta_ps_deliver_response(struct + * TIM recalculation. + */ + +- if (!sta->sta.txq[0]) +- return; +- + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) { + if (!sta->sta.txq[tid] || + !(driver_release_tids & BIT(tid)) || +@@ -2446,7 +2438,7 @@ static void sta_set_tidstats(struct sta_ + tidstats->tx_msdu_failed = sta->deflink.status_stats.msdu_failed[tid]; + } + +- if (local->ops->wake_tx_queue && tid < IEEE80211_NUM_TIDS) { ++ if (tid < IEEE80211_NUM_TIDS) { + spin_lock_bh(&local->fq.lock); + rcu_read_lock(); + +@@ -2774,9 +2766,6 @@ unsigned long ieee80211_sta_last_active( + + static void sta_update_codel_params(struct sta_info *sta, u32 thr) + { +- if (!sta->sdata->local->ops->wake_tx_queue) +- return; +- + if (thr && thr < STA_SLOW_THRESHOLD * sta->local->num_sta) { + sta->cparams.target = MS2TIME(50); + sta->cparams.interval = MS2TIME(300); +--- a/net/mac80211/tdls.c ++++ b/net/mac80211/tdls.c +@@ -1016,7 +1016,6 @@ ieee80211_tdls_prep_mgmt_packet(struct w + skb->priority = 256 + 5; + break; + } +- skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb)); + + /* + * Set the WLAN_TDLS_TEARDOWN flag to indicate a teardown in progress. +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1599,9 +1599,6 @@ int ieee80211_txq_setup_flows(struct iee + bool supp_vht = false; + enum nl80211_band band; + +- if (!local->ops->wake_tx_queue) +- return 0; +- + ret = fq_init(fq, 4096); + if (ret) + return ret; +@@ -1649,9 +1646,6 @@ void ieee80211_txq_teardown_flows(struct + { + struct fq *fq = &local->fq; + +- if (!local->ops->wake_tx_queue) +- return; +- + kfree(local->cvars); + local->cvars = NULL; + +@@ -1668,8 +1662,7 @@ static bool ieee80211_queue_skb(struct i + struct ieee80211_vif *vif; + struct txq_info *txqi; + +- if (!local->ops->wake_tx_queue || +- sdata->vif.type == NL80211_IFTYPE_MONITOR) ++ if (sdata->vif.type == NL80211_IFTYPE_MONITOR) + return false; + + if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) +@@ -4185,12 +4178,7 @@ void __ieee80211_subif_start_xmit(struct + if (IS_ERR(sta)) + sta = NULL; + +- if (local->ops->wake_tx_queue) { +- u16 queue = __ieee80211_select_queue(sdata, sta, skb); +- skb_set_queue_mapping(skb, queue); +- skb_get_hash(skb); +- } +- ++ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); + ieee80211_aggr_check(sdata, sta, skb); + + sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); +@@ -4501,11 +4489,7 @@ static void ieee80211_8023_xmit(struct i + struct tid_ampdu_tx *tid_tx; + u8 tid; + +- if (local->ops->wake_tx_queue) { +- u16 queue = __ieee80211_select_queue(sdata, sta, skb); +- skb_set_queue_mapping(skb, queue); +- skb_get_hash(skb); +- } ++ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); + + if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning)) && + test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) +@@ -4759,9 +4743,6 @@ void ieee80211_tx_pending(struct tasklet + if (!txok) + break; + } +- +- if (skb_queue_empty(&local->pending[i])) +- ieee80211_propagate_queue_wake(local, i); + } + spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); + +@@ -5954,10 +5935,9 @@ int ieee80211_tx_control_port(struct wip + } + + if (!IS_ERR(sta)) { +- u16 queue = __ieee80211_select_queue(sdata, sta, skb); ++ u16 queue = ieee80211_select_queue(sdata, sta, skb); + + skb_set_queue_mapping(skb, queue); +- skb_get_hash(skb); + + /* + * for MLO STA, the SA should be the AP MLD address, but +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -446,39 +446,6 @@ void ieee80211_wake_txqs(struct tasklet_ + spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); + } + +-void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue) +-{ +- struct ieee80211_sub_if_data *sdata; +- int n_acs = IEEE80211_NUM_ACS; +- +- if (local->ops->wake_tx_queue) +- return; +- +- if (local->hw.queues < IEEE80211_NUM_ACS) +- n_acs = 1; +- +- list_for_each_entry_rcu(sdata, &local->interfaces, list) { +- int ac; +- +- if (!sdata->dev) +- continue; +- +- if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE && +- local->queue_stop_reasons[sdata->vif.cab_queue] != 0) +- continue; +- +- for (ac = 0; ac < n_acs; ac++) { +- int ac_queue = sdata->vif.hw_queue[ac]; +- +- if (ac_queue == queue || +- (sdata->vif.cab_queue == queue && +- local->queue_stop_reasons[ac_queue] == 0 && +- skb_queue_empty(&local->pending[ac_queue]))) +- netif_wake_subqueue(sdata->dev, ac); +- } +- } +-} +- + static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue, + enum queue_stop_reason reason, + bool refcounted, +@@ -509,11 +476,7 @@ static void __ieee80211_wake_queue(struc + /* someone still has this queue stopped */ + return; + +- if (skb_queue_empty(&local->pending[queue])) { +- rcu_read_lock(); +- ieee80211_propagate_queue_wake(local, queue); +- rcu_read_unlock(); +- } else ++ if (!skb_queue_empty(&local->pending[queue])) + tasklet_schedule(&local->tx_pending_tasklet); + + /* +@@ -523,12 +486,10 @@ static void __ieee80211_wake_queue(struc + * release someone's lock, but it is fine because all the callers of + * __ieee80211_wake_queue call it right before releasing the lock. + */ +- if (local->ops->wake_tx_queue) { +- if (reason == IEEE80211_QUEUE_STOP_REASON_DRIVER) +- tasklet_schedule(&local->wake_txqs_tasklet); +- else +- _ieee80211_wake_txqs(local, flags); +- } ++ if (reason == IEEE80211_QUEUE_STOP_REASON_DRIVER) ++ tasklet_schedule(&local->wake_txqs_tasklet); ++ else ++ _ieee80211_wake_txqs(local, flags); + } + + void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, +@@ -585,10 +546,6 @@ static void __ieee80211_stop_queue(struc + for (ac = 0; ac < n_acs; ac++) { + if (sdata->vif.hw_queue[ac] == queue || + sdata->vif.cab_queue == queue) { +- if (!local->ops->wake_tx_queue) { +- netif_stop_subqueue(sdata->dev, ac); +- continue; +- } + spin_lock(&local->fq.lock); + sdata->vif.txqs_stopped[ac] = true; + spin_unlock(&local->fq.lock); +--- a/net/mac80211/wme.c ++++ b/net/mac80211/wme.c +@@ -122,6 +122,9 @@ u16 ieee80211_select_queue_80211(struct + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + u8 *p; + ++ /* Ensure hash is set prior to potential SW encryption */ ++ skb_get_hash(skb); ++ + if ((info->control.flags & IEEE80211_TX_CTRL_DONT_REORDER) || + local->hw.queues < IEEE80211_NUM_ACS) + return 0; +@@ -141,12 +144,15 @@ u16 ieee80211_select_queue_80211(struct + return ieee80211_downgrade_queue(sdata, NULL, skb); + } + +-u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, +- struct sta_info *sta, struct sk_buff *skb) ++u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta, struct sk_buff *skb) + { + struct mac80211_qos_map *qos_map; + bool qos; + ++ /* Ensure hash is set prior to potential SW encryption */ ++ skb_get_hash(skb); ++ + /* all mesh/ocb stations are required to support WME */ + if (sta && (sdata->vif.type == NL80211_IFTYPE_MESH_POINT || + sdata->vif.type == NL80211_IFTYPE_OCB)) +@@ -176,59 +182,6 @@ u16 __ieee80211_select_queue(struct ieee + return ieee80211_downgrade_queue(sdata, sta, skb); + } + +- +-/* Indicate which queue to use. */ +-u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, +- struct sk_buff *skb) +-{ +- struct ieee80211_local *local = sdata->local; +- struct sta_info *sta = NULL; +- const u8 *ra = NULL; +- u16 ret; +- +- /* when using iTXQ, we can do this later */ +- if (local->ops->wake_tx_queue) +- return 0; +- +- if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) { +- skb->priority = 0; /* required for correct WPA/11i MIC */ +- return 0; +- } +- +- rcu_read_lock(); +- switch (sdata->vif.type) { +- case NL80211_IFTYPE_AP_VLAN: +- sta = rcu_dereference(sdata->u.vlan.sta); +- if (sta) +- break; +- fallthrough; +- case NL80211_IFTYPE_AP: +- ra = skb->data; +- break; +- case NL80211_IFTYPE_STATION: +- /* might be a TDLS station */ +- sta = sta_info_get(sdata, skb->data); +- if (sta) +- break; +- +- ra = sdata->deflink.u.mgd.bssid; +- break; +- case NL80211_IFTYPE_ADHOC: +- ra = skb->data; +- break; +- default: +- break; +- } +- +- if (!sta && ra && !is_multicast_ether_addr(ra)) +- sta = sta_info_get(sdata, ra); +- +- ret = __ieee80211_select_queue(sdata, sta, skb); +- +- rcu_read_unlock(); +- return ret; +-} +- + /** + * ieee80211_set_qos_hdr - Fill in the QoS header if there is one. + * +--- a/net/mac80211/wme.h ++++ b/net/mac80211/wme.h +@@ -13,10 +13,8 @@ + u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb, + struct ieee80211_hdr *hdr); +-u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, +- struct sta_info *sta, struct sk_buff *skb); + u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, +- struct sk_buff *skb); ++ struct sta_info *sta, struct sk_buff *skb); + void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb); + diff --git a/package/kernel/mac80211/patches/subsys/306-04-wifi-realtek-remove-duplicated-wake_tx_queue.patch b/package/kernel/mac80211/patches/subsys/306-04-wifi-realtek-remove-duplicated-wake_tx_queue.patch new file mode 100644 index 00000000000..f0dfc75a788 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/306-04-wifi-realtek-remove-duplicated-wake_tx_queue.patch @@ -0,0 +1,32 @@ +From: Johannes Berg +Date: Mon, 10 Oct 2022 19:17:46 +0200 +Subject: [PATCH] wifi: realtek: remove duplicated wake_tx_queue + +By accident, the previous patch duplicated the initialization +of the wake_tx_queue callback. Fix that by removing the new +initializations. + +Fixes: a790cc3a4fad ("wifi: mac80211: add wake_tx_queue callback to drivers") +Signed-off-by: Johannes Berg +--- + +--- a/drivers/net/wireless/realtek/rtw88/mac80211.c ++++ b/drivers/net/wireless/realtek/rtw88/mac80211.c +@@ -896,7 +896,6 @@ static void rtw_ops_sta_rc_update(struct + + const struct ieee80211_ops rtw_ops = { + .tx = rtw_ops_tx, +- .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .wake_tx_queue = rtw_ops_wake_tx_queue, + .start = rtw_ops_start, + .stop = rtw_ops_stop, +--- a/drivers/net/wireless/realtek/rtw89/mac80211.c ++++ b/drivers/net/wireless/realtek/rtw89/mac80211.c +@@ -918,7 +918,6 @@ static int rtw89_ops_set_tid_config(stru + + const struct ieee80211_ops rtw89_ops = { + .tx = rtw89_ops_tx, +- .wake_tx_queue = ieee80211_handle_wake_tx_queue, + .wake_tx_queue = rtw89_ops_wake_tx_queue, + .start = rtw89_ops_start, + .stop = rtw89_ops_stop, diff --git a/package/kernel/mac80211/patches/subsys/306-v5.17-mac80211-use-coarse-boottime-for-airtime-fairness-co.patch b/package/kernel/mac80211/patches/subsys/306-v5.17-mac80211-use-coarse-boottime-for-airtime-fairness-co.patch deleted file mode 100644 index c43cd3acb9f..00000000000 --- a/package/kernel/mac80211/patches/subsys/306-v5.17-mac80211-use-coarse-boottime-for-airtime-fairness-co.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: Felix Fietkau -Date: Tue, 14 Dec 2021 17:53:12 +0100 -Subject: [PATCH] mac80211: use coarse boottime for airtime fairness code - -The time values used by the airtime fairness code only need to be accurate -enough to cover station activity detection. -Using ktime_get_coarse_boottime_ns instead of ktime_get_boottime_ns will -drop the accuracy down to jiffies intervals, but at the same time saves -a lot of CPU cycles in a hot path - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3820,7 +3820,7 @@ struct ieee80211_txq *ieee80211_next_txq - { - struct ieee80211_local *local = hw_to_local(hw); - struct airtime_sched_info *air_sched; -- u64 now = ktime_get_boottime_ns(); -+ u64 now = ktime_get_coarse_boottime_ns(); - struct ieee80211_txq *ret = NULL; - struct airtime_info *air_info; - struct txq_info *txqi = NULL; -@@ -3947,7 +3947,7 @@ void ieee80211_update_airtime_weight(str - u64 weight_sum = 0; - - if (unlikely(!now)) -- now = ktime_get_boottime_ns(); -+ now = ktime_get_coarse_boottime_ns(); - - lockdep_assert_held(&air_sched->lock); - -@@ -3973,7 +3973,7 @@ void ieee80211_schedule_txq(struct ieee8 - struct ieee80211_local *local = hw_to_local(hw); - struct txq_info *txqi = to_txq_info(txq); - struct airtime_sched_info *air_sched; -- u64 now = ktime_get_boottime_ns(); -+ u64 now = ktime_get_coarse_boottime_ns(); - struct airtime_info *air_info; - u8 ac = txq->ac; - bool was_active; -@@ -4031,7 +4031,7 @@ static void __ieee80211_unschedule_txq(s - - if (!purge) - airtime_set_active(air_sched, air_info, -- ktime_get_boottime_ns()); -+ ktime_get_coarse_boottime_ns()); - - rb_erase_cached(&txqi->schedule_order, - &air_sched->active_txqs); -@@ -4119,7 +4119,7 @@ bool ieee80211_txq_may_transmit(struct i - if (RB_EMPTY_NODE(&txqi->schedule_order)) - goto out; - -- now = ktime_get_boottime_ns(); -+ now = ktime_get_coarse_boottime_ns(); - - /* Like in ieee80211_next_txq(), make sure the first station in the - * scheduling order is eligible for transmission to avoid starvation. diff --git a/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch b/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch deleted file mode 100644 index 9c3b38adbfa..00000000000 --- a/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch +++ /dev/null @@ -1,74 +0,0 @@ -From: Felix Fietkau -Date: Mon, 24 May 2021 11:46:09 +0200 -Subject: [PATCH] mac80211_hwsim: make 6 GHz channels usable - -The previous commit that claimed to add 6 GHz channels didn't actually make -them usable, since the 6 GHz band was not registered with mac80211. - -Fixes: 28881922abd7 ("mac80211_hwsim: add 6GHz channels") -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -3008,15 +3008,19 @@ static void mac80211_hwsim_he_capab(stru - { - u16 n_iftype_data; - -- if (sband->band == NL80211_BAND_2GHZ) { -+ switch (sband->band) { -+ case NL80211_BAND_2GHZ: - n_iftype_data = ARRAY_SIZE(he_capa_2ghz); - sband->iftype_data = - (struct ieee80211_sband_iftype_data *)he_capa_2ghz; -- } else if (sband->band == NL80211_BAND_5GHZ) { -+ break; -+ case NL80211_BAND_5GHZ: -+ case NL80211_BAND_6GHZ: - n_iftype_data = ARRAY_SIZE(he_capa_5ghz); - sband->iftype_data = - (struct ieee80211_sband_iftype_data *)he_capa_5ghz; -- } else { -+ break; -+ default: - return; - } - -@@ -3306,6 +3310,12 @@ static int mac80211_hwsim_new_radio(stru - sband->vht_cap.vht_mcs.tx_mcs_map = - sband->vht_cap.vht_mcs.rx_mcs_map; - break; -+ case NL80211_BAND_6GHZ: -+ sband->channels = data->channels_6ghz; -+ sband->n_channels = ARRAY_SIZE(hwsim_channels_6ghz); -+ sband->bitrates = data->rates + 4; -+ sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4; -+ break; - case NL80211_BAND_S1GHZ: - memcpy(&sband->s1g_cap, &hwsim_s1g_cap, - sizeof(sband->s1g_cap)); -@@ -3316,6 +3326,13 @@ static int mac80211_hwsim_new_radio(stru - continue; - } - -+ mac80211_hwsim_he_capab(sband); -+ -+ hw->wiphy->bands[band] = sband; -+ -+ if (band == NL80211_BAND_6GHZ) -+ continue; -+ - sband->ht_cap.ht_supported = true; - sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | - IEEE80211_HT_CAP_GRN_FLD | -@@ -3329,10 +3346,6 @@ static int mac80211_hwsim_new_radio(stru - sband->ht_cap.mcs.rx_mask[0] = 0xff; - sband->ht_cap.mcs.rx_mask[1] = 0xff; - sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; -- -- mac80211_hwsim_he_capab(sband); -- -- hw->wiphy->bands[band] = sband; - } - - /* By default all radios belong to the first group */ diff --git a/package/kernel/mac80211/patches/subsys/308-v5.17-mac80211-add-support-for-.ndo_fill_forward_path.patch b/package/kernel/mac80211/patches/subsys/308-v5.17-mac80211-add-support-for-.ndo_fill_forward_path.patch deleted file mode 100644 index a9a6182ab29..00000000000 --- a/package/kernel/mac80211/patches/subsys/308-v5.17-mac80211-add-support-for-.ndo_fill_forward_path.patch +++ /dev/null @@ -1,178 +0,0 @@ -From: Felix Fietkau -Date: Fri, 12 Nov 2021 12:22:23 +0100 -Subject: [PATCH] mac80211: add support for .ndo_fill_forward_path - -This allows drivers to provide a destination device + info for flow offload -Only supported in combination with 802.3 encap offload - -Signed-off-by: Felix Fietkau -Tested-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/20211112112223.1209-1-nbd@nbd.name -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -3937,6 +3937,8 @@ struct ieee80211_prep_tx_info { - * twt structure. - * @twt_teardown_request: Update the hw with TWT teardown request received - * from the peer. -+ * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to -+ * resolve a path for hardware flow offloading - */ - struct ieee80211_ops { - void (*tx)(struct ieee80211_hw *hw, -@@ -4265,6 +4267,13 @@ struct ieee80211_ops { - struct ieee80211_twt_setup *twt); - void (*twt_teardown_request)(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 flowid); -+#if LINUX_VERSION_IS_GEQ(5,10,0) -+ int (*net_fill_forward_path)(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_sta *sta, -+ struct net_device_path_ctx *ctx, -+ struct net_device_path *path); -+#endif - }; - - /** ---- a/net/mac80211/driver-ops.h -+++ b/net/mac80211/driver-ops.h -@@ -1486,4 +1486,28 @@ static inline void drv_twt_teardown_requ - trace_drv_return_void(local); - } - -+#if LINUX_VERSION_IS_GEQ(5,10,0) -+static inline int drv_net_fill_forward_path(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta, -+ struct net_device_path_ctx *ctx, -+ struct net_device_path *path) -+{ -+ int ret = -EOPNOTSUPP; -+ -+ sdata = get_bss_sdata(sdata); -+ if (!check_sdata_in_driver(sdata)) -+ return -EIO; -+ -+ trace_drv_net_fill_forward_path(local, sdata, sta); -+ if (local->ops->net_fill_forward_path) -+ ret = local->ops->net_fill_forward_path(&local->hw, -+ &sdata->vif, sta, -+ ctx, path); -+ trace_drv_return_int(local, ret); -+ -+ return ret; -+} -+#endif -+ - #endif /* __MAC80211_DRIVER_OPS */ ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1489,7 +1489,7 @@ struct ieee80211_local { - }; - - static inline struct ieee80211_sub_if_data * --IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) -+IEEE80211_DEV_TO_SUB_IF(const struct net_device *dev) - { - return netdev_priv(dev); - } ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -822,6 +822,66 @@ static const struct net_device_ops ieee8 - - }; - -+#if LINUX_VERSION_IS_GEQ(5,10,0) -+static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx, -+ struct net_device_path *path) -+{ -+ struct ieee80211_sub_if_data *sdata; -+ struct ieee80211_local *local; -+ struct sta_info *sta; -+ int ret = -ENOENT; -+ -+ sdata = IEEE80211_DEV_TO_SUB_IF(ctx->dev); -+ local = sdata->local; -+ -+ if (!local->ops->net_fill_forward_path) -+ return -EOPNOTSUPP; -+ -+ rcu_read_lock(); -+ switch (sdata->vif.type) { -+ case NL80211_IFTYPE_AP_VLAN: -+ sta = rcu_dereference(sdata->u.vlan.sta); -+ if (sta) -+ break; -+ if (sdata->wdev.use_4addr) -+ goto out; -+ if (is_multicast_ether_addr(ctx->daddr)) -+ goto out; -+ sta = sta_info_get_bss(sdata, ctx->daddr); -+ break; -+ case NL80211_IFTYPE_AP: -+ if (is_multicast_ether_addr(ctx->daddr)) -+ goto out; -+ sta = sta_info_get(sdata, ctx->daddr); -+ break; -+ case NL80211_IFTYPE_STATION: -+ if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) { -+ sta = sta_info_get(sdata, ctx->daddr); -+ if (sta && test_sta_flag(sta, WLAN_STA_TDLS_PEER)) { -+ if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) -+ goto out; -+ -+ break; -+ } -+ } -+ -+ sta = sta_info_get(sdata, sdata->u.mgd.bssid); -+ break; -+ default: -+ goto out; -+ } -+ -+ if (!sta) -+ goto out; -+ -+ ret = drv_net_fill_forward_path(local, sdata, &sta->sta, ctx, path); -+out: -+ rcu_read_unlock(); -+ -+ return ret; -+} -+#endif -+ - static const struct net_device_ops ieee80211_dataif_8023_ops = { - #if LINUX_VERSION_IS_LESS(4,10,0) - .ndo_change_mtu = __change_mtu, -@@ -839,7 +899,9 @@ static const struct net_device_ops ieee8 - #else - .ndo_get_stats64 = bp_ieee80211_get_stats64, - #endif -- -+#if LINUX_VERSION_IS_GEQ(5,10,0) -+ .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, -+#endif - }; - - static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype) ---- a/net/mac80211/trace.h -+++ b/net/mac80211/trace.h -@@ -2892,6 +2892,15 @@ TRACE_EVENT(drv_twt_teardown_request, - ) - ); - -+#if LINUX_VERSION_IS_GEQ(5,10,0) -+DEFINE_EVENT(sta_event, drv_net_fill_forward_path, -+ TP_PROTO(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta), -+ TP_ARGS(local, sdata, sta) -+); -+#endif -+ - #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ - - #undef TRACE_INCLUDE_PATH diff --git a/package/kernel/mac80211/patches/subsys/364-mac80211-add-support-for-restricting-netdev-features.patch b/package/kernel/mac80211/patches/subsys/310-mac80211-add-support-for-restricting-netdev-features.patch similarity index 86% rename from package/kernel/mac80211/patches/subsys/364-mac80211-add-support-for-restricting-netdev-features.patch rename to package/kernel/mac80211/patches/subsys/310-mac80211-add-support-for-restricting-netdev-features.patch index d133ed91eb1..cd6048b4fd0 100644 --- a/package/kernel/mac80211/patches/subsys/364-mac80211-add-support-for-restricting-netdev-features.patch +++ b/package/kernel/mac80211/patches/subsys/310-mac80211-add-support-for-restricting-netdev-features.patch @@ -59,10 +59,10 @@ Signed-off-by: Felix Fietkau flow = fq_find_fattest_flow(fq); --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1685,6 +1685,10 @@ enum ieee80211_offload_flags { - * write-protected by sdata_lock and local->mtx so holding either is fine - * for read access. - * @mu_mimo_owner: indicates interface owns MU-MIMO capability +@@ -1807,6 +1807,10 @@ struct ieee80211_vif_cfg { + * @addr: address of this interface + * @p2p: indicates whether this AP or STA interface is a p2p + * interface, i.e. a GO or p2p-sta respectively + * @netdev_features: tx netdev features supported by the hardware for this + * vif. mac80211 initializes this to hw->netdev_features, and the driver + * can mask out specific tx features. mac80211 will handle software fixup @@ -70,9 +70,9 @@ Signed-off-by: Felix Fietkau * @driver_flags: flags/capabilities the driver has for this interface, * these need to be set (or cleared) when the interface is added * or, if supported by the driver, the interface type is changed -@@ -1736,6 +1740,7 @@ struct ieee80211_vif { +@@ -1848,6 +1852,7 @@ struct ieee80211_vif { - struct ieee80211_chanctx_conf __rcu *chanctx_conf; + struct ieee80211_txq *txq; + netdev_features_t netdev_features; u32 driver_flags; @@ -80,8 +80,8 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -2209,6 +2209,7 @@ int ieee80211_if_add(struct ieee80211_lo - ndev->features |= local->hw.netdev_features; +@@ -2179,6 +2179,7 @@ int ieee80211_if_add(struct ieee80211_lo + ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; ndev->hw_features |= ndev->features & MAC80211_SUPPORTED_FEATURES_TX; + sdata->vif.netdev_features = local->hw.netdev_features; @@ -90,7 +90,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -1310,7 +1310,11 @@ static struct txq_info *ieee80211_get_tx +@@ -1355,7 +1355,11 @@ static struct txq_info *ieee80211_get_tx static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb) { @@ -103,7 +103,7 @@ Signed-off-by: Felix Fietkau } static u32 codel_skb_len_func(const struct sk_buff *skb) -@@ -3499,47 +3503,71 @@ ieee80211_xmit_fast_finish(struct ieee80 +@@ -3578,55 +3582,79 @@ ieee80211_xmit_fast_finish(struct ieee80 return TX_CONTINUE; } @@ -167,8 +167,9 @@ Signed-off-by: Felix Fietkau + + consume_skb(skb); + return segs; -+ } -+ + } + +- /* after this point (skb is modified) we cannot return false */ + if (skb_needs_linearize(skb, features) && __skb_linearize(skb)) + goto free; + @@ -182,9 +183,8 @@ Signed-off-by: Felix Fietkau + + if (skb_csum_hwoffload_help(skb, features)) + goto free; - } - -- /* after this point (skb is modified) we cannot return false */ ++ } ++ + skb_mark_not_on_list(skb); + return skb; + @@ -207,15 +207,10 @@ Signed-off-by: Felix Fietkau + int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); + struct ethhdr eth; - if (skb_shared(skb)) { - struct sk_buff *tmp_skb = skb; -@@ -3548,12 +3576,12 @@ static bool ieee80211_xmit_fast(struct i - kfree_skb(tmp_skb); - - if (!skb) -- return true; -+ return; - } + skb = skb_share_check(skb, GFP_ATOMIC); + if (unlikely(!skb)) +- return true; ++ return; if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) && ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb)) @@ -224,7 +219,7 @@ Signed-off-by: Felix Fietkau /* will not be crypto-handled beyond what we do here, so use false * as the may-encrypt argument for the resize to not account for -@@ -3562,10 +3590,8 @@ static bool ieee80211_xmit_fast(struct i +@@ -3635,10 +3663,8 @@ static bool ieee80211_xmit_fast(struct i if (unlikely(ieee80211_skb_resize(sdata, skb, max_t(int, extra_head + hw_headroom - skb_headroom(skb), 0), @@ -237,16 +232,16 @@ Signed-off-by: Felix Fietkau memcpy(ð, skb->data, ETH_HLEN - 2); hdr = skb_push(skb, extra_head); -@@ -3579,7 +3605,7 @@ static bool ieee80211_xmit_fast(struct i +@@ -3652,7 +3678,7 @@ static bool ieee80211_xmit_fast(struct i info->control.vif = &sdata->vif; info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT | IEEE80211_TX_CTL_DONTFRAG | - (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0); + (ampdu ? IEEE80211_TX_CTL_AMPDU : 0); - info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT; - - #ifdef CPTCFG_MAC80211_DEBUGFS -@@ -3601,16 +3627,14 @@ static bool ieee80211_xmit_fast(struct i + info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT | + u32_encode_bits(IEEE80211_LINK_UNSPECIFIED, + IEEE80211_TX_CTRL_MLO_LINK); +@@ -3676,16 +3702,14 @@ static bool ieee80211_xmit_fast(struct i tx.key = fast_tx->key; if (ieee80211_queue_skb(local, sdata, sta, skb)) @@ -266,7 +261,7 @@ Signed-off-by: Felix Fietkau if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) sdata = container_of(sdata->bss, -@@ -3618,6 +3642,55 @@ static bool ieee80211_xmit_fast(struct i +@@ -3693,6 +3717,56 @@ static bool ieee80211_xmit_fast(struct i __skb_queue_tail(&tx.skbs, skb); ieee80211_tx_frags(local, &sdata->vif, sta, &tx.skbs, false); @@ -310,6 +305,7 @@ Signed-off-by: Felix Fietkau + } + } + ++ /* after this point (skb is modified) we cannot return false */ + skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata)); + if (!skb) + return true; @@ -322,7 +318,7 @@ Signed-off-by: Felix Fietkau return true; } -@@ -4123,31 +4196,14 @@ void __ieee80211_subif_start_xmit(struct +@@ -4193,31 +4267,14 @@ void __ieee80211_subif_start_xmit(struct goto out; } @@ -362,7 +358,7 @@ Signed-off-by: Felix Fietkau } skb_list_walk_safe(skb, skb, next) { -@@ -4310,9 +4366,11 @@ netdev_tx_t ieee80211_subif_start_xmit(s +@@ -4435,9 +4492,11 @@ normal: return NETDEV_TX_OK; } @@ -377,7 +373,7 @@ Signed-off-by: Felix Fietkau { struct ieee80211_local *local = sdata->local; struct ieee80211_tx_control control = {}; -@@ -4321,14 +4379,6 @@ static bool ieee80211_tx_8023(struct iee +@@ -4446,14 +4505,6 @@ static bool ieee80211_tx_8023(struct iee unsigned long flags; int q = info->hw_queue; @@ -392,7 +388,7 @@ Signed-off-by: Felix Fietkau spin_lock_irqsave(&local->queue_stop_reason_lock, flags); if (local->queue_stop_reasons[q] || -@@ -4355,27 +4405,50 @@ static bool ieee80211_tx_8023(struct iee +@@ -4480,6 +4531,26 @@ static bool ieee80211_tx_8023(struct iee return true; } @@ -419,9 +415,8 @@ Signed-off-by: Felix Fietkau static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata, struct net_device *dev, struct sta_info *sta, struct ieee80211_key *key, struct sk_buff *skb) - { -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -+ struct ieee80211_tx_info *info; +@@ -4487,9 +4558,13 @@ static void ieee80211_8023_xmit(struct i + struct ieee80211_tx_info *info; struct ieee80211_local *local = sdata->local; struct tid_ampdu_tx *tid_tx; + struct sk_buff *seg, *next; @@ -429,25 +424,23 @@ Signed-off-by: Felix Fietkau + u16 queue; u8 tid; - if (local->ops->wake_tx_queue) { -- u16 queue = __ieee80211_select_queue(sdata, sta, skb); -+ queue = __ieee80211_select_queue(sdata, sta, skb); - skb_set_queue_mapping(skb, queue); - skb_get_hash(skb); -+ } else { -+ queue = skb_get_queue_mapping(skb); - } +- skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); ++ queue = ieee80211_select_queue(sdata, sta, skb); ++ skb_set_queue_mapping(skb, queue); if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning)) && test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) - goto out_free; +@@ -4499,9 +4574,6 @@ static void ieee80211_8023_xmit(struct i + if (unlikely(!skb)) + return; +- info = IEEE80211_SKB_CB(skb); - memset(info, 0, sizeof(*info)); - ieee80211_aggr_check(sdata, sta, skb); tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -@@ -4387,22 +4460,20 @@ static void ieee80211_8023_xmit(struct i +@@ -4515,22 +4587,20 @@ static void ieee80211_8023_xmit(struct i return; } @@ -472,13 +465,13 @@ Signed-off-by: Felix Fietkau - dev_sw_netstats_tx_add(dev, 1, skb->len); - -- sta->tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len; -- sta->tx_stats.packets[skb_get_queue_mapping(skb)]++; +- sta->deflink.tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len; +- sta->deflink.tx_stats.packets[skb_get_queue_mapping(skb)]++; + info->hw_queue = sdata->vif.hw_queue[queue]; if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) sdata = container_of(sdata->bss, -@@ -4414,6 +4485,24 @@ static void ieee80211_8023_xmit(struct i +@@ -4542,6 +4612,24 @@ static void ieee80211_8023_xmit(struct i if (key) info->control.hw_key = &key->conf; @@ -495,15 +488,15 @@ Signed-off-by: Felix Fietkau + &info->flags, NULL); + + dev_sw_netstats_tx_add(dev, skbs, len); -+ sta->tx_stats.packets[queue] += skbs; -+ sta->tx_stats.bytes[queue] += len; ++ sta->deflink.tx_stats.packets[queue] += skbs; ++ sta->deflink.tx_stats.bytes[queue] += len; + + ieee80211_tpt_led_trig_tx(local, len); + ieee80211_tx_8023(sdata, skb, sta, false); return; -@@ -4455,6 +4544,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8 +@@ -4583,6 +4671,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8 key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)) goto skip_offload; diff --git a/package/kernel/mac80211/patches/subsys/312-v5.16-mac80211-split-beacon-retrieval-functions.patch b/package/kernel/mac80211/patches/subsys/312-v5.16-mac80211-split-beacon-retrieval-functions.patch deleted file mode 100644 index 18b1951f6e7..00000000000 --- a/package/kernel/mac80211/patches/subsys/312-v5.16-mac80211-split-beacon-retrieval-functions.patch +++ /dev/null @@ -1,262 +0,0 @@ -From: Aloka Dixit -Date: Tue, 5 Oct 2021 21:09:36 -0700 -Subject: [PATCH] mac80211: split beacon retrieval functions - -Split __ieee80211_beacon_get() into a separate function for AP mode -ieee80211_beacon_get_ap(). -Also, move the code common to all modes (AP, adhoc and mesh) to -a separate function ieee80211_beacon_get_finish(). - -Signed-off-by: Aloka Dixit -Link: https://lore.kernel.org/r/20211006040938.9531-2-alokad@codeaurora.org -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -4987,6 +4987,115 @@ static int ieee80211_beacon_protect(stru - return 0; - } - -+static void -+ieee80211_beacon_get_finish(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_mutable_offsets *offs, -+ struct beacon_data *beacon, -+ struct sk_buff *skb, -+ struct ieee80211_chanctx_conf *chanctx_conf, -+ u16 csa_off_base) -+{ -+ struct ieee80211_local *local = hw_to_local(hw); -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); -+ struct ieee80211_tx_info *info; -+ enum nl80211_band band; -+ struct ieee80211_tx_rate_control txrc; -+ -+ /* CSA offsets */ -+ if (offs && beacon) { -+ u16 i; -+ -+ for (i = 0; i < IEEE80211_MAX_CNTDWN_COUNTERS_NUM; i++) { -+ u16 csa_off = beacon->cntdwn_counter_offsets[i]; -+ -+ if (!csa_off) -+ continue; -+ -+ offs->cntdwn_counter_offs[i] = csa_off_base + csa_off; -+ } -+ } -+ -+ band = chanctx_conf->def.chan->band; -+ info = IEEE80211_SKB_CB(skb); -+ info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; -+ info->flags |= IEEE80211_TX_CTL_NO_ACK; -+ info->band = band; -+ -+ memset(&txrc, 0, sizeof(txrc)); -+ txrc.hw = hw; -+ txrc.sband = local->hw.wiphy->bands[band]; -+ txrc.bss_conf = &sdata->vif.bss_conf; -+ txrc.skb = skb; -+ txrc.reported_rate.idx = -1; -+ if (sdata->beacon_rate_set && sdata->beacon_rateidx_mask[band]) -+ txrc.rate_idx_mask = sdata->beacon_rateidx_mask[band]; -+ else -+ txrc.rate_idx_mask = sdata->rc_rateidx_mask[band]; -+ txrc.bss = true; -+ rate_control_get_rate(sdata, NULL, &txrc); -+ -+ info->control.vif = vif; -+ info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT | -+ IEEE80211_TX_CTL_ASSIGN_SEQ | -+ IEEE80211_TX_CTL_FIRST_FRAGMENT; -+} -+ -+static struct sk_buff * -+ieee80211_beacon_get_ap(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_mutable_offsets *offs, -+ bool is_template, -+ struct beacon_data *beacon, -+ struct ieee80211_chanctx_conf *chanctx_conf) -+{ -+ struct ieee80211_local *local = hw_to_local(hw); -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); -+ struct ieee80211_if_ap *ap = &sdata->u.ap; -+ struct sk_buff *skb = NULL; -+ u16 csa_off_base = 0; -+ -+ if (beacon->cntdwn_counter_offsets[0]) { -+ if (!is_template) -+ ieee80211_beacon_update_cntdwn(vif); -+ -+ ieee80211_set_beacon_cntdwn(sdata, beacon); -+ } -+ -+ /* headroom, head length, -+ * tail length and maximum TIM length -+ */ -+ skb = dev_alloc_skb(local->tx_headroom + beacon->head_len + -+ beacon->tail_len + 256 + -+ local->hw.extra_beacon_tailroom); -+ if (!skb) -+ return NULL; -+ -+ skb_reserve(skb, local->tx_headroom); -+ skb_put_data(skb, beacon->head, beacon->head_len); -+ -+ ieee80211_beacon_add_tim(sdata, &ap->ps, skb, is_template); -+ -+ if (offs) { -+ offs->tim_offset = beacon->head_len; -+ offs->tim_length = skb->len - beacon->head_len; -+ offs->cntdwn_counter_offs[0] = beacon->cntdwn_counter_offsets[0]; -+ -+ /* for AP the csa offsets are from tail */ -+ csa_off_base = skb->len; -+ } -+ -+ if (beacon->tail) -+ skb_put_data(skb, beacon->tail, beacon->tail_len); -+ -+ if (ieee80211_beacon_protect(skb, local, sdata) < 0) -+ return NULL; -+ -+ ieee80211_beacon_get_finish(hw, vif, offs, beacon, skb, chanctx_conf, -+ csa_off_base); -+ return skb; -+} -+ - static struct sk_buff * - __ieee80211_beacon_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, -@@ -4996,12 +5105,8 @@ __ieee80211_beacon_get(struct ieee80211_ - struct ieee80211_local *local = hw_to_local(hw); - struct beacon_data *beacon = NULL; - struct sk_buff *skb = NULL; -- struct ieee80211_tx_info *info; - struct ieee80211_sub_if_data *sdata = NULL; -- enum nl80211_band band; -- struct ieee80211_tx_rate_control txrc; - struct ieee80211_chanctx_conf *chanctx_conf; -- int csa_off_base = 0; - - rcu_read_lock(); - -@@ -5018,48 +5123,11 @@ __ieee80211_beacon_get(struct ieee80211_ - struct ieee80211_if_ap *ap = &sdata->u.ap; - - beacon = rcu_dereference(ap->beacon); -- if (beacon) { -- if (beacon->cntdwn_counter_offsets[0]) { -- if (!is_template) -- ieee80211_beacon_update_cntdwn(vif); -- -- ieee80211_set_beacon_cntdwn(sdata, beacon); -- } -- -- /* -- * headroom, head length, -- * tail length and maximum TIM length -- */ -- skb = dev_alloc_skb(local->tx_headroom + -- beacon->head_len + -- beacon->tail_len + 256 + -- local->hw.extra_beacon_tailroom); -- if (!skb) -- goto out; -- -- skb_reserve(skb, local->tx_headroom); -- skb_put_data(skb, beacon->head, beacon->head_len); -- -- ieee80211_beacon_add_tim(sdata, &ap->ps, skb, -- is_template); -- -- if (offs) { -- offs->tim_offset = beacon->head_len; -- offs->tim_length = skb->len - beacon->head_len; -- offs->cntdwn_counter_offs[0] = beacon->cntdwn_counter_offsets[0]; -- -- /* for AP the csa offsets are from tail */ -- csa_off_base = skb->len; -- } -- -- if (beacon->tail) -- skb_put_data(skb, beacon->tail, -- beacon->tail_len); -- -- if (ieee80211_beacon_protect(skb, local, sdata) < 0) -- goto out; -- } else -+ if (!beacon) - goto out; -+ -+ skb = ieee80211_beacon_get_ap(hw, vif, offs, is_template, -+ beacon, chanctx_conf); - } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_hdr *hdr; -@@ -5085,6 +5153,9 @@ __ieee80211_beacon_get(struct ieee80211_ - hdr = (struct ieee80211_hdr *) skb->data; - hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_BEACON); -+ -+ ieee80211_beacon_get_finish(hw, vif, offs, beacon, skb, -+ chanctx_conf, 0); - } else if (ieee80211_vif_is_mesh(&sdata->vif)) { - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - -@@ -5124,51 +5195,13 @@ __ieee80211_beacon_get(struct ieee80211_ - } - - skb_put_data(skb, beacon->tail, beacon->tail_len); -+ ieee80211_beacon_get_finish(hw, vif, offs, beacon, skb, -+ chanctx_conf, 0); - } else { - WARN_ON(1); - goto out; - } - -- /* CSA offsets */ -- if (offs && beacon) { -- int i; -- -- for (i = 0; i < IEEE80211_MAX_CNTDWN_COUNTERS_NUM; i++) { -- u16 csa_off = beacon->cntdwn_counter_offsets[i]; -- -- if (!csa_off) -- continue; -- -- offs->cntdwn_counter_offs[i] = csa_off_base + csa_off; -- } -- } -- -- band = chanctx_conf->def.chan->band; -- -- info = IEEE80211_SKB_CB(skb); -- -- info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; -- info->flags |= IEEE80211_TX_CTL_NO_ACK; -- info->band = band; -- -- memset(&txrc, 0, sizeof(txrc)); -- txrc.hw = hw; -- txrc.sband = local->hw.wiphy->bands[band]; -- txrc.bss_conf = &sdata->vif.bss_conf; -- txrc.skb = skb; -- txrc.reported_rate.idx = -1; -- if (sdata->beacon_rate_set && sdata->beacon_rateidx_mask[band]) -- txrc.rate_idx_mask = sdata->beacon_rateidx_mask[band]; -- else -- txrc.rate_idx_mask = sdata->rc_rateidx_mask[band]; -- txrc.bss = true; -- rate_control_get_rate(sdata, NULL, &txrc); -- -- info->control.vif = vif; -- -- info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT | -- IEEE80211_TX_CTL_ASSIGN_SEQ | -- IEEE80211_TX_CTL_FIRST_FRAGMENT; - out: - rcu_read_unlock(); - return skb; diff --git a/package/kernel/mac80211/patches/subsys/313-v5.16-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/313-v5.16-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch deleted file mode 100644 index 429886d701d..00000000000 --- a/package/kernel/mac80211/patches/subsys/313-v5.16-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch +++ /dev/null @@ -1,493 +0,0 @@ -From: John Crispin -Date: Wed, 15 Sep 2021 19:54:34 -0700 -Subject: [PATCH] nl80211: MBSSID and EMA support in AP mode - -Add new attributes to configure support for multiple BSSID -and advanced multi-BSSID advertisements (EMA) in AP mode. - -- NL80211_ATTR_MBSSID_CONFIG used for per interface configuration. -- NL80211_ATTR_MBSSID_ELEMS used to MBSSID elements for beacons. - -Memory for the elements is allocated dynamically. This change frees -the memory in existing functions which call nl80211_parse_beacon(), -a comment is added to indicate the new references to do the same. - -Signed-off-by: John Crispin -Co-developed-by: Aloka Dixit -Signed-off-by: Aloka Dixit -Link: https://lore.kernel.org/r/20210916025437.29138-2-alokad@codeaurora.org -[don't leave ERR_PTR hanging around] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -1046,6 +1046,36 @@ struct cfg80211_crypto_settings { - }; - - /** -+ * struct cfg80211_mbssid_config - AP settings for multi bssid -+ * -+ * @tx_wdev: pointer to the transmitted interface in the MBSSID set -+ * @index: index of this AP in the multi bssid group. -+ * @ema: set to true if the beacons should be sent out in EMA mode. -+ */ -+struct cfg80211_mbssid_config { -+ struct wireless_dev *tx_wdev; -+ u8 index; -+ bool ema; -+}; -+ -+/** -+ * struct cfg80211_mbssid_elems - Multiple BSSID elements -+ * -+ * @cnt: Number of elements in array %elems. -+ * -+ * @elem: Array of multiple BSSID element(s) to be added into Beacon frames. -+ * @elem.data: Data for multiple BSSID elements. -+ * @elem.len: Length of data. -+ */ -+struct cfg80211_mbssid_elems { -+ u8 cnt; -+ struct { -+ const u8 *data; -+ size_t len; -+ } elem[]; -+}; -+ -+/** - * struct cfg80211_beacon_data - beacon data - * @head: head portion of beacon (before TIM IE) - * or %NULL if not changed -@@ -1063,6 +1093,7 @@ struct cfg80211_crypto_settings { - * @assocresp_ies_len: length of assocresp_ies in octets - * @probe_resp_len: length of probe response template (@probe_resp) - * @probe_resp: probe response template (AP mode only) -+ * @mbssid_ies: multiple BSSID elements - * @ftm_responder: enable FTM responder functionality; -1 for no change - * (which also implies no change in LCI/civic location data) - * @lci: Measurement Report element content, starting with Measurement Token -@@ -1080,6 +1111,7 @@ struct cfg80211_beacon_data { - const u8 *probe_resp; - const u8 *lci; - const u8 *civicloc; -+ struct cfg80211_mbssid_elems *mbssid_ies; - s8 ftm_responder; - - size_t head_len, tail_len; -@@ -1194,6 +1226,7 @@ enum cfg80211_ap_settings_flags { - * @he_oper: HE operation IE (or %NULL if HE isn't enabled) - * @fils_discovery: FILS discovery transmission parameters - * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters -+ * @mbssid_config: AP settings for multiple bssid - */ - struct cfg80211_ap_settings { - struct cfg80211_chan_def chandef; -@@ -1226,6 +1259,7 @@ struct cfg80211_ap_settings { - struct cfg80211_he_bss_color he_bss_color; - struct cfg80211_fils_discovery fils_discovery; - struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; -+ struct cfg80211_mbssid_config mbssid_config; - }; - - /** -@@ -4986,6 +5020,13 @@ struct wiphy_iftype_akm_suites { - * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes - * @sar_capa: SAR control capabilities - * @rfkill: a pointer to the rfkill structure -+ * -+ * @mbssid_max_interfaces: maximum number of interfaces supported by the driver -+ * in a multiple BSSID set. This field must be set to a non-zero value -+ * by the driver to advertise MBSSID support. -+ * @mbssid_max_ema_profile_periodicity: maximum profile periodicity supported by -+ * the driver. Setting this field to a non-zero value indicates that the -+ * driver supports enhanced multi-BSSID advertisements (EMA AP). - */ - struct wiphy { - struct mutex mtx; -@@ -5133,6 +5174,9 @@ struct wiphy { - - struct rfkill *rfkill; - -+ u8 mbssid_max_interfaces; -+ u8 ema_max_profile_periodicity; -+ - char priv[] __aligned(NETDEV_ALIGN); - }; - ---- a/include/uapi/linux/nl80211.h -+++ b/include/uapi/linux/nl80211.h -@@ -337,7 +337,10 @@ - * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes - * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from - * userspace to request deletion of a virtual interface, then requires -- * attribute %NL80211_ATTR_IFINDEX. -+ * attribute %NL80211_ATTR_IFINDEX. If multiple BSSID advertisements are -+ * enabled using %NL80211_ATTR_MBSSID_CONFIG, %NL80211_ATTR_MBSSID_ELEMS, -+ * and if this command is used for the transmitting interface, then all -+ * the non-transmitting interfaces are deleted as well. - * - * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified - * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. -@@ -2593,6 +2596,18 @@ enum nl80211_commands { - * @NL80211_ATTR_COLOR_CHANGE_ELEMS: Nested set of attributes containing the IE - * information for the time while performing a color switch. - * -+ * @NL80211_ATTR_MBSSID_CONFIG: Nested attribute for multiple BSSID -+ * advertisements (MBSSID) parameters in AP mode. -+ * Kernel uses this attribute to indicate the driver's support for MBSSID -+ * and enhanced multi-BSSID advertisements (EMA AP) to the userspace. -+ * Userspace should use this attribute to configure per interface MBSSID -+ * parameters. -+ * See &enum nl80211_mbssid_config_attributes for details. -+ * -+ * @NL80211_ATTR_MBSSID_ELEMS: Nested parameter to pass multiple BSSID elements. -+ * Mandatory parameter for the transmitting interface to enable MBSSID. -+ * Optional for the non-transmitting interfaces. -+ * - * @NUM_NL80211_ATTR: total number of nl80211_attrs available - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3096,6 +3111,9 @@ enum nl80211_attrs { - NL80211_ATTR_COLOR_CHANGE_COLOR, - NL80211_ATTR_COLOR_CHANGE_ELEMS, - -+ NL80211_ATTR_MBSSID_CONFIG, -+ NL80211_ATTR_MBSSID_ELEMS, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, -@@ -7349,4 +7367,60 @@ enum nl80211_sar_specs_attrs { - NL80211_SAR_ATTR_SPECS_MAX = __NL80211_SAR_ATTR_SPECS_LAST - 1, - }; - -+/** -+ * enum nl80211_mbssid_config_attributes - multiple BSSID (MBSSID) and enhanced -+ * multi-BSSID advertisements (EMA) in AP mode. -+ * Kernel uses some of these attributes to advertise driver's support for -+ * MBSSID and EMA. -+ * Remaining attributes should be used by the userspace to configure the -+ * features. -+ * -+ * @__NL80211_MBSSID_CONFIG_ATTR_INVALID: Invalid -+ * -+ * @NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES: Used by the kernel to advertise -+ * the maximum number of MBSSID interfaces supported by the driver. -+ * Driver should indicate MBSSID support by setting -+ * wiphy->mbssid_max_interfaces to a value more than or equal to 2. -+ * -+ * @NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY: Used by the kernel -+ * to advertise the maximum profile periodicity supported by the driver -+ * if EMA is enabled. Driver should indicate EMA support to the userspace -+ * by setting wiphy->mbssid_max_ema_profile_periodicity to -+ * a non-zero value. -+ * -+ * @NL80211_MBSSID_CONFIG_ATTR_INDEX: Mandatory parameter to pass the index of -+ * this BSS (u8) in the multiple BSSID set. -+ * Value must be set to 0 for the transmitting interface and non-zero for -+ * all non-transmitting interfaces. The userspace will be responsible -+ * for using unique indices for the interfaces. -+ * Range: 0 to wiphy->mbssid_max_interfaces-1. -+ * -+ * @NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX: Mandatory parameter for -+ * a non-transmitted profile which provides the interface index (u32) of -+ * the transmitted profile. The value must match one of the interface -+ * indices advertised by the kernel. Optional if the interface being set up -+ * is the transmitting one, however, if provided then the value must match -+ * the interface index of the same. -+ * -+ * @NL80211_MBSSID_CONFIG_ATTR_EMA: Flag used to enable EMA AP feature. -+ * Setting this flag is permitted only if the driver advertises EMA support -+ * by setting wiphy->mbssid_max_ema_profile_periodicity to non-zero. -+ * -+ * @__NL80211_MBSSID_CONFIG_ATTR_LAST: Internal -+ * @NL80211_MBSSID_CONFIG_ATTR_MAX: highest attribute -+ */ -+enum nl80211_mbssid_config_attributes { -+ __NL80211_MBSSID_CONFIG_ATTR_INVALID, -+ -+ NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES, -+ NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY, -+ NL80211_MBSSID_CONFIG_ATTR_INDEX, -+ NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX, -+ NL80211_MBSSID_CONFIG_ATTR_EMA, -+ -+ /* keep last */ -+ __NL80211_MBSSID_CONFIG_ATTR_LAST, -+ NL80211_MBSSID_CONFIG_ATTR_MAX = __NL80211_MBSSID_CONFIG_ATTR_LAST - 1, -+}; -+ - #endif /* __LINUX_NL80211_H */ ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -442,6 +442,16 @@ sar_policy[NL80211_SAR_ATTR_MAX + 1] = { - [NL80211_SAR_ATTR_SPECS] = NLA_POLICY_NESTED_ARRAY(sar_specs_policy), - }; - -+static const struct nla_policy -+nl80211_mbssid_config_policy[NL80211_MBSSID_CONFIG_ATTR_MAX + 1] = { -+ [NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES] = NLA_POLICY_MIN(NLA_U8, 2), -+ [NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY] = -+ NLA_POLICY_MIN(NLA_U8, 1), -+ [NL80211_MBSSID_CONFIG_ATTR_INDEX] = { .type = NLA_U8 }, -+ [NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX] = { .type = NLA_U32 }, -+ [NL80211_MBSSID_CONFIG_ATTR_EMA] = { .type = NLA_FLAG }, -+}; -+ - static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { - [0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD }, - [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, -@@ -788,6 +798,9 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_COLOR_CHANGE_COUNT] = { .type = NLA_U8 }, - [NL80211_ATTR_COLOR_CHANGE_COLOR] = { .type = NLA_U8 }, - [NL80211_ATTR_COLOR_CHANGE_ELEMS] = NLA_POLICY_NESTED(nl80211_policy), -+ [NL80211_ATTR_MBSSID_CONFIG] = -+ NLA_POLICY_NESTED(nl80211_mbssid_config_policy), -+ [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, - }; - - /* policy for the key attributes */ -@@ -2236,6 +2249,35 @@ fail: - return -ENOBUFS; - } - -+static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg) -+{ -+ struct nlattr *config; -+ -+ if (!wiphy->mbssid_max_interfaces) -+ return 0; -+ -+ config = nla_nest_start(msg, NL80211_ATTR_MBSSID_CONFIG); -+ if (!config) -+ return -ENOBUFS; -+ -+ if (nla_put_u8(msg, NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES, -+ wiphy->mbssid_max_interfaces)) -+ goto fail; -+ -+ if (wiphy->ema_max_profile_periodicity && -+ nla_put_u8(msg, -+ NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY, -+ wiphy->ema_max_profile_periodicity)) -+ goto fail; -+ -+ nla_nest_end(msg, config); -+ return 0; -+ -+fail: -+ nla_nest_cancel(msg, config); -+ return -ENOBUFS; -+} -+ - struct nl80211_dump_wiphy_state { - s64 filter_wiphy; - long start; -@@ -2821,6 +2863,9 @@ static int nl80211_send_wiphy(struct cfg - if (nl80211_put_sar_specs(rdev, msg)) - goto nla_put_failure; - -+ if (nl80211_put_mbssid_support(&rdev->wiphy, msg)) -+ goto nla_put_failure; -+ - /* done */ - state->split_start = 0; - break; -@@ -5020,6 +5065,96 @@ static int validate_beacon_tx_rate(struc - return 0; - } - -+static int nl80211_parse_mbssid_config(struct wiphy *wiphy, -+ struct net_device *dev, -+ struct nlattr *attrs, -+ struct cfg80211_mbssid_config *config, -+ u8 num_elems) -+{ -+ struct nlattr *tb[NL80211_MBSSID_CONFIG_ATTR_MAX + 1]; -+ -+ if (!wiphy->mbssid_max_interfaces) -+ return -EOPNOTSUPP; -+ -+ if (nla_parse_nested(tb, NL80211_MBSSID_CONFIG_ATTR_MAX, attrs, NULL, -+ NULL) || -+ !tb[NL80211_MBSSID_CONFIG_ATTR_INDEX]) -+ return -EINVAL; -+ -+ config->ema = nla_get_flag(tb[NL80211_MBSSID_CONFIG_ATTR_EMA]); -+ if (config->ema) { -+ if (!wiphy->ema_max_profile_periodicity) -+ return -EOPNOTSUPP; -+ -+ if (num_elems > wiphy->ema_max_profile_periodicity) -+ return -EINVAL; -+ } -+ -+ config->index = nla_get_u8(tb[NL80211_MBSSID_CONFIG_ATTR_INDEX]); -+ if (config->index >= wiphy->mbssid_max_interfaces || -+ (!config->index && !num_elems)) -+ return -EINVAL; -+ -+ if (tb[NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX]) { -+ u32 tx_ifindex = -+ nla_get_u32(tb[NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX]); -+ -+ if ((!config->index && tx_ifindex != dev->ifindex) || -+ (config->index && tx_ifindex == dev->ifindex)) -+ return -EINVAL; -+ -+ if (tx_ifindex != dev->ifindex) { -+ struct net_device *tx_netdev = -+ dev_get_by_index(wiphy_net(wiphy), tx_ifindex); -+ -+ if (!tx_netdev || !tx_netdev->ieee80211_ptr || -+ tx_netdev->ieee80211_ptr->wiphy != wiphy || -+ tx_netdev->ieee80211_ptr->iftype != -+ NL80211_IFTYPE_AP) { -+ dev_put(tx_netdev); -+ return -EINVAL; -+ } -+ -+ config->tx_wdev = tx_netdev->ieee80211_ptr; -+ } else { -+ config->tx_wdev = dev->ieee80211_ptr; -+ } -+ } else if (!config->index) { -+ config->tx_wdev = dev->ieee80211_ptr; -+ } else { -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static struct cfg80211_mbssid_elems * -+nl80211_parse_mbssid_elems(struct wiphy *wiphy, struct nlattr *attrs) -+{ -+ struct nlattr *nl_elems; -+ struct cfg80211_mbssid_elems *elems; -+ int rem_elems; -+ u8 i = 0, num_elems = 0; -+ -+ if (!wiphy->mbssid_max_interfaces) -+ return ERR_PTR(-EINVAL); -+ -+ nla_for_each_nested(nl_elems, attrs, rem_elems) -+ num_elems++; -+ -+ elems = kzalloc(struct_size(elems, elem, num_elems), GFP_KERNEL); -+ if (!elems) -+ return ERR_PTR(-ENOMEM); -+ -+ nla_for_each_nested(nl_elems, attrs, rem_elems) { -+ elems->elem[i].data = nla_data(nl_elems); -+ elems->elem[i].len = nla_len(nl_elems); -+ i++; -+ } -+ elems->cnt = num_elems; -+ return elems; -+} -+ - static int nl80211_parse_beacon(struct cfg80211_registered_device *rdev, - struct nlattr *attrs[], - struct cfg80211_beacon_data *bcn) -@@ -5100,6 +5235,17 @@ static int nl80211_parse_beacon(struct c - bcn->ftm_responder = -1; - } - -+ if (attrs[NL80211_ATTR_MBSSID_ELEMS]) { -+ struct cfg80211_mbssid_elems *mbssid = -+ nl80211_parse_mbssid_elems(&rdev->wiphy, -+ attrs[NL80211_ATTR_MBSSID_ELEMS]); -+ -+ if (IS_ERR(mbssid)) -+ return PTR_ERR(mbssid); -+ -+ bcn->mbssid_ies = mbssid; -+ } -+ - return 0; - } - -@@ -5556,6 +5702,17 @@ static int nl80211_start_ap(struct sk_bu - goto out; - } - -+ if (info->attrs[NL80211_ATTR_MBSSID_CONFIG]) { -+ err = nl80211_parse_mbssid_config(&rdev->wiphy, dev, -+ info->attrs[NL80211_ATTR_MBSSID_CONFIG], -+ ¶ms.mbssid_config, -+ params.beacon.mbssid_ies ? -+ params.beacon.mbssid_ies->cnt : -+ 0); -+ if (err) -+ goto out; -+ } -+ - nl80211_calculate_ap_params(¶ms); - - if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT]) -@@ -5577,6 +5734,11 @@ static int nl80211_start_ap(struct sk_bu - - out: - kfree(params.acl); -+ kfree(params.beacon.mbssid_ies); -+ if (params.mbssid_config.tx_wdev && -+ params.mbssid_config.tx_wdev->netdev && -+ params.mbssid_config.tx_wdev->netdev != dev) -+ dev_put(params.mbssid_config.tx_wdev->netdev); - - return err; - } -@@ -5601,12 +5763,14 @@ static int nl80211_set_beacon(struct sk_ - - err = nl80211_parse_beacon(rdev, info->attrs, ¶ms); - if (err) -- return err; -+ goto out; - - wdev_lock(wdev); - err = rdev_change_beacon(rdev, dev, ¶ms); - wdev_unlock(wdev); - -+out: -+ kfree(params.mbssid_ies); - return err; - } - -@@ -9283,12 +9447,14 @@ static int nl80211_channel_switch(struct - - err = nl80211_parse_beacon(rdev, info->attrs, ¶ms.beacon_after); - if (err) -- return err; -+ goto free; - - csa_attrs = kcalloc(NL80211_ATTR_MAX + 1, sizeof(*csa_attrs), - GFP_KERNEL); -- if (!csa_attrs) -- return -ENOMEM; -+ if (!csa_attrs) { -+ err = -ENOMEM; -+ goto free; -+ } - - err = nla_parse_nested_deprecated(csa_attrs, NL80211_ATTR_MAX, - info->attrs[NL80211_ATTR_CSA_IES], -@@ -9407,6 +9573,8 @@ skip_beacons: - wdev_unlock(wdev); - - free: -+ kfree(params.beacon_after.mbssid_ies); -+ kfree(params.beacon_csa.mbssid_ies); - kfree(csa_attrs); - return err; - } -@@ -14959,6 +15127,8 @@ static int nl80211_color_change(struct s - wdev_unlock(wdev); - - out: -+ kfree(params.beacon_next.mbssid_ies); -+ kfree(params.beacon_color_change.mbssid_ies); - kfree(tb); - return err; - } diff --git a/package/kernel/mac80211/patches/subsys/314-v5.17-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch b/package/kernel/mac80211/patches/subsys/314-v5.17-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch deleted file mode 100644 index 2038ee69db7..00000000000 --- a/package/kernel/mac80211/patches/subsys/314-v5.17-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch +++ /dev/null @@ -1,378 +0,0 @@ -From: Lorenzo Bianconi -Date: Sat, 23 Oct 2021 11:10:50 +0200 -Subject: [PATCH] cfg80211: implement APIs for dedicated radar detection HW - -If a dedicated (off-channel) radar detection hardware (chain) -is available in the hardware/driver, allow this to be used by -calling the NL80211_CMD_RADAR_DETECT command with a new flag -attribute requesting off-channel radar detection is used. - -Offchannel CAC (channel availability check) avoids the CAC -downtime when switching to a radar channel or when turning on -the AP. - -Drivers advertise support for this using the new feature flag -NL80211_EXT_FEATURE_RADAR_OFFCHAN. - -Tested-by: Evelyn Tsai -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/7468e291ef5d05d692c1738d25b8f778d8ea5c3f.1634979655.git.lorenzo@kernel.org -Link: https://lore.kernel.org/r/1e60e60fef00e14401adae81c3d49f3e5f307537.1634979655.git.lorenzo@kernel.org -Link: https://lore.kernel.org/r/85fa50f57fc3adb2934c8d9ca0be30394de6b7e8.1634979655.git.lorenzo@kernel.org -Link: https://lore.kernel.org/r/4b6c08671ad59aae0ac46fc94c02f31b1610eb72.1634979655.git.lorenzo@kernel.org -Link: https://lore.kernel.org/r/241849ccaf2c228873c6f8495bf87b19159ba458.1634979655.git.lorenzo@kernel.org -[remove offchan_mutex, fix cfg80211_stop_offchan_radar_detection(), - remove gfp_t argument, fix documentation, fix tracing] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -4057,6 +4057,15 @@ struct mgmt_frame_regs { - * @set_sar_specs: Update the SAR (TX power) settings. - * - * @color_change: Initiate a color change. -+ * -+ * @set_radar_offchan: Configure dedicated offchannel chain available for -+ * radar/CAC detection on some hw. This chain can't be used to transmit -+ * or receive frames and it is bounded to a running wdev. -+ * Offchannel radar/CAC detection allows to avoid the CAC downtime -+ * switching to a different channel during CAC detection on the selected -+ * radar channel. -+ * The caller is expected to set chandef pointer to NULL in order to -+ * disable offchannel CAC/radar detection. - */ - struct cfg80211_ops { - int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); -@@ -4387,6 +4396,8 @@ struct cfg80211_ops { - int (*color_change)(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_color_change_settings *params); -+ int (*set_radar_offchan)(struct wiphy *wiphy, -+ struct cfg80211_chan_def *chandef); - }; - - /* -@@ -7608,6 +7619,20 @@ void cfg80211_cac_event(struct net_devic - const struct cfg80211_chan_def *chandef, - enum nl80211_radar_event event, gfp_t gfp); - -+/** -+ * cfg80211_offchan_cac_event - Channel Availability Check (CAC) offchan event -+ * @wiphy: the wiphy -+ * @chandef: chandef for the current channel -+ * @event: type of event -+ * -+ * This function is called when a Channel Availability Check (CAC) is finished, -+ * started or aborted by a offchannel dedicated chain. -+ * -+ * Note that this acquires the wiphy lock. -+ */ -+void cfg80211_offchan_cac_event(struct wiphy *wiphy, -+ const struct cfg80211_chan_def *chandef, -+ enum nl80211_radar_event event); - - /** - * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying ---- a/include/uapi/linux/nl80211.h -+++ b/include/uapi/linux/nl80211.h -@@ -2608,6 +2608,13 @@ enum nl80211_commands { - * Mandatory parameter for the transmitting interface to enable MBSSID. - * Optional for the non-transmitting interfaces. - * -+ * @NL80211_ATTR_RADAR_OFFCHAN: Configure dedicated offchannel chain available for -+ * radar/CAC detection on some hw. This chain can't be used to transmit -+ * or receive frames and it is bounded to a running wdev. -+ * Offchannel radar/CAC detection allows to avoid the CAC downtime -+ * switching on a different channel during CAC detection on the selected -+ * radar channel. -+ * - * @NUM_NL80211_ATTR: total number of nl80211_attrs available - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3114,6 +3121,8 @@ enum nl80211_attrs { - NL80211_ATTR_MBSSID_CONFIG, - NL80211_ATTR_MBSSID_ELEMS, - -+ NL80211_ATTR_RADAR_OFFCHAN, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, -@@ -6013,6 +6022,9 @@ enum nl80211_feature_flags { - * @NL80211_EXT_FEATURE_BSS_COLOR: The driver supports BSS color collision - * detection and change announcemnts. - * -+ * @NL80211_EXT_FEATURE_RADAR_OFFCHAN: Device supports offchannel radar/CAC -+ * detection. -+ * - * @NUM_NL80211_EXT_FEATURES: number of extended features. - * @MAX_NL80211_EXT_FEATURES: highest extended feature index. - */ -@@ -6078,6 +6090,7 @@ enum nl80211_ext_feature_index { - NL80211_EXT_FEATURE_SECURE_RTT, - NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, - NL80211_EXT_FEATURE_BSS_COLOR, -+ NL80211_EXT_FEATURE_RADAR_OFFCHAN, - - /* add new features before the definition below */ - NUM_NL80211_EXT_FEATURES, ---- a/net/wireless/core.c -+++ b/net/wireless/core.c -@@ -543,6 +543,7 @@ use_default_name: - INIT_WORK(&rdev->rfkill_block, cfg80211_rfkill_block_work); - INIT_WORK(&rdev->conn_work, cfg80211_conn_work); - INIT_WORK(&rdev->event_work, cfg80211_event_work); -+ INIT_DELAYED_WORK(&rdev->offchan_cac_work, cfg80211_offchan_cac_work); - - init_waitqueue_head(&rdev->dev_wait); - -@@ -1205,6 +1206,8 @@ void __cfg80211_leave(struct cfg80211_re - - cfg80211_pmsr_wdev_down(wdev); - -+ cfg80211_stop_offchan_radar_detection(wdev); -+ - switch (wdev->iftype) { - case NL80211_IFTYPE_ADHOC: - __cfg80211_leave_ibss(rdev, dev, true); ---- a/net/wireless/core.h -+++ b/net/wireless/core.h -@@ -84,6 +84,10 @@ struct cfg80211_registered_device { - - struct delayed_work dfs_update_channels_wk; - -+ struct wireless_dev *offchan_radar_wdev; -+ struct cfg80211_chan_def offchan_radar_chandef; -+ struct delayed_work offchan_cac_work; -+ - /* netlink port which started critical protocol (0 means not started) */ - u32 crit_proto_nlportid; - -@@ -491,6 +495,15 @@ cfg80211_chandef_dfs_cac_time(struct wip - - void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev); - -+int -+cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev, -+ struct wireless_dev *wdev, -+ struct cfg80211_chan_def *chandef); -+ -+void cfg80211_stop_offchan_radar_detection(struct wireless_dev *wdev); -+ -+void cfg80211_offchan_cac_work(struct work_struct *work); -+ - bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, - struct ieee80211_channel *chan); - ---- a/net/wireless/mlme.c -+++ b/net/wireless/mlme.c -@@ -970,3 +970,116 @@ void cfg80211_cac_event(struct net_devic - nl80211_radar_notify(rdev, chandef, event, netdev, gfp); - } - EXPORT_SYMBOL(cfg80211_cac_event); -+ -+void cfg80211_offchan_cac_work(struct work_struct *work) -+{ -+ struct delayed_work *delayed_work = to_delayed_work(work); -+ struct cfg80211_registered_device *rdev; -+ -+ rdev = container_of(delayed_work, struct cfg80211_registered_device, -+ offchan_cac_work); -+ cfg80211_offchan_cac_event(&rdev->wiphy, &rdev->offchan_radar_chandef, -+ NL80211_RADAR_CAC_FINISHED); -+} -+ -+static void -+__cfg80211_offchan_cac_event(struct cfg80211_registered_device *rdev, -+ struct wireless_dev *wdev, -+ const struct cfg80211_chan_def *chandef, -+ enum nl80211_radar_event event) -+{ -+ struct wiphy *wiphy = &rdev->wiphy; -+ struct net_device *netdev; -+ -+ lockdep_assert_wiphy(&rdev->wiphy); -+ -+ if (event != NL80211_RADAR_CAC_STARTED && !rdev->offchan_radar_wdev) -+ return; -+ -+ switch (event) { -+ case NL80211_RADAR_CAC_FINISHED: -+ cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); -+ memcpy(&rdev->cac_done_chandef, chandef, sizeof(*chandef)); -+ queue_work(cfg80211_wq, &rdev->propagate_cac_done_wk); -+ cfg80211_sched_dfs_chan_update(rdev); -+ wdev = rdev->offchan_radar_wdev; -+ rdev->offchan_radar_wdev = NULL; -+ break; -+ case NL80211_RADAR_CAC_ABORTED: -+ cancel_delayed_work(&rdev->offchan_cac_work); -+ wdev = rdev->offchan_radar_wdev; -+ rdev->offchan_radar_wdev = NULL; -+ break; -+ case NL80211_RADAR_CAC_STARTED: -+ WARN_ON(!wdev); -+ rdev->offchan_radar_wdev = wdev; -+ break; -+ default: -+ return; -+ } -+ -+ netdev = wdev ? wdev->netdev : NULL; -+ nl80211_radar_notify(rdev, chandef, event, netdev, GFP_KERNEL); -+} -+ -+void cfg80211_offchan_cac_event(struct wiphy *wiphy, -+ const struct cfg80211_chan_def *chandef, -+ enum nl80211_radar_event event) -+{ -+ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); -+ -+ wiphy_lock(wiphy); -+ __cfg80211_offchan_cac_event(rdev, NULL, chandef, event); -+ wiphy_unlock(wiphy); -+} -+EXPORT_SYMBOL(cfg80211_offchan_cac_event); -+ -+int -+cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev, -+ struct wireless_dev *wdev, -+ struct cfg80211_chan_def *chandef) -+{ -+ unsigned int cac_time_ms; -+ int err; -+ -+ lockdep_assert_wiphy(&rdev->wiphy); -+ -+ if (!wiphy_ext_feature_isset(&rdev->wiphy, -+ NL80211_EXT_FEATURE_RADAR_OFFCHAN)) -+ return -EOPNOTSUPP; -+ -+ if (rdev->offchan_radar_wdev) -+ return -EBUSY; -+ -+ err = rdev_set_radar_offchan(rdev, chandef); -+ if (err) -+ return err; -+ -+ cac_time_ms = cfg80211_chandef_dfs_cac_time(&rdev->wiphy, chandef); -+ if (!cac_time_ms) -+ cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; -+ -+ rdev->offchan_radar_chandef = *chandef; -+ __cfg80211_offchan_cac_event(rdev, wdev, chandef, -+ NL80211_RADAR_CAC_STARTED); -+ queue_delayed_work(cfg80211_wq, &rdev->offchan_cac_work, -+ msecs_to_jiffies(cac_time_ms)); -+ -+ return 0; -+} -+ -+void cfg80211_stop_offchan_radar_detection(struct wireless_dev *wdev) -+{ -+ struct wiphy *wiphy = wdev->wiphy; -+ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); -+ -+ lockdep_assert_wiphy(wiphy); -+ -+ if (wdev != rdev->offchan_radar_wdev) -+ return; -+ -+ rdev_set_radar_offchan(rdev, NULL); -+ -+ __cfg80211_offchan_cac_event(rdev, NULL, NULL, -+ NL80211_RADAR_CAC_ABORTED); -+} ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -801,6 +801,7 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_MBSSID_CONFIG] = - NLA_POLICY_NESTED(nl80211_mbssid_config_policy), - [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, -+ [NL80211_ATTR_RADAR_OFFCHAN] = { .type = NLA_FLAG }, - }; - - /* policy for the key attributes */ -@@ -9287,12 +9288,6 @@ static int nl80211_start_radar_detection - if (err) - return err; - -- if (netif_carrier_ok(dev)) -- return -EBUSY; -- -- if (wdev->cac_started) -- return -EBUSY; -- - err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype); - if (err < 0) - return err; -@@ -9303,6 +9298,16 @@ static int nl80211_start_radar_detection - if (!cfg80211_chandef_dfs_usable(wiphy, &chandef)) - return -EINVAL; - -+ if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN])) -+ return cfg80211_start_offchan_radar_detection(rdev, wdev, -+ &chandef); -+ -+ if (netif_carrier_ok(dev)) -+ return -EBUSY; -+ -+ if (wdev->cac_started) -+ return -EBUSY; -+ - /* CAC start is offloaded to HW and can't be started manually */ - if (wiphy_ext_feature_isset(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD)) - return -EOPNOTSUPP; ---- a/net/wireless/rdev-ops.h -+++ b/net/wireless/rdev-ops.h -@@ -1381,4 +1381,21 @@ static inline int rdev_color_change(stru - return ret; - } - -+static inline int -+rdev_set_radar_offchan(struct cfg80211_registered_device *rdev, -+ struct cfg80211_chan_def *chandef) -+{ -+ struct wiphy *wiphy = &rdev->wiphy; -+ int ret; -+ -+ if (!rdev->ops->set_radar_offchan) -+ return -EOPNOTSUPP; -+ -+ trace_rdev_set_radar_offchan(wiphy, chandef); -+ ret = rdev->ops->set_radar_offchan(wiphy, chandef); -+ trace_rdev_return_int(wiphy, ret); -+ -+ return ret; -+} -+ - #endif /* __CFG80211_RDEV_OPS */ ---- a/net/wireless/trace.h -+++ b/net/wireless/trace.h -@@ -3643,6 +3643,25 @@ TRACE_EVENT(cfg80211_bss_color_notify, - __entry->color_bitmap) - ); - -+TRACE_EVENT(rdev_set_radar_offchan, -+ TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef), -+ -+ TP_ARGS(wiphy, chandef), -+ -+ TP_STRUCT__entry( -+ WIPHY_ENTRY -+ CHAN_DEF_ENTRY -+ ), -+ -+ TP_fast_assign( -+ WIPHY_ASSIGN; -+ CHAN_DEF_ASSIGN(chandef) -+ ), -+ -+ TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT, -+ WIPHY_PR_ARG, CHAN_DEF_PR_ARG) -+); -+ - #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ - - #undef TRACE_INCLUDE_PATH diff --git a/package/kernel/mac80211/patches/subsys/315-v5.17-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch b/package/kernel/mac80211/patches/subsys/315-v5.17-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch deleted file mode 100644 index b1a1d2c8945..00000000000 --- a/package/kernel/mac80211/patches/subsys/315-v5.17-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch +++ /dev/null @@ -1,183 +0,0 @@ -From: Lorenzo Bianconi -Date: Wed, 27 Oct 2021 11:03:42 +0200 -Subject: [PATCH] cfg80211: move offchan_cac_event to a dedicated work - -In order to make cfg80211_offchan_cac_abort() (renamed from -cfg80211_offchan_cac_event) callable in other contexts and -without so much locking restrictions, make it trigger a new -work instead of operating directly. - -Do some other renames while at it to clarify. - -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/6145c3d0f30400a568023f67981981d24c7c6133.1635325205.git.lorenzo@kernel.org -[rewrite commit log] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -7620,19 +7620,13 @@ void cfg80211_cac_event(struct net_devic - enum nl80211_radar_event event, gfp_t gfp); - - /** -- * cfg80211_offchan_cac_event - Channel Availability Check (CAC) offchan event -+ * cfg80211_offchan_cac_abort - Channel Availability Check offchan abort event - * @wiphy: the wiphy -- * @chandef: chandef for the current channel -- * @event: type of event - * -- * This function is called when a Channel Availability Check (CAC) is finished, -- * started or aborted by a offchannel dedicated chain. -- * -- * Note that this acquires the wiphy lock. -+ * This function is called by the driver when a Channel Availability Check -+ * (CAC) is aborted by a offchannel dedicated chain. - */ --void cfg80211_offchan_cac_event(struct wiphy *wiphy, -- const struct cfg80211_chan_def *chandef, -- enum nl80211_radar_event event); -+void cfg80211_offchan_cac_abort(struct wiphy *wiphy); - - /** - * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying ---- a/net/wireless/core.c -+++ b/net/wireless/core.c -@@ -543,7 +543,9 @@ use_default_name: - INIT_WORK(&rdev->rfkill_block, cfg80211_rfkill_block_work); - INIT_WORK(&rdev->conn_work, cfg80211_conn_work); - INIT_WORK(&rdev->event_work, cfg80211_event_work); -- INIT_DELAYED_WORK(&rdev->offchan_cac_work, cfg80211_offchan_cac_work); -+ INIT_WORK(&rdev->offchan_cac_abort_wk, cfg80211_offchan_cac_abort_wk); -+ INIT_DELAYED_WORK(&rdev->offchan_cac_done_wk, -+ cfg80211_offchan_cac_done_wk); - - init_waitqueue_head(&rdev->dev_wait); - -@@ -1053,11 +1055,13 @@ void wiphy_unregister(struct wiphy *wiph - cancel_work_sync(&rdev->conn_work); - flush_work(&rdev->event_work); - cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); -+ cancel_delayed_work_sync(&rdev->offchan_cac_done_wk); - flush_work(&rdev->destroy_work); - flush_work(&rdev->sched_scan_stop_wk); - flush_work(&rdev->propagate_radar_detect_wk); - flush_work(&rdev->propagate_cac_done_wk); - flush_work(&rdev->mgmt_registrations_update_wk); -+ flush_work(&rdev->offchan_cac_abort_wk); - - #ifdef CONFIG_PM - if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup) ---- a/net/wireless/core.h -+++ b/net/wireless/core.h -@@ -86,7 +86,8 @@ struct cfg80211_registered_device { - - struct wireless_dev *offchan_radar_wdev; - struct cfg80211_chan_def offchan_radar_chandef; -- struct delayed_work offchan_cac_work; -+ struct delayed_work offchan_cac_done_wk; -+ struct work_struct offchan_cac_abort_wk; - - /* netlink port which started critical protocol (0 means not started) */ - u32 crit_proto_nlportid; -@@ -502,7 +503,9 @@ cfg80211_start_offchan_radar_detection(s - - void cfg80211_stop_offchan_radar_detection(struct wireless_dev *wdev); - --void cfg80211_offchan_cac_work(struct work_struct *work); -+void cfg80211_offchan_cac_done_wk(struct work_struct *work); -+ -+void cfg80211_offchan_cac_abort_wk(struct work_struct *work); - - bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, - struct ieee80211_channel *chan); ---- a/net/wireless/mlme.c -+++ b/net/wireless/mlme.c -@@ -971,17 +971,6 @@ void cfg80211_cac_event(struct net_devic - } - EXPORT_SYMBOL(cfg80211_cac_event); - --void cfg80211_offchan_cac_work(struct work_struct *work) --{ -- struct delayed_work *delayed_work = to_delayed_work(work); -- struct cfg80211_registered_device *rdev; -- -- rdev = container_of(delayed_work, struct cfg80211_registered_device, -- offchan_cac_work); -- cfg80211_offchan_cac_event(&rdev->wiphy, &rdev->offchan_radar_chandef, -- NL80211_RADAR_CAC_FINISHED); --} -- - static void - __cfg80211_offchan_cac_event(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev, -@@ -1006,7 +995,7 @@ __cfg80211_offchan_cac_event(struct cfg8 - rdev->offchan_radar_wdev = NULL; - break; - case NL80211_RADAR_CAC_ABORTED: -- cancel_delayed_work(&rdev->offchan_cac_work); -+ cancel_delayed_work(&rdev->offchan_cac_done_wk); - wdev = rdev->offchan_radar_wdev; - rdev->offchan_radar_wdev = NULL; - break; -@@ -1022,17 +1011,44 @@ __cfg80211_offchan_cac_event(struct cfg8 - nl80211_radar_notify(rdev, chandef, event, netdev, GFP_KERNEL); - } - --void cfg80211_offchan_cac_event(struct wiphy *wiphy, -- const struct cfg80211_chan_def *chandef, -- enum nl80211_radar_event event) -+static void -+cfg80211_offchan_cac_event(struct cfg80211_registered_device *rdev, -+ const struct cfg80211_chan_def *chandef, -+ enum nl80211_radar_event event) -+{ -+ wiphy_lock(&rdev->wiphy); -+ __cfg80211_offchan_cac_event(rdev, NULL, chandef, event); -+ wiphy_unlock(&rdev->wiphy); -+} -+ -+void cfg80211_offchan_cac_done_wk(struct work_struct *work) -+{ -+ struct delayed_work *delayed_work = to_delayed_work(work); -+ struct cfg80211_registered_device *rdev; -+ -+ rdev = container_of(delayed_work, struct cfg80211_registered_device, -+ offchan_cac_done_wk); -+ cfg80211_offchan_cac_event(rdev, &rdev->offchan_radar_chandef, -+ NL80211_RADAR_CAC_FINISHED); -+} -+ -+void cfg80211_offchan_cac_abort_wk(struct work_struct *work) -+{ -+ struct cfg80211_registered_device *rdev; -+ -+ rdev = container_of(work, struct cfg80211_registered_device, -+ offchan_cac_abort_wk); -+ cfg80211_offchan_cac_event(rdev, &rdev->offchan_radar_chandef, -+ NL80211_RADAR_CAC_ABORTED); -+} -+ -+void cfg80211_offchan_cac_abort(struct wiphy *wiphy) - { - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); - -- wiphy_lock(wiphy); -- __cfg80211_offchan_cac_event(rdev, NULL, chandef, event); -- wiphy_unlock(wiphy); -+ queue_work(cfg80211_wq, &rdev->offchan_cac_abort_wk); - } --EXPORT_SYMBOL(cfg80211_offchan_cac_event); -+EXPORT_SYMBOL(cfg80211_offchan_cac_abort); - - int - cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev, -@@ -1062,7 +1078,7 @@ cfg80211_start_offchan_radar_detection(s - rdev->offchan_radar_chandef = *chandef; - __cfg80211_offchan_cac_event(rdev, wdev, chandef, - NL80211_RADAR_CAC_STARTED); -- queue_delayed_work(cfg80211_wq, &rdev->offchan_cac_work, -+ queue_delayed_work(cfg80211_wq, &rdev->offchan_cac_done_wk, - msecs_to_jiffies(cac_time_ms)); - - return 0; diff --git a/package/kernel/mac80211/patches/subsys/316-v5.17-cfg80211-fix-possible-NULL-pointer-dereference-in-cf.patch b/package/kernel/mac80211/patches/subsys/316-v5.17-cfg80211-fix-possible-NULL-pointer-dereference-in-cf.patch deleted file mode 100644 index 362bb885d76..00000000000 --- a/package/kernel/mac80211/patches/subsys/316-v5.17-cfg80211-fix-possible-NULL-pointer-dereference-in-cf.patch +++ /dev/null @@ -1,99 +0,0 @@ -From: Lorenzo Bianconi -Date: Wed, 3 Nov 2021 18:02:35 +0100 -Subject: [PATCH] cfg80211: fix possible NULL pointer dereference in - cfg80211_stop_offchan_radar_detection - -Fix the following NULL pointer dereference in -cfg80211_stop_offchan_radar_detection routine that occurs when hostapd -is stopped during the CAC on offchannel chain: - -Sat Jan 1 0[ 779.567851] ESR = 0x96000005 -0:12:50 2000 dae[ 779.572346] EC = 0x25: DABT (current EL), IL = 32 bits -mon.debug hostap[ 779.578984] SET = 0, FnV = 0 -d: hostapd_inter[ 779.583445] EA = 0, S1PTW = 0 -face_deinit_free[ 779.587936] Data abort info: -: num_bss=1 conf[ 779.592224] ISV = 0, ISS = 0x00000005 -->num_bss=1 -Sat[ 779.597403] CM = 0, WnR = 0 - Jan 1 00:12:50[ 779.601749] user pgtable: 4k pages, 39-bit VAs, pgdp=00000000418b2000 - 2000 daemon.deb[ 779.609601] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000 -ug hostapd: host[ 779.619657] Internal error: Oops: 96000005 [#1] SMP -[ 779.770810] CPU: 0 PID: 2202 Comm: hostapd Not tainted 5.10.75 #0 -[ 779.776892] Hardware name: MediaTek MT7622 RFB1 board (DT) -[ 779.782370] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--) -[ 779.788384] pc : cfg80211_chandef_valid+0x10/0x490 [cfg80211] -[ 779.794128] lr : cfg80211_check_station_change+0x3190/0x3950 [cfg80211] -[ 779.800731] sp : ffffffc01204b7e0 -[ 779.804036] x29: ffffffc01204b7e0 x28: ffffff80039bdc00 -[ 779.809340] x27: 0000000000000000 x26: ffffffc008cb3050 -[ 779.814644] x25: 0000000000000000 x24: 0000000000000002 -[ 779.819948] x23: ffffff8002630000 x22: ffffff8003e748d0 -[ 779.825252] x21: 0000000000000cc0 x20: ffffff8003da4a00 -[ 779.830556] x19: 0000000000000000 x18: ffffff8001bf7ce0 -[ 779.835860] x17: 00000000ffffffff x16: 0000000000000000 -[ 779.841164] x15: 0000000040d59200 x14: 00000000000019c0 -[ 779.846467] x13: 00000000000001c8 x12: 000636b9e9dab1c6 -[ 779.851771] x11: 0000000000000141 x10: 0000000000000820 -[ 779.857076] x9 : 0000000000000000 x8 : ffffff8003d7d038 -[ 779.862380] x7 : 0000000000000000 x6 : ffffff8003d7d038 -[ 779.867683] x5 : 0000000000000e90 x4 : 0000000000000038 -[ 779.872987] x3 : 0000000000000002 x2 : 0000000000000004 -[ 779.878291] x1 : 0000000000000000 x0 : 0000000000000000 -[ 779.883594] Call trace: -[ 779.886039] cfg80211_chandef_valid+0x10/0x490 [cfg80211] -[ 779.891434] cfg80211_check_station_change+0x3190/0x3950 [cfg80211] -[ 779.897697] nl80211_radar_notify+0x138/0x19c [cfg80211] -[ 779.903005] cfg80211_stop_offchan_radar_detection+0x7c/0x8c [cfg80211] -[ 779.909616] __cfg80211_leave+0x2c/0x190 [cfg80211] -[ 779.914490] cfg80211_register_netdevice+0x1c0/0x6d0 [cfg80211] -[ 779.920404] raw_notifier_call_chain+0x50/0x70 -[ 779.924841] call_netdevice_notifiers_info+0x54/0xa0 -[ 779.929796] __dev_close_many+0x40/0x100 -[ 779.933712] __dev_change_flags+0x98/0x190 -[ 779.937800] dev_change_flags+0x20/0x60 -[ 779.941628] devinet_ioctl+0x534/0x6d0 -[ 779.945370] inet_ioctl+0x1bc/0x230 -[ 779.948849] sock_do_ioctl+0x44/0x200 -[ 779.952502] sock_ioctl+0x268/0x4c0 -[ 779.955985] __arm64_sys_ioctl+0xac/0xd0 -[ 779.959900] el0_svc_common.constprop.0+0x60/0x110 -[ 779.964682] do_el0_svc+0x1c/0x24 -[ 779.967990] el0_svc+0x10/0x1c -[ 779.971036] el0_sync_handler+0x9c/0x120 -[ 779.974950] el0_sync+0x148/0x180 -[ 779.978259] Code: a9bc7bfd 910003fd a90153f3 aa0003f3 (f9400000) -[ 779.984344] ---[ end trace 0e67b4f5d6cdeec7 ]--- -[ 779.996400] Kernel panic - not syncing: Oops: Fatal exception -[ 780.002139] SMP: stopping secondary CPUs -[ 780.006057] Kernel Offset: disabled -[ 780.009537] CPU features: 0x0000002,04002004 -[ 780.013796] Memory Limit: none - -Fixes: b8f5facf286b ("cfg80211: implement APIs for dedicated radar detection HW") -Reported-by: Evelyn Tsai -Tested-by: Evelyn Tsai -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/c2e34c065bf8839c5ffa45498ae154021a72a520.1635958796.git.lorenzo@kernel.org -Signed-off-by: Johannes Berg ---- - ---- a/net/wireless/mlme.c -+++ b/net/wireless/mlme.c -@@ -982,6 +982,9 @@ __cfg80211_offchan_cac_event(struct cfg8 - - lockdep_assert_wiphy(&rdev->wiphy); - -+ if (!cfg80211_chandef_valid(chandef)) -+ return; -+ - if (event != NL80211_RADAR_CAC_STARTED && !rdev->offchan_radar_wdev) - return; - -@@ -1096,6 +1099,6 @@ void cfg80211_stop_offchan_radar_detecti - - rdev_set_radar_offchan(rdev, NULL); - -- __cfg80211_offchan_cac_event(rdev, NULL, NULL, -+ __cfg80211_offchan_cac_event(rdev, wdev, &rdev->offchan_radar_chandef, - NL80211_RADAR_CAC_ABORTED); - } diff --git a/package/kernel/mac80211/patches/subsys/317-v5.17-cfg80211-schedule-offchan_cac_abort_wk-in-cfg80211_r.patch b/package/kernel/mac80211/patches/subsys/317-v5.17-cfg80211-schedule-offchan_cac_abort_wk-in-cfg80211_r.patch deleted file mode 100644 index df7afefb343..00000000000 --- a/package/kernel/mac80211/patches/subsys/317-v5.17-cfg80211-schedule-offchan_cac_abort_wk-in-cfg80211_r.patch +++ /dev/null @@ -1,136 +0,0 @@ -From: Lorenzo Bianconi -Date: Tue, 16 Nov 2021 12:41:52 +0100 -Subject: [PATCH] cfg80211: schedule offchan_cac_abort_wk in - cfg80211_radar_event - -If necessary schedule offchan_cac_abort_wk work in cfg80211_radar_event -routine adding offchan parameter to cfg80211_radar_event signature. -Rename cfg80211_radar_event in __cfg80211_radar_event and introduce -the two following inline helpers: -- cfg80211_radar_event -- cfg80211_offchan_radar_event -Doing so the drv will not need to run cfg80211_offchan_cac_abort() after -radar detection on the offchannel chain. - -Tested-by: Owen Peng -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/3ff583e021e3343a3ced54a7b09b5e184d1880dc.1637062727.git.lorenzo@kernel.org -Signed-off-by: Johannes Berg ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -7580,15 +7580,33 @@ void cfg80211_cqm_txe_notify(struct net_ - void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); - - /** -- * cfg80211_radar_event - radar detection event -+ * __cfg80211_radar_event - radar detection event - * @wiphy: the wiphy - * @chandef: chandef for the current channel -+ * @offchan: the radar has been detected on the offchannel chain - * @gfp: context flags - * - * This function is called when a radar is detected on the current chanenl. - */ --void cfg80211_radar_event(struct wiphy *wiphy, -- struct cfg80211_chan_def *chandef, gfp_t gfp); -+void __cfg80211_radar_event(struct wiphy *wiphy, -+ struct cfg80211_chan_def *chandef, -+ bool offchan, gfp_t gfp); -+ -+static inline void -+cfg80211_radar_event(struct wiphy *wiphy, -+ struct cfg80211_chan_def *chandef, -+ gfp_t gfp) -+{ -+ __cfg80211_radar_event(wiphy, chandef, false, gfp); -+} -+ -+static inline void -+cfg80211_offchan_radar_event(struct wiphy *wiphy, -+ struct cfg80211_chan_def *chandef, -+ gfp_t gfp) -+{ -+ __cfg80211_radar_event(wiphy, chandef, true, gfp); -+} - - /** - * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event ---- a/net/wireless/mlme.c -+++ b/net/wireless/mlme.c -@@ -905,13 +905,13 @@ void cfg80211_dfs_channels_update_work(s - } - - --void cfg80211_radar_event(struct wiphy *wiphy, -- struct cfg80211_chan_def *chandef, -- gfp_t gfp) -+void __cfg80211_radar_event(struct wiphy *wiphy, -+ struct cfg80211_chan_def *chandef, -+ bool offchan, gfp_t gfp) - { - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); - -- trace_cfg80211_radar_event(wiphy, chandef); -+ trace_cfg80211_radar_event(wiphy, chandef, offchan); - - /* only set the chandef supplied channel to unavailable, in - * case the radar is detected on only one of multiple channels -@@ -919,6 +919,9 @@ void cfg80211_radar_event(struct wiphy * - */ - cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_UNAVAILABLE); - -+ if (offchan) -+ queue_work(cfg80211_wq, &rdev->offchan_cac_abort_wk); -+ - cfg80211_sched_dfs_chan_update(rdev); - - nl80211_radar_notify(rdev, chandef, NL80211_RADAR_DETECTED, NULL, gfp); -@@ -926,7 +929,7 @@ void cfg80211_radar_event(struct wiphy * - memcpy(&rdev->radar_chandef, chandef, sizeof(struct cfg80211_chan_def)); - queue_work(cfg80211_wq, &rdev->propagate_radar_detect_wk); - } --EXPORT_SYMBOL(cfg80211_radar_event); -+EXPORT_SYMBOL(__cfg80211_radar_event); - - void cfg80211_cac_event(struct net_device *netdev, - const struct cfg80211_chan_def *chandef, -@@ -998,7 +1001,8 @@ __cfg80211_offchan_cac_event(struct cfg8 - rdev->offchan_radar_wdev = NULL; - break; - case NL80211_RADAR_CAC_ABORTED: -- cancel_delayed_work(&rdev->offchan_cac_done_wk); -+ if (!cancel_delayed_work(&rdev->offchan_cac_done_wk)) -+ return; - wdev = rdev->offchan_radar_wdev; - rdev->offchan_radar_wdev = NULL; - break; ---- a/net/wireless/trace.h -+++ b/net/wireless/trace.h -@@ -3022,18 +3022,21 @@ TRACE_EVENT(cfg80211_ch_switch_started_n - ); - - TRACE_EVENT(cfg80211_radar_event, -- TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef), -- TP_ARGS(wiphy, chandef), -+ TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, -+ bool offchan), -+ TP_ARGS(wiphy, chandef, offchan), - TP_STRUCT__entry( - WIPHY_ENTRY - CHAN_DEF_ENTRY -+ __field(bool, offchan) - ), - TP_fast_assign( - WIPHY_ASSIGN; - CHAN_DEF_ASSIGN(chandef); -+ __entry->offchan = offchan; - ), -- TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT, -- WIPHY_PR_ARG, CHAN_DEF_PR_ARG) -+ TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT ", offchan %d", -+ WIPHY_PR_ARG, CHAN_DEF_PR_ARG, __entry->offchan) - ); - - TRACE_EVENT(cfg80211_cac_event, diff --git a/package/kernel/mac80211/patches/subsys/318-v5.17-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch b/package/kernel/mac80211/patches/subsys/318-v5.17-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch deleted file mode 100644 index a1b6e3c80d6..00000000000 --- a/package/kernel/mac80211/patches/subsys/318-v5.17-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch +++ /dev/null @@ -1,220 +0,0 @@ -From: Lorenzo Bianconi -Date: Tue, 16 Nov 2021 15:03:36 +0100 -Subject: [PATCH] cfg80211: allow continuous radar monitoring on offchannel - chain - -Allow continuous radar detection on the offchannel chain in order -to switch to the monitored channel whenever the underlying driver -reports a radar pattern on the main channel. - -Tested-by: Owen Peng -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/d46217310a49b14ff0e9c002f0a6e0547d70fd2c.1637071350.git.lorenzo@kernel.org -Signed-off-by: Johannes Berg ---- - ---- a/net/wireless/chan.c -+++ b/net/wireless/chan.c -@@ -712,6 +712,19 @@ static bool cfg80211_is_wiphy_oper_chan( - return false; - } - -+static bool -+cfg80211_offchan_chain_is_active(struct cfg80211_registered_device *rdev, -+ struct ieee80211_channel *channel) -+{ -+ if (!rdev->offchan_radar_wdev) -+ return false; -+ -+ if (!cfg80211_chandef_valid(&rdev->offchan_radar_chandef)) -+ return false; -+ -+ return cfg80211_is_sub_chan(&rdev->offchan_radar_chandef, channel); -+} -+ - bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, - struct ieee80211_channel *chan) - { -@@ -728,6 +741,9 @@ bool cfg80211_any_wiphy_oper_chan(struct - - if (cfg80211_is_wiphy_oper_chan(&rdev->wiphy, chan)) - return true; -+ -+ if (cfg80211_offchan_chain_is_active(rdev, chan)) -+ return true; - } - - return false; ---- a/net/wireless/mlme.c -+++ b/net/wireless/mlme.c -@@ -988,7 +988,7 @@ __cfg80211_offchan_cac_event(struct cfg8 - if (!cfg80211_chandef_valid(chandef)) - return; - -- if (event != NL80211_RADAR_CAC_STARTED && !rdev->offchan_radar_wdev) -+ if (!rdev->offchan_radar_wdev) - return; - - switch (event) { -@@ -998,17 +998,13 @@ __cfg80211_offchan_cac_event(struct cfg8 - queue_work(cfg80211_wq, &rdev->propagate_cac_done_wk); - cfg80211_sched_dfs_chan_update(rdev); - wdev = rdev->offchan_radar_wdev; -- rdev->offchan_radar_wdev = NULL; - break; - case NL80211_RADAR_CAC_ABORTED: - if (!cancel_delayed_work(&rdev->offchan_cac_done_wk)) - return; - wdev = rdev->offchan_radar_wdev; -- rdev->offchan_radar_wdev = NULL; - break; - case NL80211_RADAR_CAC_STARTED: -- WARN_ON(!wdev); -- rdev->offchan_radar_wdev = wdev; - break; - default: - return; -@@ -1024,7 +1020,8 @@ cfg80211_offchan_cac_event(struct cfg802 - enum nl80211_radar_event event) - { - wiphy_lock(&rdev->wiphy); -- __cfg80211_offchan_cac_event(rdev, NULL, chandef, event); -+ __cfg80211_offchan_cac_event(rdev, rdev->offchan_radar_wdev, -+ chandef, event); - wiphy_unlock(&rdev->wiphy); - } - -@@ -1071,7 +1068,13 @@ cfg80211_start_offchan_radar_detection(s - NL80211_EXT_FEATURE_RADAR_OFFCHAN)) - return -EOPNOTSUPP; - -- if (rdev->offchan_radar_wdev) -+ /* Offchannel chain already locked by another wdev */ -+ if (rdev->offchan_radar_wdev && rdev->offchan_radar_wdev != wdev) -+ return -EBUSY; -+ -+ /* CAC already in progress on the offchannel chain */ -+ if (rdev->offchan_radar_wdev == wdev && -+ delayed_work_pending(&rdev->offchan_cac_done_wk)) - return -EBUSY; - - err = rdev_set_radar_offchan(rdev, chandef); -@@ -1083,6 +1086,8 @@ cfg80211_start_offchan_radar_detection(s - cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; - - rdev->offchan_radar_chandef = *chandef; -+ rdev->offchan_radar_wdev = wdev; /* Get offchain ownership */ -+ - __cfg80211_offchan_cac_event(rdev, wdev, chandef, - NL80211_RADAR_CAC_STARTED); - queue_delayed_work(cfg80211_wq, &rdev->offchan_cac_done_wk, -@@ -1102,6 +1107,7 @@ void cfg80211_stop_offchan_radar_detecti - return; - - rdev_set_radar_offchan(rdev, NULL); -+ rdev->offchan_radar_wdev = NULL; /* Release offchain ownership */ - - __cfg80211_offchan_cac_event(rdev, wdev, &rdev->offchan_radar_chandef, - NL80211_RADAR_CAC_ABORTED); ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -9278,42 +9278,60 @@ static int nl80211_start_radar_detection - struct cfg80211_chan_def chandef; - enum nl80211_dfs_regions dfs_region; - unsigned int cac_time_ms; -- int err; -+ int err = -EINVAL; -+ -+ flush_delayed_work(&rdev->dfs_update_channels_wk); -+ -+ wiphy_lock(wiphy); - - dfs_region = reg_get_dfs_region(wiphy); - if (dfs_region == NL80211_DFS_UNSET) -- return -EINVAL; -+ goto unlock; - - err = nl80211_parse_chandef(rdev, info, &chandef); - if (err) -- return err; -+ goto unlock; - - err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype); - if (err < 0) -- return err; -+ goto unlock; - -- if (err == 0) -- return -EINVAL; -+ if (err == 0) { -+ err = -EINVAL; -+ goto unlock; -+ } - -- if (!cfg80211_chandef_dfs_usable(wiphy, &chandef)) -- return -EINVAL; -+ if (!cfg80211_chandef_dfs_usable(wiphy, &chandef)) { -+ err = -EINVAL; -+ goto unlock; -+ } - -- if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN])) -- return cfg80211_start_offchan_radar_detection(rdev, wdev, -- &chandef); -+ if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN])) { -+ err = cfg80211_start_offchan_radar_detection(rdev, wdev, -+ &chandef); -+ goto unlock; -+ } - -- if (netif_carrier_ok(dev)) -- return -EBUSY; -+ if (netif_carrier_ok(dev)) { -+ err = -EBUSY; -+ goto unlock; -+ } - -- if (wdev->cac_started) -- return -EBUSY; -+ if (wdev->cac_started) { -+ err = -EBUSY; -+ goto unlock; -+ } - - /* CAC start is offloaded to HW and can't be started manually */ -- if (wiphy_ext_feature_isset(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD)) -- return -EOPNOTSUPP; -+ if (wiphy_ext_feature_isset(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD)) { -+ err = -EOPNOTSUPP; -+ goto unlock; -+ } - -- if (!rdev->ops->start_radar_detection) -- return -EOPNOTSUPP; -+ if (!rdev->ops->start_radar_detection) { -+ err = -EOPNOTSUPP; -+ goto unlock; -+ } - - cac_time_ms = cfg80211_chandef_dfs_cac_time(&rdev->wiphy, &chandef); - if (WARN_ON(!cac_time_ms)) -@@ -9326,6 +9344,9 @@ static int nl80211_start_radar_detection - wdev->cac_start_time = jiffies; - wdev->cac_time_ms = cac_time_ms; - } -+unlock: -+ wiphy_unlock(wiphy); -+ - return err; - } - -@@ -15961,7 +15982,8 @@ static const struct genl_small_ops nl802 - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .doit = nl80211_start_radar_detection, - .flags = GENL_UNS_ADMIN_PERM, -- .internal_flags = NL80211_FLAG_NEED_NETDEV_UP, -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | -+ NL80211_FLAG_NO_WIPHY_MTX, - }, - { - .cmd = NL80211_CMD_GET_PROTOCOL_FEATURES, diff --git a/package/kernel/mac80211/patches/subsys/319-v5.17-mac80211-introduce-set_radar_offchan-callback.patch b/package/kernel/mac80211/patches/subsys/319-v5.17-mac80211-introduce-set_radar_offchan-callback.patch deleted file mode 100644 index 6197abda56a..00000000000 --- a/package/kernel/mac80211/patches/subsys/319-v5.17-mac80211-introduce-set_radar_offchan-callback.patch +++ /dev/null @@ -1,67 +0,0 @@ -From: Lorenzo Bianconi -Date: Sat, 23 Oct 2021 11:10:51 +0200 -Subject: [PATCH] mac80211: introduce set_radar_offchan callback - -Similar to cfg80211, introduce set_radar_offchan callback in mac80211_ops -in order to configure a dedicated offchannel chain available on some hw -(e.g. mt7915) to perform offchannel CAC detection and avoid tx/rx downtime. - -Tested-by: Evelyn Tsai -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/201110606d4f3a7dfdf31440e351f2e2c375d4f0.1634979655.git.lorenzo@kernel.org -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -3937,6 +3937,14 @@ struct ieee80211_prep_tx_info { - * twt structure. - * @twt_teardown_request: Update the hw with TWT teardown request received - * from the peer. -+ * @set_radar_offchan: Configure dedicated offchannel chain available for -+ * radar/CAC detection on some hw. This chain can't be used to transmit -+ * or receive frames and it is bounded to a running wdev. -+ * Offchannel radar/CAC detection allows to avoid the CAC downtime -+ * switching to a different channel during CAC detection on the selected -+ * radar channel. -+ * The caller is expected to set chandef pointer to NULL in order to -+ * disable offchannel CAC/radar detection. - * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to - * resolve a path for hardware flow offloading - */ -@@ -4267,6 +4275,8 @@ struct ieee80211_ops { - struct ieee80211_twt_setup *twt); - void (*twt_teardown_request)(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 flowid); -+ int (*set_radar_offchan)(struct ieee80211_hw *hw, -+ struct cfg80211_chan_def *chandef); - #if LINUX_VERSION_IS_GEQ(5,10,0) - int (*net_fill_forward_path)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -4341,6 +4341,18 @@ out: - return err; - } - -+static int -+ieee80211_set_radar_offchan(struct wiphy *wiphy, -+ struct cfg80211_chan_def *chandef) -+{ -+ struct ieee80211_local *local = wiphy_priv(wiphy); -+ -+ if (!local->ops->set_radar_offchan) -+ return -EOPNOTSUPP; -+ -+ return local->ops->set_radar_offchan(&local->hw, chandef); -+} -+ - const struct cfg80211_ops mac80211_config_ops = { - .add_virtual_intf = ieee80211_add_iface, - .del_virtual_intf = ieee80211_del_iface, -@@ -4445,4 +4457,5 @@ const struct cfg80211_ops mac80211_confi - .reset_tid_config = ieee80211_reset_tid_config, - .set_sar_specs = ieee80211_set_sar_specs, - .color_change = ieee80211_color_change, -+ .set_radar_offchan = ieee80211_set_radar_offchan, - }; diff --git a/package/kernel/mac80211/patches/subsys/320-v5.17-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch b/package/kernel/mac80211/patches/subsys/320-v5.17-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch deleted file mode 100644 index 608e72468d3..00000000000 --- a/package/kernel/mac80211/patches/subsys/320-v5.17-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch +++ /dev/null @@ -1,532 +0,0 @@ -From: Lorenzo Bianconi -Date: Mon, 29 Nov 2021 14:11:24 +0100 -Subject: [PATCH] cfg80211: rename offchannel_chain structs to background_chain - to avoid confusion with ETSI standard - -ETSI standard defines "Offchannel CAC" as: -"Off-Channel CAC is performed by a number of non-continuous checks -spread over a period in time. This period, which is required to -determine the presence of radar signals, is defined as the Off-Channel -CAC Time.. -Minimum Off-Channel CAC Time 6 minutes and Maximum Off-Channel CAC Time -4 hours..". -mac80211 implementation refers to a dedicated hw chain used for continuous -radar monitoring. Rename offchannel_* references to background_* in -order to avoid confusion with ETSI standard. - -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/4204cc1d648d76b44557981713231e030a3bd991.1638190762.git.lorenzo@kernel.org -Signed-off-by: Johannes Berg ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -4058,14 +4058,14 @@ struct mgmt_frame_regs { - * - * @color_change: Initiate a color change. - * -- * @set_radar_offchan: Configure dedicated offchannel chain available for -+ * @set_radar_background: Configure dedicated offchannel chain available for - * radar/CAC detection on some hw. This chain can't be used to transmit - * or receive frames and it is bounded to a running wdev. -- * Offchannel radar/CAC detection allows to avoid the CAC downtime -+ * Background radar/CAC detection allows to avoid the CAC downtime - * switching to a different channel during CAC detection on the selected - * radar channel. - * The caller is expected to set chandef pointer to NULL in order to -- * disable offchannel CAC/radar detection. -+ * disable background CAC/radar detection. - */ - struct cfg80211_ops { - int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); -@@ -4396,8 +4396,8 @@ struct cfg80211_ops { - int (*color_change)(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_color_change_settings *params); -- int (*set_radar_offchan)(struct wiphy *wiphy, -- struct cfg80211_chan_def *chandef); -+ int (*set_radar_background)(struct wiphy *wiphy, -+ struct cfg80211_chan_def *chandef); - }; - - /* -@@ -7601,9 +7601,9 @@ cfg80211_radar_event(struct wiphy *wiphy - } - - static inline void --cfg80211_offchan_radar_event(struct wiphy *wiphy, -- struct cfg80211_chan_def *chandef, -- gfp_t gfp) -+cfg80211_background_radar_event(struct wiphy *wiphy, -+ struct cfg80211_chan_def *chandef, -+ gfp_t gfp) - { - __cfg80211_radar_event(wiphy, chandef, true, gfp); - } -@@ -7638,13 +7638,13 @@ void cfg80211_cac_event(struct net_devic - enum nl80211_radar_event event, gfp_t gfp); - - /** -- * cfg80211_offchan_cac_abort - Channel Availability Check offchan abort event -+ * cfg80211_background_cac_abort - Channel Availability Check offchan abort event - * @wiphy: the wiphy - * - * This function is called by the driver when a Channel Availability Check - * (CAC) is aborted by a offchannel dedicated chain. - */ --void cfg80211_offchan_cac_abort(struct wiphy *wiphy); -+void cfg80211_background_cac_abort(struct wiphy *wiphy); - - /** - * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -3937,14 +3937,14 @@ struct ieee80211_prep_tx_info { - * twt structure. - * @twt_teardown_request: Update the hw with TWT teardown request received - * from the peer. -- * @set_radar_offchan: Configure dedicated offchannel chain available for -+ * @set_radar_background: Configure dedicated offchannel chain available for - * radar/CAC detection on some hw. This chain can't be used to transmit - * or receive frames and it is bounded to a running wdev. -- * Offchannel radar/CAC detection allows to avoid the CAC downtime -+ * Background radar/CAC detection allows to avoid the CAC downtime - * switching to a different channel during CAC detection on the selected - * radar channel. - * The caller is expected to set chandef pointer to NULL in order to -- * disable offchannel CAC/radar detection. -+ * disable background CAC/radar detection. - * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to - * resolve a path for hardware flow offloading - */ -@@ -4275,8 +4275,8 @@ struct ieee80211_ops { - struct ieee80211_twt_setup *twt); - void (*twt_teardown_request)(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 flowid); -- int (*set_radar_offchan)(struct ieee80211_hw *hw, -- struct cfg80211_chan_def *chandef); -+ int (*set_radar_background)(struct ieee80211_hw *hw, -+ struct cfg80211_chan_def *chandef); - #if LINUX_VERSION_IS_GEQ(5,10,0) - int (*net_fill_forward_path)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, ---- a/include/uapi/linux/nl80211.h -+++ b/include/uapi/linux/nl80211.h -@@ -2608,10 +2608,10 @@ enum nl80211_commands { - * Mandatory parameter for the transmitting interface to enable MBSSID. - * Optional for the non-transmitting interfaces. - * -- * @NL80211_ATTR_RADAR_OFFCHAN: Configure dedicated offchannel chain available for -- * radar/CAC detection on some hw. This chain can't be used to transmit -- * or receive frames and it is bounded to a running wdev. -- * Offchannel radar/CAC detection allows to avoid the CAC downtime -+ * @NL80211_ATTR_RADAR_BACKGROUND: Configure dedicated offchannel chain -+ * available for radar/CAC detection on some hw. This chain can't be used -+ * to transmit or receive frames and it is bounded to a running wdev. -+ * Background radar/CAC detection allows to avoid the CAC downtime - * switching on a different channel during CAC detection on the selected - * radar channel. - * -@@ -3121,7 +3121,7 @@ enum nl80211_attrs { - NL80211_ATTR_MBSSID_CONFIG, - NL80211_ATTR_MBSSID_ELEMS, - -- NL80211_ATTR_RADAR_OFFCHAN, -+ NL80211_ATTR_RADAR_BACKGROUND, - - /* add attributes here, update the policy in nl80211.c */ - -@@ -6022,7 +6022,7 @@ enum nl80211_feature_flags { - * @NL80211_EXT_FEATURE_BSS_COLOR: The driver supports BSS color collision - * detection and change announcemnts. - * -- * @NL80211_EXT_FEATURE_RADAR_OFFCHAN: Device supports offchannel radar/CAC -+ * @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC - * detection. - * - * @NUM_NL80211_EXT_FEATURES: number of extended features. -@@ -6090,7 +6090,7 @@ enum nl80211_ext_feature_index { - NL80211_EXT_FEATURE_SECURE_RTT, - NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, - NL80211_EXT_FEATURE_BSS_COLOR, -- NL80211_EXT_FEATURE_RADAR_OFFCHAN, -+ NL80211_EXT_FEATURE_RADAR_BACKGROUND, - - /* add new features before the definition below */ - NUM_NL80211_EXT_FEATURES, ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -4342,15 +4342,15 @@ out: - } - - static int --ieee80211_set_radar_offchan(struct wiphy *wiphy, -- struct cfg80211_chan_def *chandef) -+ieee80211_set_radar_background(struct wiphy *wiphy, -+ struct cfg80211_chan_def *chandef) - { - struct ieee80211_local *local = wiphy_priv(wiphy); - -- if (!local->ops->set_radar_offchan) -+ if (!local->ops->set_radar_background) - return -EOPNOTSUPP; - -- return local->ops->set_radar_offchan(&local->hw, chandef); -+ return local->ops->set_radar_background(&local->hw, chandef); - } - - const struct cfg80211_ops mac80211_config_ops = { -@@ -4457,5 +4457,5 @@ const struct cfg80211_ops mac80211_confi - .reset_tid_config = ieee80211_reset_tid_config, - .set_sar_specs = ieee80211_set_sar_specs, - .color_change = ieee80211_color_change, -- .set_radar_offchan = ieee80211_set_radar_offchan, -+ .set_radar_background = ieee80211_set_radar_background, - }; ---- a/net/wireless/chan.c -+++ b/net/wireless/chan.c -@@ -716,13 +716,13 @@ static bool - cfg80211_offchan_chain_is_active(struct cfg80211_registered_device *rdev, - struct ieee80211_channel *channel) - { -- if (!rdev->offchan_radar_wdev) -+ if (!rdev->background_radar_wdev) - return false; - -- if (!cfg80211_chandef_valid(&rdev->offchan_radar_chandef)) -+ if (!cfg80211_chandef_valid(&rdev->background_radar_chandef)) - return false; - -- return cfg80211_is_sub_chan(&rdev->offchan_radar_chandef, channel); -+ return cfg80211_is_sub_chan(&rdev->background_radar_chandef, channel); - } - - bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, ---- a/net/wireless/core.c -+++ b/net/wireless/core.c -@@ -543,9 +543,10 @@ use_default_name: - INIT_WORK(&rdev->rfkill_block, cfg80211_rfkill_block_work); - INIT_WORK(&rdev->conn_work, cfg80211_conn_work); - INIT_WORK(&rdev->event_work, cfg80211_event_work); -- INIT_WORK(&rdev->offchan_cac_abort_wk, cfg80211_offchan_cac_abort_wk); -- INIT_DELAYED_WORK(&rdev->offchan_cac_done_wk, -- cfg80211_offchan_cac_done_wk); -+ INIT_WORK(&rdev->background_cac_abort_wk, -+ cfg80211_background_cac_abort_wk); -+ INIT_DELAYED_WORK(&rdev->background_cac_done_wk, -+ cfg80211_background_cac_done_wk); - - init_waitqueue_head(&rdev->dev_wait); - -@@ -1055,13 +1056,13 @@ void wiphy_unregister(struct wiphy *wiph - cancel_work_sync(&rdev->conn_work); - flush_work(&rdev->event_work); - cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); -- cancel_delayed_work_sync(&rdev->offchan_cac_done_wk); -+ cancel_delayed_work_sync(&rdev->background_cac_done_wk); - flush_work(&rdev->destroy_work); - flush_work(&rdev->sched_scan_stop_wk); - flush_work(&rdev->propagate_radar_detect_wk); - flush_work(&rdev->propagate_cac_done_wk); - flush_work(&rdev->mgmt_registrations_update_wk); -- flush_work(&rdev->offchan_cac_abort_wk); -+ flush_work(&rdev->background_cac_abort_wk); - - #ifdef CONFIG_PM - if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup) -@@ -1210,7 +1211,7 @@ void __cfg80211_leave(struct cfg80211_re - - cfg80211_pmsr_wdev_down(wdev); - -- cfg80211_stop_offchan_radar_detection(wdev); -+ cfg80211_stop_background_radar_detection(wdev); - - switch (wdev->iftype) { - case NL80211_IFTYPE_ADHOC: ---- a/net/wireless/core.h -+++ b/net/wireless/core.h -@@ -84,10 +84,10 @@ struct cfg80211_registered_device { - - struct delayed_work dfs_update_channels_wk; - -- struct wireless_dev *offchan_radar_wdev; -- struct cfg80211_chan_def offchan_radar_chandef; -- struct delayed_work offchan_cac_done_wk; -- struct work_struct offchan_cac_abort_wk; -+ struct wireless_dev *background_radar_wdev; -+ struct cfg80211_chan_def background_radar_chandef; -+ struct delayed_work background_cac_done_wk; -+ struct work_struct background_cac_abort_wk; - - /* netlink port which started critical protocol (0 means not started) */ - u32 crit_proto_nlportid; -@@ -497,15 +497,15 @@ cfg80211_chandef_dfs_cac_time(struct wip - void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev); - - int --cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev, -- struct wireless_dev *wdev, -- struct cfg80211_chan_def *chandef); -+cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rdev, -+ struct wireless_dev *wdev, -+ struct cfg80211_chan_def *chandef); - --void cfg80211_stop_offchan_radar_detection(struct wireless_dev *wdev); -+void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev); - --void cfg80211_offchan_cac_done_wk(struct work_struct *work); -+void cfg80211_background_cac_done_wk(struct work_struct *work); - --void cfg80211_offchan_cac_abort_wk(struct work_struct *work); -+void cfg80211_background_cac_abort_wk(struct work_struct *work); - - bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, - struct ieee80211_channel *chan); ---- a/net/wireless/mlme.c -+++ b/net/wireless/mlme.c -@@ -920,7 +920,7 @@ void __cfg80211_radar_event(struct wiphy - cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_UNAVAILABLE); - - if (offchan) -- queue_work(cfg80211_wq, &rdev->offchan_cac_abort_wk); -+ queue_work(cfg80211_wq, &rdev->background_cac_abort_wk); - - cfg80211_sched_dfs_chan_update(rdev); - -@@ -975,10 +975,10 @@ void cfg80211_cac_event(struct net_devic - EXPORT_SYMBOL(cfg80211_cac_event); - - static void --__cfg80211_offchan_cac_event(struct cfg80211_registered_device *rdev, -- struct wireless_dev *wdev, -- const struct cfg80211_chan_def *chandef, -- enum nl80211_radar_event event) -+__cfg80211_background_cac_event(struct cfg80211_registered_device *rdev, -+ struct wireless_dev *wdev, -+ const struct cfg80211_chan_def *chandef, -+ enum nl80211_radar_event event) - { - struct wiphy *wiphy = &rdev->wiphy; - struct net_device *netdev; -@@ -988,7 +988,7 @@ __cfg80211_offchan_cac_event(struct cfg8 - if (!cfg80211_chandef_valid(chandef)) - return; - -- if (!rdev->offchan_radar_wdev) -+ if (!rdev->background_radar_wdev) - return; - - switch (event) { -@@ -997,12 +997,12 @@ __cfg80211_offchan_cac_event(struct cfg8 - memcpy(&rdev->cac_done_chandef, chandef, sizeof(*chandef)); - queue_work(cfg80211_wq, &rdev->propagate_cac_done_wk); - cfg80211_sched_dfs_chan_update(rdev); -- wdev = rdev->offchan_radar_wdev; -+ wdev = rdev->background_radar_wdev; - break; - case NL80211_RADAR_CAC_ABORTED: -- if (!cancel_delayed_work(&rdev->offchan_cac_done_wk)) -+ if (!cancel_delayed_work(&rdev->background_cac_done_wk)) - return; -- wdev = rdev->offchan_radar_wdev; -+ wdev = rdev->background_radar_wdev; - break; - case NL80211_RADAR_CAC_STARTED: - break; -@@ -1015,49 +1015,49 @@ __cfg80211_offchan_cac_event(struct cfg8 - } - - static void --cfg80211_offchan_cac_event(struct cfg80211_registered_device *rdev, -- const struct cfg80211_chan_def *chandef, -- enum nl80211_radar_event event) -+cfg80211_background_cac_event(struct cfg80211_registered_device *rdev, -+ const struct cfg80211_chan_def *chandef, -+ enum nl80211_radar_event event) - { - wiphy_lock(&rdev->wiphy); -- __cfg80211_offchan_cac_event(rdev, rdev->offchan_radar_wdev, -- chandef, event); -+ __cfg80211_background_cac_event(rdev, rdev->background_radar_wdev, -+ chandef, event); - wiphy_unlock(&rdev->wiphy); - } - --void cfg80211_offchan_cac_done_wk(struct work_struct *work) -+void cfg80211_background_cac_done_wk(struct work_struct *work) - { - struct delayed_work *delayed_work = to_delayed_work(work); - struct cfg80211_registered_device *rdev; - - rdev = container_of(delayed_work, struct cfg80211_registered_device, -- offchan_cac_done_wk); -- cfg80211_offchan_cac_event(rdev, &rdev->offchan_radar_chandef, -- NL80211_RADAR_CAC_FINISHED); -+ background_cac_done_wk); -+ cfg80211_background_cac_event(rdev, &rdev->background_radar_chandef, -+ NL80211_RADAR_CAC_FINISHED); - } - --void cfg80211_offchan_cac_abort_wk(struct work_struct *work) -+void cfg80211_background_cac_abort_wk(struct work_struct *work) - { - struct cfg80211_registered_device *rdev; - - rdev = container_of(work, struct cfg80211_registered_device, -- offchan_cac_abort_wk); -- cfg80211_offchan_cac_event(rdev, &rdev->offchan_radar_chandef, -- NL80211_RADAR_CAC_ABORTED); -+ background_cac_abort_wk); -+ cfg80211_background_cac_event(rdev, &rdev->background_radar_chandef, -+ NL80211_RADAR_CAC_ABORTED); - } - --void cfg80211_offchan_cac_abort(struct wiphy *wiphy) -+void cfg80211_background_cac_abort(struct wiphy *wiphy) - { - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); - -- queue_work(cfg80211_wq, &rdev->offchan_cac_abort_wk); -+ queue_work(cfg80211_wq, &rdev->background_cac_abort_wk); - } --EXPORT_SYMBOL(cfg80211_offchan_cac_abort); -+EXPORT_SYMBOL(cfg80211_background_cac_abort); - - int --cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev, -- struct wireless_dev *wdev, -- struct cfg80211_chan_def *chandef) -+cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rdev, -+ struct wireless_dev *wdev, -+ struct cfg80211_chan_def *chandef) - { - unsigned int cac_time_ms; - int err; -@@ -1065,19 +1065,19 @@ cfg80211_start_offchan_radar_detection(s - lockdep_assert_wiphy(&rdev->wiphy); - - if (!wiphy_ext_feature_isset(&rdev->wiphy, -- NL80211_EXT_FEATURE_RADAR_OFFCHAN)) -+ NL80211_EXT_FEATURE_RADAR_BACKGROUND)) - return -EOPNOTSUPP; - - /* Offchannel chain already locked by another wdev */ -- if (rdev->offchan_radar_wdev && rdev->offchan_radar_wdev != wdev) -+ if (rdev->background_radar_wdev && rdev->background_radar_wdev != wdev) - return -EBUSY; - - /* CAC already in progress on the offchannel chain */ -- if (rdev->offchan_radar_wdev == wdev && -- delayed_work_pending(&rdev->offchan_cac_done_wk)) -+ if (rdev->background_radar_wdev == wdev && -+ delayed_work_pending(&rdev->background_cac_done_wk)) - return -EBUSY; - -- err = rdev_set_radar_offchan(rdev, chandef); -+ err = rdev_set_radar_background(rdev, chandef); - if (err) - return err; - -@@ -1085,30 +1085,31 @@ cfg80211_start_offchan_radar_detection(s - if (!cac_time_ms) - cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; - -- rdev->offchan_radar_chandef = *chandef; -- rdev->offchan_radar_wdev = wdev; /* Get offchain ownership */ -+ rdev->background_radar_chandef = *chandef; -+ rdev->background_radar_wdev = wdev; /* Get offchain ownership */ - -- __cfg80211_offchan_cac_event(rdev, wdev, chandef, -- NL80211_RADAR_CAC_STARTED); -- queue_delayed_work(cfg80211_wq, &rdev->offchan_cac_done_wk, -+ __cfg80211_background_cac_event(rdev, wdev, chandef, -+ NL80211_RADAR_CAC_STARTED); -+ queue_delayed_work(cfg80211_wq, &rdev->background_cac_done_wk, - msecs_to_jiffies(cac_time_ms)); - - return 0; - } - --void cfg80211_stop_offchan_radar_detection(struct wireless_dev *wdev) -+void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev) - { - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); - - lockdep_assert_wiphy(wiphy); - -- if (wdev != rdev->offchan_radar_wdev) -+ if (wdev != rdev->background_radar_wdev) - return; - -- rdev_set_radar_offchan(rdev, NULL); -- rdev->offchan_radar_wdev = NULL; /* Release offchain ownership */ -+ rdev_set_radar_background(rdev, NULL); -+ rdev->background_radar_wdev = NULL; /* Release offchain ownership */ - -- __cfg80211_offchan_cac_event(rdev, wdev, &rdev->offchan_radar_chandef, -- NL80211_RADAR_CAC_ABORTED); -+ __cfg80211_background_cac_event(rdev, wdev, -+ &rdev->background_radar_chandef, -+ NL80211_RADAR_CAC_ABORTED); - } ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -801,7 +801,7 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_MBSSID_CONFIG] = - NLA_POLICY_NESTED(nl80211_mbssid_config_policy), - [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, -- [NL80211_ATTR_RADAR_OFFCHAN] = { .type = NLA_FLAG }, -+ [NL80211_ATTR_RADAR_BACKGROUND] = { .type = NLA_FLAG }, - }; - - /* policy for the key attributes */ -@@ -9306,9 +9306,9 @@ static int nl80211_start_radar_detection - goto unlock; - } - -- if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN])) { -- err = cfg80211_start_offchan_radar_detection(rdev, wdev, -- &chandef); -+ if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_BACKGROUND])) { -+ err = cfg80211_start_background_radar_detection(rdev, wdev, -+ &chandef); - goto unlock; - } - ---- a/net/wireless/rdev-ops.h -+++ b/net/wireless/rdev-ops.h -@@ -1382,17 +1382,17 @@ static inline int rdev_color_change(stru - } - - static inline int --rdev_set_radar_offchan(struct cfg80211_registered_device *rdev, -- struct cfg80211_chan_def *chandef) -+rdev_set_radar_background(struct cfg80211_registered_device *rdev, -+ struct cfg80211_chan_def *chandef) - { - struct wiphy *wiphy = &rdev->wiphy; - int ret; - -- if (!rdev->ops->set_radar_offchan) -+ if (!rdev->ops->set_radar_background) - return -EOPNOTSUPP; - -- trace_rdev_set_radar_offchan(wiphy, chandef); -- ret = rdev->ops->set_radar_offchan(wiphy, chandef); -+ trace_rdev_set_radar_background(wiphy, chandef); -+ ret = rdev->ops->set_radar_background(wiphy, chandef); - trace_rdev_return_int(wiphy, ret); - - return ret; ---- a/net/wireless/trace.h -+++ b/net/wireless/trace.h -@@ -3646,7 +3646,7 @@ TRACE_EVENT(cfg80211_bss_color_notify, - __entry->color_bitmap) - ); - --TRACE_EVENT(rdev_set_radar_offchan, -+TRACE_EVENT(rdev_set_radar_background, - TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef), - - TP_ARGS(wiphy, chandef), diff --git a/package/kernel/mac80211/patches/subsys/323-v5.16-mac80211-MBSSID-support-in-interface-handling.patch b/package/kernel/mac80211/patches/subsys/323-v5.16-mac80211-MBSSID-support-in-interface-handling.patch deleted file mode 100644 index a135e3d1b51..00000000000 --- a/package/kernel/mac80211/patches/subsys/323-v5.16-mac80211-MBSSID-support-in-interface-handling.patch +++ /dev/null @@ -1,144 +0,0 @@ -From: John Crispin -Date: Wed, 15 Sep 2021 19:54:35 -0700 -Subject: [PATCH] mac80211: MBSSID support in interface handling - -Configure multiple BSSID and enhanced multi-BSSID advertisement (EMA) -parameters in mac80211 for AP mode. - -For each interface, 'mbssid_tx_vif' points to the transmitting interface of -the MBSSID set. The pointer is set to NULL if MBSSID is disabled. - -Function ieee80211_stop() is modified to always bring down all the -non-transmitting interfaces first and the transmitting interface last. - -Signed-off-by: John Crispin -Co-developed-by: Aloka Dixit -Signed-off-by: Aloka Dixit -Link: https://lore.kernel.org/r/20210916025437.29138-3-alokad@codeaurora.org -[slightly change logic to be more obvious] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -1719,6 +1719,7 @@ enum ieee80211_offload_flags { - * write-protected by sdata_lock and local->mtx so holding either is fine - * for read access. - * @color_change_color: the bss color that will be used after the change. -+ * @mbssid_tx_vif: Pointer to the transmitting interface if MBSSID is enabled. - */ - struct ieee80211_vif { - enum nl80211_iftype type; -@@ -1750,6 +1751,8 @@ struct ieee80211_vif { - bool color_change_active; - u8 color_change_color; - -+ struct ieee80211_vif *mbssid_tx_vif; -+ - /* must be last */ - u8 drv_priv[] __aligned(sizeof(void *)); - }; ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -112,6 +112,36 @@ static int ieee80211_set_mon_options(str - return 0; - } - -+static int ieee80211_set_ap_mbssid_options(struct ieee80211_sub_if_data *sdata, -+ struct cfg80211_mbssid_config params) -+{ -+ struct ieee80211_sub_if_data *tx_sdata; -+ -+ sdata->vif.mbssid_tx_vif = NULL; -+ sdata->vif.bss_conf.bssid_index = 0; -+ sdata->vif.bss_conf.nontransmitted = false; -+ sdata->vif.bss_conf.ema_ap = false; -+ -+ if (sdata->vif.type != NL80211_IFTYPE_AP || !params.tx_wdev) -+ return -EINVAL; -+ -+ tx_sdata = IEEE80211_WDEV_TO_SUB_IF(params.tx_wdev); -+ if (!tx_sdata) -+ return -EINVAL; -+ -+ if (tx_sdata == sdata) { -+ sdata->vif.mbssid_tx_vif = &sdata->vif; -+ } else { -+ sdata->vif.mbssid_tx_vif = &tx_sdata->vif; -+ sdata->vif.bss_conf.nontransmitted = true; -+ sdata->vif.bss_conf.bssid_index = params.index; -+ } -+ if (params.ema) -+ sdata->vif.bss_conf.ema_ap = true; -+ -+ return 0; -+} -+ - static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy, - const char *name, - unsigned char name_assign_type, -@@ -1107,6 +1137,14 @@ static int ieee80211_start_ap(struct wip - changed |= BSS_CHANGED_HE_BSS_COLOR; - } - -+ if (sdata->vif.type == NL80211_IFTYPE_AP && -+ params->mbssid_config.tx_wdev) { -+ err = ieee80211_set_ap_mbssid_options(sdata, -+ params->mbssid_config); -+ if (err) -+ return err; -+ } -+ - mutex_lock(&local->mtx); - err = ieee80211_vif_use_channel(sdata, ¶ms->chandef, - IEEE80211_CHANCTX_SHARED); ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -632,17 +632,46 @@ static void ieee80211_do_stop(struct iee - ieee80211_add_virtual_monitor(local); - } - -+static void ieee80211_stop_mbssid(struct ieee80211_sub_if_data *sdata) -+{ -+ struct ieee80211_sub_if_data *tx_sdata, *non_tx_sdata, *tmp_sdata; -+ struct ieee80211_vif *tx_vif = sdata->vif.mbssid_tx_vif; -+ -+ if (!tx_vif) -+ return; -+ -+ tx_sdata = vif_to_sdata(tx_vif); -+ sdata->vif.mbssid_tx_vif = NULL; -+ -+ list_for_each_entry_safe(non_tx_sdata, tmp_sdata, -+ &tx_sdata->local->interfaces, list) { -+ if (non_tx_sdata != sdata && non_tx_sdata != tx_sdata && -+ non_tx_sdata->vif.mbssid_tx_vif == tx_vif && -+ ieee80211_sdata_running(non_tx_sdata)) { -+ non_tx_sdata->vif.mbssid_tx_vif = NULL; -+ dev_close(non_tx_sdata->wdev.netdev); -+ } -+ } -+ -+ if (sdata != tx_sdata && ieee80211_sdata_running(tx_sdata)) { -+ tx_sdata->vif.mbssid_tx_vif = NULL; -+ dev_close(tx_sdata->wdev.netdev); -+ } -+} -+ - static int ieee80211_stop(struct net_device *dev) - { - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - -- /* close all dependent VLAN interfaces before locking wiphy */ -+ /* close dependent VLAN and MBSSID interfaces before locking wiphy */ - if (sdata->vif.type == NL80211_IFTYPE_AP) { - struct ieee80211_sub_if_data *vlan, *tmpsdata; - - list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans, - u.vlan.list) - dev_close(vlan->dev); -+ -+ ieee80211_stop_mbssid(sdata); - } - - wiphy_lock(sdata->local->hw.wiphy); diff --git a/package/kernel/mac80211/patches/subsys/324-v5.18-mac80211-MBSSID-beacon-handling-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/324-v5.18-mac80211-MBSSID-beacon-handling-in-AP-mode.patch deleted file mode 100644 index a8fc02f92d8..00000000000 --- a/package/kernel/mac80211/patches/subsys/324-v5.18-mac80211-MBSSID-beacon-handling-in-AP-mode.patch +++ /dev/null @@ -1,326 +0,0 @@ -From: Lorenzo Bianconi -Date: Thu, 24 Feb 2022 12:54:58 +0100 -Subject: [PATCH] mac80211: MBSSID beacon handling in AP mode - -Add new fields in struct beacon_data to store all MBSSID elements. -Generate a beacon template which includes all MBSSID elements. -Move CSA offset to reflect the MBSSID element length. - -Co-developed-by: Aloka Dixit -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Lorenzo Bianconi -Tested-by: Money Wang -Link: https://lore.kernel.org/r/5322db3c303f431adaf191ab31c45e151dde5465.1645702516.git.lorenzo@kernel.org -[small cleanups] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -4938,12 +4938,14 @@ void ieee80211_report_low_ack(struct iee - * @cntdwn_counter_offs: array of IEEE80211_MAX_CNTDWN_COUNTERS_NUM offsets - * to countdown counters. This array can contain zero values which - * should be ignored. -+ * @mbssid_off: position of the multiple bssid element - */ - struct ieee80211_mutable_offsets { - u16 tim_offset; - u16 tim_length; - - u16 cntdwn_counter_offs[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; -+ u16 mbssid_off; - }; - - /** ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -989,11 +989,29 @@ static int ieee80211_set_ftm_responder_p - return 0; - } - -+static int -+ieee80211_copy_mbssid_beacon(u8 *pos, struct cfg80211_mbssid_elems *dst, -+ struct cfg80211_mbssid_elems *src) -+{ -+ int i, offset = 0; -+ -+ for (i = 0; i < src->cnt; i++) { -+ memcpy(pos + offset, src->elem[i].data, src->elem[i].len); -+ dst->elem[i].len = src->elem[i].len; -+ dst->elem[i].data = pos + offset; -+ offset += dst->elem[i].len; -+ } -+ dst->cnt = src->cnt; -+ -+ return offset; -+} -+ - static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, - struct cfg80211_beacon_data *params, - const struct ieee80211_csa_settings *csa, - const struct ieee80211_color_change_settings *cca) - { -+ struct cfg80211_mbssid_elems *mbssid = NULL; - struct beacon_data *new, *old; - int new_head_len, new_tail_len; - int size, err; -@@ -1021,6 +1039,17 @@ static int ieee80211_assign_beacon(struc - - size = sizeof(*new) + new_head_len + new_tail_len; - -+ /* new or old multiple BSSID elements? */ -+ if (params->mbssid_ies) { -+ mbssid = params->mbssid_ies; -+ size += struct_size(new->mbssid_ies, elem, mbssid->cnt); -+ size += ieee80211_get_mbssid_beacon_len(mbssid); -+ } else if (old && old->mbssid_ies) { -+ mbssid = old->mbssid_ies; -+ size += struct_size(new->mbssid_ies, elem, mbssid->cnt); -+ size += ieee80211_get_mbssid_beacon_len(mbssid); -+ } -+ - new = kzalloc(size, GFP_KERNEL); - if (!new) - return -ENOMEM; -@@ -1029,12 +1058,20 @@ static int ieee80211_assign_beacon(struc - - /* - * pointers go into the block we allocated, -- * memory is | beacon_data | head | tail | -+ * memory is | beacon_data | head | tail | mbssid_ies - */ - new->head = ((u8 *) new) + sizeof(*new); - new->tail = new->head + new_head_len; - new->head_len = new_head_len; - new->tail_len = new_tail_len; -+ /* copy in optional mbssid_ies */ -+ if (mbssid) { -+ u8 *pos = new->tail + new->tail_len; -+ -+ new->mbssid_ies = (void *)pos; -+ pos += struct_size(new->mbssid_ies, elem, mbssid->cnt); -+ ieee80211_copy_mbssid_beacon(pos, new->mbssid_ies, mbssid); -+ } - - if (csa) { - new->cntdwn_current_counter = csa->count; -@@ -1332,8 +1369,11 @@ static int ieee80211_stop_ap(struct wiph - - mutex_unlock(&local->mtx); - -- kfree(sdata->u.ap.next_beacon); -- sdata->u.ap.next_beacon = NULL; -+ if (sdata->u.ap.next_beacon) { -+ kfree(sdata->u.ap.next_beacon->mbssid_ies); -+ kfree(sdata->u.ap.next_beacon); -+ sdata->u.ap.next_beacon = NULL; -+ } - - /* turn off carrier for this interface and dependent VLANs */ - list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) -@@ -3126,12 +3166,24 @@ cfg80211_beacon_dup(struct cfg80211_beac - - len = beacon->head_len + beacon->tail_len + beacon->beacon_ies_len + - beacon->proberesp_ies_len + beacon->assocresp_ies_len + -- beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len; -+ beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len + -+ ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies); - - new_beacon = kzalloc(sizeof(*new_beacon) + len, GFP_KERNEL); - if (!new_beacon) - return NULL; - -+ if (beacon->mbssid_ies && beacon->mbssid_ies->cnt) { -+ new_beacon->mbssid_ies = -+ kzalloc(struct_size(new_beacon->mbssid_ies, -+ elem, beacon->mbssid_ies->cnt), -+ GFP_KERNEL); -+ if (!new_beacon->mbssid_ies) { -+ kfree(new_beacon); -+ return NULL; -+ } -+ } -+ - pos = (u8 *)(new_beacon + 1); - if (beacon->head_len) { - new_beacon->head_len = beacon->head_len; -@@ -3169,6 +3221,10 @@ cfg80211_beacon_dup(struct cfg80211_beac - memcpy(pos, beacon->probe_resp, beacon->probe_resp_len); - pos += beacon->probe_resp_len; - } -+ if (beacon->mbssid_ies && beacon->mbssid_ies->cnt) -+ pos += ieee80211_copy_mbssid_beacon(pos, -+ new_beacon->mbssid_ies, -+ beacon->mbssid_ies); - - /* might copy -1, meaning no changes requested */ - new_beacon->ftm_responder = beacon->ftm_responder; -@@ -3206,8 +3262,11 @@ static int ieee80211_set_after_csa_beaco - case NL80211_IFTYPE_AP: - err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon, - NULL, NULL); -- kfree(sdata->u.ap.next_beacon); -- sdata->u.ap.next_beacon = NULL; -+ if (sdata->u.ap.next_beacon) { -+ kfree(sdata->u.ap.next_beacon->mbssid_ies); -+ kfree(sdata->u.ap.next_beacon); -+ sdata->u.ap.next_beacon = NULL; -+ } - - if (err < 0) - return err; -@@ -3362,8 +3421,12 @@ static int ieee80211_set_csa_beacon(stru - if ((params->n_counter_offsets_beacon > - IEEE80211_MAX_CNTDWN_COUNTERS_NUM) || - (params->n_counter_offsets_presp > -- IEEE80211_MAX_CNTDWN_COUNTERS_NUM)) -+ IEEE80211_MAX_CNTDWN_COUNTERS_NUM)) { -+ kfree(sdata->u.ap.next_beacon->mbssid_ies); -+ kfree(sdata->u.ap.next_beacon); -+ sdata->u.ap.next_beacon = NULL; - return -EINVAL; -+ } - - csa.counter_offsets_beacon = params->counter_offsets_beacon; - csa.counter_offsets_presp = params->counter_offsets_presp; -@@ -3373,7 +3436,9 @@ static int ieee80211_set_csa_beacon(stru - - err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa, &csa, NULL); - if (err < 0) { -+ kfree(sdata->u.ap.next_beacon->mbssid_ies); - kfree(sdata->u.ap.next_beacon); -+ sdata->u.ap.next_beacon = NULL; - return err; - } - *changed |= err; -@@ -3460,8 +3525,11 @@ static int ieee80211_set_csa_beacon(stru - static void ieee80211_color_change_abort(struct ieee80211_sub_if_data *sdata) - { - sdata->vif.color_change_active = false; -- kfree(sdata->u.ap.next_beacon); -- sdata->u.ap.next_beacon = NULL; -+ if (sdata->u.ap.next_beacon) { -+ kfree(sdata->u.ap.next_beacon->mbssid_ies); -+ kfree(sdata->u.ap.next_beacon); -+ sdata->u.ap.next_beacon = NULL; -+ } - - cfg80211_color_change_aborted_notify(sdata->dev); - } -@@ -4199,8 +4267,11 @@ ieee80211_set_after_color_change_beacon( - - ret = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon, - NULL, NULL); -- kfree(sdata->u.ap.next_beacon); -- sdata->u.ap.next_beacon = NULL; -+ if (sdata->u.ap.next_beacon) { -+ kfree(sdata->u.ap.next_beacon->mbssid_ies); -+ kfree(sdata->u.ap.next_beacon); -+ sdata->u.ap.next_beacon = NULL; -+ } - - if (ret < 0) - return ret; -@@ -4243,7 +4314,11 @@ ieee80211_set_color_change_beacon(struct - err = ieee80211_assign_beacon(sdata, ¶ms->beacon_color_change, - NULL, &color_change); - if (err < 0) { -- kfree(sdata->u.ap.next_beacon); -+ if (sdata->u.ap.next_beacon) { -+ kfree(sdata->u.ap.next_beacon->mbssid_ies); -+ kfree(sdata->u.ap.next_beacon); -+ sdata->u.ap.next_beacon = NULL; -+ } - return err; - } - *changed |= err; ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -261,6 +261,7 @@ struct beacon_data { - struct ieee80211_meshconf_ie *meshconf; - u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; - u8 cntdwn_current_counter; -+ struct cfg80211_mbssid_elems *mbssid_ies; - struct rcu_head rcu_head; - }; - -@@ -1082,6 +1083,20 @@ ieee80211_vif_get_shift(struct ieee80211 - return shift; - } - -+static inline int -+ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems) -+{ -+ int i, len = 0; -+ -+ if (!elems) -+ return 0; -+ -+ for (i = 0; i < elems->cnt; i++) -+ len += elems->elem[i].len; -+ -+ return len; -+} -+ - enum { - IEEE80211_RX_MSG = 1, - IEEE80211_TX_STATUS_MSG = 2, ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -5041,6 +5041,19 @@ ieee80211_beacon_get_finish(struct ieee8 - IEEE80211_TX_CTL_FIRST_FRAGMENT; - } - -+static void -+ieee80211_beacon_add_mbssid(struct sk_buff *skb, struct beacon_data *beacon) -+{ -+ int i; -+ -+ if (!beacon->mbssid_ies) -+ return; -+ -+ for (i = 0; i < beacon->mbssid_ies->cnt; i++) -+ skb_put_data(skb, beacon->mbssid_ies->elem[i].data, -+ beacon->mbssid_ies->elem[i].len); -+} -+ - static struct sk_buff * - ieee80211_beacon_get_ap(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, -@@ -5054,6 +5067,7 @@ ieee80211_beacon_get_ap(struct ieee80211 - struct ieee80211_if_ap *ap = &sdata->u.ap; - struct sk_buff *skb = NULL; - u16 csa_off_base = 0; -+ int mbssid_len; - - if (beacon->cntdwn_counter_offsets[0]) { - if (!is_template) -@@ -5063,11 +5077,12 @@ ieee80211_beacon_get_ap(struct ieee80211 - } - - /* headroom, head length, -- * tail length and maximum TIM length -+ * tail length, maximum TIM length and multiple BSSID length - */ -+ mbssid_len = ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies); - skb = dev_alloc_skb(local->tx_headroom + beacon->head_len + - beacon->tail_len + 256 + -- local->hw.extra_beacon_tailroom); -+ local->hw.extra_beacon_tailroom + mbssid_len); - if (!skb) - return NULL; - -@@ -5081,6 +5096,11 @@ ieee80211_beacon_get_ap(struct ieee80211 - offs->tim_length = skb->len - beacon->head_len; - offs->cntdwn_counter_offs[0] = beacon->cntdwn_counter_offsets[0]; - -+ if (mbssid_len) { -+ ieee80211_beacon_add_mbssid(skb, beacon); -+ offs->mbssid_off = skb->len - mbssid_len; -+ } -+ - /* for AP the csa offsets are from tail */ - csa_off_base = skb->len; - } diff --git a/package/kernel/mac80211/patches/subsys/325-v5.18-mac80211-MBSSID-channel-switch.patch b/package/kernel/mac80211/patches/subsys/325-v5.18-mac80211-MBSSID-channel-switch.patch deleted file mode 100644 index 38b0de180ed..00000000000 --- a/package/kernel/mac80211/patches/subsys/325-v5.18-mac80211-MBSSID-channel-switch.patch +++ /dev/null @@ -1,52 +0,0 @@ -From: John Crispin -Date: Thu, 24 Feb 2022 12:54:59 +0100 -Subject: [PATCH] mac80211: MBSSID channel switch - -Trigger ieee80211_csa_finish() on the non-transmitting interfaces -when channel switch concludes on the transmitting interface. - -Co-developed-by: Lorenzo Bianconi -Signed-off-by: Lorenzo Bianconi -Co-developed-by: Aloka Dixit -Signed-off-by: Aloka Dixit -Signed-off-by: John Crispin -Link: https://lore.kernel.org/r/6fde4d7f9fa387494f46a7aa4a584478dcda06f1.1645702516.git.lorenzo@kernel.org -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -3247,9 +3247,31 @@ cfg80211_beacon_dup(struct cfg80211_beac - void ieee80211_csa_finish(struct ieee80211_vif *vif) - { - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); -+ struct ieee80211_local *local = sdata->local; - -- ieee80211_queue_work(&sdata->local->hw, -- &sdata->csa_finalize_work); -+ rcu_read_lock(); -+ -+ if (vif->mbssid_tx_vif == vif) { -+ /* Trigger ieee80211_csa_finish() on the non-transmitting -+ * interfaces when channel switch is received on -+ * transmitting interface -+ */ -+ struct ieee80211_sub_if_data *iter; -+ -+ list_for_each_entry_rcu(iter, &local->interfaces, list) { -+ if (!ieee80211_sdata_running(iter)) -+ continue; -+ -+ if (iter == sdata || iter->vif.mbssid_tx_vif != vif) -+ continue; -+ -+ ieee80211_queue_work(&iter->local->hw, -+ &iter->csa_finalize_work); -+ } -+ } -+ ieee80211_queue_work(&local->hw, &sdata->csa_finalize_work); -+ -+ rcu_read_unlock(); - } - EXPORT_SYMBOL(ieee80211_csa_finish); - diff --git a/package/kernel/mac80211/patches/subsys/326-v5.18-mac80211-update-bssid_indicator-in-ieee80211_assign_.patch b/package/kernel/mac80211/patches/subsys/326-v5.18-mac80211-update-bssid_indicator-in-ieee80211_assign_.patch deleted file mode 100644 index 19555686076..00000000000 --- a/package/kernel/mac80211/patches/subsys/326-v5.18-mac80211-update-bssid_indicator-in-ieee80211_assign_.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Lorenzo Bianconi -Date: Thu, 24 Feb 2022 12:55:00 +0100 -Subject: [PATCH] mac80211: update bssid_indicator in - ieee80211_assign_beacon - -Update bssid_indicator in ieee80211_bss_conf according to the -number of bssid in the set. - -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/f92317e002fca9933f05a445fcefb4f53291d601.1645702516.git.lorenzo@kernel.org -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1071,6 +1071,9 @@ static int ieee80211_assign_beacon(struc - new->mbssid_ies = (void *)pos; - pos += struct_size(new->mbssid_ies, elem, mbssid->cnt); - ieee80211_copy_mbssid_beacon(pos, new->mbssid_ies, mbssid); -+ /* update bssid_indicator */ -+ sdata->vif.bss_conf.bssid_indicator = -+ ilog2(__roundup_pow_of_two(mbssid->cnt + 1)); - } - - if (csa) { diff --git a/package/kernel/mac80211/patches/subsys/328-v5.19-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch b/package/kernel/mac80211/patches/subsys/328-v5.19-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch deleted file mode 100644 index f0150ddef0b..00000000000 --- a/package/kernel/mac80211/patches/subsys/328-v5.19-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: Felix Fietkau -Date: Sat, 26 Mar 2022 23:58:35 +0100 -Subject: [PATCH] mac80211: do not wake queues on a vif that is being stopped - -When a vif is being removed and sdata->bss is cleared, __ieee80211_wake_txqs -can still be called on it, which crashes as soon as sdata->bss is being -dereferenced. -To fix this properly, check for SDATA_STATE_RUNNING before waking queues, -and take the fq lock when setting it (to ensure that __ieee80211_wake_txqs -observes the change when running on a different CPU - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -377,7 +377,9 @@ static void ieee80211_do_stop(struct iee - bool cancel_scan; - struct cfg80211_nan_func *func; - -+ spin_lock_bh(&local->fq.lock); - clear_bit(SDATA_STATE_RUNNING, &sdata->state); -+ spin_unlock_bh(&local->fq.lock); - - cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata; - if (cancel_scan) ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -301,6 +301,9 @@ static void __ieee80211_wake_txqs(struct - local_bh_disable(); - spin_lock(&fq->lock); - -+ if (!test_bit(SDATA_STATE_RUNNING, &sdata->state)) -+ goto out; -+ - if (sdata->vif.type == NL80211_IFTYPE_AP) - ps = &sdata->bss->ps; - diff --git a/package/kernel/mac80211/patches/subsys/330-v6.0-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch b/package/kernel/mac80211/patches/subsys/330-v6.0-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch deleted file mode 100644 index e59036f5a2a..00000000000 --- a/package/kernel/mac80211/patches/subsys/330-v6.0-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch +++ /dev/null @@ -1,1249 +0,0 @@ -From: Felix Fietkau -Date: Sun, 19 Jun 2022 23:13:05 +0200 -Subject: [PATCH] mac80211: switch airtime fairness back to deficit round-robin - scheduling - -This reverts commits 6a789ba679d652587532cec2a0e0274fda172f3b and -2433647bc8d983a543e7d31b41ca2de1c7e2c198. - -The virtual time scheduler code has a number of issues: -- queues slowed down by hardware/firmware powersave handling were not properly - handled. -- on ath10k in push-pull mode, tx queues that the driver tries to pull from - were starved, causing excessive latency -- delay between tx enqueue and reported airtime use were causing excessively - bursty tx behavior - -The bursty behavior may also be present on the round-robin scheduler, but there -it is much easier to fix without introducing additional regressions - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -6666,6 +6666,9 @@ static inline void ieee80211_txq_schedul - { - } - -+void __ieee80211_schedule_txq(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq, bool force); -+ - /** - * ieee80211_schedule_txq - schedule a TXQ for transmission - * -@@ -6678,7 +6681,11 @@ static inline void ieee80211_txq_schedul - * The driver may call this function if it has buffered packets for - * this TXQ internally. - */ --void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); -+static inline void -+ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) -+{ -+ __ieee80211_schedule_txq(hw, txq, true); -+} - - /** - * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() -@@ -6690,8 +6697,12 @@ void ieee80211_schedule_txq(struct ieee8 - * The driver may set force=true if it has buffered packets for this TXQ - * internally. - */ --void ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, -- bool force); -+static inline void -+ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, -+ bool force) -+{ -+ __ieee80211_schedule_txq(hw, txq, force); -+} - - /** - * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1554,38 +1554,6 @@ static void sta_apply_mesh_params(struct - #endif - } - --static void sta_apply_airtime_params(struct ieee80211_local *local, -- struct sta_info *sta, -- struct station_parameters *params) --{ -- u8 ac; -- -- for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -- struct airtime_sched_info *air_sched = &local->airtime[ac]; -- struct airtime_info *air_info = &sta->airtime[ac]; -- struct txq_info *txqi; -- u8 tid; -- -- spin_lock_bh(&air_sched->lock); -- for (tid = 0; tid < IEEE80211_NUM_TIDS + 1; tid++) { -- if (air_info->weight == params->airtime_weight || -- !sta->sta.txq[tid] || -- ac != ieee80211_ac_from_tid(tid)) -- continue; -- -- airtime_weight_set(air_info, params->airtime_weight); -- -- txqi = to_txq_info(sta->sta.txq[tid]); -- if (RB_EMPTY_NODE(&txqi->schedule_order)) -- continue; -- -- ieee80211_update_airtime_weight(local, air_sched, -- 0, true); -- } -- spin_unlock_bh(&air_sched->lock); -- } --} -- - static int sta_apply_parameters(struct ieee80211_local *local, - struct sta_info *sta, - struct station_parameters *params) -@@ -1773,8 +1741,7 @@ static int sta_apply_parameters(struct i - sta_apply_mesh_params(local, sta, params); - - if (params->airtime_weight) -- sta_apply_airtime_params(local, sta, params); -- -+ sta->airtime_weight = params->airtime_weight; - - /* set the STA state after all sta info from usermode has been set */ - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) || ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -216,14 +216,14 @@ static ssize_t aql_txq_limit_read(struct - "VI %u %u\n" - "BE %u %u\n" - "BK %u %u\n", -- local->airtime[IEEE80211_AC_VO].aql_txq_limit_low, -- local->airtime[IEEE80211_AC_VO].aql_txq_limit_high, -- local->airtime[IEEE80211_AC_VI].aql_txq_limit_low, -- local->airtime[IEEE80211_AC_VI].aql_txq_limit_high, -- local->airtime[IEEE80211_AC_BE].aql_txq_limit_low, -- local->airtime[IEEE80211_AC_BE].aql_txq_limit_high, -- local->airtime[IEEE80211_AC_BK].aql_txq_limit_low, -- local->airtime[IEEE80211_AC_BK].aql_txq_limit_high); -+ local->aql_txq_limit_low[IEEE80211_AC_VO], -+ local->aql_txq_limit_high[IEEE80211_AC_VO], -+ local->aql_txq_limit_low[IEEE80211_AC_VI], -+ local->aql_txq_limit_high[IEEE80211_AC_VI], -+ local->aql_txq_limit_low[IEEE80211_AC_BE], -+ local->aql_txq_limit_high[IEEE80211_AC_BE], -+ local->aql_txq_limit_low[IEEE80211_AC_BK], -+ local->aql_txq_limit_high[IEEE80211_AC_BK]); - return simple_read_from_buffer(user_buf, count, ppos, - buf, len); - } -@@ -255,11 +255,11 @@ static ssize_t aql_txq_limit_write(struc - if (ac >= IEEE80211_NUM_ACS) - return -EINVAL; - -- q_limit_low_old = local->airtime[ac].aql_txq_limit_low; -- q_limit_high_old = local->airtime[ac].aql_txq_limit_high; -+ q_limit_low_old = local->aql_txq_limit_low[ac]; -+ q_limit_high_old = local->aql_txq_limit_high[ac]; - -- local->airtime[ac].aql_txq_limit_low = q_limit_low; -- local->airtime[ac].aql_txq_limit_high = q_limit_high; -+ local->aql_txq_limit_low[ac] = q_limit_low; -+ local->aql_txq_limit_high[ac] = q_limit_high; - - mutex_lock(&local->sta_mtx); - list_for_each_entry(sta, &local->sta_list, list) { -@@ -382,46 +382,6 @@ static const struct file_operations forc - .llseek = default_llseek, - }; - --static ssize_t airtime_read(struct file *file, -- char __user *user_buf, -- size_t count, -- loff_t *ppos) --{ -- struct ieee80211_local *local = file->private_data; -- char buf[200]; -- u64 v_t[IEEE80211_NUM_ACS]; -- u64 wt[IEEE80211_NUM_ACS]; -- int len = 0, ac; -- -- for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -- spin_lock_bh(&local->airtime[ac].lock); -- v_t[ac] = local->airtime[ac].v_t; -- wt[ac] = local->airtime[ac].weight_sum; -- spin_unlock_bh(&local->airtime[ac].lock); -- } -- len = scnprintf(buf, sizeof(buf), -- "\tVO VI BE BK\n" -- "Virt-t\t%-10llu %-10llu %-10llu %-10llu\n" -- "Weight\t%-10llu %-10llu %-10llu %-10llu\n", -- v_t[0], -- v_t[1], -- v_t[2], -- v_t[3], -- wt[0], -- wt[1], -- wt[2], -- wt[3]); -- -- return simple_read_from_buffer(user_buf, count, ppos, -- buf, len); --} -- --static const struct file_operations airtime_ops = { -- .read = airtime_read, -- .open = simple_open, -- .llseek = default_llseek, --}; -- - #ifdef CONFIG_PM - static ssize_t reset_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -@@ -672,11 +632,7 @@ void debugfs_hw_add(struct ieee80211_loc - if (local->ops->wake_tx_queue) - DEBUGFS_ADD_MODE(aqm, 0600); - -- if (wiphy_ext_feature_isset(local->hw.wiphy, -- NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) { -- DEBUGFS_ADD_MODE(airtime, 0600); -- DEBUGFS_ADD_MODE(airtime_flags, 0600); -- } -+ DEBUGFS_ADD_MODE(airtime_flags, 0600); - - DEBUGFS_ADD(aql_txq_limit); - debugfs_create_u32("aql_threshold", 0600, ---- a/net/mac80211/debugfs_netdev.c -+++ b/net/mac80211/debugfs_netdev.c -@@ -512,34 +512,6 @@ static ssize_t ieee80211_if_fmt_aqm( - } - IEEE80211_IF_FILE_R(aqm); - --static ssize_t ieee80211_if_fmt_airtime( -- const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) --{ -- struct ieee80211_local *local = sdata->local; -- struct ieee80211_txq *txq = sdata->vif.txq; -- struct airtime_info *air_info; -- int len; -- -- if (!txq) -- return 0; -- -- spin_lock_bh(&local->airtime[txq->ac].lock); -- air_info = to_airtime_info(txq); -- len = scnprintf(buf, -- buflen, -- "RX: %llu us\nTX: %llu us\nWeight: %u\n" -- "Virt-T: %lld us\n", -- air_info->rx_airtime, -- air_info->tx_airtime, -- air_info->weight, -- air_info->v_t); -- spin_unlock_bh(&local->airtime[txq->ac].lock); -- -- return len; --} -- --IEEE80211_IF_FILE_R(airtime); -- - IEEE80211_IF_FILE(multicast_to_unicast, u.ap.multicast_to_unicast, HEX); - - /* IBSS attributes */ -@@ -685,10 +657,8 @@ static void add_common_files(struct ieee - - if (sdata->local->ops->wake_tx_queue && - sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && -- sdata->vif.type != NL80211_IFTYPE_NAN) { -+ sdata->vif.type != NL80211_IFTYPE_NAN) - DEBUGFS_ADD(aqm); -- DEBUGFS_ADD(airtime); -- } - } - - static void add_sta_files(struct ieee80211_sub_if_data *sdata) ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -202,7 +202,7 @@ static ssize_t sta_airtime_read(struct f - size_t bufsz = 400; - char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; - u64 rx_airtime = 0, tx_airtime = 0; -- u64 v_t[IEEE80211_NUM_ACS]; -+ s64 deficit[IEEE80211_NUM_ACS]; - ssize_t rv; - int ac; - -@@ -210,18 +210,18 @@ static ssize_t sta_airtime_read(struct f - return -ENOMEM; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -- spin_lock_bh(&local->airtime[ac].lock); -+ spin_lock_bh(&local->active_txq_lock[ac]); - rx_airtime += sta->airtime[ac].rx_airtime; - tx_airtime += sta->airtime[ac].tx_airtime; -- v_t[ac] = sta->airtime[ac].v_t; -- spin_unlock_bh(&local->airtime[ac].lock); -+ deficit[ac] = sta->airtime[ac].deficit; -+ spin_unlock_bh(&local->active_txq_lock[ac]); - } - - p += scnprintf(p, bufsz + buf - p, - "RX: %llu us\nTX: %llu us\nWeight: %u\n" -- "Virt-T: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", -- rx_airtime, tx_airtime, sta->airtime[0].weight, -- v_t[0], v_t[1], v_t[2], v_t[3]); -+ "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", -+ rx_airtime, tx_airtime, sta->airtime_weight, -+ deficit[0], deficit[1], deficit[2], deficit[3]); - - rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); - kfree(buf); -@@ -236,11 +236,11 @@ static ssize_t sta_airtime_write(struct - int ac; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -- spin_lock_bh(&local->airtime[ac].lock); -+ spin_lock_bh(&local->active_txq_lock[ac]); - sta->airtime[ac].rx_airtime = 0; - sta->airtime[ac].tx_airtime = 0; -- sta->airtime[ac].v_t = 0; -- spin_unlock_bh(&local->airtime[ac].lock); -+ sta->airtime[ac].deficit = sta->airtime_weight; -+ spin_unlock_bh(&local->active_txq_lock[ac]); - } - - return count; -@@ -263,10 +263,10 @@ static ssize_t sta_aql_read(struct file - return -ENOMEM; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -- spin_lock_bh(&local->airtime[ac].lock); -+ spin_lock_bh(&local->active_txq_lock[ac]); - q_limit_l[ac] = sta->airtime[ac].aql_limit_low; - q_limit_h[ac] = sta->airtime[ac].aql_limit_high; -- spin_unlock_bh(&local->airtime[ac].lock); -+ spin_unlock_bh(&local->active_txq_lock[ac]); - q_depth[ac] = atomic_read(&sta->airtime[ac].aql_tx_pending); - } - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -862,16 +862,20 @@ enum txq_info_flags { - * @def_flow: used as a fallback flow when a packet destined to @tin hashes to - * a fq_flow which is already owned by a different tin - * @def_cvars: codel vars for @def_flow -- * @schedule_order: used with ieee80211_local->active_txqs - * @frags: used to keep fragments created after dequeue -+ * @schedule_order: used with ieee80211_local->active_txqs -+ * @schedule_round: counter to prevent infinite loops on TXQ scheduling - */ - struct txq_info { - struct fq_tin tin; - struct codel_vars def_cvars; - struct codel_stats cstats; -- struct rb_node schedule_order; -+ -+ u16 schedule_round; -+ struct list_head schedule_order; - - struct sk_buff_head frags; -+ - unsigned long flags; - - /* keep last! */ -@@ -948,8 +952,6 @@ struct ieee80211_sub_if_data { - struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; - struct mac80211_qos_map __rcu *qos_map; - -- struct airtime_info airtime[IEEE80211_NUM_ACS]; -- - struct work_struct csa_finalize_work; - bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ - struct cfg80211_chan_def csa_chandef; -@@ -1184,44 +1186,6 @@ enum mac80211_scan_state { - SCAN_ABORT, - }; - --/** -- * struct airtime_sched_info - state used for airtime scheduling and AQL -- * -- * @lock: spinlock that protects all the fields in this struct -- * @active_txqs: rbtree of currently backlogged queues, sorted by virtual time -- * @schedule_pos: the current position maintained while a driver walks the tree -- * with ieee80211_next_txq() -- * @active_list: list of struct airtime_info structs that were active within -- * the last AIRTIME_ACTIVE_DURATION (100 ms), used to compute -- * weight_sum -- * @last_weight_update: used for rate limiting walking active_list -- * @last_schedule_time: tracks the last time a transmission was scheduled; used -- * for catching up v_t if no stations are eligible for -- * transmission. -- * @v_t: global virtual time; queues with v_t < this are eligible for -- * transmission -- * @weight_sum: total sum of all active stations used for dividing airtime -- * @weight_sum_reciprocal: reciprocal of weight_sum (to avoid divisions in fast -- * path - see comment above -- * IEEE80211_RECIPROCAL_DIVISOR_64) -- * @aql_txq_limit_low: AQL limit when total outstanding airtime -- * is < IEEE80211_AQL_THRESHOLD -- * @aql_txq_limit_high: AQL limit when total outstanding airtime -- * is > IEEE80211_AQL_THRESHOLD -- */ --struct airtime_sched_info { -- spinlock_t lock; -- struct rb_root_cached active_txqs; -- struct rb_node *schedule_pos; -- struct list_head active_list; -- u64 last_weight_update; -- u64 last_schedule_activity; -- u64 v_t; -- u64 weight_sum; -- u64 weight_sum_reciprocal; -- u32 aql_txq_limit_low; -- u32 aql_txq_limit_high; --}; - DECLARE_STATIC_KEY_FALSE(aql_disable); - - struct ieee80211_local { -@@ -1235,8 +1199,13 @@ struct ieee80211_local { - struct codel_params cparams; - - /* protects active_txqs and txqi->schedule_order */ -- struct airtime_sched_info airtime[IEEE80211_NUM_ACS]; -+ spinlock_t active_txq_lock[IEEE80211_NUM_ACS]; -+ struct list_head active_txqs[IEEE80211_NUM_ACS]; -+ u16 schedule_round[IEEE80211_NUM_ACS]; -+ - u16 airtime_flags; -+ u32 aql_txq_limit_low[IEEE80211_NUM_ACS]; -+ u32 aql_txq_limit_high[IEEE80211_NUM_ACS]; - u32 aql_threshold; - atomic_t aql_total_pending_airtime; - -@@ -1660,125 +1629,6 @@ static inline bool txq_has_queue(struct - return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets); - } - --static inline struct airtime_info *to_airtime_info(struct ieee80211_txq *txq) --{ -- struct ieee80211_sub_if_data *sdata; -- struct sta_info *sta; -- -- if (txq->sta) { -- sta = container_of(txq->sta, struct sta_info, sta); -- return &sta->airtime[txq->ac]; -- } -- -- sdata = vif_to_sdata(txq->vif); -- return &sdata->airtime[txq->ac]; --} -- --/* To avoid divisions in the fast path, we keep pre-computed reciprocals for -- * airtime weight calculations. There are two different weights to keep track -- * of: The per-station weight and the sum of weights per phy. -- * -- * For the per-station weights (kept in airtime_info below), we use 32-bit -- * reciprocals with a devisor of 2^19. This lets us keep the multiplications and -- * divisions for the station weights as 32-bit operations at the cost of a bit -- * of rounding error for high weights; but the choice of divisor keeps rounding -- * errors <10% for weights <2^15, assuming no more than 8ms of airtime is -- * reported at a time. -- * -- * For the per-phy sum of weights the values can get higher, so we use 64-bit -- * operations for those with a 32-bit divisor, which should avoid any -- * significant rounding errors. -- */ --#define IEEE80211_RECIPROCAL_DIVISOR_64 0x100000000ULL --#define IEEE80211_RECIPROCAL_SHIFT_64 32 --#define IEEE80211_RECIPROCAL_DIVISOR_32 0x80000U --#define IEEE80211_RECIPROCAL_SHIFT_32 19 -- --static inline void airtime_weight_set(struct airtime_info *air_info, u16 weight) --{ -- if (air_info->weight == weight) -- return; -- -- air_info->weight = weight; -- if (weight) { -- air_info->weight_reciprocal = -- IEEE80211_RECIPROCAL_DIVISOR_32 / weight; -- } else { -- air_info->weight_reciprocal = 0; -- } --} -- --static inline void airtime_weight_sum_set(struct airtime_sched_info *air_sched, -- int weight_sum) --{ -- if (air_sched->weight_sum == weight_sum) -- return; -- -- air_sched->weight_sum = weight_sum; -- if (air_sched->weight_sum) { -- air_sched->weight_sum_reciprocal = IEEE80211_RECIPROCAL_DIVISOR_64; -- do_div(air_sched->weight_sum_reciprocal, air_sched->weight_sum); -- } else { -- air_sched->weight_sum_reciprocal = 0; -- } --} -- --/* A problem when trying to enforce airtime fairness is that we want to divide -- * the airtime between the currently *active* stations. However, basing this on -- * the instantaneous queue state of stations doesn't work, as queues tend to -- * oscillate very quickly between empty and occupied, leading to the scheduler -- * thinking only a single station is active when deciding whether to allow -- * transmission (and thus not throttling correctly). -- * -- * To fix this we use a timer-based notion of activity: a station is considered -- * active if it has been scheduled within the last 100 ms; we keep a separate -- * list of all the stations considered active in this manner, and lazily update -- * the total weight of active stations from this list (filtering the stations in -- * the list by their 'last active' time). -- * -- * We add one additional safeguard to guard against stations that manage to get -- * scheduled every 100 ms but don't transmit a lot of data, and thus don't use -- * up any airtime. Such stations would be able to get priority for an extended -- * period of time if they do start transmitting at full capacity again, and so -- * we add an explicit maximum for how far behind a station is allowed to fall in -- * the virtual airtime domain. This limit is set to a relatively high value of -- * 20 ms because the main mechanism for catching up idle stations is the active -- * state as described above; i.e., the hard limit should only be hit in -- * pathological cases. -- */ --#define AIRTIME_ACTIVE_DURATION (100 * NSEC_PER_MSEC) --#define AIRTIME_MAX_BEHIND 20000 /* 20 ms */ -- --static inline bool airtime_is_active(struct airtime_info *air_info, u64 now) --{ -- return air_info->last_scheduled >= now - AIRTIME_ACTIVE_DURATION; --} -- --static inline void airtime_set_active(struct airtime_sched_info *air_sched, -- struct airtime_info *air_info, u64 now) --{ -- air_info->last_scheduled = now; -- air_sched->last_schedule_activity = now; -- list_move_tail(&air_info->list, &air_sched->active_list); --} -- --static inline bool airtime_catchup_v_t(struct airtime_sched_info *air_sched, -- u64 v_t, u64 now) --{ -- air_sched->v_t = v_t; -- return true; --} -- --static inline void init_airtime_info(struct airtime_info *air_info, -- struct airtime_sched_info *air_sched) --{ -- atomic_set(&air_info->aql_tx_pending, 0); -- air_info->aql_limit_low = air_sched->aql_txq_limit_low; -- air_info->aql_limit_high = air_sched->aql_txq_limit_high; -- airtime_weight_set(air_info, IEEE80211_DEFAULT_AIRTIME_WEIGHT); -- INIT_LIST_HEAD(&air_info->list); --} -- - static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) - { - return ether_addr_equal(raddr, addr) || -@@ -2024,14 +1874,6 @@ int ieee80211_tx_control_port(struct wip - u64 *cookie); - int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, - const u8 *buf, size_t len); --void ieee80211_resort_txq(struct ieee80211_hw *hw, -- struct ieee80211_txq *txq); --void ieee80211_unschedule_txq(struct ieee80211_hw *hw, -- struct ieee80211_txq *txq, -- bool purge); --void ieee80211_update_airtime_weight(struct ieee80211_local *local, -- struct airtime_sched_info *air_sched, -- u64 now, bool force); - - /* HT */ - void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -2192,9 +2192,6 @@ int ieee80211_if_add(struct ieee80211_lo - } - } - -- for (i = 0; i < IEEE80211_NUM_ACS; i++) -- init_airtime_info(&sdata->airtime[i], &local->airtime[i]); -- - ieee80211_set_default_queues(sdata); - - sdata->ap_power_level = IEEE80211_UNSET_POWER_LEVEL; ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -707,13 +707,10 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - spin_lock_init(&local->queue_stop_reason_lock); - - for (i = 0; i < IEEE80211_NUM_ACS; i++) { -- struct airtime_sched_info *air_sched = &local->airtime[i]; -- -- air_sched->active_txqs = RB_ROOT_CACHED; -- INIT_LIST_HEAD(&air_sched->active_list); -- spin_lock_init(&air_sched->lock); -- air_sched->aql_txq_limit_low = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; -- air_sched->aql_txq_limit_high = -+ INIT_LIST_HEAD(&local->active_txqs[i]); -+ spin_lock_init(&local->active_txq_lock[i]); -+ local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; -+ local->aql_txq_limit_high[i] = - IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H; - } - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1583,8 +1583,12 @@ static void sta_ps_start(struct sta_info - - for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) { - struct ieee80211_txq *txq = sta->sta.txq[tid]; -+ struct txq_info *txqi = to_txq_info(txq); - -- ieee80211_unschedule_txq(&local->hw, txq, false); -+ spin_lock(&local->active_txq_lock[txq->ac]); -+ if (!list_empty(&txqi->schedule_order)) -+ list_del_init(&txqi->schedule_order); -+ spin_unlock(&local->active_txq_lock[txq->ac]); - - if (txq_has_queue(txq)) - set_bit(tid, &sta->txq_buffered_tids); ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -426,11 +426,15 @@ struct sta_info *sta_info_alloc(struct i - if (sta_prepare_rate_control(local, sta, gfp)) - goto free_txq; - -+ sta->airtime_weight = IEEE80211_DEFAULT_AIRTIME_WEIGHT; - - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - skb_queue_head_init(&sta->ps_tx_buf[i]); - skb_queue_head_init(&sta->tx_filtered[i]); -- init_airtime_info(&sta->airtime[i], &local->airtime[i]); -+ sta->airtime[i].deficit = sta->airtime_weight; -+ atomic_set(&sta->airtime[i].aql_tx_pending, 0); -+ sta->airtime[i].aql_limit_low = local->aql_txq_limit_low[i]; -+ sta->airtime[i].aql_limit_high = local->aql_txq_limit_high[i]; - } - - for (i = 0; i < IEEE80211_NUM_TIDS; i++) -@@ -1889,59 +1893,24 @@ void ieee80211_sta_set_buffered(struct i - } - EXPORT_SYMBOL(ieee80211_sta_set_buffered); - --void ieee80211_register_airtime(struct ieee80211_txq *txq, -- u32 tx_airtime, u32 rx_airtime) -+void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, -+ u32 tx_airtime, u32 rx_airtime) - { -- struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif); -- struct ieee80211_local *local = sdata->local; -- u64 weight_sum, weight_sum_reciprocal; -- struct airtime_sched_info *air_sched; -- struct airtime_info *air_info; -+ struct sta_info *sta = container_of(pubsta, struct sta_info, sta); -+ struct ieee80211_local *local = sta->sdata->local; -+ u8 ac = ieee80211_ac_from_tid(tid); - u32 airtime = 0; - -- air_sched = &local->airtime[txq->ac]; -- air_info = to_airtime_info(txq); -- -- if (local->airtime_flags & AIRTIME_USE_TX) -+ if (sta->local->airtime_flags & AIRTIME_USE_TX) - airtime += tx_airtime; -- if (local->airtime_flags & AIRTIME_USE_RX) -+ if (sta->local->airtime_flags & AIRTIME_USE_RX) - airtime += rx_airtime; - -- /* Weights scale so the unit weight is 256 */ -- airtime <<= 8; -- -- spin_lock_bh(&air_sched->lock); -- -- air_info->tx_airtime += tx_airtime; -- air_info->rx_airtime += rx_airtime; -- -- if (air_sched->weight_sum) { -- weight_sum = air_sched->weight_sum; -- weight_sum_reciprocal = air_sched->weight_sum_reciprocal; -- } else { -- weight_sum = air_info->weight; -- weight_sum_reciprocal = air_info->weight_reciprocal; -- } -- -- /* Round the calculation of global vt */ -- air_sched->v_t += (u64)((airtime + (weight_sum >> 1)) * -- weight_sum_reciprocal) >> IEEE80211_RECIPROCAL_SHIFT_64; -- air_info->v_t += (u32)((airtime + (air_info->weight >> 1)) * -- air_info->weight_reciprocal) >> IEEE80211_RECIPROCAL_SHIFT_32; -- ieee80211_resort_txq(&local->hw, txq); -- -- spin_unlock_bh(&air_sched->lock); --} -- --void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, -- u32 tx_airtime, u32 rx_airtime) --{ -- struct ieee80211_txq *txq = pubsta->txq[tid]; -- -- if (!txq) -- return; -- -- ieee80211_register_airtime(txq, tx_airtime, rx_airtime); -+ spin_lock_bh(&local->active_txq_lock[ac]); -+ sta->airtime[ac].tx_airtime += tx_airtime; -+ sta->airtime[ac].rx_airtime += rx_airtime; -+ sta->airtime[ac].deficit -= airtime; -+ spin_unlock_bh(&local->active_txq_lock[ac]); - } - EXPORT_SYMBOL(ieee80211_sta_register_airtime); - -@@ -2385,7 +2354,7 @@ void sta_set_sinfo(struct sta_info *sta, - } - - if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT))) { -- sinfo->airtime_weight = sta->airtime[0].weight; -+ sinfo->airtime_weight = sta->airtime_weight; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT); - } - ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -135,25 +135,18 @@ enum ieee80211_agg_stop_reason { - #define AIRTIME_USE_TX BIT(0) - #define AIRTIME_USE_RX BIT(1) - -- - struct airtime_info { - u64 rx_airtime; - u64 tx_airtime; -- u64 v_t; -- u64 last_scheduled; -- struct list_head list; -+ s64 deficit; - atomic_t aql_tx_pending; /* Estimated airtime for frames pending */ - u32 aql_limit_low; - u32 aql_limit_high; -- u32 weight_reciprocal; -- u16 weight; - }; - - void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local, - struct sta_info *sta, u8 ac, - u16 tx_airtime, bool tx_completed); --void ieee80211_register_airtime(struct ieee80211_txq *txq, -- u32 tx_airtime, u32 rx_airtime); - - struct sta_info; - -@@ -523,6 +516,7 @@ struct ieee80211_fragment_cache { - * @tid_seq: per-TID sequence numbers for sending to this STA - * @airtime: per-AC struct airtime_info describing airtime statistics for this - * station -+ * @airtime_weight: station weight for airtime fairness calculation purposes - * @ampdu_mlme: A-MPDU state machine state - * @mesh: mesh STA information - * @debugfs_dir: debug filesystem directory dentry -@@ -653,6 +647,7 @@ struct sta_info { - u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; - - struct airtime_info airtime[IEEE80211_NUM_ACS]; -+ u16 airtime_weight; - - /* - * Aggregation information, locked with lock. ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -983,25 +983,6 @@ static void __ieee80211_tx_status(struct - if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked) - ieee80211_frame_acked(sta, skb); - -- } else if (wiphy_ext_feature_isset(local->hw.wiphy, -- NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) { -- struct ieee80211_sub_if_data *sdata; -- struct ieee80211_txq *txq; -- u32 airtime; -- -- /* Account airtime to multicast queue */ -- sdata = ieee80211_sdata_from_skb(local, skb); -- -- if (sdata && (txq = sdata->vif.txq)) { -- airtime = info->status.tx_time ?: -- ieee80211_calc_expected_tx_airtime(hw, -- &sdata->vif, -- NULL, -- skb->len, -- false); -- -- ieee80211_register_airtime(txq, airtime, 0); -- } - } - - /* SNMP counters ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -18,7 +18,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -1480,7 +1479,7 @@ void ieee80211_txq_init(struct ieee80211 - codel_vars_init(&txqi->def_cvars); - codel_stats_init(&txqi->cstats); - __skb_queue_head_init(&txqi->frags); -- RB_CLEAR_NODE(&txqi->schedule_order); -+ INIT_LIST_HEAD(&txqi->schedule_order); - - txqi->txq.vif = &sdata->vif; - -@@ -1524,7 +1523,9 @@ void ieee80211_txq_purge(struct ieee8021 - ieee80211_purge_tx_queue(&local->hw, &txqi->frags); - spin_unlock_bh(&fq->lock); - -- ieee80211_unschedule_txq(&local->hw, &txqi->txq, true); -+ spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); -+ list_del_init(&txqi->schedule_order); -+ spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); - } - - void ieee80211_txq_set_params(struct ieee80211_local *local) -@@ -3819,259 +3820,102 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); - struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) - { - struct ieee80211_local *local = hw_to_local(hw); -- struct airtime_sched_info *air_sched; -- u64 now = ktime_get_coarse_boottime_ns(); - struct ieee80211_txq *ret = NULL; -- struct airtime_info *air_info; -- struct txq_info *txqi = NULL; -- struct rb_node *node; -- bool first = false; -+ struct txq_info *txqi = NULL, *head = NULL; -+ bool found_eligible_txq = false; - -- air_sched = &local->airtime[ac]; -- spin_lock_bh(&air_sched->lock); -+ spin_lock_bh(&local->active_txq_lock[ac]); - -- node = air_sched->schedule_pos; -- --begin: -- if (!node) { -- node = rb_first_cached(&air_sched->active_txqs); -- first = true; -- } else { -- node = rb_next(node); -- } -- -- if (!node) -- goto out; -- -- txqi = container_of(node, struct txq_info, schedule_order); -- air_info = to_airtime_info(&txqi->txq); -- -- if (air_info->v_t > air_sched->v_t && -- (!first || !airtime_catchup_v_t(air_sched, air_info->v_t, now))) -+ begin: -+ txqi = list_first_entry_or_null(&local->active_txqs[ac], -+ struct txq_info, -+ schedule_order); -+ if (!txqi) - goto out; - -- if (!ieee80211_txq_airtime_check(hw, &txqi->txq)) { -- first = false; -- goto begin; -- } -- -- air_sched->schedule_pos = node; -- air_sched->last_schedule_activity = now; -- ret = &txqi->txq; --out: -- spin_unlock_bh(&air_sched->lock); -- return ret; --} --EXPORT_SYMBOL(ieee80211_next_txq); -- --static void __ieee80211_insert_txq(struct rb_root_cached *root, -- struct txq_info *txqi) --{ -- struct rb_node **new = &root->rb_root.rb_node; -- struct airtime_info *old_air, *new_air; -- struct rb_node *parent = NULL; -- struct txq_info *__txqi; -- bool leftmost = true; -- -- while (*new) { -- parent = *new; -- __txqi = rb_entry(parent, struct txq_info, schedule_order); -- old_air = to_airtime_info(&__txqi->txq); -- new_air = to_airtime_info(&txqi->txq); -- -- if (new_air->v_t <= old_air->v_t) { -- new = &parent->rb_left; -- } else { -- new = &parent->rb_right; -- leftmost = false; -- } -+ if (txqi == head) { -+ if (!found_eligible_txq) -+ goto out; -+ else -+ found_eligible_txq = false; - } - -- rb_link_node(&txqi->schedule_order, parent, new); -- rb_insert_color_cached(&txqi->schedule_order, root, leftmost); --} -- --void ieee80211_resort_txq(struct ieee80211_hw *hw, -- struct ieee80211_txq *txq) --{ -- struct airtime_info *air_info = to_airtime_info(txq); -- struct ieee80211_local *local = hw_to_local(hw); -- struct txq_info *txqi = to_txq_info(txq); -- struct airtime_sched_info *air_sched; -- -- air_sched = &local->airtime[txq->ac]; -+ if (!head) -+ head = txqi; - -- lockdep_assert_held(&air_sched->lock); -- -- if (!RB_EMPTY_NODE(&txqi->schedule_order)) { -- struct airtime_info *a_prev = NULL, *a_next = NULL; -- struct txq_info *t_prev, *t_next; -- struct rb_node *n_prev, *n_next; -+ if (txqi->txq.sta) { -+ struct sta_info *sta = container_of(txqi->txq.sta, -+ struct sta_info, sta); -+ bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq); -+ s64 deficit = sta->airtime[txqi->txq.ac].deficit; - -- /* Erasing a node can cause an expensive rebalancing operation, -- * so we check the previous and next nodes first and only remove -- * and re-insert if the current node is not already in the -- * correct position. -- */ -- if ((n_prev = rb_prev(&txqi->schedule_order)) != NULL) { -- t_prev = container_of(n_prev, struct txq_info, -- schedule_order); -- a_prev = to_airtime_info(&t_prev->txq); -- } -+ if (aql_check) -+ found_eligible_txq = true; - -- if ((n_next = rb_next(&txqi->schedule_order)) != NULL) { -- t_next = container_of(n_next, struct txq_info, -- schedule_order); -- a_next = to_airtime_info(&t_next->txq); -+ if (deficit < 0) -+ sta->airtime[txqi->txq.ac].deficit += -+ sta->airtime_weight; -+ -+ if (deficit < 0 || !aql_check) { -+ list_move_tail(&txqi->schedule_order, -+ &local->active_txqs[txqi->txq.ac]); -+ goto begin; - } -- -- if ((!a_prev || a_prev->v_t <= air_info->v_t) && -- (!a_next || a_next->v_t > air_info->v_t)) -- return; -- -- if (air_sched->schedule_pos == &txqi->schedule_order) -- air_sched->schedule_pos = n_prev; -- -- rb_erase_cached(&txqi->schedule_order, -- &air_sched->active_txqs); -- RB_CLEAR_NODE(&txqi->schedule_order); -- __ieee80211_insert_txq(&air_sched->active_txqs, txqi); - } --} -- --void ieee80211_update_airtime_weight(struct ieee80211_local *local, -- struct airtime_sched_info *air_sched, -- u64 now, bool force) --{ -- struct airtime_info *air_info, *tmp; -- u64 weight_sum = 0; -- -- if (unlikely(!now)) -- now = ktime_get_coarse_boottime_ns(); -- -- lockdep_assert_held(&air_sched->lock); -- -- if (!force && (air_sched->last_weight_update < -- now - AIRTIME_ACTIVE_DURATION)) -- return; -- -- list_for_each_entry_safe(air_info, tmp, -- &air_sched->active_list, list) { -- if (airtime_is_active(air_info, now)) -- weight_sum += air_info->weight; -- else -- list_del_init(&air_info->list); -- } -- airtime_weight_sum_set(air_sched, weight_sum); -- air_sched->last_weight_update = now; --} - --void ieee80211_schedule_txq(struct ieee80211_hw *hw, -- struct ieee80211_txq *txq) -- __acquires(txq_lock) __releases(txq_lock) --{ -- struct ieee80211_local *local = hw_to_local(hw); -- struct txq_info *txqi = to_txq_info(txq); -- struct airtime_sched_info *air_sched; -- u64 now = ktime_get_coarse_boottime_ns(); -- struct airtime_info *air_info; -- u8 ac = txq->ac; -- bool was_active; - -- air_sched = &local->airtime[ac]; -- air_info = to_airtime_info(txq); -- -- spin_lock_bh(&air_sched->lock); -- was_active = airtime_is_active(air_info, now); -- airtime_set_active(air_sched, air_info, now); -- -- if (!RB_EMPTY_NODE(&txqi->schedule_order)) -+ if (txqi->schedule_round == local->schedule_round[ac]) - goto out; - -- /* If the station has been inactive for a while, catch up its v_t so it -- * doesn't get indefinite priority; see comment above the definition of -- * AIRTIME_MAX_BEHIND. -- */ -- if ((!was_active && air_info->v_t < air_sched->v_t) || -- air_info->v_t < air_sched->v_t - AIRTIME_MAX_BEHIND) -- air_info->v_t = air_sched->v_t; -- -- ieee80211_update_airtime_weight(local, air_sched, now, !was_active); -- __ieee80211_insert_txq(&air_sched->active_txqs, txqi); -+ list_del_init(&txqi->schedule_order); -+ txqi->schedule_round = local->schedule_round[ac]; -+ ret = &txqi->txq; - - out: -- spin_unlock_bh(&air_sched->lock); --} --EXPORT_SYMBOL(ieee80211_schedule_txq); -- --static void __ieee80211_unschedule_txq(struct ieee80211_hw *hw, -- struct ieee80211_txq *txq, -- bool purge) --{ -- struct ieee80211_local *local = hw_to_local(hw); -- struct txq_info *txqi = to_txq_info(txq); -- struct airtime_sched_info *air_sched; -- struct airtime_info *air_info; -- -- air_sched = &local->airtime[txq->ac]; -- air_info = to_airtime_info(&txqi->txq); -- -- lockdep_assert_held(&air_sched->lock); -- -- if (purge) { -- list_del_init(&air_info->list); -- ieee80211_update_airtime_weight(local, air_sched, 0, true); -- } -- -- if (RB_EMPTY_NODE(&txqi->schedule_order)) -- return; -- -- if (air_sched->schedule_pos == &txqi->schedule_order) -- air_sched->schedule_pos = rb_prev(&txqi->schedule_order); -- -- if (!purge) -- airtime_set_active(air_sched, air_info, -- ktime_get_coarse_boottime_ns()); -- -- rb_erase_cached(&txqi->schedule_order, -- &air_sched->active_txqs); -- RB_CLEAR_NODE(&txqi->schedule_order); -+ spin_unlock_bh(&local->active_txq_lock[ac]); -+ return ret; - } -+EXPORT_SYMBOL(ieee80211_next_txq); - --void ieee80211_unschedule_txq(struct ieee80211_hw *hw, -+void __ieee80211_schedule_txq(struct ieee80211_hw *hw, - struct ieee80211_txq *txq, -- bool purge) -- __acquires(txq_lock) __releases(txq_lock) --{ -- struct ieee80211_local *local = hw_to_local(hw); -- -- spin_lock_bh(&local->airtime[txq->ac].lock); -- __ieee80211_unschedule_txq(hw, txq, purge); -- spin_unlock_bh(&local->airtime[txq->ac].lock); --} -- --void ieee80211_return_txq(struct ieee80211_hw *hw, -- struct ieee80211_txq *txq, bool force) -+ bool force) - { - struct ieee80211_local *local = hw_to_local(hw); - struct txq_info *txqi = to_txq_info(txq); - -- spin_lock_bh(&local->airtime[txq->ac].lock); -+ spin_lock_bh(&local->active_txq_lock[txq->ac]); - -- if (!RB_EMPTY_NODE(&txqi->schedule_order) && !force && -- !txq_has_queue(txq)) -- __ieee80211_unschedule_txq(hw, txq, false); -+ if (list_empty(&txqi->schedule_order) && -+ (force || !skb_queue_empty(&txqi->frags) || -+ txqi->tin.backlog_packets)) { -+ /* If airtime accounting is active, always enqueue STAs at the -+ * head of the list to ensure that they only get moved to the -+ * back by the airtime DRR scheduler once they have a negative -+ * deficit. A station that already has a negative deficit will -+ * get immediately moved to the back of the list on the next -+ * call to ieee80211_next_txq(). -+ */ -+ if (txqi->txq.sta && local->airtime_flags && -+ wiphy_ext_feature_isset(local->hw.wiphy, -+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) -+ list_add(&txqi->schedule_order, -+ &local->active_txqs[txq->ac]); -+ else -+ list_add_tail(&txqi->schedule_order, -+ &local->active_txqs[txq->ac]); -+ } - -- spin_unlock_bh(&local->airtime[txq->ac].lock); -+ spin_unlock_bh(&local->active_txq_lock[txq->ac]); - } --EXPORT_SYMBOL(ieee80211_return_txq); -+EXPORT_SYMBOL(__ieee80211_schedule_txq); - - DEFINE_STATIC_KEY_FALSE(aql_disable); - - bool ieee80211_txq_airtime_check(struct ieee80211_hw *hw, - struct ieee80211_txq *txq) - { -- struct airtime_info *air_info = to_airtime_info(txq); -+ struct sta_info *sta; - struct ieee80211_local *local = hw_to_local(hw); - - if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) -@@ -4086,12 +3930,15 @@ bool ieee80211_txq_airtime_check(struct - if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) - return true; - -- if (atomic_read(&air_info->aql_tx_pending) < air_info->aql_limit_low) -+ sta = container_of(txq->sta, struct sta_info, sta); -+ if (atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < -+ sta->airtime[txq->ac].aql_limit_low) - return true; - - if (atomic_read(&local->aql_total_pending_airtime) < - local->aql_threshold && -- atomic_read(&air_info->aql_tx_pending) < air_info->aql_limit_high) -+ atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < -+ sta->airtime[txq->ac].aql_limit_high) - return true; - - return false; -@@ -4101,59 +3948,60 @@ EXPORT_SYMBOL(ieee80211_txq_airtime_chec - bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, - struct ieee80211_txq *txq) - { -- struct txq_info *first_txqi = NULL, *txqi = to_txq_info(txq); - struct ieee80211_local *local = hw_to_local(hw); -- struct airtime_sched_info *air_sched; -- struct airtime_info *air_info; -- struct rb_node *node = NULL; -- bool ret = false; -- u64 now; -- -+ struct txq_info *iter, *tmp, *txqi = to_txq_info(txq); -+ struct sta_info *sta; -+ u8 ac = txq->ac; - -- if (!ieee80211_txq_airtime_check(hw, txq)) -- return false; -+ spin_lock_bh(&local->active_txq_lock[ac]); - -- air_sched = &local->airtime[txq->ac]; -- spin_lock_bh(&air_sched->lock); -+ if (!txqi->txq.sta) -+ goto out; - -- if (RB_EMPTY_NODE(&txqi->schedule_order)) -+ if (list_empty(&txqi->schedule_order)) - goto out; - -- now = ktime_get_coarse_boottime_ns(); -+ list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac], -+ schedule_order) { -+ if (iter == txqi) -+ break; - -- /* Like in ieee80211_next_txq(), make sure the first station in the -- * scheduling order is eligible for transmission to avoid starvation. -- */ -- node = rb_first_cached(&air_sched->active_txqs); -- if (node) { -- first_txqi = container_of(node, struct txq_info, -- schedule_order); -- air_info = to_airtime_info(&first_txqi->txq); -- -- if (air_sched->v_t < air_info->v_t) -- airtime_catchup_v_t(air_sched, air_info->v_t, now); -+ if (!iter->txq.sta) { -+ list_move_tail(&iter->schedule_order, -+ &local->active_txqs[ac]); -+ continue; -+ } -+ sta = container_of(iter->txq.sta, struct sta_info, sta); -+ if (sta->airtime[ac].deficit < 0) -+ sta->airtime[ac].deficit += sta->airtime_weight; -+ list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); - } - -- air_info = to_airtime_info(&txqi->txq); -- if (air_info->v_t <= air_sched->v_t) { -- air_sched->last_schedule_activity = now; -- ret = true; -- } -+ sta = container_of(txqi->txq.sta, struct sta_info, sta); -+ if (sta->airtime[ac].deficit >= 0) -+ goto out; -+ -+ sta->airtime[ac].deficit += sta->airtime_weight; -+ list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]); -+ spin_unlock_bh(&local->active_txq_lock[ac]); - -+ return false; - out: -- spin_unlock_bh(&air_sched->lock); -- return ret; -+ if (!list_empty(&txqi->schedule_order)) -+ list_del_init(&txqi->schedule_order); -+ spin_unlock_bh(&local->active_txq_lock[ac]); -+ -+ return true; - } - EXPORT_SYMBOL(ieee80211_txq_may_transmit); - - void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) - { - struct ieee80211_local *local = hw_to_local(hw); -- struct airtime_sched_info *air_sched = &local->airtime[ac]; - -- spin_lock_bh(&air_sched->lock); -- air_sched->schedule_pos = NULL; -- spin_unlock_bh(&air_sched->lock); -+ spin_lock_bh(&local->active_txq_lock[ac]); -+ local->schedule_round[ac]++; -+ spin_unlock_bh(&local->active_txq_lock[ac]); - } - EXPORT_SYMBOL(ieee80211_txq_schedule_start); - diff --git a/package/kernel/mac80211/patches/subsys/331-v6.0-mac80211-make-sta-airtime-deficit-field-s32-instead-.patch b/package/kernel/mac80211/patches/subsys/331-v6.0-mac80211-make-sta-airtime-deficit-field-s32-instead-.patch deleted file mode 100644 index c006d3762a0..00000000000 --- a/package/kernel/mac80211/patches/subsys/331-v6.0-mac80211-make-sta-airtime-deficit-field-s32-instead-.patch +++ /dev/null @@ -1,52 +0,0 @@ -From: Felix Fietkau -Date: Mon, 20 Jun 2022 14:53:04 +0200 -Subject: [PATCH] mac80211: make sta airtime deficit field s32 instead of - s64 - -32 bit is more than enough range for the airtime deficit - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -202,7 +202,7 @@ static ssize_t sta_airtime_read(struct f - size_t bufsz = 400; - char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; - u64 rx_airtime = 0, tx_airtime = 0; -- s64 deficit[IEEE80211_NUM_ACS]; -+ s32 deficit[IEEE80211_NUM_ACS]; - ssize_t rv; - int ac; - -@@ -219,7 +219,7 @@ static ssize_t sta_airtime_read(struct f - - p += scnprintf(p, bufsz + buf - p, - "RX: %llu us\nTX: %llu us\nWeight: %u\n" -- "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", -+ "Deficit: VO: %d us VI: %d us BE: %d us BK: %d us\n", - rx_airtime, tx_airtime, sta->airtime_weight, - deficit[0], deficit[1], deficit[2], deficit[3]); - ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -138,7 +138,7 @@ enum ieee80211_agg_stop_reason { - struct airtime_info { - u64 rx_airtime; - u64 tx_airtime; -- s64 deficit; -+ s32 deficit; - atomic_t aql_tx_pending; /* Estimated airtime for frames pending */ - u32 aql_limit_low; - u32 aql_limit_high; ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3847,7 +3847,7 @@ struct ieee80211_txq *ieee80211_next_txq - struct sta_info *sta = container_of(txqi->txq.sta, - struct sta_info, sta); - bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq); -- s64 deficit = sta->airtime[txqi->txq.ac].deficit; -+ s32 deficit = sta->airtime[txqi->txq.ac].deficit; - - if (aql_check) - found_eligible_txq = true; diff --git a/package/kernel/mac80211/patches/subsys/332-v6.0-mac80211-consider-aql_tx_pending-when-checking-airti.patch b/package/kernel/mac80211/patches/subsys/332-v6.0-mac80211-consider-aql_tx_pending-when-checking-airti.patch deleted file mode 100644 index c214294603d..00000000000 --- a/package/kernel/mac80211/patches/subsys/332-v6.0-mac80211-consider-aql_tx_pending-when-checking-airti.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: Felix Fietkau -Date: Mon, 20 Jun 2022 14:59:09 +0200 -Subject: [PATCH] mac80211: consider aql_tx_pending when checking airtime - deficit - -When queueing packets for a station, deficit only gets added once the packets -have been transmitted, which could be much later. During that time, a lot of -temporary unfairness could happen, which could lead to bursty behavior. -Fix this by subtracting the aql_tx_pending when checking the deficit in tx -scheduling. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3817,6 +3817,13 @@ out: - } - EXPORT_SYMBOL(ieee80211_tx_dequeue); - -+static inline s32 ieee80211_sta_deficit(struct sta_info *sta, u8 ac) -+{ -+ struct airtime_info *air_info = &sta->airtime[ac]; -+ -+ return air_info->deficit - atomic_read(&air_info->aql_tx_pending); -+} -+ - struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) - { - struct ieee80211_local *local = hw_to_local(hw); -@@ -3847,7 +3854,7 @@ struct ieee80211_txq *ieee80211_next_txq - struct sta_info *sta = container_of(txqi->txq.sta, - struct sta_info, sta); - bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq); -- s32 deficit = sta->airtime[txqi->txq.ac].deficit; -+ s32 deficit = ieee80211_sta_deficit(sta, txqi->txq.ac); - - if (aql_check) - found_eligible_txq = true; -@@ -3972,7 +3979,7 @@ bool ieee80211_txq_may_transmit(struct i - continue; - } - sta = container_of(iter->txq.sta, struct sta_info, sta); -- if (sta->airtime[ac].deficit < 0) -+ if (ieee80211_sta_deficit(sta, ac) < 0) - sta->airtime[ac].deficit += sta->airtime_weight; - list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); - } diff --git a/package/kernel/mac80211/patches/subsys/333-v6.0-mac80211-keep-recently-active-tx-queues-in-schedulin.patch b/package/kernel/mac80211/patches/subsys/333-v6.0-mac80211-keep-recently-active-tx-queues-in-schedulin.patch deleted file mode 100644 index 317e4f0653e..00000000000 --- a/package/kernel/mac80211/patches/subsys/333-v6.0-mac80211-keep-recently-active-tx-queues-in-schedulin.patch +++ /dev/null @@ -1,118 +0,0 @@ -From: Felix Fietkau -Date: Mon, 20 Jun 2022 20:52:50 +0200 -Subject: [PATCH] mac80211: keep recently active tx queues in scheduling - list - -This allows proper deficit accounting to ensure that they don't carry their -deficit until the next time they become active - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -83,6 +83,13 @@ extern const u8 ieee80211_ac_to_qos_mask - - #define IEEE80211_MAX_NAN_INSTANCE_ID 255 - -+ -+/* -+ * Keep a station's queues on the active list for deficit accounting purposes -+ * if it was active or queued during the last 100ms -+ */ -+#define AIRTIME_ACTIVE_DURATION (HZ / 10) -+ - struct ieee80211_bss { - u32 device_ts_beacon, device_ts_presp; - ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -138,6 +138,7 @@ enum ieee80211_agg_stop_reason { - struct airtime_info { - u64 rx_airtime; - u64 tx_airtime; -+ u32 last_active; - s32 deficit; - atomic_t aql_tx_pending; /* Estimated airtime for frames pending */ - u32 aql_limit_low; ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3824,6 +3824,36 @@ static inline s32 ieee80211_sta_deficit( - return air_info->deficit - atomic_read(&air_info->aql_tx_pending); - } - -+static void -+ieee80211_txq_set_active(struct txq_info *txqi) -+{ -+ struct sta_info *sta; -+ -+ if (!txqi->txq.sta) -+ return; -+ -+ sta = container_of(txqi->txq.sta, struct sta_info, sta); -+ sta->airtime[txqi->txq.ac].last_active = (u32)jiffies; -+} -+ -+static bool -+ieee80211_txq_keep_active(struct txq_info *txqi) -+{ -+ struct sta_info *sta; -+ u32 diff; -+ -+ if (!txqi->txq.sta) -+ return false; -+ -+ sta = container_of(txqi->txq.sta, struct sta_info, sta); -+ if (ieee80211_sta_deficit(sta, txqi->txq.ac) >= 0) -+ return false; -+ -+ diff = (u32)jiffies - sta->airtime[txqi->txq.ac].last_active; -+ -+ return diff <= AIRTIME_ACTIVE_DURATION; -+} -+ - struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) - { - struct ieee80211_local *local = hw_to_local(hw); -@@ -3870,7 +3900,6 @@ struct ieee80211_txq *ieee80211_next_txq - } - } - -- - if (txqi->schedule_round == local->schedule_round[ac]) - goto out; - -@@ -3890,12 +3919,13 @@ void __ieee80211_schedule_txq(struct iee - { - struct ieee80211_local *local = hw_to_local(hw); - struct txq_info *txqi = to_txq_info(txq); -+ bool has_queue; - - spin_lock_bh(&local->active_txq_lock[txq->ac]); - -+ has_queue = force || txq_has_queue(txq); - if (list_empty(&txqi->schedule_order) && -- (force || !skb_queue_empty(&txqi->frags) || -- txqi->tin.backlog_packets)) { -+ (has_queue || ieee80211_txq_keep_active(txqi))) { - /* If airtime accounting is active, always enqueue STAs at the - * head of the list to ensure that they only get moved to the - * back by the airtime DRR scheduler once they have a negative -@@ -3903,7 +3933,7 @@ void __ieee80211_schedule_txq(struct iee - * get immediately moved to the back of the list on the next - * call to ieee80211_next_txq(). - */ -- if (txqi->txq.sta && local->airtime_flags && -+ if (txqi->txq.sta && local->airtime_flags && has_queue && - wiphy_ext_feature_isset(local->hw.wiphy, - NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) - list_add(&txqi->schedule_order, -@@ -3911,6 +3941,8 @@ void __ieee80211_schedule_txq(struct iee - else - list_add_tail(&txqi->schedule_order, - &local->active_txqs[txq->ac]); -+ if (has_queue) -+ ieee80211_txq_set_active(txqi); - } - - spin_unlock_bh(&local->active_txq_lock[txq->ac]); diff --git a/package/kernel/mac80211/patches/subsys/334-v6.0-mac80211-add-a-per-PHY-AQL-limit-to-improve-fairness.patch b/package/kernel/mac80211/patches/subsys/334-v6.0-mac80211-add-a-per-PHY-AQL-limit-to-improve-fairness.patch deleted file mode 100644 index fb6fd6eac6e..00000000000 --- a/package/kernel/mac80211/patches/subsys/334-v6.0-mac80211-add-a-per-PHY-AQL-limit-to-improve-fairness.patch +++ /dev/null @@ -1,131 +0,0 @@ -From: Felix Fietkau -Date: Mon, 20 Jun 2022 21:26:34 +0200 -Subject: [PATCH] mac80211: add a per-PHY AQL limit to improve fairness - -In order to maintain fairness, the amount of queueing needs to be limited -beyond the simple per-station AQL budget, otherwise the driver can simply -repeatedly do scheduling rounds until all queues that have not used their -AQL budget become eligble. - -To be conservative, use the high AQL limit for the first txq and add half -of the low AQL for each subsequent queue. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1215,6 +1215,7 @@ struct ieee80211_local { - u32 aql_txq_limit_high[IEEE80211_NUM_ACS]; - u32 aql_threshold; - atomic_t aql_total_pending_airtime; -+ atomic_t aql_ac_pending_airtime[IEEE80211_NUM_ACS]; - - const struct ieee80211_ops *ops; - ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -712,6 +712,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; - local->aql_txq_limit_high[i] = - IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H; -+ atomic_set(&local->aql_ac_pending_airtime[i], 0); - } - - local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -1929,6 +1929,7 @@ void ieee80211_sta_update_pending_airtim - &sta->airtime[ac].aql_tx_pending); - - atomic_add(tx_airtime, &local->aql_total_pending_airtime); -+ atomic_add(tx_airtime, &local->aql_ac_pending_airtime[ac]); - return; - } - -@@ -1940,14 +1941,17 @@ void ieee80211_sta_update_pending_airtim - tx_pending, 0); - } - -+ atomic_sub(tx_airtime, &local->aql_total_pending_airtime); - tx_pending = atomic_sub_return(tx_airtime, -- &local->aql_total_pending_airtime); -+ &local->aql_ac_pending_airtime[ac]); - if (WARN_ONCE(tx_pending < 0, - "Device %s AC %d pending airtime underflow: %u, %u", - wiphy_name(local->hw.wiphy), ac, tx_pending, -- tx_airtime)) -- atomic_cmpxchg(&local->aql_total_pending_airtime, -+ tx_airtime)) { -+ atomic_cmpxchg(&local->aql_ac_pending_airtime[ac], - tx_pending, 0); -+ atomic_sub(tx_pending, &local->aql_total_pending_airtime); -+ } - } - - int sta_info_move_state(struct sta_info *sta, ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3863,6 +3863,9 @@ struct ieee80211_txq *ieee80211_next_txq - - spin_lock_bh(&local->active_txq_lock[ac]); - -+ if (!local->schedule_round[ac]) -+ goto out; -+ - begin: - txqi = list_first_entry_or_null(&local->active_txqs[ac], - struct txq_info, -@@ -3984,6 +3987,25 @@ bool ieee80211_txq_airtime_check(struct - } - EXPORT_SYMBOL(ieee80211_txq_airtime_check); - -+static bool -+ieee80211_txq_schedule_airtime_check(struct ieee80211_local *local, u8 ac) -+{ -+ unsigned int num_txq = 0; -+ struct txq_info *txq; -+ u32 aql_limit; -+ -+ if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) -+ return true; -+ -+ list_for_each_entry(txq, &local->active_txqs[ac], schedule_order) -+ num_txq++; -+ -+ aql_limit = (num_txq - 1) * local->aql_txq_limit_low[ac] / 2 + -+ local->aql_txq_limit_high[ac]; -+ -+ return atomic_read(&local->aql_ac_pending_airtime[ac]) < aql_limit; -+} -+ - bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, - struct ieee80211_txq *txq) - { -@@ -4000,6 +4022,9 @@ bool ieee80211_txq_may_transmit(struct i - if (list_empty(&txqi->schedule_order)) - goto out; - -+ if (!ieee80211_txq_schedule_airtime_check(local, ac)) -+ goto out; -+ - list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac], - schedule_order) { - if (iter == txqi) -@@ -4039,7 +4064,15 @@ void ieee80211_txq_schedule_start(struct - struct ieee80211_local *local = hw_to_local(hw); - - spin_lock_bh(&local->active_txq_lock[ac]); -- local->schedule_round[ac]++; -+ -+ if (ieee80211_txq_schedule_airtime_check(local, ac)) { -+ local->schedule_round[ac]++; -+ if (!local->schedule_round[ac]) -+ local->schedule_round[ac]++; -+ } else { -+ local->schedule_round[ac] = 0; -+ } -+ - spin_unlock_bh(&local->active_txq_lock[ac]); - } - EXPORT_SYMBOL(ieee80211_txq_schedule_start); diff --git a/package/kernel/mac80211/patches/subsys/335-v6.0-mac80211-add-debugfs-file-to-display-per-phy-AQL-pen.patch b/package/kernel/mac80211/patches/subsys/335-v6.0-mac80211-add-debugfs-file-to-display-per-phy-AQL-pen.patch deleted file mode 100644 index df45a520fa3..00000000000 --- a/package/kernel/mac80211/patches/subsys/335-v6.0-mac80211-add-debugfs-file-to-display-per-phy-AQL-pen.patch +++ /dev/null @@ -1,58 +0,0 @@ -From: Felix Fietkau -Date: Sat, 25 Jun 2022 21:25:40 +0200 -Subject: [PATCH] mac80211: add debugfs file to display per-phy AQL pending - airtime - -Now that the global pending airtime is more relevant for airtime fairness, -it makes sense to make it accessible via debugfs for debugging - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -201,6 +201,36 @@ static const struct file_operations airt - .llseek = default_llseek, - }; - -+static ssize_t aql_pending_read(struct file *file, -+ char __user *user_buf, -+ size_t count, loff_t *ppos) -+{ -+ struct ieee80211_local *local = file->private_data; -+ char buf[400]; -+ int len = 0; -+ -+ len = scnprintf(buf, sizeof(buf), -+ "AC AQL pending\n" -+ "VO %u us\n" -+ "VI %u us\n" -+ "BE %u us\n" -+ "BK %u us\n" -+ "total %u us\n", -+ atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_VO]), -+ atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_VI]), -+ atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_BE]), -+ atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_BK]), -+ atomic_read(&local->aql_total_pending_airtime)); -+ return simple_read_from_buffer(user_buf, count, ppos, -+ buf, len); -+} -+ -+static const struct file_operations aql_pending_ops = { -+ .read = aql_pending_read, -+ .open = simple_open, -+ .llseek = default_llseek, -+}; -+ - static ssize_t aql_txq_limit_read(struct file *file, - char __user *user_buf, - size_t count, -@@ -628,6 +658,7 @@ void debugfs_hw_add(struct ieee80211_loc - DEBUGFS_ADD(hw_conf); - DEBUGFS_ADD_MODE(force_tx_status, 0600); - DEBUGFS_ADD_MODE(aql_enable, 0600); -+ DEBUGFS_ADD(aql_pending); - - if (local->ops->wake_tx_queue) - DEBUGFS_ADD_MODE(aqm, 0600); diff --git a/package/kernel/mac80211/patches/subsys/336-v6.0-mac80211-only-accumulate-airtime-deficit-for-active-.patch b/package/kernel/mac80211/patches/subsys/336-v6.0-mac80211-only-accumulate-airtime-deficit-for-active-.patch deleted file mode 100644 index 35f07c1a976..00000000000 --- a/package/kernel/mac80211/patches/subsys/336-v6.0-mac80211-only-accumulate-airtime-deficit-for-active-.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Felix Fietkau -Date: Sat, 25 Jun 2022 23:10:19 +0200 -Subject: [PATCH] mac80211: only accumulate airtime deficit for active - clients - -When a client does not generate any local tx activity, accumulating airtime -deficit for the round-robin scheduler can be harmful. If this goes on for too -long, the deficit could grow quite large, which might cause unreasonable -initial latency once the client becomes active - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -1900,6 +1900,7 @@ void ieee80211_sta_register_airtime(stru - struct ieee80211_local *local = sta->sdata->local; - u8 ac = ieee80211_ac_from_tid(tid); - u32 airtime = 0; -+ u32 diff; - - if (sta->local->airtime_flags & AIRTIME_USE_TX) - airtime += tx_airtime; -@@ -1909,7 +1910,11 @@ void ieee80211_sta_register_airtime(stru - spin_lock_bh(&local->active_txq_lock[ac]); - sta->airtime[ac].tx_airtime += tx_airtime; - sta->airtime[ac].rx_airtime += rx_airtime; -- sta->airtime[ac].deficit -= airtime; -+ -+ diff = (u32)jiffies - sta->airtime[ac].last_active; -+ if (diff <= AIRTIME_ACTIVE_DURATION) -+ sta->airtime[ac].deficit -= airtime; -+ - spin_unlock_bh(&local->active_txq_lock[ac]); - } - EXPORT_SYMBOL(ieee80211_sta_register_airtime); diff --git a/package/kernel/mac80211/patches/subsys/339-v6.0-mac80211-exclude-multicast-packets-from-AQL-pending-.patch b/package/kernel/mac80211/patches/subsys/339-v6.0-mac80211-exclude-multicast-packets-from-AQL-pending-.patch deleted file mode 100644 index 43c3e75d657..00000000000 --- a/package/kernel/mac80211/patches/subsys/339-v6.0-mac80211-exclude-multicast-packets-from-AQL-pending-.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: Felix Fietkau -Date: Wed, 13 Jul 2022 07:32:26 +0200 -Subject: [PATCH] mac80211: exclude multicast packets from AQL pending airtime - -In AP mode, multicast traffic is handled very differently from normal traffic, -especially if at least one client is in powersave mode. -This means that multicast packets can be buffered a lot longer than normal -unicast packets, and can eat up the AQL budget very quickly because of the low -data rate. -Along with the recent change to maintain a global PHY AQL limit, this can lead -to significant latency spikes for unicast traffic. - -Since queueing multicast to hardware is currently not constrained by AQL limits -anyway, let's just exclude it from the AQL pending airtime calculation entirely. - -Fixes: 8e4bac067105 ("wifi: mac80211: add a per-PHY AQL limit to improve fairness") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3792,7 +3792,7 @@ begin: - encap_out: - IEEE80211_SKB_CB(skb)->control.vif = vif; - -- if (vif && -+ if (tx.sta && - wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) { - bool ampdu = txq->ac != IEEE80211_AC_VO; - u32 airtime; diff --git a/package/kernel/mac80211/patches/subsys/340-v5.19-wifi-mac80211-do-not-abuse-fq.lock-in-ieee80211_do_s.patch b/package/kernel/mac80211/patches/subsys/340-v5.19-wifi-mac80211-do-not-abuse-fq.lock-in-ieee80211_do_s.patch deleted file mode 100644 index 82243f1d98f..00000000000 --- a/package/kernel/mac80211/patches/subsys/340-v5.19-wifi-mac80211-do-not-abuse-fq.lock-in-ieee80211_do_s.patch +++ /dev/null @@ -1,46 +0,0 @@ -From aa40d5a43526cca9439a2b45fcfdcd016594dece Mon Sep 17 00:00:00 2001 -From: Tetsuo Handa -Date: Sun, 17 Jul 2022 21:21:52 +0900 -Subject: [PATCH] wifi: mac80211: do not abuse fq.lock in ieee80211_do_stop() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -lockdep complains use of uninitialized spinlock at ieee80211_do_stop() [1], -for commit f856373e2f31ffd3 ("wifi: mac80211: do not wake queues on a vif -that is being stopped") guards clear_bit() using fq.lock even before -fq_init() from ieee80211_txq_setup_flows() initializes this spinlock. - -According to discussion [2], Toke was not happy with expanding usage of -fq.lock. Since __ieee80211_wake_txqs() is called under RCU read lock, we -can instead use synchronize_rcu() for flushing ieee80211_wake_txqs(). - -Link: https://syzkaller.appspot.com/bug?extid=eceab52db7c4b961e9d6 [1] -Link: https://lkml.kernel.org/r/874k0zowh2.fsf@toke.dk [2] -Reported-by: syzbot -Signed-off-by: Tetsuo Handa -Fixes: f856373e2f31ffd3 ("wifi: mac80211: do not wake queues on a vif that is being stopped") -Tested-by: syzbot -Acked-by: Toke Høiland-Jørgensen -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/9cc9b81d-75a3-3925-b612-9d0ad3cab82b@I-love.SAKURA.ne.jp -[ pick up commit 3598cb6e1862 ("wifi: mac80211: do not abuse fq.lock in ieee80211_do_stop()") from -next] -Link: https://lore.kernel.org/all/87o7xcq6qt.fsf@kernel.org/ -Signed-off-by: Jakub Kicinski ---- - net/mac80211/iface.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -377,9 +377,8 @@ static void ieee80211_do_stop(struct iee - bool cancel_scan; - struct cfg80211_nan_func *func; - -- spin_lock_bh(&local->fq.lock); - clear_bit(SDATA_STATE_RUNNING, &sdata->state); -- spin_unlock_bh(&local->fq.lock); -+ synchronize_rcu(); /* flush _ieee80211_wake_txqs() */ - - cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata; - if (cancel_scan) diff --git a/package/kernel/mac80211/patches/subsys/341-v6.0-mac80211-Fix-deadlock-Don-t-start-TX-while-holding-f.patch b/package/kernel/mac80211/patches/subsys/341-v6.0-mac80211-Fix-deadlock-Don-t-start-TX-while-holding-f.patch deleted file mode 100644 index 8c56acbf889..00000000000 --- a/package/kernel/mac80211/patches/subsys/341-v6.0-mac80211-Fix-deadlock-Don-t-start-TX-while-holding-f.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: Alexander Wetzel -Date: Thu, 15 Sep 2022 14:41:20 +0200 -Subject: [PATCH] mac80211: Fix deadlock: Don't start TX while holding - fq->lock - -ieee80211_txq_purge() calls fq_tin_reset() and -ieee80211_purge_tx_queue(); Both are then calling -ieee80211_free_txskb(). Which can decide to TX the skb again. - -There are at least two ways to get a deadlock: - -1) When we have a TDLS teardown packet queued in either tin or frags - ieee80211_tdls_td_tx_handle() will call ieee80211_subif_start_xmit() - while we still hold fq->lock. ieee80211_txq_enqueue() will thus - deadlock. - -2) A variant of the above happens if aggregation is up and running: - In that case ieee80211_iface_work() will deadlock with the original - task: The original tasks already holds fq->lock and tries to get - sta->lock after kicking off ieee80211_iface_work(). But the worker - can get sta->lock prior to the original task and will then spin for - fq->lock. - -Avoid these deadlocks by not sending out any skbs when called via -ieee80211_free_txskb(). - -Signed-off-by: Alexander Wetzel ---- - ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -698,7 +698,7 @@ static void ieee80211_report_used_skb(st - - if (!sdata) { - skb->dev = NULL; -- } else { -+ } else if (!dropped) { - unsigned int hdr_size = - ieee80211_hdrlen(hdr->frame_control); - diff --git a/package/kernel/mac80211/patches/subsys/342-v6.0-mac80211-Ensure-vif-queues-are-operational-after-sta.patch b/package/kernel/mac80211/patches/subsys/342-v6.0-mac80211-Ensure-vif-queues-are-operational-after-sta.patch deleted file mode 100644 index 43103293194..00000000000 --- a/package/kernel/mac80211/patches/subsys/342-v6.0-mac80211-Ensure-vif-queues-are-operational-after-sta.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Alexander Wetzel -Date: Thu, 15 Sep 2022 15:09:46 +0200 -Subject: [PATCH] mac80211: Ensure vif queues are operational after start - -Make sure local->queue_stop_reasons and vif.txqs_stopped stay in sync. - -When a new vif is created the queues may end up in an inconsistent state -and be inoperable: -Communication not using iTXQ will work, allowing to e.g. complete the -association. But the 4-way handshake will time out. The sta will not -send out any skbs queued in iTXQs. - -All normal attempts to start the queues will fail when reaching this -state. -local->queue_stop_reasons will have marked all queues as operational but -vif.txqs_stopped will still be set, creating an inconsistent internal -state. - -In reality this seems to be race between the mac80211 function -ieee80211_do_open() setting SDATA_STATE_RUNNING and the wake_txqs_tasklet: -Depending on the driver and the timing the queues may end up to be -operational or not. - -Cc: stable@vger.kernel.org -Fixes: f856373e2f31 ("wifi: mac80211: do not wake queues on a vif that is being stopped") -Signed-off-by: Alexander Wetzel ---- - ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -301,14 +301,14 @@ static void __ieee80211_wake_txqs(struct - local_bh_disable(); - spin_lock(&fq->lock); - -+ sdata->vif.txqs_stopped[ac] = false; -+ - if (!test_bit(SDATA_STATE_RUNNING, &sdata->state)) - goto out; - - if (sdata->vif.type == NL80211_IFTYPE_AP) - ps = &sdata->bss->ps; - -- sdata->vif.txqs_stopped[ac] = false; -- - list_for_each_entry_rcu(sta, &local->sta_list, list) { - if (sdata != sta->sdata) - continue; diff --git a/package/kernel/mac80211/patches/subsys/343-v6.1-wifi-mac80211-fix-decap-offload-for-stations-on-AP_V.patch b/package/kernel/mac80211/patches/subsys/343-v6.1-wifi-mac80211-fix-decap-offload-for-stations-on-AP_V.patch deleted file mode 100644 index 02467854750..00000000000 --- a/package/kernel/mac80211/patches/subsys/343-v6.1-wifi-mac80211-fix-decap-offload-for-stations-on-AP_V.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Felix Fietkau -Date: Wed, 28 Sep 2022 13:50:34 +0200 -Subject: [PATCH] wifi: mac80211: fix decap offload for stations on AP_VLAN - interfaces - -Since AP_VLAN interfaces are not passed to the driver, check offload_flags -on the bss vif instead. - -Reported-by: Howard Hsu -Fixes: 80a915ec4427 ("mac80211: add rx decapsulation offload support") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -4267,6 +4267,7 @@ void ieee80211_check_fast_rx(struct sta_ - .vif_type = sdata->vif.type, - .control_port_protocol = sdata->control_port_protocol, - }, *old, *new = NULL; -+ u32 offload_flags; - bool set_offload = false; - bool assign = false; - bool offload; -@@ -4382,10 +4383,10 @@ void ieee80211_check_fast_rx(struct sta_ - if (assign) - new = kmemdup(&fastrx, sizeof(fastrx), GFP_KERNEL); - -- offload = assign && -- (sdata->vif.offload_flags & IEEE80211_OFFLOAD_DECAP_ENABLED); -+ offload_flags = get_bss_sdata(sdata)->vif.offload_flags; -+ offload = offload_flags & IEEE80211_OFFLOAD_DECAP_ENABLED; - -- if (offload) -+ if (assign && offload) - set_offload = !test_and_set_sta_flag(sta, WLAN_STA_DECAP_OFFLOAD); - else - set_offload = test_and_clear_sta_flag(sta, WLAN_STA_DECAP_OFFLOAD); diff --git a/package/kernel/mac80211/patches/subsys/344-v6.1-wifi-cfg80211-fix-ieee80211_data_to_8023_exthdr-hand.patch b/package/kernel/mac80211/patches/subsys/344-v6.1-wifi-cfg80211-fix-ieee80211_data_to_8023_exthdr-hand.patch deleted file mode 100644 index 161c7d6c8fb..00000000000 --- a/package/kernel/mac80211/patches/subsys/344-v6.1-wifi-cfg80211-fix-ieee80211_data_to_8023_exthdr-hand.patch +++ /dev/null @@ -1,99 +0,0 @@ -From: Felix Fietkau -Date: Fri, 7 Oct 2022 10:54:47 +0200 -Subject: [PATCH] wifi: cfg80211: fix ieee80211_data_to_8023_exthdr - handling of small packets - -STP topology change notification packets only have a payload of 7 bytes, -so they get dropped due to the skb->len < hdrlen + 8 check. -Fix this by removing skb->len based checks and instead check the return code -on the skb_copy_bits calls. - -Fixes: 2d1c304cb2d5 ("cfg80211: add function for 802.3 conversion with separate output buffer") -Reported-by: Chad Monroe -Signed-off-by: Felix Fietkau ---- - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -557,7 +557,7 @@ int ieee80211_data_to_8023_exthdr(struct - return -1; - - hdrlen = ieee80211_hdrlen(hdr->frame_control) + data_offset; -- if (skb->len < hdrlen + 8) -+ if (skb->len < hdrlen) - return -1; - - /* convert IEEE 802.11 header + possible LLC headers into Ethernet -@@ -572,8 +572,9 @@ int ieee80211_data_to_8023_exthdr(struct - memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN); - memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN); - -- if (iftype == NL80211_IFTYPE_MESH_POINT) -- skb_copy_bits(skb, hdrlen, &mesh_flags, 1); -+ if (iftype == NL80211_IFTYPE_MESH_POINT && -+ skb_copy_bits(skb, hdrlen, &mesh_flags, 1) < 0) -+ return -1; - - mesh_flags &= MESH_FLAGS_AE; - -@@ -593,11 +594,12 @@ int ieee80211_data_to_8023_exthdr(struct - if (iftype == NL80211_IFTYPE_MESH_POINT) { - if (mesh_flags == MESH_FLAGS_AE_A4) - return -1; -- if (mesh_flags == MESH_FLAGS_AE_A5_A6) { -- skb_copy_bits(skb, hdrlen + -- offsetof(struct ieee80211s_hdr, eaddr1), -- tmp.h_dest, 2 * ETH_ALEN); -- } -+ if (mesh_flags == MESH_FLAGS_AE_A5_A6 && -+ skb_copy_bits(skb, hdrlen + -+ offsetof(struct ieee80211s_hdr, eaddr1), -+ tmp.h_dest, 2 * ETH_ALEN) < 0) -+ return -1; -+ - hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags); - } - break; -@@ -611,10 +613,11 @@ int ieee80211_data_to_8023_exthdr(struct - if (iftype == NL80211_IFTYPE_MESH_POINT) { - if (mesh_flags == MESH_FLAGS_AE_A5_A6) - return -1; -- if (mesh_flags == MESH_FLAGS_AE_A4) -- skb_copy_bits(skb, hdrlen + -- offsetof(struct ieee80211s_hdr, eaddr1), -- tmp.h_source, ETH_ALEN); -+ if (mesh_flags == MESH_FLAGS_AE_A4 && -+ skb_copy_bits(skb, hdrlen + -+ offsetof(struct ieee80211s_hdr, eaddr1), -+ tmp.h_source, ETH_ALEN) < 0) -+ return -1; - hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags); - } - break; -@@ -626,18 +629,18 @@ int ieee80211_data_to_8023_exthdr(struct - break; - } - -- skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)); -- tmp.h_proto = payload.proto; -- -- if (likely((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) && -- tmp.h_proto != htons(ETH_P_AARP) && -- tmp.h_proto != htons(ETH_P_IPX)) || -- ether_addr_equal(payload.hdr, bridge_tunnel_header))) -+ if (likely(skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 && -+ ((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) && -+ payload.proto != htons(ETH_P_AARP) && -+ payload.proto != htons(ETH_P_IPX)) || -+ ether_addr_equal(payload.hdr, bridge_tunnel_header)))) { - /* remove RFC1042 or Bridge-Tunnel encapsulation and - * replace EtherType */ - hdrlen += ETH_ALEN + 2; -- else -+ tmp.h_proto = payload.proto; -+ } else { - tmp.h_proto = htons(skb->len - hdrlen); -+ } - - pskb_pull(skb, hdrlen); - diff --git a/package/kernel/mac80211/patches/subsys/345-v6.1-wifi-mac80211-do-not-drop-packets-smaller-than-the-L.patch b/package/kernel/mac80211/patches/subsys/345-v6.1-wifi-mac80211-do-not-drop-packets-smaller-than-the-L.patch deleted file mode 100644 index 23047f68c96..00000000000 --- a/package/kernel/mac80211/patches/subsys/345-v6.1-wifi-mac80211-do-not-drop-packets-smaller-than-the-L.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Fri, 7 Oct 2022 10:58:26 +0200 -Subject: [PATCH] wifi: mac80211: do not drop packets smaller than the - LLC-SNAP header on fast-rx - -Since STP TCN frames are only 7 bytes, the pskb_may_pull call returns an error. -Instead of dropping those packets, bump them back to the slow path for proper -processing. - -Fixes: 49ddf8e6e234 ("mac80211: add fast-rx path") -Reported-by: Chad Monroe -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -4603,7 +4603,7 @@ static bool ieee80211_invoke_fast_rx(str - - if (!(status->rx_flags & IEEE80211_RX_AMSDU)) { - if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) -- goto drop; -+ return false; - - payload = (void *)(skb->data + snap_offs); - diff --git a/package/kernel/mac80211/patches/subsys/346-v6.0-wifi-mac80211-fix-mesh-airtime-link-metric-estimatin.patch b/package/kernel/mac80211/patches/subsys/346-v6.0-wifi-mac80211-fix-mesh-airtime-link-metric-estimatin.patch deleted file mode 100644 index 7185a7fed6e..00000000000 --- a/package/kernel/mac80211/patches/subsys/346-v6.0-wifi-mac80211-fix-mesh-airtime-link-metric-estimatin.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Aditya Kumar Singh -Date: Fri, 1 Jul 2022 19:06:11 +0530 -Subject: [PATCH] wifi: mac80211: fix mesh airtime link metric estimating - -ieee80211s_update_metric function uses sta_set_rate_info_tx -function to get struct rate_info data from ieee80211_tx_rate -struct, present in ieee80211_sta->deflink.tx_stats. However, -drivers can skip tx rate calculation by setting rate idx as --1. Such drivers provides rate_info directly and hence -ieee80211s metric is updated incorrectly since ieee80211_tx_rate -has inconsistent data. - -Add fix to use rate_info directly if present instead of -sta_set_rate_info_tx for updating ieee80211s metric. - -Signed-off-by: Aditya Kumar Singh -Link: https://lore.kernel.org/r/20220701133611.544-1-quic_adisi@quicinc.com -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/mesh_hwmp.c -+++ b/net/mac80211/mesh_hwmp.c -@@ -310,7 +310,12 @@ void ieee80211s_update_metric(struct iee - LINK_FAIL_THRESH) - mesh_plink_broken(sta); - -- sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo); -+ /* use rate info set by the driver directly if present */ -+ if (st->rate) -+ rinfo = sta->tx_stats.last_rate_info; -+ else -+ sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo); -+ - ewma_mesh_tx_rate_avg_add(&sta->mesh->tx_rate_avg, - cfg80211_calculate_bitrate(&rinfo)); - } diff --git a/package/kernel/mac80211/patches/subsys/363-v5.19-bss-color-collision.patch b/package/kernel/mac80211/patches/subsys/363-v5.19-bss-color-collision.patch deleted file mode 100644 index edee4b3ee09..00000000000 --- a/package/kernel/mac80211/patches/subsys/363-v5.19-bss-color-collision.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 6d945a33f2b0aa24fc210dadaa0af3e8218e7002 Mon Sep 17 00:00:00 2001 -From: Lorenzo Bianconi -Date: Fri, 25 Mar 2022 11:42:41 +0100 -Subject: [PATCH] mac80211: introduce BSS color collision detection - -Add ieee80211_rx_check_bss_color_collision routine in order to introduce -BSS color collision detection in mac80211 if it is not supported in HW/FW -(e.g. for mt7915 chipset). -Add IEEE80211_HW_DETECTS_COLOR_COLLISION flag to let the driver notify -BSS color collision detection is supported in HW/FW. Set this for ath11k -which apparently didn't need this code. - -Tested-by: Peter Chiu -Co-developed-by: Ryder Lee -Signed-off-by: Ryder Lee -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/a05eeeb1841a84560dc5aaec77894fcb69a54f27.1648204871.git.lorenzo@kernel.org -[clarify commit message a bit, move flag to mac80211] -Signed-off-by: Johannes Berg ---- - drivers/net/wireless/ath/ath11k/mac.c | 5 ++- - include/net/mac80211.h | 4 +++ - net/mac80211/debugfs.c | 1 + - net/mac80211/rx.c | 46 +++++++++++++++++++++++++++ - 4 files changed, 55 insertions(+), 1 deletion(-) - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -2418,6 +2418,9 @@ struct ieee80211_txq { - * usage and 802.11 frames with %RX_FLAG_ONLY_MONITOR set for monitor to - * the stack. - * -+ * @IEEE80211_HW_DETECTS_COLOR_COLLISION: HW/driver has support for BSS color -+ * collision detection and doesn't need it in software. -+ * - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays - */ - enum ieee80211_hw_flags { -@@ -2473,6 +2476,7 @@ enum ieee80211_hw_flags { - IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD, - IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD, - IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP, -+ IEEE80211_HW_DETECTS_COLOR_COLLISION, - - /* keep last, obviously */ - NUM_IEEE80211_HW_FLAGS ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -494,6 +494,7 @@ static const char *hw_flag_names[] = { - FLAG(SUPPORTS_TX_ENCAP_OFFLOAD), - FLAG(SUPPORTS_RX_DECAP_OFFLOAD), - FLAG(SUPPORTS_CONC_MON_RX_DECAP), -+ FLAG(DETECTS_COLOR_COLLISION), - #undef FLAG - }; - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3182,6 +3182,49 @@ static void ieee80211_process_sa_query_r - ieee80211_tx_skb(sdata, skb); - } - -+static void -+ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx) -+{ -+ struct ieee80211_mgmt *mgmt = (void *)rx->skb->data; -+ const struct element *ie; -+ size_t baselen; -+ -+ if (!wiphy_ext_feature_isset(rx->local->hw.wiphy, -+ NL80211_EXT_FEATURE_BSS_COLOR)) -+ return; -+ -+ if (ieee80211_hw_check(&rx->local->hw, DETECTS_COLOR_COLLISION)) -+ return; -+ -+ if (rx->sdata->vif.csa_active) -+ return; -+ -+ baselen = mgmt->u.beacon.variable - rx->skb->data; -+ if (baselen > rx->skb->len) -+ return; -+ -+ ie = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION, -+ mgmt->u.beacon.variable, -+ rx->skb->len - baselen); -+ if (ie && ie->datalen >= sizeof(struct ieee80211_he_operation) && -+ ie->datalen >= ieee80211_he_oper_size(ie->data + 1)) { -+ struct ieee80211_bss_conf *bss_conf = &rx->sdata->vif.bss_conf; -+ const struct ieee80211_he_operation *he_oper; -+ u8 color; -+ -+ he_oper = (void *)(ie->data + 1); -+ if (le32_get_bits(he_oper->he_oper_params, -+ IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED)) -+ return; -+ -+ color = le32_get_bits(he_oper->he_oper_params, -+ IEEE80211_HE_OPERATION_BSS_COLOR_MASK); -+ if (color == bss_conf->he_bss_color.color) -+ ieeee80211_obss_color_collision_notify(&rx->sdata->vif, -+ BIT_ULL(color)); -+ } -+} -+ - static ieee80211_rx_result debug_noinline - ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx) - { -@@ -3207,6 +3250,9 @@ ieee80211_rx_h_mgmt_check(struct ieee802 - !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) { - int sig = 0; - -+ /* sw bss color collision detection */ -+ ieee80211_rx_check_bss_color_collision(rx); -+ - if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM) && - !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) - sig = status->signal; diff --git a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch index f0f850dc6f1..c38fa13f03d 100644 --- a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch +++ b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch @@ -16,7 +16,7 @@ and we should ignore this. --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -625,21 +625,6 @@ static int wiphy_verify_combinations(str +@@ -614,21 +614,6 @@ static int wiphy_verify_combinations(str c->limits[j].max > 1)) return -EINVAL; diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 962ae93cc79..13b374aae79 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -3869,6 +3869,7 @@ struct mgmt_frame_regs { +@@ -4081,6 +4081,7 @@ struct mgmt_frame_regs { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting * functions to adjust rfkill hw state -@@ -4202,6 +4203,7 @@ struct cfg80211_ops { +@@ -4431,6 +4432,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -18,7 +18,7 @@ --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1566,6 +1566,7 @@ enum ieee80211_smps_mode { +@@ -1645,6 +1645,7 @@ enum ieee80211_smps_mode { * * @power_level: requested transmit power (in dBm), backward compatibility * value only that is set to the minimum of all interfaces @@ -26,7 +26,7 @@ * * @chandef: the channel definition to tune to * @radar_enabled: whether radar detection is enabled -@@ -1586,6 +1587,7 @@ enum ieee80211_smps_mode { +@@ -1665,6 +1666,7 @@ enum ieee80211_smps_mode { struct ieee80211_conf { u32 flags; int power_level, dynamic_ps_timeout; @@ -36,19 +36,19 @@ u8 ps_dtim_period; --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h -@@ -2615,6 +2615,9 @@ enum nl80211_commands { - * switching on a different channel during CAC detection on the selected - * radar channel. - * +@@ -2749,6 +2749,9 @@ enum nl80211_commands { + * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX + * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates + * the incoming frame RX timestamp. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3123,6 +3126,8 @@ enum nl80211_attrs { - - NL80211_ATTR_RADAR_BACKGROUND, +@@ -3277,6 +3280,8 @@ enum nl80211_attrs { + NL80211_ATTR_TX_HW_TIMESTAMP, + NL80211_ATTR_RX_HW_TIMESTAMP, + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + @@ -57,7 +57,7 @@ __NL80211_ATTR_AFTER_LAST, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2812,6 +2812,19 @@ static int ieee80211_get_tx_power(struct +@@ -2998,6 +2998,19 @@ static int ieee80211_get_tx_power(struct return 0; } @@ -77,7 +77,7 @@ static void ieee80211_rfkill_poll(struct wiphy *wiphy) { struct ieee80211_local *local = wiphy_priv(wiphy); -@@ -4513,6 +4526,7 @@ const struct cfg80211_ops mac80211_confi +@@ -4881,6 +4894,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, @@ -87,7 +87,7 @@ CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1447,6 +1447,7 @@ struct ieee80211_local { +@@ -1521,6 +1521,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ @@ -119,7 +119,7 @@ if (local->hw.conf.power_level != power) { changed |= IEEE80211_CONF_CHANGE_POWER; local->hw.conf.power_level = power; -@@ -679,6 +685,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -762,6 +768,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ IEEE80211_RADIOTAP_MCS_HAVE_BW; local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; @@ -129,15 +129,15 @@ local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -802,6 +802,7 @@ static const struct nla_policy nl80211_p - NLA_POLICY_NESTED(nl80211_mbssid_config_policy), - [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, - [NL80211_ATTR_RADAR_BACKGROUND] = { .type = NLA_FLAG }, +@@ -799,6 +799,7 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN), + [NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG }, + [NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT }, + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, }; /* policy for the key attributes */ -@@ -3391,6 +3392,22 @@ static int nl80211_set_wiphy(struct sk_b +@@ -3511,6 +3512,22 @@ static int nl80211_set_wiphy(struct sk_b if (result) goto out; } diff --git a/package/kernel/mac80211/patches/subsys/783-sync-nl80211.patch b/package/kernel/mac80211/patches/subsys/783-sync-nl80211.patch deleted file mode 100644 index dc2b05b1a34..00000000000 --- a/package/kernel/mac80211/patches/subsys/783-sync-nl80211.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/include/uapi/linux/nl80211.h -+++ b/include/uapi/linux/nl80211.h -@@ -6027,6 +6027,11 @@ enum nl80211_feature_flags { - * @NL80211_EXT_FEATURE_BSS_COLOR: The driver supports BSS color collision - * detection and change announcemnts. - * -+ * @NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD: Driver running in AP mode supports -+ * FILS encryption and decryption for (Re)Association Request and Response -+ * frames. Userspace has to share FILS AAD details to the driver by using -+ * @NL80211_CMD_SET_FILS_AAD. -+ * - * @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC - * detection. - * -@@ -6095,6 +6100,7 @@ enum nl80211_ext_feature_index { - NL80211_EXT_FEATURE_SECURE_RTT, - NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, - NL80211_EXT_FEATURE_BSS_COLOR, -+ NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD, - NL80211_EXT_FEATURE_RADAR_BACKGROUND, - - /* add new features before the definition below */ diff --git a/package/kernel/mac80211/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch b/package/kernel/mac80211/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch index a17d6f61615..56cc5230224 100644 --- a/package/kernel/mac80211/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch +++ b/package/kernel/mac80211/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch @@ -18,7 +18,7 @@ Signed-off-by: David Bauer --- a/net/mac80211/agg-rx.c +++ b/net/mac80211/agg-rx.c -@@ -251,7 +251,11 @@ static void ieee80211_send_addba_resp(st +@@ -254,7 +254,11 @@ static void ieee80211_send_addba_resp(st mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP; mgmt->u.action.u.addba_resp.dialog_token = dialog_token; diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 4b9a8885e93..cb1f8743bc0 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2022-11-12 -PKG_SOURCE_VERSION:=4bf2607362fc64fc4cb7d662feb736b7536c0811 -PKG_MIRROR_HASH:=fd4291ac89e14750073cc8c345772883d756bf32cf19fc7205fa344b5b3b91d0 +PKG_SOURCE_DATE:=2022-12-09 +PKG_SOURCE_VERSION:=7fae1de12ae7832a6095fd2df198f41fabd5223d +PKG_MIRROR_HASH:=c2bf2f23265d5e181c275a62a64f487b190f19b43fc4c584b62b9e6c16e992ef PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile index bd2c7cfc4ae..f486c3c2234 100644 --- a/package/kernel/mwlwifi/Makefile +++ b/package/kernel/mwlwifi/Makefile @@ -41,7 +41,8 @@ NOSTDINC_FLAGS := \ -I$(STAGING_DIR)/usr/include/mac80211-backport \ -I$(STAGING_DIR)/usr/include/mac80211/uapi \ -I$(STAGING_DIR)/usr/include/mac80211 \ - -include backport/backport.h + -include backport/backport.h \ + -Wno-unused-result define Build/Compile +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ diff --git a/package/kernel/mwlwifi/patches/005-mac80211_update.patch b/package/kernel/mwlwifi/patches/005-mac80211_update.patch new file mode 100644 index 00000000000..d0dacabd8af --- /dev/null +++ b/package/kernel/mwlwifi/patches/005-mac80211_update.patch @@ -0,0 +1,401 @@ +--- a/core.c ++++ b/core.c +@@ -692,7 +692,7 @@ static void mwl_chnl_switch_event(struct + vif = container_of((void *)mwl_vif, struct ieee80211_vif, + drv_priv); + +- if (vif->csa_active) ++ if (vif->bss_conf.csa_active) + ieee80211_csa_finish(vif); + } + spin_unlock_bh(&priv->vif_lock); +--- a/debugfs.c ++++ b/debugfs.c +@@ -462,9 +462,9 @@ static ssize_t mwl_debugfs_vif_read(stru + switch (vif->type) { + case NL80211_IFTYPE_AP: + len += scnprintf(p + len, size - len, "type: ap\n"); +- memcpy(ssid, vif->bss_conf.ssid, +- vif->bss_conf.ssid_len); +- ssid[vif->bss_conf.ssid_len] = 0; ++ memcpy(ssid, vif->cfg.ssid, ++ vif->cfg.ssid_len); ++ ssid[vif->cfg.ssid_len] = 0; + len += scnprintf(p + len, size - len, + "ssid: %s\n", ssid); + len += scnprintf(p + len, size - len, +@@ -486,8 +486,8 @@ static ssize_t mwl_debugfs_vif_read(stru + "type: unknown\n"); + break; + } +- if (vif->chanctx_conf) { +- chan_def = &vif->chanctx_conf->def; ++ if (vif->bss_conf.chanctx_conf) { ++ chan_def = &vif->bss_conf.chanctx_conf->def; + len += scnprintf(p + len, size - len, + "channel: %d: width: %d\n", + chan_def->chan->hw_value, +@@ -573,28 +573,28 @@ static ssize_t mwl_debugfs_sta_read(stru + "amsdu cap: 0x%02x\n", + sta_info->amsdu_ctrl.cap); + } +- if (sta->ht_cap.ht_supported) { ++ if (sta->deflink.ht_cap.ht_supported) { + len += scnprintf(p + len, size - len, + "ht_cap: 0x%04x, ampdu: %02x, %02x\n", +- sta->ht_cap.cap, +- sta->ht_cap.ampdu_factor, +- sta->ht_cap.ampdu_density); ++ sta->deflink.ht_cap.cap, ++ sta->deflink.ht_cap.ampdu_factor, ++ sta->deflink.ht_cap.ampdu_density); + len += scnprintf(p + len, size - len, + "rx_mask: 0x%02x, %02x, %02x, %02x\n", +- sta->ht_cap.mcs.rx_mask[0], +- sta->ht_cap.mcs.rx_mask[1], +- sta->ht_cap.mcs.rx_mask[2], +- sta->ht_cap.mcs.rx_mask[3]); ++ sta->deflink.ht_cap.mcs.rx_mask[0], ++ sta->deflink.ht_cap.mcs.rx_mask[1], ++ sta->deflink.ht_cap.mcs.rx_mask[2], ++ sta->deflink.ht_cap.mcs.rx_mask[3]); + } +- if (sta->vht_cap.vht_supported) { ++ if (sta->deflink.vht_cap.vht_supported) { + len += scnprintf(p + len, size - len, + "vht_cap: 0x%08x, mcs: %02x, %02x\n", +- sta->vht_cap.cap, +- sta->vht_cap.vht_mcs.rx_mcs_map, +- sta->vht_cap.vht_mcs.tx_mcs_map); ++ sta->deflink.vht_cap.cap, ++ sta->deflink.vht_cap.vht_mcs.rx_mcs_map, ++ sta->deflink.vht_cap.vht_mcs.tx_mcs_map); + } + len += scnprintf(p + len, size - len, "rx_bw: %d, rx_nss: %d\n", +- sta->bandwidth, sta->rx_nss); ++ sta->deflink.bandwidth, sta->deflink.rx_nss); + len += scnprintf(p + len, size - len, + "tdls: %d, tdls_init: %d\n", + sta->tdls, sta->tdls_initiator); +--- a/hif/fwcmd.c ++++ b/hif/fwcmd.c +@@ -634,8 +634,9 @@ einval: + + static int mwl_fwcmd_set_ap_beacon(struct mwl_priv *priv, + struct mwl_vif *mwl_vif, +- struct ieee80211_bss_conf *bss_conf) ++ struct ieee80211_vif *vif) + { ++ struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; + struct hostcmd_cmd_ap_beacon *pcmd; + struct ds_params *phy_ds_param_set; + +@@ -664,7 +665,7 @@ static int mwl_fwcmd_set_ap_beacon(struc + pcmd->cmd_hdr.macid = mwl_vif->macid; + + ether_addr_copy(pcmd->start_cmd.sta_mac_addr, mwl_vif->bssid); +- memcpy(pcmd->start_cmd.ssid, bss_conf->ssid, bss_conf->ssid_len); ++ memcpy(pcmd->start_cmd.ssid, vif->cfg.ssid, vif->cfg.ssid_len); + if (priv->chip_type == MWL8997) + ether_addr_copy(pcmd->start_cmd.bssid, mwl_vif->bssid); + pcmd->start_cmd.bss_type = 1; +@@ -2085,7 +2086,7 @@ int mwl_fwcmd_set_beacon(struct ieee8021 + if (mwl_fwcmd_set_wsc_ie(hw, b_inf->ie_wsc_len, b_inf->ie_wsc_ptr)) + goto err; + +- if (mwl_fwcmd_set_ap_beacon(priv, mwl_vif, &vif->bss_conf)) ++ if (mwl_fwcmd_set_ap_beacon(priv, mwl_vif, vif)) + goto err; + + if (b_inf->cap_info & WLAN_CAPABILITY_SPECTRUM_MGMT) +@@ -2147,38 +2148,38 @@ int mwl_fwcmd_set_new_stn_add(struct iee + ether_addr_copy(pcmd->mac_addr, sta->addr); + + if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) +- rates = sta->supp_rates[NL80211_BAND_2GHZ]; ++ rates = sta->deflink.supp_rates[NL80211_BAND_2GHZ]; + else +- rates = sta->supp_rates[NL80211_BAND_5GHZ] << 5; ++ rates = sta->deflink.supp_rates[NL80211_BAND_5GHZ] << 5; + pcmd->peer_info.legacy_rate_bitmap = cpu_to_le32(rates); + +- if (sta->ht_cap.ht_supported) { ++ if (sta->deflink.ht_cap.ht_supported) { + int i; + + for (i = 0; i < 4; i++) { +- if (i < sta->rx_nss) { ++ if (i < sta->deflink.rx_nss) { + pcmd->peer_info.ht_rates[i] = +- sta->ht_cap.mcs.rx_mask[i]; ++ sta->deflink.ht_cap.mcs.rx_mask[i]; + } else { + pcmd->peer_info.ht_rates[i] = 0; + } + } +- pcmd->peer_info.ht_cap_info = cpu_to_le16(sta->ht_cap.cap); ++ pcmd->peer_info.ht_cap_info = cpu_to_le16(sta->deflink.ht_cap.cap); + pcmd->peer_info.mac_ht_param_info = +- (sta->ht_cap.ampdu_factor & 3) | +- ((sta->ht_cap.ampdu_density & 7) << 2); ++ (sta->deflink.ht_cap.ampdu_factor & 3) | ++ ((sta->deflink.ht_cap.ampdu_density & 7) << 2); + } + +- if (sta->vht_cap.vht_supported) { ++ if (sta->deflink.vht_cap.vht_supported) { + u32 rx_mcs_map_mask = 0; + +- rx_mcs_map_mask = ((0x0000FFFF) >> (sta->rx_nss * 2)) +- << (sta->rx_nss * 2); ++ rx_mcs_map_mask = ((0x0000FFFF) >> (sta->deflink.rx_nss * 2)) ++ << (sta->deflink.rx_nss * 2); + pcmd->peer_info.vht_max_rx_mcs = + cpu_to_le32((*((u32 *) +- &sta->vht_cap.vht_mcs.rx_mcs_map)) | rx_mcs_map_mask); +- pcmd->peer_info.vht_cap = cpu_to_le32(sta->vht_cap.cap); +- pcmd->peer_info.vht_rx_channel_width = sta->bandwidth; ++ &sta->deflink.vht_cap.vht_mcs.rx_mcs_map)) | rx_mcs_map_mask); ++ pcmd->peer_info.vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap); ++ pcmd->peer_info.vht_rx_channel_width = sta->deflink.bandwidth; + } + + pcmd->is_qos_sta = sta->wme; +@@ -2234,38 +2235,38 @@ int mwl_fwcmd_set_new_stn_add_sc4(struct + ether_addr_copy(pcmd->mac_addr, sta->addr); + + if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) +- rates = sta->supp_rates[NL80211_BAND_2GHZ]; ++ rates = sta->deflink.supp_rates[NL80211_BAND_2GHZ]; + else +- rates = sta->supp_rates[NL80211_BAND_5GHZ] << 5; ++ rates = sta->deflink.supp_rates[NL80211_BAND_5GHZ] << 5; + pcmd->peer_info.legacy_rate_bitmap = cpu_to_le32(rates); + +- if (sta->ht_cap.ht_supported) { ++ if (sta->deflink.ht_cap.ht_supported) { + int i; + + for (i = 0; i < 4; i++) { +- if (i < sta->rx_nss) { ++ if (i < sta->deflink.rx_nss) { + pcmd->peer_info.ht_rates[i] = +- sta->ht_cap.mcs.rx_mask[i]; ++ sta->deflink.ht_cap.mcs.rx_mask[i]; + } else { + pcmd->peer_info.ht_rates[i] = 0; + } + } +- pcmd->peer_info.ht_cap_info = cpu_to_le16(sta->ht_cap.cap); ++ pcmd->peer_info.ht_cap_info = cpu_to_le16(sta->deflink.ht_cap.cap); + pcmd->peer_info.mac_ht_param_info = +- (sta->ht_cap.ampdu_factor & 3) | +- ((sta->ht_cap.ampdu_density & 7) << 2); ++ (sta->deflink.ht_cap.ampdu_factor & 3) | ++ ((sta->deflink.ht_cap.ampdu_density & 7) << 2); + } + +- if (sta->vht_cap.vht_supported) { ++ if (sta->deflink.vht_cap.vht_supported) { + u32 rx_mcs_map_mask = 0; + +- rx_mcs_map_mask = ((0x0000FFFF) >> (sta->rx_nss * 2)) +- << (sta->rx_nss * 2); ++ rx_mcs_map_mask = ((0x0000FFFF) >> (sta->deflink.rx_nss * 2)) ++ << (sta->deflink.rx_nss * 2); + pcmd->peer_info.vht_max_rx_mcs = + cpu_to_le32((*((u32 *) +- &sta->vht_cap.vht_mcs.rx_mcs_map)) | rx_mcs_map_mask); +- pcmd->peer_info.vht_cap = cpu_to_le32(sta->vht_cap.cap); +- pcmd->peer_info.vht_rx_channel_width = sta->bandwidth; ++ &sta->deflink.vht_cap.vht_mcs.rx_mcs_map)) | rx_mcs_map_mask); ++ pcmd->peer_info.vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap); ++ pcmd->peer_info.vht_rx_channel_width = sta->deflink.bandwidth; + } + + pcmd->is_qos_sta = sta->wme; +@@ -2782,9 +2783,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 + pcmd->ba_info.create_params.flags = cpu_to_le32(ba_flags); + pcmd->ba_info.create_params.queue_id = stream->idx; + pcmd->ba_info.create_params.param_info = +- (stream->sta->ht_cap.ampdu_factor & ++ (stream->sta->deflink.ht_cap.ampdu_factor & + IEEE80211_HT_AMPDU_PARM_FACTOR) | +- ((stream->sta->ht_cap.ampdu_density << 2) & ++ ((stream->sta->deflink.ht_cap.ampdu_density << 2) & + IEEE80211_HT_AMPDU_PARM_DENSITY); + if (direction == BA_FLAG_DIRECTION_UP) { + pcmd->ba_info.create_params.reset_seq_no = 0; +@@ -2794,9 +2795,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 + pcmd->ba_info.create_params.current_seq = cpu_to_le16(0); + } + if (priv->chip_type == MWL8964 && +- stream->sta->vht_cap.vht_supported) { ++ stream->sta->deflink.vht_cap.vht_supported) { + pcmd->ba_info.create_params.vht_rx_factor = +- cpu_to_le32((stream->sta->vht_cap.cap & ++ cpu_to_le32((stream->sta->deflink.vht_cap.cap & + IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK) >> + IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT); + } +--- a/mac80211.c ++++ b/mac80211.c +@@ -371,15 +371,15 @@ static void mwl_mac80211_bss_info_change + } + } + +- if ((changed & BSS_CHANGED_ASSOC) && vif->bss_conf.assoc) ++ if ((changed & BSS_CHANGED_ASSOC) && vif->cfg.assoc) + mwl_fwcmd_set_aid(hw, vif, (u8 *)vif->bss_conf.bssid, +- vif->bss_conf.aid); ++ vif->cfg.aid); + } + + static void mwl_mac80211_bss_info_changed_ap(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *info, +- u32 changed) ++ u64 changed) + { + struct mwl_priv *priv = hw->priv; + struct mwl_vif *mwl_vif; +@@ -429,8 +429,8 @@ static void mwl_mac80211_bss_info_change + if (changed & (BSS_CHANGED_BEACON_INT | BSS_CHANGED_BEACON)) { + struct sk_buff *skb; + +- if ((info->ssid[0] != '\0') && +- (info->ssid_len != 0) && ++ if ((vif->cfg.ssid[0] != '\0') && ++ (vif->cfg.ssid_len != 0) && + (!info->hidden_ssid)) { + if (mwl_vif->broadcast_ssid != true) { + mwl_fwcmd_broadcast_ssid_enable(hw, vif, true); +@@ -444,7 +444,7 @@ static void mwl_mac80211_bss_info_change + } + + if (!mwl_vif->set_beacon) { +- skb = ieee80211_beacon_get(hw, vif); ++ skb = ieee80211_beacon_get(hw, vif, 0); + + if (skb) { + mwl_fwcmd_set_beacon(hw, vif, skb->data, skb->len); +@@ -461,7 +461,7 @@ static void mwl_mac80211_bss_info_change + static void mwl_mac80211_bss_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *info, +- u32 changed) ++ u64 changed) + { + switch (vif->type) { + case NL80211_IFTYPE_AP: +@@ -583,10 +583,10 @@ static int mwl_mac80211_sta_add(struct i + if (vif->type == NL80211_IFTYPE_MESH_POINT) + sta_info->is_mesh_node = true; + +- if (sta->ht_cap.ht_supported) { ++ if (sta->deflink.ht_cap.ht_supported) { + sta_info->is_ampdu_allowed = true; + sta_info->is_amsdu_allowed = false; +- if (sta->ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) ++ if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) + sta_info->amsdu_ctrl.cap = MWL_AMSDU_SIZE_8K; + else + sta_info->amsdu_ctrl.cap = MWL_AMSDU_SIZE_4K; +@@ -668,7 +668,7 @@ static int mwl_mac80211_sta_remove(struc + + static int mwl_mac80211_conf_tx(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, +- u16 queue, ++ unsigned int link_id, u16 queue, + const struct ieee80211_tx_queue_params *params) + { + struct mwl_priv *priv = hw->priv; +@@ -768,6 +768,7 @@ static int mwl_mac80211_ampdu_action(str + spin_lock_bh(&priv->stream_lock); + break; + } ++ break; + case IEEE80211_AMPDU_RX_STOP: + if (priv->chip_type == MWL8964) { + struct mwl_ampdu_stream tmp; +@@ -930,4 +931,5 @@ const struct ieee80211_ops mwl_mac80211_ + .pre_channel_switch = mwl_mac80211_chnl_switch, + .sw_scan_start = mwl_mac80211_sw_scan_start, + .sw_scan_complete = mwl_mac80211_sw_scan_complete, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, + }; +--- a/utils.c ++++ b/utils.c +@@ -173,9 +173,9 @@ u32 utils_get_init_tx_rate(struct mwl_pr + u32 tx_rate; + u16 format, nss, bw, rate_mcs; + +- if (sta->vht_cap.vht_supported) ++ if (sta->deflink.vht_cap.vht_supported) + format = TX_RATE_FORMAT_11AC; +- else if (sta->ht_cap.ht_supported) ++ else if (sta->deflink.ht_cap.ht_supported) + format = TX_RATE_FORMAT_11N; + else + format = TX_RATE_FORMAT_LEGACY; +@@ -192,11 +192,11 @@ u32 utils_get_init_tx_rate(struct mwl_pr + nss = 3; + break; + default: +- nss = sta->rx_nss; ++ nss = sta->deflink.rx_nss; + break; + } +- if (nss > sta->rx_nss) +- nss = sta->rx_nss; ++ if (nss > sta->deflink.rx_nss) ++ nss = sta->deflink.rx_nss; + + switch (conf->chandef.width) { + case NL80211_CHAN_WIDTH_20_NOHT: +@@ -213,11 +213,11 @@ u32 utils_get_init_tx_rate(struct mwl_pr + bw = TX_RATE_BANDWIDTH_160; + break; + default: +- bw = sta->bandwidth; ++ bw = sta->deflink.bandwidth; + break; + } +- if (bw > sta->bandwidth) +- bw = sta->bandwidth; ++ if (bw > sta->deflink.bandwidth) ++ bw = sta->deflink.bandwidth; + + switch (format) { + case TX_RATE_FORMAT_LEGACY: +--- a/hif/pcie/tx.c ++++ b/hif/pcie/tx.c +@@ -157,7 +157,7 @@ static int pcie_txbd_ring_create(struct + wiphy_info(priv->hw->wiphy, + "TX ring: - base: %p, pbase: 0x%x, len: %d\n", + pcie_priv->txbd_ring_vbase, +- pcie_priv->txbd_ring_pbase, ++ (u32)pcie_priv->txbd_ring_pbase, + pcie_priv->txbd_ring_size); + + for (num = 0; num < PCIE_MAX_TXRX_BD; num++) { +@@ -1153,7 +1153,7 @@ void pcie_tx_xmit(struct ieee80211_hw *h + index = SYSADPT_TX_WMM_QUEUES - index - 1; + txpriority = index; + +- if (sta && sta->ht_cap.ht_supported && !eapol_frame && ++ if (sta && sta->deflink.ht_cap.ht_supported && !eapol_frame && + ieee80211_is_data_qos(wh->frame_control)) { + tid = qos & 0xf; + pcie_tx_count_packet(sta, tid); +--- a/hif/pcie/tx_ndp.c ++++ b/hif/pcie/tx_ndp.c +@@ -602,7 +602,7 @@ void pcie_tx_xmit_ndp(struct ieee80211_h + pcie_tx_encapsulate_frame(priv, skb, k_conf, NULL); + } else { + tid = qos & 0x7; +- if (sta && sta->ht_cap.ht_supported && !eapol_frame && ++ if (sta && sta->deflink.ht_cap.ht_supported && !eapol_frame && + qos != 0xFFFF) { + pcie_tx_count_packet(sta, tid); + spin_lock_bh(&priv->stream_lock); diff --git a/package/kernel/rtl8812au-ct/patches/100-api_update.patch b/package/kernel/rtl8812au-ct/patches/100-api_update.patch new file mode 100644 index 00000000000..2c081256ed7 --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/100-api_update.patch @@ -0,0 +1,56 @@ +--- a/os_dep/linux/ioctl_cfg80211.c ++++ b/os_dep/linux/ioctl_cfg80211.c +@@ -798,8 +798,8 @@ check_bss: + + DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) +- roam_info.channel = notify_channel; +- roam_info.bssid = cur_network->network.MacAddress; ++ roam_info.links[0].channel = notify_channel; ++ roam_info.links[0].bssid = cur_network->network.MacAddress; + roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2; + roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2; + roam_info.resp_ie = pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6; +@@ -1389,6 +1389,7 @@ exit: + + static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ int link_id, + u8 key_index, bool pairwise, const u8 *mac_addr, + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr, +@@ -1529,6 +1530,7 @@ addkey_end: + + static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ int link_id, + u8 key_index, bool pairwise, const u8 *mac_addr, + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr, +@@ -1562,6 +1564,7 @@ static int cfg80211_rtw_get_key(struct w + + static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ int link_id, + u8 key_index, bool pairwise, const u8 *mac_addr) + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr) +@@ -1581,7 +1584,7 @@ static int cfg80211_rtw_del_key(struct w + } + + static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, +- struct net_device *ndev, u8 key_index ++ struct net_device *ndev, int link_id, u8 key_index + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + , bool unicast, bool multicast + #endif +@@ -4019,7 +4022,8 @@ static int cfg80211_rtw_change_beacon(st + return ret; + } + +-static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) ++static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, ++ unsigned int link_id) + { + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + return 0; diff --git a/package/libs/libtracefs/Makefile b/package/libs/libtracefs/Makefile index aa3fdb44f3d..2647f377c3d 100644 --- a/package/libs/libtracefs/Makefile +++ b/package/libs/libtracefs/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libtracefs -PKG_VERSION:=1.6.1 +PKG_VERSION:=1.6.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/snapshot/ -PKG_HASH:=215a5182ee7d5a813ff84d290bb8988aa4c04cc16bb837780f61b0f5bf7494ab +PKG_HASH:=3598ead36660b03cec097bd7e45d900e4c3f7673bba673f5508884477d2d982c PKG_MAINTAINER:=Nick Hainke diff --git a/package/libs/ustream-ssl/Makefile b/package/libs/ustream-ssl/Makefile index 3181f66c7e6..f90a2edb755 100644 --- a/package/libs/ustream-ssl/Makefile +++ b/package/libs/ustream-ssl/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ustream-ssl -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ustream-ssl.git -PKG_SOURCE_DATE:=2022-01-16 -PKG_SOURCE_VERSION:=868fd8812f477c110f9c6c5252c0bd172167b94c -PKG_MIRROR_HASH:=dd28d5e846b391917cf83d66176653bdfa4e8a0d5b11144b65a012fe7693ddeb +PKG_SOURCE_DATE:=2022-12-08 +PKG_SOURCE_VERSION:=9217ab46536353c7c792951b57163063f5ec7a3b +PKG_MIRROR_HASH:=cd4dc6a6c18290348b1f8b1c01df3320e4954dc46d714c797bef066f7a91248d CMAKE_INSTALL:=1 PKG_LICENSE:=ISC diff --git a/package/libs/wolfssl/patches/001-Fix-enable-devcrypto-build-error.patch b/package/libs/wolfssl/patches/001-Fix-enable-devcrypto-build-error.patch new file mode 100644 index 00000000000..bcdaf2b7a2a --- /dev/null +++ b/package/libs/wolfssl/patches/001-Fix-enable-devcrypto-build-error.patch @@ -0,0 +1,33 @@ +From dc9f46a3be00b5e82684a158605189d1278e324c Mon Sep 17 00:00:00 2001 +From: Eric Blankenhorn +Date: Wed, 12 Oct 2022 16:05:17 -0500 +Subject: [PATCH] Fix --enable-devcrypto build error for sys without u_int8_t + type + +--- + wolfcrypt/src/port/devcrypto/README.md | 2 +- + wolfcrypt/src/port/devcrypto/wc_devcrypto.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/wolfcrypt/src/port/devcrypto/README.md ++++ b/wolfcrypt/src/port/devcrypto/README.md +@@ -22,7 +22,7 @@ modprobe cryptodev + For default build with all supported features use: + + ``` +-./configure --enable-cryptodev ++./configure --enable-devcrypto + ``` + + Or for more control over features used: +--- a/wolfcrypt/src/port/devcrypto/wc_devcrypto.c ++++ b/wolfcrypt/src/port/devcrypto/wc_devcrypto.c +@@ -122,7 +122,7 @@ int wc_DevCryptoCreate(WC_CRYPTODEV* ctx + case CRYPTO_SHA2_512_HMAC: + ctx->sess.cipher = 0; + ctx->sess.mac = type; +- ctx->sess.mackey = (u_int8_t*)key; ++ ctx->sess.mackey = (byte*)key; + ctx->sess.mackeylen = keySz; + break; + diff --git a/package/network/config/firewall4/Makefile b/package/network/config/firewall4/Makefile index 47c2cc5bf37..bec03b62d43 100644 --- a/package/network/config/firewall4/Makefile +++ b/package/network/config/firewall4/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git -PKG_SOURCE_DATE:=2022-10-18 -PKG_SOURCE_VERSION:=7ae5e14bbd7265cc67ec870c3bb0c8e197bb7ca9 -PKG_MIRROR_HASH:=ce190e526df915df65b40aa24fadf2a1b5badc57ab4e564d5f44575b11d18e26 +PKG_SOURCE_DATE:=2022-11-29 +PKG_SOURCE_VERSION:=700a925fd9c1f1ff404e6b125cd5347ad7c45668 +PKG_MIRROR_HASH:=18fb7a27399bf2e9e094a4cbacd4e859448c1c9194b6da4a78c9f37a642d1703 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 79daa915ada..55cc766b58c 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -1322,7 +1322,7 @@ wpa_supplicant_add_network() { } [ "$_w_mode" = "mesh" ] && { - json_get_vars mesh_id mesh_fwding mesh_rssi_threshold + json_get_vars mesh_id mesh_fwding mesh_rssi_threshold encryption [ -n "$mesh_id" ] && ssid="${mesh_id}" append network_data "mode=5" "$N$T" @@ -1330,7 +1330,7 @@ wpa_supplicant_add_network() { [ -n "$mesh_rssi_threshold" ] && append network_data "mesh_rssi_threshold=${mesh_rssi_threshold}" "$N$T" [ -n "$freq" ] && wpa_supplicant_set_fixed_freq "$freq" "$htmode" [ "$noscan" = "1" ] && append network_data "noscan=1" "$N$T" - append wpa_key_mgmt "SAE" + [ "$encryption" = "none" -o -z "$encryption" ] || append wpa_key_mgmt "SAE" scan_ssid="" } diff --git a/package/network/services/hostapd/src/src/utils/build_features.h b/package/network/services/hostapd/src/src/utils/build_features.h index 642a35836e4..138a799e75b 100644 --- a/package/network/services/hostapd/src/src/utils/build_features.h +++ b/package/network/services/hostapd/src/src/utils/build_features.h @@ -58,6 +58,10 @@ static inline int has_feature(const char *feat) #ifdef CONFIG_OCV if (!strcmp(feat, "ocv")) return 1; +#endif +#ifdef CONFIG_MESH + if (!strcmp(feat, "mesh")) + return 1; #endif return 0; } diff --git a/package/network/utils/comgt/files/ncm.json b/package/network/utils/comgt/files/ncm.json index b6ad7175291..7d9a38fe36d 100644 --- a/package/network/utils/comgt/files/ncm.json +++ b/package/network/utils/comgt/files/ncm.json @@ -75,6 +75,22 @@ "finalize": "AT+CGDATA=\\\"M-MBIM\\\",${profile},1", "disconnect": "AT+CGACT=0,${profile}" }, + "quectel": { + "initialize": [ + "AT+CFUN=1" + ], + "configure": [ + "at+qicsgp=${profile},${context_type},\\\"${apn}\\\",\\\"${username}\\\",\\\"${password}\\\",0" + ], + "modes": { + "lte": "AT+QCFG=\\\"nwscanmode\\\",3", + "umts": "AT+QCFG=\\\"nwscanmode\\\",2", + "gsm": "AT+QCFG=\\\"nwscanmode\\\",1", + "auto": "AT+QCFG=\\\"nwscanmode\\\",0" + }, + "connect": "AT+qnetdevctl=1,${profile},1", + "disconnect": "AT+qnetdevctl=0,${profile},0" + }, "\"zte": { "initialize": [ "AT+CFUN=1" diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh index a2c913ea1d6..2f366974876 100644 --- a/package/network/utils/comgt/files/ncm.sh +++ b/package/network/utils/comgt/files/ncm.sh @@ -31,6 +31,8 @@ proto_ncm_setup() { local device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS json_get_vars device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS + local context_type + [ "$metric" = "" ] && metric="0" [ -n "$profile" ] || profile=1 @@ -38,6 +40,10 @@ proto_ncm_setup() { pdptype=$(echo "$pdptype" | awk '{print toupper($0)}') [ "$pdptype" = "IP" -o "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] || pdptype="IP" + [ "$pdptype" = "IPV4V6" ] && context_type=3 + [ -z "$context_type" -a "$pdptype" = "IPV6" ] && context_type=2 + [ -n "$context_type" ] || context_type=1 + [ -n "$ctl_device" ] && device=$ctl_device [ -n "$device" ] || { diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch index 49d08d9b01a..afe27d6f238 100644 --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch @@ -1,554 +1,259 @@ --- a/nl80211.h +++ b/nl80211.h -@@ -11,7 +11,7 @@ - * Copyright 2008 Jouni Malinen - * Copyright 2008 Colin McCabe - * Copyright 2015-2017 Intel Deutschland GmbH -- * Copyright (C) 2018-2022 Intel Corporation -+ * Copyright (C) 2018-2021 Intel Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above -@@ -301,29 +301,6 @@ +@@ -324,6 +324,17 @@ */ /** -- * DOC: FILS shared key crypto offload -- * -- * This feature is applicable to drivers running in AP mode. -- * -- * FILS shared key crypto offload can be advertised by drivers by setting -- * @NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD flag. The drivers that support -- * FILS shared key crypto offload should be able to encrypt and decrypt -- * association frames for FILS shared key authentication as per IEEE 802.11ai. -- * With this capability, for FILS key derivation, drivers depend on userspace. -- * -- * After FILS key derivation, userspace shares the FILS AAD details with the -- * driver and the driver stores the same to use in decryption of association -- * request and in encryption of association response. The below parameters -- * should be given to the driver in %NL80211_CMD_SET_FILS_AAD. -- * %NL80211_ATTR_MAC - STA MAC address, used for storing FILS AAD per STA -- * %NL80211_ATTR_FILS_KEK - Used for encryption or decryption -- * %NL80211_ATTR_FILS_NONCES - Used for encryption or decryption -- * (STA Nonce 16 bytes followed by AP Nonce 16 bytes) -- * -- * Once the association is done, the driver cleans the FILS AAD data. -- */ -- --/** ++ * DOC: Multi-Link Operation ++ * ++ * In Multi-Link Operation, a connection between to MLDs utilizes multiple ++ * links. To use this in nl80211, various commands and responses now need ++ * to or will include the new %NL80211_ATTR_MLO_LINKS attribute. ++ * Additionally, various commands that need to operate on a specific link ++ * now need to be given the %NL80211_ATTR_MLO_LINK_ID attribute, e.g. to ++ * use %NL80211_CMD_START_AP or similar functions. ++ */ ++ ++/** * enum nl80211_commands - supported nl80211 commands * * @NL80211_CMD_UNSPEC: unspecified command to catch errors -@@ -1226,17 +1203,6 @@ - * @NL80211_CMD_COLOR_CHANGE_COMPLETED: Notify userland that the color change - * has completed +@@ -366,14 +377,22 @@ + * the non-transmitting interfaces are deleted as well. * -- * @NL80211_CMD_SET_FILS_AAD: Set FILS AAD data to the driver using - -- * &NL80211_ATTR_MAC - for STA MAC address -- * &NL80211_ATTR_FILS_KEK - for KEK -- * &NL80211_ATTR_FILS_NONCES - for FILS Nonces -- * (STA Nonce 16 bytes followed by AP Nonce 16 bytes) -- * -- * @NL80211_CMD_ASSOC_COMEBACK: notification about an association -- * temporal rejection with comeback. The event includes %NL80211_ATTR_MAC -- * to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to -- * specify the timeout value. -- * + * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified +- * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. ++ * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC ++ * represents peer's MLD address for MLO pairwise key. For MLO group key, ++ * the link is identified by %NL80211_ATTR_MLO_LINK_ID. + * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, + * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. ++ * For MLO connection, the link to set default key is identified by ++ * %NL80211_ATTR_MLO_LINK_ID. + * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, + * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER, +- * and %NL80211_ATTR_KEY_SEQ attributes. ++ * and %NL80211_ATTR_KEY_SEQ attributes. %NL80211_ATTR_MAC represents ++ * peer's MLD address for MLO pairwise key. The link to add MLO ++ * group key is identified by %NL80211_ATTR_MLO_LINK_ID. + * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX +- * or %NL80211_ATTR_MAC. ++ * or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC represents peer's MLD address ++ * for MLO pairwise key. The link to delete group key is identified by ++ * %NL80211_ATTR_MLO_LINK_ID. + * + * @NL80211_CMD_GET_BEACON: (not used) + * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface +@@ -753,6 +772,13 @@ + * %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA + * counters which will be updated to the current value. This attribute + * is used during CSA period. ++ * For TX on an MLD, the frequency can be omitted and the link ID be ++ * specified, or if transmitting to a known peer MLD (with MLD addresses ++ * in the frame) both can be omitted and the link will be selected by ++ * lower layers. ++ * For RX notification, %NL80211_ATTR_RX_HW_TIMESTAMP may be included to ++ * indicate the frame RX timestamp and %NL80211_ATTR_TX_HW_TIMESTAMP may ++ * be included to indicate the ack TX timestamp. + * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this + * command may be used with the corresponding cookie to cancel the wait + * time if it is known that it is no longer necessary. This command is +@@ -763,7 +789,9 @@ + * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies + * the TX command and %NL80211_ATTR_FRAME includes the contents of the + * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged +- * the frame. ++ * the frame. %NL80211_ATTR_TX_HW_TIMESTAMP may be included to indicate the ++ * tx timestamp and %NL80211_ATTR_RX_HW_TIMESTAMP may be included to ++ * indicate the ack RX timestamp. + * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for + * backward compatibility. + * +@@ -1108,6 +1136,12 @@ + * has been received. %NL80211_ATTR_FRAME is used to specify the + * frame contents. The frame is the raw EAPoL data, without ethernet or + * 802.11 headers. ++ * For an MLD transmitter, the %NL80211_ATTR_MLO_LINK_ID may be given and ++ * its effect will depend on the destination: If the destination is known ++ * to be an MLD, this will be used as a hint to select the link to transmit ++ * the frame on. If the destination is not an MLD, this will select both ++ * the link to transmit on and the source address will be set to the link ++ * address of that link. + * When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, + * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added + * indicating the protocol type of the received frame; whether the frame +@@ -1237,6 +1271,16 @@ + * to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to + * specify the timeout value. + * ++ * @NL80211_CMD_ADD_LINK: Add a new link to an interface. The ++ * %NL80211_ATTR_MLO_LINK_ID attribute is used for the new link. ++ * @NL80211_CMD_REMOVE_LINK: Remove a link from an interface. This may come ++ * without %NL80211_ATTR_MLO_LINK_ID as an easy way to remove all links ++ * in preparation for e.g. roaming to a regular (non-MLO) AP. ++ * ++ * @NL80211_CMD_ADD_LINK_STA: Add a link to an MLD station ++ * @NL80211_CMD_MODIFY_LINK_STA: Modify a link of an MLD station ++ * @NL80211_CMD_REMOVE_LINK_STA: Remove a link of an MLD station ++ * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ -@@ -1477,10 +1443,6 @@ enum nl80211_commands { - NL80211_CMD_COLOR_CHANGE_ABORTED, - NL80211_CMD_COLOR_CHANGE_COMPLETED, +@@ -1481,6 +1525,13 @@ enum nl80211_commands { -- NL80211_CMD_SET_FILS_AAD, -- -- NL80211_CMD_ASSOC_COMEBACK, -- + NL80211_CMD_ASSOC_COMEBACK, + ++ NL80211_CMD_ADD_LINK, ++ NL80211_CMD_REMOVE_LINK, ++ ++ NL80211_CMD_ADD_LINK_STA, ++ NL80211_CMD_MODIFY_LINK_STA, ++ NL80211_CMD_REMOVE_LINK_STA, ++ /* add new commands above here */ /* used to define NL80211_CMD_MAX below */ -@@ -2477,9 +2439,7 @@ enum nl80211_commands { - * space supports external authentication. This attribute shall be used - * with %NL80211_CMD_CONNECT and %NL80211_CMD_START_AP request. The driver - * may offload authentication processing to user space if this capability -- * is indicated in the respective requests from the user space. (This flag -- * attribute deprecated for %NL80211_CMD_START_AP, use -- * %NL80211_ATTR_AP_SETTINGS_FLAGS) -+ * is indicated in the respective requests from the user space. +@@ -2340,8 +2391,10 @@ enum nl80211_commands { * - * @NL80211_ATTR_NSS: Station's New/updated RX_NSS value notified using this - * u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED. -@@ -2655,13 +2615,8 @@ enum nl80211_commands { - * switching on a different channel during CAC detection on the selected - * radar channel. + * @NL80211_ATTR_IFTYPE_EXT_CAPA: Nested attribute of the following attributes: + * %NL80211_ATTR_IFTYPE, %NL80211_ATTR_EXT_CAPA, +- * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per +- * interface type. ++ * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities and ++ * other interface-type specific capabilities per interface type. For MLO, ++ * %NL80211_ATTR_EML_CAPABILITY and %NL80211_ATTR_MLD_CAPA_AND_OPS are ++ * present. * -- * @NL80211_ATTR_AP_SETTINGS_FLAGS: u32 attribute contains ap settings flags, -- * enumerated in &enum nl80211_ap_settings_flags. This attribute shall be -- * used with %NL80211_CMD_START_AP request. -- * -- * @NL80211_ATTR_EHT_CAPABILITY: EHT Capability information element (from -- * association request when used with NL80211_CMD_NEW_STATION). Can be set -- * only if %NL80211_STA_FLAG_WME is set. + * @NL80211_ATTR_MU_MIMO_GROUP_DATA: array of 24 bytes that defines a MU-MIMO + * groupID for monitor mode. +@@ -2663,6 +2716,44 @@ enum nl80211_commands { + * association request when used with NL80211_CMD_NEW_STATION). Can be set + * only if %NL80211_STA_FLAG_WME is set. + * ++ * @NL80211_ATTR_MLO_LINK_ID: A (u8) link ID for use with MLO, to be used with ++ * various commands that need a link ID to operate. ++ * @NL80211_ATTR_MLO_LINKS: A nested array of links, each containing some ++ * per-link information and a link ID. ++ * @NL80211_ATTR_MLD_ADDR: An MLD address, used with various commands such as ++ * authenticate/associate. ++ * ++ * @NL80211_ATTR_MLO_SUPPORT: Flag attribute to indicate user space supports MLO ++ * connection. Used with %NL80211_CMD_CONNECT. If this attribute is not ++ * included in NL80211_CMD_CONNECT drivers must not perform MLO connection. ++ * ++ * @NL80211_ATTR_MAX_NUM_AKM_SUITES: U16 attribute. Indicates maximum number of ++ * AKM suites allowed for %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and ++ * %NL80211_CMD_START_AP in %NL80211_CMD_GET_WIPHY response. If this ++ * attribute is not present userspace shall consider maximum number of AKM ++ * suites allowed as %NL80211_MAX_NR_AKM_SUITES which is the legacy maximum ++ * number prior to the introduction of this attribute. ++ * ++ * @NL80211_ATTR_EML_CAPABILITY: EML Capability information (u16) ++ * @NL80211_ATTR_MLD_CAPA_AND_OPS: MLD Capabilities and Operations (u16) ++ * ++ * @NL80211_ATTR_TX_HW_TIMESTAMP: Hardware timestamp for TX operation in ++ * nanoseconds (u64). This is the device clock timestamp so it will ++ * probably reset when the device is stopped or the firmware is reset. ++ * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the frame TX ++ * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates ++ * the ack TX timestamp. ++ * @NL80211_ATTR_RX_HW_TIMESTAMP: Hardware timestamp for RX operation in ++ * nanoseconds (u64). This is the device clock timestamp so it will ++ * probably reset when the device is stopped or the firmware is reset. ++ * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX ++ * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates ++ * the incoming frame RX timestamp. ++ * @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent ++ * (re)associations. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. - * ++ * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined -@@ -3171,11 +3126,7 @@ enum nl80211_attrs { + * @__NL80211_ATTR_AFTER_LAST: internal use +@@ -3177,6 +3268,23 @@ enum nl80211_attrs { - NL80211_ATTR_RADAR_BACKGROUND, + NL80211_ATTR_DISABLE_EHT, -- NL80211_ATTR_AP_SETTINGS_FLAGS, -- -- NL80211_ATTR_EHT_CAPABILITY, -- -- NL80211_ATTR_DISABLE_EHT, ++ NL80211_ATTR_MLO_LINKS, ++ NL80211_ATTR_MLO_LINK_ID, ++ NL80211_ATTR_MLD_ADDR, ++ ++ NL80211_ATTR_MLO_SUPPORT, ++ ++ NL80211_ATTR_MAX_NUM_AKM_SUITES, ++ ++ NL80211_ATTR_EML_CAPABILITY, ++ NL80211_ATTR_MLD_CAPA_AND_OPS, ++ ++ NL80211_ATTR_TX_HW_TIMESTAMP, ++ NL80211_ATTR_RX_HW_TIMESTAMP, ++ NL80211_ATTR_TD_BITMAP, ++ + NL80211_ATTR_WIPHY_ANTENNA_GAIN, - ++ /* add attributes here, update the policy in nl80211.c */ -@@ -3232,8 +3183,6 @@ enum nl80211_attrs { + __NL80211_ATTR_AFTER_LAST, +@@ -3231,6 +3339,11 @@ enum nl80211_attrs { + #define NL80211_HE_MIN_CAPABILITY_LEN 16 #define NL80211_HE_MAX_CAPABILITY_LEN 54 #define NL80211_MAX_NR_CIPHER_SUITES 5 - #define NL80211_MAX_NR_AKM_SUITES 2 --#define NL80211_EHT_MIN_CAPABILITY_LEN 13 --#define NL80211_EHT_MAX_CAPABILITY_LEN 51 - - #define NL80211_MIN_REMAIN_ON_CHANNEL_TIME 10 - -@@ -3261,7 +3210,7 @@ enum nl80211_attrs { - * and therefore can't be created in the normal ways, use the - * %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE - * commands to create and destroy one -- * @NL80211_IFTYPE_OCB: Outside Context of a BSS -+ * @NL80211_IF_TYPE_OCB: Outside Context of a BSS - * This mode corresponds to the MIB variable dot11OCBActivated=true - * @NL80211_IFTYPE_NAN: NAN device interface type (not a netdev) - * @NL80211_IFTYPE_MAX: highest interface type number currently defined -@@ -3403,56 +3352,6 @@ enum nl80211_he_ru_alloc { - }; - - /** -- * enum nl80211_eht_gi - EHT guard interval -- * @NL80211_RATE_INFO_EHT_GI_0_8: 0.8 usec -- * @NL80211_RATE_INFO_EHT_GI_1_6: 1.6 usec -- * @NL80211_RATE_INFO_EHT_GI_3_2: 3.2 usec -- */ --enum nl80211_eht_gi { -- NL80211_RATE_INFO_EHT_GI_0_8, -- NL80211_RATE_INFO_EHT_GI_1_6, -- NL80211_RATE_INFO_EHT_GI_3_2, --}; -- --/** -- * enum nl80211_eht_ru_alloc - EHT RU allocation values -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_26: 26-tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_52: 52-tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_52P26: 52+26-tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_106: 106-tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_106P26: 106+26 tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_242: 242-tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_484: 484-tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_484P242: 484+242 tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_996: 996-tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_996P484: 996+484 tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_996P484P242: 996+484+242 tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_2x996: 2x996-tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_2x996P484: 2x996+484 tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_3x996: 3x996-tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_3x996P484: 3x996+484 tone RU allocation -- * @NL80211_RATE_INFO_EHT_RU_ALLOC_4x996: 4x996-tone RU allocation -- */ --enum nl80211_eht_ru_alloc { -- NL80211_RATE_INFO_EHT_RU_ALLOC_26, -- NL80211_RATE_INFO_EHT_RU_ALLOC_52, -- NL80211_RATE_INFO_EHT_RU_ALLOC_52P26, -- NL80211_RATE_INFO_EHT_RU_ALLOC_106, -- NL80211_RATE_INFO_EHT_RU_ALLOC_106P26, -- NL80211_RATE_INFO_EHT_RU_ALLOC_242, -- NL80211_RATE_INFO_EHT_RU_ALLOC_484, -- NL80211_RATE_INFO_EHT_RU_ALLOC_484P242, -- NL80211_RATE_INFO_EHT_RU_ALLOC_996, -- NL80211_RATE_INFO_EHT_RU_ALLOC_996P484, -- NL80211_RATE_INFO_EHT_RU_ALLOC_996P484P242, -- NL80211_RATE_INFO_EHT_RU_ALLOC_2x996, -- NL80211_RATE_INFO_EHT_RU_ALLOC_2x996P484, -- NL80211_RATE_INFO_EHT_RU_ALLOC_3x996, -- NL80211_RATE_INFO_EHT_RU_ALLOC_3x996P484, -- NL80211_RATE_INFO_EHT_RU_ALLOC_4x996, --}; -- --/** - * enum nl80211_rate_info - bitrate information - * - * These attribute types are used with %NL80211_STA_INFO_TXRATE -@@ -3491,13 +3390,6 @@ enum nl80211_eht_ru_alloc { - * @NL80211_RATE_INFO_HE_DCM: HE DCM value (u8, 0/1) - * @NL80211_RATE_INFO_RU_ALLOC: HE RU allocation, if not present then - * non-OFDMA was used (u8, see &enum nl80211_he_ru_alloc) -- * @NL80211_RATE_INFO_320_MHZ_WIDTH: 320 MHz bitrate -- * @NL80211_RATE_INFO_EHT_MCS: EHT MCS index (u8, 0-15) -- * @NL80211_RATE_INFO_EHT_NSS: EHT NSS value (u8, 1-8) -- * @NL80211_RATE_INFO_EHT_GI: EHT guard interval identifier -- * (u8, see &enum nl80211_eht_gi) -- * @NL80211_RATE_INFO_EHT_RU_ALLOC: EHT RU allocation, if not present then -- * non-OFDMA was used (u8, see &enum nl80211_eht_ru_alloc) - * @__NL80211_RATE_INFO_AFTER_LAST: internal use - */ - enum nl80211_rate_info { -@@ -3519,11 +3411,6 @@ enum nl80211_rate_info { - NL80211_RATE_INFO_HE_GI, - NL80211_RATE_INFO_HE_DCM, - NL80211_RATE_INFO_HE_RU_ALLOC, -- NL80211_RATE_INFO_320_MHZ_WIDTH, -- NL80211_RATE_INFO_EHT_MCS, -- NL80211_RATE_INFO_EHT_NSS, -- NL80211_RATE_INFO_EHT_GI, -- NL80211_RATE_INFO_EHT_RU_ALLOC, - - /* keep last */ - __NL80211_RATE_INFO_AFTER_LAST, -@@ -3834,20 +3721,13 @@ enum nl80211_mpath_info { - * capabilities IE - * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE: HE PPE thresholds information as - * defined in HE capabilities IE -+ * @NL80211_BAND_IFTYPE_ATTR_MAX: highest band HE capability attribute currently -+ * defined - * @NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA: HE 6GHz band capabilities (__le16), - * given for all 6 GHz band channels - * @NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS: vendor element capabilities that are - * advertised on this band/for this iftype (binary) -- * @NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC: EHT MAC capabilities as in EHT -- * capabilities element -- * @NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY: EHT PHY capabilities as in EHT -- * capabilities element -- * @NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET: EHT supported NSS/MCS as in EHT -- * capabilities element -- * @NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE: EHT PPE thresholds information as -- * defined in EHT capabilities element - * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use -- * @NL80211_BAND_IFTYPE_ATTR_MAX: highest band attribute currently defined - */ - enum nl80211_band_iftype_attr { - __NL80211_BAND_IFTYPE_ATTR_INVALID, -@@ -3859,10 +3739,6 @@ enum nl80211_band_iftype_attr { - NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE, - NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA, - NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS, -- NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC, -- NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY, -- NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET, -- NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE, - - /* keep last */ - __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST, -@@ -4007,10 +3883,6 @@ enum nl80211_wmm_rule { - * on this channel in current regulatory domain. - * @NL80211_FREQUENCY_ATTR_16MHZ: 16 MHz operation is allowed - * on this channel in current regulatory domain. -- * @NL80211_FREQUENCY_ATTR_NO_320MHZ: any 320 MHz channel using this channel -- * as the primary or any of the secondary channels isn't possible -- * @NL80211_FREQUENCY_ATTR_NO_EHT: EHT operation is not allowed on this channel -- * in current regulatory domain. - * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number - * currently defined - * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use -@@ -4047,8 +3919,6 @@ enum nl80211_frequency_attr { - NL80211_FREQUENCY_ATTR_4MHZ, - NL80211_FREQUENCY_ATTR_8MHZ, - NL80211_FREQUENCY_ATTR_16MHZ, -- NL80211_FREQUENCY_ATTR_NO_320MHZ, -- NL80211_FREQUENCY_ATTR_NO_EHT, - - /* keep last */ - __NL80211_FREQUENCY_ATTR_AFTER_LAST, -@@ -4247,7 +4117,6 @@ enum nl80211_sched_scan_match_attr { - * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed - * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed - * @NL80211_RRF_NO_HE: HE operation not allowed -- * @NL80211_RRF_NO_320MHZ: 320MHz operation not allowed - */ - enum nl80211_reg_rule_flags { - NL80211_RRF_NO_OFDM = 1<<0, -@@ -4266,7 +4135,6 @@ enum nl80211_reg_rule_flags { - NL80211_RRF_NO_80MHZ = 1<<15, - NL80211_RRF_NO_160MHZ = 1<<16, - NL80211_RRF_NO_HE = 1<<17, -- NL80211_RRF_NO_320MHZ = 1<<18, - }; - - #define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR -@@ -4764,8 +4632,6 @@ enum nl80211_key_mode { - * @NL80211_CHAN_WIDTH_4: 4 MHz OFDM channel - * @NL80211_CHAN_WIDTH_8: 8 MHz OFDM channel - * @NL80211_CHAN_WIDTH_16: 16 MHz OFDM channel -- * @NL80211_CHAN_WIDTH_320: 320 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 -- * attribute must be provided as well - */ - enum nl80211_chan_width { - NL80211_CHAN_WIDTH_20_NOHT, -@@ -4781,7 +4647,6 @@ enum nl80211_chan_width { - NL80211_CHAN_WIDTH_4, - NL80211_CHAN_WIDTH_8, - NL80211_CHAN_WIDTH_16, -- NL80211_CHAN_WIDTH_320, - }; - - /** -@@ -5096,7 +4961,6 @@ enum nl80211_txrate_gi { - * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 69.12 GHz) - * @NL80211_BAND_6GHZ: around 6 GHz band (5.9 - 7.2 GHz) - * @NL80211_BAND_S1GHZ: around 900MHz, supported by S1G PHYs -- * @NL80211_BAND_LC: light communication band (placeholder) - * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace - * since newer kernel versions may support more bands - */ -@@ -5106,7 +4970,6 @@ enum nl80211_band { - NL80211_BAND_60GHZ, - NL80211_BAND_6GHZ, - NL80211_BAND_S1GHZ, -- NL80211_BAND_LC, - - NUM_NL80211_BANDS, - }; -@@ -5673,7 +5536,7 @@ enum nl80211_iface_limit_attrs { - * => allows 8 of AP/GO that can have BI gcd >= min gcd - * - * numbers = [ #{STA} <= 2 ], channels = 2, max = 2 -- * => allows two STAs on the same or on different channels -+ * => allows two STAs on different channels - * - * numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4 - * => allows a STA plus three P2P interfaces -@@ -5718,7 +5581,7 @@ enum nl80211_if_combination_attrs { - * @NL80211_PLINK_ESTAB: mesh peer link is established - * @NL80211_PLINK_HOLDING: mesh peer link is being closed or cancelled - * @NL80211_PLINK_BLOCKED: all frames transmitted from this mesh -- * plink are discarded, except for authentication frames -+ * plink are discarded - * @NUM_NL80211_PLINK_STATES: number of peer link states - * @MAX_NL80211_PLINK_STATES: highest numerical value of plink states - */ -@@ -5855,15 +5718,13 @@ enum nl80211_tdls_operation { - NL80211_TDLS_DISABLE_LINK, - }; - --/** ++ +/* - * enum nl80211_ap_sme_features - device-integrated AP features -- * @NL80211_AP_SME_SA_QUERY_OFFLOAD: SA Query procedures offloaded to driver -- * when user space indicates support for SA Query procedures offload during -- * "start ap" with %NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT. -- */ -+ * Reserved for future use, no bits are defined in -+ * NL80211_ATTR_DEVICE_AP_SME yet. - enum nl80211_ap_sme_features { -- NL80211_AP_SME_SA_QUERY_OFFLOAD = 1 << 0, - }; ++ * NL80211_MAX_NR_AKM_SUITES is obsolete when %NL80211_ATTR_MAX_NUM_AKM_SUITES ++ * present in %NL80211_CMD_GET_WIPHY response. + */ + #define NL80211_MAX_NR_AKM_SUITES 2 + #define NL80211_EHT_MIN_CAPABILITY_LEN 13 + #define NL80211_EHT_MAX_CAPABILITY_LEN 51 +@@ -4853,6 +4966,8 @@ enum nl80211_bss_scan_width { + * Contains a nested array of signal strength attributes (u8, dBm), + * using the nesting index as the antenna number. + * @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz ++ * @NL80211_BSS_MLO_LINK_ID: MLO link ID of the BSS (u8). ++ * @NL80211_BSS_MLD_ADDR: MLD address of this BSS if connected to it. + * @__NL80211_BSS_AFTER_LAST: internal + * @NL80211_BSS_MAX: highest BSS attribute + */ +@@ -4878,6 +4993,8 @@ enum nl80211_bss { + NL80211_BSS_PARENT_BSSID, + NL80211_BSS_CHAIN_SIGNAL, + NL80211_BSS_FREQUENCY_OFFSET, ++ NL80211_BSS_MLO_LINK_ID, ++ NL80211_BSS_MLD_ADDR, - /** - * enum nl80211_feature_flags - device/driver features -@@ -6166,11 +6027,6 @@ enum nl80211_feature_flags { - * @NL80211_EXT_FEATURE_BSS_COLOR: The driver supports BSS color collision - * detection and change announcemnts. - * -- * @NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD: Driver running in AP mode supports -- * FILS encryption and decryption for (Re)Association Request and Response -- * frames. Userspace has to share FILS AAD details to the driver by using -- * @NL80211_CMD_SET_FILS_AAD. -- * + /* keep last */ + __NL80211_BSS_AFTER_LAST, +@@ -5874,7 +5991,7 @@ enum nl80211_ap_sme_features { + * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up + * the connected inactive stations in AP mode. + * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested +- * to work properly to suppport receiving regulatory hints from ++ * to work properly to support receiving regulatory hints from + * cellular base stations. + * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: (no longer available, only + * here to reserve the value for API/ABI compatibility) +@@ -6174,6 +6291,14 @@ enum nl80211_feature_flags { * @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC * detection. * -@@ -6239,7 +6095,6 @@ enum nl80211_ext_feature_index { - NL80211_EXT_FEATURE_SECURE_RTT, - NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, ++ * @NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE: Device can perform a MAC address ++ * change without having to bring the underlying network device down ++ * first. For example, in station mode this can be used to vary the ++ * origin MAC address prior to a connection to a new AP for privacy ++ * or other reasons. Note that certain driver specific restrictions ++ * might apply, e.g. no scans in progress, no offchannel operations ++ * in progress, and no active connections. ++ * + * @NUM_NL80211_EXT_FEATURES: number of extended features. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index. + */ +@@ -6241,6 +6366,7 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_BSS_COLOR, -- NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD, + NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD, NL80211_EXT_FEATURE_RADAR_BACKGROUND, ++ NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE, /* add new features before the definition below */ -@@ -7548,7 +7403,7 @@ enum nl80211_sar_specs_attrs { - * @NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY: Used by the kernel - * to advertise the maximum profile periodicity supported by the driver - * if EMA is enabled. Driver should indicate EMA support to the userspace -- * by setting wiphy->ema_max_profile_periodicity to -+ * by setting wiphy->mbssid_max_ema_profile_periodicity to - * a non-zero value. - * - * @NL80211_MBSSID_CONFIG_ATTR_INDEX: Mandatory parameter to pass the index of -@@ -7567,7 +7422,7 @@ enum nl80211_sar_specs_attrs { - * - * @NL80211_MBSSID_CONFIG_ATTR_EMA: Flag used to enable EMA AP feature. - * Setting this flag is permitted only if the driver advertises EMA support -- * by setting wiphy->ema_max_profile_periodicity to non-zero. -+ * by setting wiphy->mbssid_max_ema_profile_periodicity to non-zero. - * - * @__NL80211_MBSSID_CONFIG_ATTR_LAST: Internal - * @NL80211_MBSSID_CONFIG_ATTR_MAX: highest attribute -@@ -7586,20 +7441,4 @@ enum nl80211_mbssid_config_attributes { - NL80211_MBSSID_CONFIG_ATTR_MAX = __NL80211_MBSSID_CONFIG_ATTR_LAST - 1, - }; - --/** -- * enum nl80211_ap_settings_flags - AP settings flags -- * -- * @NL80211_AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external -- * authentication. -- * @NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT: Userspace supports SA Query -- * procedures offload to driver. If driver advertises -- * %NL80211_AP_SME_SA_QUERY_OFFLOAD in AP SME features, userspace shall -- * ignore SA Query procedures and validations when this flag is set by -- * userspace. -- */ --enum nl80211_ap_settings_flags { -- NL80211_AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = 1 << 0, -- NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT = 1 << 1, --}; -- - #endif /* __LINUX_NL80211_H */ ---- a/event.c -+++ b/event.c -@@ -1292,9 +1292,6 @@ static int print_event(struct nl_msg *ms - case NL80211_CMD_CH_SWITCH_NOTIFY: - parse_ch_switch_notify(tb, gnlh->cmd); - break; -- case NL80211_CMD_ASSOC_COMEBACK: /* 147 */ -- parse_assoc_comeback(tb, gnlh->cmd); -- break; - default: - printf("unknown event %d (%s)\n", - gnlh->cmd, command_name(gnlh->cmd)); ---- a/info.c -+++ b/info.c -@@ -164,7 +164,6 @@ static void ext_feat_print(enum nl80211_ - ext_feat_case(PROT_RANGE_NEGO_AND_MEASURE, - "support for MFP in range measurement negotiation/procedure"); - ext_feat_case(BSS_COLOR, "BSS coloring support"); -- ext_feat_case(FILS_CRYPTO_OFFLOAD, "FILS crypto offload"); - ext_feat_case(RADAR_BACKGROUND, "Radar background support"); - } - } ---- a/interface.c -+++ b/interface.c -@@ -362,8 +362,6 @@ char *channel_width_name(enum nl80211_ch - return "5 MHz"; - case NL80211_CHAN_WIDTH_10: - return "10 MHz"; -- case NL80211_CHAN_WIDTH_320: -- return "320 MHz"; - default: - return "unknown"; - } ---- a/util.c -+++ b/util.c -@@ -508,7 +508,6 @@ static int parse_freqs(struct chandef *c - case NL80211_CHAN_WIDTH_40: - case NL80211_CHAN_WIDTH_80: - case NL80211_CHAN_WIDTH_160: -- case NL80211_CHAN_WIDTH_320: - need_cf1 = true; - break; - case NL80211_CHAN_WIDTH_1: -@@ -626,10 +625,6 @@ int parse_freqchan(struct chandef *chand - .width = NL80211_CHAN_WIDTH_160, - .freq1_diff = 0, - .chantype = -1 }, -- { .name = "320MHz", -- .width = NL80211_CHAN_WIDTH_320, -- .freq1_diff = 0, -- .chantype = -1 }, - }; - const struct chanmode *chanmode_selected = NULL; - unsigned int freq; -@@ -1599,48 +1594,6 @@ void print_eht_info(struct nlattr *nl_if - print_iftype_line(tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES]); - printf("\n"); - -- if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC]) { -- len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC]); -- if (len > sizeof(mac_cap)) -- len = sizeof(mac_cap); -- memcpy(mac_cap, -- nla_data(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC]), -- len); -- } -- -- if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY]) { -- len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY]); -- -- if (len > sizeof(phy_cap)) -- len = sizeof(phy_cap); -- -- memcpy(phy_cap, -- nla_data(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY]), -- len); -- } -- -- if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET]) { -- len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET]); -- if (len > sizeof(mcs_set)) -- len = sizeof(mcs_set); -- memcpy(mcs_set, -- nla_data(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET]), -- len); -- -- // Assume that all parts of the MCS set are present -- mcs_len = sizeof(mcs_set); -- } -- -- if (tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE]) { -- len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE]); -- if (len > sizeof(ppet)) -- len = sizeof(ppet); -- memcpy(ppet, -- nla_data(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE]), -- len); -- ppet_len = len; -- } -- - if (tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]) { - len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]); - ---- a/reg.c -+++ b/reg.c -@@ -210,7 +210,6 @@ static int print_reg_handler(struct nl_m - PARSE_FLAG(NL80211_RRF_NO_80MHZ, "NO-80MHZ"); - PARSE_FLAG(NL80211_RRF_NO_160MHZ, "NO-160MHZ"); - PARSE_FLAG(NL80211_RRF_NO_HE, "NO-HE"); -- PARSE_FLAG(NL80211_RRF_NO_320MHZ, "NO-320MHZ"); - - /* Kernels that support NO_IR always turn on both flags */ - if ((flags & NL80211_RRF_NO_IR) && (flags & __NL80211_RRF_NO_IBSS)) { ---- a/station.c -+++ b/station.c -@@ -239,8 +239,6 @@ void parse_bitrate(struct nlattr *bitrat - pos += snprintf(pos, buflen - (pos - buf), " 80P80MHz"); - if (rinfo[NL80211_RATE_INFO_160_MHZ_WIDTH]) - pos += snprintf(pos, buflen - (pos - buf), " 160MHz"); -- if (rinfo[NL80211_RATE_INFO_320_MHZ_WIDTH]) -- pos += snprintf(pos, buflen - (pos - buf), " 320MHz"); - if (rinfo[NL80211_RATE_INFO_SHORT_GI]) - pos += snprintf(pos, buflen - (pos - buf), " short GI"); - if (rinfo[NL80211_RATE_INFO_VHT_NSS]) -@@ -261,18 +259,6 @@ void parse_bitrate(struct nlattr *bitrat - if (rinfo[NL80211_RATE_INFO_HE_RU_ALLOC]) - pos += snprintf(pos, buflen - (pos - buf), - " HE-RU-ALLOC %d", nla_get_u8(rinfo[NL80211_RATE_INFO_HE_RU_ALLOC])); -- if (rinfo[NL80211_RATE_INFO_EHT_MCS]) -- pos += snprintf(pos, buflen - (pos - buf), -- " EHT-MCS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_EHT_MCS])); -- if (rinfo[NL80211_RATE_INFO_EHT_NSS]) -- pos += snprintf(pos, buflen - (pos - buf), -- " EHT-NSS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_EHT_NSS])); -- if (rinfo[NL80211_RATE_INFO_EHT_GI]) -- pos += snprintf(pos, buflen - (pos - buf), -- " EHT-GI %d", nla_get_u8(rinfo[NL80211_RATE_INFO_EHT_GI])); -- if (rinfo[NL80211_RATE_INFO_EHT_RU_ALLOC]) -- pos += snprintf(pos, buflen - (pos - buf), -- " EHT-RU-ALLOC %d", nla_get_u8(rinfo[NL80211_RATE_INFO_EHT_RU_ALLOC])); - } - - static char *get_chain_signal(struct nlattr *attr_list) + NUM_NL80211_EXT_FEATURES, diff --git a/package/network/utils/iw/patches/200-reduce_size.patch b/package/network/utils/iw/patches/200-reduce_size.patch index 88df56b385c..86219945242 100644 --- a/package/network/utils/iw/patches/200-reduce_size.patch +++ b/package/network/utils/iw/patches/200-reduce_size.patch @@ -24,9 +24,9 @@ case NL80211_CMD_JOIN_IBSS: mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); printf("IBSS %s joined\n", macbuf); -@@ -1292,9 +1295,9 @@ static int print_event(struct nl_msg *ms - case NL80211_CMD_CH_SWITCH_NOTIFY: - parse_ch_switch_notify(tb, gnlh->cmd); +@@ -1295,9 +1298,9 @@ static int print_event(struct nl_msg *ms + case NL80211_CMD_ASSOC_COMEBACK: /* 147 */ + parse_assoc_comeback(tb, gnlh->cmd); break; +#endif default: @@ -38,7 +38,7 @@ --- a/info.c +++ b/info.c -@@ -308,6 +308,7 @@ next: +@@ -309,6 +309,7 @@ next: } } @@ -46,7 +46,7 @@ if (tb_band[NL80211_BAND_ATTR_RATES]) { printf("\t\tBitrates (non-HT):\n"); nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) { -@@ -324,6 +325,7 @@ next: +@@ -325,6 +326,7 @@ next: printf("\n"); } } @@ -54,7 +54,7 @@ } } -@@ -389,6 +391,7 @@ next: +@@ -390,6 +392,7 @@ next: printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage); } @@ -62,7 +62,7 @@ if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) { int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32); int i; -@@ -400,6 +403,7 @@ next: +@@ -401,6 +404,7 @@ next: cipher_name(ciphers[i])); } } @@ -70,7 +70,7 @@ if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] && tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX]) -@@ -417,9 +421,11 @@ next: +@@ -418,9 +422,11 @@ next: print_iftype_list("\tSupported interface modes", "\t\t", tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES]); @@ -82,7 +82,7 @@ if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) { struct nlattr *nl_combi; -@@ -509,6 +515,7 @@ broken_combination: +@@ -510,6 +516,7 @@ broken_combination: printf("\tinterface combinations are not supported\n"); } @@ -90,7 +90,7 @@ if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) { printf("\tSupported commands:\n"); nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd) -@@ -606,6 +613,7 @@ broken_combination: +@@ -607,6 +614,7 @@ broken_combination: printf("\t\t * wake up on TCP connection\n"); } } @@ -98,7 +98,7 @@ if (tb_msg[NL80211_ATTR_ROAM_SUPPORT]) printf("\tDevice supports roaming.\n"); -@@ -644,6 +652,7 @@ broken_combination: +@@ -645,6 +653,7 @@ broken_combination: } } @@ -106,7 +106,7 @@ if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) { unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]); -@@ -708,6 +717,7 @@ broken_combination: +@@ -709,6 +718,7 @@ broken_combination: if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR) printf("\tDevice supports randomizing MAC-addr in net-detect scans.\n"); } @@ -114,7 +114,7 @@ if (tb_msg[NL80211_ATTR_TDLS_SUPPORT]) printf("\tDevice supports T-DLS.\n"); -@@ -773,6 +783,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP +@@ -774,6 +784,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP "List all wireless devices and their capabilities."); TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL); @@ -122,7 +122,7 @@ static int handle_commands(struct nl80211_state *state, struct nl_msg *msg, int argc, char **argv, enum id_input id) { -@@ -784,6 +795,7 @@ static int handle_commands(struct nl8021 +@@ -785,6 +796,7 @@ static int handle_commands(struct nl8021 } TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands, "list all known commands and their decimal & hex value"); @@ -292,7 +292,7 @@ ifeq ($(NO_PKG_CONFIG),) --- a/station.c +++ b/station.c -@@ -777,10 +777,12 @@ static int handle_station_set_plink(stru +@@ -791,10 +791,12 @@ static int handle_station_set_plink(stru nla_put_failure: return -ENOBUFS; } @@ -305,7 +305,7 @@ static int handle_station_set_vlan(struct nl80211_state *state, struct nl_msg *msg, -@@ -875,11 +877,13 @@ static int handle_station_set_mesh_power +@@ -889,11 +891,13 @@ static int handle_station_set_mesh_power nla_put_failure: return -ENOBUFS; } @@ -321,7 +321,7 @@ struct nl_msg *msg, --- a/interface.c +++ b/interface.c -@@ -627,9 +627,11 @@ static int handle_interface_wds_peer(str +@@ -629,9 +629,11 @@ static int handle_interface_wds_peer(str nla_put_failure: return -ENOBUFS; } @@ -333,7 +333,7 @@ static int set_mcast_rate(struct nl80211_state *state, struct nl_msg *msg, -@@ -719,6 +721,7 @@ static int handle_chan(struct nl80211_st +@@ -721,6 +723,7 @@ static int handle_chan(struct nl80211_st return handle_chanfreq(state, msg, true, argc, argv, id); } @@ -341,7 +341,7 @@ SECTION(switch); COMMAND(switch, freq, " [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons ] [block-tx]\n" -@@ -990,3 +993,4 @@ COMMAND(set, tidconf, "[peer +Date: Tue, 29 Nov 2022 19:37:03 +0100 +Subject: [PATCH] iucode_tool: add missing limits.h for USE_CPUID_DEVICE + +If USE_CPUID_DEVICE is enabled, compilation fails for missing define. +Add the missing include to fix compilation error with USE_CPUID_DEVICE +define. + +Signed-off-by: Christian Marangi +--- + iucode_tool.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/iucode_tool.c b/iucode_tool.c +index 4bba5db..0246035 100644 +--- a/iucode_tool.c ++++ b/iucode_tool.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.37.2 + diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index b131cdccac5..2ece58f3151 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs PKG_VERSION:=1.46.5 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/ diff --git a/package/utils/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch b/package/utils/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch new file mode 100644 index 00000000000..e5a76161f21 --- /dev/null +++ b/package/utils/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch @@ -0,0 +1,50 @@ +From ab51d587bb9b229b1fade1afd02e1574c1ba5c76 Mon Sep 17 00:00:00 2001 +From: Lukas Czerner +Date: Thu, 21 Apr 2022 19:31:48 +0200 +Subject: libext2fs: add sanity check to extent manipulation + +It is possible to have a corrupted extent tree in such a way that a leaf +node contains zero extents in it. Currently if that happens and we try +to traverse the tree we can end up accessing wrong data, or possibly +even uninitialized memory. Make sure we don't do that. + +Additionally make sure that we have a sane number of bytes passed to +memmove() in ext2fs_extent_delete(). + +Note that e2fsck is currently unable to spot and fix such corruption in +pass1. + +Signed-off-by: Lukas Czerner +Reported-by: Nils Bars +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2068113 +Addresses: CVE-2022-1304 +Addresses-Debian-Bug: #1010263 +Signed-off-by: Theodore Ts'o +--- + lib/ext2fs/extent.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/lib/ext2fs/extent.c ++++ b/lib/ext2fs/extent.c +@@ -495,6 +495,10 @@ retry: + ext2fs_le16_to_cpu(eh->eh_entries); + newpath->max_entries = ext2fs_le16_to_cpu(eh->eh_max); + ++ /* Make sure there is at least one extent present */ ++ if (newpath->left <= 0) ++ return EXT2_ET_EXTENT_NO_DOWN; ++ + if (path->left > 0) { + ix++; + newpath->end_blk = ext2fs_le32_to_cpu(ix->ei_block); +@@ -1630,6 +1634,10 @@ errcode_t ext2fs_extent_delete(ext2_exte + + cp = path->curr; + ++ /* Sanity check before memmove() */ ++ if (path->left < 0) ++ return EXT2_ET_EXTENT_LEAF_BAD; ++ + if (path->left) { + memmove(cp, cp + sizeof(struct ext3_extent_idx), + path->left * sizeof(struct ext3_extent_idx)); diff --git a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c index 22b27336f89..05179bb423b 100644 --- a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c +++ b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c @@ -73,21 +73,18 @@ static uint8_t readbuf[TFFS_SECTOR_SIZE]; static uint8_t oobbuf[TFFS_SECTOR_OOB_SIZE]; static uint32_t blocksize; static int mtdfd; -struct tffs_sectors *sectors; - -struct tffs_sectors { - uint32_t num_sectors; - uint8_t sectors[0]; -}; +static uint32_t num_sectors; +static uint8_t *sectors; +static uint32_t *sector_ids; static inline void sector_mark_bad(int num) { - sectors->sectors[num / 8] &= ~(0x80 >> (num % 8)); + sectors[num / 8] &= ~(0x80 >> (num % 8)); }; static inline uint8_t sector_get_good(int num) { - return sectors->sectors[num / 8] & 0x80 >> (num % 8); + return sectors[num / 8] & 0x80 >> (num % 8); }; struct tffs_entry_segment { @@ -139,6 +136,8 @@ static int read_sector(off_t pos) return -1; } + sector_ids[pos / TFFS_SECTOR_SIZE] = read_uint32(readbuf, 0x00); + return 0; } @@ -176,25 +175,39 @@ static int find_entry(uint32_t id, struct tffs_entry *entry) off_t pos = 0; uint8_t block_end = 0; - for (uint32_t sector = 0; sector < sectors->num_sectors; sector++, pos += TFFS_SECTOR_SIZE) { + for (uint32_t sector = 0; sector < num_sectors; sector++, pos += TFFS_SECTOR_SIZE) { if (block_end) { if (pos % blocksize == 0) { block_end = 0; } } else if (sector_get_good(sector)) { + if (sector_ids[sector]) { + if (sector_ids[sector] == TFFS_ID_END) { + /* no more entries in this block */ + block_end = 1; + continue; + } + + if (sector_ids[sector] != id) + continue; + } + if (read_sectoroob(pos) || read_sector(pos)) { fprintf(stderr, "ERROR: sector isn't readable, but has been previously!\n"); exit(EXIT_FAILURE); } - uint32_t oob_id = read_uint32(oobbuf, 0x02); - uint32_t oob_len = read_uint32(oobbuf, 0x06); - uint32_t oob_rev = read_uint32(oobbuf, 0x0a); uint32_t read_id = read_uint32(readbuf, 0x00); uint32_t read_len = read_uint32(readbuf, 0x04); uint32_t read_rev = read_uint32(readbuf, 0x0c); - if (read_oob_sector_health && (oob_id != read_id || oob_len != read_len || oob_rev != read_rev)) { - fprintf(stderr, "Warning: sector has inconsistent metadata\n"); - continue; + if (read_oob_sector_health) { + uint32_t oob_id = read_uint32(oobbuf, 0x02); + uint32_t oob_len = read_uint32(oobbuf, 0x06); + uint32_t oob_rev = read_uint32(oobbuf, 0x0a); + + if (oob_id != read_id || oob_len != read_len || oob_rev != read_rev) { + fprintf(stderr, "Warning: sector has inconsistent metadata\n"); + continue; + } } if (read_id == TFFS_ID_END) { /* no more entries in this block */ @@ -414,13 +427,14 @@ static int scan_mtd(void) blocksize = info.erasesize; - sectors = malloc(sizeof(*sectors) + (info.size / TFFS_SECTOR_SIZE + 7) / 8); - if (sectors == NULL) { + num_sectors = info.size / TFFS_SECTOR_SIZE; + sectors = malloc((num_sectors + 7) / 8); + sector_ids = calloc(num_sectors, sizeof(uint32_t)); + if (!sectors || !sector_ids) { fprintf(stderr, "ERROR: memory allocation failed!\n"); exit(EXIT_FAILURE); } - sectors->num_sectors = info.size / TFFS_SECTOR_SIZE; - memset(sectors->sectors, 0xff, (info.size / TFFS_SECTOR_SIZE + 7) / 8); + memset(sectors, 0xff, (num_sectors + 7) / 8); uint32_t sector = 0, valid_blocks = 0; uint8_t block_ok = 0; @@ -564,6 +578,7 @@ int main(int argc, char *argv[]) out_free_entry: free(name_table.val); out_free_sectors: + free(sector_ids); free(sectors); out_close: close(mtdfd); diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index eccf4aab32c..fafc449090b 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2022-10-18 -PKG_SOURCE_VERSION:=00af065057a0e9c10ce6a6475acc47920790c2a9 -PKG_MIRROR_HASH:=58077503b6cabe70334fca8f33f0e443c60de31a1aaadef7079d5d103c547fe1 +PKG_SOURCE_DATE:=2022-12-02 +PKG_SOURCE_VERSION:=46d93c9cc5da6fce581df86159bd0fc4357de41c +PKG_MIRROR_HASH:=970a47f1bef719f056d40d17398db492bd4de92b98ef9aba4582cb18b4c9b270 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index 1858c74272b..26004c1cfd6 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -10,7 +10,7 @@ compatible = "teltonika,rut230-v1", "qca,ar9331"; aliases { - label-mac-device = &wmac; + label-mac-device = ð1; led-boot = &led_ss0; led-failsafe = &led_ss0; led-upgrade = &led_ss0; @@ -111,6 +111,7 @@ nvmem-cells = <&macaddr_config_0>; nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; }; ð1 { @@ -118,7 +119,6 @@ nvmem-cells = <&macaddr_config_0>; nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; }; &spi { diff --git a/target/linux/ath79/dts/ar9344_netgear_r6100.dts b/target/linux/ath79/dts/ar9344_netgear_r6100.dts index a73ea52de98..76bd77d4c65 100644 --- a/target/linux/ath79/dts/ar9344_netgear_r6100.dts +++ b/target/linux/ath79/dts/ar9344_netgear_r6100.dts @@ -181,8 +181,8 @@ compatible = "qcom,ath10k"; reg = <0x0000 0 0 0 0>; - nvmem-cells = <&macaddr_caldata_c>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&cal_ath10k>, <&macaddr_caldata_c>; + nvmem-cell-names = "calibration", "mac-address"; }; }; @@ -201,7 +201,8 @@ &wmac { status = "okay"; - mtd-cal-data = <&caldata 0x1000>; + nvmem-cells = <&cal_ath9k>; + nvmem-cell-names = "calibration"; }; &caldata { @@ -209,6 +210,14 @@ #address-cells = <1>; #size-cells = <1>; + cal_ath9k: calibration@1000 { + reg = <0x1000 0x440>; + }; + + cal_ath10k: calibration@5000 { + reg = <0x5000 0x844>; + }; + macaddr_caldata_0: macaddr@0 { reg = <0x0 0x6>; }; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 9da47ad38ee..ee14c005ccc 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -230,7 +230,7 @@ define Device/linksys_ea4500-v3 endef TARGET_DEVICES += linksys_ea4500-v3 -# fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header + 0xff) +# fake rootfs is mandatory, pad-offset 64 equals (1 * uimage_header) define Device/netgear_ath79_nand DEVICE_VENDOR := NETGEAR DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport @@ -238,15 +238,12 @@ define Device/netgear_ath79_nand BLOCKSIZE := 128k PAGESIZE := 2048 IMAGE_SIZE := 25600k - KERNEL := kernel-bin | append-dtb | lzma -d20 | \ - pad-offset $$(KERNEL_SIZE) 129 | uImage lzma | \ - append-string -e '\xff' | \ - append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC) - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | uImage lzma + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | \ + pad-offset $$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC) IMAGES := sysupgrade.bin factory.img - IMAGE/factory.img := append-kernel | append-ubi | netgear-dni | \ - check-size - IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata + IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ + append-ubi | check-size | netgear-dni + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata UBINIZE_OPTS := -E 5 endef @@ -262,8 +259,7 @@ define Device/netgear_pgzng1 IMAGE_SIZE := 83968k PAGESIZE := 2048 BLOCKSIZE := 128k - KERNEL := kernel-bin | append-dtb | lzma | uImage lzma - IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += netgear_pgzng1 diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index e5c26d6bb5d..d26625981ee 100644 --- a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -18,9 +18,6 @@ case "$FIRMWARE" in caldata_extract "art" 0x5000 0x844 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 1) ;; - netgear,r6100) - caldata_extract "caldata" 0x5000 0x844 - ;; zyxel,emg2926-q10a|\ zyxel,nbg6716) caldata_extract "art" 0x5000 0x844 diff --git a/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch index 1e13f09ffd6..53ddcd46e50 100644 --- a/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch @@ -258,7 +258,7 @@ SVN-Revision: 35130 #include #include #include -@@ -924,10 +925,10 @@ static void tcp_v6_send_response(const s +@@ -926,10 +927,10 @@ static void tcp_v6_send_response(const s topt = (__be32 *)(t1 + 1); if (tsecr) { diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index d8f61de8ebe..3e707ef8ca9 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -258,7 +258,7 @@ SVN-Revision: 35130 #include #include #include -@@ -941,10 +942,10 @@ static void tcp_v6_send_response(const s +@@ -943,10 +944,10 @@ static void tcp_v6_send_response(const s topt = (__be32 *)(t1 + 1); if (tsecr) { diff --git a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch index 3e2d3135c5c..799b5c8eabb 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0070-MMC-added-alternative-MMC-driver.patch @@ -291,7 +291,7 @@ bcm2835-mmc: uninitialized_var is no more goto out; --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c -@@ -1807,7 +1807,8 @@ EXPORT_SYMBOL(mmc_erase); +@@ -1812,7 +1812,8 @@ EXPORT_SYMBOL(mmc_erase); int mmc_can_erase(struct mmc_card *card) { @@ -1984,7 +1984,7 @@ bcm2835-mmc: uninitialized_var is no more #define MAX_TUNING_LOOP 40 -@@ -3143,7 +3143,7 @@ static void sdhci_timeout_timer(struct t +@@ -3188,7 +3188,7 @@ static void sdhci_timeout_timer(struct t spin_lock_irqsave(&host->lock, flags); if (host->cmd && !sdhci_data_line_cmd(host->cmd)) { @@ -1993,7 +1993,7 @@ bcm2835-mmc: uninitialized_var is no more mmc_hostname(host->mmc)); sdhci_dumpregs(host); -@@ -3165,7 +3165,7 @@ static void sdhci_timeout_data_timer(str +@@ -3210,7 +3210,7 @@ static void sdhci_timeout_data_timer(str if (host->data || host->data_cmd || (host->cmd && sdhci_data_line_cmd(host->cmd))) { diff --git a/target/linux/bcm27xx/patches-5.15/950-0470-sound-usb-add-device-quirks-for-A4Tech-FHD-1080p-web.patch b/target/linux/bcm27xx/patches-5.15/950-0470-sound-usb-add-device-quirks-for-A4Tech-FHD-1080p-web.patch index 524f6899048..d8ee96258d7 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0470-sound-usb-add-device-quirks-for-A4Tech-FHD-1080p-web.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0470-sound-usb-add-device-quirks-for-A4Tech-FHD-1080p-web.patch @@ -22,6 +22,6 @@ Signed-off-by: Jonathan Bell QUIRK_FLAG_GENERIC_IMPLICIT_FB), + DEVICE_FLG(0x09da, 0x2695, /* A4Tech FHD 1080p webcam */ + QUIRK_FLAG_DISABLE_AUTOSUSPEND | QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x0525, 0xa4ad, /* Hamedal C20 usb camero */ + QUIRK_FLAG_IFACE_SKIP_CLOSE), - /* Vendor matches */ - VENDOR_FLG(0x045e, /* MS Lifecam */ diff --git a/target/linux/generic/backport-5.10/605-v5.12-net-export-dev_set_threaded-symbol.patch b/target/linux/generic/backport-5.10/605-v5.12-net-export-dev_set_threaded-symbol.patch new file mode 100644 index 00000000000..2846679c6f6 --- /dev/null +++ b/target/linux/generic/backport-5.10/605-v5.12-net-export-dev_set_threaded-symbol.patch @@ -0,0 +1,24 @@ +From: Lorenzo Bianconi +Date: Sun, 14 Mar 2021 15:49:19 +0100 +Subject: [PATCH] net: export dev_set_threaded symbol + +For wireless devices (e.g. mt76 driver) multiple net_devices belongs to +the same wireless phy and the napi object is registered in a dummy +netdevice related to the wireless phy. +Export dev_set_threaded in order to be reused in device drivers enabling +threaded NAPI. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: David S. Miller +--- + +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -6819,6 +6819,7 @@ int dev_set_threaded(struct net_device * + + return err; + } ++EXPORT_SYMBOL(dev_set_threaded); + + void netif_napi_add(struct net_device *dev, struct napi_struct *napi, + int (*poll)(struct napi_struct *, int), int weight) diff --git a/target/linux/generic/backport-5.10/610-v5.13-01-netfilter-flowtable-separate-replace-destroy-and-sta.patch b/target/linux/generic/backport-5.10/610-v5.13-01-netfilter-flowtable-separate-replace-destroy-and-sta.patch index d98b4bfb7f5..478a2e0ec26 100644 --- a/target/linux/generic/backport-5.10/610-v5.13-01-netfilter-flowtable-separate-replace-destroy-and-sta.patch +++ b/target/linux/generic/backport-5.10/610-v5.13-01-netfilter-flowtable-separate-replace-destroy-and-sta.patch @@ -58,7 +58,7 @@ Signed-off-by: Pablo Neira Ayuso } static int nf_flow_table_block_setup(struct nf_flowtable *flowtable, -@@ -1013,15 +1023,33 @@ EXPORT_SYMBOL_GPL(nf_flow_table_offload_ +@@ -1017,15 +1027,33 @@ EXPORT_SYMBOL_GPL(nf_flow_table_offload_ int nf_flow_table_offload_init(void) { diff --git a/target/linux/generic/backport-5.10/610-v5.13-14-net-bridge-resolve-forwarding-path-for-VLAN-tag-acti.patch b/target/linux/generic/backport-5.10/610-v5.13-14-net-bridge-resolve-forwarding-path-for-VLAN-tag-acti.patch index 0f09dfe06c4..ef7157fba08 100644 --- a/target/linux/generic/backport-5.10/610-v5.13-14-net-bridge-resolve-forwarding-path-for-VLAN-tag-acti.patch +++ b/target/linux/generic/backport-5.10/610-v5.13-14-net-bridge-resolve-forwarding-path-for-VLAN-tag-acti.patch @@ -145,7 +145,7 @@ Signed-off-by: Pablo Neira Ayuso const struct net_bridge *br) --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c -@@ -1327,6 +1327,59 @@ int br_vlan_get_pvid_rcu(const struct ne +@@ -1350,6 +1350,59 @@ int br_vlan_get_pvid_rcu(const struct ne } EXPORT_SYMBOL_GPL(br_vlan_get_pvid_rcu); diff --git a/target/linux/generic/backport-5.10/610-v5.13-27-netfilter-flowtable-bridge-vlan-hardware-offload-and.patch b/target/linux/generic/backport-5.10/610-v5.13-27-netfilter-flowtable-bridge-vlan-hardware-offload-and.patch index 015e899253e..5431f480191 100644 --- a/target/linux/generic/backport-5.10/610-v5.13-27-netfilter-flowtable-bridge-vlan-hardware-offload-and.patch +++ b/target/linux/generic/backport-5.10/610-v5.13-27-netfilter-flowtable-bridge-vlan-hardware-offload-and.patch @@ -57,7 +57,7 @@ Signed-off-by: Pablo Neira Ayuso break; --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c -@@ -1374,6 +1374,8 @@ int br_vlan_fill_forward_path_mode(struc +@@ -1397,6 +1397,8 @@ int br_vlan_fill_forward_path_mode(struc if (path->bridge.vlan_mode == DEV_PATH_BR_VLAN_TAG) path->bridge.vlan_mode = DEV_PATH_BR_VLAN_KEEP; diff --git a/target/linux/generic/backport-5.10/610-v5.13-32-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch b/target/linux/generic/backport-5.10/610-v5.13-32-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch index f8ee000eeb2..4448af9f623 100644 --- a/target/linux/generic/backport-5.10/610-v5.13-32-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch +++ b/target/linux/generic/backport-5.10/610-v5.13-32-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch @@ -27,17 +27,21 @@ Signed-off-by: Pablo Neira Ayuso obj-$(CONFIG_NET_MEDIATEK_STAR_EMAC) += mtk_star_emac.o --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2299,12 +2299,17 @@ static int mtk_open(struct net_device *d +@@ -2299,7 +2299,10 @@ static int mtk_open(struct net_device *d /* we run 2 netdevs on the same dma ring so we only bring it up once */ if (!refcount_read(ð->dma_refcnt)) { - int err = mtk_start_dma(eth); + u32 gdm_config = MTK_GDMA_TO_PDMA; + int err; - ++ + err = mtk_start_dma(eth); + if (err) + if (err) { +@@ -2307,7 +2310,10 @@ static int mtk_open(struct net_device *d return err; + } - mtk_gdm_config(eth, MTK_GDMA_TO_PDMA); + if (eth->soc->offload_version && mtk_ppe_start(ð->ppe) == 0) @@ -47,7 +51,7 @@ Signed-off-by: Pablo Neira Ayuso napi_enable(ð->tx_napi); napi_enable(ð->rx_napi); -@@ -2371,6 +2376,9 @@ static int mtk_stop(struct net_device *d +@@ -2374,6 +2380,9 @@ static int mtk_stop(struct net_device *d mtk_dma_free(eth); @@ -57,7 +61,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; } -@@ -3099,6 +3107,13 @@ static int mtk_probe(struct platform_dev +@@ -3102,6 +3111,13 @@ static int mtk_probe(struct platform_dev goto err_free_dev; } @@ -71,7 +75,7 @@ Signed-off-by: Pablo Neira Ayuso for (i = 0; i < MTK_MAX_DEVS; i++) { if (!eth->netdev[i]) continue; -@@ -3173,6 +3188,7 @@ static const struct mtk_soc_data mt7621_ +@@ -3176,6 +3192,7 @@ static const struct mtk_soc_data mt7621_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, @@ -79,7 +83,7 @@ Signed-off-by: Pablo Neira Ayuso }; static const struct mtk_soc_data mt7622_data = { -@@ -3181,6 +3197,7 @@ static const struct mtk_soc_data mt7622_ +@@ -3184,6 +3201,7 @@ static const struct mtk_soc_data mt7622_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7622_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.10/610-v5.13-33-net-ethernet-mtk_eth_soc-add-flow-offloading-support.patch b/target/linux/generic/backport-5.10/610-v5.13-33-net-ethernet-mtk_eth_soc-add-flow-offloading-support.patch index b58eeacd77c..ee0bf9db16e 100644 --- a/target/linux/generic/backport-5.10/610-v5.13-33-net-ethernet-mtk_eth_soc-add-flow-offloading-support.patch +++ b/target/linux/generic/backport-5.10/610-v5.13-33-net-ethernet-mtk_eth_soc-add-flow-offloading-support.patch @@ -21,7 +21,7 @@ Signed-off-by: Pablo Neira Ayuso obj-$(CONFIG_NET_MEDIATEK_STAR_EMAC) += mtk_star_emac.o --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2854,6 +2854,7 @@ static const struct net_device_ops mtk_n +@@ -2858,6 +2858,7 @@ static const struct net_device_ops mtk_n #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = mtk_poll_controller, #endif @@ -29,7 +29,7 @@ Signed-off-by: Pablo Neira Ayuso }; static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) -@@ -3112,6 +3113,10 @@ static int mtk_probe(struct platform_dev +@@ -3116,6 +3117,10 @@ static int mtk_probe(struct platform_dev eth->base + MTK_ETH_PPE_BASE, 2); if (err) goto err_free_dev; diff --git a/target/linux/generic/backport-5.10/610-v5.13-45-net-ethernet-mtk_eth_soc-implement-dynamic-interrupt.patch b/target/linux/generic/backport-5.10/610-v5.13-45-net-ethernet-mtk_eth_soc-implement-dynamic-interrupt.patch index ba9e160dd26..7dbda871eae 100644 --- a/target/linux/generic/backport-5.10/610-v5.13-45-net-ethernet-mtk_eth_soc-implement-dynamic-interrupt.patch +++ b/target/linux/generic/backport-5.10/610-v5.13-45-net-ethernet-mtk_eth_soc-implement-dynamic-interrupt.patch @@ -103,7 +103,7 @@ Signed-off-by: David S. Miller if (likely(napi_schedule_prep(ð->tx_napi))) { __napi_schedule(ð->tx_napi); mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); -@@ -2366,6 +2383,9 @@ static int mtk_stop(struct net_device *d +@@ -2370,6 +2387,9 @@ static int mtk_stop(struct net_device *d napi_disable(ð->tx_napi); napi_disable(ð->rx_napi); @@ -113,7 +113,7 @@ Signed-off-by: David S. Miller if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) mtk_stop_dma(eth, MTK_QDMA_GLO_CFG); mtk_stop_dma(eth, MTK_PDMA_GLO_CFG); -@@ -2418,6 +2438,64 @@ err_disable_clks: +@@ -2422,6 +2442,64 @@ err_disable_clks: return ret; } @@ -178,7 +178,7 @@ Signed-off-by: David S. Miller static int mtk_hw_init(struct mtk_eth *eth) { int i, val, ret; -@@ -2439,9 +2517,6 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2443,9 +2521,6 @@ static int mtk_hw_init(struct mtk_eth *e goto err_disable_pm; } @@ -188,7 +188,7 @@ Signed-off-by: David S. Miller /* disable delay and normal interrupt */ mtk_tx_irq_disable(eth, ~0); mtk_rx_irq_disable(eth, ~0); -@@ -2480,11 +2555,11 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2484,11 +2559,11 @@ static int mtk_hw_init(struct mtk_eth *e /* Enable RX VLan Offloading */ mtk_w32(eth, 1, MTK_CDMP_EG_CTRL); @@ -203,7 +203,7 @@ Signed-off-by: David S. Miller mtk_tx_irq_disable(eth, ~0); mtk_rx_irq_disable(eth, ~0); -@@ -2989,6 +3064,13 @@ static int mtk_probe(struct platform_dev +@@ -2993,6 +3068,13 @@ static int mtk_probe(struct platform_dev spin_lock_init(ð->page_lock); spin_lock_init(ð->tx_irq_lock); spin_lock_init(ð->rx_irq_lock); diff --git a/target/linux/generic/backport-5.10/611-v5.12-net-ethernet-mediatek-support-setting-MTU.patch b/target/linux/generic/backport-5.10/611-v5.12-net-ethernet-mediatek-support-setting-MTU.patch index b0908cca9a6..d8c5ad8b83f 100644 --- a/target/linux/generic/backport-5.10/611-v5.12-net-ethernet-mediatek-support-setting-MTU.patch +++ b/target/linux/generic/backport-5.10/611-v5.12-net-ethernet-mediatek-support-setting-MTU.patch @@ -48,7 +48,7 @@ Signed-off-by: Jakub Kicinski return buf_size; } -@@ -2626,6 +2626,35 @@ static void mtk_uninit(struct net_device +@@ -2630,6 +2630,35 @@ static void mtk_uninit(struct net_device mtk_rx_irq_disable(eth, ~0); } @@ -84,7 +84,7 @@ Signed-off-by: Jakub Kicinski static int mtk_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct mtk_mac *mac = netdev_priv(dev); -@@ -2922,6 +2951,7 @@ static const struct net_device_ops mtk_n +@@ -2926,6 +2955,7 @@ static const struct net_device_ops mtk_n .ndo_set_mac_address = mtk_set_mac_address, .ndo_validate_addr = eth_validate_addr, .ndo_do_ioctl = mtk_do_ioctl, @@ -92,7 +92,7 @@ Signed-off-by: Jakub Kicinski .ndo_tx_timeout = mtk_tx_timeout, .ndo_get_stats64 = mtk_get_stats64, .ndo_fix_features = mtk_fix_features, -@@ -3024,7 +3054,10 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3028,7 +3058,10 @@ static int mtk_add_mac(struct mtk_eth *e eth->netdev[id]->irq = eth->irq[0]; eth->netdev[id]->dev.of_node = np; diff --git a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index 80ba4a69c13..83aae57d280 100644 --- a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -476,7 +476,7 @@ Signed-off-by: David S. Miller p->phy_np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c -@@ -1474,7 +1474,6 @@ static int bgx_init_of_phy(struct bgx *b +@@ -1476,7 +1476,6 @@ static int bgx_init_of_phy(struct bgx *b device_for_each_child_node(&bgx->pdev->dev, fwn) { struct phy_device *pd; struct device_node *phy_np; @@ -484,7 +484,7 @@ Signed-off-by: David S. Miller /* Should always be an OF node. But if it is not, we * cannot handle it, so exit the loop. -@@ -1483,9 +1482,7 @@ static int bgx_init_of_phy(struct bgx *b +@@ -1485,9 +1484,7 @@ static int bgx_init_of_phy(struct bgx *b if (!node) break; @@ -895,7 +895,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2600,14 +2600,11 @@ static int __init mtk_init(struct net_de +@@ -2604,14 +2604,11 @@ static int __init mtk_init(struct net_de { struct mtk_mac *mac = netdev_priv(dev); struct mtk_eth *eth = mac->hw; @@ -1360,7 +1360,7 @@ Signed-off-by: David S. Miller int irq; --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -5000,7 +5000,7 @@ int stmmac_dvr_probe(struct device *devi +@@ -5008,7 +5008,7 @@ int stmmac_dvr_probe(struct device *devi priv->wol_irq = res->wol_irq; priv->lpi_irq = res->lpi_irq; diff --git a/target/linux/generic/backport-5.15/020-v6.1-03-mm-vmscan.c-refactor-shrink_node.patch b/target/linux/generic/backport-5.15/020-v6.1-03-mm-vmscan.c-refactor-shrink_node.patch index f466f1105c0..31161e2a0f5 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-03-mm-vmscan.c-refactor-shrink_node.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-03-mm-vmscan.c-refactor-shrink_node.patch @@ -15,7 +15,7 @@ Change-Id: Iae734b5b4030205b7db6e8c841f747b6f6ae1a04 --- a/mm/vmscan.c +++ b/mm/vmscan.c -@@ -2562,6 +2562,103 @@ enum scan_balance { +@@ -2497,6 +2497,103 @@ enum scan_balance { SCAN_FILE, }; @@ -119,7 +119,7 @@ Change-Id: Iae734b5b4030205b7db6e8c841f747b6f6ae1a04 /* * Determine how aggressively the anon and file LRU lists should be * scanned. The relative value of each set of LRU lists is determined -@@ -3032,7 +3129,6 @@ static void shrink_node(pg_data_t *pgdat +@@ -2965,7 +3062,6 @@ static void shrink_node(pg_data_t *pgdat unsigned long nr_reclaimed, nr_scanned; struct lruvec *target_lruvec; bool reclaimable = false; @@ -127,7 +127,7 @@ Change-Id: Iae734b5b4030205b7db6e8c841f747b6f6ae1a04 target_lruvec = mem_cgroup_lruvec(sc->target_mem_cgroup, pgdat); -@@ -3048,93 +3144,7 @@ again: +@@ -2981,93 +3077,7 @@ again: nr_reclaimed = sc->nr_reclaimed; nr_scanned = sc->nr_scanned; diff --git a/target/linux/generic/backport-5.15/020-v6.1-04-mm-multigenerational-lru-groundwork.patch b/target/linux/generic/backport-5.15/020-v6.1-04-mm-multigenerational-lru-groundwork.patch index fbc15d8c912..533ea2aa200 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-04-mm-multigenerational-lru-groundwork.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-04-mm-multigenerational-lru-groundwork.patch @@ -720,7 +720,7 @@ Change-Id: I71de7cd15b8dfa6f9fdd838023474693c4fee0a7 #include #include -@@ -2880,6 +2881,273 @@ static bool can_age_anon_pages(struct pg +@@ -2815,6 +2816,273 @@ static bool can_age_anon_pages(struct pg return can_demote(pgdat->node_id, sc); } diff --git a/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch b/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch index 2592f18e06a..736b4f5152e 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch @@ -387,7 +387,7 @@ Change-Id: I25d9eda8c6bdc7c3653b9f210a159d6c247c81e8 .dfl_cftypes = memory_files, --- a/mm/vmscan.c +++ b/mm/vmscan.c -@@ -2929,6 +2929,306 @@ static bool __maybe_unused seq_is_valid( +@@ -2864,6 +2864,306 @@ static bool __maybe_unused seq_is_valid( } /****************************************************************************** @@ -694,7 +694,7 @@ Change-Id: I25d9eda8c6bdc7c3653b9f210a159d6c247c81e8 * state change ******************************************************************************/ -@@ -3112,6 +3412,7 @@ void lru_gen_init_state(struct mem_cgrou +@@ -3047,6 +3347,7 @@ void lru_gen_init_state(struct mem_cgrou int i; int gen, type, zone; struct lrugen *lrugen = &lruvec->evictable; @@ -702,7 +702,7 @@ Change-Id: I25d9eda8c6bdc7c3653b9f210a159d6c247c81e8 lrugen->max_seq = MIN_NR_GENS + 1; lrugen->enabled[0] = lru_gen_enabled() && lru_gen_nr_swapfiles; -@@ -3122,6 +3423,17 @@ void lru_gen_init_state(struct mem_cgrou +@@ -3057,6 +3358,17 @@ void lru_gen_init_state(struct mem_cgrou for_each_gen_type_zone(gen, type, zone) INIT_LIST_HEAD(&lrugen->lists[gen][type][zone]); @@ -720,7 +720,7 @@ Change-Id: I25d9eda8c6bdc7c3653b9f210a159d6c247c81e8 } #ifdef CONFIG_MEMCG -@@ -3129,18 +3441,37 @@ void lru_gen_init_memcg(struct mem_cgrou +@@ -3064,18 +3376,37 @@ void lru_gen_init_memcg(struct mem_cgrou { int nid; diff --git a/target/linux/generic/backport-5.15/020-v6.1-06-mm-multigenerational-lru-aging.patch b/target/linux/generic/backport-5.15/020-v6.1-06-mm-multigenerational-lru-aging.patch index 6fc93d9422f..2ff49681c7b 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-06-mm-multigenerational-lru-aging.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-06-mm-multigenerational-lru-aging.patch @@ -193,7 +193,7 @@ Change-Id: I3ae8abc3100d023cecb3a699d86020ae6fc10a45 #include #include -@@ -2887,6 +2889,15 @@ static bool can_age_anon_pages(struct pg +@@ -2822,6 +2824,15 @@ static bool can_age_anon_pages(struct pg * shorthand helpers ******************************************************************************/ @@ -209,7 +209,7 @@ Change-Id: I3ae8abc3100d023cecb3a699d86020ae6fc10a45 #define for_each_gen_type_zone(gen, type, zone) \ for ((gen) = 0; (gen) < MAX_NR_GENS; (gen)++) \ for ((type) = 0; (type) < ANON_AND_FILE; (type)++) \ -@@ -2899,6 +2910,12 @@ static int page_lru_gen(struct page *pag +@@ -2834,6 +2845,12 @@ static int page_lru_gen(struct page *pag return ((flags & LRU_GEN_MASK) >> LRU_GEN_PGOFF) - 1; } @@ -222,7 +222,7 @@ Change-Id: I3ae8abc3100d023cecb3a699d86020ae6fc10a45 static struct lruvec *get_lruvec(int nid, struct mem_cgroup *memcg) { struct pglist_data *pgdat = NODE_DATA(nid); -@@ -3229,6 +3246,926 @@ done: +@@ -3164,6 +3181,926 @@ done: } /****************************************************************************** @@ -1149,7 +1149,7 @@ Change-Id: I3ae8abc3100d023cecb3a699d86020ae6fc10a45 * state change ******************************************************************************/ -@@ -3477,6 +4414,12 @@ static int __init init_lru_gen(void) +@@ -3412,6 +4349,12 @@ static int __init init_lru_gen(void) }; late_initcall(init_lru_gen); @@ -1162,7 +1162,7 @@ Change-Id: I3ae8abc3100d023cecb3a699d86020ae6fc10a45 #endif /* CONFIG_LRU_GEN */ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) -@@ -4333,6 +5276,11 @@ static void age_active_anon(struct pglis +@@ -4266,6 +5209,11 @@ static void age_active_anon(struct pglis struct mem_cgroup *memcg; struct lruvec *lruvec; diff --git a/target/linux/generic/backport-5.15/020-v6.1-07-mm-multigenerational-lru-eviction.patch b/target/linux/generic/backport-5.15/020-v6.1-07-mm-multigenerational-lru-eviction.patch index 09e4315dccb..a75fedecaaa 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-07-mm-multigenerational-lru-eviction.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-07-mm-multigenerational-lru-eviction.patch @@ -212,7 +212,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac may_enter_fs = (sc->gfp_mask & __GFP_FS) || (PageSwapCache(page) && (sc->gfp_mask & __GFP_IO)); -@@ -2570,6 +2577,9 @@ static void prepare_scan_count(pg_data_t +@@ -2505,6 +2512,9 @@ static void prepare_scan_count(pg_data_t unsigned long file; struct lruvec *target_lruvec; @@ -222,7 +222,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac target_lruvec = mem_cgroup_lruvec(sc->target_mem_cgroup, pgdat); /* -@@ -2910,6 +2920,17 @@ static int page_lru_gen(struct page *pag +@@ -2845,6 +2855,17 @@ static int page_lru_gen(struct page *pag return ((flags & LRU_GEN_MASK) >> LRU_GEN_PGOFF) - 1; } @@ -240,7 +240,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac static int get_swappiness(struct mem_cgroup *memcg) { return mem_cgroup_get_nr_swap_pages(memcg) >= MIN_BATCH_SIZE ? -@@ -3246,6 +3267,91 @@ done: +@@ -3181,6 +3202,91 @@ done: } /****************************************************************************** @@ -332,7 +332,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac * the aging ******************************************************************************/ -@@ -3265,6 +3371,7 @@ static int page_update_gen(struct page * +@@ -3200,6 +3306,7 @@ static int page_update_gen(struct page * new_flags &= ~LRU_GEN_MASK; new_flags |= (gen + 1UL) << LRU_GEN_PGOFF; @@ -340,7 +340,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac } while (new_flags != old_flags && cmpxchg(&page->flags, old_flags, new_flags) != old_flags); -@@ -3296,6 +3403,7 @@ static void page_inc_gen(struct page *pa +@@ -3231,6 +3338,7 @@ static void page_inc_gen(struct page *pa new_flags &= ~LRU_GEN_MASK; new_flags |= (new_gen + 1UL) << LRU_GEN_PGOFF; @@ -348,7 +348,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac /* for end_page_writeback() */ if (reclaiming) new_flags |= BIT(PG_reclaim); -@@ -3787,6 +3895,7 @@ static bool inc_min_seq(struct lruvec *l +@@ -3722,6 +3830,7 @@ static bool inc_min_seq(struct lruvec *l } } @@ -356,7 +356,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac WRITE_ONCE(lrugen->min_seq[type], lrugen->min_seq[type] + 1); return true; -@@ -3824,6 +3933,8 @@ next: +@@ -3759,6 +3868,8 @@ next: if (min_seq[type] == lrugen->min_seq[type]) continue; @@ -365,7 +365,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac WRITE_ONCE(lrugen->min_seq[type], min_seq[type]); success = true; } -@@ -3885,6 +3996,9 @@ static void inc_max_seq(struct lruvec *l +@@ -3820,6 +3931,9 @@ static void inc_max_seq(struct lruvec *l } } @@ -375,7 +375,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac WRITE_ONCE(lrugen->timestamps[gen], jiffies); /* make sure all preceding modifications appear first */ smp_store_release(&lrugen->max_seq, lrugen->max_seq + 1); -@@ -4166,6 +4280,433 @@ void lru_gen_look_around(struct page_vma +@@ -4101,6 +4215,433 @@ void lru_gen_look_around(struct page_vma } /****************************************************************************** @@ -809,7 +809,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac * state change ******************************************************************************/ -@@ -4420,6 +4961,10 @@ static void lru_gen_age_node(struct pgli +@@ -4355,6 +4896,10 @@ static void lru_gen_age_node(struct pgli { } @@ -820,9 +820,9 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac #endif /* CONFIG_LRU_GEN */ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) -@@ -4433,6 +4978,11 @@ static void shrink_lruvec(struct lruvec +@@ -4368,6 +4913,11 @@ static void shrink_lruvec(struct lruvec + bool proportional_reclaim; struct blk_plug plug; - bool scan_adjusted; + if (lru_gen_enabled()) { + lru_gen_shrink_lruvec(lruvec, sc); @@ -832,7 +832,7 @@ Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac get_scan_count(lruvec, sc, nr); /* Record the original scan target for proportional adjustments later */ -@@ -4906,6 +5456,9 @@ static void snapshot_refaults(struct mem +@@ -4839,6 +5389,9 @@ static void snapshot_refaults(struct mem struct lruvec *target_lruvec; unsigned long refaults; diff --git a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multigenerational-lru-user-interface.patch b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multigenerational-lru-user-interface.patch index a1a749fc38e..f0753ea8028 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-08-mm-multigenerational-lru-user-interface.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-08-mm-multigenerational-lru-user-interface.patch @@ -67,7 +67,7 @@ Change-Id: I4448e60029badbe347aa3b624f429b280cc3a3d3 #include #include -@@ -4882,6 +4884,413 @@ unlock: +@@ -4817,6 +4819,413 @@ unlock: } /****************************************************************************** @@ -481,7 +481,7 @@ Change-Id: I4448e60029badbe347aa3b624f429b280cc3a3d3 * initialization ******************************************************************************/ -@@ -4951,6 +5360,12 @@ static int __init init_lru_gen(void) +@@ -4886,6 +5295,12 @@ static int __init init_lru_gen(void) BUILD_BUG_ON(BIT(LRU_GEN_WIDTH) <= MAX_NR_GENS); BUILD_BUG_ON(sizeof(MM_STAT_CODES) != NR_MM_STATS + 1); diff --git a/target/linux/generic/backport-5.15/021-v6.1-mm-mglru-don-t-sync-disk-for-each-aging-cycle.patch b/target/linux/generic/backport-5.15/021-v6.1-mm-mglru-don-t-sync-disk-for-each-aging-cycle.patch index 269e5eb2049..6cc4b3368f3 100644 --- a/target/linux/generic/backport-5.15/021-v6.1-mm-mglru-don-t-sync-disk-for-each-aging-cycle.patch +++ b/target/linux/generic/backport-5.15/021-v6.1-mm-mglru-don-t-sync-disk-for-each-aging-cycle.patch @@ -21,7 +21,7 @@ Signed-off-by: Andrew Morton --- a/mm/vmscan.c +++ b/mm/vmscan.c -@@ -4072,8 +4072,6 @@ static bool try_to_inc_max_seq(struct lr +@@ -4007,8 +4007,6 @@ static bool try_to_inc_max_seq(struct lr if (wq_has_sleeper(&lruvec->mm_walk.wait)) wake_up_all(&lruvec->mm_walk.wait); diff --git a/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch b/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch index afd78fdda29..e13616fd834 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch @@ -205,7 +205,7 @@ Signed-off-by: Felix Fietkau MTK_DMA_SIZE * sizeof(struct mtk_tx_dma), eth->scratch_ring, eth->phy_scratch_ring); -@@ -2511,6 +2512,8 @@ static void mtk_dim_tx(struct work_struc +@@ -2513,6 +2514,8 @@ static void mtk_dim_tx(struct work_struc static int mtk_hw_init(struct mtk_eth *eth) { @@ -214,7 +214,7 @@ Signed-off-by: Felix Fietkau int i, val, ret; if (test_and_set_bit(MTK_HW_INIT, ð->state)) -@@ -2523,6 +2526,10 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2525,6 +2528,10 @@ static int mtk_hw_init(struct mtk_eth *e if (ret) goto err_disable_pm; @@ -225,7 +225,7 @@ Signed-off-by: Felix Fietkau if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { ret = device_reset(eth->dev); if (ret) { -@@ -3076,6 +3083,35 @@ free_netdev: +@@ -3078,6 +3085,35 @@ free_netdev: return err; } @@ -261,7 +261,7 @@ Signed-off-by: Felix Fietkau static int mtk_probe(struct platform_device *pdev) { struct device_node *mac_np; -@@ -3089,6 +3125,7 @@ static int mtk_probe(struct platform_dev +@@ -3091,6 +3127,7 @@ static int mtk_probe(struct platform_dev eth->soc = of_device_get_match_data(&pdev->dev); eth->dev = &pdev->dev; @@ -269,7 +269,7 @@ Signed-off-by: Felix Fietkau eth->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(eth->base)) return PTR_ERR(eth->base); -@@ -3137,6 +3174,16 @@ static int mtk_probe(struct platform_dev +@@ -3139,6 +3176,16 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch b/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch index 502d1d0e9b5..a623aa14d78 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau static int mtk_msg_level = -1; module_param_named(msg_level, mtk_msg_level, int, 0); -@@ -3206,6 +3207,22 @@ static int mtk_probe(struct platform_dev +@@ -3208,6 +3209,22 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch b/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch index a17d49cac11..5002c38dc9c 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch @@ -10,16 +10,16 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2332,7 +2332,7 @@ static int mtk_open(struct net_device *d - if (err) +@@ -2334,7 +2334,7 @@ static int mtk_open(struct net_device *d return err; + } - if (eth->soc->offload_version && mtk_ppe_start(ð->ppe) == 0) + if (eth->soc->offload_version && mtk_ppe_start(eth->ppe) == 0) gdm_config = MTK_GDMA_TO_PPE; mtk_gdm_config(eth, gdm_config); -@@ -2406,7 +2406,7 @@ static int mtk_stop(struct net_device *d +@@ -2408,7 +2408,7 @@ static int mtk_stop(struct net_device *d mtk_dma_free(eth); if (eth->soc->offload_version) @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -3298,10 +3298,11 @@ static int mtk_probe(struct platform_dev +@@ -3300,10 +3300,11 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch b/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch index 76e8eb11fd5..52b3add875d 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch @@ -54,7 +54,7 @@ Signed-off-by: Felix Fietkau if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX && (trxd.rxd2 & RX_DMA_VTAG)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), -@@ -3298,7 +3304,7 @@ static int mtk_probe(struct platform_dev +@@ -3300,7 +3306,7 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch b/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch index d87022fce43..0a2c1435f75 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-13-net-ethernet-mtk_eth_soc-use-standard-property-for-c.patch @@ -24,7 +24,7 @@ Signed-off-by: David S. Miller mediatek,hifsys = <&hifsys>; --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3185,7 +3185,7 @@ static int mtk_probe(struct platform_dev +@@ -3187,7 +3187,7 @@ static int mtk_probe(struct platform_dev struct regmap *cci; cci = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, diff --git a/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch b/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch index 7aeeda0ba06..d3feef28eb8 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-19-net-ethernet-mtk_eth_soc-add-txd_size-to-mtk_soc_dat.patch @@ -85,7 +85,7 @@ Signed-off-by: David S. Miller eth->scratch_ring = NULL; eth->phy_scratch_ring = 0; } -@@ -3388,6 +3391,9 @@ static const struct mtk_soc_data mt2701_ +@@ -3390,6 +3393,9 @@ static const struct mtk_soc_data mt2701_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, @@ -95,7 +95,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7621_data = { -@@ -3396,6 +3402,9 @@ static const struct mtk_soc_data mt7621_ +@@ -3398,6 +3404,9 @@ static const struct mtk_soc_data mt7621_ .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -105,7 +105,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7622_data = { -@@ -3405,6 +3414,9 @@ static const struct mtk_soc_data mt7622_ +@@ -3407,6 +3416,9 @@ static const struct mtk_soc_data mt7622_ .required_clks = MT7622_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -115,7 +115,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7623_data = { -@@ -3413,6 +3425,9 @@ static const struct mtk_soc_data mt7623_ +@@ -3415,6 +3427,9 @@ static const struct mtk_soc_data mt7623_ .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .offload_version = 2, @@ -125,7 +125,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data mt7629_data = { -@@ -3421,6 +3436,9 @@ static const struct mtk_soc_data mt7629_ +@@ -3423,6 +3438,9 @@ static const struct mtk_soc_data mt7629_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7629_CLKS_BITMAP, .required_pctl = false, @@ -135,7 +135,7 @@ Signed-off-by: David S. Miller }; static const struct mtk_soc_data rt5350_data = { -@@ -3428,6 +3446,9 @@ static const struct mtk_soc_data rt5350_ +@@ -3430,6 +3448,9 @@ static const struct mtk_soc_data rt5350_ .hw_features = MTK_HW_FEATURES_MT7628, .required_clks = MT7628_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch b/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch index be258da75a9..5436e92dbea 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch @@ -34,7 +34,7 @@ Signed-off-by: David S. Miller ring->dma = NULL; } } -@@ -3403,6 +3402,7 @@ static const struct mtk_soc_data mt2701_ +@@ -3405,6 +3404,7 @@ static const struct mtk_soc_data mt2701_ .required_pctl = true, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -42,7 +42,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3414,6 +3414,7 @@ static const struct mtk_soc_data mt7621_ +@@ -3416,6 +3416,7 @@ static const struct mtk_soc_data mt7621_ .offload_version = 2, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -50,7 +50,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3426,6 +3427,7 @@ static const struct mtk_soc_data mt7622_ +@@ -3428,6 +3429,7 @@ static const struct mtk_soc_data mt7622_ .offload_version = 2, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -58,7 +58,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3437,6 +3439,7 @@ static const struct mtk_soc_data mt7623_ +@@ -3439,6 +3441,7 @@ static const struct mtk_soc_data mt7623_ .offload_version = 2, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -66,7 +66,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3448,6 +3451,7 @@ static const struct mtk_soc_data mt7629_ +@@ -3450,6 +3453,7 @@ static const struct mtk_soc_data mt7629_ .required_pctl = false, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), @@ -74,7 +74,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3458,6 +3462,7 @@ static const struct mtk_soc_data rt5350_ +@@ -3460,6 +3464,7 @@ static const struct mtk_soc_data rt5350_ .required_pctl = false, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), diff --git a/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch b/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch index 99f482c418f..945d4d9bb2e 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-26-net-ethernet-mtk_eth_soc-introduce-device-register-m.patch @@ -415,7 +415,7 @@ Signed-off-by: David S. Miller } return 0; -@@ -2437,8 +2497,8 @@ static int mtk_stop(struct net_device *d +@@ -2439,8 +2499,8 @@ static int mtk_stop(struct net_device *d cancel_work_sync(ð->tx_dim.work); if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) @@ -426,7 +426,7 @@ Signed-off-by: David S. Miller mtk_dma_free(eth); -@@ -2492,6 +2552,7 @@ static void mtk_dim_rx(struct work_struc +@@ -2494,6 +2554,7 @@ static void mtk_dim_rx(struct work_struc { struct dim *dim = container_of(work, struct dim, work); struct mtk_eth *eth = container_of(dim, struct mtk_eth, rx_dim); @@ -434,7 +434,7 @@ Signed-off-by: David S. Miller struct dim_cq_moder cur_profile; u32 val, cur; -@@ -2499,7 +2560,7 @@ static void mtk_dim_rx(struct work_struc +@@ -2501,7 +2562,7 @@ static void mtk_dim_rx(struct work_struc dim->profile_ix); spin_lock_bh(ð->dim_lock); @@ -443,7 +443,7 @@ Signed-off-by: David S. Miller val &= MTK_PDMA_DELAY_TX_MASK; val |= MTK_PDMA_DELAY_RX_EN; -@@ -2509,9 +2570,9 @@ static void mtk_dim_rx(struct work_struc +@@ -2511,9 +2572,9 @@ static void mtk_dim_rx(struct work_struc cur = min_t(u32, cur_profile.pkts, MTK_PDMA_DELAY_PINT_MASK); val |= cur << MTK_PDMA_DELAY_RX_PINT_SHIFT; @@ -455,7 +455,7 @@ Signed-off-by: David S. Miller spin_unlock_bh(ð->dim_lock); -@@ -2522,6 +2583,7 @@ static void mtk_dim_tx(struct work_struc +@@ -2524,6 +2585,7 @@ static void mtk_dim_tx(struct work_struc { struct dim *dim = container_of(work, struct dim, work); struct mtk_eth *eth = container_of(dim, struct mtk_eth, tx_dim); @@ -463,7 +463,7 @@ Signed-off-by: David S. Miller struct dim_cq_moder cur_profile; u32 val, cur; -@@ -2529,7 +2591,7 @@ static void mtk_dim_tx(struct work_struc +@@ -2531,7 +2593,7 @@ static void mtk_dim_tx(struct work_struc dim->profile_ix); spin_lock_bh(ð->dim_lock); @@ -472,7 +472,7 @@ Signed-off-by: David S. Miller val &= MTK_PDMA_DELAY_RX_MASK; val |= MTK_PDMA_DELAY_TX_EN; -@@ -2539,9 +2601,9 @@ static void mtk_dim_tx(struct work_struc +@@ -2541,9 +2603,9 @@ static void mtk_dim_tx(struct work_struc cur = min_t(u32, cur_profile.pkts, MTK_PDMA_DELAY_PINT_MASK); val |= cur << MTK_PDMA_DELAY_TX_PINT_SHIFT; @@ -484,7 +484,7 @@ Signed-off-by: David S. Miller spin_unlock_bh(ð->dim_lock); -@@ -2552,6 +2614,7 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2554,6 +2616,7 @@ static int mtk_hw_init(struct mtk_eth *e { u32 dma_mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA | ETHSYS_DMA_AG_MAP_PPE; @@ -492,7 +492,7 @@ Signed-off-by: David S. Miller int i, val, ret; if (test_and_set_bit(MTK_HW_INIT, ð->state)) -@@ -2626,10 +2689,10 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2628,10 +2691,10 @@ static int mtk_hw_init(struct mtk_eth *e mtk_rx_irq_disable(eth, ~0); /* FE int grouping */ @@ -507,7 +507,7 @@ Signed-off-by: David S. Miller mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); return 0; -@@ -3168,14 +3231,6 @@ static int mtk_probe(struct platform_dev +@@ -3170,14 +3233,6 @@ static int mtk_probe(struct platform_dev if (IS_ERR(eth->base)) return PTR_ERR(eth->base); @@ -522,7 +522,7 @@ Signed-off-by: David S. Miller if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { eth->rx_dma_l4_valid = RX_DMA_L4_VALID_PDMA; eth->ip_align = NET_IP_ALIGN; -@@ -3409,6 +3464,7 @@ static int mtk_remove(struct platform_de +@@ -3411,6 +3466,7 @@ static int mtk_remove(struct platform_de } static const struct mtk_soc_data mt2701_data = { @@ -530,7 +530,7 @@ Signed-off-by: David S. Miller .caps = MT7623_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, -@@ -3420,6 +3476,7 @@ static const struct mtk_soc_data mt2701_ +@@ -3422,6 +3478,7 @@ static const struct mtk_soc_data mt2701_ }; static const struct mtk_soc_data mt7621_data = { @@ -538,7 +538,7 @@ Signed-off-by: David S. Miller .caps = MT7621_CAPS, .hw_features = MTK_HW_FEATURES, .required_clks = MT7621_CLKS_BITMAP, -@@ -3432,6 +3489,7 @@ static const struct mtk_soc_data mt7621_ +@@ -3434,6 +3491,7 @@ static const struct mtk_soc_data mt7621_ }; static const struct mtk_soc_data mt7622_data = { @@ -546,7 +546,7 @@ Signed-off-by: David S. Miller .ana_rgc3 = 0x2028, .caps = MT7622_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, -@@ -3445,6 +3503,7 @@ static const struct mtk_soc_data mt7622_ +@@ -3447,6 +3505,7 @@ static const struct mtk_soc_data mt7622_ }; static const struct mtk_soc_data mt7623_data = { @@ -554,7 +554,7 @@ Signed-off-by: David S. Miller .caps = MT7623_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, -@@ -3457,6 +3516,7 @@ static const struct mtk_soc_data mt7623_ +@@ -3459,6 +3518,7 @@ static const struct mtk_soc_data mt7623_ }; static const struct mtk_soc_data mt7629_data = { @@ -562,7 +562,7 @@ Signed-off-by: David S. Miller .ana_rgc3 = 0x128, .caps = MT7629_CAPS | MTK_HWLRO, .hw_features = MTK_HW_FEATURES, -@@ -3469,6 +3529,7 @@ static const struct mtk_soc_data mt7629_ +@@ -3471,6 +3531,7 @@ static const struct mtk_soc_data mt7629_ }; static const struct mtk_soc_data rt5350_data = { diff --git a/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch b/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch index e15854ecad1..d1f19d6a454 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-27-net-ethernet-mtk_eth_soc-introduce-MTK_NETSYS_V2-sup.patch @@ -471,7 +471,7 @@ Signed-off-by: David S. Miller mtk_w32(eth, MTK_RX_DMA_EN | rx_2b_offset | MTK_RX_BT_32DWORDS | MTK_MULTI_EN, -@@ -2437,7 +2554,7 @@ static int mtk_open(struct net_device *d +@@ -2439,7 +2556,7 @@ static int mtk_open(struct net_device *d napi_enable(ð->tx_napi); napi_enable(ð->rx_napi); mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); @@ -480,7 +480,7 @@ Signed-off-by: David S. Miller refcount_set(ð->dma_refcnt, 1); } else -@@ -2489,7 +2606,7 @@ static int mtk_stop(struct net_device *d +@@ -2491,7 +2608,7 @@ static int mtk_stop(struct net_device *d mtk_gdm_config(eth, MTK_GDMA_DROP_ALL); mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); @@ -489,7 +489,7 @@ Signed-off-by: David S. Miller napi_disable(ð->tx_napi); napi_disable(ð->rx_napi); -@@ -2649,9 +2766,25 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2651,9 +2768,25 @@ static int mtk_hw_init(struct mtk_eth *e return 0; } @@ -518,7 +518,7 @@ Signed-off-by: David S. Miller if (eth->pctl) { /* Set GE2 driving and slew rate */ -@@ -2690,11 +2823,47 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2692,11 +2825,47 @@ static int mtk_hw_init(struct mtk_eth *e /* FE int grouping */ mtk_w32(eth, MTK_TX_DONE_INT, reg_map->pdma.int_grp); @@ -568,7 +568,7 @@ Signed-off-by: David S. Miller return 0; err_disable_pm: -@@ -3231,12 +3400,8 @@ static int mtk_probe(struct platform_dev +@@ -3233,12 +3402,8 @@ static int mtk_probe(struct platform_dev if (IS_ERR(eth->base)) return PTR_ERR(eth->base); @@ -582,7 +582,7 @@ Signed-off-by: David S. Miller spin_lock_init(ð->page_lock); spin_lock_init(ð->tx_irq_lock); -@@ -3472,6 +3637,10 @@ static const struct mtk_soc_data mt2701_ +@@ -3474,6 +3639,10 @@ static const struct mtk_soc_data mt2701_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -593,7 +593,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3485,6 +3654,10 @@ static const struct mtk_soc_data mt7621_ +@@ -3487,6 +3656,10 @@ static const struct mtk_soc_data mt7621_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -604,7 +604,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3499,6 +3672,10 @@ static const struct mtk_soc_data mt7622_ +@@ -3501,6 +3674,10 @@ static const struct mtk_soc_data mt7622_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -615,7 +615,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3512,6 +3689,10 @@ static const struct mtk_soc_data mt7623_ +@@ -3514,6 +3691,10 @@ static const struct mtk_soc_data mt7623_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -626,7 +626,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3525,6 +3706,10 @@ static const struct mtk_soc_data mt7629_ +@@ -3527,6 +3708,10 @@ static const struct mtk_soc_data mt7629_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), @@ -637,7 +637,7 @@ Signed-off-by: David S. Miller }, }; -@@ -3537,6 +3722,10 @@ static const struct mtk_soc_data rt5350_ +@@ -3539,6 +3724,10 @@ static const struct mtk_soc_data rt5350_ .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), diff --git a/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch b/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch index 4baeb2244f0..c14fcffcc54 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-30-net-ethernet-mtk_eth_soc-introduce-support-for-mt798.patch @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller }; void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) -@@ -3709,6 +3746,21 @@ static const struct mtk_soc_data mt7629_ +@@ -3711,6 +3748,21 @@ static const struct mtk_soc_data mt7629_ }, }; @@ -87,7 +87,7 @@ Signed-off-by: David S. Miller static const struct mtk_soc_data rt5350_data = { .reg_map = &mt7628_reg_map, .caps = MT7628_CAPS, -@@ -3731,6 +3783,7 @@ const struct of_device_id of_mtk_match[] +@@ -3733,6 +3785,7 @@ const struct of_device_id of_mtk_match[] { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data}, diff --git a/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch b/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch index 2e3ad698b55..56d0efb9031 100644 --- a/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch +++ b/target/linux/generic/backport-5.15/702-v5.19-33-net-ethernet-mtk_eth_soc-enable-rx-cksum-offload-for.patch @@ -37,7 +37,7 @@ Signed-off-by: Jakub Kicinski skb->ip_summed = CHECKSUM_UNNECESSARY; else skb_checksum_none_assert(skb); -@@ -3756,6 +3762,7 @@ static const struct mtk_soc_data mt7986_ +@@ -3758,6 +3764,7 @@ static const struct mtk_soc_data mt7986_ .txd_size = sizeof(struct mtk_tx_dma_v2), .rxd_size = sizeof(struct mtk_rx_dma_v2), .rx_irq_done_mask = MTK_RX_DONE_INT_V2, diff --git a/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch b/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch index 555e7eaa958..ede1cc3a8d0 100644 --- a/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch +++ b/target/linux/generic/backport-5.15/703-00-v5.16-net-convert-users-of-bitmap_foo-to-linkmode_foo.patch @@ -637,7 +637,7 @@ Signed-off-by: David S. Miller static void macb_usx_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c -@@ -968,7 +968,7 @@ static void enetc_pl_mac_validate(struct +@@ -965,7 +965,7 @@ static void enetc_pl_mac_validate(struct state->interface != PHY_INTERFACE_MODE_2500BASEX && state->interface != PHY_INTERFACE_MODE_USXGMII && !phy_interface_mode_is_rgmii(state->interface)) { @@ -646,7 +646,7 @@ Signed-off-by: David S. Miller return; } -@@ -991,10 +991,8 @@ static void enetc_pl_mac_validate(struct +@@ -988,10 +988,8 @@ static void enetc_pl_mac_validate(struct phylink_set(mask, 2500baseX_Full); } diff --git a/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch b/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch index 43e1f9cc31b..a602ed5c9c0 100644 --- a/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch +++ b/target/linux/generic/backport-5.15/704-01-v5.17-net-mtk_eth_soc-populate-supported_interfaces-member.patch @@ -14,7 +14,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3352,6 +3352,26 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3354,6 +3354,26 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch b/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch index 7f3734a7654..2140a8267b3 100644 --- a/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch +++ b/target/linux/generic/backport-5.15/704-04-v5.17-net-mtk_eth_soc-use-phylink_generic_validate.patch @@ -72,7 +72,7 @@ Signed-off-by: David S. Miller .mac_pcs_get_state = mtk_mac_pcs_get_state, .mac_an_restart = mtk_mac_an_restart, .mac_config = mtk_mac_config, -@@ -3314,6 +3266,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3316,6 +3268,9 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch b/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch index 6aa99acf77d..8b9a249e40e 100644 --- a/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch +++ b/target/linux/generic/backport-5.15/704-05-v5.17-net-mtk_eth_soc-mark-as-a-legacy_pre_march2020-drive.patch @@ -16,7 +16,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3266,6 +3266,10 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3268,6 +3268,10 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch b/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch index e5f70e36f0b..97e0b3ccb06 100644 --- a/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch +++ b/target/linux/generic/backport-5.15/704-06-v5.19-eth-mtk_eth_soc-remove-a-copy-of-the-NAPI_POLL_WEIGH.patch @@ -16,7 +16,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3565,9 +3565,9 @@ static int mtk_probe(struct platform_dev +@@ -3567,9 +3567,9 @@ static int mtk_probe(struct platform_dev */ init_dummy_netdev(ð->dummy_dev); netif_napi_add(ð->dummy_dev, ð->tx_napi, mtk_napi_tx, diff --git a/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch b/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch index 4d896cdf392..9873edbc500 100644 --- a/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch +++ b/target/linux/generic/backport-5.15/704-07-v5.19-mtk_eth_soc-remove-unused-mac-mode.patch @@ -15,7 +15,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3261,7 +3261,6 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3263,7 +3263,6 @@ static int mtk_add_mac(struct mtk_eth *e /* mac config is not set */ mac->interface = PHY_INTERFACE_MODE_NA; diff --git a/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch b/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch index 140ff3cab5e..d4a4d511016 100644 --- a/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch +++ b/target/linux/generic/backport-5.15/704-11-v5.19-net-mtk_eth_soc-correct-802.3z-duplex-setting.patch @@ -38,7 +38,7 @@ Signed-off-by: Jakub Kicinski mcr &= ~(MAC_MCR_SPEED_100 | MAC_MCR_SPEED_1000 | MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC | MAC_MCR_FORCE_RX_FC); -@@ -3265,9 +3275,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3267,9 +3277,7 @@ static int mtk_add_mac(struct mtk_eth *e mac->phylink_config.dev = ð->netdev[id]->dev; mac->phylink_config.type = PHYLINK_NETDEV; diff --git a/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch b/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch index b930152dd14..f03f6a3a414 100644 --- a/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch +++ b/target/linux/generic/backport-5.15/706-01-v6.0-net-ethernet-mtk_eth_soc-add-basic-XDP-support.patch @@ -208,7 +208,7 @@ Signed-off-by: David S. Miller struct page_pool *pp; pp = mtk_create_page_pool(eth, &ring->xdp_q, ring_no, -@@ -2707,6 +2782,48 @@ static int mtk_stop(struct net_device *d +@@ -2709,6 +2784,48 @@ static int mtk_stop(struct net_device *d return 0; } @@ -257,7 +257,7 @@ Signed-off-by: David S. Miller static void ethsys_reset(struct mtk_eth *eth, u32 reset_bits) { regmap_update_bits(eth->ethsys, ETHSYS_RSTCTRL, -@@ -3002,6 +3119,12 @@ static int mtk_change_mtu(struct net_dev +@@ -3004,6 +3121,12 @@ static int mtk_change_mtu(struct net_dev struct mtk_eth *eth = mac->hw; u32 mcr_cur, mcr_new; @@ -270,7 +270,7 @@ Signed-off-by: David S. Miller if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); mcr_new = mcr_cur & ~MAC_MCR_MAX_RX_MASK; -@@ -3329,6 +3452,7 @@ static const struct net_device_ops mtk_n +@@ -3331,6 +3454,7 @@ static const struct net_device_ops mtk_n .ndo_poll_controller = mtk_poll_controller, #endif .ndo_setup_tc = mtk_eth_setup_tc, diff --git a/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch b/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch index 42b3ea215d8..345c6bed01b 100644 --- a/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch +++ b/target/linux/generic/backport-5.15/706-03-v6.0-net-ethernet-mtk_eth_soc-add-xmit-XDP-support.patch @@ -304,7 +304,7 @@ Signed-off-by: David S. Miller } mtk_tx_unmap(eth, tx_buf, true); -@@ -3475,6 +3624,7 @@ static const struct net_device_ops mtk_n +@@ -3477,6 +3626,7 @@ static const struct net_device_ops mtk_n #endif .ndo_setup_tc = mtk_eth_setup_tc, .ndo_bpf = mtk_xdp, diff --git a/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch b/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch index d372f022c7e..8302cb05c43 100644 --- a/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch +++ b/target/linux/generic/backport-5.15/706-04-v6.0-net-ethernet-mtk_eth_soc-add-support-for-page_pool_g.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller MediaTek SoC family. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3485,11 +3485,18 @@ static void mtk_get_strings(struct net_d +@@ -3487,11 +3487,18 @@ static void mtk_get_strings(struct net_d int i; switch (stringset) { @@ -46,7 +46,7 @@ Signed-off-by: David S. Miller break; } } -@@ -3497,13 +3504,35 @@ static void mtk_get_strings(struct net_d +@@ -3499,13 +3506,35 @@ static void mtk_get_strings(struct net_d static int mtk_get_sset_count(struct net_device *dev, int sset) { switch (sset) { @@ -84,7 +84,7 @@ Signed-off-by: David S. Miller static void mtk_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) { -@@ -3531,6 +3560,8 @@ static void mtk_get_ethtool_stats(struct +@@ -3533,6 +3562,8 @@ static void mtk_get_ethtool_stats(struct for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) *data_dst++ = *(data_src + mtk_ethtool_stats[i].offset); diff --git a/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch b/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch index 008e20416dc..ca2d161056d 100644 --- a/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch +++ b/target/linux/generic/backport-5.15/713-v6.0-net-ethernet-mtk_eth_soc-move-gdma_to_ppe-and-ppe_ba.patch @@ -65,9 +65,9 @@ Signed-off-by: Lorenzo Bianconi u32 gdm_config = MTK_GDMA_TO_PDMA; int err; -@@ -2931,15 +2936,15 @@ static int mtk_open(struct net_device *d - if (err) +@@ -2933,15 +2938,15 @@ static int mtk_open(struct net_device *d return err; + } - if (eth->soc->offload_version && mtk_ppe_start(eth->ppe) == 0) - gdm_config = MTK_GDMA_TO_PPE; @@ -84,7 +84,7 @@ Signed-off-by: Lorenzo Bianconi refcount_set(ð->dma_refcnt, 1); } else -@@ -4045,7 +4050,9 @@ static int mtk_probe(struct platform_dev +@@ -4047,7 +4052,9 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch b/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch index dd3bb158005..89a3aa98931 100644 --- a/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch +++ b/target/linux/generic/backport-5.15/714-v6.0-net-ethernet-mtk_eth_soc-move-ppe-table-hash-offset-.patch @@ -44,7 +44,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4148,6 +4148,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4150,6 +4150,7 @@ static const struct mtk_soc_data mt7621_ .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -52,7 +52,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4166,6 +4167,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4168,6 +4169,7 @@ static const struct mtk_soc_data mt7622_ .required_clks = MT7622_CLKS_BITMAP, .required_pctl = false, .offload_version = 2, @@ -60,7 +60,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4183,6 +4185,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4185,6 +4187,7 @@ static const struct mtk_soc_data mt7623_ .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .offload_version = 2, @@ -68,7 +68,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4216,6 +4219,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4218,6 +4221,7 @@ static const struct mtk_soc_data mt7986_ .caps = MT7986_CAPS, .required_clks = MT7986_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch b/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch index 0b207ff6a1f..9f4875eed3b 100644 --- a/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch +++ b/target/linux/generic/backport-5.15/715-v6.0-net-ethernet-mtk_eth_soc-add-the-capability-to-run-m.patch @@ -57,7 +57,7 @@ Signed-off-by: Lorenzo Bianconi if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) { if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { -@@ -2929,15 +2929,19 @@ static int mtk_open(struct net_device *d +@@ -2929,7 +2929,8 @@ static int mtk_open(struct net_device *d /* we run 2 netdevs on the same dma ring so we only bring it up once */ if (!refcount_read(ð->dma_refcnt)) { const struct mtk_soc_data *soc = eth->soc; @@ -67,8 +67,9 @@ Signed-off-by: Lorenzo Bianconi int err; err = mtk_start_dma(eth); - if (err) +@@ -2938,8 +2939,11 @@ static int mtk_open(struct net_device *d return err; + } - if (soc->offload_version && mtk_ppe_start(eth->ppe) == 0) - gdm_config = soc->reg_map->gdma_to_ppe0; @@ -76,11 +77,11 @@ Signed-off-by: Lorenzo Bianconi + mtk_ppe_start(eth->ppe[i]); + + gdm_config = soc->offload_version ? soc->reg_map->gdma_to_ppe0 -+ : MTK_GDMA_TO_PDMA; ++ : MTK_GDMA_TO_PDMA; mtk_gdm_config(eth, gdm_config); -@@ -2982,6 +2986,7 @@ static int mtk_stop(struct net_device *d +@@ -2984,6 +2988,7 @@ static int mtk_stop(struct net_device *d { struct mtk_mac *mac = netdev_priv(dev); struct mtk_eth *eth = mac->hw; @@ -88,7 +89,7 @@ Signed-off-by: Lorenzo Bianconi phylink_stop(mac->phylink); -@@ -3009,8 +3014,8 @@ static int mtk_stop(struct net_device *d +@@ -3011,8 +3016,8 @@ static int mtk_stop(struct net_device *d mtk_dma_free(eth); @@ -99,7 +100,7 @@ Signed-off-by: Lorenzo Bianconi return 0; } -@@ -4050,12 +4055,19 @@ static int mtk_probe(struct platform_dev +@@ -4052,12 +4057,19 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch b/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch index e984f4b68b2..9ac6875da14 100644 --- a/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch +++ b/target/linux/generic/backport-5.15/716-v6.0-net-ethernet-mtk_eth_soc-move-wdma_base-definitions-.patch @@ -39,7 +39,7 @@ Signed-off-by: Lorenzo Bianconi }; /* strings used by ethtool */ -@@ -3967,16 +3975,12 @@ static int mtk_probe(struct platform_dev +@@ -3969,16 +3977,12 @@ static int mtk_probe(struct platform_dev for (i = 0;; i++) { struct device_node *np = of_parse_phandle(pdev->dev.of_node, "mediatek,wed", i); diff --git a/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch b/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch index c24bd8022c9..16bc8e29fc1 100644 --- a/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch +++ b/target/linux/generic/backport-5.15/717-v6.0-net-ethernet-mtk_eth_soc-add-foe_entry_size-to-mtk_e.patch @@ -21,7 +21,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4165,6 +4165,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4167,6 +4167,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -29,7 +29,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4184,6 +4185,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4186,6 +4187,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -37,7 +37,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4202,6 +4204,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4204,6 +4206,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .offload_version = 2, .hash_offset = 2, diff --git a/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch b/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch index 71bfcdbac8b..cd841d2dafc 100644 --- a/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch +++ b/target/linux/generic/backport-5.15/721-v6.0-net-ethernet-mtk_eth_wed-add-wed-support-for-mt7986-.patch @@ -26,7 +26,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3892,6 +3892,7 @@ void mtk_eth_set_dma_device(struct mtk_e +@@ -3894,6 +3894,7 @@ void mtk_eth_set_dma_device(struct mtk_e static int mtk_probe(struct platform_device *pdev) { @@ -34,7 +34,7 @@ Signed-off-by: Lorenzo Bianconi struct device_node *mac_np; struct mtk_eth *eth; int err, i; -@@ -3972,16 +3973,31 @@ static int mtk_probe(struct platform_dev +@@ -3974,16 +3975,31 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch b/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch index 1ecbf485f1d..2fb0b1dfd67 100644 --- a/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch +++ b/target/linux/generic/backport-5.15/723-v6.0-net-ethernet-mtk_eth_soc-introduce-flow-offloading-s.patch @@ -49,7 +49,7 @@ Signed-off-by: Lorenzo Bianconi if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED) mtk_ppe_check_skb(eth->ppe[0], skb, hash); -@@ -4181,7 +4182,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4183,7 +4184,7 @@ static const struct mtk_soc_data mt7621_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -58,7 +58,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4201,7 +4202,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4203,7 +4204,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -67,7 +67,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4220,7 +4221,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4222,7 +4223,7 @@ static const struct mtk_soc_data mt7623_ .required_pctl = true, .offload_version = 2, .hash_offset = 2, @@ -76,7 +76,7 @@ Signed-off-by: Lorenzo Bianconi .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4252,9 +4253,11 @@ static const struct mtk_soc_data mt7986_ +@@ -4254,9 +4255,11 @@ static const struct mtk_soc_data mt7986_ .reg_map = &mt7986_reg_map, .ana_rgc3 = 0x128, .caps = MT7986_CAPS, diff --git a/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch b/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch index 037e9d44438..5b94c3ad3a0 100644 --- a/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch +++ b/target/linux/generic/backport-5.15/724-v6.0-net-ethernet-mtk_eth_soc-enable-flow-offloading-supp.patch @@ -16,7 +16,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4256,6 +4256,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4258,6 +4258,7 @@ static const struct mtk_soc_data mt7986_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7986_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch b/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch index c419fc8130e..08ec7e1ab94 100644 --- a/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch +++ b/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4008,19 +4008,23 @@ static int mtk_probe(struct platform_dev +@@ -4010,19 +4010,23 @@ static int mtk_probe(struct platform_dev eth->irq[i] = platform_get_irq(pdev, i); if (eth->irq[i] < 0) { dev_err(&pdev->dev, "no IRQ%d resource found\n", i); @@ -45,7 +45,7 @@ Signed-off-by: David S. Miller } eth->clks[i] = NULL; } -@@ -4031,7 +4035,7 @@ static int mtk_probe(struct platform_dev +@@ -4033,7 +4037,7 @@ static int mtk_probe(struct platform_dev err = mtk_hw_init(eth); if (err) @@ -54,7 +54,7 @@ Signed-off-by: David S. Miller eth->hwlro = MTK_HAS_CAPS(eth->soc->caps, MTK_HWLRO); -@@ -4129,6 +4133,8 @@ err_free_dev: +@@ -4131,6 +4135,8 @@ err_free_dev: mtk_free_dev(eth); err_deinit_hw: mtk_hw_deinit(eth); @@ -63,7 +63,7 @@ Signed-off-by: David S. Miller return err; } -@@ -4148,6 +4154,7 @@ static int mtk_remove(struct platform_de +@@ -4150,6 +4156,7 @@ static int mtk_remove(struct platform_de phylink_disconnect_phy(mac->phylink); } diff --git a/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch b/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch index 78a5494bf25..7890c995517 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-01-net-ethernet-stmicro-stmmac-move-queue-reset-to-dedi.patch @@ -27,7 +27,7 @@ Signed-off-by: Jakub Kicinski static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue); static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int queue); -@@ -1697,9 +1700,6 @@ static int __init_dma_rx_desc_rings(stru +@@ -1705,9 +1708,6 @@ static int __init_dma_rx_desc_rings(stru return -ENOMEM; } @@ -37,7 +37,7 @@ Signed-off-by: Jakub Kicinski /* Setup the chained descriptor addresses */ if (priv->mode == STMMAC_CHAIN_MODE) { if (priv->extend_desc) -@@ -1805,12 +1805,6 @@ static int __init_dma_tx_desc_rings(stru +@@ -1813,12 +1813,6 @@ static int __init_dma_tx_desc_rings(stru tx_q->tx_skbuff[i] = NULL; } @@ -50,7 +50,7 @@ Signed-off-by: Jakub Kicinski return 0; } -@@ -2679,10 +2673,7 @@ static void stmmac_tx_err(struct stmmac_ +@@ -2687,10 +2681,7 @@ static void stmmac_tx_err(struct stmmac_ stmmac_stop_tx_dma(priv, chan); dma_free_tx_skbufs(priv, chan); stmmac_clear_tx_descriptors(priv, chan); @@ -62,7 +62,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); stmmac_start_tx_dma(priv, chan); -@@ -3766,6 +3757,8 @@ static int stmmac_open(struct net_device +@@ -3774,6 +3765,8 @@ static int stmmac_open(struct net_device } } @@ -71,7 +71,7 @@ Signed-off-by: Jakub Kicinski ret = stmmac_hw_setup(dev, true); if (ret < 0) { netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); -@@ -6409,6 +6402,7 @@ void stmmac_enable_rx_queue(struct stmma +@@ -6417,6 +6410,7 @@ void stmmac_enable_rx_queue(struct stmma return; } @@ -79,7 +79,7 @@ Signed-off-by: Jakub Kicinski stmmac_clear_rx_descriptors(priv, queue); stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, -@@ -6470,6 +6464,7 @@ void stmmac_enable_tx_queue(struct stmma +@@ -6478,6 +6472,7 @@ void stmmac_enable_tx_queue(struct stmma return; } @@ -87,7 +87,7 @@ Signed-off-by: Jakub Kicinski stmmac_clear_tx_descriptors(priv, queue); stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, -@@ -7390,6 +7385,25 @@ int stmmac_suspend(struct device *dev) +@@ -7398,6 +7393,25 @@ int stmmac_suspend(struct device *dev) } EXPORT_SYMBOL_GPL(stmmac_suspend); @@ -113,7 +113,7 @@ Signed-off-by: Jakub Kicinski /** * stmmac_reset_queues_param - reset queue parameters * @priv: device pointer -@@ -7400,22 +7414,11 @@ static void stmmac_reset_queues_param(st +@@ -7408,22 +7422,11 @@ static void stmmac_reset_queues_param(st u32 tx_cnt = priv->plat->tx_queues_to_use; u32 queue; diff --git a/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch b/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch index 0bb28c79e7f..ee3b92f06ba 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -3818,8 +3818,6 @@ static int stmmac_release(struct net_dev +@@ -3826,8 +3826,6 @@ static int stmmac_release(struct net_dev struct stmmac_priv *priv = netdev_priv(dev); u32 chan; @@ -26,7 +26,7 @@ Signed-off-by: Jakub Kicinski if (device_may_wakeup(priv->device)) phylink_speed_down(priv->phylink, false); /* Stop and disconnect the PHY */ -@@ -3831,6 +3829,8 @@ static int stmmac_release(struct net_dev +@@ -3839,6 +3837,8 @@ static int stmmac_release(struct net_dev for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) hrtimer_cancel(&priv->tx_queue[chan].txtimer); diff --git a/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch b/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch index 5cfb14aaab1..46375a6fa98 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-03-net-ethernet-stmicro-stmmac-move-dma-conf-to-dedicat.patch @@ -189,7 +189,7 @@ Signed-off-by: Jakub Kicinski if (tx_q->dirty_tx != tx_q->cur_tx) return -EBUSY; /* still unfinished work */ -@@ -1294,7 +1294,7 @@ static void stmmac_display_rx_rings(stru +@@ -1302,7 +1302,7 @@ static void stmmac_display_rx_rings(stru /* Display RX rings */ for (queue = 0; queue < rx_cnt; queue++) { @@ -198,7 +198,7 @@ Signed-off-by: Jakub Kicinski pr_info("\tRX Queue %u rings\n", queue); -@@ -1307,7 +1307,7 @@ static void stmmac_display_rx_rings(stru +@@ -1315,7 +1315,7 @@ static void stmmac_display_rx_rings(stru } /* Display RX ring */ @@ -207,7 +207,7 @@ Signed-off-by: Jakub Kicinski rx_q->dma_rx_phy, desc_size); } } -@@ -1321,7 +1321,7 @@ static void stmmac_display_tx_rings(stru +@@ -1329,7 +1329,7 @@ static void stmmac_display_tx_rings(stru /* Display TX rings */ for (queue = 0; queue < tx_cnt; queue++) { @@ -216,7 +216,7 @@ Signed-off-by: Jakub Kicinski pr_info("\tTX Queue %d rings\n", queue); -@@ -1336,7 +1336,7 @@ static void stmmac_display_tx_rings(stru +@@ -1344,7 +1344,7 @@ static void stmmac_display_tx_rings(stru desc_size = sizeof(struct dma_desc); } @@ -225,7 +225,7 @@ Signed-off-by: Jakub Kicinski tx_q->dma_tx_phy, desc_size); } } -@@ -1377,21 +1377,21 @@ static int stmmac_set_bfsize(int mtu, in +@@ -1385,21 +1385,21 @@ static int stmmac_set_bfsize(int mtu, in */ static void stmmac_clear_rx_descriptors(struct stmmac_priv *priv, u32 queue) { @@ -253,7 +253,7 @@ Signed-off-by: Jakub Kicinski } /** -@@ -1403,12 +1403,12 @@ static void stmmac_clear_rx_descriptors( +@@ -1411,12 +1411,12 @@ static void stmmac_clear_rx_descriptors( */ static void stmmac_clear_tx_descriptors(struct stmmac_priv *priv, u32 queue) { @@ -269,7 +269,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; if (priv->extend_desc) -@@ -1456,7 +1456,7 @@ static void stmmac_clear_descriptors(str +@@ -1464,7 +1464,7 @@ static void stmmac_clear_descriptors(str static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, int i, gfp_t flags, u32 queue) { @@ -278,7 +278,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (!buf->page) { -@@ -1481,7 +1481,7 @@ static int stmmac_init_rx_buffers(struct +@@ -1489,7 +1489,7 @@ static int stmmac_init_rx_buffers(struct buf->addr = page_pool_get_dma_addr(buf->page) + buf->page_offset; stmmac_set_desc_addr(priv, p, buf->addr); @@ -287,7 +287,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_desc3(priv, p); return 0; -@@ -1495,7 +1495,7 @@ static int stmmac_init_rx_buffers(struct +@@ -1503,7 +1503,7 @@ static int stmmac_init_rx_buffers(struct */ static void stmmac_free_rx_buffer(struct stmmac_priv *priv, u32 queue, int i) { @@ -296,7 +296,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (buf->page) -@@ -1515,7 +1515,7 @@ static void stmmac_free_rx_buffer(struct +@@ -1523,7 +1523,7 @@ static void stmmac_free_rx_buffer(struct */ static void stmmac_free_tx_buffer(struct stmmac_priv *priv, u32 queue, int i) { @@ -305,7 +305,7 @@ Signed-off-by: Jakub Kicinski if (tx_q->tx_skbuff_dma[i].buf && tx_q->tx_skbuff_dma[i].buf_type != STMMAC_TXBUF_T_XDP_TX) { -@@ -1560,17 +1560,17 @@ static void dma_free_rx_skbufs(struct st +@@ -1568,17 +1568,17 @@ static void dma_free_rx_skbufs(struct st { int i; @@ -326,7 +326,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; int ret; -@@ -1597,10 +1597,10 @@ static int stmmac_alloc_rx_buffers(struc +@@ -1605,10 +1605,10 @@ static int stmmac_alloc_rx_buffers(struc */ static void dma_free_rx_xskbufs(struct stmmac_priv *priv, u32 queue) { @@ -339,7 +339,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (!buf->xdp) -@@ -1613,10 +1613,10 @@ static void dma_free_rx_xskbufs(struct s +@@ -1621,10 +1621,10 @@ static void dma_free_rx_xskbufs(struct s static int stmmac_alloc_rx_buffers_zc(struct stmmac_priv *priv, u32 queue) { @@ -352,7 +352,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf; dma_addr_t dma_addr; struct dma_desc *p; -@@ -1659,7 +1659,7 @@ static struct xsk_buff_pool *stmmac_get_ +@@ -1667,7 +1667,7 @@ static struct xsk_buff_pool *stmmac_get_ */ static int __init_dma_rx_desc_rings(struct stmmac_priv *priv, u32 queue, gfp_t flags) { @@ -361,7 +361,7 @@ Signed-off-by: Jakub Kicinski int ret; netif_dbg(priv, probe, priv->dev, -@@ -1705,11 +1705,11 @@ static int __init_dma_rx_desc_rings(stru +@@ -1713,11 +1713,11 @@ static int __init_dma_rx_desc_rings(stru if (priv->extend_desc) stmmac_mode_init(priv, rx_q->dma_erx, rx_q->dma_rx_phy, @@ -375,7 +375,7 @@ Signed-off-by: Jakub Kicinski } return 0; -@@ -1736,7 +1736,7 @@ static int init_dma_rx_desc_rings(struct +@@ -1744,7 +1744,7 @@ static int init_dma_rx_desc_rings(struct err_init_rx_buffers: while (queue >= 0) { @@ -384,7 +384,7 @@ Signed-off-by: Jakub Kicinski if (rx_q->xsk_pool) dma_free_rx_xskbufs(priv, queue); -@@ -1765,7 +1765,7 @@ err_init_rx_buffers: +@@ -1773,7 +1773,7 @@ err_init_rx_buffers: */ static int __init_dma_tx_desc_rings(struct stmmac_priv *priv, u32 queue) { @@ -393,7 +393,7 @@ Signed-off-by: Jakub Kicinski int i; netif_dbg(priv, probe, priv->dev, -@@ -1777,16 +1777,16 @@ static int __init_dma_tx_desc_rings(stru +@@ -1785,16 +1785,16 @@ static int __init_dma_tx_desc_rings(stru if (priv->extend_desc) stmmac_mode_init(priv, tx_q->dma_etx, tx_q->dma_tx_phy, @@ -413,7 +413,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; if (priv->extend_desc) -@@ -1856,12 +1856,12 @@ static int init_dma_desc_rings(struct ne +@@ -1864,12 +1864,12 @@ static int init_dma_desc_rings(struct ne */ static void dma_free_tx_skbufs(struct stmmac_priv *priv, u32 queue) { @@ -428,7 +428,7 @@ Signed-off-by: Jakub Kicinski stmmac_free_tx_buffer(priv, queue, i); if (tx_q->xsk_pool && tx_q->xsk_frames_done) { -@@ -1891,7 +1891,7 @@ static void stmmac_free_tx_skbufs(struct +@@ -1899,7 +1899,7 @@ static void stmmac_free_tx_skbufs(struct */ static void __free_dma_rx_desc_resources(struct stmmac_priv *priv, u32 queue) { @@ -437,7 +437,7 @@ Signed-off-by: Jakub Kicinski /* Release the DMA RX socket buffers */ if (rx_q->xsk_pool) -@@ -1904,11 +1904,11 @@ static void __free_dma_rx_desc_resources +@@ -1912,11 +1912,11 @@ static void __free_dma_rx_desc_resources /* Free DMA regions of consistent memory previously allocated */ if (!priv->extend_desc) @@ -451,7 +451,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_extended_desc), rx_q->dma_erx, rx_q->dma_rx_phy); -@@ -1937,7 +1937,7 @@ static void free_dma_rx_desc_resources(s +@@ -1945,7 +1945,7 @@ static void free_dma_rx_desc_resources(s */ static void __free_dma_tx_desc_resources(struct stmmac_priv *priv, u32 queue) { @@ -460,7 +460,7 @@ Signed-off-by: Jakub Kicinski size_t size; void *addr; -@@ -1955,7 +1955,7 @@ static void __free_dma_tx_desc_resources +@@ -1963,7 +1963,7 @@ static void __free_dma_tx_desc_resources addr = tx_q->dma_tx; } @@ -469,7 +469,7 @@ Signed-off-by: Jakub Kicinski dma_free_coherent(priv->device, size, addr, tx_q->dma_tx_phy); -@@ -1984,7 +1984,7 @@ static void free_dma_tx_desc_resources(s +@@ -1992,7 +1992,7 @@ static void free_dma_tx_desc_resources(s */ static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv, u32 queue) { @@ -478,7 +478,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; bool xdp_prog = stmmac_xdp_is_enabled(priv); struct page_pool_params pp_params = { 0 }; -@@ -1996,8 +1996,8 @@ static int __alloc_dma_rx_desc_resources +@@ -2004,8 +2004,8 @@ static int __alloc_dma_rx_desc_resources rx_q->priv_data = priv; pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV; @@ -489,7 +489,7 @@ Signed-off-by: Jakub Kicinski pp_params.order = ilog2(num_pages); pp_params.nid = dev_to_node(priv->device); pp_params.dev = priv->device; -@@ -2012,7 +2012,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2020,7 +2020,7 @@ static int __alloc_dma_rx_desc_resources return ret; } @@ -498,7 +498,7 @@ Signed-off-by: Jakub Kicinski sizeof(*rx_q->buf_pool), GFP_KERNEL); if (!rx_q->buf_pool) -@@ -2020,7 +2020,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2028,7 +2028,7 @@ static int __alloc_dma_rx_desc_resources if (priv->extend_desc) { rx_q->dma_erx = dma_alloc_coherent(priv->device, @@ -507,7 +507,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_extended_desc), &rx_q->dma_rx_phy, GFP_KERNEL); -@@ -2029,7 +2029,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2037,7 +2037,7 @@ static int __alloc_dma_rx_desc_resources } else { rx_q->dma_rx = dma_alloc_coherent(priv->device, @@ -516,7 +516,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_desc), &rx_q->dma_rx_phy, GFP_KERNEL); -@@ -2086,20 +2086,20 @@ err_dma: +@@ -2094,20 +2094,20 @@ err_dma: */ static int __alloc_dma_tx_desc_resources(struct stmmac_priv *priv, u32 queue) { @@ -540,7 +540,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct sk_buff *), GFP_KERNEL); if (!tx_q->tx_skbuff) -@@ -2112,7 +2112,7 @@ static int __alloc_dma_tx_desc_resources +@@ -2120,7 +2120,7 @@ static int __alloc_dma_tx_desc_resources else size = sizeof(struct dma_desc); @@ -549,7 +549,7 @@ Signed-off-by: Jakub Kicinski addr = dma_alloc_coherent(priv->device, size, &tx_q->dma_tx_phy, GFP_KERNEL); -@@ -2356,7 +2356,7 @@ static void stmmac_dma_operation_mode(st +@@ -2364,7 +2364,7 @@ static void stmmac_dma_operation_mode(st /* configure all channels */ for (chan = 0; chan < rx_channels_count; chan++) { @@ -558,7 +558,7 @@ Signed-off-by: Jakub Kicinski u32 buf_size; qmode = priv->plat->rx_queues_cfg[chan].mode_to_use; -@@ -2371,7 +2371,7 @@ static void stmmac_dma_operation_mode(st +@@ -2379,7 +2379,7 @@ static void stmmac_dma_operation_mode(st chan); } else { stmmac_set_dma_bfsize(priv, priv->ioaddr, @@ -567,7 +567,7 @@ Signed-off-by: Jakub Kicinski chan); } } -@@ -2387,7 +2387,7 @@ static void stmmac_dma_operation_mode(st +@@ -2395,7 +2395,7 @@ static void stmmac_dma_operation_mode(st static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) { struct netdev_queue *nq = netdev_get_tx_queue(priv->dev, queue); @@ -576,7 +576,7 @@ Signed-off-by: Jakub Kicinski struct xsk_buff_pool *pool = tx_q->xsk_pool; unsigned int entry = tx_q->cur_tx; struct dma_desc *tx_desc = NULL; -@@ -2462,7 +2462,7 @@ static bool stmmac_xdp_xmit_zc(struct st +@@ -2470,7 +2470,7 @@ static bool stmmac_xdp_xmit_zc(struct st stmmac_enable_dma_transmission(priv, priv->ioaddr); @@ -585,7 +585,7 @@ Signed-off-by: Jakub Kicinski entry = tx_q->cur_tx; } -@@ -2488,7 +2488,7 @@ static bool stmmac_xdp_xmit_zc(struct st +@@ -2496,7 +2496,7 @@ static bool stmmac_xdp_xmit_zc(struct st */ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue) { @@ -594,7 +594,7 @@ Signed-off-by: Jakub Kicinski unsigned int bytes_compl = 0, pkts_compl = 0; unsigned int entry, xmits = 0, count = 0; -@@ -2501,7 +2501,7 @@ static int stmmac_tx_clean(struct stmmac +@@ -2509,7 +2509,7 @@ static int stmmac_tx_clean(struct stmmac entry = tx_q->dirty_tx; /* Try to clean all TX complete frame in 1 shot */ @@ -603,7 +603,7 @@ Signed-off-by: Jakub Kicinski struct xdp_frame *xdpf; struct sk_buff *skb; struct dma_desc *p; -@@ -2601,7 +2601,7 @@ static int stmmac_tx_clean(struct stmmac +@@ -2609,7 +2609,7 @@ static int stmmac_tx_clean(struct stmmac stmmac_release_tx_desc(priv, p, priv->mode); @@ -612,7 +612,7 @@ Signed-off-by: Jakub Kicinski } tx_q->dirty_tx = entry; -@@ -2666,7 +2666,7 @@ static int stmmac_tx_clean(struct stmmac +@@ -2674,7 +2674,7 @@ static int stmmac_tx_clean(struct stmmac */ static void stmmac_tx_err(struct stmmac_priv *priv, u32 chan) { @@ -621,7 +621,7 @@ Signed-off-by: Jakub Kicinski netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, chan)); -@@ -2733,8 +2733,8 @@ static int stmmac_napi_check(struct stmm +@@ -2741,8 +2741,8 @@ static int stmmac_napi_check(struct stmm { int status = stmmac_dma_interrupt_status(priv, priv->ioaddr, &priv->xstats, chan, dir); @@ -632,7 +632,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[chan]; struct napi_struct *rx_napi; struct napi_struct *tx_napi; -@@ -2910,7 +2910,7 @@ static int stmmac_init_dma_engine(struct +@@ -2918,7 +2918,7 @@ static int stmmac_init_dma_engine(struct /* DMA RX Channel Configuration */ for (chan = 0; chan < rx_channels_count; chan++) { @@ -641,7 +641,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, rx_q->dma_rx_phy, chan); -@@ -2924,7 +2924,7 @@ static int stmmac_init_dma_engine(struct +@@ -2932,7 +2932,7 @@ static int stmmac_init_dma_engine(struct /* DMA TX Channel Configuration */ for (chan = 0; chan < tx_channels_count; chan++) { @@ -650,7 +650,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); -@@ -2939,7 +2939,7 @@ static int stmmac_init_dma_engine(struct +@@ -2947,7 +2947,7 @@ static int stmmac_init_dma_engine(struct static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue) { @@ -659,7 +659,7 @@ Signed-off-by: Jakub Kicinski hrtimer_start(&tx_q->txtimer, STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]), -@@ -2989,7 +2989,7 @@ static void stmmac_init_coalesce(struct +@@ -2997,7 +2997,7 @@ static void stmmac_init_coalesce(struct u32 chan; for (chan = 0; chan < tx_channel_count; chan++) { @@ -668,7 +668,7 @@ Signed-off-by: Jakub Kicinski priv->tx_coal_frames[chan] = STMMAC_TX_FRAMES; priv->tx_coal_timer[chan] = STMMAC_COAL_TX_TIMER; -@@ -3011,12 +3011,12 @@ static void stmmac_set_rings_length(stru +@@ -3019,12 +3019,12 @@ static void stmmac_set_rings_length(stru /* set TX ring length */ for (chan = 0; chan < tx_channels_count; chan++) stmmac_set_tx_ring_len(priv, priv->ioaddr, @@ -683,7 +683,7 @@ Signed-off-by: Jakub Kicinski } /** -@@ -3351,7 +3351,7 @@ static int stmmac_hw_setup(struct net_de +@@ -3359,7 +3359,7 @@ static int stmmac_hw_setup(struct net_de /* Enable TSO */ if (priv->tso) { for (chan = 0; chan < tx_cnt; chan++) { @@ -692,7 +692,7 @@ Signed-off-by: Jakub Kicinski /* TSO and TBS cannot co-exist */ if (tx_q->tbs & STMMAC_TBS_AVAIL) -@@ -3373,7 +3373,7 @@ static int stmmac_hw_setup(struct net_de +@@ -3381,7 +3381,7 @@ static int stmmac_hw_setup(struct net_de /* TBS */ for (chan = 0; chan < tx_cnt; chan++) { @@ -701,7 +701,7 @@ Signed-off-by: Jakub Kicinski int enable = tx_q->tbs & STMMAC_TBS_AVAIL; stmmac_enable_tbs(priv, priv->ioaddr, enable, chan); -@@ -3417,7 +3417,7 @@ static void stmmac_free_irq(struct net_d +@@ -3425,7 +3425,7 @@ static void stmmac_free_irq(struct net_d for (j = irq_idx - 1; j >= 0; j--) { if (priv->tx_irq[j] > 0) { irq_set_affinity_hint(priv->tx_irq[j], NULL); @@ -710,7 +710,7 @@ Signed-off-by: Jakub Kicinski } } irq_idx = priv->plat->rx_queues_to_use; -@@ -3426,7 +3426,7 @@ static void stmmac_free_irq(struct net_d +@@ -3434,7 +3434,7 @@ static void stmmac_free_irq(struct net_d for (j = irq_idx - 1; j >= 0; j--) { if (priv->rx_irq[j] > 0) { irq_set_affinity_hint(priv->rx_irq[j], NULL); @@ -719,7 +719,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -3559,7 +3559,7 @@ static int stmmac_request_irq_multi_msi( +@@ -3567,7 +3567,7 @@ static int stmmac_request_irq_multi_msi( sprintf(int_name, "%s:%s-%d", dev->name, "rx", i); ret = request_irq(priv->rx_irq[i], stmmac_msi_intr_rx, @@ -728,7 +728,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: alloc rx-%d MSI %d (error: %d)\n", -@@ -3582,7 +3582,7 @@ static int stmmac_request_irq_multi_msi( +@@ -3590,7 +3590,7 @@ static int stmmac_request_irq_multi_msi( sprintf(int_name, "%s:%s-%d", dev->name, "tx", i); ret = request_irq(priv->tx_irq[i], stmmac_msi_intr_tx, @@ -737,7 +737,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(ret < 0)) { netdev_err(priv->dev, "%s: alloc tx-%d MSI %d (error: %d)\n", -@@ -3713,21 +3713,21 @@ static int stmmac_open(struct net_device +@@ -3721,21 +3721,21 @@ static int stmmac_open(struct net_device bfsize = 0; if (bfsize < BUF_SIZE_16KiB) @@ -766,7 +766,7 @@ Signed-off-by: Jakub Kicinski int tbs_en = priv->plat->tx_queues_cfg[chan].tbs_en; /* Setup per-TXQ tbs flag before TX descriptor alloc */ -@@ -3785,7 +3785,7 @@ irq_error: +@@ -3793,7 +3793,7 @@ irq_error: phylink_stop(priv->phylink); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -775,7 +775,7 @@ Signed-off-by: Jakub Kicinski stmmac_hw_teardown(dev); init_error: -@@ -3827,7 +3827,7 @@ static int stmmac_release(struct net_dev +@@ -3835,7 +3835,7 @@ static int stmmac_release(struct net_dev stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -784,7 +784,7 @@ Signed-off-by: Jakub Kicinski netif_tx_disable(dev); -@@ -3891,7 +3891,7 @@ static bool stmmac_vlan_insert(struct st +@@ -3899,7 +3899,7 @@ static bool stmmac_vlan_insert(struct st return false; stmmac_set_tx_owner(priv, p); @@ -793,7 +793,7 @@ Signed-off-by: Jakub Kicinski return true; } -@@ -3909,7 +3909,7 @@ static bool stmmac_vlan_insert(struct st +@@ -3917,7 +3917,7 @@ static bool stmmac_vlan_insert(struct st static void stmmac_tso_allocator(struct stmmac_priv *priv, dma_addr_t des, int total_len, bool last_segment, u32 queue) { @@ -802,7 +802,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *desc; u32 buff_size; int tmp_len; -@@ -3920,7 +3920,7 @@ static void stmmac_tso_allocator(struct +@@ -3928,7 +3928,7 @@ static void stmmac_tso_allocator(struct dma_addr_t curr_addr; tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, @@ -811,7 +811,7 @@ Signed-off-by: Jakub Kicinski WARN_ON(tx_q->tx_skbuff[tx_q->cur_tx]); if (tx_q->tbs & STMMAC_TBS_AVAIL) -@@ -3948,7 +3948,7 @@ static void stmmac_tso_allocator(struct +@@ -3956,7 +3956,7 @@ static void stmmac_tso_allocator(struct static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int queue) { @@ -820,7 +820,7 @@ Signed-off-by: Jakub Kicinski int desc_size; if (likely(priv->extend_desc)) -@@ -4010,7 +4010,7 @@ static netdev_tx_t stmmac_tso_xmit(struc +@@ -4018,7 +4018,7 @@ static netdev_tx_t stmmac_tso_xmit(struc dma_addr_t des; int i; @@ -829,7 +829,7 @@ Signed-off-by: Jakub Kicinski first_tx = tx_q->cur_tx; /* Compute header lengths */ -@@ -4050,7 +4050,7 @@ static netdev_tx_t stmmac_tso_xmit(struc +@@ -4058,7 +4058,7 @@ static netdev_tx_t stmmac_tso_xmit(struc stmmac_set_mss(priv, mss_desc, mss); tx_q->mss = mss; tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, @@ -838,7 +838,7 @@ Signed-off-by: Jakub Kicinski WARN_ON(tx_q->tx_skbuff[tx_q->cur_tx]); } -@@ -4162,7 +4162,7 @@ static netdev_tx_t stmmac_tso_xmit(struc +@@ -4170,7 +4170,7 @@ static netdev_tx_t stmmac_tso_xmit(struc * ndo_start_xmit will fill this descriptor the next time it's * called and stmmac_tx_clean may clean up to this descriptor. */ @@ -847,7 +847,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(stmmac_tx_avail(priv, queue) <= (MAX_SKB_FRAGS + 1))) { netif_dbg(priv, hw, priv->dev, "%s: stop transmitted packets\n", -@@ -4250,7 +4250,7 @@ static netdev_tx_t stmmac_xmit(struct sk +@@ -4258,7 +4258,7 @@ static netdev_tx_t stmmac_xmit(struct sk int entry, first_tx; dma_addr_t des; @@ -856,7 +856,7 @@ Signed-off-by: Jakub Kicinski first_tx = tx_q->cur_tx; if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en) -@@ -4313,7 +4313,7 @@ static netdev_tx_t stmmac_xmit(struct sk +@@ -4321,7 +4321,7 @@ static netdev_tx_t stmmac_xmit(struct sk int len = skb_frag_size(frag); bool last_segment = (i == (nfrags - 1)); @@ -865,7 +865,7 @@ Signed-off-by: Jakub Kicinski WARN_ON(tx_q->tx_skbuff[entry]); if (likely(priv->extend_desc)) -@@ -4384,7 +4384,7 @@ static netdev_tx_t stmmac_xmit(struct sk +@@ -4392,7 +4392,7 @@ static netdev_tx_t stmmac_xmit(struct sk * ndo_start_xmit will fill this descriptor the next time it's * called and stmmac_tx_clean may clean up to this descriptor. */ @@ -874,7 +874,7 @@ Signed-off-by: Jakub Kicinski tx_q->cur_tx = entry; if (netif_msg_pktdata(priv)) { -@@ -4499,7 +4499,7 @@ static void stmmac_rx_vlan(struct net_de +@@ -4507,7 +4507,7 @@ static void stmmac_rx_vlan(struct net_de */ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) { @@ -883,7 +883,7 @@ Signed-off-by: Jakub Kicinski int dirty = stmmac_rx_dirty(priv, queue); unsigned int entry = rx_q->dirty_rx; -@@ -4549,7 +4549,7 @@ static inline void stmmac_rx_refill(stru +@@ -4557,7 +4557,7 @@ static inline void stmmac_rx_refill(stru dma_wmb(); stmmac_set_rx_owner(priv, p, use_rx_wd); @@ -892,7 +892,7 @@ Signed-off-by: Jakub Kicinski } rx_q->dirty_rx = entry; rx_q->rx_tail_addr = rx_q->dma_rx_phy + -@@ -4577,12 +4577,12 @@ static unsigned int stmmac_rx_buf1_len(s +@@ -4585,12 +4585,12 @@ static unsigned int stmmac_rx_buf1_len(s /* First descriptor, not last descriptor and not split header */ if (status & rx_not_ls) @@ -907,7 +907,7 @@ Signed-off-by: Jakub Kicinski } static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv, -@@ -4598,7 +4598,7 @@ static unsigned int stmmac_rx_buf2_len(s +@@ -4606,7 +4606,7 @@ static unsigned int stmmac_rx_buf2_len(s /* Not last descriptor */ if (status & rx_not_ls) @@ -916,7 +916,7 @@ Signed-off-by: Jakub Kicinski plen = stmmac_get_rx_frame_len(priv, p, coe); -@@ -4609,7 +4609,7 @@ static unsigned int stmmac_rx_buf2_len(s +@@ -4617,7 +4617,7 @@ static unsigned int stmmac_rx_buf2_len(s static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue, struct xdp_frame *xdpf, bool dma_map) { @@ -925,7 +925,7 @@ Signed-off-by: Jakub Kicinski unsigned int entry = tx_q->cur_tx; struct dma_desc *tx_desc; dma_addr_t dma_addr; -@@ -4672,7 +4672,7 @@ static int stmmac_xdp_xmit_xdpf(struct s +@@ -4680,7 +4680,7 @@ static int stmmac_xdp_xmit_xdpf(struct s stmmac_enable_dma_transmission(priv, priv->ioaddr); @@ -934,7 +934,7 @@ Signed-off-by: Jakub Kicinski tx_q->cur_tx = entry; return STMMAC_XDP_TX; -@@ -4846,7 +4846,7 @@ static void stmmac_dispatch_skb_zc(struc +@@ -4854,7 +4854,7 @@ static void stmmac_dispatch_skb_zc(struc static bool stmmac_rx_refill_zc(struct stmmac_priv *priv, u32 queue, u32 budget) { @@ -943,7 +943,7 @@ Signed-off-by: Jakub Kicinski unsigned int entry = rx_q->dirty_rx; struct dma_desc *rx_desc = NULL; bool ret = true; -@@ -4889,7 +4889,7 @@ static bool stmmac_rx_refill_zc(struct s +@@ -4897,7 +4897,7 @@ static bool stmmac_rx_refill_zc(struct s dma_wmb(); stmmac_set_rx_owner(priv, rx_desc, use_rx_wd); @@ -952,7 +952,7 @@ Signed-off-by: Jakub Kicinski } if (rx_desc) { -@@ -4904,7 +4904,7 @@ static bool stmmac_rx_refill_zc(struct s +@@ -4912,7 +4912,7 @@ static bool stmmac_rx_refill_zc(struct s static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue) { @@ -961,7 +961,7 @@ Signed-off-by: Jakub Kicinski unsigned int count = 0, error = 0, len = 0; int dirty = stmmac_rx_dirty(priv, queue); unsigned int next_entry = rx_q->cur_rx; -@@ -4926,7 +4926,7 @@ static int stmmac_rx_zc(struct stmmac_pr +@@ -4934,7 +4934,7 @@ static int stmmac_rx_zc(struct stmmac_pr desc_size = sizeof(struct dma_desc); } @@ -970,7 +970,7 @@ Signed-off-by: Jakub Kicinski rx_q->dma_rx_phy, desc_size); } while (count < limit) { -@@ -4973,7 +4973,7 @@ read_again: +@@ -4981,7 +4981,7 @@ read_again: /* Prefetch the next RX descriptor */ rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, @@ -979,7 +979,7 @@ Signed-off-by: Jakub Kicinski next_entry = rx_q->cur_rx; if (priv->extend_desc) -@@ -5094,7 +5094,7 @@ read_again: +@@ -5102,7 +5102,7 @@ read_again: */ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) { @@ -988,7 +988,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; unsigned int count = 0, error = 0, len = 0; int status = 0, coe = priv->hw->rx_csum; -@@ -5107,7 +5107,7 @@ static int stmmac_rx(struct stmmac_priv +@@ -5115,7 +5115,7 @@ static int stmmac_rx(struct stmmac_priv int buf_sz; dma_dir = page_pool_get_dma_dir(rx_q->page_pool); @@ -997,7 +997,7 @@ Signed-off-by: Jakub Kicinski if (netif_msg_rx_status(priv)) { void *rx_head; -@@ -5121,7 +5121,7 @@ static int stmmac_rx(struct stmmac_priv +@@ -5129,7 +5129,7 @@ static int stmmac_rx(struct stmmac_priv desc_size = sizeof(struct dma_desc); } @@ -1006,7 +1006,7 @@ Signed-off-by: Jakub Kicinski rx_q->dma_rx_phy, desc_size); } while (count < limit) { -@@ -5165,7 +5165,7 @@ read_again: +@@ -5173,7 +5173,7 @@ read_again: break; rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, @@ -1015,7 +1015,7 @@ Signed-off-by: Jakub Kicinski next_entry = rx_q->cur_rx; if (priv->extend_desc) -@@ -5299,7 +5299,7 @@ read_again: +@@ -5307,7 +5307,7 @@ read_again: buf1_len, dma_dir); skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, buf->page, buf->page_offset, buf1_len, @@ -1024,7 +1024,7 @@ Signed-off-by: Jakub Kicinski /* Data payload appended into SKB */ page_pool_release_page(rx_q->page_pool, buf->page); -@@ -5311,7 +5311,7 @@ read_again: +@@ -5319,7 +5319,7 @@ read_again: buf2_len, dma_dir); skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, buf->sec_page, 0, buf2_len, @@ -1033,7 +1033,7 @@ Signed-off-by: Jakub Kicinski /* Data payload appended into SKB */ page_pool_release_page(rx_q->page_pool, buf->sec_page); -@@ -5753,11 +5753,13 @@ static irqreturn_t stmmac_safety_interru +@@ -5761,11 +5761,13 @@ static irqreturn_t stmmac_safety_interru static irqreturn_t stmmac_msi_intr_tx(int irq, void *data) { struct stmmac_tx_queue *tx_q = (struct stmmac_tx_queue *)data; @@ -1048,7 +1048,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); -@@ -5797,10 +5799,12 @@ static irqreturn_t stmmac_msi_intr_tx(in +@@ -5805,10 +5807,12 @@ static irqreturn_t stmmac_msi_intr_tx(in static irqreturn_t stmmac_msi_intr_rx(int irq, void *data) { struct stmmac_rx_queue *rx_q = (struct stmmac_rx_queue *)data; @@ -1062,7 +1062,7 @@ Signed-off-by: Jakub Kicinski if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); -@@ -5831,10 +5835,10 @@ static void stmmac_poll_controller(struc +@@ -5839,10 +5843,10 @@ static void stmmac_poll_controller(struc if (priv->plat->multi_msi_en) { for (i = 0; i < priv->plat->rx_queues_to_use; i++) @@ -1075,7 +1075,7 @@ Signed-off-by: Jakub Kicinski } else { disable_irq(dev->irq); stmmac_interrupt(dev->irq, dev); -@@ -6015,34 +6019,34 @@ static int stmmac_rings_status_show(stru +@@ -6023,34 +6027,34 @@ static int stmmac_rings_status_show(stru return 0; for (queue = 0; queue < rx_count; queue++) { @@ -1116,7 +1116,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -6383,7 +6387,7 @@ void stmmac_disable_rx_queue(struct stmm +@@ -6391,7 +6395,7 @@ void stmmac_disable_rx_queue(struct stmm void stmmac_enable_rx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1125,7 +1125,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; unsigned long flags; u32 buf_size; -@@ -6420,7 +6424,7 @@ void stmmac_enable_rx_queue(struct stmma +@@ -6428,7 +6432,7 @@ void stmmac_enable_rx_queue(struct stmma rx_q->queue_index); } else { stmmac_set_dma_bfsize(priv, priv->ioaddr, @@ -1134,7 +1134,7 @@ Signed-off-by: Jakub Kicinski rx_q->queue_index); } -@@ -6446,7 +6450,7 @@ void stmmac_disable_tx_queue(struct stmm +@@ -6454,7 +6458,7 @@ void stmmac_disable_tx_queue(struct stmm void stmmac_enable_tx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1143,7 +1143,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; unsigned long flags; int ret; -@@ -6496,7 +6500,7 @@ void stmmac_xdp_release(struct net_devic +@@ -6504,7 +6508,7 @@ void stmmac_xdp_release(struct net_devic stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1152,7 +1152,7 @@ Signed-off-by: Jakub Kicinski /* Free the IRQ lines */ stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0); -@@ -6555,7 +6559,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6563,7 +6567,7 @@ int stmmac_xdp_open(struct net_device *d /* DMA RX Channel Configuration */ for (chan = 0; chan < rx_cnt; chan++) { @@ -1161,7 +1161,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, rx_q->dma_rx_phy, chan); -@@ -6573,7 +6577,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6581,7 +6585,7 @@ int stmmac_xdp_open(struct net_device *d rx_q->queue_index); } else { stmmac_set_dma_bfsize(priv, priv->ioaddr, @@ -1170,7 +1170,7 @@ Signed-off-by: Jakub Kicinski rx_q->queue_index); } -@@ -6582,7 +6586,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6590,7 +6594,7 @@ int stmmac_xdp_open(struct net_device *d /* DMA TX Channel Configuration */ for (chan = 0; chan < tx_cnt; chan++) { @@ -1179,7 +1179,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); -@@ -6615,7 +6619,7 @@ int stmmac_xdp_open(struct net_device *d +@@ -6623,7 +6627,7 @@ int stmmac_xdp_open(struct net_device *d irq_error: for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1188,7 +1188,7 @@ Signed-off-by: Jakub Kicinski stmmac_hw_teardown(dev); init_error: -@@ -6642,8 +6646,8 @@ int stmmac_xsk_wakeup(struct net_device +@@ -6650,8 +6654,8 @@ int stmmac_xsk_wakeup(struct net_device queue >= priv->plat->tx_queues_to_use) return -EINVAL; @@ -1199,7 +1199,7 @@ Signed-off-by: Jakub Kicinski ch = &priv->channel[queue]; if (!rx_q->xsk_pool && !tx_q->xsk_pool) -@@ -6899,8 +6903,8 @@ int stmmac_reinit_ringparam(struct net_d +@@ -6907,8 +6911,8 @@ int stmmac_reinit_ringparam(struct net_d if (netif_running(dev)) stmmac_release(dev); @@ -1210,7 +1210,7 @@ Signed-off-by: Jakub Kicinski if (netif_running(dev)) ret = stmmac_open(dev); -@@ -7336,7 +7340,7 @@ int stmmac_suspend(struct device *dev) +@@ -7344,7 +7348,7 @@ int stmmac_suspend(struct device *dev) stmmac_disable_all_queues(priv); for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) @@ -1219,7 +1219,7 @@ Signed-off-by: Jakub Kicinski if (priv->eee_enabled) { priv->tx_path_in_lpi_mode = false; -@@ -7387,7 +7391,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); +@@ -7395,7 +7399,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); static void stmmac_reset_rx_queue(struct stmmac_priv *priv, u32 queue) { @@ -1228,7 +1228,7 @@ Signed-off-by: Jakub Kicinski rx_q->cur_rx = 0; rx_q->dirty_rx = 0; -@@ -7395,7 +7399,7 @@ static void stmmac_reset_rx_queue(struct +@@ -7403,7 +7407,7 @@ static void stmmac_reset_rx_queue(struct static void stmmac_reset_tx_queue(struct stmmac_priv *priv, u32 queue) { diff --git a/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch b/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch index 4c41d3c7433..12149edbe9e 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-04-net-ethernet-stmicro-stmmac-generate-stmmac-dma-conf.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -1285,7 +1285,8 @@ static int stmmac_phy_setup(struct stmma +@@ -1293,7 +1293,8 @@ static int stmmac_phy_setup(struct stmma return 0; } @@ -27,7 +27,7 @@ Signed-off-by: Jakub Kicinski { u32 rx_cnt = priv->plat->rx_queues_to_use; unsigned int desc_size; -@@ -1294,7 +1295,7 @@ static void stmmac_display_rx_rings(stru +@@ -1302,7 +1303,7 @@ static void stmmac_display_rx_rings(stru /* Display RX rings */ for (queue = 0; queue < rx_cnt; queue++) { @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski pr_info("\tRX Queue %u rings\n", queue); -@@ -1307,12 +1308,13 @@ static void stmmac_display_rx_rings(stru +@@ -1315,12 +1316,13 @@ static void stmmac_display_rx_rings(stru } /* Display RX ring */ @@ -52,7 +52,7 @@ Signed-off-by: Jakub Kicinski { u32 tx_cnt = priv->plat->tx_queues_to_use; unsigned int desc_size; -@@ -1321,7 +1323,7 @@ static void stmmac_display_tx_rings(stru +@@ -1329,7 +1331,7 @@ static void stmmac_display_tx_rings(stru /* Display TX rings */ for (queue = 0; queue < tx_cnt; queue++) { @@ -61,7 +61,7 @@ Signed-off-by: Jakub Kicinski pr_info("\tTX Queue %d rings\n", queue); -@@ -1336,18 +1338,19 @@ static void stmmac_display_tx_rings(stru +@@ -1344,18 +1346,19 @@ static void stmmac_display_tx_rings(stru desc_size = sizeof(struct dma_desc); } @@ -85,7 +85,7 @@ Signed-off-by: Jakub Kicinski } static int stmmac_set_bfsize(int mtu, int bufsize) -@@ -1371,44 +1374,50 @@ static int stmmac_set_bfsize(int mtu, in +@@ -1379,44 +1382,50 @@ static int stmmac_set_bfsize(int mtu, in /** * stmmac_clear_rx_descriptors - clear RX descriptors * @priv: driver private structure @@ -147,7 +147,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; if (priv->extend_desc) -@@ -1425,10 +1434,12 @@ static void stmmac_clear_tx_descriptors( +@@ -1433,10 +1442,12 @@ static void stmmac_clear_tx_descriptors( /** * stmmac_clear_descriptors - clear descriptors * @priv: driver private structure @@ -161,7 +161,7 @@ Signed-off-by: Jakub Kicinski { u32 rx_queue_cnt = priv->plat->rx_queues_to_use; u32 tx_queue_cnt = priv->plat->tx_queues_to_use; -@@ -1436,16 +1447,17 @@ static void stmmac_clear_descriptors(str +@@ -1444,16 +1455,17 @@ static void stmmac_clear_descriptors(str /* Clear the RX descriptors */ for (queue = 0; queue < rx_queue_cnt; queue++) @@ -181,7 +181,7 @@ Signed-off-by: Jakub Kicinski * @p: descriptor pointer * @i: descriptor index * @flags: gfp flag -@@ -1453,10 +1465,12 @@ static void stmmac_clear_descriptors(str +@@ -1461,10 +1473,12 @@ static void stmmac_clear_descriptors(str * Description: this function is called to allocate a receive buffer, perform * the DMA mapping and init the descriptor. */ @@ -196,7 +196,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (!buf->page) { -@@ -1481,7 +1495,7 @@ static int stmmac_init_rx_buffers(struct +@@ -1489,7 +1503,7 @@ static int stmmac_init_rx_buffers(struct buf->addr = page_pool_get_dma_addr(buf->page) + buf->page_offset; stmmac_set_desc_addr(priv, p, buf->addr); @@ -205,7 +205,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_desc3(priv, p); return 0; -@@ -1490,12 +1504,13 @@ static int stmmac_init_rx_buffers(struct +@@ -1498,12 +1512,13 @@ static int stmmac_init_rx_buffers(struct /** * stmmac_free_rx_buffer - free RX dma buffers * @priv: private structure @@ -222,7 +222,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (buf->page) -@@ -1510,12 +1525,15 @@ static void stmmac_free_rx_buffer(struct +@@ -1518,12 +1533,15 @@ static void stmmac_free_rx_buffer(struct /** * stmmac_free_tx_buffer - free RX dma buffers * @priv: private structure @@ -240,7 +240,7 @@ Signed-off-by: Jakub Kicinski if (tx_q->tx_skbuff_dma[i].buf && tx_q->tx_skbuff_dma[i].buf_type != STMMAC_TXBUF_T_XDP_TX) { -@@ -1554,23 +1572,28 @@ static void stmmac_free_tx_buffer(struct +@@ -1562,23 +1580,28 @@ static void stmmac_free_tx_buffer(struct /** * dma_free_rx_skbufs - free RX dma buffers * @priv: private structure @@ -276,7 +276,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; int ret; -@@ -1579,7 +1602,7 @@ static int stmmac_alloc_rx_buffers(struc +@@ -1587,7 +1610,7 @@ static int stmmac_alloc_rx_buffers(struc else p = rx_q->dma_rx + i; @@ -285,7 +285,7 @@ Signed-off-by: Jakub Kicinski queue); if (ret) return ret; -@@ -1593,14 +1616,17 @@ static int stmmac_alloc_rx_buffers(struc +@@ -1601,14 +1624,17 @@ static int stmmac_alloc_rx_buffers(struc /** * dma_free_rx_xskbufs - free RX dma buffers from XSK pool * @priv: private structure @@ -306,7 +306,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; if (!buf->xdp) -@@ -1611,12 +1637,14 @@ static void dma_free_rx_xskbufs(struct s +@@ -1619,12 +1645,14 @@ static void dma_free_rx_xskbufs(struct s } } @@ -324,7 +324,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_rx_buffer *buf; dma_addr_t dma_addr; struct dma_desc *p; -@@ -1651,22 +1679,25 @@ static struct xsk_buff_pool *stmmac_get_ +@@ -1659,22 +1687,25 @@ static struct xsk_buff_pool *stmmac_get_ /** * __init_dma_rx_desc_rings - init the RX descriptor ring (per queue) * @priv: driver private structure @@ -353,7 +353,7 @@ Signed-off-by: Jakub Kicinski xdp_rxq_info_unreg_mem_model(&rx_q->xdp_rxq); -@@ -1693,9 +1724,9 @@ static int __init_dma_rx_desc_rings(stru +@@ -1701,9 +1732,9 @@ static int __init_dma_rx_desc_rings(stru /* RX XDP ZC buffer pool may not be populated, e.g. * xdpsock TX-only. */ @@ -365,7 +365,7 @@ Signed-off-by: Jakub Kicinski if (ret < 0) return -ENOMEM; } -@@ -1705,17 +1736,19 @@ static int __init_dma_rx_desc_rings(stru +@@ -1713,17 +1744,19 @@ static int __init_dma_rx_desc_rings(stru if (priv->extend_desc) stmmac_mode_init(priv, rx_q->dma_erx, rx_q->dma_rx_phy, @@ -388,7 +388,7 @@ Signed-off-by: Jakub Kicinski { struct stmmac_priv *priv = netdev_priv(dev); u32 rx_count = priv->plat->rx_queues_to_use; -@@ -1727,7 +1760,7 @@ static int init_dma_rx_desc_rings(struct +@@ -1735,7 +1768,7 @@ static int init_dma_rx_desc_rings(struct "SKB addresses:\nskb\t\tskb data\tdma data\n"); for (queue = 0; queue < rx_count; queue++) { @@ -397,7 +397,7 @@ Signed-off-by: Jakub Kicinski if (ret) goto err_init_rx_buffers; } -@@ -1736,12 +1769,12 @@ static int init_dma_rx_desc_rings(struct +@@ -1744,12 +1777,12 @@ static int init_dma_rx_desc_rings(struct err_init_rx_buffers: while (queue >= 0) { @@ -413,7 +413,7 @@ Signed-off-by: Jakub Kicinski rx_q->buf_alloc_num = 0; rx_q->xsk_pool = NULL; -@@ -1758,14 +1791,17 @@ err_init_rx_buffers: +@@ -1766,14 +1799,17 @@ err_init_rx_buffers: /** * __init_dma_tx_desc_rings - init the TX descriptor ring (per queue) * @priv: driver private structure @@ -434,7 +434,7 @@ Signed-off-by: Jakub Kicinski int i; netif_dbg(priv, probe, priv->dev, -@@ -1777,16 +1813,16 @@ static int __init_dma_tx_desc_rings(stru +@@ -1785,16 +1821,16 @@ static int __init_dma_tx_desc_rings(stru if (priv->extend_desc) stmmac_mode_init(priv, tx_q->dma_etx, tx_q->dma_tx_phy, @@ -454,7 +454,7 @@ Signed-off-by: Jakub Kicinski struct dma_desc *p; if (priv->extend_desc) -@@ -1808,7 +1844,8 @@ static int __init_dma_tx_desc_rings(stru +@@ -1816,7 +1852,8 @@ static int __init_dma_tx_desc_rings(stru return 0; } @@ -464,7 +464,7 @@ Signed-off-by: Jakub Kicinski { struct stmmac_priv *priv = netdev_priv(dev); u32 tx_queue_cnt; -@@ -1817,7 +1854,7 @@ static int init_dma_tx_desc_rings(struct +@@ -1825,7 +1862,7 @@ static int init_dma_tx_desc_rings(struct tx_queue_cnt = priv->plat->tx_queues_to_use; for (queue = 0; queue < tx_queue_cnt; queue++) @@ -473,7 +473,7 @@ Signed-off-by: Jakub Kicinski return 0; } -@@ -1825,26 +1862,29 @@ static int init_dma_tx_desc_rings(struct +@@ -1833,26 +1870,29 @@ static int init_dma_tx_desc_rings(struct /** * init_dma_desc_rings - init the RX/TX descriptor rings * @dev: net device structure @@ -508,7 +508,7 @@ Signed-off-by: Jakub Kicinski return ret; } -@@ -1852,17 +1892,20 @@ static int init_dma_desc_rings(struct ne +@@ -1860,17 +1900,20 @@ static int init_dma_desc_rings(struct ne /** * dma_free_tx_skbufs - free TX dma buffers * @priv: private structure @@ -533,7 +533,7 @@ Signed-off-by: Jakub Kicinski if (tx_q->xsk_pool && tx_q->xsk_frames_done) { xsk_tx_completed(tx_q->xsk_pool, tx_q->xsk_frames_done); -@@ -1881,34 +1924,37 @@ static void stmmac_free_tx_skbufs(struct +@@ -1889,34 +1932,37 @@ static void stmmac_free_tx_skbufs(struct u32 queue; for (queue = 0; queue < tx_queue_cnt; queue++) @@ -578,7 +578,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_extended_desc), rx_q->dma_erx, rx_q->dma_rx_phy); -@@ -1920,29 +1966,33 @@ static void __free_dma_rx_desc_resources +@@ -1928,29 +1974,33 @@ static void __free_dma_rx_desc_resources page_pool_destroy(rx_q->page_pool); } @@ -617,7 +617,7 @@ Signed-off-by: Jakub Kicinski if (priv->extend_desc) { size = sizeof(struct dma_extended_desc); -@@ -1955,7 +2005,7 @@ static void __free_dma_tx_desc_resources +@@ -1963,7 +2013,7 @@ static void __free_dma_tx_desc_resources addr = tx_q->dma_tx; } @@ -626,7 +626,7 @@ Signed-off-by: Jakub Kicinski dma_free_coherent(priv->device, size, addr, tx_q->dma_tx_phy); -@@ -1963,28 +2013,32 @@ static void __free_dma_tx_desc_resources +@@ -1971,28 +2021,32 @@ static void __free_dma_tx_desc_resources kfree(tx_q->tx_skbuff); } @@ -663,7 +663,7 @@ Signed-off-by: Jakub Kicinski struct stmmac_channel *ch = &priv->channel[queue]; bool xdp_prog = stmmac_xdp_is_enabled(priv); struct page_pool_params pp_params = { 0 }; -@@ -1996,8 +2050,8 @@ static int __alloc_dma_rx_desc_resources +@@ -2004,8 +2058,8 @@ static int __alloc_dma_rx_desc_resources rx_q->priv_data = priv; pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV; @@ -674,7 +674,7 @@ Signed-off-by: Jakub Kicinski pp_params.order = ilog2(num_pages); pp_params.nid = dev_to_node(priv->device); pp_params.dev = priv->device; -@@ -2012,7 +2066,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2020,7 +2074,7 @@ static int __alloc_dma_rx_desc_resources return ret; } @@ -683,7 +683,7 @@ Signed-off-by: Jakub Kicinski sizeof(*rx_q->buf_pool), GFP_KERNEL); if (!rx_q->buf_pool) -@@ -2020,7 +2074,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2028,7 +2082,7 @@ static int __alloc_dma_rx_desc_resources if (priv->extend_desc) { rx_q->dma_erx = dma_alloc_coherent(priv->device, @@ -692,7 +692,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_extended_desc), &rx_q->dma_rx_phy, GFP_KERNEL); -@@ -2029,7 +2083,7 @@ static int __alloc_dma_rx_desc_resources +@@ -2037,7 +2091,7 @@ static int __alloc_dma_rx_desc_resources } else { rx_q->dma_rx = dma_alloc_coherent(priv->device, @@ -701,7 +701,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct dma_desc), &rx_q->dma_rx_phy, GFP_KERNEL); -@@ -2054,7 +2108,8 @@ static int __alloc_dma_rx_desc_resources +@@ -2062,7 +2116,8 @@ static int __alloc_dma_rx_desc_resources return 0; } @@ -711,7 +711,7 @@ Signed-off-by: Jakub Kicinski { u32 rx_count = priv->plat->rx_queues_to_use; u32 queue; -@@ -2062,7 +2117,7 @@ static int alloc_dma_rx_desc_resources(s +@@ -2070,7 +2125,7 @@ static int alloc_dma_rx_desc_resources(s /* RX queues buffers and DMA */ for (queue = 0; queue < rx_count; queue++) { @@ -720,7 +720,7 @@ Signed-off-by: Jakub Kicinski if (ret) goto err_dma; } -@@ -2070,7 +2125,7 @@ static int alloc_dma_rx_desc_resources(s +@@ -2078,7 +2133,7 @@ static int alloc_dma_rx_desc_resources(s return 0; err_dma: @@ -729,7 +729,7 @@ Signed-off-by: Jakub Kicinski return ret; } -@@ -2078,28 +2133,31 @@ err_dma: +@@ -2086,28 +2141,31 @@ err_dma: /** * __alloc_dma_tx_desc_resources - alloc TX resources (per queue). * @priv: private structure @@ -765,7 +765,7 @@ Signed-off-by: Jakub Kicinski sizeof(struct sk_buff *), GFP_KERNEL); if (!tx_q->tx_skbuff) -@@ -2112,7 +2170,7 @@ static int __alloc_dma_tx_desc_resources +@@ -2120,7 +2178,7 @@ static int __alloc_dma_tx_desc_resources else size = sizeof(struct dma_desc); @@ -774,7 +774,7 @@ Signed-off-by: Jakub Kicinski addr = dma_alloc_coherent(priv->device, size, &tx_q->dma_tx_phy, GFP_KERNEL); -@@ -2129,7 +2187,8 @@ static int __alloc_dma_tx_desc_resources +@@ -2137,7 +2195,8 @@ static int __alloc_dma_tx_desc_resources return 0; } @@ -784,7 +784,7 @@ Signed-off-by: Jakub Kicinski { u32 tx_count = priv->plat->tx_queues_to_use; u32 queue; -@@ -2137,7 +2196,7 @@ static int alloc_dma_tx_desc_resources(s +@@ -2145,7 +2204,7 @@ static int alloc_dma_tx_desc_resources(s /* TX queues buffers and DMA */ for (queue = 0; queue < tx_count; queue++) { @@ -793,7 +793,7 @@ Signed-off-by: Jakub Kicinski if (ret) goto err_dma; } -@@ -2145,27 +2204,29 @@ static int alloc_dma_tx_desc_resources(s +@@ -2153,27 +2212,29 @@ static int alloc_dma_tx_desc_resources(s return 0; err_dma: @@ -827,7 +827,7 @@ Signed-off-by: Jakub Kicinski return ret; } -@@ -2173,16 +2234,18 @@ static int alloc_dma_desc_resources(stru +@@ -2181,16 +2242,18 @@ static int alloc_dma_desc_resources(stru /** * free_dma_desc_resources - free dma desc resources * @priv: private structure @@ -849,7 +849,7 @@ Signed-off-by: Jakub Kicinski } /** -@@ -2671,8 +2734,8 @@ static void stmmac_tx_err(struct stmmac_ +@@ -2679,8 +2742,8 @@ static void stmmac_tx_err(struct stmmac_ netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, chan)); stmmac_stop_tx_dma(priv, chan); @@ -860,7 +860,7 @@ Signed-off-by: Jakub Kicinski stmmac_reset_tx_queue(priv, chan); stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, chan); -@@ -3669,19 +3732,93 @@ static int stmmac_request_irq(struct net +@@ -3677,19 +3740,93 @@ static int stmmac_request_irq(struct net } /** @@ -957,7 +957,7 @@ Signed-off-by: Jakub Kicinski u32 chan; int ret; -@@ -3708,45 +3845,10 @@ static int stmmac_open(struct net_device +@@ -3716,45 +3853,10 @@ static int stmmac_open(struct net_device memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); priv->xstats.threshold = tc; @@ -1005,7 +1005,7 @@ Signed-off-by: Jakub Kicinski if (priv->plat->serdes_powerup) { ret = priv->plat->serdes_powerup(dev, priv->plat->bsp_priv); -@@ -3789,14 +3891,28 @@ irq_error: +@@ -3797,14 +3899,28 @@ irq_error: stmmac_hw_teardown(dev); init_error: @@ -1036,7 +1036,7 @@ Signed-off-by: Jakub Kicinski static void stmmac_fpe_stop_wq(struct stmmac_priv *priv) { set_bit(__FPE_REMOVING, &priv->fpe_task_state); -@@ -3843,7 +3959,7 @@ static int stmmac_release(struct net_dev +@@ -3851,7 +3967,7 @@ static int stmmac_release(struct net_dev stmmac_stop_all_dma(priv); /* Release and free the Rx/Tx resources */ @@ -1045,7 +1045,7 @@ Signed-off-by: Jakub Kicinski /* Disable the MAC Rx/Tx */ stmmac_mac_set(priv, priv->ioaddr, false); -@@ -6382,7 +6498,7 @@ void stmmac_disable_rx_queue(struct stmm +@@ -6390,7 +6506,7 @@ void stmmac_disable_rx_queue(struct stmm spin_unlock_irqrestore(&ch->lock, flags); stmmac_stop_rx_dma(priv, queue); @@ -1054,7 +1054,7 @@ Signed-off-by: Jakub Kicinski } void stmmac_enable_rx_queue(struct stmmac_priv *priv, u32 queue) -@@ -6393,21 +6509,21 @@ void stmmac_enable_rx_queue(struct stmma +@@ -6401,21 +6517,21 @@ void stmmac_enable_rx_queue(struct stmma u32 buf_size; int ret; @@ -1080,7 +1080,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, rx_q->dma_rx_phy, rx_q->queue_index); -@@ -6445,7 +6561,7 @@ void stmmac_disable_tx_queue(struct stmm +@@ -6453,7 +6569,7 @@ void stmmac_disable_tx_queue(struct stmm spin_unlock_irqrestore(&ch->lock, flags); stmmac_stop_tx_dma(priv, queue); @@ -1089,7 +1089,7 @@ Signed-off-by: Jakub Kicinski } void stmmac_enable_tx_queue(struct stmmac_priv *priv, u32 queue) -@@ -6455,21 +6571,21 @@ void stmmac_enable_tx_queue(struct stmma +@@ -6463,21 +6579,21 @@ void stmmac_enable_tx_queue(struct stmma unsigned long flags; int ret; @@ -1115,7 +1115,7 @@ Signed-off-by: Jakub Kicinski stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, tx_q->dma_tx_phy, tx_q->queue_index); -@@ -6509,7 +6625,7 @@ void stmmac_xdp_release(struct net_devic +@@ -6517,7 +6633,7 @@ void stmmac_xdp_release(struct net_devic stmmac_stop_all_dma(priv); /* Release and free the Rx/Tx resources */ @@ -1124,7 +1124,7 @@ Signed-off-by: Jakub Kicinski /* Disable the MAC Rx/Tx */ stmmac_mac_set(priv, priv->ioaddr, false); -@@ -6534,14 +6650,14 @@ int stmmac_xdp_open(struct net_device *d +@@ -6542,14 +6658,14 @@ int stmmac_xdp_open(struct net_device *d u32 chan; int ret; @@ -1141,7 +1141,7 @@ Signed-off-by: Jakub Kicinski if (ret < 0) { netdev_err(dev, "%s: DMA descriptors initialization failed\n", __func__); -@@ -6623,7 +6739,7 @@ irq_error: +@@ -6631,7 +6747,7 @@ irq_error: stmmac_hw_teardown(dev); init_error: @@ -1150,7 +1150,7 @@ Signed-off-by: Jakub Kicinski dma_desc_error: return ret; } -@@ -7482,7 +7598,7 @@ int stmmac_resume(struct device *dev) +@@ -7490,7 +7606,7 @@ int stmmac_resume(struct device *dev) stmmac_reset_queues_param(priv); stmmac_free_tx_skbufs(priv); diff --git a/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch b/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch index 996c28119e2..d1d8c622fc9 100644 --- a/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch +++ b/target/linux/generic/backport-5.15/775-v6.0-05-net-ethernet-stmicro-stmmac-permit-MTU-change-with-i.patch @@ -19,7 +19,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -5611,18 +5611,15 @@ static int stmmac_change_mtu(struct net_ +@@ -5619,18 +5619,15 @@ static int stmmac_change_mtu(struct net_ { struct stmmac_priv *priv = netdev_priv(dev); int txfifosz = priv->plat->tx_fifo_size; @@ -40,7 +40,7 @@ Signed-off-by: Jakub Kicinski if (stmmac_xdp_is_enabled(priv) && new_mtu > ETH_DATA_LEN) { netdev_dbg(priv->dev, "Jumbo frames not supported for XDP\n"); return -EINVAL; -@@ -5634,8 +5631,29 @@ static int stmmac_change_mtu(struct net_ +@@ -5642,8 +5639,29 @@ static int stmmac_change_mtu(struct net_ if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB)) return -EINVAL; diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index 5010091ea97..722b7578f8d 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -2535,6 +2535,7 @@ CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_INA2XX_ADC is not set # CONFIG_INDIRECT_PIO is not set CONFIG_INET=y +CONFIG_INET_TABLE_PERTURB_ORDER=16 # CONFIG_INET6_AH is not set # CONFIG_INET6_ESP is not set # CONFIG_INET6_ESPINTCP is not set diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 735b3d05886..b3541ab95bf 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -2636,6 +2636,7 @@ CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_INA2XX_ADC is not set # CONFIG_INDIRECT_PIO is not set CONFIG_INET=y +CONFIG_INET_TABLE_PERTURB_ORDER=16 # CONFIG_INET6_AH is not set # CONFIG_INET6_ESP is not set # CONFIG_INET6_ESPINTCP is not set diff --git a/target/linux/generic/hack-5.10/100-update-mtk_wed_h.patch b/target/linux/generic/hack-5.10/100-update-mtk_wed_h.patch new file mode 100644 index 00000000000..fe49100e4f7 --- /dev/null +++ b/target/linux/generic/hack-5.10/100-update-mtk_wed_h.patch @@ -0,0 +1,209 @@ +--- a/include/linux/soc/mediatek/mtk_wed.h ++++ b/include/linux/soc/mediatek/mtk_wed.h +@@ -5,21 +5,76 @@ + #include + #include + #include ++#include + + #define MTK_WED_TX_QUEUES 2 ++#define MTK_WED_RX_QUEUES 2 ++ ++#define WED_WO_STA_REC 0x6 + + struct mtk_wed_hw; + struct mtk_wdma_desc; + ++enum mtk_wed_wo_cmd { ++ MTK_WED_WO_CMD_WED_CFG, ++ MTK_WED_WO_CMD_WED_RX_STAT, ++ MTK_WED_WO_CMD_RRO_SER, ++ MTK_WED_WO_CMD_DBG_INFO, ++ MTK_WED_WO_CMD_DEV_INFO, ++ MTK_WED_WO_CMD_BSS_INFO, ++ MTK_WED_WO_CMD_STA_REC, ++ MTK_WED_WO_CMD_DEV_INFO_DUMP, ++ MTK_WED_WO_CMD_BSS_INFO_DUMP, ++ MTK_WED_WO_CMD_STA_REC_DUMP, ++ MTK_WED_WO_CMD_BA_INFO_DUMP, ++ MTK_WED_WO_CMD_FBCMD_Q_DUMP, ++ MTK_WED_WO_CMD_FW_LOG_CTRL, ++ MTK_WED_WO_CMD_LOG_FLUSH, ++ MTK_WED_WO_CMD_CHANGE_STATE, ++ MTK_WED_WO_CMD_CPU_STATS_ENABLE, ++ MTK_WED_WO_CMD_CPU_STATS_DUMP, ++ MTK_WED_WO_CMD_EXCEPTION_INIT, ++ MTK_WED_WO_CMD_PROF_CTRL, ++ MTK_WED_WO_CMD_STA_BA_DUMP, ++ MTK_WED_WO_CMD_BA_CTRL_DUMP, ++ MTK_WED_WO_CMD_RXCNT_CTRL, ++ MTK_WED_WO_CMD_RXCNT_INFO, ++ MTK_WED_WO_CMD_SET_CAP, ++ MTK_WED_WO_CMD_CCIF_RING_DUMP, ++ MTK_WED_WO_CMD_WED_END ++}; ++ ++struct mtk_rxbm_desc { ++ __le32 buf0; ++ __le32 token; ++} __packed __aligned(4); ++ ++enum mtk_wed_bus_tye { ++ MTK_WED_BUS_PCIE, ++ MTK_WED_BUS_AXI, ++}; ++ ++#define MTK_WED_RING_CONFIGURED BIT(0) + struct mtk_wed_ring { + struct mtk_wdma_desc *desc; + dma_addr_t desc_phys; ++ u32 desc_size; + int size; ++ u32 flags; + + u32 reg_base; + void __iomem *wpdma; + }; + ++struct mtk_wed_wo_rx_stats { ++ __le16 wlan_idx; ++ __le16 tid; ++ __le32 rx_pkt_cnt; ++ __le32 rx_byte_cnt; ++ __le32 rx_err_cnt; ++ __le32 rx_drop_cnt; ++}; ++ + struct mtk_wed_device { + #ifdef CONFIG_NET_MEDIATEK_SOC_WED + const struct mtk_wed_ops *ops; +@@ -28,30 +83,71 @@ struct mtk_wed_device { + bool init_done, running; + int wdma_idx; + int irq; ++ u8 version; + + struct mtk_wed_ring tx_ring[MTK_WED_TX_QUEUES]; ++ struct mtk_wed_ring rx_ring[MTK_WED_RX_QUEUES]; + struct mtk_wed_ring txfree_ring; + struct mtk_wed_ring tx_wdma[MTK_WED_TX_QUEUES]; ++ struct mtk_wed_ring rx_wdma[MTK_WED_RX_QUEUES]; + + struct { + int size; + void **pages; + struct mtk_wdma_desc *desc; + dma_addr_t desc_phys; +- } buf_ring; ++ } tx_buf_ring; ++ ++ struct { ++ int size; ++ struct page_frag_cache rx_page; ++ struct mtk_rxbm_desc *desc; ++ dma_addr_t desc_phys; ++ } rx_buf_ring; ++ ++ struct { ++ struct mtk_wed_ring ring; ++ dma_addr_t miod_phys; ++ dma_addr_t fdbk_phys; ++ } rro; + + /* filled by driver: */ + struct { +- struct pci_dev *pci_dev; ++ union { ++ struct platform_device *platform_dev; ++ struct pci_dev *pci_dev; ++ }; ++ enum mtk_wed_bus_tye bus_type; ++ void __iomem *base; ++ u32 phy_base; + + u32 wpdma_phys; ++ u32 wpdma_int; ++ u32 wpdma_mask; ++ u32 wpdma_tx; ++ u32 wpdma_txfree; ++ u32 wpdma_rx_glo; ++ u32 wpdma_rx; ++ ++ bool wcid_512; + + u16 token_start; + unsigned int nbuf; ++ unsigned int rx_nbuf; ++ unsigned int rx_npkt; ++ unsigned int rx_size; ++ ++ u8 tx_tbit[MTK_WED_TX_QUEUES]; ++ u8 rx_tbit[MTK_WED_RX_QUEUES]; ++ u8 txfree_tbit; + + u32 (*init_buf)(void *ptr, dma_addr_t phys, int token_id); + int (*offload_enable)(struct mtk_wed_device *wed); + void (*offload_disable)(struct mtk_wed_device *wed); ++ u32 (*init_rx_buf)(struct mtk_wed_device *wed, int size); ++ void (*release_rx_buf)(struct mtk_wed_device *wed); ++ void (*update_wo_rx_stats)(struct mtk_wed_device *wed, ++ struct mtk_wed_wo_rx_stats *stats); + } wlan; + #endif + }; +@@ -60,9 +156,15 @@ struct mtk_wed_ops { + int (*attach)(struct mtk_wed_device *dev); + int (*tx_ring_setup)(struct mtk_wed_device *dev, int ring, + void __iomem *regs); ++ int (*rx_ring_setup)(struct mtk_wed_device *dev, int ring, ++ void __iomem *regs); + int (*txfree_ring_setup)(struct mtk_wed_device *dev, + void __iomem *regs); ++ int (*msg_update)(struct mtk_wed_device *dev, int cmd_id, ++ void *data, int len); + void (*detach)(struct mtk_wed_device *dev); ++ void (*ppe_check)(struct mtk_wed_device *dev, struct sk_buff *skb, ++ u32 reason, u32 hash); + + void (*stop)(struct mtk_wed_device *dev); + void (*start)(struct mtk_wed_device *dev, u32 irq_mask); +@@ -97,6 +199,16 @@ mtk_wed_device_attach(struct mtk_wed_dev + return ret; + } + ++static inline bool ++mtk_wed_get_rx_capa(struct mtk_wed_device *dev) ++{ ++#ifdef CONFIG_NET_MEDIATEK_SOC_WED ++ return dev->version != 1; ++#else ++ return false; ++#endif ++} ++ + #ifdef CONFIG_NET_MEDIATEK_SOC_WED + #define mtk_wed_device_active(_dev) !!(_dev)->ops + #define mtk_wed_device_detach(_dev) (_dev)->ops->detach(_dev) +@@ -113,6 +225,12 @@ mtk_wed_device_attach(struct mtk_wed_dev + (_dev)->ops->irq_get(_dev, _mask) + #define mtk_wed_device_irq_set_mask(_dev, _mask) \ + (_dev)->ops->irq_set_mask(_dev, _mask) ++#define mtk_wed_device_rx_ring_setup(_dev, _ring, _regs) \ ++ (_dev)->ops->rx_ring_setup(_dev, _ring, _regs) ++#define mtk_wed_device_ppe_check(_dev, _skb, _reason, _hash) \ ++ (_dev)->ops->ppe_check(_dev, _skb, _reason, _hash) ++#define mtk_wed_device_update_msg(_dev, _id, _msg, _len) \ ++ (_dev)->ops->msg_update(_dev, _id, _msg, _len) + #else + static inline bool mtk_wed_device_active(struct mtk_wed_device *dev) + { +@@ -126,6 +244,9 @@ static inline bool mtk_wed_device_active + #define mtk_wed_device_reg_write(_dev, _reg, _val) do {} while (0) + #define mtk_wed_device_irq_get(_dev, _mask) 0 + #define mtk_wed_device_irq_set_mask(_dev, _mask) do {} while (0) ++#define mtk_wed_device_rx_ring_setup(_dev, _ring, _regs) -ENODEV ++#define mtk_wed_device_ppe_check(_dev, _skb, _reason, _hash) do {} while (0) ++#define mtk_wed_device_update_msg(_dev, _id, _msg, _len) -ENODEV + #endif + + #endif diff --git a/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch b/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch index 405cc9d0d43..acad393906a 100644 --- a/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch +++ b/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch @@ -101,7 +101,7 @@ Submitted-by: Daniel Golle #ifdef CONFIG_SGI_PARTITION sgi_partition, #endif -@@ -694,6 +701,14 @@ static bool blk_add_partition(struct gen +@@ -701,6 +708,14 @@ static bool blk_add_partition(struct gen (state->parts[p].flags & ADDPART_FLAG_RAID)) md_autodetect_dev(part_to_dev(part)->devt); diff --git a/target/linux/generic/hack-5.10/645-netfilter-connmark-introduce-set-dscpmark.patch b/target/linux/generic/hack-5.10/645-netfilter-connmark-introduce-set-dscpmark.patch index 2d3fe01a755..c368c4ae3bf 100644 --- a/target/linux/generic/hack-5.10/645-netfilter-connmark-introduce-set-dscpmark.patch +++ b/target/linux/generic/hack-5.10/645-netfilter-connmark-introduce-set-dscpmark.patch @@ -109,7 +109,7 @@ Signed-off-by: Kevin Darbyshire-Bryant __u8 invert; --- a/net/netfilter/xt_connmark.c +++ b/net/netfilter/xt_connmark.c -@@ -24,12 +24,13 @@ MODULE_ALIAS("ipt_connmark"); +@@ -24,13 +24,13 @@ MODULE_ALIAS("ipt_connmark"); MODULE_ALIAS("ip6t_connmark"); static unsigned int @@ -120,20 +120,22 @@ Signed-off-by: Kevin Darbyshire-Bryant u_int32_t new_targetmark; struct nf_conn *ct; u_int32_t newmark; +- u_int32_t oldmark; + u_int8_t dscp; ct = nf_ct_get(skb, &ctinfo); if (ct == NULL) -@@ -37,12 +38,24 @@ connmark_tg_shift(struct sk_buff *skb, c +@@ -38,13 +38,24 @@ connmark_tg_shift(struct sk_buff *skb, c switch (info->mode) { case XT_CONNMARK_SET: -- newmark = (ct->mark & ~info->ctmask) ^ info->ctmark; +- oldmark = READ_ONCE(ct->mark); +- newmark = (oldmark & ~info->ctmask) ^ info->ctmark; - if (info->shift_dir == D_SHIFT_RIGHT) - newmark >>= info->shift_bits; - else - newmark <<= info->shift_bits; -+ newmark = ct->mark; ++ newmark = READ_ONCE(ct->mark); + if (info->func & XT_CONNMARK_VALUE) { + newmark = (newmark & ~info->ctmask) ^ info->ctmark; + if (info->shift_dir == D_SHIFT_RIGHT) @@ -151,10 +153,10 @@ Signed-off-by: Kevin Darbyshire-Bryant + newmark = (newmark & ~info->ctmark) | + (info->ctmask | (dscp << info->shift_bits)); + } - if (ct->mark != newmark) { - ct->mark = newmark; + if (READ_ONCE(ct->mark) != newmark) { + WRITE_ONCE(ct->mark, newmark); nf_conntrack_event_cache(IPCT_MARK, ct); -@@ -81,20 +94,36 @@ static unsigned int +@@ -83,20 +94,36 @@ static unsigned int connmark_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct xt_connmark_tginfo1 *info = par->targinfo; @@ -193,7 +195,7 @@ Signed-off-by: Kevin Darbyshire-Bryant return connmark_tg_shift(skb, info); } -@@ -165,6 +194,16 @@ static struct xt_target connmark_tg_reg[ +@@ -167,6 +194,16 @@ static struct xt_target connmark_tg_reg[ .targetsize = sizeof(struct xt_connmark_tginfo2), .destroy = connmark_tg_destroy, .me = THIS_MODULE, diff --git a/target/linux/generic/hack-5.10/901-debloat_sock_diag.patch b/target/linux/generic/hack-5.10/901-debloat_sock_diag.patch index 5302c793de1..1ff1bcabb4a 100644 --- a/target/linux/generic/hack-5.10/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-5.10/901-debloat_sock_diag.patch @@ -122,7 +122,7 @@ Signed-off-by: Felix Fietkau u64 res; --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig -@@ -414,6 +414,7 @@ config INET_TUNNEL +@@ -424,6 +424,7 @@ config INET_TUNNEL config INET_DIAG tristate "INET: socket monitoring interface" diff --git a/target/linux/generic/hack-5.10/902-debloat_proc.patch b/target/linux/generic/hack-5.10/902-debloat_proc.patch index 913a5cb1321..5cdc22a5d5b 100644 --- a/target/linux/generic/hack-5.10/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.10/902-debloat_proc.patch @@ -341,7 +341,7 @@ Signed-off-by: Felix Fietkau --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c -@@ -2986,11 +2986,13 @@ static const struct seq_operations fib_r +@@ -2988,11 +2988,13 @@ static const struct seq_operations fib_r int __net_init fib_proc_init(struct net *net) { @@ -357,7 +357,7 @@ Signed-off-by: Felix Fietkau fib_triestat_seq_show, NULL)) goto out2; -@@ -3001,17 +3003,21 @@ int __net_init fib_proc_init(struct net +@@ -3003,17 +3005,21 @@ int __net_init fib_proc_init(struct net return 0; out3: diff --git a/target/linux/generic/hack-5.15/645-netfilter-connmark-introduce-set-dscpmark.patch b/target/linux/generic/hack-5.15/645-netfilter-connmark-introduce-set-dscpmark.patch index 2d3fe01a755..c368c4ae3bf 100644 --- a/target/linux/generic/hack-5.15/645-netfilter-connmark-introduce-set-dscpmark.patch +++ b/target/linux/generic/hack-5.15/645-netfilter-connmark-introduce-set-dscpmark.patch @@ -109,7 +109,7 @@ Signed-off-by: Kevin Darbyshire-Bryant __u8 invert; --- a/net/netfilter/xt_connmark.c +++ b/net/netfilter/xt_connmark.c -@@ -24,12 +24,13 @@ MODULE_ALIAS("ipt_connmark"); +@@ -24,13 +24,13 @@ MODULE_ALIAS("ipt_connmark"); MODULE_ALIAS("ip6t_connmark"); static unsigned int @@ -120,20 +120,22 @@ Signed-off-by: Kevin Darbyshire-Bryant u_int32_t new_targetmark; struct nf_conn *ct; u_int32_t newmark; +- u_int32_t oldmark; + u_int8_t dscp; ct = nf_ct_get(skb, &ctinfo); if (ct == NULL) -@@ -37,12 +38,24 @@ connmark_tg_shift(struct sk_buff *skb, c +@@ -38,13 +38,24 @@ connmark_tg_shift(struct sk_buff *skb, c switch (info->mode) { case XT_CONNMARK_SET: -- newmark = (ct->mark & ~info->ctmask) ^ info->ctmark; +- oldmark = READ_ONCE(ct->mark); +- newmark = (oldmark & ~info->ctmask) ^ info->ctmark; - if (info->shift_dir == D_SHIFT_RIGHT) - newmark >>= info->shift_bits; - else - newmark <<= info->shift_bits; -+ newmark = ct->mark; ++ newmark = READ_ONCE(ct->mark); + if (info->func & XT_CONNMARK_VALUE) { + newmark = (newmark & ~info->ctmask) ^ info->ctmark; + if (info->shift_dir == D_SHIFT_RIGHT) @@ -151,10 +153,10 @@ Signed-off-by: Kevin Darbyshire-Bryant + newmark = (newmark & ~info->ctmark) | + (info->ctmask | (dscp << info->shift_bits)); + } - if (ct->mark != newmark) { - ct->mark = newmark; + if (READ_ONCE(ct->mark) != newmark) { + WRITE_ONCE(ct->mark, newmark); nf_conntrack_event_cache(IPCT_MARK, ct); -@@ -81,20 +94,36 @@ static unsigned int +@@ -83,20 +94,36 @@ static unsigned int connmark_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct xt_connmark_tginfo1 *info = par->targinfo; @@ -193,7 +195,7 @@ Signed-off-by: Kevin Darbyshire-Bryant return connmark_tg_shift(skb, info); } -@@ -165,6 +194,16 @@ static struct xt_target connmark_tg_reg[ +@@ -167,6 +194,16 @@ static struct xt_target connmark_tg_reg[ .targetsize = sizeof(struct xt_connmark_tginfo2), .destroy = connmark_tg_destroy, .me = THIS_MODULE, diff --git a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch index ab629d598f9..ac502bdd16d 100644 --- a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch @@ -122,7 +122,7 @@ Signed-off-by: Felix Fietkau u64 res; --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig -@@ -414,6 +414,7 @@ config INET_TUNNEL +@@ -424,6 +424,7 @@ config INET_TUNNEL config INET_DIAG tristate "INET: socket monitoring interface" diff --git a/target/linux/generic/hack-5.15/902-debloat_proc.patch b/target/linux/generic/hack-5.15/902-debloat_proc.patch index c58370eff11..753b9705bc7 100644 --- a/target/linux/generic/hack-5.15/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.15/902-debloat_proc.patch @@ -341,7 +341,7 @@ Signed-off-by: Felix Fietkau --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c -@@ -3022,11 +3022,13 @@ static const struct seq_operations fib_r +@@ -3024,11 +3024,13 @@ static const struct seq_operations fib_r int __net_init fib_proc_init(struct net *net) { @@ -357,7 +357,7 @@ Signed-off-by: Felix Fietkau fib_triestat_seq_show, NULL)) goto out2; -@@ -3037,17 +3039,21 @@ int __net_init fib_proc_init(struct net +@@ -3039,17 +3041,21 @@ int __net_init fib_proc_init(struct net return 0; out3: diff --git a/target/linux/generic/pending-5.10/630-packet_socket_type.patch b/target/linux/generic/pending-5.10/630-packet_socket_type.patch index 26fd8bc7541..beff8bda78e 100644 --- a/target/linux/generic/pending-5.10/630-packet_socket_type.patch +++ b/target/linux/generic/pending-5.10/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3330,6 +3332,7 @@ static int packet_create(struct net *net +@@ -3329,6 +3331,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3974,6 +3977,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3972,6 +3975,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -4030,6 +4043,13 @@ static int packet_getsockopt(struct sock +@@ -4028,6 +4041,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index b0efced825d..f2ab205f26a 100644 --- a/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -66,7 +66,7 @@ Signed-off-by: Jonas Gorski static void rt_fibinfo_free(struct rtable __rcu **rtp) --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c -@@ -2734,6 +2734,7 @@ static const char *const rtn_type_names[ +@@ -2736,6 +2736,7 @@ static const char *const rtn_type_names[ [RTN_THROW] = "THROW", [RTN_NAT] = "NAT", [RTN_XRESOLVE] = "XRESOLVE", diff --git a/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index c9d5a805b8f..8ce754b2e5a 100644 --- a/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau if (netif_elide_gro(skb->dev)) goto normal; -@@ -8044,6 +8047,48 @@ static void __netdev_adjacent_dev_unlink +@@ -8045,6 +8048,48 @@ static void __netdev_adjacent_dev_unlink &upper_dev->adj_list.lower); } @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau static int __netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, bool master, void *upper_priv, void *upper_info, -@@ -8095,6 +8140,7 @@ static int __netdev_upper_dev_link(struc +@@ -8096,6 +8141,7 @@ static int __netdev_upper_dev_link(struc if (ret) return ret; @@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); ret = notifier_to_errno(ret); -@@ -8191,6 +8237,7 @@ static void __netdev_upper_dev_unlink(st +@@ -8192,6 +8238,7 @@ static void __netdev_upper_dev_unlink(st __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, &changeupper_info.info); -@@ -8977,6 +9024,7 @@ int dev_set_mac_address(struct net_devic +@@ -8978,6 +9025,7 @@ int dev_set_mac_address(struct net_devic if (err) return err; dev->addr_assign_type = NET_ADDR_SET; diff --git a/target/linux/generic/pending-5.10/701-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch b/target/linux/generic/pending-5.10/701-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch index 3678530e9aa..75d75d0b3c6 100644 --- a/target/linux/generic/pending-5.10/701-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch +++ b/target/linux/generic/pending-5.10/701-00-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch @@ -205,7 +205,7 @@ Signed-off-by: Felix Fietkau MTK_DMA_SIZE * sizeof(struct mtk_tx_dma), eth->scratch_ring, eth->phy_scratch_ring); -@@ -2502,6 +2503,8 @@ static void mtk_dim_tx(struct work_struc +@@ -2506,6 +2507,8 @@ static void mtk_dim_tx(struct work_struc static int mtk_hw_init(struct mtk_eth *eth) { @@ -214,7 +214,7 @@ Signed-off-by: Felix Fietkau int i, val, ret; if (test_and_set_bit(MTK_HW_INIT, ð->state)) -@@ -2514,6 +2517,10 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2518,6 +2521,10 @@ static int mtk_hw_init(struct mtk_eth *e if (ret) goto err_disable_pm; @@ -225,7 +225,7 @@ Signed-off-by: Felix Fietkau if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { ret = device_reset(eth->dev); if (ret) { -@@ -3063,6 +3070,35 @@ free_netdev: +@@ -3067,6 +3074,35 @@ free_netdev: return err; } @@ -261,7 +261,7 @@ Signed-off-by: Felix Fietkau static int mtk_probe(struct platform_device *pdev) { struct device_node *mac_np; -@@ -3076,6 +3112,7 @@ static int mtk_probe(struct platform_dev +@@ -3080,6 +3116,7 @@ static int mtk_probe(struct platform_dev eth->soc = of_device_get_match_data(&pdev->dev); eth->dev = &pdev->dev; @@ -269,7 +269,7 @@ Signed-off-by: Felix Fietkau eth->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(eth->base)) return PTR_ERR(eth->base); -@@ -3124,6 +3161,16 @@ static int mtk_probe(struct platform_dev +@@ -3128,6 +3165,16 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/pending-5.10/701-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch b/target/linux/generic/pending-5.10/701-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch index cebdbd6fee3..d1729c640cc 100644 --- a/target/linux/generic/pending-5.10/701-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch +++ b/target/linux/generic/pending-5.10/701-02-net-ethernet-mtk_eth_soc-add-support-for-Wireless-Et.patch @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau static int mtk_msg_level = -1; module_param_named(msg_level, mtk_msg_level, int, 0); -@@ -3193,6 +3194,22 @@ static int mtk_probe(struct platform_dev +@@ -3197,6 +3198,22 @@ static int mtk_probe(struct platform_dev } } diff --git a/target/linux/generic/pending-5.10/701-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch b/target/linux/generic/pending-5.10/701-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch index da5b2549148..b33d16f0854 100644 --- a/target/linux/generic/pending-5.10/701-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch +++ b/target/linux/generic/pending-5.10/701-07-net-ethernet-mtk_eth_soc-allocate-struct-mtk_ppe-sep.patch @@ -10,16 +10,16 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2325,7 +2325,7 @@ static int mtk_open(struct net_device *d - if (err) +@@ -2329,7 +2329,7 @@ static int mtk_open(struct net_device *d return err; + } - if (eth->soc->offload_version && mtk_ppe_start(ð->ppe) == 0) + if (eth->soc->offload_version && mtk_ppe_start(eth->ppe) == 0) gdm_config = MTK_GDMA_TO_PPE; mtk_gdm_config(eth, gdm_config); -@@ -2399,7 +2399,7 @@ static int mtk_stop(struct net_device *d +@@ -2403,7 +2403,7 @@ static int mtk_stop(struct net_device *d mtk_dma_free(eth); if (eth->soc->offload_version) @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -3285,10 +3285,11 @@ static int mtk_probe(struct platform_dev +@@ -3289,10 +3289,11 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/pending-5.10/701-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch b/target/linux/generic/pending-5.10/701-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch index 5b49513d4c8..47905d25e71 100644 --- a/target/linux/generic/pending-5.10/701-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch +++ b/target/linux/generic/pending-5.10/701-08-net-ethernet-mtk_eth_soc-rework-hardware-flow-table-.patch @@ -54,7 +54,7 @@ Signed-off-by: Felix Fietkau if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX && (trxd.rxd2 & RX_DMA_VTAG)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), -@@ -3285,7 +3291,7 @@ static int mtk_probe(struct platform_dev +@@ -3289,7 +3295,7 @@ static int mtk_probe(struct platform_dev } if (eth->soc->offload_version) { diff --git a/target/linux/generic/pending-5.10/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-5.10/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 477c8f15683..53dfb03de93 100644 --- a/target/linux/generic/pending-5.10/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-5.10/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -3320,6 +3320,8 @@ static int mtk_probe(struct platform_dev +@@ -3324,6 +3324,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-5.10/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-5.10/703-phy-add-detach-callback-to-struct-phy_driver.patch index 52350ecccc2..068ed323a95 100644 --- a/target/linux/generic/pending-5.10/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ b/target/linux/generic/pending-5.10/703-phy-add-detach-callback-to-struct-phy_driver.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -1651,6 +1651,9 @@ void phy_detach(struct phy_device *phyde +@@ -1652,6 +1652,9 @@ void phy_detach(struct phy_device *phyde struct module *ndev_owner = NULL; struct mii_bus *bus; diff --git a/target/linux/generic/pending-5.10/706-netfilter-nf_flow_table-add-missing-locking.patch b/target/linux/generic/pending-5.10/706-netfilter-nf_flow_table-add-missing-locking.patch deleted file mode 100644 index b77d71cc946..00000000000 --- a/target/linux/generic/pending-5.10/706-netfilter-nf_flow_table-add-missing-locking.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Felix Fietkau -Date: Sat, 19 Nov 2022 18:48:42 +0100 -Subject: [PATCH] netfilter: nf_flow_table: add missing locking - -nf_flow_table_block_setup and the driver TC_SETUP_FT call can modify the flow -block cb list while they are being traversed elsewhere, causing a crash. -Add a write lock around the calls to protect readers - -Signed-off-by: Felix Fietkau ---- - ---- a/net/netfilter/nf_flow_table_offload.c -+++ b/net/netfilter/nf_flow_table_offload.c -@@ -1015,6 +1015,7 @@ static int nf_flow_table_block_setup(str - struct flow_block_cb *block_cb, *next; - int err = 0; - -+ down_write(&flowtable->flow_block_lock); - switch (cmd) { - case FLOW_BLOCK_BIND: - list_splice(&bo->cb_list, &flowtable->flow_block.cb_list); -@@ -1029,6 +1030,7 @@ static int nf_flow_table_block_setup(str - WARN_ON_ONCE(1); - err = -EOPNOTSUPP; - } -+ up_write(&flowtable->flow_block_lock); - - return err; - } -@@ -1085,7 +1087,9 @@ static int nf_flow_table_offload_cmd(str - - nf_flow_table_block_offload_init(bo, dev_net(dev), cmd, flowtable, - extack); -+ down_write(&flowtable->flow_block_lock); - err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_FT, bo); -+ up_write(&flowtable->flow_block_lock); - if (err < 0) - return err; - diff --git a/target/linux/generic/pending-5.10/763-net-bridge-switchdev-Include-local-flag-in-FDB-notif.patch b/target/linux/generic/pending-5.10/763-net-bridge-switchdev-Include-local-flag-in-FDB-notif.patch index 41374c88df6..434288c3efb 100644 --- a/target/linux/generic/pending-5.10/763-net-bridge-switchdev-Include-local-flag-in-FDB-notif.patch +++ b/target/linux/generic/pending-5.10/763-net-bridge-switchdev-Include-local-flag-in-FDB-notif.patch @@ -22,7 +22,7 @@ Signed-off-by: Tobias Waldekranz --- a/include/net/switchdev.h +++ b/include/net/switchdev.h -@@ -224,6 +224,7 @@ struct switchdev_notifier_fdb_info { +@@ -226,6 +226,7 @@ struct switchdev_notifier_fdb_info { const unsigned char *addr; u16 vid; u8 added_by_user:1, diff --git a/target/linux/generic/pending-5.10/870-ca8210-Fix-crash-by-zero-initializing-data.patch b/target/linux/generic/pending-5.10/870-ca8210-Fix-crash-by-zero-initializing-data.patch new file mode 100644 index 00000000000..3f14988d9a4 --- /dev/null +++ b/target/linux/generic/pending-5.10/870-ca8210-Fix-crash-by-zero-initializing-data.patch @@ -0,0 +1,30 @@ +From 1e24c54da257ab93cff5826be8a793b014a5dc9c Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Mon, 21 Nov 2022 01:22:01 +0100 +Subject: ca8210: Fix crash by zero initializing data + +The struct cas_control embeds multiple generic SPI structures and we +have to make sure these structures are initialized to default values. +This driver does not set all attributes. When using kmalloc before some +attributes were not initialized and contained random data which caused +random crashes at bootup. + +Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver") +Signed-off-by: Hauke Mehrtens +Link: https://lore.kernel.org/r/20221121002201.1339636-1-hauke@hauke-m.de +Signed-off-by: Stefan Schmidt +--- + drivers/net/ieee802154/ca8210.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ieee802154/ca8210.c ++++ b/drivers/net/ieee802154/ca8210.c +@@ -926,7 +926,7 @@ static int ca8210_spi_transfer( + + dev_dbg(&spi->dev, "%s called\n", __func__); + +- cas_ctl = kmalloc(sizeof(*cas_ctl), GFP_ATOMIC); ++ cas_ctl = kzalloc(sizeof(*cas_ctl), GFP_ATOMIC); + if (!cas_ctl) + return -ENOMEM; + diff --git a/target/linux/generic/pending-5.15/630-packet_socket_type.patch b/target/linux/generic/pending-5.15/630-packet_socket_type.patch index c61935ffb05..c305aca6e0e 100644 --- a/target/linux/generic/pending-5.15/630-packet_socket_type.patch +++ b/target/linux/generic/pending-5.15/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3330,6 +3332,7 @@ static int packet_create(struct net *net +@@ -3329,6 +3331,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3971,6 +3974,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3969,6 +3972,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -4027,6 +4040,13 @@ static int packet_getsockopt(struct sock +@@ -4025,6 +4038,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index c58e6b545bf..bb30f372eb1 100644 --- a/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-5.15/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -66,7 +66,7 @@ Signed-off-by: Jonas Gorski static void rt_fibinfo_free(struct rtable __rcu **rtp) --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c -@@ -2770,6 +2770,7 @@ static const char *const rtn_type_names[ +@@ -2772,6 +2772,7 @@ static const char *const rtn_type_names[ [RTN_THROW] = "THROW", [RTN_NAT] = "NAT", [RTN_XRESOLVE] = "XRESOLVE", diff --git a/target/linux/generic/pending-5.15/701-netfilter-nf_flow_table-add-missing-locking.patch b/target/linux/generic/pending-5.15/701-netfilter-nf_flow_table-add-missing-locking.patch deleted file mode 100644 index 9ff393a8b7f..00000000000 --- a/target/linux/generic/pending-5.15/701-netfilter-nf_flow_table-add-missing-locking.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Felix Fietkau -Date: Sat, 19 Nov 2022 18:48:42 +0100 -Subject: [PATCH] netfilter: nf_flow_table: add missing locking - -nf_flow_table_block_setup and the driver TC_SETUP_FT call can modify the flow -block cb list while they are being traversed elsewhere, causing a crash. -Add a write lock around the calls to protect readers - -Signed-off-by: Felix Fietkau ---- - ---- a/net/netfilter/nf_flow_table_offload.c -+++ b/net/netfilter/nf_flow_table_offload.c -@@ -1074,6 +1074,7 @@ static int nf_flow_table_block_setup(str - struct flow_block_cb *block_cb, *next; - int err = 0; - -+ down_write(&flowtable->flow_block_lock); - switch (cmd) { - case FLOW_BLOCK_BIND: - list_splice(&bo->cb_list, &flowtable->flow_block.cb_list); -@@ -1088,6 +1089,7 @@ static int nf_flow_table_block_setup(str - WARN_ON_ONCE(1); - err = -EOPNOTSUPP; - } -+ up_write(&flowtable->flow_block_lock); - - return err; - } -@@ -1144,7 +1146,9 @@ static int nf_flow_table_offload_cmd(str - - nf_flow_table_block_offload_init(bo, dev_net(dev), cmd, flowtable, - extack); -+ down_write(&flowtable->flow_block_lock); - err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_FT, bo); -+ up_write(&flowtable->flow_block_lock); - if (err < 0) - return err; - diff --git a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 3e1486962cb..3be68a9e353 100644 --- a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -4118,6 +4118,8 @@ static int mtk_probe(struct platform_dev +@@ -4120,6 +4120,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch index 976239c1287..5baccf73cb8 100644 --- a/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ b/target/linux/generic/pending-5.15/703-phy-add-detach-callback-to-struct-phy_driver.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -1746,6 +1746,9 @@ void phy_detach(struct phy_device *phyde +@@ -1748,6 +1748,9 @@ void phy_detach(struct phy_device *phyde struct module *ndev_owner = NULL; struct mii_bus *bus; diff --git a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch b/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch index 8bf036d006f..aea6a605a90 100644 --- a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch +++ b/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch @@ -53,7 +53,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4088,7 +4088,9 @@ static int mtk_probe(struct platform_dev +@@ -4090,7 +4090,9 @@ static int mtk_probe(struct platform_dev u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400; eth->ppe[i] = mtk_ppe_init(eth, eth->base + ppe_addr, @@ -64,7 +64,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov if (!eth->ppe[i]) { err = -ENOMEM; goto err_free_dev; -@@ -4211,6 +4213,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4213,6 +4215,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -72,7 +72,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), -@@ -4248,6 +4251,7 @@ static const struct mtk_soc_data mt7629_ +@@ -4250,6 +4253,7 @@ static const struct mtk_soc_data mt7629_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7629_CLKS_BITMAP, .required_pctl = false, @@ -80,7 +80,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4268,6 +4272,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4270,6 +4274,7 @@ static const struct mtk_soc_data mt7986_ .offload_version = 2, .hash_offset = 4, .foe_entry_size = sizeof(struct mtk_foe_entry), diff --git a/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch b/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch index 116ae011f05..2e9594c8729 100644 --- a/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch +++ b/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-avoid-port_mg-assignment-on.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4197,7 +4197,7 @@ static const struct mtk_soc_data mt7621_ +@@ -4199,7 +4199,7 @@ static const struct mtk_soc_data mt7621_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, @@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau .hash_offset = 2, .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { -@@ -4237,7 +4237,7 @@ static const struct mtk_soc_data mt7623_ +@@ -4239,7 +4239,7 @@ static const struct mtk_soc_data mt7623_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, diff --git a/target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch b/target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch index fd1898586f6..0e817cd2729 100644 --- a/target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch +++ b/target/linux/generic/pending-5.15/732-04-net-ethernet-mtk_eth_soc-implement-multi-queue-suppo.patch @@ -479,7 +479,7 @@ Signed-off-by: Felix Fietkau static int mtk_open(struct net_device *dev) { struct mtk_mac *mac = netdev_priv(dev); -@@ -2970,7 +3125,8 @@ static int mtk_open(struct net_device *d +@@ -2972,7 +3127,8 @@ static int mtk_open(struct net_device *d refcount_inc(ð->dma_refcnt); phylink_start(mac->phylink); @@ -489,7 +489,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -3486,8 +3642,12 @@ static int mtk_unreg_dev(struct mtk_eth +@@ -3488,8 +3644,12 @@ static int mtk_unreg_dev(struct mtk_eth int i; for (i = 0; i < MTK_MAC_COUNT; i++) { @@ -502,7 +502,7 @@ Signed-off-by: Felix Fietkau unregister_netdev(eth->netdev[i]); } -@@ -3703,6 +3863,23 @@ static int mtk_set_rxnfc(struct net_devi +@@ -3705,6 +3865,23 @@ static int mtk_set_rxnfc(struct net_devi return ret; } @@ -526,7 +526,7 @@ Signed-off-by: Felix Fietkau static const struct ethtool_ops mtk_ethtool_ops = { .get_link_ksettings = mtk_get_link_ksettings, .set_link_ksettings = mtk_set_link_ksettings, -@@ -3738,6 +3915,7 @@ static const struct net_device_ops mtk_n +@@ -3740,6 +3917,7 @@ static const struct net_device_ops mtk_n .ndo_setup_tc = mtk_eth_setup_tc, .ndo_bpf = mtk_xdp, .ndo_xdp_xmit = mtk_xdp_xmit, @@ -534,7 +534,7 @@ Signed-off-by: Felix Fietkau }; static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) -@@ -3747,6 +3925,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3749,6 +3927,7 @@ static int mtk_add_mac(struct mtk_eth *e struct phylink *phylink; struct mtk_mac *mac; int id, err; @@ -542,7 +542,7 @@ Signed-off-by: Felix Fietkau if (!_id) { dev_err(eth->dev, "missing mac id\n"); -@@ -3764,7 +3943,10 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3766,7 +3945,10 @@ static int mtk_add_mac(struct mtk_eth *e return -EINVAL; } @@ -554,7 +554,7 @@ Signed-off-by: Felix Fietkau if (!eth->netdev[id]) { dev_err(eth->dev, "alloc_etherdev failed\n"); return -ENOMEM; -@@ -3861,6 +4043,11 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3863,6 +4045,11 @@ static int mtk_add_mac(struct mtk_eth *e else eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN; diff --git a/target/linux/generic/pending-5.15/732-09-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch b/target/linux/generic/pending-5.15/732-09-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch index c1090678029..933112c17a7 100644 --- a/target/linux/generic/pending-5.15/732-09-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch +++ b/target/linux/generic/pending-5.15/732-09-net-ethernet-mtk_eth_soc-fix-VLAN-rx-hardware-accele.patch @@ -135,7 +135,7 @@ Signed-off-by: Felix Fietkau err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); if (err) { -@@ -3417,6 +3473,10 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3419,6 +3475,10 @@ static int mtk_hw_init(struct mtk_eth *e */ val = mtk_r32(eth, MTK_CDMQ_IG_CTRL); mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL); @@ -146,7 +146,7 @@ Signed-off-by: Felix Fietkau /* Enable RX VLan Offloading */ mtk_w32(eth, 1, MTK_CDMP_EG_CTRL); -@@ -3634,6 +3694,12 @@ static int mtk_free_dev(struct mtk_eth * +@@ -3636,6 +3696,12 @@ static int mtk_free_dev(struct mtk_eth * free_netdev(eth->netdev[i]); } diff --git a/target/linux/generic/pending-5.15/732-12-net-ethernet-mtk_eth_soc-drop-packets-to-WDMA-if-the.patch b/target/linux/generic/pending-5.15/732-12-net-ethernet-mtk_eth_soc-drop-packets-to-WDMA-if-the.patch index 9fa384e6faa..6568e890d2e 100644 --- a/target/linux/generic/pending-5.15/732-12-net-ethernet-mtk_eth_soc-drop-packets-to-WDMA-if-the.patch +++ b/target/linux/generic/pending-5.15/732-12-net-ethernet-mtk_eth_soc-drop-packets-to-WDMA-if-the.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3529,9 +3529,12 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3531,9 +3531,12 @@ static int mtk_hw_init(struct mtk_eth *e mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { diff --git a/target/linux/generic/pending-5.15/732-14-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch b/target/linux/generic/pending-5.15/732-14-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch index 42f98e6aff5..c3a879e5ab9 100644 --- a/target/linux/generic/pending-5.15/732-14-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch +++ b/target/linux/generic/pending-5.15/732-14-net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch @@ -111,7 +111,7 @@ Signed-off-by: Felix Fietkau err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); if (err) { netdev_err(dev, "%s: could not attach PHY: %d\n", __func__, -@@ -3215,6 +3160,35 @@ static int mtk_open(struct net_device *d +@@ -3217,6 +3162,35 @@ static int mtk_open(struct net_device *d phylink_start(mac->phylink); netif_tx_start_all_queues(dev); @@ -147,7 +147,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -3508,10 +3482,9 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -3510,10 +3484,9 @@ static int mtk_hw_init(struct mtk_eth *e if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { val = mtk_r32(eth, MTK_CDMP_IG_CTRL); mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL); @@ -160,7 +160,7 @@ Signed-off-by: Felix Fietkau /* set interrupt delays based on current Net DIM sample */ mtk_dim_rx(ð->rx_dim.work); -@@ -4132,7 +4105,7 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4134,7 +4107,7 @@ static int mtk_add_mac(struct mtk_eth *e eth->netdev[id]->hw_features |= NETIF_F_LRO; eth->netdev[id]->vlan_features = eth->soc->hw_features & diff --git a/target/linux/generic/pending-5.15/870-ca8210-Fix-crash-by-zero-initializing-data.patch b/target/linux/generic/pending-5.15/870-ca8210-Fix-crash-by-zero-initializing-data.patch new file mode 100644 index 00000000000..1fbf78dd3d8 --- /dev/null +++ b/target/linux/generic/pending-5.15/870-ca8210-Fix-crash-by-zero-initializing-data.patch @@ -0,0 +1,30 @@ +From 1e24c54da257ab93cff5826be8a793b014a5dc9c Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Mon, 21 Nov 2022 01:22:01 +0100 +Subject: ca8210: Fix crash by zero initializing data + +The struct cas_control embeds multiple generic SPI structures and we +have to make sure these structures are initialized to default values. +This driver does not set all attributes. When using kmalloc before some +attributes were not initialized and contained random data which caused +random crashes at bootup. + +Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver") +Signed-off-by: Hauke Mehrtens +Link: https://lore.kernel.org/r/20221121002201.1339636-1-hauke@hauke-m.de +Signed-off-by: Stefan Schmidt +--- + drivers/net/ieee802154/ca8210.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ieee802154/ca8210.c ++++ b/drivers/net/ieee802154/ca8210.c +@@ -927,7 +927,7 @@ static int ca8210_spi_transfer( + + dev_dbg(&spi->dev, "%s called\n", __func__); + +- cas_ctl = kmalloc(sizeof(*cas_ctl), GFP_ATOMIC); ++ cas_ctl = kzalloc(sizeof(*cas_ctl), GFP_ATOMIC); + if (!cas_ctl) + return -ENOMEM; + diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-gl-a1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-gl-a1300.dts index 5993243dc97..a742138cdf3 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-gl-a1300.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-gl-a1300.dts @@ -267,6 +267,14 @@ pinctrl-names = "default"; }; +&usb2 { + status = "okay"; +}; + +&usb3 { + status = "okay"; +}; + &usb2_hs_phy { status = "okay"; }; diff --git a/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch b/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch index 324d42770d1..64efbd74c5b 100644 --- a/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch +++ b/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -5033,6 +5033,10 @@ int stmmac_dvr_probe(struct device *devi +@@ -5041,6 +5041,10 @@ int stmmac_dvr_probe(struct device *devi reset_control_reset(priv->plat->stmmac_rst); } @@ -40,7 +40,7 @@ Signed-off-by: David S. Miller /* Init MAC and get the capabilities */ ret = stmmac_hw_init(priv); if (ret) -@@ -5247,6 +5251,7 @@ int stmmac_dvr_remove(struct device *dev +@@ -5255,6 +5259,7 @@ int stmmac_dvr_remove(struct device *dev phylink_destroy(priv->phylink); if (priv->plat->stmmac_rst) reset_control_assert(priv->plat->stmmac_rst); diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index d17045b6db1..deea3996670 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -197,7 +197,8 @@ define Device/avm_fritz7430 DEVICE_MODEL := FRITZ!Box 7430 KERNEL_SIZE := 4096k IMAGE_SIZE := 49152k - DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader wpad-basic-wolfssl fritz-tffs-nand fritz-caldata + DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader kmod-usb-dwc2 wpad-basic-wolfssl \ + fritz-tffs-nand fritz-caldata endef TARGET_DEVICES += avm_fritz7430 diff --git a/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts b/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts new file mode 100644 index 00000000000..d86ea52fcf0 --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7622-ruijie-rg-ew3200.dtsi" + +/ { + model = "reyee AX3200 E5"; + compatible = "reyee,ax3200-e5", "mediatek,mt7622"; +}; + +&nor_flash { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_nor_pins>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Preloader"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "ATF"; + reg = <0x20000 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot"; + reg = <0x30000 0x80000>; + read-only; + }; + + partition@80000 { + label = "u-boot-env"; + reg = <0x80000 0x90000>; + }; + + factory: partition@90000 { + label = "Factory"; + reg = <0x90000 0xd0000>; + read-only; + }; + + partition@d0000 { + label = "product_info"; + reg = <0xd0000 0xe0000>; + read-only; + }; + + partition@e0000 { + label = "kdump"; + reg = <0xe0000 0xf0000>; + read-only; + }; + + partition@f0000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0xf0000 0x1000000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&epa_elna_pins>; + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&slot0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x5000>; + ieee80211-freq-limit = <5000000 6000000>; + mediatek,disable-radar-background; + }; +}; diff --git a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi new file mode 100644 index 00000000000..5a1cd99f619 --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7622.dtsi" +#include "mt6380.dtsi" + +/ { + aliases { + ethernet0 = &gmac0; + label-mac-device = &gmac0; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n1"; + bootargs = "console=ttyS0,115200n1 swiotlb=512"; + }; + + cpus { + cpu@0 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; + }; + + cpu@1 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 102 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + mesh_green { + label = "green:mesh"; + gpios = <&pio 79 GPIO_ACTIVE_LOW>; + }; + + mesh_red { + label = "red:mesh"; + gpios = <&pio 82 GPIO_ACTIVE_LOW>; + }; + + led_system: system_blue { + label = "blue:system"; + gpios = <&pio 81 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; +}; + +ð { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-connection-type = "2500base-x"; + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch@0 { + compatible = "mediatek,mt7531"; + reg = <0>; + reset-gpios = <&pio 54 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&pio>; + interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + wan: port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&pcie0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; +}; + +&pio { + epa_elna_pins: epa-elna-pins { + mux { + function = "antsel"; + groups = "antsel0", "antsel1", "antsel2", "antsel3", + "antsel4", "antsel5", "antsel6", "antsel7", + "antsel8", "antsel9", "antsel12", "antsel13", + "antsel14", "antsel15", "antsel16", "antsel17"; + }; + }; + + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "mdc_mdio", "rgmii_via_gmac2"; + }; + }; + + pcie0_pins: pcie0-pins { + mux { + function = "pcie"; + groups = "pcie0_pad_perst", + "pcie0_0_waken", + "pcie0_0_clkreq"; + }; + }; + + pmic_bus_pins: pmic-bus-pins { + mux { + function = "pmic"; + groups = "pmic_bus"; + }; + }; + + spi_nor_pins: spi-nor-pins { + mux { + function = "flash"; + groups = "spi_nor"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0_0_tx_rx"; + }; + }; + + watchdog_pins: watchdog-pins { + mux { + function = "watchdog"; + groups = "watchdog"; + }; + }; +}; + +&pwrap { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pmic_bus_pins>; +}; + +&rtc { + status = "disabled"; +}; + +&uart0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; +}; + +&watchdog { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; +}; diff --git a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts index fba9a1b8f77..857f94ae94b 100644 --- a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts +++ b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts @@ -1,239 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include -#include - -#include "mt7622.dtsi" -#include "mt6380.dtsi" +#include "mt7622-ruijie-rg-ew3200.dtsi" / { model = "Ruijie RG-EW3200GX PRO"; compatible = "ruijie,rg-ew3200gx-pro", "mediatek,mt7622"; - - aliases { - ethernet0 = &gmac0; - label-mac-device = &gmac0; - led-boot = &led_system; - led-failsafe = &led_system; - led-running = &led_system; - led-upgrade = &led_system; - serial0 = &uart0; - }; - - chosen { - stdout-path = "serial0:115200n1"; - bootargs = "console=ttyS0,115200n1 swiotlb=512"; - }; - - cpus { - cpu@0 { - proc-supply = <&mt6380_vcpu_reg>; - sram-supply = <&mt6380_vm_reg>; - }; - - cpu@1 { - proc-supply = <&mt6380_vcpu_reg>; - sram-supply = <&mt6380_vm_reg>; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - linux,code = ; - gpios = <&pio 0 GPIO_ACTIVE_LOW>; - }; - - wps { - label = "wps"; - linux,code = ; - gpios = <&pio 102 GPIO_ACTIVE_LOW>; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - mesh_green { - label = "green:mesh"; - gpios = <&pio 79 GPIO_ACTIVE_LOW>; - }; - - mesh_red { - label = "red:mesh"; - gpios = <&pio 82 GPIO_ACTIVE_LOW>; - }; - - led_system: system_blue { - label = "blue:system"; - gpios = <&pio 81 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - }; - - memory { - reg = <0 0x40000000 0 0x40000000>; - }; -}; - -ð { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <ð_pins>; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-connection-type = "2500base-x"; - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - - switch@0 { - compatible = "mediatek,mt7531"; - reg = <0>; - reset-gpios = <&pio 54 GPIO_ACTIVE_HIGH>; - - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&pio>; - interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - label = "lan1"; - }; - - port@1 { - reg = <1>; - label = "lan2"; - }; - - port@2 { - reg = <2>; - label = "lan3"; - }; - - port@3 { - reg = <3>; - label = "lan4"; - }; - - wan: port@4 { - reg = <4>; - label = "wan"; - }; - - port@6 { - reg = <6>; - label = "cpu"; - ethernet = <&gmac0>; - phy-mode = "2500base-x"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - }; - }; - }; -}; - -&pcie0 { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pcie0_pins>; -}; - -&slot0 { - wifi@0,0 { - compatible = "mediatek,mt76"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x5000>; - ieee80211-freq-limit = <5000000 6000000>; - mediatek,disable-radar-background; - }; -}; - -&pio { - epa_elna_pins: epa-elna-pins { - mux { - function = "antsel"; - groups = "antsel0", "antsel1", "antsel2", "antsel3", - "antsel4", "antsel5", "antsel6", "antsel7", - "antsel8", "antsel9", "antsel12", "antsel13", - "antsel14", "antsel15", "antsel16", "antsel17"; - }; - }; - - eth_pins: eth-pins { - mux { - function = "eth"; - groups = "mdc_mdio", "rgmii_via_gmac2"; - }; - }; - - pcie0_pins: pcie0-pins { - mux { - function = "pcie"; - groups = "pcie0_pad_perst", - "pcie0_0_waken", - "pcie0_0_clkreq"; - }; - }; - - pmic_bus_pins: pmic-bus-pins { - mux { - function = "pmic"; - groups = "pmic_bus"; - }; - }; - - spi_nor_pins: spi-nor-pins { - mux { - function = "flash"; - groups = "spi_nor"; - }; - }; - - uart0_pins: uart0-pins { - mux { - function = "uart"; - groups = "uart0_0_tx_rx"; - }; - }; - - watchdog_pins: watchdog-pins { - mux { - function = "watchdog"; - groups = "watchdog"; - }; - }; -}; - -&pwrap { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pmic_bus_pins>; }; &nor_flash { @@ -302,24 +74,6 @@ }; }; -&rtc { - status = "disabled"; -}; - -&uart0 { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins>; -}; - -&watchdog { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&watchdog_pins>; -}; - &wmac { status = "okay"; @@ -327,3 +81,13 @@ pinctrl-0 = <&epa_elna_pins>; mediatek,mtd-eeprom = <&factory 0x0>; }; + +&slot0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x5000>; + ieee80211-freq-limit = <5000000 6000000>; + mediatek,disable-radar-background; + }; +}; diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index f9cd18fd418..9760097ee4a 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -237,6 +237,15 @@ define Device/ruijie_rg-ew3200gx-pro endef TARGET_DEVICES += ruijie_rg-ew3200gx-pro +define Device/reyee_ax3200-e5 + DEVICE_VENDOR := reyee + DEVICE_MODEL := AX3200 E5 + DEVICE_DTS := mt7622-reyee-ax3200-e5 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e +endef +TARGET_DEVICES += reyee_ax3200-e5 + define Device/totolink_a8000ru DEVICE_VENDOR := TOTOLINK DEVICE_MODEL := A8000RU diff --git a/target/linux/mediatek/modules.mk b/target/linux/mediatek/modules.mk index f46a6ad2ffc..84801237259 100644 --- a/target/linux/mediatek/modules.mk +++ b/target/linux/mediatek/modules.mk @@ -29,7 +29,7 @@ $(eval $(call KernelPackage,btmtkuart)) define KernelPackage/iio-mt6577-auxadc TITLE:=Mediatek AUXADC driver - DEPENDS:=@(TARGET_mediatek_mt7622||TARGET_mediatek_mt7623||TARGET_mediatek_filogic) + DEPENDS:=@(TARGET_mediatek_mt7622||TARGET_mediatek_filogic) KCONFIG:=CONFIG_MEDIATEK_MT6577_AUXADC FILES:= \ $(LINUX_DIR)/drivers/iio/adc/mt6577_auxadc.ko diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network index 7781fcd4355..5312bf5c564 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network @@ -14,6 +14,7 @@ mediatek_setup_interfaces() linksys,e8450-ubi|\ mediatek,mt7622-rfb1|\ mediatek,mt7622-rfb1-ubi|\ + reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan ;; @@ -53,6 +54,7 @@ mediatek_setup_macs() local label_mac="" case $board in + reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) lan_mac=$(macaddr_add $(get_mac_label) 1) ;; diff --git a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 00ed12cd2f0..f8639e9f409 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -13,6 +13,7 @@ case "$board" in bananapi,bpi-r64) [ "$PHYNBR" = "0" ] && macaddr_add $(cat /sys/class/net/eth0/address) 2 > /sys${DEVPATH}/macaddress ;; + reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15 index e787539d6df..898e721df44 100644 --- a/target/linux/mediatek/mt7623/config-5.15 +++ b/target/linux/mediatek/mt7623/config-5.15 @@ -266,6 +266,7 @@ CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_MT65XX=y CONFIG_ICPLUS_PHY=y +CONFIG_IIO=y CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y @@ -319,6 +320,7 @@ CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_GPIO=y CONFIG_MEDIATEK_GE_PHY=y +CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y CONFIG_MEMORY=y diff --git a/target/linux/mvebu/Makefile b/target/linux/mvebu/Makefile index 2971f3fcaf5..6a1e0f63f70 100644 --- a/target/linux/mvebu/Makefile +++ b/target/linux/mvebu/Makefile @@ -9,7 +9,8 @@ BOARDNAME:=Marvell EBU Armada FEATURES:=fpu usb pci pcie gpio nand squashfs ramdisk boot-part rootfs-part legacy-sdcard targz SUBTARGETS:=cortexa9 cortexa53 cortexa72 -KERNEL_PATCHVER:=5.15 +KERNEL_PATCHVER:=5.10 +KERNEL_TESTING_PATCHVER:=5.15 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts index ed0b4e52cf9..8b88cfe0a31 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts @@ -49,6 +49,7 @@ status = "okay"; label = "sfp"; + phy-mode = "rgmii-rxid"; phy-handle = <&ephy7>; }; diff --git a/target/linux/ramips/dts/mt7621_wavlink_ws-wn572hp3-4g.dts b/target/linux/ramips/dts/mt7621_wavlink_ws-wn572hp3-4g.dts new file mode 100644 index 00000000000..60d0708a80e --- /dev/null +++ b/target/linux/ramips/dts/mt7621_wavlink_ws-wn572hp3-4g.dts @@ -0,0 +1,184 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "wavlink,ws-wn572hp3-4g", "mediatek,mt7621-soc"; + model = "Wavlink WS-WN572HP3 4G"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + aliases { + label-mac-device = &wifi1; + led-boot = &led_status_blue; + led-failsafe = &led_status_blue; + led-running = &led_status_blue; + led-upgrade = &led_status_blue; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset Button"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + rssihigh { + label = "blue:rssihigh"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + rssimedium { + label = "blue:rssimedium"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + + rssilow { + label = "blue:rssilow"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + led_status_blue: status_blue { + label = "blue:status"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + // gpio 15 would be Quectels PWRKEY if used + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x50000 0xf30000>; + }; + + partition@f00000 { + label = "vendor"; + reg = <0xf80000 0x80000>; + read-only; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi0: mt76@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +&pcie1 { + wifi1: mt76@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&state_default { + gpio { + groups = "wdt"; + function = "gpio"; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; + + macaddr_factory_e006: macaddr@e006 { + reg = <0xe006 0x6>; + }; +}; + +&wifi0{ + ieee80211-freq-limit = <2400000 2500000>; +}; + +&wifi1{ + ieee80211-freq-limit = <5000000 6000000>; +}; + diff --git a/target/linux/ramips/dts/mt7628an_hiwifi_hc5611.dts b/target/linux/ramips/dts/mt7628an_hiwifi_hc5611.dts new file mode 100644 index 00000000000..17de299b3cb --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_hiwifi_hc5611.dts @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an_hiwifi_hc5x61a.dtsi" + +/ { + compatible = "hiwifi,hc5611", "mediatek,mt7628an-soc"; + model = "HiWiFi HC5611"; + + leds { + compatible = "gpio-leds"; + + led_system: system { + label = "green:system"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + internet { + label = "red:internet"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&state_default { + gpio { + groups = "gpio", "spi cs1", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 82b4731bb50..08aa592be83 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -49,23 +49,6 @@ define Build/haier-sim_wr1800k-factory $(CP) $(1) $(BIN_DIR)/ endef -define Build/iodata-factory - $(eval fw_size=$(word 1,$(1))) - $(eval fw_type=$(word 2,$(1))) - $(eval product=$(word 3,$(1))) - $(eval factory_bin=$(word 4,$(1))) - if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(fw_size)" ]; then \ - $(CP) $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) $(factory_bin); \ - $(STAGING_DIR_HOST)/bin/mksenaofw \ - -r 0x30a -p $(product) -t $(fw_type) \ - -e $(factory_bin) -o $(factory_bin).new; \ - mv $(factory_bin).new $(factory_bin); \ - $(CP) $(factory_bin) $(BIN_DIR)/; \ - else \ - echo "WARNING: initramfs kernel image too big, cannot generate factory image (actual $$(stat -c%s $@); max $(fw_size))" >&2; \ - fi -endef - define Build/iodata-mstc-header ( \ data_size_crc="$$(dd if=$@ ibs=64 skip=1 2>/dev/null | gzip -c | \ @@ -972,10 +955,11 @@ define Device/iodata_wn-ax1167gr $(Device/dsa-migration) $(Device/uimage-lzma-loader) IMAGE_SIZE := 15552k - KERNEL_INITRAMFS := $$(KERNEL) | \ - iodata-factory 7864320 4 0x1055 $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.bin DEVICE_VENDOR := I-O DATA DEVICE_MODEL := WN-AX1167GR + ARTIFACTS := initramfs-factory.bin + ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \ + check-size 7680k | senao-header -r 0x30a -p 0x1055 -t 4 DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 endef TARGET_DEVICES += iodata_wn-ax1167gr @@ -1680,6 +1664,7 @@ TARGET_DEVICES += netgear_wndr3700-v5 define Device/netis_wf2881 $(Device/dsa-migration) + $(Device/uimage-lzma-loader) BLOCKSIZE := 128k PAGESIZE := 2048 FILESYSTEMS := squashfs @@ -1687,7 +1672,7 @@ define Device/netis_wf2881 IMAGE_SIZE := 129280k UBINIZE_OPTS := -E 5 UIMAGE_NAME := WF2881_0.0.00 - KERNEL_INITRAMFS := $(KERNEL_DTB) | netis-tail WF2881 | uImage lzma + KERNEL_INITRAMFS := $$(KERNEL) | netis-tail WF2881 IMAGES += factory.bin IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ @@ -2079,6 +2064,7 @@ define Device/ubnt_unifi-flexhd DEVICE_VENDOR := Ubiquiti DEVICE_MODEL := UniFi FlexHD DEVICE_DTS_CONFIG := config@2 + DEVICE_DTS_LOADADDR := 0x87000000 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware kmod-leds-ubnt-ledbar IMAGE_SIZE := 15552k @@ -2099,6 +2085,7 @@ define Device/ubnt_usw-flex DEVICE_VENDOR := Ubiquiti DEVICE_MODEL := UniFi Switch Flex DEVICE_DTS_CONFIG := config@1 + DEVICE_DTS_LOADADDR := 0x87000000 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGE_SIZE := 7360k endef @@ -2158,6 +2145,23 @@ define Device/wavlink_wl-wn533a8 endef TARGET_DEVICES += wavlink_wl-wn533a8 +define Device/wavlink_ws-wn572hp3-4g + $(Device/dsa-migration) + BLOCKSIZE := 64k + DEVICE_VENDOR := Wavlink + DEVICE_MODEL := WS-WN572HP3 + DEVICE_VARIANT := 4G + IMAGE_SIZE := 15040k + KERNEL_LOADADDR := 0x82000000 + KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | check-size | append-metadata + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ + kmod-usb3 kmod-usb-net-rndis comgt-ncm +endef +TARGET_DEVICES += wavlink_ws-wn572hp3-4g + define Device/wevo_11acnas $(Device/dsa-migration) $(Device/uimage-lzma-loader) diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 5e8d05b0428..1b7e786b52b 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -243,6 +243,14 @@ define Device/hilink_hlk-7688a endef TARGET_DEVICES += hilink_hlk-7688a +define Device/hiwifi_hc5611 + IMAGE_SIZE := 15808k + DEVICE_VENDOR := HiWiFi + DEVICE_MODEL := HC5611 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci +endef +TARGET_DEVICES += hiwifi_hc5611 + define Device/hiwifi_hc5661a IMAGE_SIZE := 15808k DEVICE_VENDOR := HiWiFi diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index c4fe2153ace..b7121db64f0 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -50,6 +50,7 @@ ramips_setup_interfaces() ;; asiarf,ap7621-001|\ humax,e10|\ + wavlink,ws-wn572hp3-4g|\ winstars,ws-wn583a6) ucidef_set_interfaces_lan_wan "lan" "wan" ;; diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index 8a21756225a..66628cea09f 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -46,6 +46,9 @@ skylab,skw92a) hilink,hlk-7688a) ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt" ;; +hiwifi,hc5611) + ucidef_set_led_netdev "internet" "internet" "red:internet" "br-lan" "tx rx" + ;; hiwifi,hc5661a|\ hiwifi,hc5761a) ucidef_set_led_switch "internet" "internet" "blue:internet" "switch0" "0x10" diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 38ff38bac5f..d85cdf3db7f 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -14,6 +14,7 @@ ramips_setup_interfaces() glinet,microuter-n300|\ glinet,vixmini|\ hak5,wifi-pineapple-mk7|\ + hiwifi,hc5611|\ mediatek,linkit-smart-7688|\ minew,g1-c|\ onion,omega2p|\ @@ -226,6 +227,7 @@ ramips_setup_macs() zyxel,keenetic-extra-ii) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1) ;; + hiwifi,hc5611|\ hiwifi,hc5661a|\ hiwifi,hc5761a|\ hiwifi,hc5861b) diff --git a/target/linux/ramips/mt76x8/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt76x8/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index b8f8faee9ca..c9e205a0fc1 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt76x8/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -10,6 +10,7 @@ PHYNBR=${DEVPATH##*/phy} board=$(board_name) case "$board" in + hiwifi,hc5611|\ hiwifi,hc5661a|\ hiwifi,hc5761a|\ hiwifi,hc5861b) diff --git a/target/linux/ramips/patches-5.10/700-net-ethernet-mediatek-support-net-labels.patch b/target/linux/ramips/patches-5.10/700-net-ethernet-mediatek-support-net-labels.patch index f86daff7d65..8eeecfc2595 100644 --- a/target/linux/ramips/patches-5.10/700-net-ethernet-mediatek-support-net-labels.patch +++ b/target/linux/ramips/patches-5.10/700-net-ethernet-mediatek-support-net-labels.patch @@ -14,7 +14,7 @@ Signed-off-by: René van Dorst --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2975,6 +2975,7 @@ static const struct net_device_ops mtk_n +@@ -2979,6 +2979,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { @@ -22,7 +22,7 @@ Signed-off-by: René van Dorst const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; -@@ -3070,6 +3071,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3074,6 +3075,9 @@ static int mtk_add_mac(struct mtk_eth *e else eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN; diff --git a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch index 8e666ec53dc..cdd81df9d4d 100644 --- a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch +++ b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch @@ -14,7 +14,7 @@ Signed-off-by: René van Dorst --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3994,6 +3994,7 @@ static const struct net_device_ops mtk_n +@@ -3996,6 +3996,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { @@ -22,7 +22,7 @@ Signed-off-by: René van Dorst const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; -@@ -4122,6 +4123,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4124,6 +4125,9 @@ static int mtk_add_mac(struct mtk_eth *e register_netdevice_notifier(&mac->device_notifier); } diff --git a/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch b/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch index 192f5b48daa..d53a8c2d792 100644 --- a/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch +++ b/target/linux/ramips/patches-5.15/720-Revert-net-phy-simplify-phy_link_change-arguments.patch @@ -71,7 +71,7 @@ still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c break; --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -1031,14 +1031,16 @@ struct phy_device *phy_find_first(struct +@@ -1032,14 +1032,16 @@ struct phy_device *phy_find_first(struct } EXPORT_SYMBOL(phy_find_first); diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts index 7ab37aaa9ff..16934ede3b8 100644 --- a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts +++ b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts @@ -11,12 +11,34 @@ compatible = "gpio-keys-polled"; poll-interval = <20>; - /* is this pin 30 on the external RTL8231 (&gpio1)? */ - /*mode { + mode { + label = "mode"; + gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { label = "reset"; - gpios = <&gpio0 94 GPIO_ACTIVE_LOW>; + gpios = <&gpio1 33 GPIO_ACTIVE_LOW>; linux,code = ; - };*/ + }; + }; + + leds { + link_act { + label = "green:link_act"; + gpios = <&gpio1 28 GPIO_ACTIVE_LOW>; + }; + + poe { + label = "green:poe"; + gpios = <&gpio1 29 GPIO_ACTIVE_LOW>; + }; + + poe_max { + label = "yellow:poe_max"; + gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + }; }; gpio1: rtl8231-gpio { diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28.dts b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28.dts index cf7b888fc9c..0bcb196b7c9 100644 --- a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28.dts +++ b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28.dts @@ -3,98 +3,9 @@ #include "rtl838x.dtsi" #include "rtl83xx_d-link_dgs-1210_common.dtsi" #include "rtl83xx_d-link_dgs-1210_gpio.dtsi" +#include "rtl8382_d-link_dgs-1210-28_common.dtsi" / { compatible = "d-link,dgs-1210-28", "realtek,rtl838x-soc"; model = "D-Link DGS-1210-28"; }; - -ðernet0 { - mdio: mdio-bus { - compatible = "realtek,rtl838x-mdio"; - regmap = <ðernet0>; - #address-cells = <1>; - #size-cells = <0>; - - EXTERNAL_PHY(0) - EXTERNAL_PHY(1) - EXTERNAL_PHY(2) - EXTERNAL_PHY(3) - EXTERNAL_PHY(4) - EXTERNAL_PHY(5) - EXTERNAL_PHY(6) - EXTERNAL_PHY(7) - - INTERNAL_PHY(8) - INTERNAL_PHY(9) - INTERNAL_PHY(10) - INTERNAL_PHY(11) - INTERNAL_PHY(12) - INTERNAL_PHY(13) - INTERNAL_PHY(14) - INTERNAL_PHY(15) - - EXTERNAL_PHY(16) - EXTERNAL_PHY(17) - EXTERNAL_PHY(18) - EXTERNAL_PHY(19) - EXTERNAL_PHY(20) - EXTERNAL_PHY(21) - EXTERNAL_PHY(22) - EXTERNAL_PHY(23) - - EXTERNAL_SFP_PHY(24) - EXTERNAL_SFP_PHY(25) - EXTERNAL_SFP_PHY(26) - EXTERNAL_SFP_PHY(27) - }; -}; - -&switch0 { - ports { - #address-cells = <1>; - #size-cells = <0>; - - SWITCH_PORT(0, 1, qsgmii) - SWITCH_PORT(1, 2, qsgmii) - SWITCH_PORT(2, 3, qsgmii) - SWITCH_PORT(3, 4, qsgmii) - SWITCH_PORT(4, 5, qsgmii) - SWITCH_PORT(5, 6, qsgmii) - SWITCH_PORT(6, 7, qsgmii) - SWITCH_PORT(7, 8, qsgmii) - - SWITCH_PORT(8, 9, internal) - SWITCH_PORT(9, 10, internal) - SWITCH_PORT(10, 11, internal) - SWITCH_PORT(11, 12, internal) - SWITCH_PORT(12, 13, internal) - SWITCH_PORT(13, 14, internal) - SWITCH_PORT(14, 15, internal) - SWITCH_PORT(15, 16, internal) - - SWITCH_PORT(16, 17, qsgmii) - SWITCH_PORT(17, 18, qsgmii) - SWITCH_PORT(18, 19, qsgmii) - SWITCH_PORT(19, 20, qsgmii) - SWITCH_PORT(20, 21, qsgmii) - SWITCH_PORT(21, 22, qsgmii) - SWITCH_PORT(22, 23, qsgmii) - SWITCH_PORT(23, 24, qsgmii) - - SWITCH_PORT(24, 25, qsgmii) - SWITCH_PORT(25, 26, qsgmii) - SWITCH_PORT(26, 27, qsgmii) - SWITCH_PORT(27, 28, qsgmii) - - port@28 { - ethernet = <ðernet0>; - reg = <28>; - phy-mode = "internal"; - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - }; -}; diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28_common.dtsi b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28_common.dtsi new file mode 100644 index 00000000000..17866d5f038 --- /dev/null +++ b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28_common.dtsi @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +ðernet0 { + mdio: mdio-bus { + compatible = "realtek,rtl838x-mdio"; + regmap = <ðernet0>; + #address-cells = <1>; + #size-cells = <0>; + + EXTERNAL_PHY(0) + EXTERNAL_PHY(1) + EXTERNAL_PHY(2) + EXTERNAL_PHY(3) + EXTERNAL_PHY(4) + EXTERNAL_PHY(5) + EXTERNAL_PHY(6) + EXTERNAL_PHY(7) + + INTERNAL_PHY(8) + INTERNAL_PHY(9) + INTERNAL_PHY(10) + INTERNAL_PHY(11) + INTERNAL_PHY(12) + INTERNAL_PHY(13) + INTERNAL_PHY(14) + INTERNAL_PHY(15) + + EXTERNAL_PHY(16) + EXTERNAL_PHY(17) + EXTERNAL_PHY(18) + EXTERNAL_PHY(19) + EXTERNAL_PHY(20) + EXTERNAL_PHY(21) + EXTERNAL_PHY(22) + EXTERNAL_PHY(23) + + EXTERNAL_SFP_PHY(24) + EXTERNAL_SFP_PHY(25) + EXTERNAL_SFP_PHY(26) + EXTERNAL_SFP_PHY(27) + }; +}; + +&switch0 { + ports { + #address-cells = <1>; + #size-cells = <0>; + + SWITCH_PORT(0, 1, qsgmii) + SWITCH_PORT(1, 2, qsgmii) + SWITCH_PORT(2, 3, qsgmii) + SWITCH_PORT(3, 4, qsgmii) + SWITCH_PORT(4, 5, qsgmii) + SWITCH_PORT(5, 6, qsgmii) + SWITCH_PORT(6, 7, qsgmii) + SWITCH_PORT(7, 8, qsgmii) + + SWITCH_PORT(8, 9, internal) + SWITCH_PORT(9, 10, internal) + SWITCH_PORT(10, 11, internal) + SWITCH_PORT(11, 12, internal) + SWITCH_PORT(12, 13, internal) + SWITCH_PORT(13, 14, internal) + SWITCH_PORT(14, 15, internal) + SWITCH_PORT(15, 16, internal) + + SWITCH_PORT(16, 17, qsgmii) + SWITCH_PORT(17, 18, qsgmii) + SWITCH_PORT(18, 19, qsgmii) + SWITCH_PORT(19, 20, qsgmii) + SWITCH_PORT(20, 21, qsgmii) + SWITCH_PORT(21, 22, qsgmii) + SWITCH_PORT(22, 23, qsgmii) + SWITCH_PORT(23, 24, qsgmii) + + SWITCH_PORT(24, 25, qsgmii) + SWITCH_PORT(25, 26, qsgmii) + SWITCH_PORT(26, 27, qsgmii) + SWITCH_PORT(27, 28, qsgmii) + + port@28 { + ethernet = <ðernet0>; + reg = <28>; + phy-mode = "internal"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28mp-f.dts b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28mp-f.dts new file mode 100644 index 00000000000..ce008229b33 --- /dev/null +++ b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28mp-f.dts @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl838x.dtsi" +#include "rtl83xx_d-link_dgs-1210_common.dtsi" +#include "rtl83xx_d-link_dgs-1210_gpio.dtsi" +#include "rtl8382_d-link_dgs-1210-28_common.dtsi" + +/ { + compatible = "d-link,dgs-1210-28mp-f", "realtek,rtl8382-soc", "realtek,rtl838x-soc"; + model = "D-Link DGS-1210-28MP F"; +}; + +&leds { + link_act { + label = "green:link_act"; + gpios = <&gpio1 28 GPIO_ACTIVE_LOW>; + }; + + poe { + label = "green:poe"; + gpios = <&gpio1 29 GPIO_ACTIVE_LOW>; + }; + + poe_max { + label = "yellow:poe_max"; + gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + }; +}; + +&keys { + mode { + label = "mode"; + gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; +}; + +&uart1 { + status = "okay"; +}; diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index c33ac7c5c49..eef66c89ce1 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -50,6 +50,15 @@ define Device/d-link_dgs-1210-28 endef TARGET_DEVICES += d-link_dgs-1210-28 +define Device/d-link_dgs-1210-28mp-f + $(Device/d-link_dgs-1210) + SOC := rtl8382 + DEVICE_MODEL := DGS-1210-28MP + DEVICE_VARIANT := F + DEVICE_PACKAGES += realtek-poe +endef +TARGET_DEVICES += d-link_dgs-1210-28mp-f + # The "IMG-" uImage name allows flashing the iniramfs from the vendor Web UI. # Avoided for sysupgrade, as the vendor FW would do an incomplete flash. define Device/engenius_ews2910p diff --git a/target/linux/rockchip/armv8/config-5.15 b/target/linux/rockchip/armv8/config-5.15 index 371d06d1644..39802ee728f 100644 --- a/target/linux/rockchip/armv8/config-5.15 +++ b/target/linux/rockchip/armv8/config-5.15 @@ -191,6 +191,7 @@ CONFIG_DUMMY_CONSOLE=y CONFIG_DWMAC_DWC_QOS_ETH=y CONFIG_DWMAC_GENERIC=y CONFIG_DWMAC_ROCKCHIP=y +CONFIG_DW_WATCHDOG=y CONFIG_EDAC_SUPPORT=y CONFIG_EEPROM_AT24=y CONFIG_EMAC_ROCKCHIP=y @@ -639,7 +640,7 @@ CONFIG_VM_EVENT_COUNTERS=y CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y -# CONFIG_WATCHDOG is not set +CONFIG_WATCHDOG_CORE=y CONFIG_XARRAY_MULTI=y CONFIG_XPS=y CONFIG_XXHASH=y diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index 07e2a432182..b7dadee7335 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.24.2 +PKG_VERSION:=3.25.1 PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION))) PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake @@ -15,7 +15,7 @@ PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v$(PKG_VERSION_MAJOR)/ -PKG_HASH:=0d9020f06f3ddf17fb537dc228e1a56c927ee506b486f55fe2dc19f69bf0c8db +PKG_HASH:=1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8 HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 diff --git a/tools/cmake/patches/120-curl-fix-libressl-linking.patch b/tools/cmake/patches/120-curl-fix-libressl-linking.patch index 6ef37c22cb2..1744fe5b04c 100644 --- a/tools/cmake/patches/120-curl-fix-libressl-linking.patch +++ b/tools/cmake/patches/120-curl-fix-libressl-linking.patch @@ -20,7 +20,7 @@ Signed-off-by: Jo-Philipp Wich --- --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt -@@ -594,6 +594,14 @@ if(CURL_USE_OPENSSL) +@@ -611,6 +611,14 @@ if(CURL_USE_OPENSSL) endif() set(SSL_ENABLED ON) set(USE_OPENSSL ON) diff --git a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch index 2b3ba361bd9..70d122c9d9e 100644 --- a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch +++ b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch @@ -1,6 +1,6 @@ --- a/bootstrap +++ b/bootstrap -@@ -1441,7 +1441,10 @@ int main(){ printf("1%c", (char)0x0a); r +@@ -1449,7 +1449,10 @@ int main(){ printf("1%c", (char)0x0a); r ' > "test.c" cmake_original_make_flags="${cmake_make_flags}" if test "x${cmake_parallel_make}" != "x"; then diff --git a/tools/cmake/patches/150-zstd-libarchive.patch b/tools/cmake/patches/150-zstd-libarchive.patch index 603ac037750..34f7240fe41 100644 --- a/tools/cmake/patches/150-zstd-libarchive.patch +++ b/tools/cmake/patches/150-zstd-libarchive.patch @@ -1,6 +1,6 @@ --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt -@@ -630,8 +630,13 @@ IF(ENABLE_ZSTD) +@@ -632,8 +632,13 @@ IF(ENABLE_ZSTD) SET(ZSTD_FIND_QUIETLY TRUE) ENDIF (ZSTD_INCLUDE_DIR) diff --git a/tools/e2fsprogs/Makefile b/tools/e2fsprogs/Makefile index 004a04ea261..a8bd745afb6 100644 --- a/tools/e2fsprogs/Makefile +++ b/tools/e2fsprogs/Makefile @@ -11,7 +11,7 @@ PKG_NAME:=e2fsprogs PKG_CPE_ID:=cpe:/a:e2fsprogs_project:e2fsprogs PKG_VERSION:=1.46.5 PKG_HASH:=2f16c9176704cf645dc69d5b15ff704ae722d665df38b2ed3cfc249757d8d81e -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/ diff --git a/tools/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch b/tools/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch new file mode 100644 index 00000000000..e5a76161f21 --- /dev/null +++ b/tools/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch @@ -0,0 +1,50 @@ +From ab51d587bb9b229b1fade1afd02e1574c1ba5c76 Mon Sep 17 00:00:00 2001 +From: Lukas Czerner +Date: Thu, 21 Apr 2022 19:31:48 +0200 +Subject: libext2fs: add sanity check to extent manipulation + +It is possible to have a corrupted extent tree in such a way that a leaf +node contains zero extents in it. Currently if that happens and we try +to traverse the tree we can end up accessing wrong data, or possibly +even uninitialized memory. Make sure we don't do that. + +Additionally make sure that we have a sane number of bytes passed to +memmove() in ext2fs_extent_delete(). + +Note that e2fsck is currently unable to spot and fix such corruption in +pass1. + +Signed-off-by: Lukas Czerner +Reported-by: Nils Bars +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2068113 +Addresses: CVE-2022-1304 +Addresses-Debian-Bug: #1010263 +Signed-off-by: Theodore Ts'o +--- + lib/ext2fs/extent.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/lib/ext2fs/extent.c ++++ b/lib/ext2fs/extent.c +@@ -495,6 +495,10 @@ retry: + ext2fs_le16_to_cpu(eh->eh_entries); + newpath->max_entries = ext2fs_le16_to_cpu(eh->eh_max); + ++ /* Make sure there is at least one extent present */ ++ if (newpath->left <= 0) ++ return EXT2_ET_EXTENT_NO_DOWN; ++ + if (path->left > 0) { + ix++; + newpath->end_blk = ext2fs_le32_to_cpu(ix->ei_block); +@@ -1630,6 +1634,10 @@ errcode_t ext2fs_extent_delete(ext2_exte + + cp = path->curr; + ++ /* Sanity check before memmove() */ ++ if (path->left < 0) ++ return EXT2_ET_EXTENT_LEAF_BAD; ++ + if (path->left) { + memmove(cp, cp + sizeof(struct ext3_extent_idx), + path->left * sizeof(struct ext3_extent_idx));