diff --git a/include/kernel-version.mk b/include/kernel-version.mk index daa1a5efa835e0..2948f7b5e8c885 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -6,11 +6,11 @@ ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-5.4 = .128 -LINUX_VERSION-5.10 = .46 +LINUX_VERSION-5.4 = .132 +LINUX_VERSION-5.10 = .50 -LINUX_KERNEL_HASH-5.4.128 = 3b54aebb816b9e628cb9ba3055a6aca58ce0ddeec49366c0da86ced9a7be39ab -LINUX_KERNEL_HASH-5.10.46 = 569122a39c6b325befb9ac1c07da0c53e6363b3baacd82081d131b06c1dc1415 +LINUX_KERNEL_HASH-5.4.132 = 8466adbfb3579e751ede683496df7bb20f258b5f882250f3dd82be63736d00ef +LINUX_KERNEL_HASH-5.10.50 = 8bda327a7d95acfff8f87fb6ef4223e3194fa22195f5551249a9aa3393bfb436 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/package/boot/arm-trusted-firmware-rk3328/Makefile b/package/boot/arm-trusted-firmware-rk3328/Makefile deleted file mode 100644 index 243fcac9c9068b..00000000000000 --- a/package/boot/arm-trusted-firmware-rk3328/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -# -# Copyright (C) 2021 ImmortalWrt -# (https://immortalwrt.org) -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=arm-trusted-firmware-rk3328 -PKG_RELEASE:=1 - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL=https://github.com/rockchip-linux/rkbin.git -PKG_SOURCE_DATE:=2020-10-30 -PKG_SOURCE_VERSION:=0bb1c512492386a72a3a0b5a0e18e49c636577b9 -PKG_MIRROR_HASH:=6dffe95b83f37a280f98c105fce529f45e39ce333b24709a9645aac1352457ce - -PKG_MAINTAINER:=AmadeusGhost - -MAKE_PATH:=$(PKG_NAME) - -include $(INCLUDE_DIR)/package.mk - -define Package/arm-trusted-firmware-rk3328 - SECTION:=boot - CATEGORY:=Boot Loaders - TITLE:=ARM Trusted Firmware for Rockchip - DEPENDS:=@TARGET_rockchip_armv8 -endef - -define Build/Configure - $(SED) 's,$$$$(PKG_BUILD_DIR),$(PKG_BUILD_DIR),g' $(PKG_BUILD_DIR)/trust.ini - $(call Build/Configure/Default) -endef - -define Build/Compile - mkimage -n rk3328 -T rksd -d $(PKG_BUILD_DIR)/bin/rk33/rk3328_ddr_333MHz_v1.16.bin $(PKG_BUILD_DIR)/idbloader.bin - cat $(PKG_BUILD_DIR)/bin/rk33/rk322xh_miniloader_v2.50.bin >> $(PKG_BUILD_DIR)/idbloader.bin - $(PKG_BUILD_DIR)/tools/trust_merger --replace bl31.elf $(PKG_BUILD_DIR)/bin/rk33/rk322xh_bl31_v1.44.elf $(PKG_BUILD_DIR)/trust.ini -endef - -define Build/InstallDev - $(INSTALL_DIR) -p $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/bin/rk33/rk322xh_bl31_v1.44.elf $(STAGING_DIR_IMAGE)/ - $(CP) $(PKG_BUILD_DIR)/tools/loaderimage $(STAGING_DIR_IMAGE)/ - $(CP) $(PKG_BUILD_DIR)/idbloader.bin $(STAGING_DIR_IMAGE)/ - $(CP) $(PKG_BUILD_DIR)/trust.bin $(STAGING_DIR_IMAGE)/ -endef - -define Package/arm-trusted-firmware-rk3328/install -endef - -$(eval $(call BuildPackage,arm-trusted-firmware-rk3328)) diff --git a/package/boot/arm-trusted-firmware-rk3328/src/trust.ini b/package/boot/arm-trusted-firmware-rk3328/src/trust.ini deleted file mode 100644 index b95797427e4f92..00000000000000 --- a/package/boot/arm-trusted-firmware-rk3328/src/trust.ini +++ /dev/null @@ -1,15 +0,0 @@ -[VERSION] -MAJOR=1 -MINOR=0 -[BL30_OPTION] -SEC=0 -[BL31_OPTION] -SEC=1 -PATH=bl31.elf -ADDR=0x10000 -[BL32_OPTION] -SEC=0 -[BL33_OPTION] -SEC=0 -[OUTPUT] -PATH=$(PKG_BUILD_DIR)/trust.bin diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 7d616ede490e89..34aaf9a5e25a9e 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -58,7 +58,7 @@ xiaomi,mi-router-ac2100|\ xiaomi,redmi-router-ac2100) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" ;; -xiaomi,mi-router-cr6606) +xiaomi,mi-router-cr660x) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ;; zyxel,nr7101) diff --git a/package/kernel/ath10k-ct/patches/970-remove-noise-log.patch b/package/kernel/ath10k-ct/patches/970-remove-noise-log.patch new file mode 100644 index 00000000000000..4813e79bf7105c --- /dev/null +++ b/package/kernel/ath10k-ct/patches/970-remove-noise-log.patch @@ -0,0 +1,45 @@ +--- a/ath10k-5.10/htt_rx.c ++++ b/ath10k-5.10/htt_rx.c +@@ -3026,7 +3026,7 @@ + + /* workaround for possibly firmware bug */ + if (unlikely(tx_done.tx_rate_code == ATH10K_CT_TX_BEACON_INVALID_RATE_CODE)) { +- dev_warn_once(ar->dev, "htt tx ct: fixing invalid VHT TX rate code 0xff\n"); ++ //dev_warn_once(ar->dev, "htt tx ct: fixing invalid VHT TX rate code 0xff\n"); + tx_done.tx_rate_code = 0; + } + +@@ -3120,7 +3120,7 @@ + + /* workaround for possibly firmware bug */ + if (unlikely(tx_done.tx_rate_code == ATH10K_CT_TX_BEACON_INVALID_RATE_CODE)) { +- dev_warn_once(ar->dev, "htt tx: fixing invalid VHT TX rate code 0xff\n"); ++ //dev_warn_once(ar->dev, "htt tx: fixing invalid VHT TX rate code 0xff\n"); + tx_done.tx_rate_code = 0; + } + +@@ -3970,11 +3970,11 @@ + if (txrate.flags == WMI_RATE_PREAMBLE_VHT && txrate.mcs > 9) { + static bool done_once = 0; + if (!done_once) { +- ath10k_warn(ar, "Invalid VHT mcs %hhd peer stats", txrate.mcs); ++ //ath10k_warn(ar, "Invalid VHT mcs %hhd peer stats", txrate.mcs); + done_once = true; + } + else { +- ath10k_dbg(ar, ATH10K_DBG_HTT, "Invalid VHT mcs %hhd peer stats", txrate.mcs); ++ //ath10k_dbg(ar, ATH10K_DBG_HTT, "Invalid VHT mcs %hhd peer stats", txrate.mcs); + } + return; + } +--- a/ath10k-5.10/wmi.c ++++ b/ath10k-5.10/wmi.c +@@ -6329,7 +6329,7 @@ + + /* workaround for possibly firmware bug */ + if (unlikely(ev->tx_rate_code == ATH10K_CT_TX_BEACON_INVALID_RATE_CODE)) { +- dev_warn_once(ar->dev, "wmi: fixing invalid VHT TX rate code 0xff\n"); ++ //dev_warn_once(ar->dev, "wmi: fixing invalid VHT TX rate code 0xff\n"); + ev->tx_rate_code = 0; + } + diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index fc892c5072fdf4..3485ff11832bc7 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -128,7 +128,7 @@ define KernelPackage/mac80211 $(call KernelPackage/mac80211/Default) TITLE:=Linux 802.11 Wireless Networking Stack # +kmod-crypto-cmac is a runtime only dependency of net/mac80211/aes_cmac.c - DEPENDS+= +kmod-cfg80211 +kmod-crypto-cmac +kmod-crypto-ccm +kmod-crypto-gcm +hostapd-common +PACKAGE_kmod-qca-nss-drv:kmod-qca-nss-drv + DEPENDS+= +kmod-cfg80211 +kmod-crypto-cmac +kmod-crypto-ccm +kmod-crypto-gcm +hostapd-common +PACKAGE_kmod-qca-nss-drv:kmod-qca-nss-drv +PACKAGE_kmod-qca-nss-drv-64:kmod-qca-nss-drv-64 KCONFIG:=\ CONFIG_AVERAGE=y FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko @@ -139,7 +139,7 @@ endef define KernelPackage/mac80211/config if PACKAGE_kmod-mac80211 - if PACKAGE_kmod-qca-nss-drv + if PACKAGE_kmod-qca-nss-drv||PACKAGE_kmod-qca-nss-drv-64 config PACKAGE_MAC80211_NSS_SUPPORT bool "Enable NSS support for IPQ platform" default y diff --git a/package/kernel/mac80211/patches/ath11k/004-v5.13-ath11k-Update-signal-filled-flag-during-sta_statisti.patch b/package/kernel/mac80211/patches/ath11k/004-v5.13-ath11k-Update-signal-filled-flag-during-sta_statisti.patch new file mode 100644 index 00000000000000..6cfa1d32db7fb9 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/004-v5.13-ath11k-Update-signal-filled-flag-during-sta_statisti.patch @@ -0,0 +1,35 @@ +From f277eb0500b4ee1cbe9db8615761f19b5a5520c9 Mon Sep 17 00:00:00 2001 +From: Sriram R +Date: Wed, 24 Feb 2021 14:32:41 +0530 +Subject: [PATCH] ath11k: Update signal filled flag during sta_statistics drv + op + +Currently, though the peer rssi information is updated to station dump +from driver sta_statistics mac op, the info doesn't get updated +since the NL80211_STA_INFO_SIGNAL filled flag is not set in station +info. Hence update this flag while filling the rssi info. + +Tested on: IPQ8074 WLAN.HK.2.1.0.1-01213-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Sriram R +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20210224090241.3098-1-srirrama@codeaurora.org +--- + drivers/net/wireless/ath/ath11k/mac.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c +index 3c1f35a204ba..32c7687d9ac2 100644 +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -6082,6 +6082,7 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, + + /* TODO: Use real NF instead of default one. */ + sinfo->signal = arsta->rssi_comb + ATH11K_DEFAULT_NOISE_FLOOR; ++ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); + } + + static const struct ieee80211_ops ath11k_ops = { +-- +2.25.1 + diff --git a/package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch b/package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch new file mode 100644 index 00000000000000..b21b671c10a51e --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch @@ -0,0 +1,111 @@ +From: Lorenzo Bianconi +Date: Sat, 9 Jan 2021 18:57:51 +0100 +Subject: [PATCH] mac80211: introduce aql_enable node in debugfs + +Introduce aql_enable node in debugfs in order to enable/disable aql. +This is useful for debugging purpose. + +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/e7a934d5d84e4796c4f97ea5de4e66c824296b07.1610214851.git.lorenzo@kernel.org +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -281,6 +281,56 @@ static const struct file_operations aql_ + .llseek = default_llseek, + }; + ++static ssize_t aql_enable_read(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ char buf[3]; ++ int len; ++ ++ len = scnprintf(buf, sizeof(buf), "%d\n", ++ !static_key_false(&aql_disable.key)); ++ ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t aql_enable_write(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ bool aql_disabled = static_key_false(&aql_disable.key); ++ char buf[3]; ++ size_t len; ++ ++ if (count > sizeof(buf)) ++ return -EINVAL; ++ ++ if (copy_from_user(buf, user_buf, count)) ++ return -EFAULT; ++ ++ buf[sizeof(buf) - 1] = '\0'; ++ len = strlen(buf); ++ if (len > 0 && buf[len - 1] == '\n') ++ buf[len - 1] = 0; ++ ++ if (buf[0] == '0' && buf[1] == '\0') { ++ if (!aql_disabled) ++ static_branch_inc(&aql_disable); ++ } else if (buf[0] == '1' && buf[1] == '\0') { ++ if (aql_disabled) ++ static_branch_dec(&aql_disable); ++ } else { ++ return -EINVAL; ++ } ++ ++ return count; ++} ++ ++static const struct file_operations aql_enable_ops = { ++ .write = aql_enable_write, ++ .read = aql_enable_read, ++ .open = simple_open, ++ .llseek = default_llseek, ++}; ++ + static ssize_t force_tx_status_read(struct file *file, + char __user *user_buf, + size_t count, +@@ -569,6 +619,7 @@ void debugfs_hw_add(struct ieee80211_loc + DEBUGFS_ADD(power); + DEBUGFS_ADD(hw_conf); + DEBUGFS_ADD_MODE(force_tx_status, 0600); ++ DEBUGFS_ADD_MODE(aql_enable, 0600); + + if (local->ops->wake_tx_queue) + DEBUGFS_ADD_MODE(aqm, 0600); +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1140,6 +1140,8 @@ enum mac80211_scan_state { + SCAN_ABORT, + }; + ++DECLARE_STATIC_KEY_FALSE(aql_disable); ++ + struct ieee80211_local { + /* embed the driver visible part. + * don't cast (use the static inlines below), but we keep +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3887,6 +3887,8 @@ void __ieee80211_schedule_txq(struct iee + } + EXPORT_SYMBOL(__ieee80211_schedule_txq); + ++DEFINE_STATIC_KEY_FALSE(aql_disable); ++ + bool ieee80211_txq_airtime_check(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) + { +@@ -3896,6 +3898,9 @@ bool ieee80211_txq_airtime_check(struct + if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) + return true; + ++ if (static_branch_unlikely(&aql_disable)) ++ return true; ++ + if (!txq->sta) + return true; + diff --git a/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch b/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch new file mode 100644 index 00000000000000..708ad6f46018a6 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch @@ -0,0 +1,39 @@ +From: Johannes Berg +Date: Fri, 18 Jun 2021 13:41:44 +0300 +Subject: [PATCH] mac80211: rearrange struct txq_info for fewer holes + +We can slightly decrease the size of struct txq_info by +rearranging some fields for fewer holes, so do that. + +Signed-off-by: Johannes Berg +Signed-off-by: Luca Coelho +Link: https://lore.kernel.org/r/iwlwifi.20210618133832.1bf019a1fe2e.Ib54622b8d6dc1a9a7dc484e573c073119450538b@changeid +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -5,7 +5,7 @@ + * Copyright 2006-2007 Jiri Benc + * Copyright 2007-2010 Johannes Berg + * Copyright 2013-2015 Intel Mobile Communications GmbH +- * Copyright (C) 2018-2020 Intel Corporation ++ * Copyright (C) 2018-2021 Intel Corporation + */ + + #ifndef IEEE80211_I_H +@@ -848,9 +848,12 @@ struct txq_info { + struct fq_tin tin; + struct codel_vars def_cvars; + struct codel_stats cstats; +- struct sk_buff_head frags; +- struct list_head schedule_order; ++ + u16 schedule_round; ++ struct list_head schedule_order; ++ ++ struct sk_buff_head frags; ++ + unsigned long flags; + + /* keep last! */ diff --git a/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch b/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch new file mode 100644 index 00000000000000..ba78f7a1428145 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch @@ -0,0 +1,1277 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Wed, 23 Jun 2021 15:47:55 +0200 +Subject: [PATCH] mac80211: Switch to a virtual time-based airtime scheduler +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This switches the airtime scheduler in mac80211 to use a virtual +time-based scheduler instead of the round-robin scheduler used before. +This has a couple of advantages: + +- No need to sync up the round-robin scheduler in firmware/hardware with + the round-robin airtime scheduler. + +- If several stations are eligible for transmission we can schedule both + of them; no need to hard-block the scheduling rotation until the head + of the queue has used up its quantum. + +- The check of whether a station is eligible for transmission becomes + simpler (in ieee80211_txq_may_transmit()). + +The drawback is that scheduling becomes slightly more expensive, as we +need to maintain an rbtree of TXQs sorted by virtual time. This means +that ieee80211_register_airtime() becomes O(logN) in the number of +currently scheduled TXQs because it can change the order of the +scheduled stations. We mitigate this overhead by only resorting when a +station changes position in the tree, and hopefully N rarely grows too +big (it's only TXQs currently backlogged, not all associated stations), +so it shouldn't be too big of an issue. + +To prevent divisions in the fast path, we maintain both station sums and +pre-computed reciprocals of the sums. This turns the fast-path operation +into a multiplication, with divisions only happening as the number of +active stations change (to re-compute the current sum of all active +station weights). To prevent this re-computation of the reciprocal from +happening too frequently, we use a time-based notion of station +activity, instead of updating the weight every time a station gets +scheduled or de-scheduled. As queues can oscillate between empty and +occupied quite frequently, this can significantly cut down on the number +of re-computations. It also has the added benefit of making the station +airtime calculation independent on whether the queue happened to have +drained at the time an airtime value was accounted. + +Co-developed-by: Yibo Zhao +Signed-off-by: Yibo Zhao +Signed-off-by: Toke Høiland-Jørgensen +Link: https://lore.kernel.org/r/20210623134755.235545-1-toke@redhat.com +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -6552,9 +6552,6 @@ 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 + * +@@ -6567,11 +6564,7 @@ void __ieee80211_schedule_txq(struct iee + * The driver may call this function if it has buffered packets for + * this TXQ internally. + */ +-static inline void +-ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) +-{ +- __ieee80211_schedule_txq(hw, txq, true); +-} ++void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); + + /** + * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() +@@ -6583,12 +6576,8 @@ ieee80211_schedule_txq(struct ieee80211_ + * The driver may set force=true if it has buffered packets for this TXQ + * internally. + */ +-static inline void +-ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, +- bool force) +-{ +- __ieee80211_schedule_txq(hw, txq, force); +-} ++void ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, ++ bool force); + + /** + * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1442,6 +1442,38 @@ 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) +@@ -1629,7 +1661,8 @@ static int sta_apply_parameters(struct i + sta_apply_mesh_params(local, sta, params); + + if (params->airtime_weight) +- sta->airtime_weight = params->airtime_weight; ++ sta_apply_airtime_params(local, sta, params); ++ + + /* 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->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]); ++ 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); + 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->aql_txq_limit_low[ac]; +- q_limit_high_old = local->aql_txq_limit_high[ac]; ++ q_limit_low_old = local->airtime[ac].aql_txq_limit_low; ++ q_limit_high_old = local->airtime[ac].aql_txq_limit_high; + +- local->aql_txq_limit_low[ac] = q_limit_low; +- local->aql_txq_limit_high[ac] = q_limit_high; ++ local->airtime[ac].aql_txq_limit_low = q_limit_low; ++ local->airtime[ac].aql_txq_limit_high = q_limit_high; + + mutex_lock(&local->sta_mtx); + list_for_each_entry(sta, &local->sta_list, list) { +@@ -382,6 +382,46 @@ 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) +@@ -624,7 +664,11 @@ void debugfs_hw_add(struct ieee80211_loc + if (local->ops->wake_tx_queue) + DEBUGFS_ADD_MODE(aqm, 0600); + +- DEBUGFS_ADD_MODE(airtime_flags, 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(aql_txq_limit); + debugfs_create_u32("aql_threshold", 0600, +--- a/net/mac80211/debugfs_netdev.c ++++ b/net/mac80211/debugfs_netdev.c +@@ -513,6 +513,34 @@ 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 */ +@@ -661,8 +689,10 @@ 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; +- s64 deficit[IEEE80211_NUM_ACS]; ++ u64 v_t[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->active_txq_lock[ac]); ++ spin_lock_bh(&local->airtime[ac].lock); + rx_airtime += sta->airtime[ac].rx_airtime; + tx_airtime += sta->airtime[ac].tx_airtime; +- deficit[ac] = sta->airtime[ac].deficit; +- spin_unlock_bh(&local->active_txq_lock[ac]); ++ v_t[ac] = sta->airtime[ac].v_t; ++ spin_unlock_bh(&local->airtime[ac].lock); + } + + 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", +- rx_airtime, tx_airtime, sta->airtime_weight, +- deficit[0], deficit[1], deficit[2], deficit[3]); ++ "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]); + + 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->active_txq_lock[ac]); ++ spin_lock_bh(&local->airtime[ac].lock); + sta->airtime[ac].rx_airtime = 0; + sta->airtime[ac].tx_airtime = 0; +- sta->airtime[ac].deficit = sta->airtime_weight; +- spin_unlock_bh(&local->active_txq_lock[ac]); ++ sta->airtime[ac].v_t = 0; ++ spin_unlock_bh(&local->airtime[ac].lock); + } + + 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->active_txq_lock[ac]); ++ spin_lock_bh(&local->airtime[ac].lock); + q_limit_l[ac] = sta->airtime[ac].aql_limit_low; + q_limit_h[ac] = sta->airtime[ac].aql_limit_high; +- spin_unlock_bh(&local->active_txq_lock[ac]); ++ spin_unlock_bh(&local->airtime[ac].lock); + q_depth[ac] = atomic_read(&sta->airtime[ac].aql_tx_pending); + } + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -840,20 +840,16 @@ 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 +- * @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 ++ * @frags: used to keep fragments created after dequeue + */ + struct txq_info { + struct fq_tin tin; + struct codel_vars def_cvars; + struct codel_stats cstats; +- +- u16 schedule_round; +- struct list_head schedule_order; ++ struct rb_node schedule_order; + + struct sk_buff_head frags; +- + unsigned long flags; + + /* keep last! */ +@@ -930,6 +926,8 @@ 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; +@@ -1143,6 +1141,44 @@ 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 { +@@ -1156,13 +1192,8 @@ struct ieee80211_local { + struct codel_params cparams; + + /* protects active_txqs and txqi->schedule_order */ +- spinlock_t active_txq_lock[IEEE80211_NUM_ACS]; +- struct list_head active_txqs[IEEE80211_NUM_ACS]; +- u16 schedule_round[IEEE80211_NUM_ACS]; +- ++ struct airtime_sched_info airtime[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; + +@@ -1581,6 +1612,125 @@ 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) || +@@ -1821,6 +1971,14 @@ 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 +@@ -2067,6 +2067,9 @@ 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 +@@ -693,10 +693,13 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + spin_lock_init(&local->queue_stop_reason_lock); + + for (i = 0; i < IEEE80211_NUM_ACS; i++) { +- 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] = ++ 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 = + IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H; + } + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -1573,12 +1573,8 @@ 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); + +- 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]); ++ ieee80211_unschedule_txq(&local->hw, txq, false); + + 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,15 +426,11 @@ 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]); +- 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]; ++ init_airtime_info(&sta->airtime[i], &local->airtime[i]); + } + + for (i = 0; i < IEEE80211_NUM_TIDS; i++) +@@ -1898,24 +1894,59 @@ void ieee80211_sta_set_buffered(struct i + } + EXPORT_SYMBOL(ieee80211_sta_set_buffered); + +-void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, +- u32 tx_airtime, u32 rx_airtime) ++void ieee80211_register_airtime(struct ieee80211_txq *txq, ++ u32 tx_airtime, u32 rx_airtime) + { +- 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); ++ 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; + u32 airtime = 0; + +- if (sta->local->airtime_flags & AIRTIME_USE_TX) ++ air_sched = &local->airtime[txq->ac]; ++ air_info = to_airtime_info(txq); ++ ++ if (local->airtime_flags & AIRTIME_USE_TX) + airtime += tx_airtime; +- if (sta->local->airtime_flags & AIRTIME_USE_RX) ++ if (local->airtime_flags & AIRTIME_USE_RX) + 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]); ++ /* 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); + } + EXPORT_SYMBOL(ieee80211_sta_register_airtime); + +@@ -2364,7 +2395,7 @@ void sta_set_sinfo(struct sta_info *sta, + } + + if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT))) { +- sinfo->airtime_weight = sta->airtime_weight; ++ sinfo->airtime_weight = sta->airtime[0].weight; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT); + } + +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -135,18 +135,25 @@ 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; +- s64 deficit; ++ u64 v_t; ++ u64 last_scheduled; ++ struct list_head list; + 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; + +@@ -515,7 +522,6 @@ 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 +@@ -646,7 +652,6 @@ 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 +@@ -972,6 +972,25 @@ 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,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1489,7 +1490,7 @@ void ieee80211_txq_init(struct ieee80211 + codel_vars_init(&txqi->def_cvars); + codel_stats_init(&txqi->cstats); + __skb_queue_head_init(&txqi->frags); +- INIT_LIST_HEAD(&txqi->schedule_order); ++ RB_CLEAR_NODE(&txqi->schedule_order); + + txqi->txq.vif = &sdata->vif; + +@@ -1533,9 +1534,7 @@ void ieee80211_txq_purge(struct ieee8021 + ieee80211_purge_tx_queue(&local->hw, &txqi->frags); + spin_unlock_bh(&fq->lock); + +- 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]); ++ ieee80211_unschedule_txq(&local->hw, &txqi->txq, true); + } + + void ieee80211_txq_set_params(struct ieee80211_local *local) +@@ -3797,102 +3796,259 @@ 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_boottime_ns(); + struct ieee80211_txq *ret = NULL; +- struct txq_info *txqi = NULL, *head = NULL; +- bool found_eligible_txq = false; ++ struct airtime_info *air_info; ++ struct txq_info *txqi = NULL; ++ struct rb_node *node; ++ bool first = false; + +- spin_lock_bh(&local->active_txq_lock[ac]); ++ air_sched = &local->airtime[ac]; ++ spin_lock_bh(&air_sched->lock); + +- begin: +- txqi = list_first_entry_or_null(&local->active_txqs[ac], +- struct txq_info, +- schedule_order); +- if (!txqi) ++ 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; + +- if (txqi == head) { +- if (!found_eligible_txq) +- goto out; +- else +- found_eligible_txq = false; ++ 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))) ++ goto out; ++ ++ if (!ieee80211_txq_airtime_check(hw, &txqi->txq)) { ++ first = false; ++ goto begin; + } + +- if (!head) +- head = txqi; ++ 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); + +- 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; ++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 (aql_check) +- found_eligible_txq = true; ++ if (new_air->v_t <= old_air->v_t) { ++ new = &parent->rb_left; ++ } else { ++ new = &parent->rb_right; ++ leftmost = false; ++ } ++ } + +- 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; ++ 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]; ++ ++ 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; ++ ++ /* 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 ((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 ((!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_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_boottime_ns(); ++ struct airtime_info *air_info; ++ u8 ac = txq->ac; ++ bool was_active; + +- if (txqi->schedule_round == local->schedule_round[ac]) ++ 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)) + goto out; + +- list_del_init(&txqi->schedule_order); +- txqi->schedule_round = local->schedule_round[ac]; +- ret = &txqi->txq; ++ /* 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); + + out: +- spin_unlock_bh(&local->active_txq_lock[ac]); +- return ret; ++ spin_unlock_bh(&air_sched->lock); + } +-EXPORT_SYMBOL(ieee80211_next_txq); ++EXPORT_SYMBOL(ieee80211_schedule_txq); + +-void __ieee80211_schedule_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq, +- bool force) ++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; + +- spin_lock_bh(&local->active_txq_lock[txq->ac]); ++ air_sched = &local->airtime[txq->ac]; ++ air_info = to_airtime_info(&txqi->txq); + +- 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]); ++ lockdep_assert_held(&air_sched->lock); ++ ++ if (purge) { ++ list_del_init(&air_info->list); ++ ieee80211_update_airtime_weight(local, air_sched, 0, true); + } + +- spin_unlock_bh(&local->active_txq_lock[txq->ac]); ++ 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_boottime_ns()); ++ ++ rb_erase_cached(&txqi->schedule_order, ++ &air_sched->active_txqs); ++ RB_CLEAR_NODE(&txqi->schedule_order); ++} ++ ++void ieee80211_unschedule_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) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct txq_info *txqi = to_txq_info(txq); ++ ++ spin_lock_bh(&local->airtime[txq->ac].lock); ++ ++ if (!RB_EMPTY_NODE(&txqi->schedule_order) && !force && ++ !txq_has_queue(txq)) ++ __ieee80211_unschedule_txq(hw, txq, false); ++ ++ spin_unlock_bh(&local->airtime[txq->ac].lock); + } +-EXPORT_SYMBOL(__ieee80211_schedule_txq); ++EXPORT_SYMBOL(ieee80211_return_txq); + + DEFINE_STATIC_KEY_FALSE(aql_disable); + + bool ieee80211_txq_airtime_check(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) + { +- struct sta_info *sta; ++ struct airtime_info *air_info = to_airtime_info(txq); + struct ieee80211_local *local = hw_to_local(hw); + + if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) +@@ -3907,15 +4063,12 @@ bool ieee80211_txq_airtime_check(struct + if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) + return true; + +- 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) ++ if (atomic_read(&air_info->aql_tx_pending) < air_info->aql_limit_low) + return true; + + if (atomic_read(&local->aql_total_pending_airtime) < + local->aql_threshold && +- atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < +- sta->airtime[txq->ac].aql_limit_high) ++ atomic_read(&air_info->aql_tx_pending) < air_info->aql_limit_high) + return true; + + return false; +@@ -3925,60 +4078,59 @@ 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 txq_info *iter, *tmp, *txqi = to_txq_info(txq); +- struct sta_info *sta; +- u8 ac = txq->ac; ++ struct airtime_sched_info *air_sched; ++ struct airtime_info *air_info; ++ struct rb_node *node = NULL; ++ bool ret = false; ++ u64 now; + +- spin_lock_bh(&local->active_txq_lock[ac]); + +- if (!txqi->txq.sta) +- goto out; ++ if (!ieee80211_txq_airtime_check(hw, txq)) ++ return false; ++ ++ air_sched = &local->airtime[txq->ac]; ++ spin_lock_bh(&air_sched->lock); + +- if (list_empty(&txqi->schedule_order)) ++ if (RB_EMPTY_NODE(&txqi->schedule_order)) + goto out; + +- list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac], +- schedule_order) { +- if (iter == txqi) +- break; ++ now = ktime_get_boottime_ns(); + +- 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]); ++ /* 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); + } + +- 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]); ++ air_info = to_airtime_info(&txqi->txq); ++ if (air_info->v_t <= air_sched->v_t) { ++ air_sched->last_schedule_activity = now; ++ ret = true; ++ } + +- return false; + out: +- if (!list_empty(&txqi->schedule_order)) +- list_del_init(&txqi->schedule_order); +- spin_unlock_bh(&local->active_txq_lock[ac]); +- +- return true; ++ spin_unlock_bh(&air_sched->lock); ++ return ret; + } + 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(&local->active_txq_lock[ac]); +- local->schedule_round[ac]++; +- spin_unlock_bh(&local->active_txq_lock[ac]); ++ spin_lock_bh(&air_sched->lock); ++ air_sched->schedule_pos = NULL; ++ spin_unlock_bh(&air_sched->lock); + } + EXPORT_SYMBOL(ieee80211_txq_schedule_start); + diff --git a/package/kernel/mac80211/patches/subsys/383-mac80211-fix-enabling-4-address-mode-on-a-sta-vif-af.patch b/package/kernel/mac80211/patches/subsys/383-mac80211-fix-enabling-4-address-mode-on-a-sta-vif-af.patch new file mode 100644 index 00000000000000..5a82f00c9e78b2 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/383-mac80211-fix-enabling-4-address-mode-on-a-sta-vif-af.patch @@ -0,0 +1,72 @@ +From: Felix Fietkau +Date: Fri, 2 Jul 2021 06:57:53 +0200 +Subject: [PATCH] mac80211: fix enabling 4-address mode on a sta vif after + assoc + +Notify the driver about the 4-address mode change and also send a nulldata +packet to the AP to notify it about the change + +Fixes: 1ff4e8f2dec8 ("mac80211: notify the driver when a sta uses 4-address mode") +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -152,6 +152,8 @@ static int ieee80211_change_iface(struct + struct vif_params *params) + { + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); ++ struct ieee80211_local *local = sdata->local; ++ struct sta_info *sta; + int ret; + + ret = ieee80211_if_change_type(sdata, type); +@@ -162,7 +164,24 @@ static int ieee80211_change_iface(struct + RCU_INIT_POINTER(sdata->u.vlan.sta, NULL); + ieee80211_check_fast_rx_iface(sdata); + } else if (type == NL80211_IFTYPE_STATION && params->use_4addr >= 0) { ++ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; ++ ++ if (params->use_4addr == ifmgd->use_4addr) ++ return 0; ++ + sdata->u.mgd.use_4addr = params->use_4addr; ++ if (!ifmgd->associated) ++ return 0; ++ ++ mutex_lock(&local->sta_mtx); ++ sta = sta_info_get(sdata, ifmgd->bssid); ++ if (sta) ++ drv_sta_set_4addr(local, sdata, &sta->sta, ++ params->use_4addr); ++ mutex_unlock(&local->sta_mtx); ++ ++ if (params->use_4addr) ++ ieee80211_send_4addr_nullfunc(local, sdata); + } + + if (sdata->vif.type == NL80211_IFTYPE_MONITOR) { +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -2224,6 +2224,8 @@ void ieee80211_dynamic_ps_timer(struct t + void ieee80211_send_nullfunc(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + bool powersave); ++void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata); + void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, + struct ieee80211_hdr *hdr, bool ack, u16 tx_time); + +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -1115,8 +1115,8 @@ void ieee80211_send_nullfunc(struct ieee + ieee80211_tx_skb(sdata, skb); + } + +-static void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local, +- struct ieee80211_sub_if_data *sdata) ++void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata) + { + struct sk_buff *skb; + struct ieee80211_hdr *nullfunc; diff --git a/package/kernel/mac80211/patches/subsys/384-nl80211-add-common-API-to-configure-SAR-power-limita.patch b/package/kernel/mac80211/patches/subsys/384-nl80211-add-common-API-to-configure-SAR-power-limita.patch new file mode 100644 index 00000000000000..0c9ae3595d87ff --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/384-nl80211-add-common-API-to-configure-SAR-power-limita.patch @@ -0,0 +1,398 @@ +From: Carl Huang +Date: Thu, 3 Dec 2020 05:37:26 -0500 +Subject: [PATCH] nl80211: add common API to configure SAR power limitations + +NL80211_CMD_SET_SAR_SPECS is added to configure SAR from +user space. NL80211_ATTR_SAR_SPEC is used to pass the SAR +power specification when used with NL80211_CMD_SET_SAR_SPECS. + +Wireless driver needs to register SAR type, supported frequency +ranges to wiphy, so user space can query it. The index in +frequency range is used to specify which sub band the power +limitation applies to. The SAR type is for compatibility, so later +other SAR mechanism can be implemented without breaking the user +space SAR applications. + +Normal process is user space queries the SAR capability, and +gets the index of supported frequency ranges and associates the +power limitation with this index and sends to kernel. + +Here is an example of message send to kernel: +8c 00 00 00 08 00 01 00 00 00 00 00 38 00 2b 81 +08 00 01 00 00 00 00 00 2c 00 02 80 14 00 00 80 +08 00 02 00 00 00 00 00 08 00 01 00 38 00 00 00 +14 00 01 80 08 00 02 00 01 00 00 00 08 00 01 00 +48 00 00 00 + +NL80211_CMD_SET_SAR_SPECS: 0x8c +NL80211_ATTR_WIPHY: 0x01(phy idx is 0) +NL80211_ATTR_SAR_SPEC: 0x812b (NLA_NESTED) +NL80211_SAR_ATTR_TYPE: 0x00 (NL80211_SAR_TYPE_POWER) +NL80211_SAR_ATTR_SPECS: 0x8002 (NLA_NESTED) +freq range 0 power: 0x38 in 0.25dbm unit (14dbm) +freq range 1 power: 0x48 in 0.25dbm unit (18dbm) + +Signed-off-by: Carl Huang +Reviewed-by: Brian Norris +Reviewed-by: Abhishek Kumar +Link: https://lore.kernel.org/r/20201203103728.3034-2-cjhuang@codeaurora.org +[minor edits, NLA parse cleanups] +Signed-off-by: Johannes Berg +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -1737,6 +1737,54 @@ struct station_info { + u8 connected_to_as; + }; + ++/** ++ * struct cfg80211_sar_sub_specs - sub specs limit ++ * @power: power limitation in 0.25dbm ++ * @freq_range_index: index the power limitation applies to ++ */ ++struct cfg80211_sar_sub_specs { ++ s32 power; ++ u32 freq_range_index; ++}; ++ ++/** ++ * struct cfg80211_sar_specs - sar limit specs ++ * @type: it's set with power in 0.25dbm or other types ++ * @num_sub_specs: number of sar sub specs ++ * @sub_specs: memory to hold the sar sub specs ++ */ ++struct cfg80211_sar_specs { ++ enum nl80211_sar_type type; ++ u32 num_sub_specs; ++ struct cfg80211_sar_sub_specs sub_specs[]; ++}; ++ ++ ++/** ++ * @struct cfg80211_sar_chan_ranges - sar frequency ranges ++ * @start_freq: start range edge frequency ++ * @end_freq: end range edge frequency ++ */ ++struct cfg80211_sar_freq_ranges { ++ u32 start_freq; ++ u32 end_freq; ++}; ++ ++/** ++ * struct cfg80211_sar_capa - sar limit capability ++ * @type: it's set via power in 0.25dbm or other types ++ * @num_freq_ranges: number of frequency ranges ++ * @freq_ranges: memory to hold the freq ranges. ++ * ++ * Note: WLAN driver may append new ranges or split an existing ++ * range to small ones and then append them. ++ */ ++struct cfg80211_sar_capa { ++ enum nl80211_sar_type type; ++ u32 num_freq_ranges; ++ const struct cfg80211_sar_freq_ranges *freq_ranges; ++}; ++ + #if IS_ENABLED(CPTCFG_CFG80211) + /** + * cfg80211_get_station - retrieve information about a given station +@@ -4259,6 +4307,8 @@ struct cfg80211_ops { + struct cfg80211_tid_config *tid_conf); + int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev, + const u8 *peer, u8 tids); ++ int (*set_sar_specs)(struct wiphy *wiphy, ++ struct cfg80211_sar_specs *sar); + }; + + /* +@@ -5030,6 +5080,8 @@ struct wiphy { + + u8 max_data_retry_count; + ++ const struct cfg80211_sar_capa *sar_capa; ++ + char priv[] __aligned(NETDEV_ALIGN); + }; + +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -405,6 +405,18 @@ nl80211_unsol_bcast_probe_resp_policy[NL + .len = IEEE80211_MAX_DATA_LEN } + }; + ++static const struct nla_policy ++sar_specs_policy[NL80211_SAR_ATTR_SPECS_MAX + 1] = { ++ [NL80211_SAR_ATTR_SPECS_POWER] = { .type = NLA_S32 }, ++ [NL80211_SAR_ATTR_SPECS_RANGE_INDEX] = {.type = NLA_U32 }, ++}; ++ ++static const struct nla_policy ++sar_policy[NL80211_SAR_ATTR_MAX + 1] = { ++ [NL80211_SAR_ATTR_TYPE] = NLA_POLICY_MAX(NLA_U32, NUM_NL80211_SAR_TYPE), ++ [NL80211_SAR_ATTR_SPECS] = NLA_POLICY_NESTED_ARRAY(sar_specs_policy), ++}; ++ + 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 }, +@@ -739,6 +751,7 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_SAE_PWE] = + NLA_POLICY_RANGE(NLA_U8, NL80211_SAE_PWE_HUNT_AND_PECK, + NL80211_SAE_PWE_BOTH), ++ [NL80211_ATTR_SAR_SPEC] = NLA_POLICY_NESTED(sar_policy), + [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, + }; + +@@ -2117,6 +2130,56 @@ fail: + return -ENOBUFS; + } + ++static int ++nl80211_put_sar_specs(struct cfg80211_registered_device *rdev, ++ struct sk_buff *msg) ++{ ++ struct nlattr *sar_capa, *specs, *sub_freq_range; ++ u8 num_freq_ranges; ++ int i; ++ ++ if (!rdev->wiphy.sar_capa) ++ return 0; ++ ++ num_freq_ranges = rdev->wiphy.sar_capa->num_freq_ranges; ++ ++ sar_capa = nla_nest_start(msg, NL80211_ATTR_SAR_SPEC); ++ if (!sar_capa) ++ return -ENOSPC; ++ ++ if (nla_put_u32(msg, NL80211_SAR_ATTR_TYPE, rdev->wiphy.sar_capa->type)) ++ goto fail; ++ ++ specs = nla_nest_start(msg, NL80211_SAR_ATTR_SPECS); ++ if (!specs) ++ goto fail; ++ ++ /* report supported freq_ranges */ ++ for (i = 0; i < num_freq_ranges; i++) { ++ sub_freq_range = nla_nest_start(msg, i + 1); ++ if (!sub_freq_range) ++ goto fail; ++ ++ if (nla_put_u32(msg, NL80211_SAR_ATTR_SPECS_START_FREQ, ++ rdev->wiphy.sar_capa->freq_ranges[i].start_freq)) ++ goto fail; ++ ++ if (nla_put_u32(msg, NL80211_SAR_ATTR_SPECS_END_FREQ, ++ rdev->wiphy.sar_capa->freq_ranges[i].end_freq)) ++ goto fail; ++ ++ nla_nest_end(msg, sub_freq_range); ++ } ++ ++ nla_nest_end(msg, specs); ++ nla_nest_end(msg, sar_capa); ++ ++ return 0; ++fail: ++ nla_nest_cancel(msg, sar_capa); ++ return -ENOBUFS; ++} ++ + struct nl80211_dump_wiphy_state { + s64 filter_wiphy; + long start; +@@ -2366,6 +2429,8 @@ static int nl80211_send_wiphy(struct cfg + CMD(set_multicast_to_unicast, SET_MULTICAST_TO_UNICAST); + CMD(update_connect_params, UPDATE_CONNECT_PARAMS); + CMD(update_ft_ies, UPDATE_FT_IES); ++ if (rdev->wiphy.sar_capa) ++ CMD(set_sar_specs, SET_SAR_SPECS); + } + #undef CMD + +@@ -2691,6 +2756,11 @@ static int nl80211_send_wiphy(struct cfg + + if (nl80211_put_tid_config_support(rdev, msg)) + goto nla_put_failure; ++ state->split_start++; ++ break; ++ case 16: ++ if (nl80211_put_sar_specs(rdev, msg)) ++ goto nla_put_failure; + + /* done */ + state->split_start = 0; +@@ -14713,6 +14783,111 @@ static void nl80211_post_doit(__genl_con + } + } + ++static int nl80211_set_sar_sub_specs(struct cfg80211_registered_device *rdev, ++ struct cfg80211_sar_specs *sar_specs, ++ struct nlattr *spec[], int index) ++{ ++ u32 range_index, i; ++ ++ if (!sar_specs || !spec) ++ return -EINVAL; ++ ++ if (!spec[NL80211_SAR_ATTR_SPECS_POWER] || ++ !spec[NL80211_SAR_ATTR_SPECS_RANGE_INDEX]) ++ return -EINVAL; ++ ++ range_index = nla_get_u32(spec[NL80211_SAR_ATTR_SPECS_RANGE_INDEX]); ++ ++ /* check if range_index exceeds num_freq_ranges */ ++ if (range_index >= rdev->wiphy.sar_capa->num_freq_ranges) ++ return -EINVAL; ++ ++ /* check if range_index duplicates */ ++ for (i = 0; i < index; i++) { ++ if (sar_specs->sub_specs[i].freq_range_index == range_index) ++ return -EINVAL; ++ } ++ ++ sar_specs->sub_specs[index].power = ++ nla_get_s32(spec[NL80211_SAR_ATTR_SPECS_POWER]); ++ ++ sar_specs->sub_specs[index].freq_range_index = range_index; ++ ++ return 0; ++} ++ ++static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info) ++{ ++ struct cfg80211_registered_device *rdev = info->user_ptr[0]; ++ struct nlattr *spec[NL80211_SAR_ATTR_SPECS_MAX + 1]; ++ struct nlattr *tb[NL80211_SAR_ATTR_MAX + 1]; ++ struct cfg80211_sar_specs *sar_spec; ++ enum nl80211_sar_type type; ++ struct nlattr *spec_list; ++ u32 specs; ++ int rem, err; ++ ++ if (!rdev->wiphy.sar_capa || !rdev->ops->set_sar_specs) ++ return -EOPNOTSUPP; ++ ++ if (!info->attrs[NL80211_ATTR_SAR_SPEC]) ++ return -EINVAL; ++ ++ nla_parse_nested(tb, NL80211_SAR_ATTR_MAX, ++ info->attrs[NL80211_ATTR_SAR_SPEC], ++ NULL, NULL); ++ ++ if (!tb[NL80211_SAR_ATTR_TYPE] || !tb[NL80211_SAR_ATTR_SPECS]) ++ return -EINVAL; ++ ++ type = nla_get_u32(tb[NL80211_SAR_ATTR_TYPE]); ++ if (type != rdev->wiphy.sar_capa->type) ++ return -EINVAL; ++ ++ specs = 0; ++ nla_for_each_nested(spec_list, tb[NL80211_SAR_ATTR_SPECS], rem) ++ specs++; ++ ++ if (specs > rdev->wiphy.sar_capa->num_freq_ranges) ++ return -EINVAL; ++ ++ sar_spec = kzalloc(sizeof(*sar_spec) + ++ specs * sizeof(struct cfg80211_sar_sub_specs), ++ GFP_KERNEL); ++ if (!sar_spec) ++ return -ENOMEM; ++ ++ sar_spec->type = type; ++ specs = 0; ++ nla_for_each_nested(spec_list, tb[NL80211_SAR_ATTR_SPECS], rem) { ++ nla_parse_nested(spec, NL80211_SAR_ATTR_SPECS_MAX, ++ spec_list, NULL, NULL); ++ ++ switch (type) { ++ case NL80211_SAR_TYPE_POWER: ++ if (nl80211_set_sar_sub_specs(rdev, sar_spec, ++ spec, specs)) { ++ err = -EINVAL; ++ goto error; ++ } ++ break; ++ default: ++ err = -EINVAL; ++ goto error; ++ } ++ specs++; ++ } ++ ++ sar_spec->num_sub_specs = specs; ++ ++ rdev->cur_cmd_info = info; ++ err = rdev_set_sar_specs(rdev, sar_spec); ++ rdev->cur_cmd_info = NULL; ++error: ++ kfree(sar_spec); ++ return err; ++} ++ + static __genl_const struct genl_ops nl80211_ops[] = { + { + .cmd = NL80211_CMD_GET_WIPHY, +@@ -15576,6 +15751,14 @@ static const struct genl_small_ops nl802 + .internal_flags = NL80211_FLAG_NEED_NETDEV | + NL80211_FLAG_NEED_RTNL, + }, ++ { ++ .cmd = NL80211_CMD_SET_SAR_SPECS, ++ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, ++ .doit = nl80211_set_sar_specs, ++ .flags = GENL_UNS_ADMIN_PERM, ++ .internal_flags = NL80211_FLAG_NEED_WIPHY | ++ NL80211_FLAG_NEED_RTNL, ++ }, + }; + + static struct genl_family nl80211_fam __genl_ro_after_init = { +--- a/net/wireless/rdev-ops.h ++++ b/net/wireless/rdev-ops.h +@@ -1356,4 +1356,16 @@ static inline int rdev_reset_tid_config( + return ret; + } + ++static inline int rdev_set_sar_specs(struct cfg80211_registered_device *rdev, ++ struct cfg80211_sar_specs *sar) ++{ ++ int ret; ++ ++ trace_rdev_set_sar_specs(&rdev->wiphy, sar); ++ ret = rdev->ops->set_sar_specs(&rdev->wiphy, sar); ++ trace_rdev_return_int(&rdev->wiphy, ret); ++ ++ return ret; ++} ++ + #endif /* __CFG80211_RDEV_OPS */ +--- a/net/wireless/trace.h ++++ b/net/wireless/trace.h +@@ -3551,6 +3551,25 @@ TRACE_EVENT(rdev_reset_tid_config, + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", peer: " MAC_PR_FMT ", tids: 0x%x", + WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), __entry->tids) + ); ++ ++TRACE_EVENT(rdev_set_sar_specs, ++ TP_PROTO(struct wiphy *wiphy, struct cfg80211_sar_specs *sar), ++ TP_ARGS(wiphy, sar), ++ TP_STRUCT__entry( ++ WIPHY_ENTRY ++ __field(u16, type) ++ __field(u16, num) ++ ), ++ TP_fast_assign( ++ WIPHY_ASSIGN; ++ __entry->type = sar->type; ++ __entry->num = sar->num_sub_specs; ++ ++ ), ++ TP_printk(WIPHY_PR_FMT ", Set type:%d, num_specs:%d", ++ WIPHY_PR_ARG, __entry->type, __entry->num) ++); ++ + #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ + + #undef TRACE_INCLUDE_PATH diff --git a/package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch b/package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch new file mode 100644 index 00000000000000..c351bc812a2558 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch @@ -0,0 +1,51 @@ +From: Carl Huang +Date: Thu, 3 Dec 2020 05:37:27 -0500 +Subject: [PATCH] mac80211: add ieee80211_set_sar_specs + +This change registers ieee80211_set_sar_specs to +mac80211_config_ops, so cfg80211 can call it. + +Signed-off-by: Carl Huang +Reviewed-by: Brian Norris +Reviewed-by: Abhishek Kumar +Link: https://lore.kernel.org/r/20201203103728.3034-3-cjhuang@codeaurora.org +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -4207,6 +4207,8 @@ struct ieee80211_ops { + struct ieee80211_vif *vif); + void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, bool enabled); ++ int (*set_sar_specs)(struct ieee80211_hw *hw, ++ const struct cfg80211_sar_specs *sar); + void (*sta_set_decap_offload)(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, bool enabled); +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -4136,6 +4136,17 @@ static int ieee80211_reset_tid_config(st + return ret; + } + ++static int ieee80211_set_sar_specs(struct wiphy *wiphy, ++ struct cfg80211_sar_specs *sar) ++{ ++ struct ieee80211_local *local = wiphy_priv(wiphy); ++ ++ if (!local->ops->set_sar_specs) ++ return -EOPNOTSUPP; ++ ++ return local->ops->set_sar_specs(&local->hw, sar); ++} ++ + const struct cfg80211_ops mac80211_config_ops = { + .add_virtual_intf = ieee80211_add_iface, + .del_virtual_intf = ieee80211_del_iface, +@@ -4239,4 +4250,5 @@ const struct cfg80211_ops mac80211_confi + .probe_mesh_link = ieee80211_probe_mesh_link, + .set_tid_config = ieee80211_set_tid_config, + .reset_tid_config = ieee80211_reset_tid_config, ++ .set_sar_specs = ieee80211_set_sar_specs, + }; 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 febe42eb9d3fa3..b2ee61a6dc9786 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 -@@ -3745,6 +3745,7 @@ struct mgmt_frame_regs { +@@ -3793,6 +3793,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 @@ * * @set_wds_peer: set the WDS peer for a WDS interface * -@@ -4067,6 +4068,7 @@ struct cfg80211_ops { +@@ -4115,6 +4116,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); @@ -57,7 +57,7 @@ __NL80211_ATTR_AFTER_LAST, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2709,6 +2709,19 @@ static int ieee80211_get_tx_power(struct +@@ -2761,6 +2761,19 @@ static int ieee80211_get_tx_power(struct return 0; } @@ -77,7 +77,7 @@ static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev, const u8 *addr) { -@@ -4139,6 +4152,7 @@ const struct cfg80211_ops mac80211_confi +@@ -4202,6 +4215,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_CMD(ieee80211_testmode_cmd) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1390,6 +1390,7 @@ struct ieee80211_local { +@@ -1426,6 +1426,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ @@ -129,15 +129,15 @@ local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -740,6 +740,7 @@ static const struct nla_policy nl80211_p - NLA_POLICY_RANGE(NLA_U8, NL80211_SAE_PWE_HUNT_AND_PECK, +@@ -753,6 +753,7 @@ static const struct nla_policy nl80211_p NL80211_SAE_PWE_BOTH), + [NL80211_ATTR_SAR_SPEC] = NLA_POLICY_NESTED(sar_policy), [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, }; /* policy for the key attributes */ -@@ -3248,6 +3249,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -3318,6 +3319,20 @@ static int nl80211_set_wiphy(struct sk_b if (result) return result; } diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 74d5950545228d..431c57a240a4ac 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:=2021-06-06 -PKG_SOURCE_VERSION:=22b690334c0f49b11534cc2e331c9d5e17c4a0bc -PKG_MIRROR_HASH:=ff5e563935919d2e40c1e7254ef3bc06f7ecc5e69f8ddd12903e8f5de942d630 +PKG_SOURCE_DATE:=2021-07-15 +PKG_SOURCE_VERSION:=bbebea7d6dc64313132226adc3f7369d36e9359d +PKG_MIRROR_HASH:=17cd74e72c1f6c8742b698bf6772afacc6fba71b233af8c4d59530600cf44d5b PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/package/lean/default-settings/Makefile b/package/lean/default-settings/Makefile index 31a7e5fa492699..baa7c951b1b4a3 100644 --- a/package/lean/default-settings/Makefile +++ b/package/lean/default-settings/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=default-settings PKG_VERSION:=2 -PKG_RELEASE:=15 +PKG_RELEASE:=16 PKG_LICENSE:=GPLv3 PKG_LICENSE_FILES:=LICENSE diff --git a/package/lean/default-settings/files/zzz-default-settings b/package/lean/default-settings/files/zzz-default-settings index a6e6fa6181c10d..05c58be3297af6 100755 --- a/package/lean/default-settings/files/zzz-default-settings +++ b/package/lean/default-settings/files/zzz-default-settings @@ -45,7 +45,7 @@ sed -i '/option disabled/d' /etc/config/wireless sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release -echo "DISTRIB_REVISION='R21.7.1.100'" >> /etc/openwrt_release +echo "DISTRIB_REVISION='R21.7.15'" >> /etc/openwrt_release sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release echo "DISTRIB_DESCRIPTION='OpenWrt '" >> /etc/openwrt_release diff --git a/package/lean/dnsproxy/Makefile b/package/lean/dnsproxy/Makefile index 7b1433f3f2249e..4a791cf9f13edb 100644 --- a/package/lean/dnsproxy/Makefile +++ b/package/lean/dnsproxy/Makefile @@ -61,8 +61,6 @@ define Package/dnsproxy/description work as a DNS-over-HTTPS, DNS-over-TLS or DNS-over-QUIC server. endef -GO_PKG_INSTALL_ARGS+= -mod vendor - define Build/Compile $(call GoPackage/Build/Compile) ifeq ($(CONFIG_DNSPROXY_COMPRESS_UPX),y) diff --git a/package/lean/luci-app-arpbind/root/etc/hotplug.d/iface/50-arpbind b/package/lean/luci-app-arpbind/root/etc/hotplug.d/iface/50-arpbind old mode 100644 new mode 100755 diff --git a/package/lean/luci-app-arpbind/root/etc/init.d/arpbind b/package/lean/luci-app-arpbind/root/etc/init.d/arpbind index 7e1048dab6d5ba..c2c0fa8d1a4ec4 100755 --- a/package/lean/luci-app-arpbind/root/etc/init.d/arpbind +++ b/package/lean/luci-app-arpbind/root/etc/init.d/arpbind @@ -2,8 +2,8 @@ # OpenWrt 静态ARP绑定 启动脚本 # Copyright (C) 2015 GuoGuo -. /lib/functions.sh -. /lib/functions/network.sh +START=80 +STOP=20 #清除单接口ARP #参数:$1:接口名称 diff --git a/package/lean/luci-app-dnsfilter/Makefile b/package/lean/luci-app-dnsfilter/Makefile deleted file mode 100644 index 925afad5fac112..00000000000000 --- a/package/lean/luci-app-dnsfilter/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include $(TOPDIR)/rules.mk - -PKG_NAME:=luci-app-dnsfilter -include $(TOPDIR)/rules.mk - -LUCI_TITLE:=LuCI support for DNSFilter -LUCI_DEPENDS:=+uclient-fetch +ipset +dnsmasq-full -LUCI_PKGARCH:=all -PKG_NAME:=luci-app-dnsfilter -PKG_VERSION:=1 -PKG_RELEASE:=3 - -include $(TOPDIR)/feeds/luci/luci.mk - -# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-dnsfilter/luasrc/controller/dnsfilter.lua b/package/lean/luci-app-dnsfilter/luasrc/controller/dnsfilter.lua deleted file mode 100644 index 656cb60d498c1f..00000000000000 --- a/package/lean/luci-app-dnsfilter/luasrc/controller/dnsfilter.lua +++ /dev/null @@ -1,48 +0,0 @@ -module("luci.controller.dnsfilter",package.seeall) -function index() - if not nixio.fs.access("/etc/config/dnsfilter") then - return - end - local page = entry({"admin","services","dnsfilter"},alias("admin","services","dnsfilter","base"),_("DNSFilter ADBlock"),9) - page.dependent = true - page.acl_depends = { "luci-app-dnsfilter" } - entry({"admin","services","dnsfilter","base"},cbi("dnsfilter/base"),_("Base Setting"),10).leaf=true - entry({"admin","services","dnsfilter","white"},form("dnsfilter/white"),_("White Domain List"),20).leaf=true - entry({"admin","services","dnsfilter","black"},form("dnsfilter/black"),_("Block Domain List"),30).leaf=true - entry({"admin","services","dnsfilter","ip"},form("dnsfilter/ip"),_("Block IP List"),40).leaf=true - entry({"admin","services","dnsfilter","log"},form("dnsfilter/log"),_("Update Log"),50).leaf=true - entry({"admin","services","dnsfilter","run"},call("act_status")).leaf = true - entry({"admin","services","dnsfilter","refresh"},call("refresh_data")) -end - -function act_status() - local e={} - e.running=luci.sys.call("[ -s /tmp/dnsmasq.dnsfilter/rules.conf ]")==0 - luci.http.prepare_content("application/json") - luci.http.write_json(e) -end - -function refresh_data() -local set=luci.http.formvalue("set") -local icount=0 - - luci.sys.exec("/usr/share/dnsfilter/dnsfilter down") - icount=luci.sys.exec("find /tmp/ad_tmp -type f -name rules.conf -exec cat {} \\; 2>/dev/null | wc -l") - if tonumber(icount)>0 then - oldcount=luci.sys.exec("find /tmp/dnsfilter -type f -name rules.conf -exec cat {} \\; 2>/dev/null | wc -l") - if tonumber(icount) ~= tonumber(oldcount) then - luci.sys.exec("[ -h /tmp/dnsfilter/url ] && (rm -f /etc/dnsfilter/rules/*;cp -a /tmp/ad_tmp/* /etc/dnsfilter/rules) || (rm -f /tmp/dnsfilter/*;cp -a /tmp/ad_tmp/* /tmp/dnsfilter)") - luci.sys.exec("/etc/init.d/dnsfilter restart &") - retstring=tostring(math.ceil(tonumber(icount))) - else - retstring=0 - end - luci.sys.call("echo `date +'%Y-%m-%d %H:%M:%S'` > /tmp/dnsfilter/dnsfilter.updated") - else - retstring="-1" - end - luci.sys.exec("rm -rf /tmp/ad_tmp") - - luci.http.prepare_content("application/json") - luci.http.write_json({ret=retstring,retcount=icount}) -end diff --git a/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/base.lua b/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/base.lua deleted file mode 100644 index 3f69d5626bd792..00000000000000 --- a/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/base.lua +++ /dev/null @@ -1,81 +0,0 @@ -local SYS=require "luci.sys" - -m=Map("dnsfilter") -m.title=translate("DNSFilter ADBlock") -m.description=translate("Support AdGuardHome/Host/DNSMASQ/Domain Rules") -m:section(SimpleSection).template="dnsfilter/dnsfilter_status" - -s=m:section(TypedSection,"dnsfilter") -s.anonymous=true - -o=s:option(Flag,"enable") -o.title=translate("Enable") -o.rmempty=false - -o=s:option(Flag,"block_ios") -o.title=translate("Block Apple iOS OTA update") - -o=s:option(Flag,"block_cnshort") -o.title=translate("Block CNshort APP and Website") - -o=s:option(Flag,"safe_search") -o.title=translate("Safe Search") -o.description=translate("Enforcing SafeSearch for google, bing, duckduckgo, yandex and youtube.") - -o=s:option(Flag,"cron_mode") -o.title=translate("Enable automatic update rules") - -o=s:option(ListValue,"time_update") -o.title=translate("Update time") -for s=0,23 do -o:value(s) -end -o.default=6 -o:depends("cron_mode",1) - -tmp_rule=0 -if nixio.fs.access("/tmp/dnsfilter/rules.conf") then -tmp_rule=1 -UD=SYS.exec("cat /tmp/dnsfilter/dnsfilter.updated 2>/dev/null") -rule_count=tonumber(SYS.exec("find /tmp/dnsfilter -exec cat {} \\; 2>/dev/null | wc -l")) -o=s:option(DummyValue,"1",translate("Subscribe Rules Data")) -o.rawhtml=true -o.template="dnsfilter/refresh" -o.value=rule_count.." "..translate("Records") -o.description=string.format(translate("AdGuardHome / Host / DNSMASQ / Domain rules auto-convert").."
"..translate("Last Update Checked")..": %s
",UD) -end - -o=s:option(Flag,"flash") -o.title=translate("Save rules to flash") -o.description=translate("Should be enabled when rules addresses are slow to download") -o.rmempty=false - -if tmp_rule==1 then -o=s:option(Button,"delete",translate("Delete All Subscribe Rules")) -o.inputstyle="reset" -o.description=translate("Delete rules files and delete the subscription link
There is no need to click for modify the subscription link,The script will automatically replace the old rule file") -o.write=function() - SYS.exec("[ -d /etc/dnsfilter/rules ] && rm -rf /etc/dnsfilter/rules") - SYS.exec("grep -wq 'list url' /etc/config/dnsfilter && sed -i '/list url/d' /etc/config/dnsfilter && /etc/init.d/dnsfilter restart 2>&1 &") - luci.http.redirect(luci.dispatcher.build_url("admin","services","dnsfilter","base")) -end -end - -if luci.sys.call("[ -h /tmp/dnsfilter/url ] || exit 9")==9 then - if nixio.fs.access("/etc/dnsfilter/rules") then - o=s:option(Button,"delete_1",translate("Delete Subscribe Rules On The Flash")) - o.inputstyle="reset" - o.write=function() - SYS.exec("rm -rf /etc/dnsfilter/rules") - luci.http.redirect(luci.dispatcher.build_url("admin","services","dnsfilter","base")) - end - end -end - -o=s:option(DynamicList,"url",translate("Anti-AD Rules Subscribe")) -o:value("https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD@master/adblock-for-dnsmasq.conf","anti-AD") -o:value("https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt","AdGuard") -o:value("https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt","Easylistchina+Easylist") -o:value("https://block.energized.pro/extensions/porn-lite/formats/domains.txt","Anti-Porn") - -return m diff --git a/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/black.lua b/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/black.lua deleted file mode 100644 index 1c70d1baca2668..00000000000000 --- a/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/black.lua +++ /dev/null @@ -1,25 +0,0 @@ -local fs=require "nixio.fs" -local conffile="/etc/dnsfilter/black.list" - -f=SimpleForm("custom") -t=f:field(TextValue,"conf") -t.rmempty=true -t.rows=13 -t.description=translate("Will Always block these Domain") -function t.cfgvalue() - return fs.readfile(conffile) or "" -end - -function f.handle(self,state,data) - if state == FORM_VALID then - if data.conf then - fs.writefile(conffile,data.conf:gsub("\r\n","\n")) - else - luci.sys.call("> /etc/dnsfilter/black.list") - end - luci.sys.exec("[ \"$(uci -q get dnsfilter.@dnsfilter[0].enable)\" = 1 ] && /etc/init.d/dnsfilter restart") - end - return true -end - -return f diff --git a/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/ip.lua b/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/ip.lua deleted file mode 100644 index c40dc0b20ea8f2..00000000000000 --- a/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/ip.lua +++ /dev/null @@ -1,25 +0,0 @@ -local fs=require "nixio.fs" -local conffile="/etc/dnsfilter/ip.list" - -f=SimpleForm("custom") -t=f:field(TextValue,"conf") -t.rmempty=true -t.rows=13 -t.description=translate("Will Always block these IP") -function t.cfgvalue() - return fs.readfile(conffile) or "" -end - -function f.handle(self,state,data) - if state == FORM_VALID then - if data.conf then - fs.writefile(conffile,data.conf:gsub("\r\n","\n")) - else - luci.sys.call("> /etc/dnsfilter/ip.list") - end - luci.sys.exec("ipset -F blockip 2>/dev/null && for i in $(cat /etc/dnsfilter/ip.list);do ipset add blockip $i 2>/dev/null;done") - end - return true -end - -return f diff --git a/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/log.lua b/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/log.lua deleted file mode 100644 index 19685fc4f536f0..00000000000000 --- a/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/log.lua +++ /dev/null @@ -1,15 +0,0 @@ -local fs=require "nixio.fs" -local conffile="/tmp/adupdate.log" - -f=SimpleForm("logview") -f.reset=false -f.submit=false -t=f:field(TextValue,"conf") -t.rmempty=true -t.rows=20 -function t.cfgvalue() - return fs.readfile(conffile) or "" -end -t.readonly="readonly" - -return f diff --git a/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/white.lua b/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/white.lua deleted file mode 100644 index fbfe953fe41f98..00000000000000 --- a/package/lean/luci-app-dnsfilter/luasrc/model/cbi/dnsfilter/white.lua +++ /dev/null @@ -1,27 +0,0 @@ -local fs=require "nixio.fs" -local conffile="/etc/dnsfilter/white.list" - -f=SimpleForm("custom") -t=f:field(TextValue,"conf") -t.rmempty=true -t.rows=13 -t.description=translate("Will Never filter these Domain") -function t.cfgvalue() - return fs.readfile(conffile) or "" -end - -function f.handle(self,state,data) - if state == FORM_VALID then - if data.conf then - fs.writefile(conffile,data.conf:gsub("\r\n","\n")) - else - luci.sys.call("> /etc/dnsfilter/white.list") - end - luci.sys.exec("for i in $(cat /etc/dnsfilter/white.list);do sed -i -e \"/\\/$i\\//d\" -e \"/\\.$i\\//d\" /tmp/dnsfilter/rules.conf 2>/dev/null;\\\ - [ -s /etc/dnsfilter/rules/rules.conf ] && sed -i -e \"/\\/$i\\//d\" -e \"/\\.$i\\//d\" /etc/dnsfilter/rules/rules.conf;done;\\\ - [ -s /tmp/dnsfilter/rules.conf ] && rm -f /tmp/dnsmasq.dnsfilter/rules.conf && /etc/init.d/dnsfilter start") - end - return true -end - -return f diff --git a/package/lean/luci-app-dnsfilter/luasrc/view/dnsfilter/dnsfilter_status.htm b/package/lean/luci-app-dnsfilter/luasrc/view/dnsfilter/dnsfilter_status.htm deleted file mode 100644 index eba95426bacfc3..00000000000000 --- a/package/lean/luci-app-dnsfilter/luasrc/view/dnsfilter/dnsfilter_status.htm +++ /dev/null @@ -1,21 +0,0 @@ - - -
-

- <%:Collecting data...%> -

-
diff --git a/package/lean/luci-app-dnsfilter/luasrc/view/dnsfilter/refresh.htm b/package/lean/luci-app-dnsfilter/luasrc/view/dnsfilter/refresh.htm deleted file mode 100644 index 2909bdc13d2e4d..00000000000000 --- a/package/lean/luci-app-dnsfilter/luasrc/view/dnsfilter/refresh.htm +++ /dev/null @@ -1,34 +0,0 @@ -<%+cbi/valueheader%> - - -<%=self.value%> -<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-dnsfilter/po/zh-cn/dnsfilter.zh-cn.po b/package/lean/luci-app-dnsfilter/po/zh-cn/dnsfilter.zh-cn.po deleted file mode 100644 index 283d4340b76b08..00000000000000 --- a/package/lean/luci-app-dnsfilter/po/zh-cn/dnsfilter.zh-cn.po +++ /dev/null @@ -1,107 +0,0 @@ -msgid "Base Setting" -msgstr "基本设置" - -msgid "Support AdGuardHome/Host/DNSMASQ/Domain Rules" -msgstr "支持 AdGuardHome/Host/DNSMASQ/Domain 规则" - -msgid "RUNNING" -msgstr "运行中" - -msgid "NOT RUNNING" -msgstr "未运行" - -msgid "Enable" -msgstr "启用" - -msgid "Block Apple iOS OTA update" -msgstr "拦截 Apple iOS 的OTA更新" - -msgid "Block CNshort APP and Website" -msgstr "拦截 短视频 APP 和网站" - -msgid "Enable automatic update rules" -msgstr "启用规则自动更新" - -msgid "Update time" -msgstr "更新时间" - -msgid "DNSFilter Data" -msgstr "DNSFilter 规则数据库" - -msgid "Records" -msgstr "条记录" - -msgid "Refresh..." -msgstr "正在更新,请稍候.." - -msgid "No new data!" -msgstr "你已经是最新数据,无需更新!" - -msgid "Refresh Error!" -msgstr "更新失败!" - -msgid "Refresh OK!" -msgstr "更新成功!" - -msgid "Total Records:" -msgstr "新的总纪录数:" - -msgid "Refresh Data" -msgstr "更新数据库" - -msgid "Last Update Checked" -msgstr "上一次检查规则更新" - -msgid "Subscribe Rules Data" -msgstr "去广告规则" - -msgid "AdGuardHome / Host / DNSMASQ / Domain rules auto-convert" -msgstr "AdGuardHome / Host / DNSMASQ /Domain 规则自动识别, 自动去重" - -msgid "Save rules to flash" -msgstr "保存规则到闪存" - -msgid "Should be enabled when rules addresses are slow to download" -msgstr "规则地址下载速度慢时应该打开" - -msgid "Delete All Subscribe Rules" -msgstr "清空所有订阅的规则库" - -msgid "Delete rules files and delete the subscription link
There is no need to click for modify the subscription link,The script will automatically replace the old rule file" -msgstr "清空规则文件,并且删除所有的订阅链接
如果只是修改订阅链接不需要清空,脚本会自动覆盖旧的规则文件" - -msgid "Delete Subscribe Rules On The Flash" -msgstr "清空闪存上的订阅规则库" - -msgid "Anti-AD Rules Subscribe" -msgstr "广告过滤规则订阅URL" - -msgid "White Domain List" -msgstr "域名白名单" - -msgid "Will Never filter these Domain" -msgstr "永不过滤白名单内的域名" - -msgid "Block Domain List" -msgstr "域名黑名单" - -msgid "Will Always block these Domain" -msgstr "拦截黑名单内的域名" - -msgid "Block IP List" -msgstr "IP黑名单" - -msgid "Will Always block these IP" -msgstr "拦截黑名单内的IP地址" - -msgid "Safe Search" -msgstr "安全搜索" - -msgid "Enforcing SafeSearch for google, bing, duckduckgo, yandex and youtube." -msgstr "强制为google,bing,duckduckgo,yandex,youtube开启安全搜索,过滤不健康内容" - -msgid "Update Log" -msgstr "更新日志" - -msgid "DNSFilter ADBlock" -msgstr "DNS 广告过滤" diff --git a/package/lean/luci-app-dnsfilter/po/zh_Hans b/package/lean/luci-app-dnsfilter/po/zh_Hans deleted file mode 120000 index 41451e4a19c465..00000000000000 --- a/package/lean/luci-app-dnsfilter/po/zh_Hans +++ /dev/null @@ -1 +0,0 @@ -zh-cn \ No newline at end of file diff --git a/package/lean/luci-app-dnsfilter/root/etc/config/dnsfilter b/package/lean/luci-app-dnsfilter/root/etc/config/dnsfilter deleted file mode 100644 index 43ef5a80abfa33..00000000000000 --- a/package/lean/luci-app-dnsfilter/root/etc/config/dnsfilter +++ /dev/null @@ -1,8 +0,0 @@ - -config dnsfilter - option cron_mode '1' - option time_update '6' - option flash '0' - option enable '0' - list url 'https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD@master/adblock-for-dnsmasq.conf' - diff --git a/package/lean/luci-app-dnsfilter/root/etc/dnsfilter/black.list b/package/lean/luci-app-dnsfilter/root/etc/dnsfilter/black.list deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/package/lean/luci-app-dnsfilter/root/etc/dnsfilter/ip.list b/package/lean/luci-app-dnsfilter/root/etc/dnsfilter/ip.list deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/package/lean/luci-app-dnsfilter/root/etc/dnsfilter/white.list b/package/lean/luci-app-dnsfilter/root/etc/dnsfilter/white.list deleted file mode 100644 index ffbdf5be596435..00000000000000 --- a/package/lean/luci-app-dnsfilter/root/etc/dnsfilter/white.list +++ /dev/null @@ -1 +0,0 @@ -boxer.baidu.com diff --git a/package/lean/luci-app-dnsfilter/root/etc/init.d/dnsfilter b/package/lean/luci-app-dnsfilter/root/etc/init.d/dnsfilter deleted file mode 100755 index 143994fa477e66..00000000000000 --- a/package/lean/luci-app-dnsfilter/root/etc/init.d/dnsfilter +++ /dev/null @@ -1,440 +0,0 @@ -#!/bin/sh /etc/rc.common -START=99 -STOP=10 -B=0 -CRON_FILE=/etc/crontabs/root -D=/tmp/dnsmasq.dnsfilter -E="date +'%Y-%m-%d %H:%M:%S'" -L=/etc/dnsfilter -P=/usr/share/dnsfilter -T=/tmp/dnsfilter -STATUS=Y -TAG="_DNSFILTER_RULE_" -FWI=$(uci -q get firewall.dnsfilter.path) -enable=$(uci -q get dnsfilter.@dnsfilter[0].enable) -flash=$(uci -q get dnsfilter.@dnsfilter[0].flash) -url=$(uci -q get dnsfilter.@dnsfilter[0].url) - -get_config(){ - config_get_bool cron_mode $1 cron_mode 1 - config_get_bool block_ios $1 block_ios 0 - config_get_bool block_cnshort $1 block_cnshort 0 - config_get_bool safe_search $1 safe_search 0 - config_get time_update $1 time_update 6 -} - -add_dns(){ - mkdir -p /tmp/dnsmasq.d $D - echo conf-dir=$D > /tmp/dnsmasq.d/dnsfilter.conf - if [ -n "$url" -a ! -s /tmp/dnsfilter/failed ];then - mkdir -p $T - if [ $flash = 1 ];then - ln -sf $L/rules/rules.conf $T/rules.conf - ln -sf $L/rules/url $T/url - fi - ln -sf $T/rules.conf $D/rules.conf - fi - [ $block_ios = 1 ] && echo 'mesu.apple.com' > $D/black.conf - if [ $block_cnshort = 1 ];then - cat <<-EOF >> $D/black.conf -amemv.com -tiktokv.com -snssdk.com -douyin.com -ixigua.com -pstatp.com -ixiguavideo.com -v.kandian.qq.com -yximgs.com -gifshow.com -ksapisrv.com -kuaishoupay.com -ksyun.com -live.xycdn.com -danuoyi.alicdn.com -v.weishi.qq.com -pearvideo.com -miaopai.com -kuaishou.com -qupai.me -meipai.com -huoshan.com -ergengtv.com -baijiahao.baidu.com -xiongzhang.baidu.com -EOF - fi - cat $L/black.list >> $D/black.conf - if [ -s $D/black.conf ];then - sed -i -e 's:^:address=/:' -e 's:$:/:' $D/black.conf - echo "`sort -u $D/black.conf`" > $D/black.conf - for i in $(cat $D/black.conf);do - if grep -wq $i $D/rules.conf 2>/dev/null;then - sed -i -e "s#$i##" -e '/^$/d' $D/black.conf - fi - done - for i in $(cat $L/white.list);do sed -i -e "/\/$i\//d" -e "/\.$i\//d" $D/black.conf;done - else - rm -f $D/black.conf - fi - - if [ $safe_search = 1 ];then - cat <<-EOF >> $D/safesearch.conf -address=/www.bing.com/204.79.197.220 -address=/www.google.com/216.239.38.120 -address=/google.com/216.239.38.120 -address=/www.google.ad/216.239.38.120 -address=/google.ad/216.239.38.120 -address=/www.google.ae/216.239.38.120 -address=/google.ae/216.239.38.120 -address=/www.google.al/216.239.38.120 -address=/google.al/216.239.38.120 -address=/www.google.am/216.239.38.120 -address=/google.am/216.239.38.120 -address=/www.google.as/216.239.38.120 -address=/google.as/216.239.38.120 -address=/www.google.at/216.239.38.120 -address=/google.at/216.239.38.120 -address=/www.google.az/216.239.38.120 -address=/google.az/216.239.38.120 -address=/www.google.ba/216.239.38.120 -address=/google.ba/216.239.38.120 -address=/www.google.be/216.239.38.120 -address=/google.be/216.239.38.120 -address=/www.google.bf/216.239.38.120 -address=/google.bf/216.239.38.120 -address=/www.google.bg/216.239.38.120 -address=/google.bg/216.239.38.120 -address=/www.google.bi/216.239.38.120 -address=/google.bi/216.239.38.120 -address=/www.google.bj/216.239.38.120 -address=/google.bj/216.239.38.120 -address=/www.google.bs/216.239.38.120 -address=/google.bs/216.239.38.120 -address=/www.google.bt/216.239.38.120 -address=/google.bt/216.239.38.120 -address=/www.google.by/216.239.38.120 -address=/google.by/216.239.38.120 -address=/www.google.ca/216.239.38.120 -address=/google.ca/216.239.38.120 -address=/www.google.cd/216.239.38.120 -address=/google.cd/216.239.38.120 -address=/www.google.cf/216.239.38.120 -address=/google.cf/216.239.38.120 -address=/www.google.cg/216.239.38.120 -address=/google.cg/216.239.38.120 -address=/www.google.ch/216.239.38.120 -address=/google.ch/216.239.38.120 -address=/www.google.ci/216.239.38.120 -address=/google.ci/216.239.38.120 -address=/www.google.cl/216.239.38.120 -address=/google.cl/216.239.38.120 -address=/www.google.cm/216.239.38.120 -address=/google.cm/216.239.38.120 -address=/www.google.cn/216.239.38.120 -address=/google.cn/216.239.38.120 -address=/www.google.cv/216.239.38.120 -address=/google.cv/216.239.38.120 -address=/www.google.cz/216.239.38.120 -address=/google.cz/216.239.38.120 -address=/www.google.de/216.239.38.120 -address=/google.de/216.239.38.120 -address=/www.google.dj/216.239.38.120 -address=/google.dj/216.239.38.120 -address=/www.google.dk/216.239.38.120 -address=/google.dk/216.239.38.120 -address=/www.google.dm/216.239.38.120 -address=/google.dm/216.239.38.120 -address=/www.google.dz/216.239.38.120 -address=/google.dz/216.239.38.120 -address=/www.google.ee/216.239.38.120 -address=/google.ee/216.239.38.120 -address=/www.google.es/216.239.38.120 -address=/google.es/216.239.38.120 -address=/www.google.fi/216.239.38.120 -address=/google.fi/216.239.38.120 -address=/www.google.fm/216.239.38.120 -address=/google.fm/216.239.38.120 -address=/www.google.fr/216.239.38.120 -address=/google.fr/216.239.38.120 -address=/www.google.ga/216.239.38.120 -address=/google.ga/216.239.38.120 -address=/www.google.ge/216.239.38.120 -address=/google.ge/216.239.38.120 -address=/www.google.gg/216.239.38.120 -address=/google.gg/216.239.38.120 -address=/www.google.gl/216.239.38.120 -address=/google.gl/216.239.38.120 -address=/www.google.gm/216.239.38.120 -address=/google.gm/216.239.38.120 -address=/www.google.gr/216.239.38.120 -address=/google.gr/216.239.38.120 -address=/www.google.gy/216.239.38.120 -address=/google.gy/216.239.38.120 -address=/www.google.hn/216.239.38.120 -address=/google.hn/216.239.38.120 -address=/www.google.hr/216.239.38.120 -address=/google.hr/216.239.38.120 -address=/www.google.ht/216.239.38.120 -address=/google.ht/216.239.38.120 -address=/www.google.hu/216.239.38.120 -address=/google.hu/216.239.38.120 -address=/www.google.ie/216.239.38.120 -address=/google.ie/216.239.38.120 -address=/www.google.im/216.239.38.120 -address=/google.im/216.239.38.120 -address=/www.google.iq/216.239.38.120 -address=/google.iq/216.239.38.120 -address=/www.google.is/216.239.38.120 -address=/google.is/216.239.38.120 -address=/www.google.it/216.239.38.120 -address=/google.it/216.239.38.120 -address=/www.google.je/216.239.38.120 -address=/google.je/216.239.38.120 -address=/www.google.jo/216.239.38.120 -address=/google.jo/216.239.38.120 -address=/www.google.ki/216.239.38.120 -address=/google.ki/216.239.38.120 -address=/www.google.kg/216.239.38.120 -address=/google.kg/216.239.38.120 -address=/www.google.kz/216.239.38.120 -address=/google.kz/216.239.38.120 -address=/www.google.la/216.239.38.120 -address=/google.la/216.239.38.120 -address=/www.google.li/216.239.38.120 -address=/google.li/216.239.38.120 -address=/www.google.lk/216.239.38.120 -address=/google.lk/216.239.38.120 -address=/www.google.lt/216.239.38.120 -address=/google.lt/216.239.38.120 -address=/www.google.lu/216.239.38.120 -address=/google.lu/216.239.38.120 -address=/www.google.lv/216.239.38.120 -address=/google.lv/216.239.38.120 -address=/www.google.md/216.239.38.120 -address=/google.md/216.239.38.120 -address=/www.google.me/216.239.38.120 -address=/google.me/216.239.38.120 -address=/www.google.mg/216.239.38.120 -address=/google.mg/216.239.38.120 -address=/www.google.mk/216.239.38.120 -address=/google.mk/216.239.38.120 -address=/www.google.ml/216.239.38.120 -address=/google.ml/216.239.38.120 -address=/www.google.mn/216.239.38.120 -address=/google.mn/216.239.38.120 -address=/www.google.ms/216.239.38.120 -address=/google.ms/216.239.38.120 -address=/www.google.mu/216.239.38.120 -address=/google.mu/216.239.38.120 -address=/www.google.mv/216.239.38.120 -address=/google.mv/216.239.38.120 -address=/www.google.mw/216.239.38.120 -address=/google.mw/216.239.38.120 -address=/www.google.ne/216.239.38.120 -address=/google.ne/216.239.38.120 -address=/www.google.nl/216.239.38.120 -address=/google.nl/216.239.38.120 -address=/www.google.no/216.239.38.120 -address=/google.no/216.239.38.120 -address=/www.google.nr/216.239.38.120 -address=/google.nr/216.239.38.120 -address=/www.google.nu/216.239.38.120 -address=/google.nu/216.239.38.120 -address=/www.google.pl/216.239.38.120 -address=/google.pl/216.239.38.120 -address=/www.google.pn/216.239.38.120 -address=/google.pn/216.239.38.120 -address=/www.google.ps/216.239.38.120 -address=/google.ps/216.239.38.120 -address=/www.google.pt/216.239.38.120 -address=/google.pt/216.239.38.120 -address=/www.google.ro/216.239.38.120 -address=/google.ro/216.239.38.120 -address=/www.google.ru/216.239.38.120 -address=/google.ru/216.239.38.120 -address=/www.google.rw/216.239.38.120 -address=/google.rw/216.239.38.120 -address=/www.google.sc/216.239.38.120 -address=/google.sc/216.239.38.120 -address=/www.google.se/216.239.38.120 -address=/google.se/216.239.38.120 -address=/www.google.sh/216.239.38.120 -address=/google.sh/216.239.38.120 -address=/www.google.si/216.239.38.120 -address=/google.si/216.239.38.120 -address=/www.google.sk/216.239.38.120 -address=/google.sk/216.239.38.120 -address=/www.google.sn/216.239.38.120 -address=/google.sn/216.239.38.120 -address=/www.google.so/216.239.38.120 -address=/google.so/216.239.38.120 -address=/www.google.sm/216.239.38.120 -address=/google.sm/216.239.38.120 -address=/www.google.sr/216.239.38.120 -address=/google.sr/216.239.38.120 -address=/www.google.st/216.239.38.120 -address=/google.st/216.239.38.120 -address=/www.google.td/216.239.38.120 -address=/google.td/216.239.38.120 -address=/www.google.tg/216.239.38.120 -address=/google.tg/216.239.38.120 -address=/www.google.tl/216.239.38.120 -address=/google.tl/216.239.38.120 -address=/www.google.tm/216.239.38.120 -address=/google.tm/216.239.38.120 -address=/www.google.tn/216.239.38.120 -address=/google.tn/216.239.38.120 -address=/www.google.to/216.239.38.120 -address=/google.to/216.239.38.120 -address=/www.google.tt/216.239.38.120 -address=/google.tt/216.239.38.120 -address=/www.google.vg/216.239.38.120 -address=/google.vg/216.239.38.120 -address=/www.google.vu/216.239.38.120 -address=/google.vu/216.239.38.120 -address=/www.google.ws/216.239.38.120 -address=/google.ws/216.239.38.120 -address=/www.google.rs/216.239.38.120 -address=/google.rs/216.239.38.120 -address=/www.google.cat/216.239.38.120 -address=/google.cat/216.239.38.120 -address=/ya.ru/213.180.193.56 -address=/yandex.ru/213.180.193.56 -address=/yandex.com/213.180.193.56 -address=/yandex.com.tr/213.180.193.56 -address=/yandex.ua/213.180.193.56 -address=/yandex.by/213.180.193.56 -address=/yandex.ee/213.180.193.56 -address=/yandex.lt/213.180.193.56 -address=/yandex.lv/213.180.193.56 -address=/yandex.md/213.180.193.56 -address=/yandex.uz/213.180.193.56 -address=/yandex.tm/213.180.193.56 -address=/yandex.tj/213.180.193.56 -address=/yandex.az/213.180.193.56 -address=/www.youtube.com/216.239.38.119 -address=/m.youtube.com/216.239.38.119 -address=/youtubei.googleapis.com/216.239.38.119 -address=/youtube.googleapis.com/216.239.38.119 -address=/www.youtube-nocookie.com/216.239.38.119 -EOF - fi -} - -gen(){ - echo '#!/bin/sh' > $FWI -} - -add_rule(){ - ipset -N blockip hash:net 2>/dev/null - for i in $(cat $L/ip.list);do ipset -! add blockip $i;done - iptables -I FORWARD -m set --match-set blockip dst -m comment --comment "$TAG" -j DROP - iptables -I OUTPUT -m set --match-set blockip dst -m comment --comment "$TAG" -j DROP - gen - extract_rules(){ - echo "*$1" - iptables-save -t $1 | grep DNSFILTER |\ - sed -e "s/^-A \(OUTPUT\|FORWARD\)/-I \1 1/" - echo 'COMMIT' - } - cat <<-EOF >> $FWI - iptables-save -c | grep -v DNSFILTER | iptables-restore -c - iptables-restore -n <<-EOT - $(extract_rules filter) - EOT -EOF -} - -add_cron(){ - if [ $cron_mode = 1 ];then - if ! grep -wq "$time_update \* \* \* .*dnsfilter" $CRON_FILE;then - grep -q dnsfilter $CRON_FILE && sed -i '/dnsfilter/d' $CRON_FILE - echo "0 $time_update * * * $P/dnsfilter > /tmp/adupdate.log 2>&1" >> $CRON_FILE - /etc/init.d/cron restart - fi - else - del_cron - fi -} - -del_cron(){ - if grep -q dnsfilter $CRON_FILE;then - sed -i '/dnsfilter/d' $CRON_FILE - /etc/init.d/cron restart - fi -} - -del_rule(){ - iptables -D FORWARD -m set --match-set blockip dst -m comment --comment "$TAG" -j DROP 2>/dev/null - iptables -D OUTPUT -m set --match-set blockip dst -m comment --comment "$TAG" -j DROP 2>/dev/null - ipset -X blockip 2>/dev/null - gen -} - -start(){ - config_load dnsfilter - config_foreach get_config dnsfilter - if [ $enable = 0 ];then - echo "`eval $E` [DNSFilter is disabled]" - exit 1 - fi - if [ -s $D/rules.conf ];then - echo "`eval $E` [DNSFilter is running]" - exit 1 - fi - if [ -n "$url" ];then - [ $flash = 0 -a ! -s $T/rules.conf ] && B=1 - [ $flash = 1 -a ! -s $L/rules/rules.conf ] && B=1 - fi - if [ $B = 1 ];then - echo "`eval $E` [Download Subscribe Rules...]" - $P/addown --down $B >/dev/null 2>&1 & - exit 9 - fi - echo "`eval $E` [Load DNSFilter Rules]" - add_dns - add_rule - add_cron - if [ $STATUS = Y ];then - echo "`eval $E` [Dnsmasq Change]" - /etc/init.d/dnsmasq restart >/dev/null 2>&1 - fi -} - -stop(){ - del_rule - kill -9 $(ps -w | grep grep $P/dnsfilter | grep -v grep | awk '{print$1}') 2>/dev/null - kill -9 $(ps -w | grep grep $P/addown | grep -v grep | awk '{print$1}') 2>/dev/null - kill -9 $(ps -w | grep ad_new.conf | grep -v grep | awk '{print$1}') 2>/dev/null - echo "`eval $E` [Stop DNSFilter]" - rm -rf /tmp/dnsmasq.d/dnsfilter.conf $D /var/lock/dnsfilter.lock - if [ "$(echo $url | sed 's/ /\n/g' | sort -u)" != "$(cat $T/url 2>/dev/null)" ];then - rm -rf $T - [ -d $L/rules ] && rm -rf $L/rules - fi - ([ -h $T/url -a $flash = 0 ] || [ -z "$url" ]) && rm -rf $T - [ $enable = 0 ] && del_cron - if [ $STATUS = Y ];then - rm -rf $T - echo "`eval $E` [Revert Dnsmasq]" - /etc/init.d/dnsmasq restart >/dev/null 2>&1 - rm -f /tmp/adupdate.log - fi -} - -restart(){ - if [ $enable = 1 ];then - STATUS=N - stop - start - echo "`eval $E` [Restart Dnsmasq]" - /etc/init.d/dnsmasq restart >/dev/null 2>&1 - else - stop - fi -} - -boot(){ - gen;start -} diff --git a/package/lean/luci-app-dnsfilter/root/etc/uci-defaults/luci-dnsfilter b/package/lean/luci-app-dnsfilter/root/etc/uci-defaults/luci-dnsfilter deleted file mode 100755 index 85bc6e7f0023cc..00000000000000 --- a/package/lean/luci-app-dnsfilter/root/etc/uci-defaults/luci-dnsfilter +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -uci -q batch <<-EOF >/dev/null - delete ucitrack.@dnsfilter[-1] - add ucitrack dnsfilter - set ucitrack.@dnsfilter[-1].init=dnsfilter - commit ucitrack - delete firewall.dnsfilter - set firewall.dnsfilter=include - set firewall.dnsfilter.type=script - set firewall.dnsfilter.path=/var/etc/dnsfilter.include - set firewall.dnsfilter.reload=1 - commit firewall -EOF -chmod 755 /etc/init.d/dnsfilter /usr/share/dnsfilter/* >/dev/null 2>&1 -rm -rf /tmp/luci-modulecache /tmp/luci-indexcache* -exit 0 diff --git a/package/lean/luci-app-dnsfilter/root/rpcd/acl.d/luci-app-dnsfilter.json b/package/lean/luci-app-dnsfilter/root/rpcd/acl.d/luci-app-dnsfilter.json deleted file mode 100644 index a6cfdfe4e6b9b8..00000000000000 --- a/package/lean/luci-app-dnsfilter/root/rpcd/acl.d/luci-app-dnsfilter.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "luci-app-dnsfilter": { - "description": "Grant UCI access for luci-app-dnsfilter", - "read": { - "uci": [ "dnsfilter" ] - }, - "write": { - "uci": [ "dnsfilter" ] - } - } -} diff --git a/package/lean/luci-app-dnsfilter/root/usr/share/dnsfilter/addown b/package/lean/luci-app-dnsfilter/root/usr/share/dnsfilter/addown deleted file mode 100755 index 3db581e0ec647f..00000000000000 --- a/package/lean/luci-app-dnsfilter/root/usr/share/dnsfilter/addown +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -[ "$1" = --down ] || exit 1 -# 防止重复启动 -LOCK=/var/lock/dnsfilter.lock -[ -f $LOCK ] && exit 1 -touch $LOCK - -B=/tmp/dnsfilter -C=/tmp/adupdate.log -D="date +'%Y-%m-%d %H:%M:%S'" -E="uclient-fetch --no-check-certificate --continue -O" -G="Download Subscribe Rules" - -if [ "$2" = 1 ];then - echo "`eval $D` [$G]" >> $C - /usr/share/dnsfilter/dnsfilter addown >> $C -fi - -echo "`eval $D` [Start DNSFilter]" >> $C;echo `eval $D` > $B/dnsfilter.updated -rm -f $LOCK -/etc/init.d/dnsfilter start & diff --git a/package/lean/luci-app-dnsfilter/root/usr/share/dnsfilter/dnsfilter b/package/lean/luci-app-dnsfilter/root/usr/share/dnsfilter/dnsfilter deleted file mode 100755 index 666da18cdc82c2..00000000000000 --- a/package/lean/luci-app-dnsfilter/root/usr/share/dnsfilter/dnsfilter +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/sh -# 防止重复启动 -LOCK=/var/lock/dnsfilter.lock -if [ -f $LOCK ];then - case $1 in - gen|addown)X=1;; - *)exit 1;; - esac -fi -touch $LOCK - -B="Download Subscribe Rules" -C=0 -D=0 -E="date +'%Y-%m-%d %H:%M:%S'" -U=`uci -q get dnsfilter.@dnsfilter[0].url` -P=/tmp/dnsfilter -W=`cat /etc/dnsfilter/white.list` - -gen(){ - cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | grep -Ev "^\|\|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}*" | sed -e 's:||:address=/:' -e 's:\^:/:' > /tmp/ad.conf - for i in $W;do sed -i -e "/\/$i\//d" -e "/\.$i\//d" /tmp/ad.conf;done - rm -f /tmp/adnew.conf -} - -down(){ - G=/tmp/ad_tmp - F=$G/ad_new.conf - rm -rf $G - mkdir -p $G $P - for i in $U;do - X=1 - while ! uclient-fetch --no-check-certificate --timeout=5 --continue -O $F $i;do - [ $X -ge 20 ] && echo "`eval $E` [Download $i Failed]" && continue 2 || let X++ - sleep 2 - done - X=`md5sum $G/rules.conf 2>/dev/null | awk '{print$1}'` - Y=`md5sum $G/host 2>/dev/null | awk '{print$1}'` - sed -i -e '/127.0.0.1 #/d' -e '/127.0.0.1 !/d' -e 's:#.*::' -e 's:!.*::' -e 's/\$important//g' -e 's/[ \t]*$//g' -e 's/^[ \t]*//g' -e '/\*/d' -e '/^$/d' $F - sed -i "s/\r//g" $F - if grep -q "^address=" $F;then - cat $F >> $G/rules.conf - elif grep -q -e "^0.0.0.0 " -e "^127.0.0.1 " $F;then - cat $F >> $G/host - elif ! grep -q -e "|" -e "@" $F;then - cat $F | sed -e 's:^:address=/:' -e 's:$:/:' >> $G/rules.conf - else - cat $F | grep ^\|\|[^\*]*\^$ | grep -Ev "^\|\|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}*" | sed -e 's:||:address=/:' -e 's:\^.*:/:' >> $G/rules.conf - fi - [ "$X" = "`md5sum $G/rules.conf 2>/dev/null | awk '{print$1}'`" -a "$Y" = "`md5sum $G/host 2>/dev/null | awk '{print$1}'`" ] && echo "`eval $E` [Conversion $i Failed]" - echo $i >> $G/url - done - [ -s $G/host ] && sed -e '/:/d' -e '/ 0.0.0.0/d' -e '/255.255.255.255/d' -e '/ local/d' -e 's:127.0.0.1 :address=/:' -e 's:0.0.0.0 :address=/:' -e 's:$:/:' $G/host >> $G/rules.conf - [ -s $G/rules.conf ] && sed -i -e 's:/127.0.0.1$:/:' -e 's:/0.0.0.0$:/:' $G/rules.conf && echo "`sort -u $G/rules.conf`" > $G/rules.conf - [ -s $G/url ] && echo "`sort -u $G/url`" > $G/url - if [ -s $G/rules.conf ];then - echo "`eval $E` [$B Successful]" - rm -f $F $G/host $P/failed - for i in $W;do sed -i -e "/\/$i\//d" -e "/\.$i\//d" $G/rules.conf;done - [ "$1" = 2 ] && rm -f $LOCK && exit - X=`uci -q get dnsfilter.@dnsfilter[0].flash` - Y=`md5sum $G/* | awk '{print$1}'` - [ $X = 0 ] && Z=`md5sum $P/* 2>/dev/null | awk '{print$1}'` || Z=`md5sum /etc/dnsfilter/rules/* 2>/dev/null | awk '{print$1}'` - if [ "$Y" != "$Z" ];then - [ "$1" = 1 ] || echo "`eval $E` [Subscribe Rules Need Update]" - if [ "$X" = 0 ];then - rm -f $P/* - cp -a $G/* $P - else - [ ! -d "/etc/dnsfilter/rules" ] && - mkdir /etc/dnsfilter/rules - rm -f /etc/dnsfilter/rules/* - cp -a $G/* /etc/dnsfilter/rules - fi - D=1 - else - echo "`eval $E` [Subscribe Rules No Change]" - fi - else - echo "`eval $E` [$B Failed]" - echo failed > $P/failed - [ "$1" = 2 ] && rm -f $LOCK && exit - fi - rm -rf $G -} - -case $1 in - addown)down 1;exit;; - down)down 2;; - gen)gen;[ "$X" = 1 ] || rm -f $LOCK;exit;; -esac - -if [ `uci -q get dnsfilter.@dnsfilter[0].enable` = 1 ];then - [ -n "$U" ] && down - echo `eval $E` > $P/dnsfilter.updated -fi - -if [ $D = 1 ];then - echo "`eval $E` [Reload DNSFilter Rules]" - /etc/init.d/dnsfilter restart -fi - -rm -f $LOCK diff --git a/package/lean/luci-app-docker/luasrc/model/cbi/docker.lua b/package/lean/luci-app-docker/luasrc/model/cbi/docker.lua index 270fecbbc723d5..a2ea9f542a0232 100644 --- a/package/lean/luci-app-docker/luasrc/model/cbi/docker.lua +++ b/package/lean/luci-app-docker/luasrc/model/cbi/docker.lua @@ -13,11 +13,11 @@ m:section(SimpleSection).template = "docker/docker_status" s = m:section(TypedSection, "docker") s.anonymous = true -wan_mode = s:option(Flag, "wan_mode", translate("Enable WAN access Dokcer"), translate("Enable WAN access docker mapped ports")) +wan_mode = s:option(Flag, "wan_mode", translate("Enable WAN access Docker"), translate("Enable WAN access docker mapped ports")) wan_mode.default = 0 wan_mode.rmempty = false o=s:option(DummyValue,"readme",translate(" ")) o.description=translate(""..translate("Download DockerReadme.pdf").."") -return m \ No newline at end of file +return m diff --git a/package/lean/luci-app-docker/po/zh-cn/docker.po b/package/lean/luci-app-docker/po/zh-cn/docker.po index b95369aacfccea..0e378bc292c04d 100644 --- a/package/lean/luci-app-docker/po/zh-cn/docker.po +++ b/package/lean/luci-app-docker/po/zh-cn/docker.po @@ -23,11 +23,11 @@ msgstr "打开 Portainer Docker 管理页面" msgid "Docker is a set of platform-as-a-service (PaaS) products that use OS-level virtualization to deliver software in packages called containers." msgstr "Docker是一组平台即服务(platform-as-a-service,PaaS)产品,它使用操作系统级容器虚拟化来交付软件包。" -msgid "Enable WAN access Dokcer" -msgstr "允许 WAN 访问 Dokcer" +msgid "Enable WAN access Docker" +msgstr "允许 WAN 访问 Docker" msgid "Enable WAN access docker mapped ports" -msgstr "允许 WAN 访问 Dokcer 映射后的端口(易受攻击!)。

推荐禁用该选项后,用系统防火墙选择性映射 172.17.0.X:XX 端口到 WAN" +msgstr "允许 WAN 访问 Docker 映射后的端口(易受攻击!)。

推荐禁用该选项后,用系统防火墙选择性映射 172.17.0.X:XX 端口到 WAN" msgid "Docker Readme First" msgstr "Docker 初始化无脑配置教程" @@ -36,4 +36,4 @@ msgid "Download DockerReadme.pdf" msgstr "下载 Docker 初始化无脑配置教程" msgid "Please download DockerReadme.pdf to read when first-running" -msgstr "初次在OpenWrt中运行Docker必读(只需执行一次流程)" \ No newline at end of file +msgstr "初次在OpenWrt中运行Docker必读(只需执行一次流程)" diff --git a/package/lean/luci-app-jd-dailybonus/Makefile b/package/lean/luci-app-jd-dailybonus/Makefile index ee4110b7c76282..3431c8c9665821 100644 --- a/package/lean/luci-app-jd-dailybonus/Makefile +++ b/package/lean/luci-app-jd-dailybonus/Makefile @@ -10,7 +10,7 @@ endef LUCI_TITLE:=Luci for JD dailybonus Script LUCI_PKGARCH:=all -LUCI_DEPENDS:=+node +wget +lua +libuci-lua +LUCI_DEPENDS:=+node +uclient-fetch +lua +libuci-lua include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/lean/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh b/package/lean/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh index 647fb9e319c1a0..0e5b95130d6eee 100755 --- a/package/lean/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh +++ b/package/lean/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh @@ -75,7 +75,7 @@ notify() { if [ "$serverurlflag" = "sct" ]; then serverurl=https://sctapi.ftqq.com/ fi - wget -q --output-document=/dev/null --post-data="text=$title~&desp=$desc" $serverurl$sckey.send + uclient-fetch -q --output-document=/dev/null --post-data="text=$title~&desp=$desc" $serverurl$sckey.send fi #Dingding @@ -83,7 +83,7 @@ notify() { if [ ! -z $dtoken ]; then DTJ_FILE=/tmp/jd-djson.json echo "{\"msgtype\": \"markdown\",\"markdown\": {\"title\":\"${title}\",\"text\":\"${title}
${desc}\"}}" > ${DTJ_FILE} - wget -q --output-document=/dev/null --header="Content-Type: application/json" --post-file=/tmp/jd-djson.json "https://oapi.dingtalk.com/robot/send?access_token=${dtoken}" + uclient-fetch -q --output-document=/dev/null --header="Content-Type: application/json" --post-file=/tmp/jd-djson.json "https://oapi.dingtalk.com/robot/send?access_token=${dtoken}" fi #telegram @@ -98,7 +98,7 @@ notify() { =============================== 本消息来自京东签到插件 jd-dailybonus \`\`\`" - wget -q --output-document=/dev/null --post-data="chat_id=$TG_USER_ID&text=$text&parse_mode=markdownv2" $API_URL + uclient-fetch -q --output-document=/dev/null --post-data="chat_id=$TG_USER_ID&text=$text&parse_mode=markdownv2" $API_URL fi } @@ -116,7 +116,7 @@ save() { # Update Script From Server download() { REMOTE_SCRIPT=$(uci_get_by_type global remote_url) - wget --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -q $REMOTE_SCRIPT -O $TEMP_SCRIPT + uclient-fetch --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -q $REMOTE_SCRIPT -O $TEMP_SCRIPT return $? } diff --git a/package/lean/luci-app-nfs/luasrc/model/cbi/nfs.lua b/package/lean/luci-app-nfs/luasrc/model/cbi/nfs.lua index 8559298ae5fddb..6dabbe45f28a31 100644 --- a/package/lean/luci-app-nfs/luasrc/model/cbi/nfs.lua +++ b/package/lean/luci-app-nfs/luasrc/model/cbi/nfs.lua @@ -58,13 +58,13 @@ de.rmempty = false de.optional = false if nixio.fs.access("/etc/config/fstab") then - ph1.titleref = luci.dispatcher.build_url("admin", "system", "mounts") - ph2.titleref = luci.dispatcher.build_url("admin", "system", "mounts") + ph1.titleref = luci.dispatcher.build_url("admin", "system", "fstab") + ph2.titleref = luci.dispatcher.build_url("admin", "system", "fstab") end local apply = luci.http.formvalue("cbi.apply") if apply then - io.popen("/etc/init.d/nfs reload") + io.popen("/etc/init.d/nfs reload") end return m diff --git a/package/lean/luci-app-turboacc/Makefile b/package/lean/luci-app-turboacc/Makefile index fdcc6c2967a58a..7e848d68c3bc52 100644 --- a/package/lean/luci-app-turboacc/Makefile +++ b/package/lean/luci-app-turboacc/Makefile @@ -28,7 +28,7 @@ config PACKAGE_TURBOACC_INCLUDE_OFFLOADING config PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE bool "Include Shortcut-FE" - default y if !(TARGET_ipq806x||TARGET_ipq807x) + default y if !(TARGET_ipq806x||TARGET_ipq807x||TARGET_ramips) config PACKAGE_TURBOACC_INCLUDE_BBR_CCA bool "Include BBR CCA" diff --git a/package/lean/mentohust/Makefile b/package/lean/mentohust/Makefile new file mode 100644 index 00000000000000..83d5919ad28f22 --- /dev/null +++ b/package/lean/mentohust/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2014-2015 KyleRicardo +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mentohust +PKG_VERSION:=0.3.1 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/KyleRicardo/MentoHUST-OpenWrt-ipk.git +PKG_SOURCE_VERSION:=557cffca8032b6d8ac948be8a79255dc64a1915d +PKG_MIRROR_HASH:=1db6cd4402ea3e1fa2adc3adcc1490fffdac224ae83024d883429b8b67fb9c74 + +MAKE_PATH:=src + +include $(INCLUDE_DIR)/package.mk + +define Package/mentohust + SECTION:=net + CATEGORY:=Network + TITLE:=A Ruijie Client Daemon + URL:=https://github.com/KyleRicardo/MentoHUST-OpenWrt-ipk + DEPENDS:=+libpcap +endef + +define Package/mentohust/description + A Ruijie Client Daemon, most usually used in China collages. +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/src \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="$(TARGET_CPPFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS) -ldl" +endef + +define Package/mentohust/conffiles +/etc/mentohust.conf +endef + +define Package/mentohust/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mentohust $(1)/usr/sbin/mentohust + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/src/mentohust.conf $(1)/etc/mentohust.conf +endef + +$(eval $(call BuildPackage,mentohust)) diff --git a/package/lean/mt/drivers/mt7615d/Makefile b/package/lean/mt/drivers/mt7615d/Makefile index db841b7c0c84d6..b377431c197b58 100644 --- a/package/lean/mt/drivers/mt7615d/Makefile +++ b/package/lean/mt/drivers/mt7615d/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mt7615d -P4REV:=8 +P4REV:=9 PKG_VERSION:=5.0.4.0 PKG_BUILD_PARALLEL:=1 diff --git a/package/lean/mt/drivers/mt7615d/src/mt_wifi/embedded/mcu/andes_mt.c b/package/lean/mt/drivers/mt7615d/src/mt_wifi/embedded/mcu/andes_mt.c index 77be33b4e663eb..e1215cd3fdea84 100644 --- a/package/lean/mt/drivers/mt7615d/src/mt_wifi/embedded/mcu/andes_mt.c +++ b/package/lean/mt/drivers/mt7615d/src/mt_wifi/embedded/mcu/andes_mt.c @@ -2694,8 +2694,8 @@ static VOID UnsolicitedEventHandler(RTMP_ADAPTER *pAd, UINT8 EID, UINT8 ExtEID, break; default: - MTWF_LOG(DBG_CAT_FW, DBG_SUBCAT_ALL, DBG_LVL_OFF, - ("%s: Unknown Event(%x)\n", __func__, EID)); + /* MTWF_LOG(DBG_CAT_FW, DBG_SUBCAT_ALL, DBG_LVL_OFF, + ("%s: Unknown Event(%x)\n", __func__, EID)); */ break; } } diff --git a/package/lean/uugamebooster/Makefile b/package/lean/uugamebooster/Makefile index 5239ca075f6002..5abea13b585c6d 100644 --- a/package/lean/uugamebooster/Makefile +++ b/package/lean/uugamebooster/Makefile @@ -12,15 +12,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uugamebooster -PKG_VERSION:=v2.10.0 -PKG_RELEASE:=8 +PKG_VERSION:=v2.12.0 +PKG_RELEASE:=10 include $(INCLUDE_DIR)/package.mk define Package/$(PKG_NAME) SECTION:=net CATEGORY:=Network - DEPENDS:=@(aarch64||arm||mips||mipsel||x86_64) +kmod-tun + DEPENDS:=@(aarch64||arm||mipsel||x86_64) +kmod-tun TITLE:=NetEase UU Game Booster URL:=https://uu.163.com endef @@ -31,30 +31,25 @@ endef ifeq ($(ARCH),x86_64) UU_ARCH:=x86_64 - PKG_MD5SUM:=a856aebe19b9c663bdc08b257a591b40 + PKG_MD5SUM:=61fffa3e17f21cca78c85b0f0bbcd7ed endif ifeq ($(ARCH),mipsel) UU_ARCH:=mipsel - PKG_MD5SUM:=90e895012e5a03391a0c0f4759a4422c -endif - -ifeq ($(ARCH),mips) - UU_ARCH:=mipsel - PKG_MD5SUM:=90e895012e5a03391a0c0f4759a4422c + PKG_MD5SUM:=e72e9fa1761648113e9437f0e438f801 endif ifeq ($(ARCH),arm) UU_ARCH:=arm - PKG_MD5SUM:=acc7e564b1718009cd2d94335ace1bcd + PKG_MD5SUM:=3c24b9c6fceab1d2b08dfd3bd027fdf5 endif ifeq ($(ARCH),aarch64) UU_ARCH:=aarch64 - PKG_MD5SUM:=262cc28ba07d7cf84a3f487ff4fd146c + PKG_MD5SUM:=01be691af0a2e856be80754d49fa821a endif -PKG_SOURCE_URL:=http://uu.gdl.netease.com/openwrt-$(UU_ARCH)/$(PKG_VERSION)/uu.tar.gz? +PKG_SOURCE_URL:=http://uu.gdl.netease.com/uuplugin/openwrt-$(UU_ARCH)/$(PKG_VERSION)/uu.tar.gz? PKG_SOURCE:=$(PKG_NAME)-$(UU_ARCH)-$(PKG_VERSION).tar.gz STRIP:=true diff --git a/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch b/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch new file mode 100644 index 00000000000000..c7da33f029058a --- /dev/null +++ b/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch @@ -0,0 +1,25 @@ +From: Felix Fietkau +Date: Thu, 8 Jul 2021 16:33:03 +0200 +Subject: [PATCH] hostapd: fix use of uninitialized stack variables + +When a CSA is performed on an 80 MHz channel, hostapd_change_config_freq +unconditionally calls hostapd_set_oper_centr_freq_seg0/1_idx with seg0/1 +filled by ieee80211_freq_to_chan. +However, if ieee80211_freq_to_chan fails (because the freq is 0 or invalid), +seg0/1 remains uninitialized and filled with stack garbage, causing errors +such as "hostapd: 80 MHz: center segment 1 configured" + +Signed-off-by: Felix Fietkau +--- + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -3431,7 +3431,7 @@ static int hostapd_change_config_freq(st + struct hostapd_freq_params *old_params) + { + int channel; +- u8 seg0, seg1; ++ u8 seg0 = 0, seg1 = 0; + struct hostapd_hw_modes *mode; + + if (!params->channel) { diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index 71537c9ec6f53c..005ed54e0c7f78 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -473,3 +473,44 @@ /* Proceed only if DFS is not offloaded to the driver */ if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) return 0; +--- a/src/ap/airtime_policy.c ++++ b/src/ap/airtime_policy.c +@@ -112,8 +112,14 @@ static void set_sta_weights(struct hosta + { + struct sta_info *sta; + +- for (sta = hapd->sta_list; sta; sta = sta->next) +- sta_set_airtime_weight(hapd, sta, weight); ++ for (sta = hapd->sta_list; sta; sta = sta->next) { ++ unsigned int sta_weight = weight; ++ ++ if (sta->dyn_airtime_weight) ++ sta_weight = (weight * sta->dyn_airtime_weight) / 256; ++ ++ sta_set_airtime_weight(hapd, sta, sta_weight); ++ } + } + + +@@ -244,7 +250,10 @@ int airtime_policy_new_sta(struct hostap + unsigned int weight; + + if (hapd->iconf->airtime_mode == AIRTIME_MODE_STATIC) { +- weight = get_weight_for_sta(hapd, sta->addr); ++ if (sta->dyn_airtime_weight) ++ weight = sta->dyn_airtime_weight; ++ else ++ weight = get_weight_for_sta(hapd, sta->addr); + if (weight) + return sta_set_airtime_weight(hapd, sta, weight); + } +--- a/src/ap/sta_info.h ++++ b/src/ap/sta_info.h +@@ -324,6 +324,7 @@ struct sta_info { + #endif /* CONFIG_TESTING_OPTIONS */ + #ifdef CONFIG_AIRTIME_POLICY + unsigned int airtime_weight; ++ unsigned int dyn_airtime_weight; + struct os_reltime backlogged_until; + #endif /* CONFIG_AIRTIME_POLICY */ + diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 6201dfd52405ec..07c366508c4e32 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -21,6 +21,7 @@ #include "rrm.h" #include "wnm_ap.h" #include "taxonomy.h" +#include "airtime_policy.h" static struct ubus_context *ctx; static struct blob_buf b; @@ -741,7 +742,9 @@ enum { CSA_SEC_CHANNEL_OFFSET, CSA_HT, CSA_VHT, + CSA_HE, CSA_BLOCK_TX, + CSA_FORCE, __CSA_MAX }; @@ -754,9 +757,20 @@ static const struct blobmsg_policy csa_policy[__CSA_MAX] = { [CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 }, [CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL }, [CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, + [CSA_HE] = { "he", BLOBMSG_TYPE_BOOL }, [CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, + [CSA_FORCE] = { "force", BLOBMSG_TYPE_BOOL }, }; + +static void switch_chan_fallback_cb(void *eloop_data, void *user_ctx) +{ + struct hostapd_iface *iface = eloop_data; + struct hostapd_freq_params *freq_params = user_ctx; + + hostapd_switch_channel_fallback(iface, freq_params); +} + #ifdef NEED_AP_MLME static int hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, @@ -765,7 +779,16 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, { struct blob_attr *tb[__CSA_MAX]; struct hostapd_data *hapd = get_hapd_from_object(obj); - struct csa_settings css; + struct hostapd_config *iconf = hapd->iface->conf; + struct hostapd_freq_params *freq_params; + struct csa_settings css = { + .freq_params = { + .ht_enabled = iconf->ieee80211n, + .vht_enabled = iconf->ieee80211ac, + .he_enabled = iconf->ieee80211ax, + .sec_channel_offset = iconf->secondary_channel, + } + }; int ret = UBUS_STATUS_OK; int i; @@ -774,7 +797,21 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, if (!tb[CSA_FREQ]) return UBUS_STATUS_INVALID_ARGUMENT; - memset(&css, 0, sizeof(css)); + switch (iconf->vht_oper_chwidth) { + case CHANWIDTH_USE_HT: + if (iconf->secondary_channel) + css.freq_params.bandwidth = 40; + else + css.freq_params.bandwidth = 20; + break; + case CHANWIDTH_160MHZ: + css.freq_params.bandwidth = 160; + break; + default: + css.freq_params.bandwidth = 80; + break; + } + css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]); #define SET_CSA_SETTING(name, field, type) \ @@ -790,6 +827,7 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, SET_CSA_SETTING(CSA_SEC_CHANNEL_OFFSET, freq_params.sec_channel_offset, u32); SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool); SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); + SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool); SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); for (i = 0; i < hapd->iface->num_bss; i++) { @@ -799,7 +837,15 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, ret = UBUS_STATUS_NOT_SUPPORTED; } - return ret; + if (!ret || !tb[CSA_FORCE] || !blobmsg_get_bool(tb[CSA_FORCE])) + return ret; + + freq_params = malloc(sizeof(*freq_params)); + memcpy(freq_params, &css.freq_params, sizeof(*freq_params)); + eloop_register_timeout(0, 1, switch_chan_fallback_cb, + hapd->iface, freq_params); + + return 0; #undef SET_CSA_SETTING } #endif @@ -1326,11 +1372,68 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj, } #endif +#ifdef CONFIG_AIRTIME_POLICY +enum { + UPDATE_AIRTIME_STA, + UPDATE_AIRTIME_WEIGHT, + __UPDATE_AIRTIME_MAX, +}; + + +static const struct blobmsg_policy airtime_policy[__UPDATE_AIRTIME_MAX] = { + [UPDATE_AIRTIME_STA] = { "sta", BLOBMSG_TYPE_STRING }, + [UPDATE_AIRTIME_WEIGHT] = { "weight", BLOBMSG_TYPE_INT32 }, +}; + +static int +hostapd_bss_update_airtime(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *ureq, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct blob_attr *tb[__UPDATE_AIRTIME_MAX]; + struct sta_info *sta = NULL; + u8 addr[ETH_ALEN]; + int weight; + + blobmsg_parse(airtime_policy, __UPDATE_AIRTIME_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[UPDATE_AIRTIME_WEIGHT]) + return UBUS_STATUS_INVALID_ARGUMENT; + + weight = blobmsg_get_u32(tb[UPDATE_AIRTIME_WEIGHT]); + + if (!tb[UPDATE_AIRTIME_STA]) { + if (!weight) + return UBUS_STATUS_INVALID_ARGUMENT; + + hapd->conf->airtime_weight = weight; + return 0; + } + + if (hwaddr_aton(blobmsg_data(tb[UPDATE_AIRTIME_STA]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + sta = ap_get_sta(hapd, addr); + if (!sta) + return UBUS_STATUS_NOT_FOUND; + + sta->dyn_airtime_weight = weight; + airtime_policy_new_sta(hapd, sta); + + return 0; +} +#endif + + static const struct ubus_method bss_methods[] = { UBUS_METHOD_NOARG("reload", hostapd_bss_reload), UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status), UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), +#ifdef CONFIG_AIRTIME_POLICY + UBUS_METHOD("update_airtime", hostapd_bss_update_airtime, airtime_policy), +#endif UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans), #ifdef CONFIG_WPS UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start), diff --git a/package/nss/firmware/nss-firmware/Makefile b/package/qca/firmware/nss-firmware/Makefile similarity index 100% rename from package/nss/firmware/nss-firmware/Makefile rename to package/qca/firmware/nss-firmware/Makefile diff --git a/package/nss/qca/nss-ifb/Makefile b/package/qca/nss/nss-ifb/Makefile similarity index 100% rename from package/nss/qca/nss-ifb/Makefile rename to package/qca/nss/nss-ifb/Makefile diff --git a/package/nss/qca/nss-ifb/README.md b/package/qca/nss/nss-ifb/README.md similarity index 100% rename from package/nss/qca/nss-ifb/README.md rename to package/qca/nss/nss-ifb/README.md diff --git a/package/nss/qca/nss-ifb/src/Makefile b/package/qca/nss/nss-ifb/src/Makefile similarity index 100% rename from package/nss/qca/nss-ifb/src/Makefile rename to package/qca/nss/nss-ifb/src/Makefile diff --git a/package/nss/qca/nss-ifb/src/nss_ifb.c b/package/qca/nss/nss-ifb/src/nss_ifb.c similarity index 100% rename from package/nss/qca/nss-ifb/src/nss_ifb.c rename to package/qca/nss/nss-ifb/src/nss_ifb.c diff --git a/package/nss/qca/qca-nss-cfi/Makefile b/package/qca/nss/qca-nss-cfi/Makefile similarity index 98% rename from package/nss/qca/qca-nss-cfi/Makefile rename to package/qca/nss/qca-nss-cfi/Makefile index 1e27cb820248d7..570b45cf29e02e 100644 --- a/package/nss/qca/qca-nss-cfi/Makefile +++ b/package/qca/nss/qca-nss-cfi/Makefile @@ -33,7 +33,7 @@ define KernelPackage/qca-nss-cfi-cryptoapi CATEGORY:=Kernel modules SUBMENU:=Network Devices DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64 \ - +kmod-qca-nss-crypto +kmod-crypto-authenc @!LINUX_3_18 + +kmod-qca-nss-crypto +kmod-crypto-authenc @LINUX_5_4 TITLE:=Kernel driver for NSS cfi FILES:=$(PKG_BUILD_DIR)/$(CFI_CRYPTOAPI_DIR)/qca-nss-cfi-cryptoapi.ko AUTOLOAD:=$(call AutoLoad,59,qca-nss-cfi-cryptoapi) diff --git a/package/nss/qca/qca-nss-cfi/patches/0001-compile-only-cryptoapi.patch b/package/qca/nss/qca-nss-cfi/patches/0001-compile-only-cryptoapi.patch similarity index 100% rename from package/nss/qca/qca-nss-cfi/patches/0001-compile-only-cryptoapi.patch rename to package/qca/nss/qca-nss-cfi/patches/0001-compile-only-cryptoapi.patch diff --git a/package/nss/qca/qca-nss-cfi/patches/0002-wip-support-5.4.patch b/package/qca/nss/qca-nss-cfi/patches/0002-wip-support-5.4.patch similarity index 100% rename from package/nss/qca/qca-nss-cfi/patches/0002-wip-support-5.4.patch rename to package/qca/nss/qca-nss-cfi/patches/0002-wip-support-5.4.patch diff --git a/package/nss/qca/qca-nss-cfi/patches/0003-Convert-ablkcipher-to-skcipher.patch b/package/qca/nss/qca-nss-cfi/patches/0003-Convert-ablkcipher-to-skcipher.patch similarity index 100% rename from package/nss/qca/qca-nss-cfi/patches/0003-Convert-ablkcipher-to-skcipher.patch rename to package/qca/nss/qca-nss-cfi/patches/0003-Convert-ablkcipher-to-skcipher.patch diff --git a/package/qca/nss/qca-nss-clients-64/Makefile b/package/qca/nss/qca-nss-clients-64/Makefile new file mode 100644 index 00000000000000..44d21acaa40f0b --- /dev/null +++ b/package/qca/nss/qca-nss-clients-64/Makefile @@ -0,0 +1,59 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=qca-nss-clients-64 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_URL:=https://source.codeaurora.org/quic/cc-qrdk/oss/lklm/nss-clients +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2021-04-29 +PKG_SOURCE_VERSION:=b93c72c1b72c591c2ddc2f0b24f0e2b457720118 +PKG_MIRROR_HASH:=9fab23da994bfbac9a3cef32cdfec31a87a03ed415f36bc926da32b7b0934259 + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/qca-nss-drv-pppoe-64 + SECTION:=kernel + CATEGORY:=Kernel modules + SUBMENU:=Network Devices + TITLE:=Kernel driver for NSS (connection manager) - PPPoE + DEPENDS:=@TARGET_ipq807x +kmod-qca-nss-drv-64 +kmod-ppp +kmod-pppoe + FILES:=$(PKG_BUILD_DIR)/pppoe/qca-nss-pppoe.ko + AUTOLOAD:=$(call AutoLoad,51,qca-nss-pppoe) +endef + +define KernelPackage/qca-nss-drv-pppoe-64/Description +Kernel modules for NSS connection manager - Support for PPPoE +endef + +EXTRA_CFLAGS+= \ + -I$(STAGING_DIR)/usr/include/qca-nss-drv \ + -I$(STAGING_DIR)/usr/include/qca-nss-crypto \ + -I$(STAGING_DIR)/usr/include/qca-nss-cfi \ + -I$(STAGING_DIR)/usr/include/qca-nss-gmac \ + -I$(STAGING_DIR)/usr/include/qca-ssdk \ + -I$(STAGING_DIR)/usr/include/qca-ssdk/fal \ + -I$(STAGING_DIR)/usr/include/nat46 + +ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pppoe-64),) +NSS_CLIENTS_MAKE_OPTS+=pppoe=y +endif + +ifeq ($(CONFIG_TARGET_BOARD), "ipq807x") + SOC="ipq807x_64" +else ifeq ($(CONFIG_TARGET_BOARD), "ipq60xx") + SOC="ipq60xx_64" +endif + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" $(strip $(NSS_CLIENTS_MAKE_OPTS)) \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + M="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ + SoC=$(SOC) \ + $(KERNEL_MAKE_FLAGS) \ + modules +endef + +$(eval $(call KernelPackage,qca-nss-drv-pppoe-64)) diff --git a/package/qca/nss/qca-nss-clients-64/files/qca-nss-ipsec b/package/qca/nss/qca-nss-clients-64/files/qca-nss-ipsec new file mode 100755 index 00000000000000..5f682c8e912eb4 --- /dev/null +++ b/package/qca/nss/qca-nss-clients-64/files/qca-nss-ipsec @@ -0,0 +1,214 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (c) 2018-2019, 2021 The Linux Foundation. All rights reserved. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +NSS_IPSEC_LOG_FILE=/tmp/.nss_ipsec_log +NSS_IPSEC_LOG_STR_ECM="ECM_Loaded" +NSS_IPSEC_OL_FILE=/tmp/qca_nss_ipsec_ol + +ecm_load () { + if [ ! -d /sys/module/ecm ]; then + /etc/init.d/qca-nss-ecm start + if [ -d /sys/module/ecm ]; then + echo ${NSS_IPSEC_LOG_STR_ECM} >> ${NSS_IPSEC_LOG_FILE} + fi + fi +} + +ecm_unload () { + if [ -f /tmp/.nss_ipsec_log ]; then + str=`grep ${NSS_IPSEC_LOG_STR_ECM} ${NSS_IPSEC_LOG_FILE}` + if [[ $str == ${NSS_IPSEC_LOG_STR_ECM} ]]; then + /etc/init.d/qca-nss-ecm stop + `sed 's/${NSS_IPSEC_LOG_STR_ECM}/ /g' $NSS_IPSEC_LOG_FILE > $NSS_IPSEC_LOG_FILE` + fi + fi +} + +ecm_disable() { + + if [ ! -d /sys/module/ecm ]; then + return; + fi + + echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop + echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop + echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all + sleep 2 +} + +ecm_enable() { + if [ ! -d /sys/module/ecm ]; then + return; + fi + + echo 0 > /sys/kernel/debug/ecm/ecm_db/defunct_all + echo 0 > /sys/kernel/debug/ecm/front_end_ipv4_stop + echo 0 > /sys/kernel/debug/ecm/front_end_ipv6_stop +} + +kernel_version_check_5_4() { + major_ver=$(uname -r | awk -F '.' '{print $1}') + minor_ver=$(uname -r | awk -F '.' '{print $2}') + if [ $major_ver -lt 5 ] || ([ $major_ver -eq 5 ] && [ $minor_ver -lt 4 ] ) ; then + return 1 + else + return 0 + fi +} + +start_klips() { + if kernel_version_check_5_4 + then + echo "Kernel 5.4 doesn't support klips stack." + return $? + fi + + touch $NSS_IPSEC_OL_FILE + ecm_load + + local kernel_version=$(uname -r) + + insmod /lib/modules/${kernel_version}/qca-nss-ipsec-klips.ko + if [ "$?" -gt 0 ]; then + echo "Failed to load plugin. Please start ecm if not done already" + ecm_enable + rm $NSS_IPSEC_OL_FILE + return + fi + + /etc/init.d/ipsec start + sleep 2 + ipsec eroute + + ecm_enable +} + +stop_klips() { + if kernel_version_check_5_4 + then + echo "Kernel 5.4 doesn't support klips stack." + return $? + fi + + ecm_disable + + /etc/init.d/ipsec stop + rmmod qca-nss-ipsec-klips + rm $NSS_IPSEC_OL_FILE + + ecm_unload +} + +start_xfrm() { + touch $NSS_IPSEC_OL_FILE + ecm_load + + local kernel_version=$(uname -r) + + # load all NETKEY modules first. + for mod in xfrm_ipcomp ipcomp xfrm6_tunnel ipcomp6 xfrm6_mode_tunnel xfrm6_mode_beet xfrm6_mode_ro \ + xfrm6_mode_transport xfrm4_mode_transport xfrm4_mode_tunnel \ + xfrm4_tunnel xfrm4_mode_beet esp4 esp6 ah4 ah6 af_key + do + insmod $mod 2> /dev/null + done + + # Now load the xfrm plugin + insmod /lib/modules/${kernel_version}/qca-nss-ipsec-xfrm.ko + if [ "$?" -gt 0 ]; then + echo "Failed to load plugin. Please start ecm if not done already" + ecm_enable + rm $NSS_IPSEC_OL_FILE + return + fi + + /etc/init.d/ipsec start + sleep 2 + + ecm_enable +} + +stop_xfrm() { + ecm_disable + + #Shutdown Pluto first. Then only plugin can be removed. + plutopid=/var/run/pluto/pluto.pid + if [ -f $plutopid ]; then + pid=`cat $plutopid` + if [ ! -z "$pid" ]; then + ipsec whack --shutdown | grep -v "002"; + if [ -s $plutopid ]; then + echo "Attempt to shut Pluto down failed! Trying kill:" + kill $pid; + sleep 5; + fi + fi + rm -rf $plutopid + fi + ip xfrm state flush; + ip xfrm policy flush; + sleep 2 + + #Now we can remove the plugin + retries=5 + while [ -d /sys/module/qca_nss_ipsec_xfrm ] + do + rmmod qca-nss-ipsec-xfrm + if [ "$?" -eq 0 ]; then + rm $NSS_IPSEC_OL_FILE + break + fi + + if [ ${retries} -eq 0 ]; then + echo "Failed to unload qca-nss-ipsec-xfrm plugin!" + exit + fi + + echo "XFRM plugin unload failed; retrying ${retries} times" + sleep 1 + retries=`expr ${retries} - 1` + done + + /etc/init.d/ipsec stop + ecm_unload +} + +start() { + local protostack=`uci -q get ipsec.setup.protostack` + if [ "$protostack" = "klips" ]; then + start_klips + return $? + fi + + start_xfrm + return $? +} + +stop() { + local protostack=`uci -q get ipsec.setup.protostack` + if [ "$protostack" = "klips" ]; then + stop_klips + return $? + fi + + stop_xfrm + return $? +} + +restart() { + stop + start +} diff --git a/package/nss/qca/qca-nss-clients/files/qca-nss-mirred.init b/package/qca/nss/qca-nss-clients-64/files/qca-nss-mirred.init similarity index 100% rename from package/nss/qca/qca-nss-clients/files/qca-nss-mirred.init rename to package/qca/nss/qca-nss-clients-64/files/qca-nss-mirred.init diff --git a/package/nss/qca/qca-nss-clients/files/qca-nss-ovpn.init b/package/qca/nss/qca-nss-clients-64/files/qca-nss-ovpn.init similarity index 100% rename from package/nss/qca/qca-nss-clients/files/qca-nss-ovpn.init rename to package/qca/nss/qca-nss-clients-64/files/qca-nss-ovpn.init diff --git a/package/nss/qca/qca-nss-clients/Makefile b/package/qca/nss/qca-nss-clients/Makefile similarity index 100% rename from package/nss/qca/qca-nss-clients/Makefile rename to package/qca/nss/qca-nss-clients/Makefile diff --git a/package/nss/qca/qca-nss-clients/files/qca-nss-ipsec b/package/qca/nss/qca-nss-clients/files/qca-nss-ipsec similarity index 100% rename from package/nss/qca/qca-nss-clients/files/qca-nss-ipsec rename to package/qca/nss/qca-nss-clients/files/qca-nss-ipsec diff --git a/package/qca/nss/qca-nss-clients/files/qca-nss-mirred.init b/package/qca/nss/qca-nss-clients/files/qca-nss-mirred.init new file mode 100644 index 00000000000000..1f931f09032684 --- /dev/null +++ b/package/qca/nss/qca-nss-clients/files/qca-nss-mirred.init @@ -0,0 +1,28 @@ +#!/bin/sh /etc/rc.common + +########################################################################### +# Copyright (c) 2019, The Linux Foundation. All rights reserved. +# Permission to use, copy, modify, and/or distribute this software for +# any purpose with or without fee is hereby granted, provided that the +# above copyright notice and this permission notice appear in all copies. +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +########################################################################### + +restart() { + rmmod act_nssmirred.ko + insmod act_nssmirred.ko +} + +start() { + insmod act_nssmirred.ko +} + +stop() { + rmmod act_nssmirred.ko +} diff --git a/package/qca/nss/qca-nss-clients/files/qca-nss-ovpn.init b/package/qca/nss/qca-nss-clients/files/qca-nss-ovpn.init new file mode 100644 index 00000000000000..622e295eee26f0 --- /dev/null +++ b/package/qca/nss/qca-nss-clients/files/qca-nss-ovpn.init @@ -0,0 +1,69 @@ +#!/bin/sh /etc/rc.common + +########################################################################### +# Copyright (c) 2019, The Linux Foundation. All rights reserved. +# Permission to use, copy, modify, and/or distribute this software for +# any purpose with or without fee is hereby granted, provided that the +# above copyright notice and this permission notice appear in all copies. +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +########################################################################### + +ecm_disable() { + if [ ! -d /sys/module/ecm ]; then + return + fi + + echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop + echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop + echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all + sleep 2 +} + +ecm_enable() { + if [ ! -d /sys/module/ecm ]; then + return + fi + + echo 0 > /sys/kernel/debug/ecm/ecm_db/defunct_all + echo 0 > /sys/kernel/debug/ecm/front_end_ipv4_stop + echo 0 > /sys/kernel/debug/ecm/front_end_ipv6_stop +} + +restart() { + ecm_disable + + /etc/init.d/openvpn stop + rmmod qca-nss-ovpn-link + rmmod qca-nss-ovpn-mgr + + insmod qca-nss-ovpn-mgr + insmod qca-nss-ovpn-link + + if [ "$?" -gt 0 ]; then + echo "Failed to load plugin. Please start ecm if not done already" + ecm_enable + return + fi + + ecm_enable +} + +start() { + restart +} + +stop() { + ecm_disable + + /etc/init.d/openvpn stop + rmmod qca-nss-ovpn-link + rmmod qca-nss-ovpn-mgr + + ecm_enable +} diff --git a/package/nss/qca/qca-nss-clients/patches/100-kernel-5.4-support-qdisc.patch b/package/qca/nss/qca-nss-clients/patches/100-kernel-5.4-support-qdisc.patch similarity index 100% rename from package/nss/qca/qca-nss-clients/patches/100-kernel-5.4-support-qdisc.patch rename to package/qca/nss/qca-nss-clients/patches/100-kernel-5.4-support-qdisc.patch diff --git a/package/nss/qca/qca-nss-clients/patches/101-kernel-5.4-support-gre.patch b/package/qca/nss/qca-nss-clients/patches/101-kernel-5.4-support-gre.patch similarity index 100% rename from package/nss/qca/qca-nss-clients/patches/101-kernel-5.4-support-gre.patch rename to package/qca/nss/qca-nss-clients/patches/101-kernel-5.4-support-gre.patch diff --git a/package/nss/qca/qca-nss-clients/patches/102-kernel-5.4-support-ipsec.patch b/package/qca/nss/qca-nss-clients/patches/102-kernel-5.4-support-ipsec.patch similarity index 100% rename from package/nss/qca/qca-nss-clients/patches/102-kernel-5.4-support-ipsec.patch rename to package/qca/nss/qca-nss-clients/patches/102-kernel-5.4-support-ipsec.patch diff --git a/package/nss/qca/qca-nss-clients/patches/103-kernel-5.4-support-dtls.patch b/package/qca/nss/qca-nss-clients/patches/103-kernel-5.4-support-dtls.patch similarity index 100% rename from package/nss/qca/qca-nss-clients/patches/103-kernel-5.4-support-dtls.patch rename to package/qca/nss/qca-nss-clients/patches/103-kernel-5.4-support-dtls.patch diff --git a/package/nss/qca/qca-nss-clients/patches/104-kernel-5.4-support-l2tp.patch b/package/qca/nss/qca-nss-clients/patches/104-kernel-5.4-support-l2tp.patch similarity index 100% rename from package/nss/qca/qca-nss-clients/patches/104-kernel-5.4-support-l2tp.patch rename to package/qca/nss/qca-nss-clients/patches/104-kernel-5.4-support-l2tp.patch diff --git a/package/nss/qca/qca-nss-clients/patches/200-qdisc-fix-compile-error.patch b/package/qca/nss/qca-nss-clients/patches/200-qdisc-fix-compile-error.patch similarity index 100% rename from package/nss/qca/qca-nss-clients/patches/200-qdisc-fix-compile-error.patch rename to package/qca/nss/qca-nss-clients/patches/200-qdisc-fix-compile-error.patch diff --git a/package/nss/qca/qca-nss-clients/patches/202-vlanmgr-fix-compile-error.patch b/package/qca/nss/qca-nss-clients/patches/202-vlanmgr-fix-compile-error.patch similarity index 100% rename from package/nss/qca/qca-nss-clients/patches/202-vlanmgr-fix-compile-error.patch rename to package/qca/nss/qca-nss-clients/patches/202-vlanmgr-fix-compile-error.patch diff --git a/package/nss/qca/qca-nss-crypto/Makefile b/package/qca/nss/qca-nss-crypto/Makefile similarity index 88% rename from package/nss/qca/qca-nss-crypto/Makefile rename to package/qca/nss/qca-nss-crypto/Makefile index 09a16232b6d3c8..9631f10bca7c91 100644 --- a/package/nss/qca/qca-nss-crypto/Makefile +++ b/package/qca/nss/qca-nss-crypto/Makefile @@ -28,8 +28,7 @@ define KernelPackage/qca-nss-crypto/Default SECTION:=kernel CATEGORY:=Kernel modules SUBMENU:=Network Devices - DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64 \ - +kmod-qca-nss-drv @!LINUX_3_18 + DEPENDS:=@(TARGET_ipq806x||TARGET_ipq807x||TARGET_ipq50xx||TARGET_ipq60xx) +kmod-qca-nss-drv endef define KernelPackage/qca-nss-crypto diff --git a/package/nss/qca/qca-nss-crypto/patches/100-kernel-5.4-support.patch b/package/qca/nss/qca-nss-crypto/patches/100-kernel-5.4-support.patch similarity index 100% rename from package/nss/qca/qca-nss-crypto/patches/100-kernel-5.4-support.patch rename to package/qca/nss/qca-nss-crypto/patches/100-kernel-5.4-support.patch diff --git a/package/nss/qca/qca-nss-crypto/patches/200-fix-NULL-pointer-exception.patch b/package/qca/nss/qca-nss-crypto/patches/200-fix-NULL-pointer-exception.patch similarity index 100% rename from package/nss/qca/qca-nss-crypto/patches/200-fix-NULL-pointer-exception.patch rename to package/qca/nss/qca-nss-crypto/patches/200-fix-NULL-pointer-exception.patch diff --git a/package/nss/qca/qca-nss-dp/Makefile b/package/qca/nss/qca-nss-dp/Makefile similarity index 100% rename from package/nss/qca/qca-nss-dp/Makefile rename to package/qca/nss/qca-nss-dp/Makefile diff --git a/package/nss/qca/qca-nss-dp/patches/0001-edma_tx_rx-support-newer-kernels-time-stamping-API.patch b/package/qca/nss/qca-nss-dp/patches/0001-edma_tx_rx-support-newer-kernels-time-stamping-API.patch similarity index 100% rename from package/nss/qca/qca-nss-dp/patches/0001-edma_tx_rx-support-newer-kernels-time-stamping-API.patch rename to package/qca/nss/qca-nss-dp/patches/0001-edma_tx_rx-support-newer-kernels-time-stamping-API.patch diff --git a/package/nss/qca/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch b/package/qca/nss/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch similarity index 100% rename from package/nss/qca/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch rename to package/qca/nss/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch diff --git a/package/nss/qca/qca-nss-dp/patches/0003-Drop-_nocache-variants-of-ioremap.patch b/package/qca/nss/qca-nss-dp/patches/0003-Drop-_nocache-variants-of-ioremap.patch similarity index 100% rename from package/nss/qca/qca-nss-dp/patches/0003-Drop-_nocache-variants-of-ioremap.patch rename to package/qca/nss/qca-nss-dp/patches/0003-Drop-_nocache-variants-of-ioremap.patch diff --git a/package/nss/qca/qca-nss-dp/patches/0004-EDMA-Fix-NAPI-packet-counting.patch b/package/qca/nss/qca-nss-dp/patches/0004-EDMA-Fix-NAPI-packet-counting.patch similarity index 100% rename from package/nss/qca/qca-nss-dp/patches/0004-EDMA-Fix-NAPI-packet-counting.patch rename to package/qca/nss/qca-nss-dp/patches/0004-EDMA-Fix-NAPI-packet-counting.patch diff --git a/package/nss/qca/qca-nss-dp/patches/0005-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch b/package/qca/nss/qca-nss-dp/patches/0005-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch similarity index 100% rename from package/nss/qca/qca-nss-dp/patches/0005-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch rename to package/qca/nss/qca-nss-dp/patches/0005-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch diff --git a/package/qca/nss/qca-nss-drv-64/Makefile b/package/qca/nss/qca-nss-drv-64/Makefile new file mode 100644 index 00000000000000..44c208ad3315dd --- /dev/null +++ b/package/qca/nss/qca-nss-drv-64/Makefile @@ -0,0 +1,121 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=qca-nss-drv-64 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-drv +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2021-04-26 +PKG_SOURCE_VERSION:=1cf4bf81fd395f61648efeae78cdf1df60e954ff +PKG_MIRROR_HASH:=86b7455565d28a72da981099c67a89ea9e0ae3874a34be30959dcf48f5e2196c + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +NSS_CLIENTS_DIR:=$(TOPDIR)/qca/src/qca-nss-clients + +define KernelPackage/qca-nss-drv-64 + SECTION:=kernel + CATEGORY:=Kernel modules + SUBMENU:=Network Devices + DEPENDS:=@(TARGET_ipq807x||TARGET_ipq60xx) +kmod-qca-nss-dp + TITLE:=Kernel driver for NSS (core driver) + FILES:=$(PKG_BUILD_DIR)/qca-nss-drv.ko + AUTOLOAD:=$(call AutoLoad,32,qca-nss-drv) +endef + +define KernelPackage/qca-nss-drv-64/install + $(INSTALL_DIR) $(1)/lib/debug + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/sysctl.d + $(INSTALL_DIR) $(1)/etc/hotplug.d/firmware + $(INSTALL_DIR) $(1)/etc/config + + $(INSTALL_BIN) ./files/qca-nss-drv.debug $(1)/lib/debug/qca-nss-drv + $(INSTALL_BIN) ./files/qca-nss-drv.init $(1)/etc/init.d/qca-nss-drv + $(INSTALL_BIN) ./files/qca-nss-drv.sysctl $(1)/etc/sysctl.d/qca-nss-drv.conf + $(INSTALL_BIN) ./files/qca-nss-drv.hotplug $(1)/etc/hotplug.d/firmware/10-qca-nss-fw + $(INSTALL_BIN) ./files/qca-nss-drv.conf $(1)/etc/config/nss + +endef + +define KernelPackage/qca-nss-drv-64/Description +This package contains a NSS driver for QCA chipset +endef + +define Build/InstallDev + mkdir -p $(1)/usr/include/qca-nss-drv + $(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-drv/ +endef + +EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-gmac -I$(STAGING_DIR)/usr/include/qca-nss-dp -I$(STAGING_DIR)/usr/include/qca-ssdk + +ifneq (, $(findstring $(CONFIG_TARGET_BOARD), "ipq807x" "ipq60xx")) +EXTRA_CFLAGS+= -DNSS_MEM_PROFILE_MEDIUM +LOW_MEM_PROFILE_MAKE_OPTS=y +endif + +ifeq ($(CONFIG_KERNEL_SKB_FIXED_SIZE_2K),y) +EXTRA_CFLAGS+= -DNSS_SKB_FIXED_SIZE_2K +endif + +DRV_MAKE_OPTS:= +ifeq ($(LOW_MEM_PROFILE_MAKE_OPTS),y) +DRV_MAKE_OPTS+=NSS_DRV_C2C_ENABLE=n \ + NSS_DRV_CAPWAP_ENABLE=n \ + NSS_DRV_CLMAP_ENABLE=n \ + NSS_DRV_CRYPTO_ENABLE=n \ + NSS_DRV_DTLS_ENABLE=n \ + NSS_DRV_GRE_ENABLE=n \ + NSS_DRV_GRE_REDIR_ENABLE=n \ + NSS_DRV_GRE_TUNNEL_ENABLE=n \ + NSS_DRV_IGS_ENABLE=n \ + NSS_DRV_IPSEC_ENABLE=n \ + NSS_DRV_LAG_ENABLE=n \ + NSS_DRV_L2TP_ENABLE=n \ + NSS_DRV_MAPT_ENABLE=n \ + NSS_DRV_OAM_ENABLE=n \ + NSS_DRV_PPTP_ENABLE=n \ + NSS_DRV_PORTID_ENABLE=n \ + NSS_DRV_PVXLAN_ENABLE=n \ + NSS_DRV_QRFS_ENABLE=n \ + NSS_DRV_QVPN_ENABLE=n \ + NSS_DRV_RMNET_ENABLE=n \ + NSS_DRV_SHAPER_ENABLE=n \ + NSS_DRV_SJACK_ENABLE=n \ + NSS_DRV_TLS_ENABLE=n \ + NSS_DRV_TRUSTSEC_ENABLE=n \ + NSS_DRV_TSTAMP_ENABLE=n \ + NSS_DRV_TUN6RD_ENABLE=n \ + NSS_DRV_TUNIPIP6_ENABLE=n \ + NSS_DRV_VXLAN_ENABLE=n \ + NSS_DRV_MATCH_ENABLE=n \ + NSS_DRV_MIRROR_ENABLE=n +endif + +ifeq ($(CONFIG_TARGET_BOARD), "ipq807x") + SOC="ipq807x_64" +else ifeq ($(CONFIG_TARGET_BOARD), "ipq60xx") + SOC="ipq60xx_64" +endif + +define Build/Configure + $(LN) arch/nss_$(SOC).h $(PKG_BUILD_DIR)/exports/nss_arch.h + sed -i "s/define NSS_FW_VERSION_MAJOR.*/define NSS_FW_VERSION_MAJOR 11/" $(PKG_BUILD_DIR)/exports/nss_fw_version.h + sed -i "s/define NSS_FW_VERSION_MINOR.*/define NSS_FW_VERSION_MINOR 3/" $(PKG_BUILD_DIR)/exports/nss_fw_version.h +endef + +define Build/Compile + +$(MAKE) -C "$(LINUX_DIR)" $(strip $(DRV_MAKE_OPTS)) \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + M="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC=$(SOC) \ + $(KERNEL_MAKE_FLAGS) \ + $(PKG_JOBS) \ + modules +endef + +$(eval $(call KernelPackage,qca-nss-drv-64)) diff --git a/package/nss/qca/qca-nss-drv/files/qca-nss-drv.conf b/package/qca/nss/qca-nss-drv-64/files/qca-nss-drv.conf similarity index 100% rename from package/nss/qca/qca-nss-drv/files/qca-nss-drv.conf rename to package/qca/nss/qca-nss-drv-64/files/qca-nss-drv.conf diff --git a/package/nss/qca/qca-nss-drv/files/qca-nss-drv.debug b/package/qca/nss/qca-nss-drv-64/files/qca-nss-drv.debug similarity index 100% rename from package/nss/qca/qca-nss-drv/files/qca-nss-drv.debug rename to package/qca/nss/qca-nss-drv-64/files/qca-nss-drv.debug diff --git a/package/nss/qca/qca-nss-drv/files/qca-nss-drv.hotplug b/package/qca/nss/qca-nss-drv-64/files/qca-nss-drv.hotplug similarity index 100% rename from package/nss/qca/qca-nss-drv/files/qca-nss-drv.hotplug rename to package/qca/nss/qca-nss-drv-64/files/qca-nss-drv.hotplug diff --git a/package/nss/qca/qca-nss-drv/files/qca-nss-drv.init b/package/qca/nss/qca-nss-drv-64/files/qca-nss-drv.init similarity index 100% rename from package/nss/qca/qca-nss-drv/files/qca-nss-drv.init rename to package/qca/nss/qca-nss-drv-64/files/qca-nss-drv.init diff --git a/package/nss/qca/qca-nss-drv/files/qca-nss-drv.sysctl b/package/qca/nss/qca-nss-drv-64/files/qca-nss-drv.sysctl similarity index 100% rename from package/nss/qca/qca-nss-drv/files/qca-nss-drv.sysctl rename to package/qca/nss/qca-nss-drv-64/files/qca-nss-drv.sysctl diff --git a/package/qca/nss/qca-nss-drv-64/patches/0001-core-add-5.10-kernel-to-version-check.patch b/package/qca/nss/qca-nss-drv-64/patches/0001-core-add-5.10-kernel-to-version-check.patch new file mode 100644 index 00000000000000..3fea9b5ce331cb --- /dev/null +++ b/package/qca/nss/qca-nss-drv-64/patches/0001-core-add-5.10-kernel-to-version-check.patch @@ -0,0 +1,25 @@ +From 3885c752e12f74cad6c97888b797e5903ad1930d Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Thu, 13 May 2021 23:22:38 +0200 +Subject: [PATCH] core: add 5.10 kernel to version check + +NSS DRV has a kernel version check, so simply add +5.10 as supported. + +Signed-off-by: Robert Marko +--- + nss_core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/nss_core.c ++++ b/nss_core.c +@@ -52,7 +52,8 @@ + (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)))) || \ + (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \ + (((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \ +-(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))))) ++(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \ ++(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)))))) + #error "Check skb recycle code in this file to match Linux version" + #endif + diff --git a/package/qca/nss/qca-nss-drv-64/patches/0002-nss-drv-replace-ioremap_nocache-with-ioremap.patch b/package/qca/nss/qca-nss-drv-64/patches/0002-nss-drv-replace-ioremap_nocache-with-ioremap.patch new file mode 100644 index 00000000000000..77155750c387ea --- /dev/null +++ b/package/qca/nss/qca-nss-drv-64/patches/0002-nss-drv-replace-ioremap_nocache-with-ioremap.patch @@ -0,0 +1,164 @@ +From b5e2a7167ca3df9fce34f0d7c05468d4f5597275 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Thu, 13 May 2021 23:33:18 +0200 +Subject: [PATCH] nss-drv: replace ioremap_nocache() with ioremap() + +ioremap_nocache() does not exist anymore. + +Signed-off-by: Robert Marko +--- + nss_hal/ipq50xx/nss_hal_pvt.c | 6 +++--- + nss_hal/ipq60xx/nss_hal_pvt.c | 8 ++++---- + nss_hal/ipq806x/nss_hal_pvt.c | 4 ++-- + nss_hal/ipq807x/nss_hal_pvt.c | 6 +++--- + nss_hal/nss_hal.c | 4 ++-- + nss_meminfo.c | 2 +- + nss_ppe.c | 2 +- + 7 files changed, 16 insertions(+), 16 deletions(-) + +--- a/nss_hal/ipq50xx/nss_hal_pvt.c ++++ b/nss_hal/ipq50xx/nss_hal_pvt.c +@@ -184,13 +184,13 @@ static struct nss_platform_data *__nss_h + npd->nphys = res_nphys.start; + npd->qgic_phys = res_qgic_phys.start; + +- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys)); ++ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); + if (!npd->nmap) { + nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); + goto out; + } + +- npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys)); ++ npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys)); + if (!npd->qgic_map) { + nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); + goto out; +@@ -348,7 +348,7 @@ static int __nss_hal_common_reset(struct + + of_node_put(cmn); + +- nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); ++ nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); + if (!nss_misc_reset) { + pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev); + return -EFAULT; +--- a/nss_hal/ipq60xx/nss_hal_pvt.c ++++ b/nss_hal/ipq60xx/nss_hal_pvt.c +@@ -207,13 +207,13 @@ static struct nss_platform_data *__nss_h + npd->nphys = res_nphys.start; + npd->qgic_phys = res_qgic_phys.start; + +- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys)); ++ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); + if (!npd->nmap) { + nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); + goto out; + } + +- npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys)); ++ npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys)); + if (!npd->qgic_map) { + nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); + goto out; +@@ -433,13 +433,13 @@ static int __nss_hal_common_reset(struct + + of_node_put(cmn); + +- nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); ++ nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); + if (!nss_misc_reset) { + pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev); + return -EFAULT; + } + +- nss_misc_reset_flag = ioremap_nocache(res_nss_misc_reset_flag.start, resource_size(&res_nss_misc_reset_flag)); ++ nss_misc_reset_flag = ioremap(res_nss_misc_reset_flag.start, resource_size(&res_nss_misc_reset_flag)); + if (!nss_misc_reset_flag) { + pr_err("%px: ioremap fail for nss_misc_reset_flag\n", nss_dev); + return -EFAULT; +--- a/nss_hal/ipq806x/nss_hal_pvt.c ++++ b/nss_hal/ipq806x/nss_hal_pvt.c +@@ -458,7 +458,7 @@ static struct nss_platform_data *__nss_h + npd->nphys = res_nphys.start; + npd->vphys = res_vphys.start; + +- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys)); ++ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); + if (!npd->nmap) { + nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); + goto out; +@@ -711,7 +711,7 @@ static int __nss_hal_common_reset(struct + } + of_node_put(cmn); + +- fpb_base = ioremap_nocache(res_nss_fpb_base.start, resource_size(&res_nss_fpb_base)); ++ fpb_base = ioremap(res_nss_fpb_base.start, resource_size(&res_nss_fpb_base)); + if (!fpb_base) { + pr_err("%px: ioremap fail for nss_fpb_base\n", nss_dev); + return -EFAULT; +--- a/nss_hal/ipq807x/nss_hal_pvt.c ++++ b/nss_hal/ipq807x/nss_hal_pvt.c +@@ -234,7 +234,7 @@ static struct nss_platform_data *__nss_h + npd->vphys = res_vphys.start; + npd->qgic_phys = res_qgic_phys.start; + +- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys)); ++ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); + if (!npd->nmap) { + nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); + goto out; +@@ -247,7 +247,7 @@ static struct nss_platform_data *__nss_h + goto out; + } + +- npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys)); ++ npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys)); + if (!npd->qgic_map) { + nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); + goto out; +@@ -467,7 +467,7 @@ static int __nss_hal_common_reset(struct + } + of_node_put(cmn); + +- nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); ++ nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); + if (!nss_misc_reset) { + pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev); + return -EFAULT; +--- a/nss_hal/nss_hal.c ++++ b/nss_hal/nss_hal.c +@@ -78,9 +78,9 @@ int nss_hal_firmware_load(struct nss_ctx + return rc; + } + +- load_mem = ioremap_nocache(npd->load_addr, nss_fw->size); ++ load_mem = ioremap(npd->load_addr, nss_fw->size); + if (!load_mem) { +- nss_info_always("%px: ioremap_nocache failed: %x", nss_ctx, npd->load_addr); ++ nss_info_always("%px: ioremap failed: %x", nss_ctx, npd->load_addr); + release_firmware(nss_fw); + return rc; + } +--- a/nss_meminfo.c ++++ b/nss_meminfo.c +@@ -728,7 +728,7 @@ bool nss_meminfo_init(struct nss_ctx_ins + /* + * meminfo_start is the label where the start address of meminfo map is stored. + */ +- meminfo_start = (uint32_t *)ioremap_nocache(nss_ctx->load + NSS_MEMINFO_MAP_START_OFFSET, ++ meminfo_start = (uint32_t *)ioremap(nss_ctx->load + NSS_MEMINFO_MAP_START_OFFSET, + NSS_MEMINFO_RESERVE_AREA_SIZE); + if (!meminfo_start) { + nss_info_always("%px: cannot remap meminfo start\n", nss_ctx); +--- a/nss_ppe.c ++++ b/nss_ppe.c +@@ -357,7 +357,7 @@ void nss_ppe_init(void) + /* + * Get the PPE base address + */ +- ppe_pvt.ppe_base = ioremap_nocache(PPE_BASE_ADDR, PPE_REG_SIZE); ++ ppe_pvt.ppe_base = ioremap(PPE_BASE_ADDR, PPE_REG_SIZE); + if (!ppe_pvt.ppe_base) { + nss_warning("DRV can't get PPE base address\n"); + return; diff --git a/package/qca/nss/qca-nss-drv-64/patches/0003-DMA-Fix-NULL-pointer-exceptions.patch b/package/qca/nss/qca-nss-drv-64/patches/0003-DMA-Fix-NULL-pointer-exceptions.patch new file mode 100644 index 00000000000000..0c13a7887004fe --- /dev/null +++ b/package/qca/nss/qca-nss-drv-64/patches/0003-DMA-Fix-NULL-pointer-exceptions.patch @@ -0,0 +1,49 @@ +From 62e457f262aaa0db7113ad3ccbcb7ae49d4d7ea8 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Tue, 8 Jun 2021 23:24:43 +0200 +Subject: [PATCH] DMA: Fix NULL pointer exceptions + +There are multiple instances that pass NULL instead +of device to DMA functions. +That is incorrect and will cause kernel NULL pointer +exceptions. + +So, simply pass the device structure pointers. + +Signed-off-by: Robert Marko +--- + nss_core.c | 2 +- + nss_coredump.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- a/nss_core.c ++++ b/nss_core.c +@@ -1617,7 +1617,7 @@ static int32_t nss_core_handle_cause_que + * + */ + if (unlikely((buffer_type == N2H_BUFFER_CRYPTO_RESP))) { +- dma_unmap_single(NULL, (desc->buffer + desc->payload_offs), desc->payload_len, DMA_FROM_DEVICE); ++ dma_unmap_single(nss_ctx->dev, (desc->buffer + desc->payload_offs), desc->payload_len, DMA_FROM_DEVICE); + goto consume; + } + +--- a/nss_coredump.c ++++ b/nss_coredump.c +@@ -154,7 +154,7 @@ void nss_fw_coredump_notify(struct nss_c + dma_addr = nss_own->meminfo_ctx.logbuffer_dma; + } + +- dma_sync_single_for_cpu(NULL, dma_addr, sizeof(struct nss_log_descriptor), DMA_FROM_DEVICE); ++ dma_sync_single_for_cpu(nss_own->dev, dma_addr, sizeof(struct nss_log_descriptor), DMA_FROM_DEVICE); + + /* + * If the current entry is smaller than or equal to the number of NSS_LOG_COREDUMP_LINE_NUM, +@@ -181,7 +181,7 @@ void nss_fw_coredump_notify(struct nss_c + + offset = (index * sizeof(struct nss_log_entry)) + + offsetof(struct nss_log_descriptor, log_ring_buffer); +- dma_sync_single_for_cpu(NULL, dma_addr + offset, ++ dma_sync_single_for_cpu(nss_own->dev, dma_addr + offset, + sizeof(struct nss_log_entry), DMA_FROM_DEVICE); + nss_info_always("%px: %s\n", nss_own, nle_print->message); + nle_print++; diff --git a/package/qca/nss/qca-nss-drv-64/patches/999-treewide-hack-support-for-mismatched-firmware.patch b/package/qca/nss/qca-nss-drv-64/patches/999-treewide-hack-support-for-mismatched-firmware.patch new file mode 100644 index 00000000000000..46025b8235d7dd --- /dev/null +++ b/package/qca/nss/qca-nss-drv-64/patches/999-treewide-hack-support-for-mismatched-firmware.patch @@ -0,0 +1,344 @@ +From d0bffc800a50305315a0d7cf37140291ef5b1b61 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 27 May 2021 03:52:47 +0200 +Subject: [PATCH] treewide: hack support for mismatched firmware + +Make new qsdk feature configurable to support old half compatible +firmware. + +Signed-off-by: Ansuel Smith +--- + exports/nss_fw_version.h | 11 +++++++++++ + exports/nss_ipv4.h | 8 ++++++++ + exports/nss_ipv6.h | 7 +++++++ + exports/nss_wifi_vdev.h | 14 ++++++++++++++ + exports/nss_wifili_if.h | 8 ++++++++ + nss_ipv4_stats.c | 2 ++ + nss_ipv4_strings.c | 2 ++ + nss_ipv6_stats.c | 2 ++ + nss_ipv6_strings.c | 2 ++ + 9 files changed, 56 insertions(+) + create mode 100644 exports/nss_fw_version.h + +diff --git a/exports/nss_fw_version.h b/exports/nss_fw_version.h +new file mode 100644 +index 0000000..895d523 +--- /dev/null ++++ b/exports/nss_fw_version.h +@@ -0,0 +1,11 @@ ++#ifndef __NSS_FW_VERSION_H ++#define __NSS_FW_VERSION_H ++ ++#define NSS_FW_VERSION_MAJOR 11 ++#define NSS_FW_VERSION_MINOR 4 ++ ++#define NSS_FW_VERSION(a,b) (((a) << 8) + (b)) ++ ++#define NSS_FW_VERSION_CODE NSS_FW_VERSION(NSS_FW_VERSION_MAJOR, NSS_FW_VERSION_MINOR) ++ ++#endif /* __NSS_FW_VERSION_H */ +\ No newline at end of file +diff --git a/exports/nss_ipv4.h b/exports/nss_ipv4.h +index ee3a552..25c4d82 100644 +--- a/exports/nss_ipv4.h ++++ b/exports/nss_ipv4.h +@@ -26,6 +26,8 @@ + #include "nss_stats_public.h" + #endif + ++#include "nss_fw_version.h" ++ + /** + * @addtogroup nss_ipv4_subsystem + * @{ +@@ -216,12 +218,14 @@ enum nss_ipv4_stats_types { + /**< Number of IPv4 multicast connection destroy requests that missed the cache. */ + NSS_IPV4_STATS_MC_CONNECTION_FLUSHES, + /**< Number of IPv4 multicast connection flushes. */ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + NSS_IPV4_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFNUM, + /**< Number of IPv4 mirror connection requests with an invalid interface number. */ + NSS_IPV4_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFTYPE, + /**< Number of IPv4 mirror connection requests with an invalid interface type. */ + NSS_IPV4_STATS_MIRROR_FAILURES, + /**< Number of IPv4 mirror failures. */ ++#endif + NSS_IPV4_STATS_MAX, + /**< Maximum message type. */ + }; +@@ -609,8 +613,10 @@ struct nss_ipv4_rule_create_msg { + /**< Ingress shaping related accleration parameters. */ + struct nss_ipv4_identifier_rule identifier; + /**< Rule for adding identifier. */ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + struct nss_ipv4_mirror_rule mirror_rule; + /**< Mirror rule parameter. */ ++#endif + }; + + /** +@@ -955,6 +961,7 @@ struct nss_ipv4_node_sync { + uint32_t ipv4_mc_connection_flushes; + /**< Number of multicast connection flushes. */ + ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + uint32_t ipv4_connection_create_invalid_mirror_ifnum; + /**< Number of create request failed with an invalid mirror interface number. */ + +@@ -963,6 +970,7 @@ struct nss_ipv4_node_sync { + + uint32_t ipv4_mirror_failures; + /**< Mirror packet failed. */ ++#endif + + uint32_t exception_events[NSS_IPV4_EXCEPTION_EVENT_MAX]; + /**< Number of exception events. */ +diff --git a/exports/nss_ipv6.h b/exports/nss_ipv6.h +index 930e74c..a21f939 100644 +--- a/exports/nss_ipv6.h ++++ b/exports/nss_ipv6.h +@@ -195,6 +195,8 @@ enum nss_ipv6_stats_types { + /**< Number of IPv6 multicast connection destroy requests that missed the cache. */ + NSS_IPV6_STATS_MC_CONNECTION_FLUSHES, + /**< Number of IPv6 multicast connection flushes. */ ++ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + NSS_IPV6_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFNUM, + /**< Number of IPv6 mirror connection requests with an invalid interface number. */ + NSS_IPV6_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFTYPE, +@@ -202,6 +204,7 @@ enum nss_ipv6_stats_types { + + NSS_IPV6_STATS_MIRROR_FAILURES, + /**< Number of IPv6 mirror failures. */ ++#endif + + NSS_IPV6_STATS_MAX, + /**< Maximum message type. */ +@@ -702,8 +705,10 @@ struct nss_ipv6_rule_create_msg { + /**< Ingress shaping related accleration parameters. */ + struct nss_ipv6_identifier_rule identifier; + /**< Rule for adding identifier. */ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + struct nss_ipv6_mirror_rule mirror_rule; + /**< Mirror rule parameter. */ ++#endif + }; + + /** +@@ -950,6 +955,7 @@ struct nss_ipv6_node_sync { + uint32_t ipv6_mc_connection_flushes; + /**< Number of multicast connection flushes. */ + ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + uint32_t ipv6_connection_create_invalid_mirror_ifnum; + /**< Number of create request failed with an invalid mirror interface number. */ + +@@ -958,6 +964,7 @@ struct nss_ipv6_node_sync { + + uint32_t ipv6_mirror_failures; + /**< Mirror packet failed. */ ++#endif + + uint32_t exception_events[NSS_IPV6_EXCEPTION_EVENT_MAX]; + /**< Number of exception events. */ +diff --git a/exports/nss_wifi_vdev.h b/exports/nss_wifi_vdev.h +index 1b52f66..da91b56 100644 +--- a/exports/nss_wifi_vdev.h ++++ b/exports/nss_wifi_vdev.h +@@ -74,8 +74,10 @@ enum nss_wifi_vdev_msg_types { + NSS_WIFI_VDEV_INTERFACE_RECOVERY_RESET_MSG, + NSS_WIFI_VDEV_INTERFACE_RECOVERY_RECONF_MSG, + NSS_WIFI_VDEV_SET_GROUP_KEY, ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + NSS_WIFI_VDEV_HMMC_MEMBER_ADD_MSG, + NSS_WIFI_VDEV_HMMC_MEMBER_DEL_MSG, ++#endif + NSS_WIFI_VDEV_MAX_MSG + }; + +@@ -130,6 +132,7 @@ enum nss_wifi_vdev_err_types { + NSS_WIFI_VDEV_VLAN_MODE_CONFIG_FAIL, + NSS_WIFI_VDEV_RECOVERY_RESET_FAIL, + NSS_WIFI_VDEV_RECOVERY_RECONF_FAIL, ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + NSS_WIFI_VDEV_CONFIG_GROUP_KEY_FAIL, + NSS_WIFI_VDEV_MULTIPASS_NOT_ENABLED, + NSS_WIFI_VDEV_ALLOC_VLAN_MAP_FAILED, +@@ -139,6 +142,7 @@ enum nss_wifi_vdev_err_types { + NSS_WIFI_VDEV_PPE_PORT_DESTROY_FAIL, + NSS_WIFI_VDEV_PPE_VSI_ASSIGN_FAIL, + NSS_WIFI_VDEV_PPE_VSI_UNASSIGN_FAIL, ++#endif + NSS_WIFI_VDEV_EINV_MAX_CFG + }; + +@@ -161,11 +165,13 @@ enum nss_wifi_vdev_ext_data_pkt_type { + NSS_WIFI_VDEV_EXT_TX_COMPL_PKT_TYPE = 11, /**< Tx completion. */ + NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_WDS_LEARN = 12, /**< WDS source port learning command. */ + NSS_WIFI_VDEV_EXT_DATA_PPDU_INFO = 13, /**< PPDU metadata information. */ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_MCBC_RX = 14, /**< Multicast/broadcast packet received. */ + NSS_WIFI_VDEV_MESH_EXT_DATA_PKT_TYPE_RX_SPL_PACKET = 15, + /**< Mesh link VAP special packet. */ + NSS_WIFI_VDEV_MESH_EXT_DATA_PKT_TYPE_RX_MCAST_EXC = 16, + /**< Mesh link VAP multicast packet. */ ++#endif + NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_MAX + }; + +@@ -201,9 +207,11 @@ enum nss_wifi_vdev_cmd { + NSS_WIFI_VDEV_ENABLE_IGMP_ME_CMD, /**< Configuration to set IGMP multicast enhancement on VAP. */ + NSS_WIFI_VDEV_CFG_WDS_BACKHAUL_CMD, + /**< Configuration to set WDS backhaul extension on VAP. */ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + NSS_WIFI_VDEV_CFG_MCBC_EXC_TO_HOST_CMD, /**< Configuration to set multicast/broadcast exception to host on VAP. */ + NSS_WIFI_VDEV_CFG_PEER_AUTHORIZE_CMD, + /**< Configuration to enable peer authorization on VAP. */ ++#endif + NSS_WIFI_VDEV_MAX_CMD + }; + +@@ -271,7 +279,9 @@ struct nss_wifi_vdev_config_msg { + uint8_t is_nss_qwrap_en; /**< VAP is configured for NSS firmware QWRAP logic. */ + uint8_t tx_per_pkt_vdev_id_check; /**< Transmit per-packet virtual device ID check. */ + uint8_t align_pad; /**< Reserved field. */ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + uint32_t vap_ext_mode; /**< Different VAP extended modes. */ ++#endif + }; + + /** +@@ -1037,8 +1047,10 @@ struct nss_wifi_vdev_stats_sync_msg { + uint32_t rx_mcast_bytes; /**< Receive multicast bytes count. */ + uint32_t rx_decrypt_err; /**< Receive decryption error */ + uint32_t rx_mic_err; /**< Receive MIC error */ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + uint32_t mcbc_exc_host_fail_cnt; + /**< Number of multicast/broadcast packets failed to send to host through exception path. */ ++#endif + }; + + /** +@@ -1070,6 +1082,7 @@ struct nss_wifi_vdev_msg { + /**< Updates a snooplist group member. */ + struct nss_wifi_vdev_me_snptbl_deny_grp_add_msg vdev_deny_member_add; + /**< Add a snooplist member to the deny list. */ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + struct nss_wifi_vdev_me_hmmc_add_msg vdev_hmmc_member_add; + /**< Adds a new member into the HMMC list. */ + struct nss_wifi_vdev_me_hmmc_del_msg vdev_hmmc_member_del; +@@ -1078,6 +1091,7 @@ struct nss_wifi_vdev_msg { + /**< Adds a new member into the deny list. */ + struct nss_wifi_vdev_me_deny_ip_del_msg vdev_deny_list_member_del; + /**< Delete a member from the deny list. */ ++#endif + struct nss_wifi_vdev_txmsg vdev_txmsgext; + /**< Transmits special data. */ + struct nss_wifi_vdev_vow_dbg_cfg_msg vdev_vow_dbg_cfg; +diff --git a/exports/nss_wifili_if.h b/exports/nss_wifili_if.h +index fce20fd..1f26d67 100644 +--- a/exports/nss_wifili_if.h ++++ b/exports/nss_wifili_if.h +@@ -62,8 +62,12 @@ + /**< Maximum number of bandwidth supported. */ + #define NSS_WIFILI_REPT_MU_MIMO 1 + #define NSS_WIFILI_REPT_MU_OFDMA_MIMO 3 ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) ++#define NSS_WIFILI_MAX_RESERVED_TYPE 3 ++#else + #define NSS_WIFILI_MAX_RESERVED_TYPE 2 + /**< Maximum reserved type. */ ++#endif + #define NSS_WIFILI_SOC_PER_PACKET_METADATA_SIZE 60 + /**< Metadata area total size. */ + #define NSS_WIFILI_MEC_PEER_ID 0xDEAD +@@ -1333,7 +1337,9 @@ struct nss_wifili_rx_err { + struct nss_wifili_rx_ctrl_stats { + struct nss_wifili_rx_err err; /**< Rx peer errors. */ + uint32_t multipass_rx_pkt_drop; /**< Total number of multipass packets without a VLAN header. */ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + uint32_t peer_unauth_rx_pkt_drop; /**< Number of receive packets dropped due to an authorized peer. */ ++#endif + uint32_t reserved_type[NSS_WIFILI_MAX_RESERVED_TYPE]; /**< Reserved type for future use. */ + uint32_t non_amsdu_cnt; /**< Number of MSDUs with no MSDU level aggregation. */ + uint32_t amsdu_cnt; /**< Number of MSDUs part of AMSDU. */ +@@ -1810,10 +1816,12 @@ struct nss_wifili_msg { + /**< Peer four-address event message. */ + struct nss_wifili_dbdc_repeater_loop_detection_msg wdrldm; + /**< Wifili DBDC repeater loop detection message. */ ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + struct nss_wifili_peer_update_auth_flag peer_auth; + /**< Peer authentication flag message. */ + struct nss_wifili_mesh_capability_info cap_info; + /**< Mesh capability flag. */ ++#endif + } msg; /**< Message payload. */ + }; + +diff --git a/nss_ipv4_stats.c b/nss_ipv4_stats.c +index 39b162c..c875a63 100644 +--- a/nss_ipv4_stats.c ++++ b/nss_ipv4_stats.c +@@ -177,9 +177,11 @@ void nss_ipv4_stats_node_sync(struct nss_ctx_instance *nss_ctx, struct nss_ipv4_ + nss_ipv4_stats[NSS_IPV4_STATS_MC_CONNECTION_DESTROY_REQUESTS] += nins->ipv4_mc_connection_destroy_requests; + nss_ipv4_stats[NSS_IPV4_STATS_MC_CONNECTION_DESTROY_MISSES] += nins->ipv4_mc_connection_destroy_misses; + nss_ipv4_stats[NSS_IPV4_STATS_MC_CONNECTION_FLUSHES] += nins->ipv4_mc_connection_flushes; ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + nss_ipv4_stats[NSS_IPV4_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFNUM] += nins->ipv4_connection_create_invalid_mirror_ifnum; + nss_ipv4_stats[NSS_IPV4_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFTYPE] += nins->ipv4_connection_create_invalid_mirror_iftype; + nss_ipv4_stats[NSS_IPV4_STATS_MIRROR_FAILURES] += nins->ipv4_mirror_failures; ++#endif + + for (i = 0; i < NSS_IPV4_EXCEPTION_EVENT_MAX; i++) { + nss_ipv4_exception_stats[i] += nins->exception_events[i]; +diff --git a/nss_ipv4_strings.c b/nss_ipv4_strings.c +index 77ff352..ce4c249 100644 +--- a/nss_ipv4_strings.c ++++ b/nss_ipv4_strings.c +@@ -137,9 +137,11 @@ struct nss_stats_info nss_ipv4_strings_stats[NSS_IPV4_STATS_MAX] = { + {"mc_destroy_requests" , NSS_STATS_TYPE_SPECIAL}, + {"mc_destroy_misses" , NSS_STATS_TYPE_SPECIAL}, + {"mc_flushes" , NSS_STATS_TYPE_SPECIAL}, ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + {"mirror_invalid_ifnum_conn_create_req" , NSS_STATS_TYPE_SPECIAL}, + {"mirror_invalid_iftype_conn_create_req" , NSS_STATS_TYPE_SPECIAL}, + {"mirror_failures" , NSS_STATS_TYPE_SPECIAL}, ++#endif + }; + + /* +diff --git a/nss_ipv6_stats.c b/nss_ipv6_stats.c +index 617f55b..a492a6c 100644 +--- a/nss_ipv6_stats.c ++++ b/nss_ipv6_stats.c +@@ -180,9 +180,11 @@ void nss_ipv6_stats_node_sync(struct nss_ctx_instance *nss_ctx, struct nss_ipv6_ + nss_ipv6_stats[NSS_IPV6_STATS_MC_CONNECTION_DESTROY_REQUESTS] += nins->ipv6_mc_connection_destroy_requests; + nss_ipv6_stats[NSS_IPV6_STATS_MC_CONNECTION_DESTROY_MISSES] += nins->ipv6_mc_connection_destroy_misses; + nss_ipv6_stats[NSS_IPV6_STATS_MC_CONNECTION_FLUSHES] += nins->ipv6_mc_connection_flushes; ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + nss_ipv6_stats[NSS_IPV6_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFNUM] += nins->ipv6_connection_create_invalid_mirror_ifnum; + nss_ipv6_stats[NSS_IPV6_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFTYPE] += nins->ipv6_connection_create_invalid_mirror_iftype; + nss_ipv6_stats[NSS_IPV6_STATS_MIRROR_FAILURES] += nins->ipv6_mirror_failures; ++#endif + + for (i = 0; i < NSS_IPV6_EXCEPTION_EVENT_MAX; i++) { + nss_ipv6_exception_stats[i] += nins->exception_events[i]; +diff --git a/nss_ipv6_strings.c b/nss_ipv6_strings.c +index 57b100f..29df9c9 100644 +--- a/nss_ipv6_strings.c ++++ b/nss_ipv6_strings.c +@@ -115,9 +115,11 @@ struct nss_stats_info nss_ipv6_strings_stats[NSS_IPV6_STATS_MAX] = { + {"mc_destroy_requests" ,NSS_STATS_TYPE_SPECIAL}, + {"mc_destroy_misses" ,NSS_STATS_TYPE_SPECIAL}, + {"mc_flushes" ,NSS_STATS_TYPE_SPECIAL}, ++#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) + {"mirror_invalid_ifnum_conn_create_req" ,NSS_STATS_TYPE_SPECIAL}, + {"mirror_invalid_iftype_conn_create_req" ,NSS_STATS_TYPE_SPECIAL}, + {"mirror_failures" ,NSS_STATS_TYPE_SPECIAL}, ++#endif + }; + + /* +-- +2.31.1 + diff --git a/package/nss/qca/qca-nss-drv/Makefile b/package/qca/nss/qca-nss-drv/Makefile similarity index 98% rename from package/nss/qca/qca-nss-drv/Makefile rename to package/qca/nss/qca-nss-drv/Makefile index aeb037e83e092d..7e695ca3822235 100644 --- a/package/nss/qca/qca-nss-drv/Makefile +++ b/package/qca/nss/qca-nss-drv/Makefile @@ -18,7 +18,7 @@ define KernelPackage/qca-nss-drv CATEGORY:=Kernel modules SUBMENU:=Network Devices DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64 \ - +PACKAGE_kmod-qca-nss-gmac:kmod-qca-nss-gmac @!LINUX_3_18 + +PACKAGE_kmod-qca-nss-gmac:kmod-qca-nss-gmac @LINUX_5_4 TITLE:=Kernel driver for NSS (core driver) FILES:=$(PKG_BUILD_DIR)/qca-nss-drv.ko AUTOLOAD:=$(call AutoLoad,32,qca-nss-drv) diff --git a/package/nss/qca/qca-nss-drv/files/nss-firmware/LICENSE.TXT b/package/qca/nss/qca-nss-drv/files/nss-firmware/LICENSE.TXT similarity index 100% rename from package/nss/qca/qca-nss-drv/files/nss-firmware/LICENSE.TXT rename to package/qca/nss/qca-nss-drv/files/nss-firmware/LICENSE.TXT diff --git a/package/nss/qca/qca-nss-drv/files/nss-firmware/NOTICE.TXT b/package/qca/nss/qca-nss-drv/files/nss-firmware/NOTICE.TXT similarity index 100% rename from package/nss/qca/qca-nss-drv/files/nss-firmware/NOTICE.TXT rename to package/qca/nss/qca-nss-drv/files/nss-firmware/NOTICE.TXT diff --git a/package/nss/qca/qca-nss-drv/files/nss-firmware/README.md b/package/qca/nss/qca-nss-drv/files/nss-firmware/README.md similarity index 100% rename from package/nss/qca/qca-nss-drv/files/nss-firmware/README.md rename to package/qca/nss/qca-nss-drv/files/nss-firmware/README.md diff --git a/package/nss/qca/qca-nss-drv/files/nss-firmware/qca-nss0-retail.bin b/package/qca/nss/qca-nss-drv/files/nss-firmware/qca-nss0-retail.bin similarity index 100% rename from package/nss/qca/qca-nss-drv/files/nss-firmware/qca-nss0-retail.bin rename to package/qca/nss/qca-nss-drv/files/nss-firmware/qca-nss0-retail.bin diff --git a/package/nss/qca/qca-nss-drv/files/nss-firmware/qca-nss1-retail.bin b/package/qca/nss/qca-nss-drv/files/nss-firmware/qca-nss1-retail.bin similarity index 100% rename from package/nss/qca/qca-nss-drv/files/nss-firmware/qca-nss1-retail.bin rename to package/qca/nss/qca-nss-drv/files/nss-firmware/qca-nss1-retail.bin diff --git a/package/qca/nss/qca-nss-drv/files/qca-nss-drv.conf b/package/qca/nss/qca-nss-drv/files/qca-nss-drv.conf new file mode 100644 index 00000000000000..a8a1fbf406d49b --- /dev/null +++ b/package/qca/nss/qca-nss-drv/files/qca-nss-drv.conf @@ -0,0 +1,6 @@ +config nss_firmware 'qca_nss_0' + +config nss_firmware 'qca_nss_1' + +config general + option enable_rps '1' diff --git a/package/qca/nss/qca-nss-drv/files/qca-nss-drv.debug b/package/qca/nss/qca-nss-drv/files/qca-nss-drv.debug new file mode 100644 index 00000000000000..5d435c3a76d0a0 --- /dev/null +++ b/package/qca/nss/qca-nss-drv/files/qca-nss-drv.debug @@ -0,0 +1,26 @@ +#!/bin/sh /sbin/sysdebug +# +# Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +log cat /sys/kernel/debug/qca-nss-drv/stats/pppoe +log cat /sys/kernel/debug/qca-nss-drv/stats/n2h +log cat /sys/kernel/debug/qca-nss-drv/stats/ipv6 +log cat /sys/kernel/debug/qca-nss-drv/stats/ipv4 +log cat /sys/kernel/debug/qca-nss-drv/stats/gmac +log cat /sys/kernel/debug/qca-nss-drv/stats/drv +log cat /sys/kernel/debug/qca-nss-drv/stats/wifi +log cat /sys/kernel/debug/qca-nss-drv/stats/wifi_if +log cat /sys/kernel/debug/qca-nss-drv/stats/eth_rx diff --git a/package/qca/nss/qca-nss-drv/files/qca-nss-drv.hotplug b/package/qca/nss/qca-nss-drv/files/qca-nss-drv.hotplug new file mode 100644 index 00000000000000..1e4813838c30bd --- /dev/null +++ b/package/qca/nss/qca-nss-drv/files/qca-nss-drv.hotplug @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +KERNEL=`uname -r` +case "${KERNEL}" in + 3.4*) + select_or_load=load_nss_fw + ;; + *) + select_or_load=select_nss_fw + ;; +esac + +load_nss_fw () { + ls -l $1 | awk ' { print $9,$5 } '> /dev/console + echo 1 > /sys/class/firmware/$DEVICENAME/loading + cat $1 > /sys/class/firmware/$DEVICENAME/data + echo 0 > /sys/class/firmware/$DEVICENAME/loading +} + +select_nss_fw () { + rm -f /lib/firmware/$DEVICENAME + ln -s $1 /lib/firmware/$DEVICENAME + ls -l /lib/firmware/$DEVICENAME | awk ' { print $9,$5 } '> /dev/console +} + +[ "$ACTION" != "add" ] && exit + +# dev name for UCI, since it doesn't let you use . or - +SDEVNAME=$(echo ${DEVICENAME} | sed s/[.-]/_/g) + +SELECTED_FW=$(uci get nss.${SDEVNAME}.firmware 2>/dev/null) +[ -e "${SELECTED_FW}" ] && { + $select_or_load ${SELECTED_FW} + exit +} + +case $DEVICENAME in + qca-nss0* | qca-nss.0*) + if [ -e /lib/firmware/qca-nss0-enterprise.bin ] ; then + $select_or_load /lib/firmware/qca-nss0-enterprise.bin + else + $select_or_load /lib/firmware/qca-nss0-retail.bin + fi + exit + ;; + qca-nss1* | qca-nss.1*) + if [ -e /lib/firmware/qca-nss1-enterprise.bin ] ; then + $select_or_load /lib/firmware/qca-nss1-enterprise.bin + else + $select_or_load /lib/firmware/qca-nss1-retail.bin + fi + exit + ;; +esac + diff --git a/package/qca/nss/qca-nss-drv/files/qca-nss-drv.init b/package/qca/nss/qca-nss-drv/files/qca-nss-drv.init new file mode 100644 index 00000000000000..de12cb6d127c57 --- /dev/null +++ b/package/qca/nss/qca-nss-drv/files/qca-nss-drv.init @@ -0,0 +1,50 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +START=70 + +enable_rps() { + irq_nss_rps=`grep nss_queue1 /proc/interrupts | cut -d ':' -f 1 | tr -d ' '` + for entry in $irq_nss_rps + do + echo 2 > /proc/irq/$entry/smp_affinity + done + + irq_nss_rps=`grep nss_queue2 /proc/interrupts | cut -d ':' -f 1 | tr -d ' '` + for entry in $irq_nss_rps + do + echo 4 > /proc/irq/$entry/smp_affinity + done + + irq_nss_rps=`grep nss_queue3 /proc/interrupts | cut -d ':' -f 1 | tr -d ' '` + for entry in $irq_nss_rps + do + echo 8 > /proc/irq/$entry/smp_affinity + done + + # Enable NSS RPS + sysctl -w dev.nss.rps.enable=1 >/dev/null 2>/dev/null + +} + + +start() { + local rps_enabled="$(uci_get nss @general[0] enable_rps)" + if [ "$rps_enabled" -eq 1 ]; then + enable_rps + fi +} diff --git a/package/qca/nss/qca-nss-drv/files/qca-nss-drv.sysctl b/package/qca/nss/qca-nss-drv/files/qca-nss-drv.sysctl new file mode 100644 index 00000000000000..fc36c33eb524de --- /dev/null +++ b/package/qca/nss/qca-nss-drv/files/qca-nss-drv.sysctl @@ -0,0 +1,4 @@ +# Default Number of connection configuration +dev.nss.ipv4cfg.ipv4_conn=4096 +dev.nss.ipv6cfg.ipv6_conn=4096 + diff --git a/package/nss/qca/qca-nss-drv/patches/100-kernel-5.4-support.patch b/package/qca/nss/qca-nss-drv/patches/100-kernel-5.4-support.patch similarity index 100% rename from package/nss/qca/qca-nss-drv/patches/100-kernel-5.4-support.patch rename to package/qca/nss/qca-nss-drv/patches/100-kernel-5.4-support.patch diff --git a/package/nss/qca/qca-nss-drv/patches/101-nss-drv-Control-fab-scaling-from-package-Makefile.patch b/package/qca/nss/qca-nss-drv/patches/101-nss-drv-Control-fab-scaling-from-package-Makefile.patch similarity index 100% rename from package/nss/qca/qca-nss-drv/patches/101-nss-drv-Control-fab-scaling-from-package-Makefile.patch rename to package/qca/nss/qca-nss-drv/patches/101-nss-drv-Control-fab-scaling-from-package-Makefile.patch diff --git a/package/nss/qca/qca-nss-drv/patches/200-fix-NULL-pointer-exception.patch b/package/qca/nss/qca-nss-drv/patches/200-fix-NULL-pointer-exception.patch similarity index 100% rename from package/nss/qca/qca-nss-drv/patches/200-fix-NULL-pointer-exception.patch rename to package/qca/nss/qca-nss-drv/patches/200-fix-NULL-pointer-exception.patch diff --git a/package/nss/qca/qca-nss-drv/patches/201-Fix-Kernel-Panic-dma-with-NULL-dev.patch b/package/qca/nss/qca-nss-drv/patches/201-Fix-Kernel-Panic-dma-with-NULL-dev.patch similarity index 100% rename from package/nss/qca/qca-nss-drv/patches/201-Fix-Kernel-Panic-dma-with-NULL-dev.patch rename to package/qca/nss/qca-nss-drv/patches/201-Fix-Kernel-Panic-dma-with-NULL-dev.patch diff --git a/package/nss/qca/qca-nss-drv/patches/400-Exported-set-nexthop-function.patch b/package/qca/nss/qca-nss-drv/patches/400-Exported-set-nexthop-function.patch similarity index 100% rename from package/nss/qca/qca-nss-drv/patches/400-Exported-set-nexthop-function.patch rename to package/qca/nss/qca-nss-drv/patches/400-Exported-set-nexthop-function.patch diff --git a/package/qca/nss/qca-nss-ecm-64/Makefile b/package/qca/nss/qca-nss-ecm-64/Makefile new file mode 100644 index 00000000000000..f59488c5bb02c2 --- /dev/null +++ b/package/qca/nss/qca-nss-ecm-64/Makefile @@ -0,0 +1,97 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=qca-nss-ecm-64 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_URL:=https://source.codeaurora.org/quic/cc-qrdk/oss/lklm/qca-nss-ecm +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2021-04-29 +PKG_SOURCE_VERSION:=c115aec34867b582e2e5ea79fc5315971e0e953c +PKG_MIRROR_HASH:=a772996af7bbae7031eebc2f789431d29be67f11eb0a1e874c08b74eec6f4585 + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/qca-nss-ecm-64 + SECTION:=kernel + CATEGORY:=Kernel modules + SUBMENU:=Network Support + DEPENDS:=@(TARGET_ipq807x||TARGET_ipq60xx) \ + +kmod-qca-nss-drv-64 \ + +iptables-mod-extra \ + +kmod-ipt-conntrack \ + +kmod-ipt-physdev \ + +iptables-mod-physdev \ + +kmod-ppp \ + +kmod-pppoe + TITLE:=QCA NSS Enhanced Connection Manager (ECM) + FILES:=$(PKG_BUILD_DIR)/*.ko + KCONFIG:=CONFIG_BRIDGE_NETFILTER=y \ + CONFIG_NF_CONNTRACK_EVENTS=y \ + CONFIG_NF_CONNTRACK_CHAIN_EVENTS=y \ + CONFIG_NF_CONNTRACK_DSCPREMARK_EXT=n +endef + +define KernelPackage/qca-nss-ecm-64/Description +This package contains the QCA NSS Enhanced Connection Manager +endef + +define KernelPackage/qca-nss-ecm-64/install + $(INSTALL_DIR) $(1)/etc/firewall.d $(1)/etc/init.d $(1)/usr/bin $(1)/lib/netifd/offload $(1)/etc/config $(1)/etc/uci-defaults $(1)/etc/sysctl.d + $(INSTALL_DATA) ./files/qca-nss-ecm.firewall $(1)/etc/firewall.d/qca-nss-ecm + $(INSTALL_BIN) ./files/qca-nss-ecm.init $(1)/etc/init.d/qca-nss-ecm + $(INSTALL_BIN) ./files/ecm_dump.sh $(1)/usr/bin/ + $(INSTALL_BIN) ./files/on-demand-down $(1)/lib/netifd/offload/on-demand-down + $(INSTALL_DATA) ./files/qca-nss-ecm.uci $(1)/etc/config/ecm + $(INSTALL_DATA) ./files/qca-nss-ecm.defaults $(1)/etc/uci-defaults/99-qca-nss-ecm + $(INSTALL_BIN) ./files/qca-nss-ecm.sysctl $(1)/etc/sysctl.d/qca-nss-ecm.conf + echo 'net.netfilter.nf_conntrack_max=8192' >> $(1)/etc/sysctl.d/qca-nss-ecm.conf +endef + +EXTRA_CFLAGS+=-I$(STAGING_DIR)/usr/include/qca-nss-drv + +ifneq (, $(findstring $(CONFIG_TARGET_BOARD), "ipq807x" "ipq60xx")) +ECM_MAKE_OPTS+= ECM_FRONT_END_NSS_ENABLE=y \ + ECM_CLASSIFIER_HYFI_ENABLE=n \ + ECM_MULTICAST_ENABLE=n \ + ECM_INTERFACE_IPSEC_ENABLE=n \ + ECM_INTERFACE_PPTP_ENABLE=n \ + ECM_INTERFACE_L2TPV2_ENABLE=n \ + ECM_INTERFACE_GRE_TAP_ENABLE=n \ + ECM_INTERFACE_GRE_TUN_ENABLE=n \ + ECM_INTERFACE_SIT_ENABLE=n \ + ECM_INTERFACE_TUNIPIP6_ENABLE=n \ + ECM_INTERFACE_RAWIP_ENABLE=n \ + ECM_INTERFACE_VLAN_ENABLE=n \ + ECM_CLASSIFIER_MARK_ENABLE=n \ + ECM_CLASSIFIER_DSCP_ENABLE=n \ + ECM_CLASSIFIER_PCC_ENABLE=n \ + ECM_BAND_STEERING_ENABLE=n \ + ECM_INTERFACE_PPPOE_ENABLE=y +endif + +ifeq ($(CONFIG_TARGET_BOARD), "ipq807x") + SOC="ipq807x_64" +else ifeq ($(CONFIG_TARGET_BOARD), "ipq60xx") + SOC="ipq60xx_64" +endif + +define Build/InstallDev + mkdir -p $(1)/usr/include/qca-nss-ecm + $(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-ecm +endef + +define Build/Compile + +$(MAKE) -C "$(LINUX_DIR)" $(strip $(ECM_MAKE_OPTS)) \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + M="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC=$(SOC) \ + $(KERNEL_MAKE_FLAGS) \ + $(PKG_JOBS) \ + modules +endef + +$(eval $(call KernelPackage,qca-nss-ecm-64)) diff --git a/package/nss/qca/qca-nss-ecm/files/ecm_dump.sh b/package/qca/nss/qca-nss-ecm-64/files/ecm_dump.sh old mode 100644 new mode 100755 similarity index 100% rename from package/nss/qca/qca-nss-ecm/files/ecm_dump.sh rename to package/qca/nss/qca-nss-ecm-64/files/ecm_dump.sh diff --git a/package/nss/qca/qca-nss-ecm/files/on-demand-down b/package/qca/nss/qca-nss-ecm-64/files/on-demand-down similarity index 100% rename from package/nss/qca/qca-nss-ecm/files/on-demand-down rename to package/qca/nss/qca-nss-ecm-64/files/on-demand-down diff --git a/package/nss/qca/qca-nss-ecm/files/qca-nss-ecm.defaults b/package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.defaults similarity index 100% rename from package/nss/qca/qca-nss-ecm/files/qca-nss-ecm.defaults rename to package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.defaults diff --git a/package/nss/qca/qca-nss-ecm/files/qca-nss-ecm.firewall b/package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.firewall similarity index 100% rename from package/nss/qca/qca-nss-ecm/files/qca-nss-ecm.firewall rename to package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.firewall diff --git a/package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.init b/package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.init new file mode 100644 index 00000000000000..7afb679f19ad67 --- /dev/null +++ b/package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.init @@ -0,0 +1,140 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (c) 2014, 2019-2020 The Linux Foundation. All rights reserved. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +# The shebang above has an extra space intentially to avoid having +# openwrt build scripts automatically enable this package starting +# at boot. + +START=19 + +get_front_end_mode() { + config_load "ecm" + config_get front_end global acceleration_engine "auto" + + case $front_end in + auto) + echo '0' + ;; + nss) + echo '1' + ;; + sfe) + echo '2' + ;; + *) + echo 'uci_option_acceleration_engine is invalid' + esac +} + +support_bridge() { + #NSS support bridge acceleration + [ -d /sys/kernel/debug/ecm/ecm_nss_ipv4 ] && return 0 + #SFE doesn't support bridge acceleration + [ -d /sys/kernel/debug/ecm/ecm_sfe_ipv4 ] && return 1 +} + +load_sfe() { + local kernel_version=$(uname -r) + + [ -e "/lib/modules/$kernel_version/shortcut-fe.ko" ] && { + [ -d /sys/module/shortcut_fe ] || insmod shortcut-fe + } + + [ -e "/lib/modules/$kernel_version/shortcut-fe-ipv6.ko" ] && { + [ -d /sys/module/shortcut_fe_ipv6 ] || insmod shortcut-fe-ipv6 + } + + [ -e "/lib/modules/$kernel_version/shortcut-fe-drv.ko" ] && { + [ -d /sys/module/shortcut_fe_drv ] || insmod shortcut-fe-drv + } +} + +load_ecm() { + [ -d /sys/module/ecm ] || { + [ ! -e /proc/device-tree/MP_256 ] && load_sfe + insmod ecm front_end_selection=$(get_front_end_mode) + } + + support_bridge && { + sysctl -w net.bridge.bridge-nf-call-ip6tables=1 + sysctl -w net.bridge.bridge-nf-call-iptables=1 + } +} + +unload_ecm() { + sysctl -w net.bridge.bridge-nf-call-ip6tables=0 + sysctl -w net.bridge.bridge-nf-call-iptables=0 + + if [ -d /sys/module/ecm ]; then + # + # Stop ECM frontends + # + echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop + echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop + + # + # Defunct the connections + # + echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all + sleep 5; + + rmmod ecm + sleep 1 + fi +} + +start() { + # If SFE CM is loaded, return. + if [ -d /sys/module/shortcut_fe_cm ]; then + echo "shortcut_fe CM is loaded, unload it first" + echo "cmd: /etc/init.d/shortcut_fe stop" + return + fi + + load_ecm + + # If the acceleration engine is NSS, enable wifi redirect. + [ -d /sys/kernel/debug/ecm/ecm_nss_ipv4 ] && sysctl -w dev.nss.general.redirect=1 + + support_bridge && { + echo 'net.bridge.bridge-nf-call-ip6tables=1' >> /etc/sysctl.d/qca-nss-ecm.conf + echo 'net.bridge.bridge-nf-call-iptables=1' >> /etc/sysctl.d/qca-nss-ecm.conf + } + + if [ -d /sys/module/qca_ovsmgr ]; then + insmod ecm_ovs + fi + +} + +stop() { + # If ECM is already not loaded, just return. + if [ ! -d /sys/module/ecm ]; then + return + fi + + # If the acceleration engine is NSS, disable wifi redirect. + [ -d /sys/kernel/debug/ecm/ecm_nss_ipv4 ] && sysctl -w dev.nss.general.redirect=0 + + sed '/net.bridge.bridge-nf-call-ip6tables=1/d' -i /etc/sysctl.d/qca-nss-ecm.conf + sed '/net.bridge.bridge-nf-call-iptables=1/d' -i /etc/sysctl.d/qca-nss-ecm.conf + + if [ -d /sys/module/ecm_ovs ]; then + rmmod ecm_ovs + fi + + unload_ecm +} diff --git a/package/nss/qca/qca-nss-ecm/files/qca-nss-ecm.sysctl b/package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.sysctl similarity index 100% rename from package/nss/qca/qca-nss-ecm/files/qca-nss-ecm.sysctl rename to package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.sysctl diff --git a/package/nss/qca/qca-nss-ecm/files/qca-nss-ecm.uci b/package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.uci similarity index 100% rename from package/nss/qca/qca-nss-ecm/files/qca-nss-ecm.uci rename to package/qca/nss/qca-nss-ecm-64/files/qca-nss-ecm.uci diff --git a/package/qca/nss/qca-nss-ecm-64/patches/001-treewide-componentize-the-module-even-more.patch b/package/qca/nss/qca-nss-ecm-64/patches/001-treewide-componentize-the-module-even-more.patch new file mode 100644 index 00000000000000..4e7932c9d7cc73 --- /dev/null +++ b/package/qca/nss/qca-nss-ecm-64/patches/001-treewide-componentize-the-module-even-more.patch @@ -0,0 +1,335 @@ +From 73345c87b28a473b35b57e673f8de963c3d73da1 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Wed, 19 May 2021 02:38:53 +0200 +Subject: [PATCH] treewide: componentize the module even more + +Signed-off-by: Ansuel Smith +--- + Makefile | 56 +++++++++++++++++++++++++------- + ecm_db/ecm_db_connection.c | 8 +++++ + ecm_db/ecm_db_node.c | 4 +++ + ecm_interface.c | 8 +++++ + frontends/ecm_front_end_common.c | 7 ++++ + 5 files changed, 72 insertions(+), 11 deletions(-) + +--- a/Makefile ++++ b/Makefile +@@ -82,10 +82,18 @@ ccflags-$(ECM_INTERFACE_BOND_ENABLE) += + # Define ECM_INTERFACE_PPPOE_ENABLE=y in order + # to enable support for PPPoE acceleration. + # ############################################################################# +-ECM_INTERFACE_PPPOE_ENABLE=y ++ifndef $(ECM_INTERFACE_PPPOE_ENABLE) ++ ECM_INTERFACE_PPPOE_ENABLE=y ++endif + ccflags-$(ECM_INTERFACE_PPPOE_ENABLE) += -DECM_INTERFACE_PPPOE_ENABLE + + # ############################################################################# ++# Define ECM_INTERFACE_L2TPV2_PPTP_ENABLE=y in order ++# to enable support for l2tpv2 or PPTP detection. ++# ############################################################################# ++ccflags-$(ECM_INTERFACE_L2TPV2_PPTP_ENABLE) += -DECM_INTERFACE_L2TPV2_PPTP_ENABLE ++ ++# ############################################################################# + # Define ECM_INTERFACE_L2TPV2_ENABLE=y in order + # to enable support for l2tpv2 acceleration. + # ############################################################################# +@@ -118,6 +126,12 @@ ccflags-$(ECM_INTERFACE_PPP_ENABLE) += - + ccflags-$(ECM_INTERFACE_MAP_T_ENABLE) += -DECM_INTERFACE_MAP_T_ENABLE + + # ############################################################################# ++# Define ECM_INTERFACE_GRE_ENABLE=y in order ++# to enable support for GRE detection. ++# ############################################################################# ++ccflags-$(ECM_INTERFACE_GRE_ENABLE) += -DECM_INTERFACE_GRE_ENABLE ++ ++# ############################################################################# + # Define ECM_INTERFACE_GRE_TAP_ENABLE=y in order + # to enable support for GRE TAP interface. + # ############################################################################# +@@ -186,7 +200,9 @@ ccflags-$(ECM_INTERFACE_OVS_BRIDGE_ENABL + # ############################################################################# + # Define ECM_INTERFACE_VLAN_ENABLE=y in order to enable support for VLAN + # ############################################################################# +-ECM_INTERFACE_VLAN_ENABLE=y ++ifndef $(ECM_INTERFACE_VLAN_ENABLE) ++ ECM_INTERFACE_VLAN_ENABLE=y ++endif + ccflags-$(ECM_INTERFACE_VLAN_ENABLE) += -DECM_INTERFACE_VLAN_ENABLE + + # ############################################################################# +@@ -228,7 +244,9 @@ ccflags-$(ECM_CLASSIFIER_OVS_ENABLE) += + # ############################################################################# + # Define ECM_CLASSIFIER_MARK_ENABLE=y in order to enable mark classifier. + # ############################################################################# +-ECM_CLASSIFIER_MARK_ENABLE=y ++ifndef $(ECM_CLASSIFIER_MARK_ENABLE) ++ ECM_CLASSIFIER_MARK_ENABLE=y ++endif + ecm-$(ECM_CLASSIFIER_MARK_ENABLE) += ecm_classifier_mark.o + ccflags-$(ECM_CLASSIFIER_MARK_ENABLE) += -DECM_CLASSIFIER_MARK_ENABLE + +@@ -247,7 +265,9 @@ ccflags-$(ECM_CLASSIFIER_NL_ENABLE) += - + # ############################################################################# + # Define ECM_CLASSIFIER_DSCP_ENABLE=y in order to enable DSCP classifier. + # ############################################################################# +-ECM_CLASSIFIER_DSCP_ENABLE=y ++ifndef $(ECM_CLASSIFIER_DSCP_ENABLE) ++ ECM_CLASSIFIER_DSCP_ENABLE=y ++endif + ecm-$(ECM_CLASSIFIER_DSCP_ENABLE) += ecm_classifier_dscp.o + ccflags-$(ECM_CLASSIFIER_DSCP_ENABLE) += -DECM_CLASSIFIER_DSCP_ENABLE + ccflags-$(ECM_CLASSIFIER_DSCP_IGS) += -DECM_CLASSIFIER_DSCP_IGS +@@ -274,7 +294,9 @@ endif + # the Parental Controls subsystem classifier in ECM. Currently disabled until + # customers require it / if they need to integrate their Parental Controls with it. + # ############################################################################# +-ECM_CLASSIFIER_PCC_ENABLE=y ++ifndef $(ECM_CLASSIFIER_PCC_ENABLE) ++ ECM_CLASSIFIER_PCC_ENABLE=y ++endif + ecm-$(ECM_CLASSIFIER_PCC_ENABLE) += ecm_classifier_pcc.o + ccflags-$(ECM_CLASSIFIER_PCC_ENABLE) += -DECM_CLASSIFIER_PCC_ENABLE + +@@ -301,28 +323,36 @@ ccflags-$(ECM_NON_PORTED_SUPPORT_ENABLE) + # ############################################################################# + # Define ECM_STATE_OUTPUT_ENABLE=y to support XML state output + # ############################################################################# +-ECM_STATE_OUTPUT_ENABLE=y ++ifndef $(ECM_STATE_OUTPUT_ENABLE) ++ ECM_STATE_OUTPUT_ENABLE=y ++endif + ecm-$(ECM_STATE_OUTPUT_ENABLE) += ecm_state.o + ccflags-$(ECM_STATE_OUTPUT_ENABLE) += -DECM_STATE_OUTPUT_ENABLE + + # ############################################################################# + # Define ECM_DB_ADVANCED_STATS_ENABLE to support XML state output + # ############################################################################# +-ECM_DB_ADVANCED_STATS_ENABLE=y ++ifndef $(ECM_DB_ADVANCED_STATS_ENABLE) ++ ECM_DB_ADVANCED_STATS_ENABLE=y ++endif + ccflags-$(ECM_DB_ADVANCED_STATS_ENABLE) += -DECM_DB_ADVANCED_STATS_ENABLE + + # ############################################################################# + # Define ECM_DB_CONNECTION_CROSS_REFERENCING_ENABLE=y in order to enable + # the database to track relationships between objects. + # ############################################################################# +-ECM_DB_CONNECTION_CROSS_REFERENCING_ENABLE=y ++ifndef $(ECM_DB_CONNECTION_CROSS_REFERENCING_ENABLE) ++ ECM_DB_CONNECTION_CROSS_REFERENCING_ENABLE=y ++endif + ccflags-$(ECM_DB_CONNECTION_CROSS_REFERENCING_ENABLE) += -DECM_DB_XREF_ENABLE + + # ############################################################################# + # Define ECM_TRACKER_DPI_SUPPORT_ENABLE=y in order to enable support for + # deep packet inspection and tracking of data with the trackers. + # ############################################################################# +-ECM_TRACKER_DPI_SUPPORT_ENABLE=y ++ifndef $(ECM_TRACKER_DPI_SUPPORT_ENABLE) ++ ECM_TRACKER_DPI_SUPPORT_ENABLE=y ++endif + ccflags-$(ECM_TRACKER_DPI_SUPPORT_ENABLE) += -DECM_TRACKER_DPI_SUPPORT_ENABLE + + # ############################################################################# +@@ -330,14 +360,18 @@ ccflags-$(ECM_TRACKER_DPI_SUPPORT_ENABLE + # support for the database keeping lists of connections that are assigned + # on a per TYPE of classifier basis. + # ############################################################################# +-ECM_DB_CLASSIFIER_TYPE_ASSIGNMENTS_TRACK_ENABLE=y ++ifndef $(ECM_DB_CLASSIFIER_TYPE_ASSIGNMENTS_TRACK_ENABLE) ++ ECM_DB_CLASSIFIER_TYPE_ASSIGNMENTS_TRACK_ENABLE=y ++endif + ccflags-$(ECM_DB_CLASSIFIER_TYPE_ASSIGNMENTS_TRACK_ENABLE) += -DECM_DB_CTA_TRACK_ENABLE + + # ############################################################################# + # Define ECM_BAND_STEERING_ENABLE=y in order to enable + # band steering feature. + # ############################################################################# +-ECM_BAND_STEERING_ENABLE=y ++ifndef $(ECM_BAND_STEERING_ENABLE) ++ ECM_BAND_STEERING_ENABLE=y ++endif + ccflags-$(ECM_BAND_STEERING_ENABLE) += -DECM_BAND_STEERING_ENABLE + + # ############################################################################# +--- a/ecm_db/ecm_db_connection.c ++++ b/ecm_db/ecm_db_connection.c +@@ -430,7 +430,9 @@ EXPORT_SYMBOL(ecm_db_connection_make_def + */ + void ecm_db_connection_data_totals_update(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets) + { ++#ifdef ECM_DB_ADVANCED_STATS_ENABLE + int32_t i; ++#endif + + DEBUG_CHECK_MAGIC(ci, ECM_DB_CONNECTION_INSTANCE_MAGIC, "%px: magic failed\n", ci); + +@@ -529,7 +531,9 @@ EXPORT_SYMBOL(ecm_db_connection_data_tot + */ + void ecm_db_connection_data_totals_update_dropped(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets) + { ++#ifdef ECM_DB_ADVANCED_STATS_ENABLE + int32_t i; ++#endif + + DEBUG_CHECK_MAGIC(ci, ECM_DB_CONNECTION_INSTANCE_MAGIC, "%px: magic failed\n", ci); + +@@ -1508,6 +1512,7 @@ void ecm_db_connection_defunct_all(void) + } + EXPORT_SYMBOL(ecm_db_connection_defunct_all); + ++#ifdef ECM_INTERFACE_OVS_BRIDGE_ENABLE + /* + * ecm_db_connection_defunct_by_classifier() + * Make defunct based on masked fields +@@ -1667,6 +1672,7 @@ next_ci: + ECM_IP_ADDR_TO_OCTAL(dest_addr_mask), dest_port_mask, proto_mask, cnt); + } + } ++#endif + + /* + * ecm_db_connection_defunct_by_port() +@@ -1956,6 +1962,7 @@ struct ecm_db_node_instance *ecm_db_conn + } + EXPORT_SYMBOL(ecm_db_connection_node_get_and_ref); + ++#ifdef ECM_DB_XREF_ENABLE + /* + * ecm_db_connection_mapping_get_and_ref_next() + * Return reference to next connection in the mapping chain in the specified direction. +@@ -1997,6 +2004,7 @@ struct ecm_db_connection_instance *ecm_d + return nci; + } + EXPORT_SYMBOL(ecm_db_connection_iface_get_and_ref_next); ++#endif + + /* + * ecm_db_connection_mapping_get_and_ref() +--- a/ecm_db/ecm_db_node.c ++++ b/ecm_db/ecm_db_node.c +@@ -224,9 +224,11 @@ EXPORT_SYMBOL(ecm_db_node_get_and_ref_ne + */ + int ecm_db_node_deref(struct ecm_db_node_instance *ni) + { ++#ifdef ECM_DB_XREF_ENABLE + #if (DEBUG_LEVEL >= 1) + int dir; + #endif ++#endif + DEBUG_CHECK_MAGIC(ni, ECM_DB_NODE_INSTANCE_MAGIC, "%px: magic failed\n", ni); + + spin_lock_bh(&ecm_db_lock); +@@ -486,9 +488,11 @@ EXPORT_SYMBOL(ecm_db_node_iface_get_and_ + void ecm_db_node_add(struct ecm_db_node_instance *ni, struct ecm_db_iface_instance *ii, uint8_t *address, + ecm_db_node_final_callback_t final, void *arg) + { ++#ifdef ECM_DB_XREF_ENABLE + #if (DEBUG_LEVEL >= 1) + int dir; + #endif ++#endif + ecm_db_node_hash_t hash_index; + struct ecm_db_listener_instance *li; + +--- a/ecm_interface.c ++++ b/ecm_interface.c +@@ -1343,6 +1343,7 @@ struct neighbour *ecm_interface_ipv6_nei + */ + bool ecm_interface_is_pptp(struct sk_buff *skb, const struct net_device *out) + { ++#ifdef ECM_INTERFACE_PPTP_ENABLE + struct net_device *in; + + /* +@@ -1367,6 +1368,7 @@ bool ecm_interface_is_pptp(struct sk_buf + } + + dev_put(in); ++#endif + return false; + } + +@@ -1379,6 +1381,7 @@ bool ecm_interface_is_pptp(struct sk_buf + */ + bool ecm_interface_is_l2tp_packet_by_version(struct sk_buff *skb, const struct net_device *out, int ver) + { ++#ifdef ECM_INTERFACE_L2TPV2_PPTP_ENABLE + uint32_t flag = 0; + struct net_device *in; + +@@ -1411,6 +1414,7 @@ bool ecm_interface_is_l2tp_packet_by_ver + } + + dev_put(in); ++#endif + return false; + } + +@@ -1423,6 +1427,7 @@ bool ecm_interface_is_l2tp_packet_by_ver + */ + bool ecm_interface_is_l2tp_pptp(struct sk_buff *skb, const struct net_device *out) + { ++#ifdef ECM_INTERFACE_L2TPV2_PPTP_ENABLE + struct net_device *in; + + /* +@@ -1445,6 +1450,7 @@ bool ecm_interface_is_l2tp_pptp(struct s + } + + dev_put(in); ++#endif + return false; + } + +@@ -6630,6 +6636,7 @@ static void ecm_interface_regenerate_con + return; + } + ++#ifdef ECM_DB_XREF_ENABLE + for (dir = 0; dir < ECM_DB_OBJ_DIR_MAX; dir++) { + /* + * Re-generate all connections associated with this interface +@@ -6645,6 +6652,7 @@ static void ecm_interface_regenerate_con + ci[dir] = cin; + } + } ++#endif + + #ifdef ECM_MULTICAST_ENABLE + /* +--- a/frontends/ecm_front_end_common.c ++++ b/frontends/ecm_front_end_common.c +@@ -106,6 +106,7 @@ bool ecm_front_end_gre_proto_is_accel_al + struct nf_conntrack_tuple *tuple, + int ip_version) + { ++#ifdef ECM_INTERFACE_GRE_ENABLE + struct net_device *dev; + struct gre_base_hdr *greh; + +@@ -117,10 +118,12 @@ bool ecm_front_end_gre_proto_is_accel_al + /* + * Case 1: PPTP locally terminated + */ ++#ifdef ECM_INTERFACE_PPTP_ENABLE + if (ecm_interface_is_pptp(skb, outdev)) { + DEBUG_TRACE("%px: PPTP GRE locally terminated - allow acceleration\n", skb); + return true; + } ++#endif + + /* + * Case 2: PPTP pass through +@@ -223,6 +226,10 @@ bool ecm_front_end_gre_proto_is_accel_al + */ + DEBUG_TRACE("%px: GRE IPv%d pass through - allow acceleration\n", skb, ip_version); + return true; ++#else ++ DEBUG_TRACE("%px: GRE%d feature is disabled - do not allow acceleration\n", skb, ip_version); ++ return false; ++#endif + } + + #ifdef ECM_CLASSIFIER_DSCP_ENABLE diff --git a/package/qca/nss/qca-nss-ecm-64/patches/100-kernel-5.10-support.patch b/package/qca/nss/qca-nss-ecm-64/patches/100-kernel-5.10-support.patch new file mode 100644 index 00000000000000..107b9571bdaaae --- /dev/null +++ b/package/qca/nss/qca-nss-ecm-64/patches/100-kernel-5.10-support.patch @@ -0,0 +1,831 @@ +From e8b642c23af9146c973e828a7f4e0fb56cfc8d0b Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Sat, 15 May 2021 03:51:14 +0200 +Subject: [PATCH] add support for kernel 5.10 + +Signed-off-by: Ansuel Smith +--- + ecm_classifier_default.c | 24 +++--------- + ecm_classifier_dscp.c | 8 +--- + ecm_classifier_emesh.c | 16 ++------ + ecm_classifier_hyfi.c | 7 +--- + ecm_classifier_mark.c | 8 +--- + ecm_classifier_ovs.c | 8 +--- + ecm_classifier_pcc.c | 8 +--- + ecm_conntrack_notifier.c | 8 +--- + ecm_db/ecm_db_connection.c | 7 +--- + ecm_db/ecm_db_host.c | 7 +--- + ecm_db/ecm_db_iface.c | 7 +--- + ecm_db/ecm_db_mapping.c | 7 +--- + ecm_db/ecm_db_node.c | 7 +--- + ecm_interface.c | 4 +- + ecm_state.c | 14 ++----- + frontends/ecm_front_end_common.c | 4 +- + frontends/ecm_front_end_ipv4.c | 7 +--- + frontends/ecm_front_end_ipv6.c | 7 +--- + frontends/nss/ecm_nss_bond_notifier.c | 8 +--- + frontends/nss/ecm_nss_ipv4.c | 49 +++++++------------------ + frontends/nss/ecm_nss_ipv6.c | 49 +++++++------------------ + frontends/nss/ecm_nss_multicast_ipv4.c | 7 +--- + frontends/nss/ecm_nss_multicast_ipv6.c | 7 +--- + frontends/nss/ecm_nss_non_ported_ipv4.c | 7 +--- + frontends/nss/ecm_nss_non_ported_ipv6.c | 7 +--- + frontends/nss/ecm_nss_ported_ipv4.c | 8 +--- + frontends/nss/ecm_nss_ported_ipv6.c | 8 +--- + frontends/sfe/ecm_sfe_ipv4.c | 49 +++++++------------------ + frontends/sfe/ecm_sfe_ipv6.c | 49 +++++++------------------ + frontends/sfe/ecm_sfe_non_ported_ipv4.c | 7 +--- + frontends/sfe/ecm_sfe_non_ported_ipv6.c | 7 +--- + frontends/sfe/ecm_sfe_ported_ipv4.c | 8 +--- + frontends/sfe/ecm_sfe_ported_ipv6.c | 8 +--- + 33 files changed, 122 insertions(+), 314 deletions(-) + +--- a/ecm_classifier_default.c ++++ b/ecm_classifier_default.c +@@ -776,26 +776,14 @@ int ecm_classifier_default_init(struct d + return -1; + } + +- if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry, +- (u32 *)&ecm_classifier_default_enabled)) { +- DEBUG_ERROR("Failed to create ecm deafult classifier enabled file in debugfs\n"); +- debugfs_remove_recursive(ecm_classifier_default_dentry); +- return -1; +- } ++ debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry, ++ (u32 *)&ecm_classifier_default_enabled); + +- if (!debugfs_create_u32("accel_mode", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry, +- (u32 *)&ecm_classifier_default_accel_mode)) { +- DEBUG_ERROR("Failed to create ecm deafult classifier accel_mode file in debugfs\n"); +- debugfs_remove_recursive(ecm_classifier_default_dentry); +- return -1; +- } ++ debugfs_create_u32("accel_mode", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry, ++ (u32 *)&ecm_classifier_default_accel_mode); + +- if (!debugfs_create_u32("accel_delay_pkts", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry, +- (u32 *)&ecm_classifier_accel_delay_pkts)) { +- DEBUG_ERROR("Failed to create accel delay packet counts in debugfs\n"); +- debugfs_remove_recursive(ecm_classifier_default_dentry); +- return -1; +- } ++ debugfs_create_u32("accel_delay_pkts", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry, ++ (u32 *)&ecm_classifier_accel_delay_pkts); + + return 0; + } +--- a/ecm_classifier_dscp.c ++++ b/ecm_classifier_dscp.c +@@ -747,12 +747,8 @@ int ecm_classifier_dscp_init(struct dent + return -1; + } + +- if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_dscp_dentry, +- (u32 *)&ecm_classifier_dscp_enabled)) { +- DEBUG_ERROR("Failed to create dscp enabled file in debugfs\n"); +- debugfs_remove_recursive(ecm_classifier_dscp_dentry); +- return -1; +- } ++ debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_dscp_dentry, ++ (u32 *)&ecm_classifier_dscp_enabled); + + return 0; + } +--- a/ecm_classifier_emesh.c ++++ b/ecm_classifier_emesh.c +@@ -977,19 +977,11 @@ int ecm_classifier_emesh_init(struct den + return -1; + } + +- if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_emesh_dentry, +- (u32 *)&ecm_classifier_emesh_enabled)) { +- DEBUG_ERROR("Failed to create ecm emesh classifier enabled file in debugfs\n"); +- debugfs_remove_recursive(ecm_classifier_emesh_dentry); +- return -1; +- } ++ debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_emesh_dentry, ++ (u32 *)&ecm_classifier_emesh_enabled); + +- if (!debugfs_create_u32("latency_config_enabled", S_IRUGO | S_IWUSR, ecm_classifier_emesh_dentry, +- (u32 *)&ecm_classifier_emesh_latency_config_enabled)) { +- DEBUG_ERROR("Failed to create ecm emesh classifier latency config enabled file in debugfs\n"); +- debugfs_remove_recursive(ecm_classifier_emesh_dentry); +- return -1; +- } ++ debugfs_create_u32("latency_config_enabled", S_IRUGO | S_IWUSR, ecm_classifier_emesh_dentry, ++ (u32 *)&ecm_classifier_emesh_latency_config_enabled); + + /* + * Register for service prioritization notification update. +--- a/ecm_classifier_hyfi.c ++++ b/ecm_classifier_hyfi.c +@@ -1099,11 +1099,8 @@ int ecm_classifier_hyfi_rules_init(struc + goto classifier_task_cleanup; + } + +- if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_hyfi_dentry, +- (u32 *)&ecm_classifier_hyfi_enabled)) { +- DEBUG_ERROR("Failed to create ecm hyfi classifier enabled file in debugfs\n"); +- goto classifier_task_cleanup; +- } ++ debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_hyfi_dentry, ++ (u32 *)&ecm_classifier_hyfi_enabled); + + if (!debugfs_create_file("cmd", S_IWUSR, ecm_classifier_hyfi_dentry, + NULL, &ecm_classifier_hyfi_cmd_fops)) { +--- a/ecm_classifier_mark.c ++++ b/ecm_classifier_mark.c +@@ -753,12 +753,8 @@ int ecm_classifier_mark_init(struct dent + return -1; + } + +- if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_mark_dentry, +- (u32 *)&ecm_classifier_mark_enabled)) { +- DEBUG_ERROR("Failed to create mark enabled file in debugfs\n"); +- debugfs_remove_recursive(ecm_classifier_mark_dentry); +- return -1; +- } ++ debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_mark_dentry, ++ (u32 *)&ecm_classifier_mark_enabled); + + return 0; + } +--- a/ecm_classifier_ovs.c ++++ b/ecm_classifier_ovs.c +@@ -2200,12 +2200,8 @@ int ecm_classifier_ovs_init(struct dentr + return -1; + } + +- if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_ovs_dentry, +- (u32 *)&ecm_classifier_ovs_enabled)) { +- DEBUG_ERROR("Failed to create ovs enabled file in debugfs\n"); +- debugfs_remove_recursive(ecm_classifier_ovs_dentry); +- return -1; +- } ++ debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_ovs_dentry, ++ (u32 *)&ecm_classifier_ovs_enabled); + + return 0; + } +--- a/ecm_classifier_pcc.c ++++ b/ecm_classifier_pcc.c +@@ -1308,12 +1308,8 @@ int ecm_classifier_pcc_init(struct dentr + return -1; + } + +- if (!debugfs_create_u32("enabled", S_IRUGO, ecm_classifier_pcc_dentry, +- (u32 *)&ecm_classifier_pcc_enabled)) { +- DEBUG_ERROR("Failed to create pcc enabled file in debugfs\n"); +- debugfs_remove_recursive(ecm_classifier_pcc_dentry); +- return -1; +- } ++ debugfs_create_u32("enabled", S_IRUGO, ecm_classifier_pcc_dentry, ++ (u32 *)&ecm_classifier_pcc_enabled); + + return 0; + } +--- a/ecm_conntrack_notifier.c ++++ b/ecm_conntrack_notifier.c +@@ -414,12 +414,8 @@ int ecm_conntrack_notifier_init(struct d + return -1; + } + +- if (!debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_conntrack_notifier_dentry, +- (u32 *)&ecm_conntrack_notifier_stopped)) { +- DEBUG_ERROR("Failed to create ecm conntrack notifier stopped file in debugfs\n"); +- debugfs_remove_recursive(ecm_conntrack_notifier_dentry); +- return -1; +- } ++ debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_conntrack_notifier_dentry, ++ (u32 *)&ecm_conntrack_notifier_stopped); + + #ifdef CONFIG_NF_CONNTRACK_EVENTS + /* +--- a/ecm_db/ecm_db_connection.c ++++ b/ecm_db/ecm_db_connection.c +@@ -3642,11 +3642,8 @@ static struct file_operations ecm_db_con + */ + bool ecm_db_connection_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("connection_count", S_IRUGO, dentry, +- (u32 *)&ecm_db_connection_count)) { +- DEBUG_ERROR("Failed to create ecm db connection count file in debugfs\n"); +- return false; +- } ++ debugfs_create_u32("connection_count", S_IRUGO, dentry, ++ (u32 *)&ecm_db_connection_count); + + if (!debugfs_create_file("connection_count_simple", S_IRUGO, dentry, + NULL, &ecm_db_connection_count_simple_fops)) { +--- a/ecm_db/ecm_db_host.c ++++ b/ecm_db/ecm_db_host.c +@@ -770,11 +770,8 @@ EXPORT_SYMBOL(ecm_db_host_alloc); + bool ecm_db_host_init(struct dentry *dentry) + { + +- if (!debugfs_create_u32("host_count", S_IRUGO, dentry, +- (u32 *)&ecm_db_host_count)) { +- DEBUG_ERROR("Failed to create ecm db host count file in debugfs\n"); +- return false;; +- } ++ debugfs_create_u32("host_count", S_IRUGO, dentry, ++ (u32 *)&ecm_db_host_count); + + ecm_db_host_table = vzalloc(sizeof(struct ecm_db_host_instance *) * ECM_DB_HOST_HASH_SLOTS); + if (!ecm_db_host_table) { +--- a/ecm_db/ecm_db_iface.c ++++ b/ecm_db/ecm_db_iface.c +@@ -3670,11 +3670,8 @@ EXPORT_SYMBOL(ecm_db_iface_alloc); + */ + bool ecm_db_iface_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("iface_count", S_IRUGO, dentry, +- (u32 *)&ecm_db_iface_count)) { +- DEBUG_ERROR("Failed to create ecm db iface count file in debugfs\n"); +- return false; +- } ++ debugfs_create_u32("iface_count", S_IRUGO, dentry, ++ (u32 *)&ecm_db_iface_count); + + return true; + } +--- a/ecm_db/ecm_db_mapping.c ++++ b/ecm_db/ecm_db_mapping.c +@@ -806,11 +806,8 @@ EXPORT_SYMBOL(ecm_db_mapping_alloc); + */ + bool ecm_db_mapping_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("mapping_count", S_IRUGO, dentry, +- (u32 *)&ecm_db_mapping_count)) { +- DEBUG_ERROR("Failed to create ecm db mapping count file in debugfs\n"); +- return false; +- } ++ debugfs_create_u32("mapping_count", S_IRUGO, dentry, ++ (u32 *)&ecm_db_mapping_count); + + ecm_db_mapping_table = vzalloc(sizeof(struct ecm_db_mapping_instance *) * ECM_DB_MAPPING_HASH_SLOTS); + if (!ecm_db_mapping_table) { +--- a/ecm_db/ecm_db_node.c ++++ b/ecm_db/ecm_db_node.c +@@ -1187,11 +1187,8 @@ keep_sni_conn: + */ + bool ecm_db_node_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("node_count", S_IRUGO, dentry, +- (u32 *)&ecm_db_node_count)) { +- DEBUG_ERROR("Failed to create ecm db node count file in debugfs\n"); +- return false; +- } ++ debugfs_create_u32("node_count", S_IRUGO, dentry, ++ (u32 *)&ecm_db_node_count); + + ecm_db_node_table = vzalloc(sizeof(struct ecm_db_node_instance *) * ECM_DB_NODE_HASH_SLOTS); + if (!ecm_db_node_table) { +--- a/ecm_interface.c ++++ b/ecm_interface.c +@@ -332,7 +332,7 @@ static struct net_device *ecm_interface_ + struct net_device *dev; + + ECM_IP_ADDR_TO_NIN6_ADDR(addr6, addr); +- dev = (struct net_device *)ipv6_dev_find(&init_net, &addr6, 1); ++ dev = (struct net_device *)ipv6_dev_find_and_hold(&init_net, &addr6, 1); + return dev; + } + #endif +@@ -734,7 +734,7 @@ static bool ecm_interface_mac_addr_get_i + * Get the MAC address that corresponds to IP address given. + */ + ECM_IP_ADDR_TO_NIN6_ADDR(daddr, addr); +- local_dev = ipv6_dev_find(&init_net, &daddr, 1); ++ local_dev = ipv6_dev_find_and_hold(&init_net, &daddr, 1); + if (local_dev) { + DEBUG_TRACE("%pi6 is a local address\n", &daddr); + memcpy(mac_addr, dev->dev_addr, ETH_ALEN); +--- a/ecm_state.c ++++ b/ecm_state.c +@@ -899,17 +899,11 @@ int ecm_state_init(struct dentry *dentry + return -1; + } + +- if (!debugfs_create_u32("state_dev_major", S_IRUGO, ecm_state_dentry, +- (u32 *)&ecm_state_dev_major_id)) { +- DEBUG_ERROR("Failed to create ecm state dev major file in debugfs\n"); +- goto init_cleanup; +- } ++ debugfs_create_u32("state_dev_major", S_IRUGO, ecm_state_dentry, ++ (u32 *)&ecm_state_dev_major_id); + +- if (!debugfs_create_u32("state_file_output_mask", S_IRUGO | S_IWUSR, ecm_state_dentry, +- (u32 *)&ecm_state_file_output_mask)) { +- DEBUG_ERROR("Failed to create ecm state output mask file in debugfs\n"); +- goto init_cleanup; +- } ++ debugfs_create_u32("state_file_output_mask", S_IRUGO | S_IWUSR, ecm_state_dentry, ++ (u32 *)&ecm_state_file_output_mask); + + /* + * Register a char device that we will use to provide a dump of our state +--- a/frontends/ecm_front_end_common.c ++++ b/frontends/ecm_front_end_common.c +@@ -192,7 +192,7 @@ bool ecm_front_end_gre_proto_is_accel_al + return false; + } + } else { +- dev = ipv6_dev_find(&init_net, &(tuple->src.u3.in6), 1); ++ dev = ipv6_dev_find_and_hold(&init_net, &(tuple->src.u3.in6), 1); + if (dev) { + /* + * Source IP address is local +@@ -202,7 +202,7 @@ bool ecm_front_end_gre_proto_is_accel_al + return false; + } + +- dev = ipv6_dev_find(&init_net, &(tuple->dst.u3.in6), 1); ++ dev = ipv6_dev_find_and_hold(&init_net, &(tuple->dst.u3.in6), 1); + if (dev) { + /* + * Destination IP address is local +--- a/frontends/ecm_front_end_ipv4.c ++++ b/frontends/ecm_front_end_ipv4.c +@@ -376,11 +376,8 @@ void ecm_front_end_ipv4_stop(int num) + */ + int ecm_front_end_ipv4_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("front_end_ipv4_stop", S_IRUGO | S_IWUSR, dentry, +- (u32 *)&ecm_front_end_ipv4_stopped)) { +- DEBUG_ERROR("Failed to create ecm front end ipv4 stop file in debugfs\n"); +- return -1; +- } ++ debugfs_create_u32("front_end_ipv4_stop", S_IRUGO | S_IWUSR, dentry, ++ (u32 *)&ecm_front_end_ipv4_stopped); + + switch (ecm_front_end_type_get()) { + case ECM_FRONT_END_TYPE_NSS: +--- a/frontends/ecm_front_end_ipv6.c ++++ b/frontends/ecm_front_end_ipv6.c +@@ -255,11 +255,8 @@ void ecm_front_end_ipv6_stop(int num) + */ + int ecm_front_end_ipv6_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("front_end_ipv6_stop", S_IRUGO | S_IWUSR, dentry, +- (u32 *)&ecm_front_end_ipv6_stopped)) { +- DEBUG_ERROR("Failed to create ecm front end ipv6 stop file in debugfs\n"); +- return -1; +- } ++ debugfs_create_u32("front_end_ipv6_stop", S_IRUGO | S_IWUSR, dentry, ++ (u32 *)&ecm_front_end_ipv6_stopped); + + switch (ecm_front_end_type_get()) { + case ECM_FRONT_END_TYPE_NSS: +--- a/frontends/nss/ecm_nss_bond_notifier.c ++++ b/frontends/nss/ecm_nss_bond_notifier.c +@@ -240,12 +240,8 @@ int ecm_nss_bond_notifier_init(struct de + return -1; + } + +- if (!debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_nss_bond_notifier_dentry, +- (u32 *)&ecm_nss_bond_notifier_stopped)) { +- DEBUG_ERROR("Failed to create ecm bond notifier stopped file in debugfs\n"); +- debugfs_remove_recursive(ecm_nss_bond_notifier_dentry); +- return -1; +- } ++ debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_nss_bond_notifier_dentry, ++ (u32 *)&ecm_nss_bond_notifier_stopped); + + /* + * Register Link Aggregation callbacks with the bonding driver +--- a/frontends/nss/ecm_nss_ipv4.c ++++ b/frontends/nss/ecm_nss_ipv4.c +@@ -2802,41 +2802,23 @@ int ecm_nss_ipv4_init(struct dentry *den + return result; + } + +- if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, +- (u32 *)&ecm_nss_ipv4_no_action_limit_default)) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 no_action_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, ++ (u32 *)&ecm_nss_ipv4_no_action_limit_default); + +- if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, +- (u32 *)&ecm_nss_ipv4_driver_fail_limit_default)) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 driver_fail_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, ++ (u32 *)&ecm_nss_ipv4_driver_fail_limit_default); + +- if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, +- (u32 *)&ecm_nss_ipv4_nack_limit_default)) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 nack_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, ++ (u32 *)&ecm_nss_ipv4_nack_limit_default); + +- if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv4_dentry, +- (u32 *)&ecm_nss_ipv4_accelerated_count)) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 accelerated_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv4_dentry, ++ (u32 *)&ecm_nss_ipv4_accelerated_count); + +- if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv4_dentry, +- (u32 *)&ecm_nss_ipv4_pending_accel_count)) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 pending_accel_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv4_dentry, ++ (u32 *)&ecm_nss_ipv4_pending_accel_count); + +- if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv4_dentry, +- (u32 *)&ecm_nss_ipv4_pending_decel_count)) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 pending_decel_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv4_dentry, ++ (u32 *)&ecm_nss_ipv4_pending_decel_count); + + if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, + NULL, &ecm_nss_ipv4_accel_limit_mode_fops)) { +@@ -2867,11 +2849,8 @@ int ecm_nss_ipv4_init(struct dentry *den + goto task_cleanup; + } + +- if (!debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, +- (u32 *)&ecm_nss_ipv4_vlan_passthrough_enable)) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 vlan passthrough file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, ++ (u32 *)&ecm_nss_ipv4_vlan_passthrough_enable); + + #ifdef ECM_NON_PORTED_SUPPORT_ENABLE + if (!ecm_nss_non_ported_ipv4_debugfs_init(ecm_nss_ipv4_dentry)) { +--- a/frontends/nss/ecm_nss_ipv6.c ++++ b/frontends/nss/ecm_nss_ipv6.c +@@ -2542,41 +2542,23 @@ int ecm_nss_ipv6_init(struct dentry *den + return result; + } + +- if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, +- (u32 *)&ecm_nss_ipv6_no_action_limit_default)) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 no_action_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, ++ (u32 *)&ecm_nss_ipv6_no_action_limit_default); + +- if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, +- (u32 *)&ecm_nss_ipv6_driver_fail_limit_default)) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 driver_fail_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, ++ (u32 *)&ecm_nss_ipv6_driver_fail_limit_default); + +- if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, +- (u32 *)&ecm_nss_ipv6_nack_limit_default)) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 nack_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, ++ (u32 *)&ecm_nss_ipv6_nack_limit_default); + +- if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv6_dentry, +- (u32 *)&ecm_nss_ipv6_accelerated_count)) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 accelerated_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv6_dentry, ++ (u32 *)&ecm_nss_ipv6_accelerated_count); + +- if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv6_dentry, +- (u32 *)&ecm_nss_ipv6_pending_accel_count)) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 pending_accel_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv6_dentry, ++ (u32 *)&ecm_nss_ipv6_pending_accel_count); + +- if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv6_dentry, +- (u32 *)&ecm_nss_ipv6_pending_decel_count)) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 pending_decel_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv6_dentry, ++ (u32 *)&ecm_nss_ipv6_pending_decel_count); + + if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, + NULL, &ecm_nss_ipv6_accel_limit_mode_fops)) { +@@ -2607,11 +2589,8 @@ int ecm_nss_ipv6_init(struct dentry *den + goto task_cleanup; + } + +- if (!debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, +- (u32 *)&ecm_nss_ipv6_vlan_passthrough_enable)) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 vlan passthrough file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, ++ (u32 *)&ecm_nss_ipv6_vlan_passthrough_enable); + + #ifdef ECM_NON_PORTED_SUPPORT_ENABLE + if (!ecm_nss_non_ported_ipv6_debugfs_init(ecm_nss_ipv6_dentry)) { +--- a/frontends/nss/ecm_nss_multicast_ipv4.c ++++ b/frontends/nss/ecm_nss_multicast_ipv4.c +@@ -4139,11 +4139,8 @@ void ecm_nss_multicast_ipv4_stop(int num + */ + int ecm_nss_multicast_ipv4_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("ecm_nss_multicast_ipv4_stop", S_IRUGO | S_IWUSR, dentry, +- (u32 *)&ecm_front_end_ipv4_mc_stopped)) { +- DEBUG_ERROR("Failed to create ecm front end ipv4 mc stop file in debugfs\n"); +- return -1; +- } ++ debugfs_create_u32("ecm_nss_multicast_ipv4_stop", S_IRUGO | S_IWUSR, dentry, ++ (u32 *)&ecm_front_end_ipv4_mc_stopped); + + /* + * Register multicast update callback to MCS snooper +--- a/frontends/nss/ecm_nss_multicast_ipv6.c ++++ b/frontends/nss/ecm_nss_multicast_ipv6.c +@@ -3939,11 +3939,8 @@ void ecm_nss_multicast_ipv6_stop(int num + */ + int ecm_nss_multicast_ipv6_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("ecm_nss_multicast_ipv6_stop", S_IRUGO | S_IWUSR, dentry, +- (u32 *)&ecm_front_end_ipv6_mc_stopped)) { +- DEBUG_ERROR("Failed to create ecm front end ipv6 mc stop file in debugfs\n"); +- return -1; +- } ++ debugfs_create_u32("ecm_nss_multicast_ipv6_stop", S_IRUGO | S_IWUSR, dentry, ++ (u32 *)&ecm_front_end_ipv6_mc_stopped); + + /* + * Register multicast update callback to MCS snooper +--- a/frontends/nss/ecm_nss_non_ported_ipv4.c ++++ b/frontends/nss/ecm_nss_non_ported_ipv4.c +@@ -2615,11 +2615,8 @@ done: + */ + bool ecm_nss_non_ported_ipv4_debugfs_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, +- (u32 *)&ecm_nss_non_ported_ipv4_accelerated_count)) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 non_ported_accelerated_count file in debugfs\n"); +- return false; +- } ++ debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, ++ (u32 *)&ecm_nss_non_ported_ipv4_accelerated_count); + + return true; + } +--- a/frontends/nss/ecm_nss_non_ported_ipv6.c ++++ b/frontends/nss/ecm_nss_non_ported_ipv6.c +@@ -2329,11 +2329,8 @@ done: + */ + bool ecm_nss_non_ported_ipv6_debugfs_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, +- (u32 *)&ecm_nss_non_ported_ipv6_accelerated_count)) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 non_ported_accelerated_count file in debugfs\n"); +- return false; +- } ++ debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, ++ (u32 *)&ecm_nss_non_ported_ipv6_accelerated_count); + + return true; + } +--- a/frontends/nss/ecm_nss_ported_ipv4.c ++++ b/frontends/nss/ecm_nss_ported_ipv4.c +@@ -2944,12 +2944,8 @@ bool ecm_nss_ported_ipv4_debugfs_init(st + return false; + } + +- if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, +- &ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_TCP])) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 tcp_accelerated_count file in debugfs\n"); +- debugfs_remove(udp_dentry); +- return false; +- } ++ debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, ++ &ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_TCP]); + + return true; + } +--- a/frontends/nss/ecm_nss_ported_ipv6.c ++++ b/frontends/nss/ecm_nss_ported_ipv6.c +@@ -2732,12 +2732,8 @@ bool ecm_nss_ported_ipv6_debugfs_init(st + return false; + } + +- if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, +- &ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_TCP])) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 tcp_accelerated_count file in debugfs\n"); +- debugfs_remove(udp_dentry); +- return false; +- } ++ debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, ++ &ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_TCP]); + + return true; + } +--- a/frontends/sfe/ecm_sfe_ipv4.c ++++ b/frontends/sfe/ecm_sfe_ipv4.c +@@ -1808,48 +1808,27 @@ int ecm_sfe_ipv4_init(struct dentry *den + } + + #ifdef CONFIG_XFRM +- if (!debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, +- (u32 *)&ecm_sfe_ipv4_reject_acceleration_for_ipsec)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv4 reject_acceleration_for_ipsec file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, ++ (u32 *)&ecm_sfe_ipv4_reject_acceleration_for_ipsec); + #endif + +- if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, +- (u32 *)&ecm_sfe_ipv4_no_action_limit_default)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv4 no_action_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, ++ (u32 *)&ecm_sfe_ipv4_no_action_limit_default); + +- if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, +- (u32 *)&ecm_sfe_ipv4_driver_fail_limit_default)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv4 driver_fail_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, ++ (u32 *)&ecm_sfe_ipv4_driver_fail_limit_default); + +- if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, +- (u32 *)&ecm_sfe_ipv4_nack_limit_default)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv4 nack_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, ++ (u32 *)&ecm_sfe_ipv4_nack_limit_default); + +- if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv4_dentry, +- (u32 *)&ecm_sfe_ipv4_accelerated_count)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv4 accelerated_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv4_dentry, ++ (u32 *)&ecm_sfe_ipv4_accelerated_count); + +- if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv4_dentry, +- (u32 *)&ecm_sfe_ipv4_pending_accel_count)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv4 pending_accel_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv4_dentry, ++ (u32 *)&ecm_sfe_ipv4_pending_accel_count); + +- if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv4_dentry, +- (u32 *)&ecm_sfe_ipv4_pending_decel_count)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv4 pending_decel_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv4_dentry, ++ (u32 *)&ecm_sfe_ipv4_pending_decel_count); + + if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, + NULL, &ecm_sfe_ipv4_accel_limit_mode_fops)) { +--- a/frontends/sfe/ecm_sfe_ipv6.c ++++ b/frontends/sfe/ecm_sfe_ipv6.c +@@ -1532,48 +1532,27 @@ int ecm_sfe_ipv6_init(struct dentry *den + } + + #ifdef CONFIG_XFRM +- if (!debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, +- (u32 *)&ecm_sfe_ipv6_reject_acceleration_for_ipsec)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv6 reject_acceleration_for_ipsec file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, ++ (u32 *)&ecm_sfe_ipv6_reject_acceleration_for_ipsec); + #endif + +- if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, +- (u32 *)&ecm_sfe_ipv6_no_action_limit_default)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv6 no_action_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, ++ (u32 *)&ecm_sfe_ipv6_no_action_limit_default); + +- if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, +- (u32 *)&ecm_sfe_ipv6_driver_fail_limit_default)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv6 driver_fail_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, ++ (u32 *)&ecm_sfe_ipv6_driver_fail_limit_default); + +- if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, +- (u32 *)&ecm_sfe_ipv6_nack_limit_default)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv6 nack_limit_default file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, ++ (u32 *)&ecm_sfe_ipv6_nack_limit_default); + +- if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv6_dentry, +- (u32 *)&ecm_sfe_ipv6_accelerated_count)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv6 accelerated_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv6_dentry, ++ (u32 *)&ecm_sfe_ipv6_accelerated_count); + +- if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv6_dentry, +- (u32 *)&ecm_sfe_ipv6_pending_accel_count)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv6 pending_accel_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv6_dentry, ++ (u32 *)&ecm_sfe_ipv6_pending_accel_count); + +- if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv6_dentry, +- (u32 *)&ecm_sfe_ipv6_pending_decel_count)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv6 pending_decel_count file in debugfs\n"); +- goto task_cleanup; +- } ++ debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv6_dentry, ++ (u32 *)&ecm_sfe_ipv6_pending_decel_count); + + if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, + NULL, &ecm_sfe_ipv6_accel_limit_mode_fops)) { +--- a/frontends/sfe/ecm_sfe_non_ported_ipv4.c ++++ b/frontends/sfe/ecm_sfe_non_ported_ipv4.c +@@ -2284,11 +2284,8 @@ done: + */ + bool ecm_sfe_non_ported_ipv4_debugfs_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, +- (u32 *)&ecm_sfe_non_ported_ipv4_accelerated_count)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv4 non_ported_accelerated_count file in debugfs\n"); +- return false; +- } ++ debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, ++ (u32 *)&ecm_sfe_non_ported_ipv4_accelerated_count); + + return true; + } +--- a/frontends/sfe/ecm_sfe_non_ported_ipv6.c ++++ b/frontends/sfe/ecm_sfe_non_ported_ipv6.c +@@ -2083,11 +2083,8 @@ done: + */ + bool ecm_sfe_non_ported_ipv6_debugfs_init(struct dentry *dentry) + { +- if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, +- (u32 *)&ecm_sfe_non_ported_ipv6_accelerated_count)) { +- DEBUG_ERROR("Failed to create ecm sfe ipv6 non_ported_accelerated_count file in debugfs\n"); +- return false; +- } ++ debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, ++ (u32 *)&ecm_sfe_non_ported_ipv6_accelerated_count); + + return true; + } +--- a/frontends/sfe/ecm_sfe_ported_ipv4.c ++++ b/frontends/sfe/ecm_sfe_ported_ipv4.c +@@ -2528,12 +2528,8 @@ bool ecm_sfe_ported_ipv4_debugfs_init(st + return false; + } + +- if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, +- &ecm_sfe_ported_ipv4_accelerated_count[ECM_SFE_PORTED_IPV4_PROTO_TCP])) { +- DEBUG_ERROR("Failed to create ecm sfe ipv4 tcp_accelerated_count file in debugfs\n"); +- debugfs_remove(udp_dentry); +- return false; +- } ++ debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, ++ &ecm_sfe_ported_ipv4_accelerated_count[ECM_SFE_PORTED_IPV4_PROTO_TCP]); + + return true; + } +--- a/frontends/sfe/ecm_sfe_ported_ipv6.c ++++ b/frontends/sfe/ecm_sfe_ported_ipv6.c +@@ -2374,12 +2374,8 @@ bool ecm_sfe_ported_ipv6_debugfs_init(st + return false; + } + +- if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, +- &ecm_sfe_ported_ipv6_accelerated_count[ECM_SFE_PORTED_IPV6_PROTO_TCP])) { +- DEBUG_ERROR("Failed to create ecm sfe ipv6 tcp_accelerated_count file in debugfs\n"); +- debugfs_remove(udp_dentry); +- return false; +- } ++ debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, ++ &ecm_sfe_ported_ipv6_accelerated_count[ECM_SFE_PORTED_IPV6_PROTO_TCP]); + + return true; + } diff --git a/package/qca/nss/qca-nss-ecm-64/patches/203-rework-nfct-notification.patch b/package/qca/nss/qca-nss-ecm-64/patches/203-rework-nfct-notification.patch new file mode 100644 index 00000000000000..72005cd701ecd7 --- /dev/null +++ b/package/qca/nss/qca-nss-ecm-64/patches/203-rework-nfct-notification.patch @@ -0,0 +1,25 @@ +--- a/ecm_conntrack_notifier.c ++++ b/ecm_conntrack_notifier.c +@@ -421,7 +421,11 @@ int ecm_conntrack_notifier_init(struct d + /* + * Eventing subsystem is available so we register a notifier hook to get fast notifications of expired connections + */ ++#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS ++ result = nf_conntrack_register_chain_notifier(&init_net, &ecm_conntrack_notifier); ++#else + result = nf_conntrack_register_notifier(&init_net, &ecm_conntrack_notifier); ++#endif + if (result < 0) { + DEBUG_ERROR("Can't register nf notifier hook.\n"); + debugfs_remove_recursive(ecm_conntrack_notifier_dentry); +@@ -439,7 +443,9 @@ EXPORT_SYMBOL(ecm_conntrack_notifier_ini + void ecm_conntrack_notifier_exit(void) + { + DEBUG_INFO("ECM Conntrack Notifier exit\n"); +-#ifdef CONFIG_NF_CONNTRACK_EVENTS ++#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS ++ nf_conntrack_unregister_chain_notifier(&init_net, &ecm_conntrack_notifier); ++#else + nf_conntrack_unregister_notifier(&init_net, &ecm_conntrack_notifier); + #endif + /* diff --git a/package/qca/nss/qca-nss-ecm-64/patches/204-More-compile-fixes.patch b/package/qca/nss/qca-nss-ecm-64/patches/204-More-compile-fixes.patch new file mode 100644 index 00000000000000..a998d8295a7d8d --- /dev/null +++ b/package/qca/nss/qca-nss-ecm-64/patches/204-More-compile-fixes.patch @@ -0,0 +1,58 @@ +From e6d701c0d454d841366c556b2ef07a5203ffb35d Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Fri, 21 May 2021 21:41:31 +0200 +Subject: [PATCH] More compile fixes + +More runtime compile fixes. + +Signed-off-by: Robert Marko +--- + frontends/nss/ecm_nss_ported_ipv4.c | 12 +++--------- + frontends/nss/ecm_nss_ported_ipv6.c | 12 +++--------- + 2 files changed, 6 insertions(+), 18 deletions(-) + +diff --git a/frontends/nss/ecm_nss_ported_ipv4.c b/frontends/nss/ecm_nss_ported_ipv4.c +index 3522f0f..7f5fcd1 100644 +--- a/frontends/nss/ecm_nss_ported_ipv4.c ++++ b/frontends/nss/ecm_nss_ported_ipv4.c +@@ -2935,14 +2935,8 @@ done: + */ + bool ecm_nss_ported_ipv4_debugfs_init(struct dentry *dentry) + { +- struct dentry *udp_dentry; +- +- udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, ++ debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, + &ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_UDP]); +- if (!udp_dentry) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 udp_accelerated_count file in debugfs\n"); +- return false; +- } + + debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, + &ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_TCP]); +diff --git a/frontends/nss/ecm_nss_ported_ipv6.c b/frontends/nss/ecm_nss_ported_ipv6.c +index f43ac95..e0f779c 100644 +--- a/frontends/nss/ecm_nss_ported_ipv6.c ++++ b/frontends/nss/ecm_nss_ported_ipv6.c + /* + * ecm_nss_ported_ipv6_connection_callback() +@@ -2723,14 +2723,8 @@ done: + */ + bool ecm_nss_ported_ipv6_debugfs_init(struct dentry *dentry) + { +- struct dentry *udp_dentry; +- +- udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, ++ debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, + &ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_UDP]); +- if (!udp_dentry) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 udp_accelerated_count file in debugfs\n"); +- return false; +- } + + debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, + &ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_TCP]); +-- +2.31.1 + diff --git a/package/nss/qca/qca-nss-ecm/Makefile b/package/qca/nss/qca-nss-ecm/Makefile similarity index 99% rename from package/nss/qca/qca-nss-ecm/Makefile rename to package/qca/nss/qca-nss-ecm/Makefile index 48df30a5b19c6f..a570c9551370e6 100644 --- a/package/nss/qca/qca-nss-ecm/Makefile +++ b/package/qca/nss/qca-nss-ecm/Makefile @@ -44,7 +44,7 @@ define KernelPackage/qca-nss-ecm/Default +TARGET_ipq_ipq50xx:kmod-qca-nss-drv \ +TARGET_ipq_ipq50xx_64:kmod-qca-nss-drv \ +iptables-mod-extra +kmod-ipt-conntrack \ - +kmod-pppoe @!LINUX_3_18 \ + +kmod-pppoe @LINUX_5_4 \ +kmod-ipsec TITLE:=QCA NSS Enhanced Connection Manager (ECM) FILES:=$(PKG_BUILD_DIR)/*.ko $(FILES_EXAMPLES) @@ -241,6 +241,8 @@ endef define KernelPackage/qca-nss-ecm-premium/config menu "ECM Configuration" + depends on PACKAGE_kmod_qca-nss-ecm-premium + config QCA_NSS_ECM_EXAMPLES_PCC bool "Build PCC usage example" help diff --git a/package/qca/nss/qca-nss-ecm/files/ecm_dump.sh b/package/qca/nss/qca-nss-ecm/files/ecm_dump.sh new file mode 100644 index 00000000000000..dbf7de753f055b --- /dev/null +++ b/package/qca/nss/qca-nss-ecm/files/ecm_dump.sh @@ -0,0 +1,95 @@ +#!/bin/sh +# +# Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +ECM_MODULE=${1:-ecm_state} +MOUNT_ROOT=/dev/ecm + +# +# usage: ecm_dump.sh [module=ecm_db] +# +# with no parameters, ecm_dump.sh will attempt to mount the +# ecm_db state file and cat its contents. +# +# example with a parameter: ecm_dump.sh ecm_classifier_default +# +# this will cause ecm_dump to attempt to find and mount the state +# file for the ecm_classifier_default module, and if successful +# cat the contents. +# + +# this is one of the state files, which happens to be the +# last module started in ecm +ECM_STATE=/sys/kernel/debug/ecm/ecm_state/state_dev_major + +# tests to see if ECM is up and ready to receive commands. +# returns 0 if ECM is fully up and ready, else 1 +ecm_is_ready() { + if [ ! -e "${ECM_STATE}" ] + then + return 1 + fi + return 0 +} + +# +# module_state_mount(module_name) +# Mounts the state file of the module, if supported +# +module_state_mount() { + local module_name=$1 + local mount_dir=$2 + local state_file="/sys/kernel/debug/ecm/${module_name}/state_dev_major" + + if [ -e "${mount_dir}/${module_name}" ] + then + # already mounted + return 0 + fi + + #echo "Mount state file for $module_name ..." + if [ ! -e "$state_file" ] + then + #echo "... $module_name does not support state" + return 1 + fi + + local major="`cat $state_file`" + #echo "... Mounting state $state_file with major: $major" + mknod "${mount_dir}/${module_name}" c $major 0 +} + +# +# main +# +ecm_is_ready || { + #echo "ECM is not running" + exit 1 +} + +# all state files are mounted under MOUNT_ROOT, so make sure it exists +mkdir -p ${MOUNT_ROOT} + +# +# attempt to mount state files for the requested module and cat it +# if the mount succeeded +# +module_state_mount ${ECM_MODULE} ${MOUNT_ROOT} && { + cat ${MOUNT_ROOT}/${ECM_MODULE} + exit 0 +} + +exit 2 diff --git a/package/qca/nss/qca-nss-ecm/files/on-demand-down b/package/qca/nss/qca-nss-ecm/files/on-demand-down new file mode 100644 index 00000000000000..02d708e03baaeb --- /dev/null +++ b/package/qca/nss/qca-nss-ecm/files/on-demand-down @@ -0,0 +1,6 @@ +#!/bin/sh +# Copyright (c) 2016 The Linux Foundation. All rights reserved. + +[ -e "/sys/kernel/debug/ecm/ecm_db/defunct_all" ] && { + echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all +} diff --git a/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.defaults b/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.defaults new file mode 100644 index 00000000000000..308e265c988a4a --- /dev/null +++ b/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.defaults @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +uci -q batch << EOF + delete firewall.qcanssecm + set firewall.qcanssecm=include + set firewall.qcanssecm.type=script + set firewall.qcanssecm.path=/etc/firewall.d/qca-nss-ecm + set firewall.qcanssecm.family=any + set firewall.qcanssecm.reload=1 + commit firewall +EOF + +exit 0 diff --git a/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.firewall b/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.firewall new file mode 100644 index 00000000000000..24c64def2aff3d --- /dev/null +++ b/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.firewall @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +iptables -A FORWARD -m physdev --physdev-is-bridged -j ACCEPT diff --git a/package/nss/qca/qca-nss-ecm/files/qca-nss-ecm.init b/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.init similarity index 100% rename from package/nss/qca/qca-nss-ecm/files/qca-nss-ecm.init rename to package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.init diff --git a/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.sysctl b/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.sysctl new file mode 100644 index 00000000000000..1a3d76b189d2e0 --- /dev/null +++ b/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.sysctl @@ -0,0 +1,2 @@ +# nf_conntrack_tcp_no_window_check is 0 by default, set it to 1 +net.netfilter.nf_conntrack_tcp_no_window_check=1 diff --git a/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.uci b/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.uci new file mode 100644 index 00000000000000..4f2de68771fa1d --- /dev/null +++ b/package/qca/nss/qca-nss-ecm/files/qca-nss-ecm.uci @@ -0,0 +1,2 @@ +config ecm 'global' + option acceleration_engine 'auto' diff --git a/package/nss/qca/qca-nss-ecm/patches/001-Drop_SFE_from_ecm.patch b/package/qca/nss/qca-nss-ecm/patches/001-Drop_SFE_from_ecm.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/001-Drop_SFE_from_ecm.patch rename to package/qca/nss/qca-nss-ecm/patches/001-Drop_SFE_from_ecm.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/100-kernel-5.4-support.patch b/package/qca/nss/qca-nss-ecm/patches/100-kernel-5.4-support.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/100-kernel-5.4-support.patch rename to package/qca/nss/qca-nss-ecm/patches/100-kernel-5.4-support.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/101-Fix_Kern_Panic_on_UDP_CONNTRACK.patch b/package/qca/nss/qca-nss-ecm/patches/101-Fix_Kern_Panic_on_UDP_CONNTRACK.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/101-Fix_Kern_Panic_on_UDP_CONNTRACK.patch rename to package/qca/nss/qca-nss-ecm/patches/101-Fix_Kern_Panic_on_UDP_CONNTRACK.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/200-resolve-high-load.patch b/package/qca/nss/qca-nss-ecm/patches/200-resolve-high-load.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/200-resolve-high-load.patch rename to package/qca/nss/qca-nss-ecm/patches/200-resolve-high-load.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/203-rework-nfct-notification.patch b/package/qca/nss/qca-nss-ecm/patches/203-rework-nfct-notification.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/203-rework-nfct-notification.patch rename to package/qca/nss/qca-nss-ecm/patches/203-rework-nfct-notification.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/400-Check-TCP_UDP-conntrack-state-earlier.patch b/package/qca/nss/qca-nss-ecm/patches/400-Check-TCP_UDP-conntrack-state-earlier.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/400-Check-TCP_UDP-conntrack-state-earlier.patch rename to package/qca/nss/qca-nss-ecm/patches/400-Check-TCP_UDP-conntrack-state-earlier.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/401-Fix-NSS-stats-request-roll-over-issue.patch b/package/qca/nss/qca-nss-ecm/patches/401-Fix-NSS-stats-request-roll-over-issue.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/401-Fix-NSS-stats-request-roll-over-issue.patch rename to package/qca/nss/qca-nss-ecm/patches/401-Fix-NSS-stats-request-roll-over-issue.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/401-Fix-for-ref-leak-during-multicast.patch b/package/qca/nss/qca-nss-ecm/patches/401-Fix-for-ref-leak-during-multicast.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/401-Fix-for-ref-leak-during-multicast.patch rename to package/qca/nss/qca-nss-ecm/patches/401-Fix-for-ref-leak-during-multicast.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/401-Fix-neighbour-solicitation-send-function.patch b/package/qca/nss/qca-nss-ecm/patches/401-Fix-neighbour-solicitation-send-function.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/401-Fix-neighbour-solicitation-send-function.patch rename to package/qca/nss/qca-nss-ecm/patches/401-Fix-neighbour-solicitation-send-function.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/402-Reference-leak-during-multicast_PPPoE-bridge.patch b/package/qca/nss/qca-nss-ecm/patches/402-Reference-leak-during-multicast_PPPoE-bridge.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/402-Reference-leak-during-multicast_PPPoE-bridge.patch rename to package/qca/nss/qca-nss-ecm/patches/402-Reference-leak-during-multicast_PPPoE-bridge.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/403-Access-global-accelerated-count-under-lock.patch b/package/qca/nss/qca-nss-ecm/patches/403-Access-global-accelerated-count-under-lock.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/403-Access-global-accelerated-count-under-lock.patch rename to package/qca/nss/qca-nss-ecm/patches/403-Access-global-accelerated-count-under-lock.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/403-Fix-IPv6-neighbor-solicitation-request.patch b/package/qca/nss/qca-nss-ecm/patches/403-Fix-IPv6-neighbor-solicitation-request.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/403-Fix-IPv6-neighbor-solicitation-request.patch rename to package/qca/nss/qca-nss-ecm/patches/403-Fix-IPv6-neighbor-solicitation-request.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/404-IPv6-solicitation-fix-with-zero-gateway-address.patch b/package/qca/nss/qca-nss-ecm/patches/404-IPv6-solicitation-fix-with-zero-gateway-address.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/404-IPv6-solicitation-fix-with-zero-gateway-address.patch rename to package/qca/nss/qca-nss-ecm/patches/404-IPv6-solicitation-fix-with-zero-gateway-address.patch diff --git a/package/nss/qca/qca-nss-ecm/patches/405-Allow-egress-on-same-port-when-bridge-hairpin-is-enabled.patch b/package/qca/nss/qca-nss-ecm/patches/405-Allow-egress-on-same-port-when-bridge-hairpin-is-enabled.patch similarity index 100% rename from package/nss/qca/qca-nss-ecm/patches/405-Allow-egress-on-same-port-when-bridge-hairpin-is-enabled.patch rename to package/qca/nss/qca-nss-ecm/patches/405-Allow-egress-on-same-port-when-bridge-hairpin-is-enabled.patch diff --git a/package/nss/qca/qca-nss-gmac/Makefile b/package/qca/nss/qca-nss-gmac/Makefile similarity index 95% rename from package/nss/qca/qca-nss-gmac/Makefile rename to package/qca/nss/qca-nss-gmac/Makefile index 586eb0c1bc74b8..6e00c7a1a7d446 100644 --- a/package/nss/qca/qca-nss-gmac/Makefile +++ b/package/qca/nss/qca-nss-gmac/Makefile @@ -15,7 +15,7 @@ define KernelPackage/qca-nss-gmac SECTION:=kernel CATEGORY:=Kernel modules SUBMENU:=Network Devices - DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x @!LINUX_3_18 + DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x @LINUX_5_4 TITLE:=Kernel driver for NSS gmac FILES:=$(PKG_BUILD_DIR)/ipq806x/qca-nss-gmac.ko AUTOLOAD:=$(call AutoLoad,31,qca-nss-gmac) diff --git a/package/nss/qca/qca-nss-gmac/patches/100-kernel-5.4-support.patch b/package/qca/nss/qca-nss-gmac/patches/100-kernel-5.4-support.patch similarity index 100% rename from package/nss/qca/qca-nss-gmac/patches/100-kernel-5.4-support.patch rename to package/qca/nss/qca-nss-gmac/patches/100-kernel-5.4-support.patch diff --git a/package/nss/qca/qca-nss-gmac/patches/101-nss-gmac-test-ptr.patch b/package/qca/nss/qca-nss-gmac/patches/101-nss-gmac-test-ptr.patch similarity index 100% rename from package/nss/qca/qca-nss-gmac/patches/101-nss-gmac-test-ptr.patch rename to package/qca/nss/qca-nss-gmac/patches/101-nss-gmac-test-ptr.patch diff --git a/package/nss/qca/qca-nss-gmac/patches/200-work-around-interface-close-warning.patch b/package/qca/nss/qca-nss-gmac/patches/200-work-around-interface-close-warning.patch similarity index 100% rename from package/nss/qca/qca-nss-gmac/patches/200-work-around-interface-close-warning.patch rename to package/qca/nss/qca-nss-gmac/patches/200-work-around-interface-close-warning.patch diff --git a/package/qca/nss/qca-rfs/Makefile b/package/qca/nss/qca-rfs/Makefile new file mode 100644 index 00000000000000..197545dbff2966 --- /dev/null +++ b/package/qca/nss/qca-rfs/Makefile @@ -0,0 +1,51 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=qca-rfs +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/qca-rfs +PKG_SOURCE_DATE:=2021-03-17 +PKG_SOURCE_VERSION:=75197c386f477c7b3a6f02489d9903a9409fd5cc +PKG_MIRROR_HASH:=90f1c3ec2e984cf8efa79c85d715ebd8a21e347ab57adbd9695de23e64eea1ec + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/qca-rfs + SECTION:=kernel + CATEGORY:=Kernel modules + SUBMENU:=Network Support + DEPENDS:=@TARGET_ipq40xx +kmod-ipt-conntrack + TITLE:=Kernel module for QCA Receiving Flow Steering + FILES:=$(PKG_BUILD_DIR)/qrfs.ko + KCONFIG:=\ + CONFIG_NF_CONNTRACK_EVENTS=y \ + CONFIG_NF_CONNTRACK_CHAIN_EVENTS=y + AUTOLOAD:=$(call AutoLoad,29,qrfs) +endef + +define KernelPackage/qca-rfs/Description +QCA-RFS is a kernel module for ESS Receive Flow Steering. +endef + +define Build/Compile + $(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ + $(KERNEL_MAKE_FLAGS) \ + $(PKG_MAKE_FLAGS) \ + M="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ + modules +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/qca-rfs + $(CP) -rf $(PKG_BUILD_DIR)/rfs_dev.h $(1)/usr/include/qca-rfs +endef + +define KernelPackage/qca-rfs/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/qrfs.init $(1)/etc/init.d/qrfs +endef + +$(eval $(call KernelPackage,qca-rfs)) diff --git a/package/qca/nss/qca-rfs/files/qrfs.init b/package/qca/nss/qca-rfs/files/qrfs.init new file mode 100755 index 00000000000000..f3f8a38c876412 --- /dev/null +++ b/package/qca/nss/qca-rfs/files/qrfs.init @@ -0,0 +1,27 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (c) 2015 The Linux Foundation. All rights reserved. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +START=70 + +start() { + echo "1" > /proc/qrfs/enable + ip neigh flush all +} + +stop() { + echo "0" > /proc/qrfs/enable +} diff --git a/package/qca/nss/qca-rfs/patches/100-add-kernel-5.4-support.patch b/package/qca/nss/qca-rfs/patches/100-add-kernel-5.4-support.patch new file mode 100644 index 00000000000000..b7b2db55919912 --- /dev/null +++ b/package/qca/nss/qca-rfs/patches/100-add-kernel-5.4-support.patch @@ -0,0 +1,57 @@ +--- a/rfs_cm.c ++++ b/rfs_cm.c +@@ -462,14 +462,6 @@ static int rfs_cm_conntrack_event(unsign + } + + /* +- * If this is an untracked connection then we can't have any state either. +- */ +- if (unlikely(ct == &nf_conntrack_untracked)) { +- RFS_TRACE("ignoring untracked conn\n"); +- return NOTIFY_DONE; +- } +- +- /* + * Ignore anything other than IPv4 connections. + */ + if (unlikely(nf_ct_l3num(ct) != AF_INET)) { +--- a/rfs_rule.c ++++ b/rfs_rule.c +@@ -702,7 +702,7 @@ int rfs_rule_init(void) + + RFS_DEBUG("RFS Rule init\n"); + spin_lock_init(&rr->hash_lock); +- memset(&rr->hash, 0, RFS_RULE_HASH_SIZE); ++ memset(&rr->hash, 0, sizeof(rr->hash)); + + rr->proc_rule = proc_create("rule", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, + rfs_proc_entry, &rule_proc_fops); +@@ -717,7 +717,7 @@ void rfs_rule_exit(void) + struct rfs_rule *rr = &__rr; + + RFS_DEBUG("RFS Rule exit\n"); +- if (rr->proc_rule); ++ if (rr->proc_rule) + remove_proc_entry("rule", rfs_proc_entry); + rfs_rule_destroy_all(); + } +--- a/rfs_wxt.c ++++ b/rfs_wxt.c +@@ -422,7 +422,7 @@ static int rfs_wxt_rx(struct socket *soc + #else + iov_iter_init(&msg.msg_iter, READ, &iov, 1, len); + #endif +- size = sock_recvmsg(sock, &msg, len, msg.msg_flags); ++ size = sock_recvmsg(sock, &msg, msg.msg_flags); + set_fs(oldfs); + + return size; +@@ -510,7 +510,7 @@ int rfs_wxt_stop(void) + } + + RFS_DEBUG("kill rfs_wxt thread"); +- force_sig(SIGKILL, __rwn.thread); ++ send_sig(SIGKILL, __rwn.thread, 1); + if (__rwn.thread) + err = kthread_stop(__rwn.thread); + __rwn.thread = NULL; diff --git a/package/nss/qca/qca-rfs/patches/200-rework-nfct-notification.patch b/package/qca/nss/qca-rfs/patches/200-rework-nfct-notification.patch similarity index 100% rename from package/nss/qca/qca-rfs/patches/200-rework-nfct-notification.patch rename to package/qca/nss/qca-rfs/patches/200-rework-nfct-notification.patch diff --git a/package/nss/qca/qca-ssdk-shell/Makefile b/package/qca/nss/qca-ssdk-shell/Makefile similarity index 67% rename from package/nss/qca/qca-ssdk-shell/Makefile rename to package/qca/nss/qca-ssdk-shell/Makefile index e6bd6a3f779b63..90e2c2e641c013 100644 --- a/package/nss/qca/qca-ssdk-shell/Makefile +++ b/package/qca/nss/qca-ssdk-shell/Makefile @@ -1,10 +1,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-ssdk-shell -PKG_RELEASE:=$(AUTORELEASE) +PKG_RELEASE:=1 -PKG_SOURCE_URL:=https://source.codeaurora.org/quic/cc-qrdk/oss/ssdk-shell PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/ssdk-shell PKG_SOURCE_DATE:=2021-01-27 PKG_SOURCE_VERSION:=5661366d471a78314bc7010f985ad8cc15be832a PKG_MIRROR_HASH:=73111e09e896f0abbe3ee1c358aea7ec14fe5e668ce8753b8968e03c78f9599b @@ -13,12 +13,12 @@ include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk define Package/qca-ssdk-shell - SECTION:=QCA + SECTION:=utils CATEGORY:=Utilities TITLE:=Shell application for QCA SSDK + DEPENDS:=@(TARGET_ipq40xx||TARGET_ipq806x||TARGET_ipq807x) endef - define Package/qca-ssdk-shell/Description This package contains a qca-ssdk shell application for QCA chipset endef @@ -27,13 +27,14 @@ ifndef CONFIG_TOOLCHAIN_BIN_PATH CONFIG_TOOLCHAIN_BIN_PATH=$(TOOLCHAIN_DIR)/bin endif -QCASSDK_CONFIG_OPTS+= TOOL_PATH=$(CONFIG_TOOLCHAIN_BIN_PATH) \ - SYS_PATH=$(LINUX_DIR) \ - TOOLPREFIX=$(TARGET_CROSS) \ - KVER=$(LINUX_VERSION) \ - CFLAGS="$(TARGET_CFLAGS)" \ - LDFLAGS="$(TARGET_LDFLAGS)" \ - ARCH=$(LINUX_KARCH) +QCASSDK_CONFIG_OPTS+= \ + TOOL_PATH=$(CONFIG_TOOLCHAIN_BIN_PATH) \ + SYS_PATH=$(LINUX_DIR) \ + TOOLPREFIX=$(TARGET_CROSS) \ + KVER=$(LINUX_VERSION) \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + ARCH=$(LINUX_KARCH) define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) $(strip $(QCASSDK_CONFIG_OPTS)) @@ -44,5 +45,4 @@ define Package/qca-ssdk-shell/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/bin/ssdk_sh $(1)/usr/sbin/ endef - $(eval $(call BuildPackage,qca-ssdk-shell)) diff --git a/package/nss/qca/qca-ssdk/Makefile b/package/qca/nss/qca-ssdk/Makefile similarity index 64% rename from package/nss/qca/qca-ssdk/Makefile rename to package/qca/nss/qca-ssdk/Makefile index 204bf2d39ab38b..62883a91da350a 100644 --- a/package/nss/qca/qca-ssdk/Makefile +++ b/package/qca/nss/qca-ssdk/Makefile @@ -1,34 +1,52 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-ssdk -PKG_RELEASE:=$(AUTORELEASE) +PKG_RELEASE:=1 -PKG_SOURCE_URL:=https://source.codeaurora.org/quic/cc-qrdk/oss/lklm/qca-ssdk PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/qca-ssdk PKG_SOURCE_DATE:=2021-04-28 PKG_SOURCE_VERSION:=c9bc3bc34eaaac78083573524097356e2dcc1b66 PKG_MIRROR_HASH:=29db78529be32427b8b96fcbfec22a016a243676781ec96d9d65b810944fa405 PKG_BUILD_PARALLEL:=1 +LOCAL_VARIANT=$(patsubst qca-ssdk-%,%,$(patsubst qca-ssdk-%,%,$(BUILD_VARIANT))) + include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk -define KernelPackage/qca-ssdk-nohnat +define KernelPackage/qca-ssdk/default-nohnat SECTION:=kernel CATEGORY:=Kernel modules SUBMENU:=Network Devices TITLE:=Kernel driver for QCA SSDK - DEPENDS:=@(TARGET_ipq807x) FILES:=$(PKG_BUILD_DIR)/build/bin/qca-ssdk.ko AUTOLOAD:=$(call AutoLoad,30,qca-ssdk) + PROVIDES:=qca-ssdk +endef + +define KernelPackage/qca-ssdk-nohnat +$(call KernelPackage/qca-ssdk/default-nohnat) + DEPENDS:=@(TARGET_ipq806x||TARGET_ipq807x) + VARIANT:=nohnat endef define KernelPackage/qca-ssdk-nohnat/Description This package contains a qca-ssdk driver for QCA chipset endef -GCC_VERSION=$(shell echo "$(CONFIG_GCC_VERSION)" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/') +define KernelPackage/qca-ssdk-hnat +$(call KernelPackage/qca-ssdk/default-nohnat) + DEPENDS:=@TARGET_ipq40xx +kmod-ipt-extra +kmod-ipt-filter \ + +kmod-ppp +TARGET_ipq40xx:kmod-qca-rfs + TITLE+= (hnat) + VARIANT:=hnat +endef + +define KernelPackage/qca-ssdk-hnat/Description +This package contains a qca-ssdk-hnat driver for QCA chipset +endef ifdef CONFIG_TOOLCHAIN_BIN_PATH TOOLCHAIN_BIN_PATH=$(CONFIG_TOOLCHAIN_BIN_PATH) @@ -36,8 +54,7 @@ else TOOLCHAIN_BIN_PATH=$(TOOLCHAIN_DIR)/bin endif -MAKE_FLAGS+= \ - TARGET_NAME=$(CONFIG_TARGET_NAME) \ +QCASSDK_CONFIG_OPTS+= \ TOOL_PATH=$(TOOLCHAIN_BIN_PATH) \ SYS_PATH=$(LINUX_DIR) \ TOOLPREFIX=$(TARGET_CROSS) \ @@ -45,19 +62,24 @@ MAKE_FLAGS+= \ ARCH=$(LINUX_KARCH) \ TARGET_SUFFIX=$(CONFIG_TARGET_SUFFIX) \ GCC_VERSION=$(GCC_VERSION) \ - EXTRA_CFLAGS=-I$(STAGING_DIR)/usr/include \ - $(KERNEL_MAKE_FLAGS) + CFLAGS=-I$(STAGING_DIR)/usr/include -ifneq (, $(findstring $(CONFIG_TARGET_BOARD), "ipq60xx" "ipq807x")) - MAKE_FLAGS+= PTP_FEATURE=disable SWCONFIG_FEATURE=disable +ifeq ($(LOCAL_VARIANT),hnat) + QCASSDK_CONFIG_OPTS+= HNAT_FEATURE=enable endif -ifeq ($(CONFIG_TARGET_BOARD), "ipq807x") - MAKE_FLAGS+= CHIP_TYPE=HPPE -else ifeq ($(CONFIG_TARGET_BOARD), "ipq60xx") - MAKE_FLAGS+= CHIP_TYPE=CPPE +ifeq ($(BOARD),ipq40xx) + QCASSDK_CONFIG_OPTS+= HK_CHIP=enable +else ifeq ($(BOARD),ipq60xx) + QCASSDK_CONFIG_OPTS+= CHIP_TYPE=CPPE PTP_FEATURE=disable SWCONFIG_FEATURE=disable +else ifeq ($(BOARD),ipq807x) + QCASSDK_CONFIG_OPTS+= CHIP_TYPE=HPPE PTP_FEATURE=disable SWCONFIG_FEATURE=disable endif +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) $(strip $(QCASSDK_CONFIG_OPTS)) +endef + define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include/qca-ssdk $(INSTALL_DIR) $(1)/usr/include/qca-ssdk/api @@ -82,7 +104,6 @@ define Build/InstallDev $(CP) -rf $(PKG_BUILD_DIR)/include/common/*.h $(1)/usr/include/qca-ssdk $(CP) -rf $(PKG_BUILD_DIR)/include/sal/os/linux/*.h $(1)/usr/include/qca-ssdk $(CP) -rf $(PKG_BUILD_DIR)/include/sal/os/*.h $(1)/usr/include/qca-ssdk - endef define KernelPackage/qca-ssdk-nohnat/install @@ -90,4 +111,10 @@ define KernelPackage/qca-ssdk-nohnat/install $(INSTALL_BIN) ./files/qca-ssdk $(1)/etc/init.d/qca-ssdk endef +define KernelPackage/qca-ssdk-hnat/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/qca-ssdk $(1)/etc/init.d/qca-ssdk +endef + $(eval $(call KernelPackage,qca-ssdk-nohnat)) +$(eval $(call KernelPackage,qca-ssdk-hnat)) diff --git a/package/nss/qca/qca-ssdk/files/qca-ssdk b/package/qca/nss/qca-ssdk/files/qca-ssdk similarity index 100% rename from package/nss/qca/qca-ssdk/files/qca-ssdk rename to package/qca/nss/qca-ssdk/files/qca-ssdk diff --git a/package/nss/qca/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10.patch b/package/qca/nss/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10.patch similarity index 100% rename from package/nss/qca/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10.patch rename to package/qca/nss/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10.patch diff --git a/package/nss/qca/qca-ssdk/patches/0002-SSDK-replace-ioremap_nocache-with-ioremap.patch b/package/qca/nss/qca-ssdk/patches/0002-SSDK-replace-ioremap_nocache-with-ioremap.patch similarity index 100% rename from package/nss/qca/qca-ssdk/patches/0002-SSDK-replace-ioremap_nocache-with-ioremap.patch rename to package/qca/nss/qca-ssdk/patches/0002-SSDK-replace-ioremap_nocache-with-ioremap.patch diff --git a/package/nss/qca/qca-ssdk/patches/0004-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch b/package/qca/nss/qca-ssdk/patches/0004-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch similarity index 100% rename from package/nss/qca/qca-ssdk/patches/0004-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch rename to package/qca/nss/qca-ssdk/patches/0004-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch diff --git a/package/qca/nss/qca-ssdk/patches/0005-add-kernel-5.4-support.patch b/package/qca/nss/qca-ssdk/patches/0005-add-kernel-5.4-support.patch new file mode 100644 index 00000000000000..6b08b05aeea4e1 --- /dev/null +++ b/package/qca/nss/qca-ssdk/patches/0005-add-kernel-5.4-support.patch @@ -0,0 +1,108 @@ +--- a/app/nathelper/linux/lib/nat_helper_dt.c ++++ b/app/nathelper/linux/lib/nat_helper_dt.c +@@ -721,7 +721,7 @@ napt_ct_counter_sync(a_uint32_t hw_index) + } + + if (!test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status)) { +- ct->timeout.expires += delta_jiffies; ++ ct->timeout += delta_jiffies; + } + + if((cct != NULL) && (napt_hw_get_by_index(&napt, hw_index) == 0)) +@@ -770,7 +770,7 @@ napt_ct_timer_update(a_uint32_t hw_index) + } + + if (!test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status)) { +- ct->timeout.expires += delta_jiffies; ++ ct->timeout += delta_jiffies; + } + + return 0; +--- a/app/nathelper/linux/napt_helper.c ++++ b/app/nathelper/linux/napt_helper.c +@@ -64,11 +64,6 @@ napt_ct_aging_disable(uint32_t ct_addr) + } + + ct = (struct nf_conn *)ct_addr; +- +- if (timer_pending(&ct->timeout)) +- { +- del_timer(&ct->timeout); +- } + } + + int +@@ -85,7 +80,7 @@ napt_ct_aging_is_enable(uint32_t ct_addr) + + ct = (struct nf_conn *)ct_addr; + +- return timer_pending(&(((struct nf_conn *)ct)->timeout)); ++ return (nf_ct_is_expired(ct)); + } + + void +@@ -111,18 +106,17 @@ napt_ct_aging_enable(uint32_t ct_addr) + l3num = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num; + protonum = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum; + +- ct->timeout.expires = jiffies+10*HZ; ++ ct->timeout = jiffies+10*HZ; + + if ((l3num == AF_INET) && (protonum == IPPROTO_TCP)) + { + if (ct->proto.tcp.state == TCP_CONNTRACK_ESTABLISHED) + { +- ct->timeout.expires = jiffies+(5*24*60*60*HZ); ++ ct->timeout = jiffies+(5*24*60*60*HZ); + } + } + + HNAT_PRINTK(" ct:[%x] add timeout again\n", ct_addr); +- add_timer(&ct->timeout); + } + + void +@@ -339,7 +333,6 @@ napt_ct_list_unlock(void) + uint32_t + napt_ct_list_iterate(uint32_t *hash, uint32_t *iterate) + { +- struct net *net = &init_net; + struct nf_conntrack_tuple_hash *h = NULL; + struct nf_conn *ct = NULL; + struct hlist_nulls_node *pos = (struct hlist_nulls_node *) (*iterate); +@@ -349,7 +342,7 @@ napt_ct_list_iterate(uint32_t *hash, uint32_t *iterate) + if(pos == 0) + { + /*get head for list*/ +- pos = rcu_dereference((&net->ct.hash[*hash])->first); ++ pos = rcu_dereference(hlist_nulls_first_rcu(&nf_conntrack_hash[*hash])); + } + + hlist_nulls_for_each_entry_from(h, pos, hnnode) +--- a/app/nathelper/linux/nat_ipt_helper.c ++++ b/app/nathelper/linux/nat_ipt_helper.c +@@ -534,10 +534,10 @@ nat_ipt_data_init(void) + memset(&old_replace, 0, sizeof (old_replace)); + + /*record ipt rule(SNAT) sequence for hw nat*/ +- memset(hw_nat_ipt_seq, 0, NAT_HW_NUM); ++ memset(hw_nat_ipt_seq, 0, sizeof(hw_nat_ipt_seq)); + + /*record ipt rule(SNAT) pubip index for hw nat*/ +- memset(hw_nat_pip_idx, 0, NAT_HW_NUM); ++ memset(hw_nat_pip_idx, 0, sizeof(hw_nat_pip_idx)); + } + + static void +--- a/make/linux_opt.mk ++++ b/make/linux_opt.mk +@@ -449,9 +449,6 @@ ifeq (KSLIB, $(MODULE_TYPE)) + else ifeq ($(ARCH), arm) + MODULE_INC += -I$(SYS_PATH) \ + -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ +- -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/7.5.0/include/ \ +- -I$(TOOL_PATH)/../../lib/armv7a-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.8.4/include/ \ +- -I$(TOOL_PATH)/../../lib/arm-rdk-linux-musleabi/gcc/arm-rdk-linux-musleabi/6.4.0/include/ \ + -I$(SYS_PATH)/include \ + -I$(SYS_PATH)/source \ + -I$(SYS_PATH)/source/include \ diff --git a/package/qca/nss/qca-ssdk/patches/0006-fix-mdio-probe-on-ipq806x.patch b/package/qca/nss/qca-ssdk/patches/0006-fix-mdio-probe-on-ipq806x.patch new file mode 100644 index 00000000000000..8e802fe2af40aa --- /dev/null +++ b/package/qca/nss/qca-ssdk/patches/0006-fix-mdio-probe-on-ipq806x.patch @@ -0,0 +1,11 @@ +--- a/src/init/ssdk_plat.c ++++ b/src/init/ssdk_plat.c +@@ -568,7 +568,7 @@ static int miibus_get(a_uint32_t dev_id) + if(reg_mode == HSL_REG_LOCAL_BUS) + mdio_node = of_find_compatible_node(NULL, NULL, "qcom,ipq40xx-mdio"); + else +- mdio_node = of_find_compatible_node(NULL, NULL, "virtual,mdio-gpio"); ++ mdio_node = of_find_compatible_node(NULL, NULL, "qcom,ipq8064-mdio"); + + if (!mdio_node) { + SSDK_ERROR("No MDIO node found in DTS!\n"); diff --git a/target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch b/target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch index 0ffa12eec0d09e..81b23e863ee3a2 100644 --- a/target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch +++ b/target/linux/ath25/patches-5.4/140-redboot_boardconfig.patch @@ -9,7 +9,7 @@ struct fis_image_desc { unsigned char name[16]; // Null terminated name uint32_t flash_base; // Address within FLASH of image -@@ -67,6 +69,7 @@ static int parse_redboot_partitions(stru +@@ -72,6 +74,7 @@ static int parse_redboot_partitions(stru const struct mtd_partition **pparts, struct mtd_part_parser_data *data) { @@ -17,7 +17,7 @@ int nrparts = 0; struct fis_image_desc *buf; struct mtd_partition *parts; -@@ -234,14 +237,15 @@ static int parse_redboot_partitions(stru +@@ -239,14 +242,15 @@ static int parse_redboot_partitions(stru } } #endif @@ -35,7 +35,7 @@ #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED if (nulllen > 0) { strcpy(nullname, nullstring); -@@ -260,6 +264,8 @@ static int parse_redboot_partitions(stru +@@ -265,6 +269,8 @@ static int parse_redboot_partitions(stru } #endif for ( ; iimg->size; parts[i].offset = fl->img->flash_base; parts[i].name = names; -@@ -293,6 +299,13 @@ static int parse_redboot_partitions(stru +@@ -298,6 +304,13 @@ static int parse_redboot_partitions(stru fl = fl->next; kfree(tmp_fl); } diff --git a/target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch b/target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch index 3302d6d247c330..343eedc0753e5d 100644 --- a/target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch +++ b/target/linux/ath25/patches-5.4/141-redboot_partition_scan.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/parsers/redboot.c +++ b/drivers/mtd/parsers/redboot.c -@@ -88,12 +88,18 @@ static int parse_redboot_partitions(stru +@@ -93,12 +93,18 @@ static int parse_redboot_partitions(stru parse_redboot_of(master); @@ -19,7 +19,7 @@ return -EIO; } offset -= master->erasesize; -@@ -106,10 +112,6 @@ static int parse_redboot_partitions(stru +@@ -111,10 +117,6 @@ static int parse_redboot_partitions(stru goto nogood; } } @@ -30,7 +30,7 @@ printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n", master->name, offset); -@@ -182,6 +184,11 @@ static int parse_redboot_partitions(stru +@@ -187,6 +189,11 @@ static int parse_redboot_partitions(stru } if (i == numslots) { /* Didn't find it */ diff --git a/target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch b/target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch index 2ac0eb92bf1578..55cf84eeff8d9a 100644 --- a/target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch +++ b/target/linux/ath25/patches-5.4/142-redboot_various_erase_size_fix.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/parsers/redboot.c +++ b/drivers/mtd/parsers/redboot.c -@@ -65,6 +65,22 @@ static void parse_redboot_of(struct mtd_ +@@ -70,6 +70,22 @@ static void parse_redboot_of(struct mtd_ directory = dirblock; } @@ -23,7 +23,7 @@ static int parse_redboot_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -81,6 +97,7 @@ static int parse_redboot_partitions(stru +@@ -86,6 +102,7 @@ static int parse_redboot_partitions(stru int namelen = 0; int nulllen = 0; int numslots; @@ -31,7 +31,7 @@ unsigned long offset; #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED static char nullstring[] = "unallocated"; -@@ -195,7 +212,10 @@ static int parse_redboot_partitions(stru +@@ -200,7 +217,10 @@ static int parse_redboot_partitions(stru goto out; } @@ -43,7 +43,7 @@ struct fis_list *new_fl, **prev; if (buf[i].name[0] == 0xff) { -@@ -271,12 +291,13 @@ static int parse_redboot_partitions(stru +@@ -276,12 +296,13 @@ static int parse_redboot_partitions(stru } #endif for ( ; iimg->name); #ifdef CONFIG_MTD_REDBOOT_PARTS_READONLY if (!memcmp(names, "RedBoot", 8) || -@@ -306,7 +327,9 @@ static int parse_redboot_partitions(stru +@@ -311,7 +332,9 @@ static int parse_redboot_partitions(stru fl = fl->next; kfree(tmp_fl); } diff --git a/target/linux/ath79/Makefile b/target/linux/ath79/Makefile index 4063867ce31276..a1669b6b451b1e 100644 --- a/target/linux/ath79/Makefile +++ b/target/linux/ath79/Makefile @@ -8,7 +8,7 @@ SUBTARGETS:=generic mikrotik nand tiny FEATURES:=ramdisk squashfs usbgadget -KERNEL_PATCHVER:=5.4 +KERNEL_PATCHVER:=5.10 KERNEL_TESTING_PATCHVER:=5.10 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/ath79/config-5.10 b/target/linux/ath79/config-5.10 index d4abddb4453a19..c95c073563043d 100644 --- a/target/linux/ath79/config-5.10 +++ b/target/linux/ath79/config-5.10 @@ -72,6 +72,7 @@ CONFIG_GPIOLIB_IRQCHIP=y CONFIG_GPIO_74X164=y CONFIG_GPIO_ATH79=y CONFIG_GPIO_GENERIC=y +# CONFIG_GPIO_LATCH is not set CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y diff --git a/target/linux/ath79/config-5.4 b/target/linux/ath79/config-5.4 index b39d5ec9643ec2..e37b728554c97e 100644 --- a/target/linux/ath79/config-5.4 +++ b/target/linux/ath79/config-5.4 @@ -90,6 +90,7 @@ CONFIG_GPIOLIB_IRQCHIP=y CONFIG_GPIO_74X164=y CONFIG_GPIO_ATH79=y CONFIG_GPIO_GENERIC=y +# CONFIG_GPIO_LATCH is not set CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y @@ -172,6 +173,7 @@ CONFIG_MTD_CFI_GEOMETRY=y CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_MAP_BANK_WIDTH_1 is not set # CONFIG_MTD_MAP_BANK_WIDTH_4 is not set +# CONFIG_MTD_NAND_RB91X is not set CONFIG_MTD_PARSER_CYBERTAN=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y diff --git a/target/linux/ath79/dts/ar7100.dtsi b/target/linux/ath79/dts/ar7100.dtsi index ec6ff30ab69a1b..86673cb5da3876 100644 --- a/target/linux/ath79/dts/ar7100.dtsi +++ b/target/linux/ath79/dts/ar7100.dtsi @@ -57,7 +57,7 @@ gpio: gpio@18040000 { compatible = "qca,ar7100-gpio"; - reg = <0x18040000 0x30>; + reg = <0x18040000 0x28>; interrupts = <2>; ngpios = <16>; diff --git a/target/linux/ath79/dts/ar7161_siemens_ws-ap3610.dts b/target/linux/ath79/dts/ar7161_siemens_ws-ap3610.dts index 9eaf5aaa1d741b..2cdcce0d152790 100644 --- a/target/linux/ath79/dts/ar7161_siemens_ws-ap3610.dts +++ b/target/linux/ath79/dts/ar7161_siemens_ws-ap3610.dts @@ -110,7 +110,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <25000000>; + spi-max-frequency = <50000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ath79/dts/ar724x.dtsi b/target/linux/ath79/dts/ar724x.dtsi index 25d72a786c5048..882b0bc51a93e3 100644 --- a/target/linux/ath79/dts/ar724x.dtsi +++ b/target/linux/ath79/dts/ar724x.dtsi @@ -50,7 +50,7 @@ gpio: gpio@18040000 { compatible = "qca,ar7240-gpio", "qca,ar7100-gpio"; - reg = <0x18040000 0x30>; + reg = <0x18040000 0x28>; interrupts = <2>; ngpios = <18>; diff --git a/target/linux/ath79/dts/ar9132.dtsi b/target/linux/ath79/dts/ar9132.dtsi index 37fc32e6d69271..44a5870ad7afe3 100644 --- a/target/linux/ath79/dts/ar9132.dtsi +++ b/target/linux/ath79/dts/ar9132.dtsi @@ -77,7 +77,7 @@ gpio: gpio@18040000 { compatible = "qca,ar9132-gpio", "qca,ar7100-gpio"; - reg = <0x18040000 0x30>; + reg = <0x18040000 0x28>; interrupts = <2>; ngpios = <22>; diff --git a/target/linux/ath79/dts/ar9330.dtsi b/target/linux/ath79/dts/ar9330.dtsi index 7607fede4925d8..06e1cf4601d16d 100644 --- a/target/linux/ath79/dts/ar9330.dtsi +++ b/target/linux/ath79/dts/ar9330.dtsi @@ -49,7 +49,7 @@ gpio: gpio@18040000 { compatible = "qca,ar7100-gpio"; - reg = <0x18040000 0x34>; + reg = <0x18040000 0x28>; interrupts = <2>; ngpios = <30>; diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts new file mode 100644 index 00000000000000..c394cf1cb85331 --- /dev/null +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -0,0 +1,193 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9331.dtsi" + +#include +#include + +/ { + model = "Teltonika RUT230 v1"; + compatible = "teltonika,rut230-v1", "qca,ar9331"; + + aliases { + label-mac-device = &wmac; + led-boot = &led_ss0; + led-failsafe = &led_ss0; + led-upgrade = &led_ss0; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + debounce-interval = <60>; + }; + + input { + label = "input"; + linux,code = ; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + sim-tray { + label = "sim-tray"; + linux,code = ; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&switch_led_disable_pins>; + + led_ss0: signal-strength-0 { + label = "green:signal-strength-0"; + gpios = <&gpio 23 GPIO_ACTIVE_HIGH>; + }; + + signal-strength-1 { + label = "green:signal-strength-1"; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + }; + + signal-strength-2 { + label = "green:signal-strength-2"; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + }; + + signal-strength-3 { + label = "green:signal-strength-3"; + gpios = <&gpio 26 GPIO_ACTIVE_HIGH>; + }; + + signal-strength-4 { + label = "green:signal-strength4"; + gpios = <&gpio 27 GPIO_ACTIVE_HIGH>; + }; + + 2g { + label = "green:2g"; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + }; + + 3g { + label = "green:3g"; + gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + }; + + lan { + label = "green:lan"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + /* GPIO 13 - ACTIVE HIGH for hwrev 0 */ + }; + + wan { + label = "green:wan"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + /* GPIO 14 - ACTIVE HIGH for hwrev 0 */ + }; + + /* 4G LED - GPIO21 ACTIVE_HIGH for RUT240 */ + }; + + reg_usb_vbus: reg_usb_vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 19 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; +}; + +ð0 { + status = "okay"; + + mtd-mac-address = <&config 0x0>; +}; + +ð1 { + status = "okay"; + + mtd-mac-address = <&config 0x0>; + mtd-mac-address-increment = <1>; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <30000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + config: partition@20000 { + label = "config"; + reg = <0x20000 0x10000>; + read-only; + }; + + art: partition@30000 { + label = "art"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x40000 0xf30000>; + }; + + partition@f70000 { + label = "event-log"; + reg = <0xf70000 0x90000>; + read-only; + }; + }; + }; +}; + +&usb { + dr_mode = "host"; + vbus-supply = <®_usb_vbus>; + status = "okay"; +}; + +&gpio { + modem-power { + gpio-hog; + output-low; + gpios = <18 GPIO_ACTIVE_HIGH>; + line-name = "modem-power"; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&config 0x0>; + mtd-mac-address-increment = <2>; +}; diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts new file mode 100644 index 00000000000000..ee2c12b4e0704c --- /dev/null +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts @@ -0,0 +1,218 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ar9344.dtsi" + +#include +#include + +/ { + compatible = "mikrotik,routerboard-912uag-2hpnd", "qca,ar9342"; + model = "MikroTik RouterBOARD 912UAG-2HPnD"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + gpio_latch: gpio_latch { + compatible = "gpio-latch"; + gpio-controller; + #gpio-cells = <2>; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>, + <&gpio 1 GPIO_ACTIVE_HIGH>, + <&gpio 2 GPIO_ACTIVE_HIGH>, + <&gpio 3 GPIO_ACTIVE_HIGH>, + <0>, /* Not connected */ + <&gpio 13 GPIO_ACTIVE_HIGH>, + <&gpio 14 GPIO_ACTIVE_HIGH>, + <&gpio 15 GPIO_ACTIVE_HIGH>, + <&gpio 11 GPIO_ACTIVE_LOW>; /* Latch Enable */ + }; + + nand_gpio { + compatible = "mikrotik,rb91x-nand"; + + gpios = <&gpio_latch 3 GPIO_ACTIVE_HIGH>, /* Read */ + <&gpio 4 GPIO_ACTIVE_HIGH>, /* Ready (RDY) */ + <&gpio_latch 5 GPIO_ACTIVE_LOW>, /* Chip Enable (nCE) */ + <&gpio_latch 6 GPIO_ACTIVE_HIGH>, /* Command Latch Enable (CLE) */ + <&gpio_latch 7 GPIO_ACTIVE_HIGH>, /* Address Latch Enable (ALE) */ + <&gpio 12 GPIO_ACTIVE_LOW>, /* Read/Write Enable (nRW) */ + <&gpio_latch 8 GPIO_ACTIVE_LOW>; /* Latch Enable (nLE) */ + + partitions { + compatible = "fixed-partitions"; + #size-cells = <1>; + + partition@0 { + label = "booter"; + reg = <0x0 0x0040000>; + read-only; + }; + + partition@40000 { + label = "kernel"; + reg = <0x0040000 0x03c0000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x0400000 0x7c00000>; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + gpios = <&gpio_latch 1 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + user { + label = "green:user"; + gpios = <&gpio_latch 2 GPIO_ACTIVE_HIGH>; + }; + + led1 { + label = "green:led1"; + gpios = <&ssr 0 GPIO_ACTIVE_HIGH>; + }; + + led2 { + label = "green:led2"; + gpios = <&ssr 1 GPIO_ACTIVE_HIGH>; + }; + + led3 { + label = "green:led3"; + gpios = <&ssr 2 GPIO_ACTIVE_HIGH>; + }; + + led4 { + label = "green:led4"; + gpios = <&ssr 3 GPIO_ACTIVE_HIGH>; + }; + + led5 { + label = "green:led5"; + gpios = <&ssr 4 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + beeper { + gpio-export,name = "beeper"; + gpio-export,output = <1>; /* Must be 1 to avoid EMI induced clicking noise */ + gpios = <&ssr 5 GPIO_ACTIVE_HIGH>; + }; + + usb_power { + gpio-export,name = "power-usb"; + gpio-export,output = <1>; + gpios = <&ssr 6 GPIO_ACTIVE_HIGH>; + }; + + pcie_power { + gpio-export,name = "power-pcie"; + gpio-export,output = <0>; + gpios = <&ssr 7 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + status = "okay"; + + compatible = "qca,ar7100-spi"; + + cs-gpios = <0>, <&gpio_latch 0 GPIO_ACTIVE_LOW>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "routerboot"; + reg = <0x0 0x0>; + read-only; + }; + + hard_config: hard_config { + read-only; + }; + + bios { + size = <0x1000>; + read-only; + }; + + soft_config { + }; + }; + }; + + ssr: ssr@1 { + compatible = "fairchild,74hc595"; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + reg = <1>; + spi-max-frequency = <50000000>; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +ð0 { + status = "okay"; + + phy-mode = "rgmii-id"; + phy-handle = <&phy0>; + pll-data = <0x02000000 0x00000101 0x00001313>; + + gmac-config { + device = <&gmac>; + rgmii-gmac0 = <1>; + rgmii-enabled = <1>; + rxd-delay = <1>; + txd-delay = <1>; + }; +}; + +&wmac { + status = "okay"; + qca,no-eeprom; +}; + +&pcie { + status = "okay"; +}; + +&usb { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; diff --git a/target/linux/ath79/dts/ar9342_ubnt_powerbeam-m-xw.dts b/target/linux/ath79/dts/ar9342_ubnt_powerbeam-m-xw.dts new file mode 100644 index 00000000000000..6db058f887f52f --- /dev/null +++ b/target/linux/ath79/dts/ar9342_ubnt_powerbeam-m-xw.dts @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9342_ubnt_xw.dtsi" + +/ { + compatible = "ubnt,powerbeam-m-xw", "ubnt,xw", "qca,ar9342"; + model = "Ubiquiti PowerBeam M (XW)"; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <4>; + + phy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +ð0 { + status = "okay"; + + /* default for ar934x, except for 1000M and 10M */ + pll-data = <0x02000000 0x00000101 0x00001313>; + + phy-mode = "rgmii-id"; + phy-handle = <&phy4>; + + gmac-config { + device = <&gmac>; + rxd-delay = <3>; + rxdv-delay = <3>; + }; +}; diff --git a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts index e7ef02054eef92..cf02b711fa501d 100644 --- a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts +++ b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts @@ -72,7 +72,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <25000000>; + spi-max-frequency = <50000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ath79/dts/ar934x.dtsi b/target/linux/ath79/dts/ar934x.dtsi index 42fbab4b6075ec..84dbe65f855f32 100644 --- a/target/linux/ath79/dts/ar934x.dtsi +++ b/target/linux/ath79/dts/ar934x.dtsi @@ -78,7 +78,7 @@ gpio: gpio@18040000 { compatible = "qca,ar9340-gpio"; - reg = <0x18040000 0x2c>; + reg = <0x18040000 0x28>; interrupts = <2>; ngpios = <23>; diff --git a/target/linux/ath79/dts/qca9558_arris_sbr-ac1750.dts b/target/linux/ath79/dts/qca9558_arris_sbr-ac1750.dts index 8a505a194439e9..cfbf9697dfa529 100644 --- a/target/linux/ath79/dts/qca9558_arris_sbr-ac1750.dts +++ b/target/linux/ath79/dts/qca9558_arris_sbr-ac1750.dts @@ -133,7 +133,7 @@ reg = <0x100000 0x100000>; }; - kernel: partition@200000 { + partition@200000 { label = "kernel"; reg = <0x200000 0x400000>; }; @@ -160,16 +160,6 @@ reg = <0x6d00000 0x100000>; read-only; }; - - kfs: partition@kfs { - label = "kfs"; - reg = <0x200000 0x2400000>; - }; - - kfs2: partition@kfs2 { - label = "kfs2"; - reg = <0x2600000 0x2400000>; - }; }; }; diff --git a/target/linux/ath79/dts/qca9558_ocedo_koala.dts b/target/linux/ath79/dts/qca9558_ocedo_koala.dts index aa3876acb155b6..fd54a6e8c21837 100644 --- a/target/linux/ath79/dts/qca9558_ocedo_koala.dts +++ b/target/linux/ath79/dts/qca9558_ocedo_koala.dts @@ -69,7 +69,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <25000000>; + spi-max-frequency = <50000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts index dc8329f976d727..05c2d2d1dca7e5 100644 --- a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts +++ b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts @@ -40,7 +40,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <25000000>; + spi-max-frequency = <50000000>; partitions { compatible = "fixed-partitions"; diff --git a/target/linux/ath79/dts/qca9563_tplink_re455-v1.dts b/target/linux/ath79/dts/qca9563_tplink_re455-v1.dts new file mode 100644 index 00000000000000..b6c1efb8463ff0 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_tplink_re455-v1.dts @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_tplink_re450.dtsi" + +/ { + compatible = "tplink,re455-v1", "qca,qca9563"; + model = "TP-Link RE455 v1"; +}; + +&partitions { + partition@0 { + label = "u-boot"; + reg = <0x000000 0x020000>; + read-only; + }; + + info: partition@20000 { + label = "info"; + reg = <0x020000 0x002000>; + read-only; + }; + + partition@22000 { + label = "partition-table"; + reg = <0x022000 0x002000>; + read-only; + }; + + partition@24000 { + label = "info2"; + reg = <0x024000 0x00a000>; + read-only; + }; + + partition@2e000 { + label = "config"; + reg = <0x02e000 0x022000>; + read-only; + }; + + partition@50000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x050000 0x7a0000>; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x010000>; + read-only; + }; +}; diff --git a/target/linux/ath79/dts/tp9343_tplink_tl-wr941hp-v1.dts b/target/linux/ath79/dts/tp9343_tplink_tl-wr941hp-v1.dts new file mode 100644 index 00000000000000..7451f00740bebc --- /dev/null +++ b/target/linux/ath79/dts/tp9343_tplink_tl-wr941hp-v1.dts @@ -0,0 +1,154 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca956x.dtsi" + +#include +#include + +/ { + compatible = "tplink,tl-wr941hp-v1", "qca,tp9343"; + model = "TP-Link TL-WR941HP v1"; + + aliases { + label-mac-device = &wmac; + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + leds { + compatible = "gpio-leds"; + + re { + label = "blue:re"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + + wifi { + label = "blue:wifi"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_power: power { + label = "blue:power"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + wan_blue { + label = "blue:wan"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + wan_red { + label = "red:wan"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + lan { + label = "blue:lan"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "blue:wps"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + re { + label = "range extender button"; + linux,code = ; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wifi { + label = "wifi button"; + linux,code = ; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + reset { + label = "reset button"; + linux,code = ; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wps { + label = "wps button"; + linux,code = ; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x0 0x020000>; + read-only; + }; + + partition@20000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x020000 0x730000>; + }; + + config: partition@750000 { + label = "config"; + reg = <0x750000 0x0a0000>; + read-only; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x010000>; + read-only; + }; + }; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy0>; + + mtd-mac-address = <&config 0x8>; + mtd-mac-address-increment = <1>; +}; + +ð1 { + status = "okay"; + + mtd-mac-address = <&config 0x8>; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&config 0x8>; +}; diff --git a/target/linux/ath79/files/drivers/gpio/gpio-latch.c b/target/linux/ath79/files/drivers/gpio/gpio-latch.c new file mode 100644 index 00000000000000..f3545a663e0d02 --- /dev/null +++ b/target/linux/ath79/files/drivers/gpio/gpio-latch.c @@ -0,0 +1,203 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * GPIO latch driver + * + * Copyright (C) 2014 Gabor Juhos + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GPIO_LATCH_DRIVER_NAME "gpio-latch" +#define GPIO_LATCH_LINES 9 + +struct gpio_latch_chip { + struct gpio_chip gc; + struct mutex mutex; + struct mutex latch_mutex; + bool latch_enabled; + int le_gpio; + bool le_active_low; + struct gpio_desc *gpios[GPIO_LATCH_LINES]; +}; + +static inline struct gpio_latch_chip *to_gpio_latch_chip(struct gpio_chip *gc) +{ + return container_of(gc, struct gpio_latch_chip, gc); +} + +static void gpio_latch_lock(struct gpio_latch_chip *glc, bool enable) +{ + mutex_lock(&glc->mutex); + + if (enable) + glc->latch_enabled = true; + + if (glc->latch_enabled) + mutex_lock(&glc->latch_mutex); +} + +static void gpio_latch_unlock(struct gpio_latch_chip *glc, bool disable) +{ + if (glc->latch_enabled) + mutex_unlock(&glc->latch_mutex); + + if (disable) + glc->latch_enabled = true; + + mutex_unlock(&glc->mutex); +} + +static int +gpio_latch_get(struct gpio_chip *gc, unsigned offset) +{ + struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); + int ret; + + gpio_latch_lock(glc, false); + ret = gpiod_get_value(glc->gpios[offset]); + gpio_latch_unlock(glc, false); + + return ret; +} + +static void +gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value) +{ + struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); + bool enable_latch = false; + bool disable_latch = false; + + if (offset == glc->le_gpio) { + enable_latch = value ^ glc->le_active_low; + disable_latch = !enable_latch; + } + + gpio_latch_lock(glc, enable_latch); + gpiod_set_raw_value(glc->gpios[offset], value); + gpio_latch_unlock(glc, disable_latch); +} + +static int +gpio_latch_direction_output(struct gpio_chip *gc, unsigned offset, int value) +{ + struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); + bool enable_latch = false; + bool disable_latch = false; + int ret; + + if (offset == glc->le_gpio) { + enable_latch = value ^ glc->le_active_low; + disable_latch = !enable_latch; + } + + gpio_latch_lock(glc, enable_latch); + ret = gpiod_direction_output_raw(glc->gpios[offset], value); + gpio_latch_unlock(glc, disable_latch); + + return ret; +} + +static int gpio_latch_probe(struct platform_device *pdev) +{ + struct gpio_latch_chip *glc; + struct gpio_chip *gc; + struct device *dev = &pdev->dev; + struct device_node *of_node = dev->of_node; + int i, n; + + glc = devm_kzalloc(dev, sizeof(*glc), GFP_KERNEL); + if (!glc) + return -ENOMEM; + + mutex_init(&glc->mutex); + mutex_init(&glc->latch_mutex); + + n = gpiod_count(dev, NULL); + if (n <= 0) { + dev_err(dev, "failed to get gpios: %d\n", n); + return n; + } else if (n != GPIO_LATCH_LINES) { + dev_err(dev, "expected %d gpios\n", GPIO_LATCH_LINES); + return -EINVAL; + } + + for (i = 0; i < n; i++) { + glc->gpios[i] = devm_gpiod_get_index_optional(dev, NULL, i, + GPIOD_OUT_LOW); + if (IS_ERR(glc->gpios[i])) { + dev_err(dev, "failed to get gpio %d: %d\n", i, + PTR_ERR(glc->gpios[i])); + return PTR_ERR(glc->gpios[i]); + } + } + + glc->le_gpio = 8; + glc->le_active_low = gpiod_is_active_low(glc->gpios[glc->le_gpio]); + + if (!glc->gpios[glc->le_gpio]) { + dev_err(dev, "missing required latch-enable gpio %d\n", + glc->le_gpio); + return -EINVAL; + } + + gc = &glc->gc; + gc->label = GPIO_LATCH_DRIVER_NAME; + gc->can_sleep = true; + gc->base = -1; + gc->ngpio = GPIO_LATCH_LINES; + gc->get = gpio_latch_get; + gc->set = gpio_latch_set; + gc->direction_output = gpio_latch_direction_output; + gc->of_node = of_node; + + platform_set_drvdata(pdev, glc); + + i = gpiochip_add(&glc->gc); + if (i) { + dev_err(dev, "gpiochip_add() failed: %d\n", i); + return i; + } + + return 0; +} + +static int gpio_latch_remove(struct platform_device *pdev) +{ + struct gpio_latch_chip *glc = platform_get_drvdata(pdev); + + gpiochip_remove(&glc->gc); + return 0; +} + +static const struct of_device_id gpio_latch_match[] = { + { .compatible = GPIO_LATCH_DRIVER_NAME }, + {}, +}; + +MODULE_DEVICE_TABLE(of, gpio_latch_match); + +static struct platform_driver gpio_latch_driver = { + .probe = gpio_latch_probe, + .remove = gpio_latch_remove, + .driver = { + .name = GPIO_LATCH_DRIVER_NAME, + .owner = THIS_MODULE, + .of_match_table = gpio_latch_match, + }, +}; + +module_platform_driver(gpio_latch_driver); + +MODULE_DESCRIPTION("GPIO latch driver"); +MODULE_AUTHOR("Gabor Juhos "); +MODULE_AUTHOR("Denis Kalashnikov "); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" GPIO_LATCH_DRIVER_NAME); diff --git a/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c b/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c index ddc6d6d882c261..e040726f44f013 100644 --- a/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c +++ b/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c @@ -1273,7 +1273,6 @@ static int ar934x_nfc_setup_hwecc(struct ar934x_nfc *nfc) * Writing a subpage separately is not supported, because * the controller only does ECC on full-page accesses. */ - nand->options = NAND_NO_SUBPAGE_WRITE; nand->ecc.size = 512; nand->ecc.bytes = 7; @@ -1332,6 +1331,9 @@ static int ar934x_nfc_attach_chip(struct nand_chip *nand) if (ret) return ret; + if (mtd->writesize == 2048) + nand->options |= NAND_NO_SUBPAGE_WRITE; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) if (nand->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) { #else diff --git a/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c b/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c new file mode 100644 index 00000000000000..e2319445193afa --- /dev/null +++ b/target/linux/ath79/files/drivers/mtd/nand/raw/rb91x_nand.c @@ -0,0 +1,375 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * MikroTik RB91x NAND flash driver + * + * Main part is copied from original driver written by Gabor Juhos. + * + * Copyright (C) 2013-2014 Gabor Juhos + */ + +/* + * WARNING: to speed up NAND reading/writing we are working with SoC GPIO + * controller registers directly -- not through standard GPIO API. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* Bit masks for NAND data lines in ath79 gpio 32-bit register */ +#define RB91X_NAND_NRW_BIT BIT(12) +#define RB91X_NAND_DATA_BITS (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) \ + | BIT(13) | BIT(14) | BIT(15)) +#define RB91X_NAND_LOW_DATA_MASK 0x1f +#define RB91X_NAND_HIGH_DATA_MASK 0xe0 +#define RB91X_NAND_HIGH_DATA_SHIFT 8 + +enum rb91x_nand_gpios { + RB91X_NAND_READ,/* Read */ + RB91X_NAND_RDY, /* NAND Ready */ + RB91X_NAND_NCE, /* Chip Enable. Active low */ + RB91X_NAND_CLE, /* Command Latch Enable */ + RB91X_NAND_ALE, /* Address Latch Enable */ + RB91X_NAND_NRW, /* Read/Write. Active low */ + RB91X_NAND_NLE, /* Latch Enable. Active low */ + + RB91X_NAND_GPIOS, +}; + +struct rb91x_nand_drvdata { + struct nand_chip chip; + struct device *dev; + struct gpio_desc **gpio; + void __iomem *ath79_gpio_base; +}; + +static inline void rb91x_nand_latch_lock(struct rb91x_nand_drvdata *drvdata, + int lock) +{ + gpiod_set_value_cansleep(drvdata->gpio[RB91X_NAND_NLE], lock); +} + +static int rb91x_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *oobregion) +{ + switch (section) { + case 0: + oobregion->offset = 8; + oobregion->length = 3; + return 0; + case 1: + oobregion->offset = 13; + oobregion->length = 3; + return 0; + default: + return -ERANGE; + } +} + +static int rb91x_ooblayout_free(struct mtd_info *mtd, int section, + struct mtd_oob_region *oobregion) +{ + switch (section) { + case 0: + oobregion->offset = 0; + oobregion->length = 4; + return 0; + case 1: + oobregion->offset = 4; + oobregion->length = 1; + return 0; + case 2: + oobregion->offset = 6; + oobregion->length = 2; + return 0; + case 3: + oobregion->offset = 11; + oobregion->length = 2; + return 0; + default: + return -ERANGE; + } +} + +static const struct mtd_ooblayout_ops rb91x_nand_ecclayout_ops = { + .ecc = rb91x_ooblayout_ecc, + .free = rb91x_ooblayout_free, +}; + +static void rb91x_nand_write(struct rb91x_nand_drvdata *drvdata, + const u8 *buf, + unsigned len) +{ + void __iomem *base = drvdata->ath79_gpio_base; + u32 oe_reg; + u32 out_reg; + u32 out; + unsigned i; + + rb91x_nand_latch_lock(drvdata, 1); + + oe_reg = __raw_readl(base + AR71XX_GPIO_REG_OE); + out_reg = __raw_readl(base + AR71XX_GPIO_REG_OUT); + + /* Set data lines to output mode */ + __raw_writel(oe_reg & ~(RB91X_NAND_DATA_BITS | RB91X_NAND_NRW_BIT), + base + AR71XX_GPIO_REG_OE); + + out = out_reg & ~(RB91X_NAND_DATA_BITS | RB91X_NAND_NRW_BIT); + for (i = 0; i != len; i++) { + u32 data; + + data = (buf[i] & RB91X_NAND_HIGH_DATA_MASK) << + RB91X_NAND_HIGH_DATA_SHIFT; + data |= buf[i] & RB91X_NAND_LOW_DATA_MASK; + data |= out; + __raw_writel(data, base + AR71XX_GPIO_REG_OUT); + + /* Deactivate WE line */ + data |= RB91X_NAND_NRW_BIT; + __raw_writel(data, base + AR71XX_GPIO_REG_OUT); + /* Flush write */ + __raw_readl(base + AR71XX_GPIO_REG_OUT); + } + + /* Restore registers */ + __raw_writel(out_reg, base + AR71XX_GPIO_REG_OUT); + __raw_writel(oe_reg, base + AR71XX_GPIO_REG_OE); + /* Flush write */ + __raw_readl(base + AR71XX_GPIO_REG_OUT); + + rb91x_nand_latch_lock(drvdata, 0); +} + +static void rb91x_nand_read(struct rb91x_nand_drvdata *drvdata, + u8 *read_buf, + unsigned len) +{ + void __iomem *base = drvdata->ath79_gpio_base; + u32 oe_reg; + u32 out_reg; + unsigned i; + + /* Enable read mode */ + gpiod_set_value_cansleep(drvdata->gpio[RB91X_NAND_READ], 1); + + rb91x_nand_latch_lock(drvdata, 1); + + /* Save registers */ + oe_reg = __raw_readl(base + AR71XX_GPIO_REG_OE); + out_reg = __raw_readl(base + AR71XX_GPIO_REG_OUT); + + /* Set data lines to input mode */ + __raw_writel(oe_reg | RB91X_NAND_DATA_BITS, + base + AR71XX_GPIO_REG_OE); + + for (i = 0; i < len; i++) { + u32 in; + u8 data; + + /* Activate RE line */ + __raw_writel(RB91X_NAND_NRW_BIT, base + AR71XX_GPIO_REG_CLEAR); + /* Flush write */ + __raw_readl(base + AR71XX_GPIO_REG_CLEAR); + + /* Read input lines */ + in = __raw_readl(base + AR71XX_GPIO_REG_IN); + + /* Deactivate RE line */ + __raw_writel(RB91X_NAND_NRW_BIT, base + AR71XX_GPIO_REG_SET); + + data = (in & RB91X_NAND_LOW_DATA_MASK); + data |= (in >> RB91X_NAND_HIGH_DATA_SHIFT) & + RB91X_NAND_HIGH_DATA_MASK; + + read_buf[i] = data; + } + + /* Restore registers */ + __raw_writel(out_reg, base + AR71XX_GPIO_REG_OUT); + __raw_writel(oe_reg, base + AR71XX_GPIO_REG_OE); + /* Flush write */ + __raw_readl(base + AR71XX_GPIO_REG_OUT); + + rb91x_nand_latch_lock(drvdata, 0); + + /* Disable read mode */ + gpiod_set_value_cansleep(drvdata->gpio[RB91X_NAND_READ], 0); +} + +static int rb91x_nand_dev_ready(struct nand_chip *chip) +{ + struct rb91x_nand_drvdata *drvdata = (struct rb91x_nand_drvdata *)(chip->priv); + + return gpiod_get_value_cansleep(drvdata->gpio[RB91X_NAND_RDY]); +} + +static void rb91x_nand_cmd_ctrl(struct nand_chip *chip, int cmd, + unsigned int ctrl) +{ + struct rb91x_nand_drvdata *drvdata = chip->priv; + + if (ctrl & NAND_CTRL_CHANGE) { + gpiod_set_value_cansleep(drvdata->gpio[RB91X_NAND_CLE], + (ctrl & NAND_CLE) ? 1 : 0); + gpiod_set_value_cansleep(drvdata->gpio[RB91X_NAND_ALE], + (ctrl & NAND_ALE) ? 1 : 0); + gpiod_set_value_cansleep(drvdata->gpio[RB91X_NAND_NCE], + (ctrl & NAND_NCE) ? 1 : 0); + } + + if (cmd != NAND_CMD_NONE) { + u8 t = cmd; + + rb91x_nand_write(drvdata, &t, 1); + } +} + +static u8 rb91x_nand_read_byte(struct nand_chip *chip) +{ + u8 data = 0xff; + + rb91x_nand_read(chip->priv, &data, 1); + + return data; +} + +static void rb91x_nand_read_buf(struct nand_chip *chip, u8 *buf, int len) +{ + rb91x_nand_read(chip->priv, buf, len); +} + +static void rb91x_nand_write_buf(struct nand_chip *chip, const u8 *buf, int len) +{ + rb91x_nand_write(chip->priv, buf, len); +} + +static void rb91x_nand_release(struct rb91x_nand_drvdata *drvdata) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0) + mtd_device_unregister(nand_to_mtd(&drvdata->chip)); + nand_cleanup(&drvdata->chip); +#else + nand_release(&drvdata->chip); +#endif +} + +static int rb91x_nand_probe(struct platform_device *pdev) +{ + struct rb91x_nand_drvdata *drvdata; + struct mtd_info *mtd; + int r; + struct device *dev = &pdev->dev; + struct gpio_descs *gpios; + + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + platform_set_drvdata(pdev, drvdata); + + gpios = gpiod_get_array(dev, NULL, GPIOD_OUT_LOW); + if (IS_ERR(gpios)) { + dev_err(dev, "failed to get gpios: %d\n", (int)gpios); + return -EINVAL; + } + + if (gpios->ndescs != RB91X_NAND_GPIOS) { + dev_err(dev, "expected %d gpios\n", RB91X_NAND_GPIOS); + return -EINVAL; + } + + drvdata->gpio = gpios->desc; + + gpiod_direction_input(drvdata->gpio[RB91X_NAND_RDY]); + + drvdata->ath79_gpio_base = ioremap(AR71XX_GPIO_BASE, AR71XX_GPIO_SIZE); + + drvdata->dev = dev; + + drvdata->chip.priv = drvdata; + + drvdata->chip.legacy.cmd_ctrl = rb91x_nand_cmd_ctrl; + drvdata->chip.legacy.dev_ready = rb91x_nand_dev_ready; + drvdata->chip.legacy.read_byte = rb91x_nand_read_byte; + drvdata->chip.legacy.write_buf = rb91x_nand_write_buf; + drvdata->chip.legacy.read_buf = rb91x_nand_read_buf; + + drvdata->chip.legacy.chip_delay = 25; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) + drvdata->chip.ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; + drvdata->chip.ecc.algo = NAND_ECC_ALGO_HAMMING; +#else + drvdata->chip.ecc.mode = NAND_ECC_SOFT; + drvdata->chip.ecc.algo = NAND_ECC_HAMMING; +#endif + drvdata->chip.options = NAND_NO_SUBPAGE_WRITE; + + r = nand_scan(&drvdata->chip, 1); + if (r) { + dev_err(dev, "nand_scan() failed: %d\n", r); + return r; + } + + mtd = nand_to_mtd(&drvdata->chip); + mtd->dev.parent = dev; + mtd_set_of_node(mtd, dev->of_node); + mtd->owner = THIS_MODULE; + if (mtd->writesize == 512) + mtd_set_ooblayout(mtd, &rb91x_nand_ecclayout_ops); + + r = mtd_device_register(mtd, NULL, 0); + if (r) { + dev_err(dev, "mtd_device_register() failed: %d\n", + r); + goto err_release_nand; + } + + return 0; + +err_release_nand: + rb91x_nand_release(drvdata); + return r; +} + +static int rb91x_nand_remove(struct platform_device *pdev) +{ + struct rb91x_nand_drvdata *drvdata = platform_get_drvdata(pdev); + + rb91x_nand_release(drvdata); + + return 0; +} + +static const struct of_device_id rb91x_nand_match[] = { + { .compatible = "mikrotik,rb91x-nand" }, + {}, +}; + +MODULE_DEVICE_TABLE(of, rb91x_nand_match); + +static struct platform_driver rb91x_nand_driver = { + .probe = rb91x_nand_probe, + .remove = rb91x_nand_remove, + .driver = { + .name = "rb91x-nand", + .owner = THIS_MODULE, + .of_match_table = rb91x_nand_match, + }, +}; + +module_platform_driver(rb91x_nand_driver); + +MODULE_DESCRIPTION("MikrotTik RB91x NAND flash driver"); +MODULE_VERSION(DRV_VERSION); +MODULE_AUTHOR("Gabor Juhos "); +MODULE_AUTHOR("Denis Kalashnikov "); +MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 8d169285af9c93..326db4c6686576 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -279,6 +279,10 @@ qihoo,c301) samsung,wam250) ucidef_set_led_netdev "lan" "LAN" "white:lan" "eth0" ;; +teltonika,rut230-v1) + ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" + ucidef_set_led_switch "lan" "LAN" "green:lan" "switch0" "0x04" + ;; tplink,archer-a7-v5|\ tplink,archer-c7-v4|\ tplink,archer-c7-v5) @@ -351,7 +355,8 @@ tplink,tl-wr902ac-v1) tplink,re355-v1|\ tplink,re450-v1|\ tplink,re450-v2|\ -tplink,re450-v3) +tplink,re450-v3|\ +tplink,re455-v1) ucidef_set_led_netdev "lan_data" "LAN Data" "green:lan_data" "eth0" "tx rx" ucidef_set_led_netdev "lan_link" "LAN Link" "green:lan_link" "eth0" "link" ;; @@ -380,6 +385,10 @@ tplink,tl-wr842n-v2) ucidef_set_led_switch "lan3" "LAN3" "green:lan3" "switch0" "0x10" ucidef_set_led_switch "lan4" "LAN4" "green:lan4" "switch0" "0x02" ;; +tplink,tl-wr941hp-v1) + ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1" "link tx rx" + ucidef_set_led_switch "lan" "LAN" "blue:lan" "switch0" "0x1e" + ;; trendnet,tew-823dru) ucidef_set_led_netdev "wan" "WAN" "green:planet" "eth0" ;; @@ -403,6 +412,7 @@ ubnt,nanostation-loco-m-xw|\ ubnt,nanostation-m|\ ubnt,nanostation-m-xw|\ ubnt,picostation-m|\ +ubnt,powerbeam-m-xw|\ ubnt,powerbridge-m|\ ubnt,rocket-m) ucidef_set_rssimon "wlan0" "200000" "1" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 2afdc3d88f5a31..50579989ab1d97 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -70,6 +70,7 @@ ath79_setup_interfaces() tplink,re450-v1|\ tplink,re450-v2|\ tplink,re450-v3|\ + tplink,re455-v1|\ tplink,tl-wr902ac-v1|\ ubnt,bullet-ac|\ ubnt,bullet-m-ar7240|\ @@ -85,6 +86,7 @@ ath79_setup_interfaces() ubnt,picostation-m|\ ubnt,powerbeam-5ac-500|\ ubnt,powerbeam-5ac-gen2|\ + ubnt,powerbeam-m-xw|\ ubnt,powerbridge-m|\ ubnt,rocket-5ac-lite|\ ubnt,rocket-m|\ @@ -399,7 +401,8 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4" ;; - tplink,tl-wr842n-v2) + tplink,tl-wr842n-v2|\ + tplink,tl-wr941hp-v1) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 3dc3c87d90459a..46bd303bb0eb12 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -141,7 +141,8 @@ case "$FIRMWARE" in ;; tplink,eap245-v1|\ tplink,re450-v2|\ - tplink,re450-v3) + tplink,re450-v3|\ + tplink,re455-v1) caldata_extract "art" 0x5000 0x844 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) 1) ;; diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile index 72f92428018f81..e47a22094677f5 100644 --- a/target/linux/ath79/image/Makefile +++ b/target/linux/ath79/image/Makefile @@ -91,7 +91,7 @@ define Device/Default COMPILE := IMAGES := sysupgrade.bin IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \ - append-rootfs | pad-rootfs | append-metadata | check-size + append-rootfs | pad-rootfs | check-size | append-metadata endef include $(SUBTARGET).mk diff --git a/target/linux/ath79/image/common-mikrotik.mk b/target/linux/ath79/image/common-mikrotik.mk index 6e739f2d85be2e..5f5fa7899a0797 100644 --- a/target/linux/ath79/image/common-mikrotik.mk +++ b/target/linux/ath79/image/common-mikrotik.mk @@ -9,7 +9,7 @@ define Device/mikrotik_nor $(Device/mikrotik) IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 -e | \ pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata endef define Device/mikrotik_nand diff --git a/target/linux/ath79/image/common-netgear.mk b/target/linux/ath79/image/common-netgear.mk index 8a74fdc0c9d9fe..5a61caf1f64249 100644 --- a/target/linux/ath79/image/common-netgear.mk +++ b/target/linux/ath79/image/common-netgear.mk @@ -32,10 +32,8 @@ define Device/netgear_generic KERNEL := kernel-bin | append-dtb | lzma -d20 | uImage lzma KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | uImage lzma IMAGES += factory.img - IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | \ - append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size - IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | \ - check-size + IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + netgear-squashfs | append-rootfs | pad-rootfs + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata + IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size endef diff --git a/target/linux/ath79/image/common-tp-link.mk b/target/linux/ath79/image/common-tp-link.mk index 0b7b0e1935aee9..f1d5614aa75616 100644 --- a/target/linux/ath79/image/common-tp-link.mk +++ b/target/linux/ath79/image/common-tp-link.mk @@ -22,8 +22,7 @@ define Device/tplink-v2 TPLINK_HVERSION := 3 KERNEL := kernel-bin | append-dtb | lzma KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-v2-header - IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := tplink-v2-image -s | check-size | append-metadata endef define Device/tplink-nolzma @@ -74,7 +73,7 @@ define Device/tplink-safeloader KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O KERNEL_INITRAMFS := $$(KERNEL) IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \ - append-metadata | check-size + check-size | append-metadata IMAGE/factory.bin := append-rootfs | tplink-safeloader factory endef diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index bce5fc561dfe3d..9ad70c975f4e18 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -486,6 +486,18 @@ define Device/tplink_re450-v3 endef TARGET_DEVICES += tplink_re450-v3 +define Device/tplink_re455-v1 + $(Device/tplink-safeloader) + SOC := qca9563 + IMAGE_SIZE := 7808k + DEVICE_MODEL := RE455 + DEVICE_VARIANT := v1 + DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct + TPLINK_BOARD_ID := RE455-V1 + LOADER_TYPE := elf +endef +TARGET_DEVICES += tplink_re455-v1 + define Device/tplink_tl-mr6400-v1 $(Device/tplink-8mlzma) SOC := qca9531 @@ -564,6 +576,18 @@ define Device/tplink_tl-wdr4900-v2 endef TARGET_DEVICES += tplink_tl-wdr4900-v2 +define Device/tplink_tl-wdr7500-v3 + $(Device/tplink-8mlzma) + SOC := qca9558 + DEVICE_MODEL := TL-WDR7500 + DEVICE_VARIANT := v3 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct \ + ath10k-firmware-qca988x-ct + TPLINK_HWID := 0x75000003 + SUPPORTED_DEVICES += archer-c7 +endef +TARGET_DEVICES += tplink_tl-wdr7500-v3 + define Device/tplink_tl-wdr6500-v2 $(Device/tplink-8mlzma) SOC := qca9561 @@ -579,18 +603,6 @@ define Device/tplink_tl-wdr6500-v2 endef TARGET_DEVICES += tplink_tl-wdr6500-v2 -define Device/tplink_tl-wdr7500-v3 - $(Device/tplink-8mlzma) - SOC := qca9558 - DEVICE_MODEL := TL-WDR7500 - DEVICE_VARIANT := v3 - DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct \ - ath10k-firmware-qca988x-ct - TPLINK_HWID := 0x75000003 - SUPPORTED_DEVICES += archer-c7 -endef -TARGET_DEVICES += tplink_tl-wdr7500-v3 - define Device/tplink_tl-wpa8630-v1 $(Device/tplink-8mlzma) SOC := qca9563 @@ -707,7 +719,7 @@ define Device/tplink_tl-wr2543-v1 DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport TPLINK_HWID := 0x25430001 IMAGE/sysupgrade.bin := tplink-v1-image sysupgrade -v 3.13.99 | \ - append-metadata | check-size + check-size | append-metadata IMAGE/factory.bin := tplink-v1-image factory -v 3.13.99 SUPPORTED_DEVICES += tl-wr2543n endef @@ -813,6 +825,16 @@ define Device/tplink_tl-wr902ac-v1 endef TARGET_DEVICES += tplink_tl-wr902ac-v1 +define Device/tplink_tl-wr941hp-v1 + $(Device/tplink-safeloader) + SOC := tp9343 + DEVICE_MODEL := TL-WR941HP + DEVICE_VARIANT := v1 + TPLINK_BOARD_ID := TL-WR941HP-V1 + IMAGE_SIZE := 7360k +endef +TARGET_DEVICES += tplink_tl-wr941hp-v1 + define Device/tplink_wbs210-v1 $(Device/tplink-safeloader-okli) SOC := ar9344 diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index f8e1d1e4325136..01e8533fd6a258 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -128,7 +128,7 @@ define Device/ubnt-unifi-jffs2 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | jffs2 kernel0 IMAGES := sysupgrade.bin factory.bin IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs |\ - pad-rootfs | append-metadata | check-size + pad-rootfs | check-size | append-metadata IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage2 endef @@ -328,6 +328,14 @@ define Device/ubnt_powerbeam-5ac-gen2 endef TARGET_DEVICES += ubnt_powerbeam-5ac-gen2 +define Device/ubnt_powerbeam-m-xw + $(Device/ubnt-xw) + DEVICE_MODEL := PowerBeam M + DEVICE_PACKAGES += rssileds + SUPPORTED_DEVICES += loco-m-xw +endef +TARGET_DEVICES += ubnt_powerbeam-m-xw + define Device/ubnt_powerbridge-m $(Device/ubnt-xm) SOC := ar7241 @@ -365,7 +373,7 @@ define Device/ubnt_routerstation_common IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | \ check-size IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \ - append-metadata | check-size + check-size | append-metadata KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) KERNEL_INITRAMFS := kernel-bin | append-dtb endef diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 674e6e6b7cbdd5..86ca2673794e7a 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -142,11 +142,20 @@ define Build/teltonika-fw-fake-checksum # from begin of the firmware file) with 16 bytes stored just before # 0xdeadc0de marker. Values are only compared, MD5 sum is not verified. let \ - offs="$$(stat -c%s $@) - 20"; \ + offs="$$(stat -c%s $@) - $(1)"; \ dd if=$@ bs=1 count=16 skip=76 |\ dd of=$@ bs=1 count=16 seek=$$offs conv=notrunc endef +define Build/teltonika-v1-header + $(STAGING_DIR_HOST)/bin/mktplinkfw \ + -c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \ + -E $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ + -m $(TPLINK_HEADER_VERSION) -N "$(VERSION_DIST)" -V "RUT2xx " \ + -k $@ -o $@.new $(1) + @mv $@.new $@ +endef + define Build/wrgg-pad-rootfs $(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 64 >>$@ endef @@ -163,7 +172,7 @@ define Device/seama # - 36 bytes of META data (4-bytes aligned) IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \ seama-seal | check-size SEAMA_SIGNATURE := @@ -327,7 +336,7 @@ define Device/avm KERNEL_INITRAMFS := $$(KERNEL) IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \ append-squashfs-fakeroot-be | pad-to 256 | append-rootfs | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := fritz-tffs endef @@ -768,7 +777,7 @@ define Device/dlink_dap-2xxx IMAGE/factory.img := append-kernel | pad-offset 6144k 160 | \ append-rootfs | wrgg-pad-rootfs | mkwrggimg | check-size IMAGE/sysupgrade.bin := append-kernel | mkwrggimg | \ - pad-to $$$$(BLOCKSIZE) | append-rootfs | append-metadata | check-size + pad-to $$$$(BLOCKSIZE) | append-rootfs | check-size | append-metadata KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma KERNEL_INITRAMFS := $$(KERNEL) | mkwrggimg endef @@ -820,7 +829,7 @@ define Device/dlink_dap-2695-a1 IMAGE/factory.img := $$(IMAGE/default) | append-rootfs | wrgg-pad-rootfs | \ mkwrggimg | check-size IMAGE/sysupgrade.bin := $$(IMAGE/default) | mkwrggimg | append-rootfs | \ - wrgg-pad-rootfs | append-metadata | check-size + wrgg-pad-rootfs | check-size | append-metadata KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma KERNEL_INITRAMFS := $$(KERNEL) | mkwrggimg DAP_SIGNATURE := wapac02_dkbs_dap2695 @@ -882,7 +891,7 @@ define Device/dlink_dir-825-b1 DEVICE_VARIANT := B1 IMAGE_SIZE := 6208k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \ kmod-leds-reset kmod-owl-loader SUPPORTED_DEVICES += dir-825-b1 @@ -903,8 +912,7 @@ define Device/dlink_dir-825-c1 pad-rootfs IMAGE/factory.bin := $$(IMAGE/default) | pad-offset $$$$(IMAGE_SIZE) 26 | \ append-string 00DB120AR9344-RT-101214-00 | check-size - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata endef TARGET_DEVICES += dlink_dir-825-c1 @@ -921,8 +929,7 @@ define Device/dlink_dir-835-a1 pad-rootfs IMAGE/factory.bin := $$(IMAGE/default) | pad-offset $$$$(IMAGE_SIZE) 26 | \ append-string 00DB120AR9344-RT-101214-00 | check-size - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata endef TARGET_DEVICES += dlink_dir-835-a1 @@ -941,7 +948,7 @@ define Device/dlink_dir-842-c IMAGE/default := append-kernel | uImage lzma | \ pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \ seama-seal | check-size IMAGE_SIZE := 15680k @@ -1354,7 +1361,7 @@ define Device/jjplus_ja76pf2 IMAGE/kernel.bin := append-kernel IMAGE/rootfs.bin := append-rootfs | pad-rootfs IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \ - append-metadata | check-size + check-size | append-metadata KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) KERNEL_INITRAMFS := kernel-bin | append-dtb IMAGE_SIZE := 16000k @@ -1421,7 +1428,7 @@ define Device/nec_wx1200cr DEVICE_VENDOR := NEC IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct endef @@ -1473,10 +1480,8 @@ define Device/netgear_ex6400_ex7300 IMAGE_SIZE := 15552k IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ netgear-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size - IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata + IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca99x0-ct endef @@ -1859,7 +1864,7 @@ define Device/phicomm_k2t DEVICE_MODEL := K2T IMAGE_SIZE := 15744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := kmod-leds-reset kmod-ath10k-ct-smallbuffers ath10k-firmware-qca9888-ct endef TARGET_DEVICES += phicomm_k2t @@ -2192,6 +2197,28 @@ define Device/telco_t1 endef TARGET_DEVICES += telco_t1 +define Device/teltonika_rut230-v1 + SOC := ar9331 + DEVICE_VENDOR := Teltonika + DEVICE_MODEL := RUT230 + DEVICE_VARIANT := v1 + DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-acm kmod-usb-net-qmi-wwan \ + uqmi -uboot-envtools + IMAGE_SIZE := 15552k + TPLINK_HWID := 0x32200002 + TPLINK_HWREV := 0x1 + TPLINK_HEADER_VERSION := 1 + KERNEL := kernel-bin | append-dtb | lzma | teltonika-v1-header + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs |\ + pad-rootfs | pad-extra 64 | teltonika-fw-fake-checksum 54 | check-size + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\ + append-rootfs | pad-rootfs | append-metadata |\ + check-size +endef +TARGET_DEVICES += teltonika_rut230-v1 + define Device/teltonika_rut955 SOC := ar9344 DEVICE_VENDOR := Teltonika @@ -2206,11 +2233,10 @@ define Device/teltonika_rut955 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs |\ - pad-rootfs | teltonika-fw-fake-checksum | append-string master |\ + pad-rootfs | teltonika-fw-fake-checksum 20 | append-string master |\ append-md5sum-bin | check-size IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\ - append-rootfs | pad-rootfs | append-metadata |\ - check-size + append-rootfs | pad-rootfs | check-size | append-metadata endef TARGET_DEVICES += teltonika_rut955 @@ -2233,8 +2259,7 @@ define Device/trendnet_tew-823dru pad-rootfs IMAGE/factory.bin := $$(IMAGE/default) | pad-offset $$$$(IMAGE_SIZE) 26 | \ append-string 00AP135AR9558-RT-131129-00 | check-size - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata endef TARGET_DEVICES += trendnet_tew-823dru diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 74f8603b5ab93a..4256f773792b48 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -9,6 +9,15 @@ define Device/mikrotik_routerboard-493g endef TARGET_DEVICES += mikrotik_routerboard-493g +define Device/mikrotik_routerboard-912uag-2hpnd + $(Device/mikrotik_nand) + SOC := ar9342 + DEVICE_MODEL := RouterBOARD 912UAG-2HPnD + DEVICE_PACKAGES += kmod-usb-ehci kmod-usb2 + SUPPORTED_DEVICES += rb-912uag-2hpnd +endef +TARGET_DEVICES += mikrotik_routerboard-912uag-2hpnd + define Device/mikrotik_routerboard-921gs-5hpacd-15s $(Device/mikrotik_nand) SOC := qca9558 diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 971eae1fe04845..1bae2eb4c013be 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -70,10 +70,9 @@ define Device/arris_sbr-ac1750 PAGESIZE := 2048 KERNEL := kernel-bin | append-dtb | gzip | uImage gzip KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none - IMAGES += kernel1.bin rootfs1.bin factory-kfs.bin + IMAGES += kernel1.bin rootfs1.bin IMAGE/kernel1.bin := append-kernel | check-size $$$$(KERNEL_SIZE) IMAGE/rootfs1.bin := append-ubi | check-size - IMAGE/factory-kfs.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE) IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata UBINIZE_OPTS := -E 5 endef @@ -205,8 +204,7 @@ define Device/netgear_ath79_nand IMAGES := sysupgrade.bin factory.img IMAGE/factory.img := append-kernel | append-ubi | netgear-dni | \ check-size - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata UBINIZE_OPTS := -E 5 endef diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk index 29e411c058da84..f4a03e28401078 100644 --- a/target/linux/ath79/image/tiny.mk +++ b/target/linux/ath79/image/tiny.mk @@ -21,8 +21,7 @@ define Device/dlink_dir-615-e4 FACTORY_IMAGE_SIZE := 3456k IMAGES += factory.bin IMAGE/default := append-kernel | append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata IMAGE/factory.bin := $$(IMAGE/default) | \ check-size $$$$(FACTORY_IMAGE_SIZE) | pad-to $$$$(FACTORY_IMAGE_SIZE) | \ append-string "AP99-AR7240-RT-091105-05" diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index 4ffe82588ca66c..d4a32c1e1aabaa 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -14,6 +14,7 @@ ath79_setup_interfaces() ucidef_add_switch "switch1" \ "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" ;; + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ @@ -36,6 +37,7 @@ ath79_setup_macs() local mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)" case "$board" in + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index d9425d44379167..78aa35dc697357 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -23,6 +23,7 @@ board=$(board_name) case "$FIRMWARE" in "ath9k-eeprom-ahb-18100000.wmac.bin") case $board in + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wapr-2nd) diff --git a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh index 97d388168f5dee..6962c6fdcc508c 100644 --- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh @@ -32,6 +32,7 @@ platform_do_upgrade() { case "$board" in mikrotik,routerboard-493g|\ + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-922uags-5hpacd|\ mikrotik,routerboard-sxt-5nd-r2) diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index 1e637bdfd39d2a..efea74a2398adc 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -15,6 +15,7 @@ CONFIG_MTD_NAND_AR934X=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_RB4XX=y +CONFIG_MTD_NAND_RB91X=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_ROUTERBOOT_PARTS=y CONFIG_MTD_SPI_NAND=y diff --git a/target/linux/ath79/mikrotik/target.mk b/target/linux/ath79/mikrotik/target.mk index f5df9044875060..68e9af7808c7a5 100644 --- a/target/linux/ath79/mikrotik/target.mk +++ b/target/linux/ath79/mikrotik/target.mk @@ -3,7 +3,7 @@ FEATURES += minor nand KERNELNAME := vmlinux vmlinuz IMAGES_DIR := ../../.. -DEFAULT_PACKAGES += wpad-basic-wolfssl +DEFAULT_PACKAGES += wpad-openssl define Target/Description Build firmware images for MikroTik devices based on Qualcomm Atheros diff --git a/target/linux/ath79/patches-5.10/0003-leds-add-reset-controller-based-driver.patch b/target/linux/ath79/patches-5.10/0003-leds-add-reset-controller-based-driver.patch index a023d4c6447e3d..68b831036576c2 100644 --- a/target/linux/ath79/patches-5.10/0003-leds-add-reset-controller-based-driver.patch +++ b/target/linux/ath79/patches-5.10/0003-leds-add-reset-controller-based-driver.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -928,6 +928,17 @@ config LEDS_ACER_A500 +@@ -929,6 +929,17 @@ config LEDS_ACER_A500 This option enables support for the Power Button LED of Acer Iconia Tab A500. diff --git a/target/linux/ath79/patches-5.10/408-mtd-redboot_partition_scan.patch b/target/linux/ath79/patches-5.10/408-mtd-redboot_partition_scan.patch index 8f3ee32f5776a3..e5b06e14a56837 100644 --- a/target/linux/ath79/patches-5.10/408-mtd-redboot_partition_scan.patch +++ b/target/linux/ath79/patches-5.10/408-mtd-redboot_partition_scan.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/parsers/redboot.c +++ b/drivers/mtd/parsers/redboot.c -@@ -85,12 +85,18 @@ static int parse_redboot_partitions(stru +@@ -90,12 +90,18 @@ static int parse_redboot_partitions(stru parse_redboot_of(master); @@ -19,7 +19,7 @@ return -EIO; } offset -= master->erasesize; -@@ -103,10 +109,6 @@ static int parse_redboot_partitions(stru +@@ -108,10 +114,6 @@ static int parse_redboot_partitions(stru goto nogood; } } @@ -30,7 +30,7 @@ printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n", master->name, offset); -@@ -179,6 +181,11 @@ static int parse_redboot_partitions(stru +@@ -184,6 +186,11 @@ static int parse_redboot_partitions(stru } if (i == numslots) { /* Didn't find it */ 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 c1cb0dae668156..b9290dee1c9165 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 @@ -267,7 +267,7 @@ case IPV6_2292HOPOPTS: --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c -@@ -949,7 +949,7 @@ static bool ipv6_hop_jumbo(struct sk_buf +@@ -948,7 +948,7 @@ static bool ipv6_hop_jumbo(struct sk_buf goto drop; } diff --git a/target/linux/ath79/patches-5.10/920-mikrotik-rb4xx.patch b/target/linux/ath79/patches-5.10/920-mikrotik-rb4xx.patch index 25ea1abe568999..7c3c91817f4520 100644 --- a/target/linux/ath79/patches-5.10/920-mikrotik-rb4xx.patch +++ b/target/linux/ath79/patches-5.10/920-mikrotik-rb4xx.patch @@ -1,6 +1,6 @@ --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig -@@ -2141,6 +2141,14 @@ config RAVE_SP_CORE +@@ -2142,6 +2142,14 @@ config RAVE_SP_CORE Select this to get support for the Supervisory Processor device found on several devices in RAVE line of hardware. @@ -27,7 +27,7 @@ obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig -@@ -1518,6 +1518,12 @@ config GPIO_SODAVILLE +@@ -1520,6 +1520,12 @@ config GPIO_SODAVILLE help Say Y here to support Intel Sodaville GPIO. diff --git a/target/linux/ath79/patches-5.10/939-mikrotik-rb91x.patch b/target/linux/ath79/patches-5.10/939-mikrotik-rb91x.patch new file mode 100644 index 00000000000000..5bbab93c51d052 --- /dev/null +++ b/target/linux/ath79/patches-5.10/939-mikrotik-rb91x.patch @@ -0,0 +1,49 @@ +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -341,6 +341,13 @@ config GPIO_IXP4XX + IXP4xx series of chips. + + If unsure, say N. ++ ++config GPIO_LATCH ++ tristate "MikroTik RouterBOARD GPIO latch support" ++ depends on ATH79 ++ help ++ GPIO driver for latch on some MikroTik RouterBOARDs. ++ + config GPIO_LOGICVC + tristate "Xylon LogiCVC GPIO support" + depends on MFD_SYSCON && OF +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -72,6 +72,7 @@ obj-$(CONFIG_GPIO_IT87) += gpio-it87.o + obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o + obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o + obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o ++obj-$(CONFIG_GPIO_LATCH) += gpio-latch.o + obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o + obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o + obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o +--- a/drivers/mtd/nand/raw/Kconfig ++++ b/drivers/mtd/nand/raw/Kconfig +@@ -571,4 +571,10 @@ config MTD_NAND_RB4XX + Enables support for the NAND flash chip on Mikrotik Routerboard + RB4xx series. + ++config MTD_NAND_RB91X ++ tristate "MikroTik RB91x NAND driver support" ++ depends on ATH79 && MTD_RAW_NAND ++ help ++ Enables support for the NAND flash chip on MikroTik RB91x series. ++ + endif # MTD_RAW_NAND +--- a/drivers/mtd/nand/raw/Makefile ++++ b/drivers/mtd/nand/raw/Makefile +@@ -60,6 +60,7 @@ obj-$(CONFIG_MTD_NAND_CADENCE) += caden + obj-$(CONFIG_MTD_NAND_ARASAN) += arasan-nand-controller.o + obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o + obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o ++obj-$(CONFIG_MTD_NAND_RB91X) += rb91x_nand.o + + nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o + nand-objs += nand_onfi.o diff --git a/target/linux/ath79/patches-5.4/0003-leds-add-reset-controller-based-driver.patch b/target/linux/ath79/patches-5.4/0003-leds-add-reset-controller-based-driver.patch index 3249e1e82b5b32..32a122fabe6343 100644 --- a/target/linux/ath79/patches-5.4/0003-leds-add-reset-controller-based-driver.patch +++ b/target/linux/ath79/patches-5.4/0003-leds-add-reset-controller-based-driver.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -823,6 +823,17 @@ config LEDS_LM36274 +@@ -824,6 +824,17 @@ config LEDS_LM36274 Say Y to enable the LM36274 LED driver for TI LMU devices. This supports the LED device LM36274. diff --git a/target/linux/ath79/patches-5.4/408-mtd-redboot_partition_scan.patch b/target/linux/ath79/patches-5.4/408-mtd-redboot_partition_scan.patch index 8f3ee32f5776a3..e5b06e14a56837 100644 --- a/target/linux/ath79/patches-5.4/408-mtd-redboot_partition_scan.patch +++ b/target/linux/ath79/patches-5.4/408-mtd-redboot_partition_scan.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/parsers/redboot.c +++ b/drivers/mtd/parsers/redboot.c -@@ -85,12 +85,18 @@ static int parse_redboot_partitions(stru +@@ -90,12 +90,18 @@ static int parse_redboot_partitions(stru parse_redboot_of(master); @@ -19,7 +19,7 @@ return -EIO; } offset -= master->erasesize; -@@ -103,10 +109,6 @@ static int parse_redboot_partitions(stru +@@ -108,10 +114,6 @@ static int parse_redboot_partitions(stru goto nogood; } } @@ -30,7 +30,7 @@ printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n", master->name, offset); -@@ -179,6 +181,11 @@ static int parse_redboot_partitions(stru +@@ -184,6 +186,11 @@ static int parse_redboot_partitions(stru } if (i == numslots) { /* Didn't find it */ diff --git a/target/linux/ath79/patches-5.4/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.4/910-unaligned_access_hacks.patch index 2440fbbb7373f3..99520863d3e1e8 100644 --- a/target/linux/ath79/patches-5.4/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.4/910-unaligned_access_hacks.patch @@ -267,7 +267,7 @@ case IPV6_2292HOPOPTS: --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c -@@ -752,7 +752,7 @@ static bool ipv6_hop_jumbo(struct sk_buf +@@ -751,7 +751,7 @@ static bool ipv6_hop_jumbo(struct sk_buf goto drop; } diff --git a/target/linux/ath79/patches-5.4/920-mikrotik-rb4xx.patch b/target/linux/ath79/patches-5.4/920-mikrotik-rb4xx.patch index 5540b8ae3a3cf5..60f8bdff790d7f 100644 --- a/target/linux/ath79/patches-5.4/920-mikrotik-rb4xx.patch +++ b/target/linux/ath79/patches-5.4/920-mikrotik-rb4xx.patch @@ -23,7 +23,7 @@ +obj-$(CONFIG_MFD_RB4XX_CPLD) += rb4xx-cpld.o --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig -@@ -1406,6 +1406,12 @@ config GPIO_SODAVILLE +@@ -1408,6 +1408,12 @@ config GPIO_SODAVILLE help Say Y here to support Intel Sodaville GPIO. diff --git a/target/linux/ath79/patches-5.4/939-mikrotik-rb91x.patch b/target/linux/ath79/patches-5.4/939-mikrotik-rb91x.patch new file mode 100644 index 00000000000000..6d8444394553aa --- /dev/null +++ b/target/linux/ath79/patches-5.4/939-mikrotik-rb91x.patch @@ -0,0 +1,44 @@ +--- a/drivers/mtd/nand/raw/Kconfig ++++ b/drivers/mtd/nand/raw/Kconfig +@@ -559,4 +559,8 @@ config MTD_NAND_RB4XX + Enables support for the NAND flash chip on Mikrotik Routerboard + RB4xx series. + ++config MTD_NAND_RB91X ++ tristate "MikroTik RB91x NAND driver support" ++ depends on ATH79 && MTD_RAW_NAND ++ + endif # MTD_RAW_NAND +--- a/drivers/mtd/nand/raw/Makefile ++++ b/drivers/mtd/nand/raw/Makefile +@@ -59,6 +59,7 @@ obj-$(CONFIG_MTD_NAND_STM32_FMC2) += stm + obj-$(CONFIG_MTD_NAND_MESON) += meson_nand.o + obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o + obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o ++obj-$(CONFIG_MTD_NAND_RB91X) += rb91x_nand.o + + nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o + nand-objs += nand_onfi.o +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -130,6 +130,10 @@ config GPIO_ATH79 + Select this option to enable GPIO driver for + Atheros AR71XX/AR724X/AR913X SoC devices. + ++config GPIO_LATCH ++ tristate "MikroTik RouterBOARD GPIO latch support" ++ depends on ATH79 ++ + config GPIO_RASPBERRYPI_EXP + tristate "Raspberry Pi 3 GPIO Expander" + default RASPBERRYPI_FIRMWARE +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -67,6 +67,7 @@ obj-$(CONFIG_GPIO_IT87) += gpio-it87.o + obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o + obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o + obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o ++obj-$(CONFIG_GPIO_LATCH) += gpio-latch.o + obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o + obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o + obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o diff --git a/target/linux/bcm27xx/patches-5.4/950-0043-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-5.4/950-0043-MMC-added-alternative-MMC-driver.patch index a9f99add60c477..f70887855b9e5c 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0043-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0043-MMC-added-alternative-MMC-driver.patch @@ -222,7 +222,7 @@ Signed-off-by: Yaroslav Rosomakho static inline int mmc_blk_part_switch(struct mmc_card *card, unsigned int part_type); -@@ -2884,6 +2891,7 @@ static int mmc_blk_probe(struct mmc_card +@@ -2892,6 +2899,7 @@ static int mmc_blk_probe(struct mmc_card { struct mmc_blk_data *md, *part_md; char cap_str[10]; @@ -230,7 +230,7 @@ Signed-off-by: Yaroslav Rosomakho /* * Check that the card supports the command class(es) we need. -@@ -2891,7 +2899,16 @@ static int mmc_blk_probe(struct mmc_card +@@ -2899,7 +2907,16 @@ static int mmc_blk_probe(struct mmc_card if (!(card->csd.cmdclass & CCC_BLOCK_READ)) return -ENODEV; @@ -248,7 +248,7 @@ Signed-off-by: Yaroslav Rosomakho card->complete_wq = alloc_workqueue("mmc_complete", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); -@@ -2906,9 +2923,14 @@ static int mmc_blk_probe(struct mmc_card +@@ -2914,9 +2931,14 @@ static int mmc_blk_probe(struct mmc_card string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, cap_str, sizeof(cap_str)); diff --git a/target/linux/bcm27xx/patches-5.4/950-0153-media-tc358743-fix-connected-active-CSI-2-lane-repor.patch b/target/linux/bcm27xx/patches-5.4/950-0153-media-tc358743-fix-connected-active-CSI-2-lane-repor.patch index 2357c878d7a2ac..ef2193f4de6712 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0153-media-tc358743-fix-connected-active-CSI-2-lane-repor.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0153-media-tc358743-fix-connected-active-CSI-2-lane-repor.patch @@ -47,7 +47,7 @@ Signed-off-by: Philipp Zabel switch (state->csi_lanes_in_use) { case 1: -@@ -2054,6 +2063,7 @@ static int tc358743_probe(struct i2c_cli +@@ -2055,6 +2064,7 @@ static int tc358743_probe(struct i2c_cli if (pdata) { state->pdata = *pdata; state->bus.flags = V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; diff --git a/target/linux/bcm27xx/patches-5.4/950-0154-media-tc358743-Add-support-for-972Mbit-s-link-freq.patch b/target/linux/bcm27xx/patches-5.4/950-0154-media-tc358743-Add-support-for-972Mbit-s-link-freq.patch index 18ee169b1c4ce9..7166232c400073 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0154-media-tc358743-Add-support-for-972Mbit-s-link-freq.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0154-media-tc358743-Add-support-for-972Mbit-s-link-freq.patch @@ -21,7 +21,7 @@ Signed-off-by: Dave Stevenson */ bps_pr_lane = 2 * endpoint.link_frequencies[0]; if (bps_pr_lane < 62500000U || bps_pr_lane > 1000000000U) { -@@ -1990,23 +1991,41 @@ static int tc358743_probe_of(struct tc35 +@@ -1991,23 +1992,41 @@ static int tc358743_probe_of(struct tc35 state->pdata.refclk_hz * state->pdata.pll_prd; /* diff --git a/target/linux/bcm27xx/patches-5.4/950-0155-media-tc358743-Check-I2C-succeeded-during-probe.patch b/target/linux/bcm27xx/patches-5.4/950-0155-media-tc358743-Check-I2C-succeeded-during-probe.patch index 653602b306940f..1a26997c36f226 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0155-media-tc358743-Check-I2C-succeeded-during-probe.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0155-media-tc358743-Check-I2C-succeeded-during-probe.patch @@ -78,7 +78,7 @@ Signed-off-by: Dave Stevenson static void i2c_wr16(struct v4l2_subdev *sd, u16 reg, u16 val) { i2c_wrreg(sd, reg, val, 2); -@@ -2064,6 +2081,7 @@ static int tc358743_probe(struct i2c_cli +@@ -2065,6 +2082,7 @@ static int tc358743_probe(struct i2c_cli struct tc358743_platform_data *pdata = client->dev.platform_data; struct v4l2_subdev *sd; u16 irq_mask = MASK_HDMI_MSK | MASK_CSI_MSK; @@ -86,7 +86,7 @@ Signed-off-by: Dave Stevenson int err; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) -@@ -2096,7 +2114,8 @@ static int tc358743_probe(struct i2c_cli +@@ -2097,7 +2115,8 @@ static int tc358743_probe(struct i2c_cli sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; /* i2c access */ diff --git a/target/linux/bcm27xx/patches-5.4/950-0293-xhci-Use-more-event-ring-segment-table-entries.patch b/target/linux/bcm27xx/patches-5.4/950-0293-xhci-Use-more-event-ring-segment-table-entries.patch index 20bab47514edf9..25c23a8257d772 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0293-xhci-Use-more-event-ring-segment-table-entries.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0293-xhci-Use-more-event-ring-segment-table-entries.patch @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c -@@ -2512,9 +2512,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2513,9 +2513,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, * Event ring setup: Allocate a normal ring, but also setup * the event ring segment table (ERST). Section 4.9.3. */ @@ -36,7 +36,7 @@ Signed-off-by: Jonathan Bell if (!xhci->event_ring) goto fail; if (xhci_check_trb_in_td_math(xhci) < 0) -@@ -2527,7 +2529,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2528,7 +2530,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, /* set ERST count with the number of entries in the segment table */ val = readl(&xhci->ir_set->erst_size); val &= ERST_SIZE_MASK; diff --git a/target/linux/bcm27xx/patches-5.4/950-0297-arch-arm-Add-model-string-to-cpuinfo.patch b/target/linux/bcm27xx/patches-5.4/950-0297-arch-arm-Add-model-string-to-cpuinfo.patch index 4e9598a54ee822..e3cf7bb9e1703f 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0297-arch-arm-Add-model-string-to-cpuinfo.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0297-arch-arm-Add-model-string-to-cpuinfo.patch @@ -10,7 +10,7 @@ Signed-off-by: Phil Elwell --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c -@@ -1249,6 +1249,8 @@ static int c_show(struct seq_file *m, vo +@@ -1251,6 +1251,8 @@ static int c_show(struct seq_file *m, vo { int i, j; u32 cpuid; @@ -19,7 +19,7 @@ Signed-off-by: Phil Elwell for_each_online_cpu(i) { /* -@@ -1308,6 +1310,14 @@ static int c_show(struct seq_file *m, vo +@@ -1310,6 +1312,14 @@ static int c_show(struct seq_file *m, vo seq_printf(m, "Revision\t: %04x\n", system_rev); seq_printf(m, "Serial\t\t: %s\n", system_serial); diff --git a/target/linux/bcm27xx/patches-5.4/950-0445-dma-mapping-treat-dev-bus_dma_mask-as-a-DMA-limit.patch b/target/linux/bcm27xx/patches-5.4/950-0445-dma-mapping-treat-dev-bus_dma_mask-as-a-DMA-limit.patch index d968e93153b443..344e1ee37efcf4 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0445-dma-mapping-treat-dev-bus_dma_mask-as-a-DMA-limit.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0445-dma-mapping-treat-dev-bus_dma_mask-as-a-DMA-limit.patch @@ -198,7 +198,7 @@ Signed-off-by: Christoph Hellwig return 0; --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c -@@ -404,8 +404,7 @@ static dma_addr_t iommu_dma_alloc_iova(s +@@ -406,8 +406,7 @@ static dma_addr_t iommu_dma_alloc_iova(s if (iova_len < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1))) iova_len = roundup_pow_of_two(iova_len); diff --git a/target/linux/bcm27xx/patches-5.4/950-0646-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch b/target/linux/bcm27xx/patches-5.4/950-0646-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch index 05fa9f8f2ec2e2..8e85d6e29f9af2 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0646-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0646-spi-Force-CS_HIGH-if-GPIO-descriptors-are-used.patch @@ -23,7 +23,7 @@ Signed-off-by: Phil Elwell --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c -@@ -3116,6 +3116,7 @@ static int __spi_validate_bits_per_word( +@@ -3117,6 +3117,7 @@ static int __spi_validate_bits_per_word( */ int spi_setup(struct spi_device *spi) { @@ -31,7 +31,7 @@ Signed-off-by: Phil Elwell unsigned bad_bits, ugly_bits; int status; -@@ -3133,6 +3134,14 @@ int spi_setup(struct spi_device *spi) +@@ -3134,6 +3135,14 @@ int spi_setup(struct spi_device *spi) (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL | SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL))) return -EINVAL; diff --git a/target/linux/bcm27xx/patches-5.4/950-0690-SQUASH-spi-Demote-SPI_CS_HIGH-warning-to-KERN_DEBUG.patch b/target/linux/bcm27xx/patches-5.4/950-0690-SQUASH-spi-Demote-SPI_CS_HIGH-warning-to-KERN_DEBUG.patch index b821afb08b44be..641d7688908958 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0690-SQUASH-spi-Demote-SPI_CS_HIGH-warning-to-KERN_DEBUG.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0690-SQUASH-spi-Demote-SPI_CS_HIGH-warning-to-KERN_DEBUG.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c -@@ -3128,8 +3128,8 @@ int spi_setup(struct spi_device *spi) +@@ -3129,8 +3129,8 @@ int spi_setup(struct spi_device *spi) if (ctlr->use_gpio_descriptors && ctlr->cs_gpiods && ctlr->cs_gpiods[spi->chip_select] && !(spi->mode & SPI_CS_HIGH)) { diff --git a/target/linux/bcm27xx/patches-5.4/950-0698-media-i2c-tc358743-Fix-fallthrough-warning.patch b/target/linux/bcm27xx/patches-5.4/950-0698-media-i2c-tc358743-Fix-fallthrough-warning.patch index 26c1f95bf28452..1a892b7d3c094f 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0698-media-i2c-tc358743-Fix-fallthrough-warning.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0698-media-i2c-tc358743-Fix-fallthrough-warning.patch @@ -10,7 +10,7 @@ Signed-off-by: Jacko Dirks --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c -@@ -2004,6 +2004,7 @@ static int tc358743_probe_of(struct tc35 +@@ -2005,6 +2005,7 @@ static int tc358743_probe_of(struct tc35 switch (bps_pr_lane) { default: dev_warn(dev, "untested bps per lane: %u bps\n", bps_pr_lane); diff --git a/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch b/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch index 185e8eb4935df9..7206bad51dba04 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch @@ -94,7 +94,7 @@ Signed-off-by: Phil Elwell #include