From 7329a4f74d320e03192f0afec46d698ad3451756 Mon Sep 17 00:00:00 2001 From: Qosmio Date: Sat, 9 Mar 2024 12:25:24 -0500 Subject: [PATCH] nss: Properly build drv/client based on FW There are significant changes between NSS version 11.4.0.5 and 12.1 (12.0.5), that it doesn't really make sense to use it with older firmware (i.e. using mesh releated features). This change will explicitly link building the proper driver and client packages when FW 12.1 or 11.4 is selected, while also backporting patches from 12.4. --- firmware/nss-firmware/Makefile | 12 +- qca-nss-clients/Makefile | 10 +- .../0001-kernel-5.15-support-qdisc.patch | 153 ++ .../0002-kernel-5.4-support-gre.patch | 31 + .../0003-kernel-5.4-support-ipsec.patch | 29 + .../0004-kernel-5.4-support-dtls.patch | 11 + .../0005-vlanmgr-fix-compile-error.patch | 59 + .../0006-match-fix-compile-error.patch | 25 + .../0007-bridge-fix-compile-error.patch | 29 + .../0008-profiler-fix-compile-error.patch | 61 + .../0009-gre-fix-compile-error.patch | 17 + .../patches-11.4/0010-fix-portifmgr.patch | 35 + ...lsmgr-fix-SHA-header-include-in-5.15.patch | 48 + ...0012-dtlsmgr-fix-debug-print-in-5.15.patch | 36 + ...lsmgr-fix-SHA-header-include-in-5.15.patch | 32 + ...pnmgr-fix-SHA-header-include-in-5.15.patch | 32 + ...5-tunipip6-fix-compile-error-in-5.15.patch | 11 + ...6-vxlanmgr-fix-compile-error-in-5.15.patch | 0 .../0017-tlsmgr-fix-debug-print-in-5.15.patch | 34 + .../0018-kernel-6.1-support.patch | 344 +++ ...shmgr-fix-uninitialized-and-implicit.patch | 225 ++ .../0020-capwapmgr-fix-compile-error.patch | 169 ++ .../0022-netlink-modularize-makefile.patch | 44 + .../0023-mirror-fix-makefile.patch | 10 + .../0024-match-switch-to-wifili.patch | 60 + ...5-pvxlanmgr-fix-compile-error-in-6.1.patch | 42 + .../0026-meshmgr-backport-12.4.patch | 0 .../0026-qdisc-backport-12.4.patch | 330 +++ qca-nss-drv/Makefile | 12 +- ...replace-ioremap_nocache-with-ioremap.patch | 178 ++ ...ol-fab-scaling-from-package-Makefile.patch | 31 + .../0005-fix-NULL-pointer-exception.patch | 11 + ...6-Fix-Kernel-Panic-dma-with-NULL-dev.patch | 30 + ...ts-enum-int-compilation-error-GCC-13.patch | 11 + .../0007-Exported-set-nexthop-function.patch | 23 + ...s_wifili_if-compilation-error-GCC-13.patch | 11 + .../0009-kernel-5.15-support.patch | 74 + .../0010-nss-drv-dynamic-interface-desc.patch | 18 + ...ork-getting-the-reserved-memory-size.patch | 114 + .../0012-Makefile-modularize-driver.patch | 204 ++ .../0012-nss-drv-quiet-messages.patch | 80 + .../patches-11.4/0013-backport-12.4.patch | 2163 +++++++++++++++++ .../0013-nss-drv-remove-legacy-wifi.patch | 12 + .../0014-Add-kernel-6.1-support.patch | 183 ++ ...014-nss-drv-avoid-recreating-virt_if.patch | 14 + .../patches-11.4/0015-nss-drv-fix-igs.patch | 40 + ...-rework-NSS_CORE_DMA_CACHE_MAINT-ops.patch | 558 +++++ .../0017-nss-drv-remove-gmac-stat.patch | 39 + 48 files changed, 5684 insertions(+), 11 deletions(-) create mode 100644 qca-nss-clients/patches-11.4/0001-kernel-5.15-support-qdisc.patch create mode 100644 qca-nss-clients/patches-11.4/0002-kernel-5.4-support-gre.patch create mode 100644 qca-nss-clients/patches-11.4/0003-kernel-5.4-support-ipsec.patch create mode 100644 qca-nss-clients/patches-11.4/0004-kernel-5.4-support-dtls.patch create mode 100644 qca-nss-clients/patches-11.4/0005-vlanmgr-fix-compile-error.patch create mode 100644 qca-nss-clients/patches-11.4/0006-match-fix-compile-error.patch create mode 100644 qca-nss-clients/patches-11.4/0007-bridge-fix-compile-error.patch create mode 100644 qca-nss-clients/patches-11.4/0008-profiler-fix-compile-error.patch create mode 100644 qca-nss-clients/patches-11.4/0009-gre-fix-compile-error.patch create mode 100644 qca-nss-clients/patches-11.4/0010-fix-portifmgr.patch create mode 100644 qca-nss-clients/patches-11.4/0011-dtlsmgr-fix-SHA-header-include-in-5.15.patch create mode 100644 qca-nss-clients/patches-11.4/0012-dtlsmgr-fix-debug-print-in-5.15.patch create mode 100644 qca-nss-clients/patches-11.4/0013-tlsmgr-fix-SHA-header-include-in-5.15.patch create mode 100644 qca-nss-clients/patches-11.4/0014-ovpnmgr-fix-SHA-header-include-in-5.15.patch create mode 100644 qca-nss-clients/patches-11.4/0015-tunipip6-fix-compile-error-in-5.15.patch create mode 100644 qca-nss-clients/patches-11.4/0016-vxlanmgr-fix-compile-error-in-5.15.patch create mode 100644 qca-nss-clients/patches-11.4/0017-tlsmgr-fix-debug-print-in-5.15.patch create mode 100644 qca-nss-clients/patches-11.4/0018-kernel-6.1-support.patch create mode 100644 qca-nss-clients/patches-11.4/0019-wifi-meshmgr-fix-uninitialized-and-implicit.patch create mode 100644 qca-nss-clients/patches-11.4/0020-capwapmgr-fix-compile-error.patch create mode 100644 qca-nss-clients/patches-11.4/0022-netlink-modularize-makefile.patch create mode 100644 qca-nss-clients/patches-11.4/0023-mirror-fix-makefile.patch create mode 100644 qca-nss-clients/patches-11.4/0024-match-switch-to-wifili.patch create mode 100644 qca-nss-clients/patches-11.4/0025-pvxlanmgr-fix-compile-error-in-6.1.patch create mode 100644 qca-nss-clients/patches-11.4/0026-meshmgr-backport-12.4.patch create mode 100644 qca-nss-clients/patches-11.4/0026-qdisc-backport-12.4.patch create mode 100644 qca-nss-drv/patches-11.4/0001-nss-drv-replace-ioremap_nocache-with-ioremap.patch create mode 100644 qca-nss-drv/patches-11.4/0002-Control-fab-scaling-from-package-Makefile.patch create mode 100644 qca-nss-drv/patches-11.4/0005-fix-NULL-pointer-exception.patch create mode 100644 qca-nss-drv/patches-11.4/0006-Fix-Kernel-Panic-dma-with-NULL-dev.patch create mode 100644 qca-nss-drv/patches-11.4/0006-nss-drv-Fix-nss_clmap_stats-enum-int-compilation-error-GCC-13.patch create mode 100644 qca-nss-drv/patches-11.4/0007-Exported-set-nexthop-function.patch create mode 100644 qca-nss-drv/patches-11.4/0007-nss-drv-Fix-nss_wifili_if-compilation-error-GCC-13.patch create mode 100644 qca-nss-drv/patches-11.4/0009-kernel-5.15-support.patch create mode 100644 qca-nss-drv/patches-11.4/0010-nss-drv-dynamic-interface-desc.patch create mode 100644 qca-nss-drv/patches-11.4/0011-rework-getting-the-reserved-memory-size.patch create mode 100644 qca-nss-drv/patches-11.4/0012-Makefile-modularize-driver.patch create mode 100644 qca-nss-drv/patches-11.4/0012-nss-drv-quiet-messages.patch create mode 100644 qca-nss-drv/patches-11.4/0013-backport-12.4.patch create mode 100644 qca-nss-drv/patches-11.4/0013-nss-drv-remove-legacy-wifi.patch create mode 100644 qca-nss-drv/patches-11.4/0014-Add-kernel-6.1-support.patch create mode 100644 qca-nss-drv/patches-11.4/0014-nss-drv-avoid-recreating-virt_if.patch create mode 100644 qca-nss-drv/patches-11.4/0015-nss-drv-fix-igs.patch create mode 100644 qca-nss-drv/patches-11.4/0016-rework-NSS_CORE_DMA_CACHE_MAINT-ops.patch create mode 100644 qca-nss-drv/patches-11.4/0017-nss-drv-remove-gmac-stat.patch diff --git a/firmware/nss-firmware/Makefile b/firmware/nss-firmware/Makefile index 051aad9..69e75f7 100644 --- a/firmware/nss-firmware/Makefile +++ b/firmware/nss-firmware/Makefile @@ -22,7 +22,7 @@ PKG_MAINTAINER:=Sean K PKG_CONFIG_DEPENDS:= \ CONFIG_NSS_FIRMWARE_VERSION_11_4 \ - CONFIG_NSS_FIRMWARE_VERSION_12_0 + CONFIG_NSS_FIRMWARE_VERSION_12_1 include $(INCLUDE_DIR)/package.mk @@ -68,9 +68,9 @@ define Package/nss-firmware-default/config choice prompt "Version" - default NSS_FIRMWARE_VERSION_12_0 + default NSS_FIRMWARE_VERSION_12_1 - config NSS_FIRMWARE_VERSION_12_0 + config NSS_FIRMWARE_VERSION_12_1 bool "NSS Firmware 12.1 Release 022" help This version does not work with NSS MESH @@ -87,13 +87,11 @@ ifneq ($(CONFIG_NSS_FIRMWARE_VERSION_11_4),) NSS_MAJOR:=11.4 NSS_MINOR:=11.4.0.5 NSS_REL:=5 - NSS_PROFILE:=R VERSION_PATH=$(PKG_BUILD_DIR)/QCA_Networking_2021.SPF_$(NSS_MAJOR)/CS else NSS_MAJOR:=12.0.0 NSS_MINOR:=12.1 NSS_REL:=022 - NSS_PROFILE:=R VERSION_PATH=$(PKG_BUILD_DIR)/QCA_Networking_2022.SPF_$(NSS_MAJOR)/ED1 endif @@ -101,8 +99,8 @@ define Build/Compile endef define Package/nss-firmware/install - $(eval NSS_ARCHIVE := $(VERSION_PATH)/$(IPQ_PLATFORM).ATH.$(NSS_MAJOR)/BIN-NSS*.$(NSS_MINOR)-$(NSS_REL)*$(NSS_PROFILE).tar.bz2) - mkdir -p $(PKG_BUILD_DIR)/$(IPQ_PLATFORM) + $(eval NSS_ARCHIVE ?= $(VERSION_PATH)/$(IPQ_PLATFORM).ATH.$(NSS_MAJOR)/BIN-NSS*.$(NSS_MINOR)-$(NSS_REL)*$(NSS_PROFILE).tar.bz2) + $(INSTALL_DIR) $(PKG_BUILD_DIR)/$(IPQ_PLATFORM) $(TAR) -C $(PKG_BUILD_DIR)/$(IPQ_PLATFORM) -xf $(NSS_ARCHIVE) --strip-components=1 $(INSTALL_DIR) $(1)/lib/firmware/ $(INSTALL_DATA) \ diff --git a/qca-nss-clients/Makefile b/qca-nss-clients/Makefile index 8c62dd5..3080ab1 100644 --- a/qca-nss-clients/Makefile +++ b/qca-nss-clients/Makefile @@ -46,7 +46,15 @@ PKG_CONFIG_DEPENDS:=\ CONFIG_NSS_DRV_VXLAN_ENABLE \ CONFIG_NSS_DRV_WIFIOFFLOAD_ENABLE \ CONFIG_NSS_DRV_WIFI_MESH_ENABLE \ - CONFIG_NSS_DRV_WIFI_LEGACY_ENABLE + CONFIG_NSS_DRV_WIFI_LEGACY_ENABLE \ + CONFIG_NSS_FIRMWARE_VERSION_11_4 + +ifdef CONFIG_NSS_FIRMWARE_VERSION_11_4 +PKG_SOURCE_DATE:=2021-08-17 +PKG_SOURCE_VERSION:=153998d70fdba508a59a28c13a606032cbf32686 +PKG_MIRROR_HASH:=8b0eb211da44c36022ef85fe0bf7c37836333f6ffa6c312117a43e5473dffdf8 +PATCH_DIR:=$(CURDIR)/patches-11.4 +endif include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk diff --git a/qca-nss-clients/patches-11.4/0001-kernel-5.15-support-qdisc.patch b/qca-nss-clients/patches-11.4/0001-kernel-5.15-support-qdisc.patch new file mode 100644 index 0000000..f6f69f7 --- /dev/null +++ b/qca-nss-clients/patches-11.4/0001-kernel-5.15-support-qdisc.patch @@ -0,0 +1,153 @@ +--- a/nss_qdisc/igs/nss_mirred.c ++++ b/nss_qdisc/igs/nss_mirred.c +@@ -82,20 +82,24 @@ static const struct nla_policy nss_mirre + * nss_mirred_init() + * Initialize the nss mirred action. + */ +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)) + static int nss_mirred_init(struct net *net, struct nlattr *nla, +- struct nlattr *est, struct tc_action *tc_act, int ovr, +- int bind) ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)) ++ struct nlattr *est, struct tc_action *tc_act, int ovr, ++ int bind) ++{ ++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) ++ struct nlattr *est, struct tc_action **tc_act, int ovr, ++ int bind, bool rtnl_held, struct tcf_proto *tp, ++ u32 flags, struct netlink_ext_ack *extack) + { + #else +-static int nss_mirred_init(struct net *net, struct nlattr *nla, +- struct nlattr *est, struct tc_action **tc_act, int ovr, +- int bind, bool rtnl_held, struct tcf_proto *tp, +- struct netlink_ext_ack *extack) ++ struct nlattr *est, struct tc_action **tc_act, ++ struct tcf_proto *tp, u32 flags, struct netlink_ext_ack *extack) + { ++ bool bind = flags & TCA_ACT_FLAGS_BIND; ++#endif + struct tc_action_net *tn = net_generic(net, nss_mirred_net_id); + u32 index; +-#endif + struct nlattr *arr[TC_NSS_MIRRED_MAX + 1]; + struct tc_nss_mirred *parm; + struct nss_mirred_tcf *act; +@@ -239,8 +243,13 @@ static int nss_mirred_init(struct net *n + } + + if (!ret) { ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)) + ret = tcf_idr_create(tn, index, est, tc_act, &nss_mirred_act_ops, + bind, true); ++#else ++ ret = tcf_idr_create(tn, index, est, tc_act, &nss_mirred_act_ops, ++ bind, true, 0); ++#endif + if (ret) { + tcf_idr_cleanup(tn, index); + return ret; +--- a/nss_qdisc/nss_bf.c ++++ b/nss_qdisc/nss_bf.c +@@ -74,7 +74,7 @@ static inline struct nss_bf_class_data * + */ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) + static int nss_bf_change_class(struct Qdisc *sch, u32 classid, u32 parentid, +- struct nlattr **tca, unsigned long *arg) ++ struct nlattr **tca, unsigned long *arg, struct netlink_ext_ack *extack) + { + struct netlink_ext_ack *extack = NULL; + #else +@@ -290,7 +290,11 @@ static void nss_bf_destroy_class(struct + * nss_bf_delete_class() + * Detaches a class from operation, but does not destroy it. + */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)) ++static int nss_bf_delete_class(struct Qdisc *sch, unsigned long arg, struct netlink_ext_ack *extack) ++#else + static int nss_bf_delete_class(struct Qdisc *sch, unsigned long arg) ++#endif + { + struct nss_bf_sched_data *q = qdisc_priv(sch); + struct nss_bf_class_data *cl = (struct nss_bf_class_data *)arg; +--- a/nss_qdisc/nss_htb.c ++++ b/nss_qdisc/nss_htb.c +@@ -282,7 +282,7 @@ static int nss_htb_ppe_change_class(stru + */ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) + static int nss_htb_change_class(struct Qdisc *sch, u32 classid, u32 parentid, +- struct nlattr **tca, unsigned long *arg) ++ struct nlattr **tca, unsigned long *arg, struct netlink_ext_ack *extack) + { + struct netlink_ext_ack *extack = NULL; + #else +@@ -516,7 +516,11 @@ static void nss_htb_destroy_class(struct + * nss_htb_delete_class() + * Detaches a class from operation, but does not destroy it. + */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)) ++static int nss_htb_delete_class(struct Qdisc *sch, unsigned long arg, struct netlink_ext_ack *extack) ++#else + static int nss_htb_delete_class(struct Qdisc *sch, unsigned long arg) ++#endif + { + struct nss_htb_sched_data *q = qdisc_priv(sch); + struct nss_htb_class_data *cl = (struct nss_htb_class_data *)arg; +--- a/nss_qdisc/nss_qdisc.c ++++ b/nss_qdisc/nss_qdisc.c +@@ -1140,15 +1140,16 @@ unsigned int nss_qdisc_drop(struct Qdisc + { + struct nss_qdisc *nq = qdisc_priv(sch); + unsigned int ret; ++ struct sk_buff *to_free = qdisc_peek_head(sch); + + if (!nq->is_virtual) { +- ret = __qdisc_queue_drop_head(sch, &sch->q); ++ ret = __qdisc_queue_drop_head(sch, &sch->q, &to_free); + } else { + spin_lock_bh(&nq->bounce_protection_lock); + /* + * This function is safe to call within locks + */ +- ret = __qdisc_queue_drop_head(sch, &sch->q); ++ ret = __qdisc_queue_drop_head(sch, &sch->q, &to_free); + spin_unlock_bh(&nq->bounce_protection_lock); + } + +@@ -1209,10 +1210,10 @@ static bool nss_qdisc_iterate_fl(struct + return 0; + } + +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)) +- status = tc_classify(skb, tcf, &res, false); +-#else ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) + status = tcf_classify(skb, tcf, &res, false); ++#else ++ status = tcf_classify(skb, NULL, tcf, &res, false); + #endif + if ((status == TC_ACT_STOLEN) || (status == TC_ACT_QUEUED)) { + return 1; +--- a/nss_qdisc/nss_wrr.c ++++ b/nss_qdisc/nss_wrr.c +@@ -229,7 +229,7 @@ static int nss_wrr_ppe_change_class(stru + + #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) + static int nss_wrr_change_class(struct Qdisc *sch, u32 classid, u32 parentid, +- struct nlattr **tca, unsigned long *arg) ++ struct nlattr **tca, unsigned long *arg, struct netlink_ext_ack *extack) + { + struct netlink_ext_ack *extack = NULL; + #else +@@ -400,7 +400,11 @@ failure: + return -EINVAL; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)) ++static int nss_wrr_delete_class(struct Qdisc *sch, unsigned long arg, struct netlink_ext_ack *extack) ++#else + static int nss_wrr_delete_class(struct Qdisc *sch, unsigned long arg) ++#endif + { + struct nss_wrr_sched_data *q = qdisc_priv(sch); + struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)arg; diff --git a/qca-nss-clients/patches-11.4/0002-kernel-5.4-support-gre.patch b/qca-nss-clients/patches-11.4/0002-kernel-5.4-support-gre.patch new file mode 100644 index 0000000..7ed66bd --- /dev/null +++ b/qca-nss-clients/patches-11.4/0002-kernel-5.4-support-gre.patch @@ -0,0 +1,31 @@ +--- a/gre/nss_connmgr_gre_v6.c ++++ b/gre/nss_connmgr_gre_v6.c +@@ -95,7 +95,8 @@ static int nss_connmgr_gre_v6_get_mac_ad + /* + * Find src MAC address + */ +- local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, 1); ++ local_dev = NULL; ++ local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, local_dev); + if (!local_dev) { + nss_connmgr_gre_warning("Unable to find local dev for %pI6", src_ip); + return GRE_ERR_NO_LOCAL_NETDEV; +--- a/gre/test/nss_connmgr_gre_test.c ++++ b/gre/test/nss_connmgr_gre_test.c +@@ -229,10 +229,12 @@ static int nss_connmgr_gre_test_open_pro + /* + * Proc ops + */ +-static const struct file_operations nss_connmgr_gre_test_proc_ops = { +- .open = nss_connmgr_gre_test_open_proc, +- .write = nss_connmgr_gre_test_write_proc, +- .read = seq_read, ++static const struct proc_ops nss_connmgr_gre_test_proc_ops = { ++ .proc_open = nss_connmgr_gre_test_open_proc, ++ .proc_read = seq_read, ++ .proc_lseek = seq_lseek, ++ .proc_release = single_release, ++ .proc_write = nss_connmgr_gre_test_write_proc, + }; + + /* diff --git a/qca-nss-clients/patches-11.4/0003-kernel-5.4-support-ipsec.patch b/qca-nss-clients/patches-11.4/0003-kernel-5.4-support-ipsec.patch new file mode 100644 index 0000000..de43b4d --- /dev/null +++ b/qca-nss-clients/patches-11.4/0003-kernel-5.4-support-ipsec.patch @@ -0,0 +1,29 @@ +--- a/ipsecmgr/v1.0/nss_ipsecmgr.c ++++ b/ipsecmgr/v1.0/nss_ipsecmgr.c +@@ -377,7 +377,7 @@ free: + * nss_ipsecmgr_tunnel_stats() + * get tunnel statistics + */ +-static struct rtnl_link_stats64 *nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) ++void nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) + { + struct nss_ipsecmgr_priv *priv = netdev_priv(dev); + +@@ -389,8 +389,6 @@ static struct rtnl_link_stats64 *nss_ips + read_lock_bh(&ipsecmgr_ctx->lock); + memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64)); + read_unlock_bh(&ipsecmgr_ctx->lock); +- +- return stats; + } + + /* +@@ -442,7 +440,7 @@ static void nss_ipsecmgr_tunnel_setup(st + dev->header_ops = NULL; + dev->netdev_ops = &nss_ipsecmgr_tunnel_ops; + +- dev->destructor = nss_ipsecmgr_tunnel_free; ++ dev->priv_destructor = nss_ipsecmgr_tunnel_free; + + /* + * get the MAC address from the ethernet device diff --git a/qca-nss-clients/patches-11.4/0004-kernel-5.4-support-dtls.patch b/qca-nss-clients/patches-11.4/0004-kernel-5.4-support-dtls.patch new file mode 100644 index 0000000..ae9c914 --- /dev/null +++ b/qca-nss-clients/patches-11.4/0004-kernel-5.4-support-dtls.patch @@ -0,0 +1,11 @@ +--- a/dtls/v1.0/nss_connmgr_dtls_netdev.c ++++ b/dtls/v1.0/nss_connmgr_dtls_netdev.c +@@ -160,7 +160,7 @@ static void nss_dtlsmgr_dev_setup(struct + dev->ethtool_ops = NULL; + dev->header_ops = NULL; + dev->netdev_ops = &nss_dtlsmgr_session_ops; +- dev->destructor = NULL; ++ dev->priv_destructor = NULL; + + memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len); + memset(dev->broadcast, 0xff, dev->addr_len); diff --git a/qca-nss-clients/patches-11.4/0005-vlanmgr-fix-compile-error.patch b/qca-nss-clients/patches-11.4/0005-vlanmgr-fix-compile-error.patch new file mode 100644 index 0000000..13fb767 --- /dev/null +++ b/qca-nss-clients/patches-11.4/0005-vlanmgr-fix-compile-error.patch @@ -0,0 +1,59 @@ +--- a/vlan/nss_vlan_mgr.c ++++ b/vlan/nss_vlan_mgr.c +@@ -800,8 +800,10 @@ static struct nss_vlan_pvt *nss_vlan_mgr + */ + static void nss_vlan_mgr_instance_free(struct nss_vlan_pvt *v) + { ++#ifdef NSS_VLAN_MGR_PPE_SUPPORT + int32_t i; + int ret = 0; ++#endif + + spin_lock(&vlan_mgr_ctx.lock); + BUG_ON(--v->refs); +@@ -961,8 +963,11 @@ static int nss_vlan_mgr_register_event(s + int ret; + #endif + uint32_t vlan_tag; ++#ifdef NSS_VLAN_MGR_PPE_SUPPORT + struct net_device *slave; +- int32_t port, port_if; ++ int32_t port; ++#endif ++ int32_t port_if; + struct vlan_dev_priv *vlan; + struct net_device *real_dev; + bool is_bond_master = false; +@@ -1355,8 +1360,10 @@ return_with_error: + int nss_vlan_mgr_join_bridge(struct net_device *dev, uint32_t bridge_vsi) + { + struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev); ++#ifdef NSS_VLAN_MGR_PPE_SUPPORT + struct net_device *real_dev; + int ret; ++#endif + + if (!v) + return 0; +@@ -1416,8 +1423,10 @@ EXPORT_SYMBOL(nss_vlan_mgr_join_bridge); + int nss_vlan_mgr_leave_bridge(struct net_device *dev, uint32_t bridge_vsi) + { + struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev); ++#ifdef NSS_VLAN_MGR_PPE_SUPPORT + struct net_device *real_dev; + int ret; ++#endif + + if (!v) + return 0; +--- a/vlan/Makefile ++++ b/vlan/Makefile +@@ -8,7 +8,7 @@ ifeq ($(SoC),$(filter $(SoC),ipq807x ipq + ccflags-y += -DNSS_VLAN_MGR_PPE_SUPPORT + endif + +-ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=0 ++ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=4 + ccflags-y += -Wall -Werror + + ifneq (,$(filter $(CONFIG_BONDING),y m)) diff --git a/qca-nss-clients/patches-11.4/0006-match-fix-compile-error.patch b/qca-nss-clients/patches-11.4/0006-match-fix-compile-error.patch new file mode 100644 index 0000000..ad3ad0b --- /dev/null +++ b/qca-nss-clients/patches-11.4/0006-match-fix-compile-error.patch @@ -0,0 +1,25 @@ +--- a/match/nss_match_priv.h ++++ b/match/nss_match_priv.h +@@ -29,19 +29,19 @@ + /* + * Statically compile messages at different levels + */ +-#if (NSS_match_DEBUG_LEVEL < 2) ++#if (NSS_MATCH_DEBUG_LEVEL < 2) + #define nss_match_warn(s, ...) + #else + #define nss_match_warn(s, ...) pr_warn("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__) + #endif + +-#if (NSS_match_DEBUG_LEVEL < 3) ++#if (NSS_MATCH_DEBUG_LEVEL < 3) + #define nss_match_info(s, ...) + #else + #define nss_match_info(s, ...) pr_notice("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__) + #endif + +-#if (NSS_match_DEBUG_LEVEL < 4) ++#if (NSS_MATCH_DEBUG_LEVEL < 4) + #define nss_match_trace(s, ...) + #else + #define nss_match_trace(s, ...) pr_info("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__) diff --git a/qca-nss-clients/patches-11.4/0007-bridge-fix-compile-error.patch b/qca-nss-clients/patches-11.4/0007-bridge-fix-compile-error.patch new file mode 100644 index 0000000..539ff68 --- /dev/null +++ b/qca-nss-clients/patches-11.4/0007-bridge-fix-compile-error.patch @@ -0,0 +1,29 @@ +--- a/bridge/nss_bridge_mgr.c ++++ b/bridge/nss_bridge_mgr.c +@@ -1098,8 +1098,10 @@ int nss_bridge_mgr_register_br(struct ne + */ + b_pvt->ifnum = ifnum; + b_pvt->mtu = dev->mtu; ++#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT) + b_pvt->wan_if_num = -1; + b_pvt->wan_if_enabled = false; ++#endif + ether_addr_copy(b_pvt->dev_addr, dev->dev_addr); + spin_lock(&br_mgr_ctx.lock); + list_add(&b_pvt->list, &br_mgr_ctx.list); +@@ -1165,6 +1167,7 @@ static int nss_bridge_mgr_bond_slave_cha + return NOTIFY_DONE; + } + ++#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT) + /* + * Add or remove the slave based based on linking event + */ +@@ -1179,6 +1182,7 @@ static int nss_bridge_mgr_bond_slave_cha + cu_info->upper_dev->name, master->name); + } + } ++#endif + + return NOTIFY_DONE; + } diff --git a/qca-nss-clients/patches-11.4/0008-profiler-fix-compile-error.patch b/qca-nss-clients/patches-11.4/0008-profiler-fix-compile-error.patch new file mode 100644 index 0000000..8b6d92c --- /dev/null +++ b/qca-nss-clients/patches-11.4/0008-profiler-fix-compile-error.patch @@ -0,0 +1,61 @@ +--- a/profiler/profile.c ++++ b/profiler/profile.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -937,12 +938,26 @@ static ssize_t debug_if(struct file *fil + return count; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) ++#define HAVE_PROC_OPS ++#endif ++ ++#ifdef HAVE_PROC_OPS ++static const struct proc_ops profile_fops = { ++ .proc_open = profile_open, ++ .proc_read = profile_read, ++ .proc_lseek = seq_lseek, ++ .proc_release = profile_release, ++ .proc_write = debug_if, ++}; ++#else + static const struct file_operations profile_fops = { + .open = profile_open, + .read = profile_read, + .release = profile_release, + .write = debug_if, + }; ++#endif + + /* + * showing sample status on Linux console +@@ -971,6 +986,15 @@ static ssize_t profile_rate_write(struct + return 0; + } + ++#ifdef HAVE_PROC_OPS ++static const struct proc_ops profile_rate_fops = { ++ .proc_open = profile_rate_open, ++ .proc_read = seq_read, ++ .proc_lseek = seq_lseek, ++ .proc_release = single_release, ++ .proc_write = profile_rate_write, ++}; ++#else + static const struct file_operations profile_rate_fops = { + .open = profile_rate_open, + .read = seq_read, +@@ -978,6 +1002,7 @@ static const struct file_operations prof + .release = single_release, + .write = profile_rate_write, + }; ++#endif + + /* + * hexdump diff --git a/qca-nss-clients/patches-11.4/0009-gre-fix-compile-error.patch b/qca-nss-clients/patches-11.4/0009-gre-fix-compile-error.patch new file mode 100644 index 0000000..e833327 --- /dev/null +++ b/qca-nss-clients/patches-11.4/0009-gre-fix-compile-error.patch @@ -0,0 +1,17 @@ +--- a/gre/nss_connmgr_gre_v4.c ++++ b/gre/nss_connmgr_gre_v4.c +@@ -172,14 +172,6 @@ int nss_connmgr_gre_v4_set_config(struct + } + } + +- /* +- * IP address validate +- */ +- if ((cfg->src_ip == 0) || (cfg->dest_ip == 0)) { +- nss_connmgr_gre_warning("Source ip/Destination IP is invalid"); +- return GRE_ERR_INVALID_IP; +- } +- + memset(t, 0, sizeof(struct ip_tunnel)); + + priv->pad_len = (cfg->add_padding) ? GRE_HDR_PAD_LEN : 0; diff --git a/qca-nss-clients/patches-11.4/0010-fix-portifmgr.patch b/qca-nss-clients/patches-11.4/0010-fix-portifmgr.patch new file mode 100644 index 0000000..343f17b --- /dev/null +++ b/qca-nss-clients/patches-11.4/0010-fix-portifmgr.patch @@ -0,0 +1,35 @@ +--- a/portifmgr/nss_portifmgr.c ++++ b/portifmgr/nss_portifmgr.c +@@ -187,16 +187,20 @@ drop: + } + + /* +- * nss_portifmgr_get_stats() ++ * nss_portifmgr_get_stats64() + * Netdev get stats function to get port stats + */ +-static struct rtnl_link_stats64 *nss_portifmgr_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) ++/* ++ * nss_nlgre_redir_cmn_dev_stats64 ++ * Report packet statistics to linux ++ */ ++static void nss_portifmgr_get_stats64(struct net_device *dev, ++ struct rtnl_link_stats64 *stats) + { + struct nss_portifmgr_priv *priv = (struct nss_portifmgr_priv *)netdev_priv(dev); + BUG_ON(priv == NULL); + + nss_portid_get_stats(priv->if_num, stats); +- return stats; + } + + /* +@@ -225,7 +229,7 @@ static const struct net_device_ops nss_p + .ndo_start_xmit = nss_portifmgr_start_xmit, + .ndo_set_mac_address = eth_mac_addr, + .ndo_change_mtu = nss_portifmgr_change_mtu, +- .ndo_get_stats64 = nss_portifmgr_get_stats, ++ .ndo_get_stats64 = nss_portifmgr_get_stats64, + }; + + /* diff --git a/qca-nss-clients/patches-11.4/0011-dtlsmgr-fix-SHA-header-include-in-5.15.patch b/qca-nss-clients/patches-11.4/0011-dtlsmgr-fix-SHA-header-include-in-5.15.patch new file mode 100644 index 0000000..a095a53 --- /dev/null +++ b/qca-nss-clients/patches-11.4/0011-dtlsmgr-fix-SHA-header-include-in-5.15.patch @@ -0,0 +1,48 @@ +--- a/dtls/v2.0/nss_dtlsmgr.c ++++ b/dtls/v2.0/nss_dtlsmgr.c +@@ -38,7 +38,13 @@ + #include + #include + #include ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) + #include ++#else ++#include ++#include ++#endif + #include + #include + +--- a/dtls/v2.0/nss_dtlsmgr_ctx.c ++++ b/dtls/v2.0/nss_dtlsmgr_ctx.c +@@ -40,7 +40,13 @@ + #include + #include + #include ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) + #include ++#else ++#include ++#include ++#endif + #include + #include + +--- a/dtls/v2.0/nss_dtlsmgr_ctx_dev.c ++++ b/dtls/v2.0/nss_dtlsmgr_ctx_dev.c +@@ -36,7 +36,13 @@ + #include + #include + #include ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) + #include ++#else ++#include ++#include ++#endif + + #include + #include diff --git a/qca-nss-clients/patches-11.4/0012-dtlsmgr-fix-debug-print-in-5.15.patch b/qca-nss-clients/patches-11.4/0012-dtlsmgr-fix-debug-print-in-5.15.patch new file mode 100644 index 0000000..89936db --- /dev/null +++ b/qca-nss-clients/patches-11.4/0012-dtlsmgr-fix-debug-print-in-5.15.patch @@ -0,0 +1,36 @@ +--- a/dtls/v2.0/nss_dtlsmgr_private.h ++++ b/dtls/v2.0/nss_dtlsmgr_private.h +@@ -36,9 +36,9 @@ + /* + * Compile messages for dynamic enable/disable + */ +-#define nss_dtlsmgr_warn(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) +-#define nss_dtlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) +-#define nss_dtlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) ++#define nss_dtlsmgr_warn(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); ++#define nss_dtlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); ++#define nss_dtlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); + #else + + /* +@@ -46,17 +46,17 @@ + */ + #define nss_dtlsmgr_warn(s, ...) { \ + if (NSS_DTLSMGR_DEBUG_LEVEL > NSS_DTLSMGR_DEBUG_LEVEL_ERROR) \ +- pr_warn("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \ ++ pr_warn("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \ + } + + #define nss_dtlsmgr_info(s, ...) { \ + if (NSS_DTLSMGR_DEBUG_LEVEL > NSS_DTLSMGR_DEBUG_LEVEL_WARN) \ +- pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \ ++ pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \ + } + + #define nss_dtlsmgr_trace(s, ...) { \ + if (NSS_DTLSMGR_DEBUG_LEVEL > NSS_DTLSMGR_DEBUG_LEVEL_INFO) \ +- pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \ ++ pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \ + } + + #endif /* CONFIG_DYNAMIC_DEBUG */ diff --git a/qca-nss-clients/patches-11.4/0013-tlsmgr-fix-SHA-header-include-in-5.15.patch b/qca-nss-clients/patches-11.4/0013-tlsmgr-fix-SHA-header-include-in-5.15.patch new file mode 100644 index 0000000..f3cee73 --- /dev/null +++ b/qca-nss-clients/patches-11.4/0013-tlsmgr-fix-SHA-header-include-in-5.15.patch @@ -0,0 +1,32 @@ +--- a/tls/nss_tlsmgr_crypto.c ++++ b/tls/nss_tlsmgr_crypto.c +@@ -41,7 +41,13 @@ + #include + #include + #include ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) + #include ++#else ++#include ++#include ++#endif + #include + #include + #include +--- a/tls/nss_tlsmgr_tun.c ++++ b/tls/nss_tlsmgr_tun.c +@@ -35,7 +35,13 @@ + #include + #include + #include ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) + #include ++#else ++#include ++#include ++#endif + + #include + #include diff --git a/qca-nss-clients/patches-11.4/0014-ovpnmgr-fix-SHA-header-include-in-5.15.patch b/qca-nss-clients/patches-11.4/0014-ovpnmgr-fix-SHA-header-include-in-5.15.patch new file mode 100644 index 0000000..0b8cd17 --- /dev/null +++ b/qca-nss-clients/patches-11.4/0014-ovpnmgr-fix-SHA-header-include-in-5.15.patch @@ -0,0 +1,32 @@ +--- a/openvpn/src/nss_ovpnmgr_crypto.c ++++ b/openvpn/src/nss_ovpnmgr_crypto.c +@@ -28,7 +28,13 @@ + #include + #include + #include ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) + #include ++#else ++#include ++#include ++#endif + #include + + #include +--- a/openvpn/src/nss_ovpnmgr_route.c ++++ b/openvpn/src/nss_ovpnmgr_route.c +@@ -34,7 +34,13 @@ + #include + #include + #include ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) + #include ++#else ++#include ++#include ++#endif + #include + + #include diff --git a/qca-nss-clients/patches-11.4/0015-tunipip6-fix-compile-error-in-5.15.patch b/qca-nss-clients/patches-11.4/0015-tunipip6-fix-compile-error-in-5.15.patch new file mode 100644 index 0000000..b9d6c2e --- /dev/null +++ b/qca-nss-clients/patches-11.4/0015-tunipip6-fix-compile-error-in-5.15.patch @@ -0,0 +1,11 @@ +--- a/tunipip6/nss_connmgr_tunipip6.c ++++ b/tunipip6/nss_connmgr_tunipip6.c +@@ -258,7 +258,7 @@ static void nss_tunipip6_decap_exception + struct iphdr *iph; + struct rtable *rt; + int cpu; +- int8_t ver = skb->data[0] >> 4; ++ __attribute__((unused)) int8_t ver = skb->data[0] >> 4; + + nss_tunipip6_trace("%px: received - %d bytes name %s ver %x\n", + dev, skb->len, dev->name, ver); diff --git a/qca-nss-clients/patches-11.4/0016-vxlanmgr-fix-compile-error-in-5.15.patch b/qca-nss-clients/patches-11.4/0016-vxlanmgr-fix-compile-error-in-5.15.patch new file mode 100644 index 0000000..e69de29 diff --git a/qca-nss-clients/patches-11.4/0017-tlsmgr-fix-debug-print-in-5.15.patch b/qca-nss-clients/patches-11.4/0017-tlsmgr-fix-debug-print-in-5.15.patch new file mode 100644 index 0000000..4fbdecb --- /dev/null +++ b/qca-nss-clients/patches-11.4/0017-tlsmgr-fix-debug-print-in-5.15.patch @@ -0,0 +1,34 @@ +--- a/tls/nss_tlsmgr_priv.h ++++ b/tls/nss_tlsmgr_priv.h +@@ -28,7 +28,7 @@ + #define NSS_TLSMGR_DEBUG_LEVEL_INFO 3 + #define NSS_TLSMGR_DEBUG_LEVEL_TRACE 4 + +-#define nss_tlsmgr_info_always(s, ...) pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) ++#define nss_tlsmgr_info_always(s, ...) pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); + + #define nss_tlsmgr_error(s, ...) do { \ + if (net_ratelimit()) { \ +@@ -43,18 +43,18 @@ + } while (0) + + #if defined(CONFIG_DYNAMIC_DEBUG) +-#define nss_tlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) +-#define nss_tlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) ++#define nss_tlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); ++#define nss_tlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); + #else + + #define nss_tlsmgr_info(s, ...) { \ + if (NSS_TLSMGR_DEBUG_LEVEL > NSS_TLSMGR_DEBUG_LEVEL_WARN) \ +- pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \ ++ pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \ + } + + #define nss_tlsmgr_trace(s, ...) { \ + if (NSS_TLSMGR_DEBUG_LEVEL > NSS_TLSMGR_DEBUG_LEVEL_INFO) \ +- pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \ ++ pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \ + } + + #endif /* CONFIG_DYNAMIC_DEBUG */ diff --git a/qca-nss-clients/patches-11.4/0018-kernel-6.1-support.patch b/qca-nss-clients/patches-11.4/0018-kernel-6.1-support.patch new file mode 100644 index 0000000..fb9a27a --- /dev/null +++ b/qca-nss-clients/patches-11.4/0018-kernel-6.1-support.patch @@ -0,0 +1,344 @@ +--- a/bridge/nss_bridge_mgr.c ++++ b/bridge/nss_bridge_mgr.c +@@ -1045,7 +1045,7 @@ int nss_bridge_mgr_register_br(struct ne + } + #endif + +- err = nss_bridge_tx_set_mac_addr_msg(ifnum, dev->dev_addr); ++ err = nss_bridge_tx_set_mac_addr_msg(ifnum, (uint8_t *) dev->dev_addr); + if (err != NSS_TX_SUCCESS) { + nss_bridge_mgr_warn("%px: failed to set mac_addr msg, error = %d\n", b_pvt, err); + goto fail_3; +@@ -1202,7 +1202,7 @@ static int nss_bridge_mgr_changeaddr_eve + + nss_bridge_mgr_trace("%px: MAC changed to %pM, update NSS\n", b_pvt, dev->dev_addr); + +- if (nss_bridge_tx_set_mac_addr_msg(b_pvt->ifnum, dev->dev_addr) != NSS_TX_SUCCESS) { ++ if (nss_bridge_tx_set_mac_addr_msg(b_pvt->ifnum, (uint8_t *) dev->dev_addr) != NSS_TX_SUCCESS) { + nss_bridge_mgr_warn("%px: Failed to send change MAC address message to NSS\n", b_pvt); + return NOTIFY_DONE; + } +--- a/dtls/v2.0/nss_dtlsmgr_ctx_dev.c ++++ b/dtls/v2.0/nss_dtlsmgr_ctx_dev.c +@@ -532,7 +532,7 @@ void nss_dtlsmgr_ctx_dev_setup(struct ne + #else + dev->priv_destructor = nss_dtlsmgr_ctx_dev_free; + #endif +- memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len); ++ memcpy((void *) dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len); + memset(dev->broadcast, 0xff, dev->addr_len); + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); + } +--- a/gre/test/nss_connmgr_gre_test.c ++++ b/gre/test/nss_connmgr_gre_test.c +@@ -223,7 +223,7 @@ static int nss_connmgr_gre_test_show_pro + */ + static int nss_connmgr_gre_test_open_proc(struct inode *inode, struct file *filp) + { +- return single_open(filp, nss_connmgr_gre_test_show_proc, PDE_DATA(inode)); ++ return single_open(filp, nss_connmgr_gre_test_show_proc, pde_data(inode)); + } + + /* +--- a/gre/nss_connmgr_gre.c ++++ b/gre/nss_connmgr_gre.c +@@ -279,10 +279,10 @@ static struct rtnl_link_stats64 *nss_con + #else + start = u64_stats_fetch_begin_irq(&tstats->syncp); + #endif +- rx_packets = tstats->rx_packets; +- tx_packets = tstats->tx_packets; +- rx_bytes = tstats->rx_bytes; +- tx_bytes = tstats->tx_bytes; ++ rx_packets = u64_stats_read(&tstats->rx_packets); ++ tx_packets = u64_stats_read(&tstats->tx_packets); ++ rx_bytes = u64_stats_read(&tstats->rx_bytes); ++ tx_bytes = u64_stats_read(&tstats->tx_bytes); + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)) + } while (u64_stats_fetch_retry_bh(&tstats->syncp, start)); + #else +@@ -697,11 +697,11 @@ static void nss_connmgr_gre_event_receiv + tstats = this_cpu_ptr(dev->tstats); + u64_stats_update_begin(&tstats->syncp); + if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_INNER) { +- tstats->tx_packets += stats->tx_packets; +- tstats->tx_bytes += stats->tx_bytes; ++ u64_stats_add(&tstats->tx_packets, stats->tx_packets); ++ u64_stats_add(&tstats->tx_bytes, stats->tx_bytes); + } else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_OUTER) { +- tstats->rx_packets += stats->rx_packets; +- tstats->rx_bytes += stats->rx_bytes; ++ u64_stats_add(&tstats->rx_packets, stats->rx_packets); ++ u64_stats_add(&tstats->rx_bytes, stats->rx_bytes); + } + u64_stats_update_end(&tstats->syncp); + dev->stats.rx_dropped += nss_cmn_rx_dropped_sum(stats); +--- a/tunipip6/nss_connmgr_tunipip6.c ++++ b/tunipip6/nss_connmgr_tunipip6.c +@@ -354,11 +354,11 @@ static void nss_tunipip6_update_dev_stat + + memset(&stats, 0, sizeof(stats)); + if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_INNER) { +- stats.tx_packets = sync_stats->node_stats.tx_packets; +- stats.tx_bytes = sync_stats->node_stats.tx_bytes; ++ u64_stats_set(&stats.tx_packets, sync_stats->node_stats.tx_packets); ++ u64_stats_set(&stats.tx_bytes, sync_stats->node_stats.tx_bytes); + } else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_OUTER) { +- stats.rx_packets = sync_stats->node_stats.rx_packets; +- stats.rx_bytes = sync_stats->node_stats.rx_bytes; ++ u64_stats_set(&stats.rx_packets, sync_stats->node_stats.rx_packets); ++ u64_stats_set(&stats.rx_bytes, sync_stats->node_stats.rx_bytes); + } else { + nss_tunipip6_warning("%px: Invalid interface type received from NSS\n", dev); + return; +--- a/nss_qdisc/igs/nss_mirred.c ++++ b/nss_qdisc/igs/nss_mirred.c +@@ -317,7 +317,7 @@ static int nss_mirred_act(struct sk_buff + * Update the last use of action. + */ + tcf_lastuse_update(&act->tcf_tm); +- bstats_cpu_update(this_cpu_ptr(act->common.cpu_bstats), skb); ++ bstats_update(this_cpu_ptr(act->common.cpu_bstats), skb); + + rcu_read_lock(); + retval = READ_ONCE(act->tcf_action); +--- a/nss_qdisc/nss_qdisc.h ++++ b/nss_qdisc/nss_qdisc.h +@@ -188,7 +188,7 @@ struct nss_qdisc { + /* Shaper configure callback for reading shaper specific + * responses (e.g. memory size). + */ +- struct gnet_stats_basic_packed bstats; /* Basic class statistics */ ++ struct gnet_stats_basic_sync bstats; /* Basic class statistics */ + struct gnet_stats_queue qstats; /* Qstats for use by classes */ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)) + atomic_t refcnt; /* Reference count for class use */ +@@ -445,7 +445,7 @@ extern void nss_qdisc_stop_basic_stats_p + * Wrapper around gnet_stats_copy_basic() + */ + extern int nss_qdisc_gnet_stats_copy_basic(struct Qdisc *sch, +- struct gnet_dump *d, struct gnet_stats_basic_packed *b); ++ struct gnet_dump *d, struct gnet_stats_basic_sync *b); + + /* + * nss_qdisc_gnet_stats_copy_queue() +--- a/nss_qdisc/igs/nss_ifb.c ++++ b/nss_qdisc/igs/nss_ifb.c +@@ -544,8 +544,10 @@ static void nss_ifb_update_dev_stats(str + * post shaping. Therefore IFB interface's stats should be updated + * with NSS firmware's IFB TX stats only. + */ +- stats.rx_packets = stats.tx_packets = node_stats->tx_packets; +- stats.rx_bytes = stats.tx_bytes = node_stats->tx_bytes; ++ u64_stats_set(&stats.rx_packets, node_stats->tx_packets); ++ u64_stats_set(&stats.tx_packets, node_stats->tx_packets); ++ u64_stats_set(&stats.rx_bytes, node_stats->tx_bytes); ++ u64_stats_set(&stats.tx_bytes, node_stats->tx_bytes); + dev->stats.rx_dropped = dev->stats.tx_dropped += sync_stats->igs_stats.tx_dropped; + u64_stats_update_end(&stats.syncp); + +--- a/nss_qdisc/nss_qdisc.c ++++ b/nss_qdisc/nss_qdisc.c +@@ -14,6 +14,7 @@ + ************************************************************************** + */ + ++#include "net/gen_stats.h" + #include + #include "nss_qdisc.h" + #include "nss_fifo.h" +@@ -2173,7 +2174,7 @@ int __nss_qdisc_init(struct Qdisc *sch, + * This is to prevent mixing NSS and PPE qdisc with linux qdisc. + */ + if ((parent != TC_H_ROOT) && (root->ops->owner != THIS_MODULE)) { +- nss_qdisc_warning("NSS qdisc %px (type %d) used along with non-nss qdiscs," ++ nss_qdisc_info("NSS qdisc %px (type %d) used along with non-nss qdiscs," + " or the interface is currently down", nq->qdisc, nq->type); + } + +@@ -2562,7 +2563,7 @@ static void nss_qdisc_basic_stats_callba + { + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + struct Qdisc *qdisc = nq->qdisc; +- struct gnet_stats_basic_packed *bstats; ++ struct gnet_stats_basic_sync *bstats; + struct gnet_stats_queue *qstats; + struct nss_shaper_node_stats_response *response; + #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)) +@@ -2601,8 +2602,8 @@ static void nss_qdisc_basic_stats_callba + * Update qdisc->bstats + */ + spin_lock_bh(&nq->lock); +- bstats->bytes += (__u64)response->sn_stats.delta.dequeued_bytes; +- bstats->packets += response->sn_stats.delta.dequeued_packets; ++ u64_stats_add(&bstats->bytes, (__u64)response->sn_stats.delta.dequeued_bytes); ++ u64_stats_add(&bstats->packets, response->sn_stats.delta.dequeued_packets); + + /* + * Update qdisc->qstats +@@ -2762,12 +2763,14 @@ void nss_qdisc_stop_basic_stats_polling( + * Wrapper around gnet_stats_copy_basic() + */ + int nss_qdisc_gnet_stats_copy_basic(struct Qdisc *sch, struct gnet_dump *d, +- struct gnet_stats_basic_packed *b) ++ struct gnet_stats_basic_sync *b) + { + #if (LINUX_VERSION_CODE <= KERNEL_VERSION(3, 18, 0)) + return gnet_stats_copy_basic(d, b); + #elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) + return gnet_stats_copy_basic(d, NULL, b); ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)) ++ return gnet_stats_copy_basic(d, NULL, b, true); + #else + return gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), d, NULL, b); + #endif +@@ -2798,7 +2801,6 @@ static int nss_qdisc_if_event_cb(struct + struct net_device *br; + struct Qdisc *br_qdisc; + int if_num, br_num; +- struct nss_qdisc *nq; + + dev = nss_qdisc_get_dev(ptr); + if (!dev) { +@@ -2841,8 +2843,6 @@ static int nss_qdisc_if_event_cb(struct + break; + } + +- nq = (struct nss_qdisc *)qdisc_priv(br_qdisc); +- + /* + * Call attach or detach according as per event type. + */ +--- a/vlan/nss_vlan_mgr.c ++++ b/vlan/nss_vlan_mgr.c +@@ -808,7 +808,7 @@ static struct nss_vlan_pvt *nss_vlan_mgr + } + + v->mtu = dev->mtu; +- ether_addr_copy(v->dev_addr, dev->dev_addr); ++ ether_addr_copy(v->dev_addr, (uint8_t *) dev->dev_addr); + v->ifindex = dev->ifindex; + v->refs = 1; + +@@ -956,14 +956,14 @@ static int nss_vlan_mgr_changeaddr_event + } + spin_unlock(&vlan_mgr_ctx.lock); + +- if (nss_vlan_tx_set_mac_addr_msg(v_pvt->nss_if, dev->dev_addr) != NSS_TX_SUCCESS) { ++ if (nss_vlan_tx_set_mac_addr_msg(v_pvt->nss_if, (uint8_t *) dev->dev_addr) != NSS_TX_SUCCESS) { + nss_vlan_mgr_warn("%s: Failed to send change MAC address message to NSS\n", dev->name); + nss_vlan_mgr_instance_deref(v_pvt); + return NOTIFY_BAD; + } + + spin_lock(&vlan_mgr_ctx.lock); +- ether_addr_copy(v_pvt->dev_addr, dev->dev_addr); ++ ether_addr_copy(v_pvt->dev_addr, (uint8_t *) dev->dev_addr); + spin_unlock(&vlan_mgr_ctx.lock); + nss_vlan_mgr_trace("%s: MAC changed to %pM, updated NSS\n", dev->name, dev->dev_addr); + nss_vlan_mgr_instance_deref(v_pvt); +--- a/vxlanmgr/nss_vxlanmgr_tunnel.c ++++ b/vxlanmgr/nss_vxlanmgr_tunnel.c +@@ -465,8 +465,8 @@ static void nss_vxlanmgr_tunnel_inner_st + + tstats = this_cpu_ptr(dev->tstats); + u64_stats_update_begin(&tstats->syncp); +- tstats->tx_packets += stats->node_stats.tx_packets; +- tstats->tx_bytes += stats->node_stats.tx_bytes; ++ u64_stats_add(&tstats->tx_packets, stats->node_stats.tx_packets); ++ u64_stats_add(&tstats->tx_bytes, stats->node_stats.tx_bytes); + u64_stats_update_end(&tstats->syncp); + netdev_stats->tx_dropped += dropped; + dev_put(dev); +@@ -503,8 +503,8 @@ static void nss_vxlanmgr_tunnel_outer_st + + tstats = this_cpu_ptr(dev->tstats); + u64_stats_update_begin(&tstats->syncp); +- tstats->rx_packets += stats->node_stats.tx_packets; +- tstats->rx_bytes += stats->node_stats.tx_bytes; ++ u64_stats_add(&tstats->rx_packets, stats->node_stats.tx_packets); ++ u64_stats_add(&tstats->rx_bytes, stats->node_stats.tx_bytes); + u64_stats_update_end(&tstats->syncp); + netdev_stats->rx_dropped += dropped; + dev_put(dev); +--- a/pvxlanmgr/nss_pvxlanmgr.c ++++ b/pvxlanmgr/nss_pvxlanmgr.c +@@ -177,7 +177,7 @@ static struct rtnl_link_stats64 *nss_pvx + * Netdev seems to be incrementing rx_dropped because we don't give IP header. + * So reset it as it's of no use for us. + */ +- atomic_long_set(&dev->rx_dropped, 0); ++ atomic_long_set(&(dev)->stats.__rx_dropped, 0); + priv = netdev_priv(dev); + memset(stats, 0, sizeof(struct rtnl_link_stats64)); + memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64)); +@@ -305,7 +305,7 @@ static void nss_pvxlanmgr_dummy_netdev_s + dev->priv_destructor = NULL; + #endif + +- memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len); ++ memcpy((void *) dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len); + memset(dev->broadcast, 0xff, dev->addr_len); + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); + } +--- a/tls/nss_tlsmgr_tun.c ++++ b/tls/nss_tlsmgr_tun.c +@@ -185,7 +185,7 @@ static void nss_tlsmgr_tun_setup(struct + /* + * Get the MAC address from the ethernet device + */ +- random_ether_addr(dev->dev_addr); ++ eth_random_addr((u8 *) dev->dev_addr); + + memset(dev->broadcast, 0xff, dev->addr_len); + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); +--- a/netlink/nss_nlgre_redir_cmn.c ++++ b/netlink/nss_nlgre_redir_cmn.c +@@ -384,7 +384,7 @@ static int nss_nlgre_redir_cmn_set_mac_a + return -EINVAL; + } + +- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); ++ memcpy((void *) dev->dev_addr, addr->sa_data, ETH_ALEN); + return 0; + } + +--- a/nss_connmgr_tun6rd.c ++++ b/nss_connmgr_tun6rd.c +@@ -101,10 +101,10 @@ static void nss_tun6rd_update_dev_stats( + + u64_stats_init(&stats.syncp); + u64_stats_update_begin(&stats.syncp); +- stats.rx_packets = sync_stats->node_stats.rx_packets; +- stats.rx_bytes = sync_stats->node_stats.rx_bytes; +- stats.tx_packets = sync_stats->node_stats.tx_packets; +- stats.tx_bytes = sync_stats->node_stats.tx_bytes; ++ u64_stats_set(&stats.rx_packets, sync_stats->node_stats.rx_packets); ++ u64_stats_set(&stats.rx_bytes, sync_stats->node_stats.rx_bytes); ++ u64_stats_set(&stats.tx_packets, sync_stats->node_stats.tx_packets); ++ u64_stats_set(&stats.tx_bytes, sync_stats->node_stats.tx_bytes); + u64_stats_update_end(&stats.syncp); + #else + struct nss_tun6rd_stats stats; +--- a/ipsecmgr/v1.0/nss_ipsecmgr.c ++++ b/ipsecmgr/v1.0/nss_ipsecmgr.c +@@ -445,7 +445,7 @@ static void nss_ipsecmgr_tunnel_setup(st + /* + * get the MAC address from the ethernet device + */ +- random_ether_addr(dev->dev_addr); ++ eth_random_addr((u8 *) dev->dev_addr); + + memset(dev->broadcast, 0xff, dev->addr_len); + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); +--- a/ipsecmgr/v2.0/nss_ipsecmgr_tunnel.c ++++ b/ipsecmgr/v2.0/nss_ipsecmgr_tunnel.c +@@ -445,7 +445,7 @@ static void nss_ipsecmgr_tunnel_setup(st + /* + * Get the MAC address from the ethernet device + */ +- random_ether_addr(dev->dev_addr); ++ eth_random_addr((u8 *) dev->dev_addr); + + memset(dev->broadcast, 0xff, dev->addr_len); + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); diff --git a/qca-nss-clients/patches-11.4/0019-wifi-meshmgr-fix-uninitialized-and-implicit.patch b/qca-nss-clients/patches-11.4/0019-wifi-meshmgr-fix-uninitialized-and-implicit.patch new file mode 100644 index 0000000..2adef69 --- /dev/null +++ b/qca-nss-clients/patches-11.4/0019-wifi-meshmgr-fix-uninitialized-and-implicit.patch @@ -0,0 +1,225 @@ +--- a/wifi_meshmgr/nss_wifi_meshmgr.c ++++ b/wifi_meshmgr/nss_wifi_meshmgr.c +@@ -49,7 +49,7 @@ static bool nss_wifi_meshmgr_verify_if_n + */ + static nss_wifi_meshmgr_status_t nss_wifi_meshmgr_tx_msg(struct nss_wifi_mesh_msg *msg) + { +- return nss_wifi_mesh_tx_msg(wmgr_ctx.nss_ctx, msg); ++ return (nss_wifi_meshmgr_status_t)nss_wifi_mesh_tx_msg(wmgr_ctx.nss_ctx, msg); + } + + /* +@@ -126,7 +126,7 @@ static void nss_wifi_meshmgr_cleanup(str + * Unregister and dealloc decap DI. + */ + nss_unregister_wifi_mesh_if(decap_ifnum); +- nss_status = nss_dynamic_interface_dealloc_node(decap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER); ++ nss_status = (nss_wifi_meshmgr_status_t)nss_dynamic_interface_dealloc_node(decap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER); + if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) { + nss_wifi_meshmgr_warn("%px: Failed to dealloc decap: %d\n", &wmgr_ctx, nss_status); + } +@@ -135,7 +135,7 @@ static void nss_wifi_meshmgr_cleanup(str + * Unregister and dealloc encap DI. + */ + nss_unregister_wifi_mesh_if(encap_ifnum); +- nss_status = nss_dynamic_interface_dealloc_node(encap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER); ++ nss_status = (nss_wifi_meshmgr_status_t)nss_dynamic_interface_dealloc_node(encap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER); + if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) { + nss_wifi_meshmgr_warn("%px: Failed to dealloc encap: %d\n", &wmgr_ctx, nss_status); + } +@@ -249,10 +249,10 @@ static void nss_wifi_meshmgr_tx_msg_cb(v + /* + * FIXME: The wmesh_ctx can be invalid if the memory goes away with the caller being timedout. + */ +- wmesh_ctx->response = NSS_WIFI_MESHMGR_SUCCESS; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_SUCCESS; + if (ncm->response != NSS_CMN_RESPONSE_ACK) { + nss_wifi_meshmgr_warn("%px: WiFi-Mesh error response %d error_code: %u\n", &wmgr_ctx, ncm->response, error_code); +- wmesh_ctx->response = nss_wifi_meshmgr_remap_error(error_code); ++ wmesh_ctx->response = (nss_tx_status_t)nss_wifi_meshmgr_remap_error(error_code); + } + + complete(&wmesh_ctx->complete); +@@ -281,10 +281,10 @@ static nss_wifi_meshmgr_status_t nss_wif + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- status = wmesh_ctx->response; ++ status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + return status; + } +@@ -316,7 +316,7 @@ nss_wifi_meshmgr_status_t nss_wifi_meshm + return NSS_WIFI_MESHMGR_FAILURE; + } + +- nss_status = nss_wifi_mesh_tx_buf(wmgr_ctx.nss_ctx, os_buf, encap_ifnum); ++ nss_status = (nss_wifi_meshmgr_status_t)nss_wifi_mesh_tx_buf(wmgr_ctx.nss_ctx, os_buf, encap_ifnum); + nss_wifi_meshmgr_ref_dec(wmesh_ctx); + return nss_status; + } +@@ -540,10 +540,10 @@ nss_wifi_meshmgr_dump_mesh_path_sync(nss + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + + nss_wifi_meshmgr_ref_dec(wmesh_ctx); +@@ -635,10 +635,10 @@ nss_wifi_meshmgr_dump_mesh_proxy_path_sy + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + + nss_wifi_meshmgr_ref_dec(wmesh_ctx); +@@ -707,7 +707,7 @@ nss_wifi_meshmgr_assoc_link_vap(nss_wifi + /* + * Send the link vap mesage to the NSS synchronously. + */ +- nss_status = nss_wifi_vdev_tx_msg(wmgr_ctx.nss_ctx, wifivdevmsg); ++ nss_status = (nss_wifi_meshmgr_status_t)nss_wifi_vdev_tx_msg(wmgr_ctx.nss_ctx, wifivdevmsg); + if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) { + nss_wifi_meshmgr_warn("%px: Mesh link vap association failed: %d.\n", &wmgr_ctx, nss_status); + } +@@ -753,10 +753,10 @@ nss_wifi_meshmgr_assoc_link_vap_sync(nss + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + + nss_wifi_meshmgr_ref_dec(wmesh_ctx); +@@ -878,10 +878,10 @@ nss_wifi_meshmgr_mesh_config_update_sync + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + + nss_wifi_meshmgr_ref_dec(wmesh_ctx); +@@ -977,10 +977,10 @@ nss_wifi_meshmgr_mesh_proxy_path_delete_ + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + + nss_wifi_meshmgr_ref_dec(wmesh_ctx); +@@ -1076,10 +1076,10 @@ nss_wifi_meshmgr_mesh_proxy_path_update_ + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + + nss_wifi_meshmgr_ref_dec(wmesh_ctx); +@@ -1175,10 +1175,10 @@ nss_wifi_meshmgr_mesh_proxy_path_add_syn + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + + nss_wifi_meshmgr_ref_dec(wmesh_ctx); +@@ -1274,10 +1274,10 @@ nss_wifi_meshmgr_mesh_path_delete_sync(n + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + + nss_wifi_meshmgr_ref_dec(wmesh_ctx); +@@ -1373,10 +1373,10 @@ nss_wifi_meshmgr_mesh_path_add_sync(nss_ + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + nss_wifi_meshmgr_ref_dec(wmesh_ctx); + return nss_status; +@@ -1471,10 +1471,10 @@ nss_wifi_meshmgr_mesh_path_update_sync(n + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + + nss_wifi_meshmgr_ref_dec(wmesh_ctx); +@@ -1570,10 +1570,10 @@ nss_wifi_meshmgr_mesh_path_exception_syn + ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT)); + if (!ret) { + nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx); +- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; ++ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT; + } + +- nss_status = wmesh_ctx->response; ++ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response; + up(&wmesh_ctx->sem); + + nss_wifi_meshmgr_ref_dec(wmesh_ctx); +@@ -1663,7 +1663,7 @@ nss_wifi_mesh_handle_t nss_wifi_meshmgr_ + int32_t encap_ifnum, decap_ifnum; + uint32_t features = 0; + nss_wifi_mesh_handle_t mesh_handle; +- nss_wifi_meshmgr_status_t nss_status; ++ nss_wifi_meshmgr_status_t nss_status = NSS_WIFI_MESHMGR_SUCCESS; + struct nss_wifi_meshmgr_mesh_ctx *wmesh_ctx; + + spin_lock_bh(&wmgr_ctx.ref_lock); diff --git a/qca-nss-clients/patches-11.4/0020-capwapmgr-fix-compile-error.patch b/qca-nss-clients/patches-11.4/0020-capwapmgr-fix-compile-error.patch new file mode 100644 index 0000000..c8606fa --- /dev/null +++ b/qca-nss-clients/patches-11.4/0020-capwapmgr-fix-compile-error.patch @@ -0,0 +1,169 @@ +--- a/capwapmgr/nss_capwapmgr.c ++++ b/capwapmgr/nss_capwapmgr.c +@@ -331,7 +331,7 @@ static struct rtnl_link_stats64 *nss_cap + * Netdev seems to be incrementing rx_dropped because we don't give IP header. + * So reset it as it's of no use for us. + */ +- atomic_long_set(&dev->rx_dropped, 0); ++ dev->stats.rx_dropped = 0; + + memset(stats, 0, sizeof (struct rtnl_link_stats64)); + nss_capwapmgr_fill_up_stats(stats, &global.tunneld); +@@ -376,7 +376,6 @@ static const struct net_device_ops nss_c + .ndo_stop = nss_capwapmgr_close, + .ndo_start_xmit = nss_capwapmgr_start_xmit, + .ndo_set_mac_address = eth_mac_addr, +- .ndo_change_mtu = eth_change_mtu, + .ndo_get_stats64 = nss_capwapmgr_dev_tunnel_stats, + }; + +@@ -400,7 +399,7 @@ static void nss_capwapmgr_dummpy_netdev_ + #else + dev->priv_destructor = NULL; + #endif +- memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len); ++ memcpy((u8 *)dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len); + memset(dev->broadcast, 0xff, dev->addr_len); + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); + } +@@ -569,7 +568,7 @@ static struct nss_capwapmgr_tunnel *nss_ + * nss_capwapmgr_netdev_create() + * API to create a CAPWAP netdev + */ +-struct net_device *nss_capwapmgr_netdev_create() ++struct net_device *nss_capwapmgr_netdev_create(void) + { + struct nss_capwapmgr_priv *priv; + struct nss_capwapmgr_response *r; +@@ -1168,7 +1167,7 @@ static nss_capwapmgr_status_t nss_capwap + /* + * Call NSS driver + */ +- status = nss_capwap_tx_msg(ctx, msg); ++ status = (nss_capwapmgr_status_t)nss_capwap_tx_msg(ctx, msg); + if (status != NSS_CAPWAPMGR_SUCCESS) { + up(&r->sem); + dev_put(dev); +@@ -1209,7 +1208,7 @@ static nss_capwapmgr_status_t nss_capwap + struct nss_ctx_instance *ctx = nss_capwap_get_ctx(); + struct nss_capwap_msg capwapmsg; + struct nss_capwap_rule_msg *capwapcfg; +- nss_tx_status_t status; ++ nss_capwapmgr_status_t status; + + nss_capwapmgr_info("%px: ctx: CAPWAP Rule src_port: 0x%d dest_port:0x%d\n", ctx, + ntohl(msg->encap.src_port), ntohl(msg->encap.dest_port)); +@@ -1274,7 +1273,7 @@ static nss_capwapmgr_status_t nss_capwap + nss_capwapmgr_msg_event_receive, dev); + + status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg); +- if (status != NSS_TX_SUCCESS) { ++ if (status != NSS_CAPWAPMGR_SUCCESS) { + nss_capwapmgr_warn("%px: ctx: create encap data tunnel error %d \n", ctx, status); + return status; + } +@@ -1286,10 +1285,10 @@ static nss_capwapmgr_status_t nss_capwap + * nss_capwapmgr_tx_msg_enable_tunnel() + * Common function to send CAPWAP tunnel enable msg + */ +-static nss_tx_status_t nss_capwapmgr_tx_msg_enable_tunnel(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, uint32_t sibling_if_num) ++static nss_capwapmgr_status_t nss_capwapmgr_tx_msg_enable_tunnel(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, uint32_t sibling_if_num) + { + struct nss_capwap_msg capwapmsg; +- nss_tx_status_t status; ++ nss_capwapmgr_status_t status; + + /* + * Prepare the tunnel configuration parameter to send to NSS FW +@@ -1303,7 +1302,7 @@ static nss_tx_status_t nss_capwapmgr_tx_ + nss_capwap_msg_init(&capwapmsg, if_num, NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL, sizeof(struct nss_capwap_enable_tunnel_msg), nss_capwapmgr_msg_event_receive, dev); + + status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg); +- if (status != NSS_TX_SUCCESS) { ++ if (status != NSS_CAPWAPMGR_SUCCESS) { + nss_capwapmgr_warn("%px: ctx: CMD: %d Tunnel error : %d \n", ctx, NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL, status); + } + +@@ -1315,7 +1314,7 @@ static nss_tx_status_t nss_capwapmgr_tx_ + * Common function for CAPWAP tunnel operation messages without + * any message data structures. + */ +-static nss_tx_status_t nss_capwapmgr_tunnel_action(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, nss_capwap_msg_type_t cmd) ++static nss_capwapmgr_status_t nss_capwapmgr_tunnel_action(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, nss_capwap_msg_type_t cmd) + { + struct nss_capwap_msg capwapmsg; + nss_tx_status_t status; +@@ -1330,12 +1329,12 @@ static nss_tx_status_t nss_capwapmgr_tun + */ + nss_capwap_msg_init(&capwapmsg, if_num, cmd, 0, nss_capwapmgr_msg_event_receive, dev); + +- status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg); ++ status = (nss_tx_status_t)nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg); + if (status != NSS_TX_SUCCESS) { + nss_capwapmgr_warn("%px: ctx: CMD: %d Tunnel error : %d \n", ctx, cmd, status); + } + +- return status; ++ return (nss_capwapmgr_status_t)status; + } + + /* +@@ -1460,7 +1459,6 @@ EXPORT_SYMBOL(nss_capwapmgr_update_path_ + */ + nss_capwapmgr_status_t nss_capwapmgr_update_dest_mac_addr(struct net_device *dev, uint8_t tunnel_id, uint8_t *mac_addr) + { +- struct nss_capwapmgr_priv *priv; + struct nss_capwapmgr_tunnel *t; + nss_tx_status_t nss_status; + nss_capwapmgr_status_t status = NSS_CAPWAPMGR_SUCCESS; +@@ -1476,7 +1474,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd + } + + +- priv = netdev_priv(dev); + nss_capwapmgr_info("%px: %d: tunnel update mac Addr is being called\n", dev, tunnel_id); + + /* +@@ -1523,7 +1520,6 @@ EXPORT_SYMBOL(nss_capwapmgr_update_dest_ + */ + nss_capwapmgr_status_t nss_capwapmgr_update_src_interface(struct net_device *dev, uint8_t tunnel_id, uint32_t src_interface_num) + { +- struct nss_capwapmgr_priv *priv; + struct nss_capwapmgr_tunnel *t; + nss_tx_status_t nss_status; + uint32_t outer_trustsec_enabled, dtls_enabled, forward_if_num, src_interface_num_temp; +@@ -1537,7 +1533,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd + } + + +- priv = netdev_priv(dev); + nss_capwapmgr_info("%px: %d: tunnel update source interface is being called\n", dev, tunnel_id); + outer_trustsec_enabled = t->capwap_rule.enabled_features & NSS_CAPWAPMGR_FEATURE_OUTER_TRUSTSEC_ENABLED; + dtls_enabled = t->capwap_rule.enabled_features & NSS_CAPWAPMGR_FEATURE_DTLS_ENABLED; +@@ -1576,7 +1571,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd + /* + * Destroy the IP rule only if it already exist. + */ +- if (t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) { ++ if (NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) { + struct nss_ipv4_destroy v4_destroy; + v4_destroy.protocol = IPPROTO_UDP; + v4_destroy.src_ip = t->ip_rule.v4.src_ip; +@@ -1606,7 +1601,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd + /* + * Destroy the IP rule only if it already exist. + */ +- if (t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) { ++ if (NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) { + struct nss_ipv6_destroy v6_destroy; + + if (t->capwap_rule.which_udp == NSS_CAPWAP_TUNNEL_UDP) { +@@ -1750,7 +1745,7 @@ nss_capwapmgr_status_t nss_capwapmgr_dsc + uint8_t rule_nr = NSS_CAPWAPMGR_RULE_NR; + uint8_t list_id, v4_rule_id, v6_rule_id; + uint8_t lid, rid, i, j; +- int8_t err, fail_dscp; ++ uint8_t err, fail_dscp; + int8_t uid = -1; + + nss_capwapmgr_info("Setting priority %u for dscp %u mask %u\n", pri, dscp_value, dscp_mask); diff --git a/qca-nss-clients/patches-11.4/0022-netlink-modularize-makefile.patch b/qca-nss-clients/patches-11.4/0022-netlink-modularize-makefile.patch new file mode 100644 index 0000000..9f47c32 --- /dev/null +++ b/qca-nss-clients/patches-11.4/0022-netlink-modularize-makefile.patch @@ -0,0 +1,44 @@ +--- a/netlink/Makefile ++++ b/netlink/Makefile +@@ -26,7 +26,6 @@ ccflags-y += -DCONFIG_NSS_NLPPTP=1 + ccflags-y += -DCONFIG_NSS_NLCAPWAP=${CAPWAP_ENABLED} + ccflags-y += -DCONFIG_NSS_NLIPSEC=${IPSEC_ENABLED} + ccflags-y += -DCONFIG_NSS_NLDTLS=${DTLS_ENABLED} +-ccflags-y += -DCONFIG_NSS_NLUDP_ST=1 + + qca-nss-netlink-objs := nss_nl.o + qca-nss-netlink-objs += nss_nlgre_redir_family.o +@@ -48,7 +47,6 @@ qca-nss-netlink-objs += nss_nlmap_t.o + qca-nss-netlink-objs += nss_nlpppoe.o + qca-nss-netlink-objs += nss_nll2tpv2.o + qca-nss-netlink-objs += nss_nlpptp.o +-qca-nss-netlink-objs += nss_nludp_st.o + + ifneq (,$(filter $(capwapmgr), y)) + qca-nss-netlink-objs += nss_nlcapwap.o +@@ -79,4 +77,11 @@ else + ccflags-y += -DCONFIG_NSS_NLEDMA=0 + endif + ++ifeq ($(SoC),$(filter $(SoC),ipq95xx ipq50xx)) ++ccflags-y += -DCONFIG_NSS_NLUDP_ST=1 ++qca-nss-netlink-objs += nss_nludp_st.o ++else ++ccflags-y += -DCONFIG_NSS_NLUDP_ST=0 ++endif ++ + obj-m += qca-nss-netlink.o +--- a/netlink/nss_nludp_st.h ++++ b/netlink/nss_nludp_st.h +@@ -23,10 +23,9 @@ + #ifndef __NSS_NLUDP_ST_H + #define __NSS_NLUDP_ST_H + ++#if defined(CONFIG_NSS_NLUDP_ST) && CONFIG_NSS_NLUDP_ST > 0 + bool nss_nludp_st_init(void); + bool nss_nludp_st_exit(void); +- +-#if defined(CONFIG_NSS_NLUDP_ST) + #define NSS_NLUDP_ST_INIT nss_nludp_st_init + #define NSS_NLUDP_ST_EXIT nss_nludp_st_exit + #else diff --git a/qca-nss-clients/patches-11.4/0023-mirror-fix-makefile.patch b/qca-nss-clients/patches-11.4/0023-mirror-fix-makefile.patch new file mode 100644 index 0000000..a6c51af --- /dev/null +++ b/qca-nss-clients/patches-11.4/0023-mirror-fix-makefile.patch @@ -0,0 +1,10 @@ +--- a/mirror/Makefile ++++ b/mirror/Makefile +@@ -1,6 +1,6 @@ + # Makefile for NSS MIRROR + +-ccflags-y += $(NSS_CCFLAGS) -I$(obj)/../../exports ++ccflags-y += $(NSS_CCFLAGS) -I$(obj)/../exports + ccflags-y += -DNSS_MIRROR_DEBUG_LEVEL=2 + ccflags-y += -Wall -Werror + diff --git a/qca-nss-clients/patches-11.4/0024-match-switch-to-wifili.patch b/qca-nss-clients/patches-11.4/0024-match-switch-to-wifili.patch new file mode 100644 index 0000000..e466f5b --- /dev/null +++ b/qca-nss-clients/patches-11.4/0024-match-switch-to-wifili.patch @@ -0,0 +1,60 @@ +--- a/match/nss_match_cmd.c ++++ b/match/nss_match_cmd.c +@@ -460,10 +460,10 @@ static int nss_match_cmd_procfs_reset_ne + char *cmd_buf = nss_match_data; + nss_tx_status_t nss_tx_status; + struct nss_ctx_instance *nss_ctx = nss_match_get_context(); +- struct nss_ctx_instance *wifi_nss_ctx = nss_wifi_get_context(); ++ struct nss_ctx_instance *wifili_nss_ctx = nss_wifi_get_context(); + +- if (!nss_ctx || !wifi_nss_ctx) { +- pr_warn("%px: NSS Context not found. wifi_nss_ctx: %px. Reset nexthop failed", nss_ctx, wifi_nss_ctx); ++ if (!nss_ctx || !wifili_nss_ctx) { ++ pr_warn("%px: NSS Context not found. wifili_nss_ctx: %px. Reset nexthop failed", nss_ctx, wifili_nss_ctx); + return -ENOMEM; + } + +@@ -495,9 +495,9 @@ static int nss_match_cmd_procfs_reset_ne + * nss_phys_if_reset_nexthop: Used for physical interfaces. + * nss_if_reset_nexthop: used for VAP interfaces. + */ +- type = nss_dynamic_interface_get_type(wifi_nss_ctx, if_num); ++ type = nss_dynamic_interface_get_type(wifili_nss_ctx, if_num); + if (type == NSS_DYNAMIC_INTERFACE_TYPE_VAP) { +- nss_tx_status = nss_if_reset_nexthop(wifi_nss_ctx, if_num); ++ nss_tx_status = nss_if_reset_nexthop(wifili_nss_ctx, if_num); + } else if (if_num < NSS_MAX_PHYSICAL_INTERFACES) { + nss_tx_status = nss_phys_if_reset_nexthop(nss_ctx, if_num); + } else { +@@ -528,7 +528,7 @@ static int nss_match_cmd_procfs_set_if_n + uint32_t nh_if_num; + int table_id; + struct nss_ctx_instance *nss_ctx = nss_match_get_context(); +- struct nss_ctx_instance *wifi_nss_ctx = nss_wifi_get_context(); ++ struct nss_ctx_instance *wifili_nss_ctx = nss_wifi_get_context(); + char *dev_name, *nexthop_msg; + char *cmd_buf = NULL; + size_t count = *lenp; +@@ -539,8 +539,8 @@ static int nss_match_cmd_procfs_set_if_n + return ret; + } + +- if (!nss_ctx || !wifi_nss_ctx) { +- pr_warn("%px: NSS Context not found. wifi_nss_ctx: %px. Set nexthop failed", nss_ctx, wifi_nss_ctx); ++ if (!nss_ctx || !wifili_nss_ctx) { ++ pr_warn("%px: NSS Context not found. wifili_nss_ctx: %px. Set nexthop failed", nss_ctx, wifili_nss_ctx); + return -ENOMEM; + } + +@@ -607,9 +607,9 @@ static int nss_match_cmd_procfs_set_if_n + * nss_phys_if_set_nexthop: Used for physical interfaces. + * nss_if_set_nexthop: used for VAP interfaces. + */ +- type = nss_dynamic_interface_get_type(wifi_nss_ctx, if_num); ++ type = nss_dynamic_interface_get_type(wifili_nss_ctx, if_num); + if (type == NSS_DYNAMIC_INTERFACE_TYPE_VAP) { +- nss_tx_status = nss_if_set_nexthop(wifi_nss_ctx, if_num, nh_if_num); ++ nss_tx_status = nss_if_set_nexthop(wifili_nss_ctx, if_num, nh_if_num); + } else if (if_num < NSS_MAX_PHYSICAL_INTERFACES) { + nss_tx_status = nss_phys_if_set_nexthop(nss_ctx, if_num, nh_if_num); + } else { diff --git a/qca-nss-clients/patches-11.4/0025-pvxlanmgr-fix-compile-error-in-6.1.patch b/qca-nss-clients/patches-11.4/0025-pvxlanmgr-fix-compile-error-in-6.1.patch new file mode 100644 index 0000000..e15a4de --- /dev/null +++ b/qca-nss-clients/patches-11.4/0025-pvxlanmgr-fix-compile-error-in-6.1.patch @@ -0,0 +1,42 @@ +--- a/pvxlanmgr/nss_pvxlanmgr.c ++++ b/pvxlanmgr/nss_pvxlanmgr.c +@@ -18,6 +18,7 @@ + * nss_pvxlanmgr.c + * NSS to HLOS Pvxlan manager + */ ++#include "nss_pvxlanmgr.h" + #include "nss_pvxlanmgr_priv.h" + + /* +@@ -431,19 +432,19 @@ EXPORT_SYMBOL(nss_pvxlanmgr_netdev_disab + nss_pvxlanmgr_status_t nss_pvxlanmgr_netdev_enable(struct net_device *dev) + { + struct nss_pvxlanmgr_priv *priv; +- nss_tx_status_t ret; ++ nss_pvxlanmgr_status_t ret; + + dev_hold(dev); + priv = netdev_priv(dev); + nss_pvxlanmgr_info("%px: tunnel enable is being called\n", dev); +- ret = nss_pvxlanmgr_tunnel_tx_msg_enable(priv->pvxlan_ctx, priv->if_num_host_inner, priv->if_num_outer); ++ ret = (nss_pvxlanmgr_status_t)nss_pvxlanmgr_tunnel_tx_msg_enable(priv->pvxlan_ctx, priv->if_num_host_inner, priv->if_num_outer); + if (ret != NSS_TX_SUCCESS) { + nss_pvxlanmgr_warn("%px: Tunnel enable failed: %d\n", dev, ret); + dev_put(dev); + return ret; + } + +- ret = nss_pvxlanmgr_tunnel_tx_msg_enable(priv->pvxlan_ctx, priv->if_num_outer, priv->if_num_host_inner); ++ ret = (nss_pvxlanmgr_status_t)nss_pvxlanmgr_tunnel_tx_msg_enable(priv->pvxlan_ctx, priv->if_num_outer, priv->if_num_host_inner); + if (ret != NSS_TX_SUCCESS) { + nss_pvxlanmgr_warn("%px: Tunnel enable failed: %d\n", dev, ret); + nss_pvxlanmgr_tunnel_tx_msg_disable(priv->pvxlan_ctx, priv->if_num_host_inner); +@@ -524,7 +525,7 @@ EXPORT_SYMBOL(nss_pvxlanmgr_netdev_destr + * nss_pvxlanmgr_netdev_create() + * API to create a Pvxlan netdev + */ +-struct net_device *nss_pvxlanmgr_netdev_create() ++struct net_device *nss_pvxlanmgr_netdev_create(void) + { + struct nss_pvxlanmgr_priv *priv; + struct net_device *dev; diff --git a/qca-nss-clients/patches-11.4/0026-meshmgr-backport-12.4.patch b/qca-nss-clients/patches-11.4/0026-meshmgr-backport-12.4.patch new file mode 100644 index 0000000..e69de29 diff --git a/qca-nss-clients/patches-11.4/0026-qdisc-backport-12.4.patch b/qca-nss-clients/patches-11.4/0026-qdisc-backport-12.4.patch new file mode 100644 index 0000000..a16fc4c --- /dev/null +++ b/qca-nss-clients/patches-11.4/0026-qdisc-backport-12.4.patch @@ -0,0 +1,330 @@ +--- a/nss_qdisc/nss_bf.c ++++ b/nss_qdisc/nss_bf.c +@@ -331,10 +331,19 @@ static int nss_bf_delete_class(struct Qd + qdisc_class_hash_remove(&q->clhash, &cl->cl_common); + refcnt = nss_qdisc_atomic_sub_return(&cl->nq); + sch_tree_unlock(sch); ++ ++ /* ++ * For 5.4 and above kernels, calling nss_htb_destroy_class ++ * explicitly as there is no put_class which would have called ++ * nss_bf_destroy_class when refcnt becomes zero. ++ */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) ++ nss_bf_destroy_class(sch, cl); ++#else + if (!refcnt) { + nss_qdisc_error("Reference count should not be zero for class %px\n", cl); + } +- ++#endif + return 0; + } + +@@ -634,6 +643,11 @@ static int nss_bf_change_qdisc(struct Qd + */ + static void nss_bf_reset_class(struct nss_bf_class_data *cl) + { ++ if (cl->qdisc == &noop_qdisc) { ++ nss_qdisc_trace("Class %x has no child qdisc to reset\n", cl->nq.qos_tag); ++ return; ++ } ++ + nss_qdisc_reset(cl->qdisc); + nss_qdisc_info("Nssbf class resetted %px\n", cl->qdisc); + } +--- a/nss_qdisc/nss_htb.c ++++ b/nss_qdisc/nss_htb.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2017, 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. +@@ -574,10 +574,16 @@ static int nss_htb_delete_class(struct Q + /* + * If we are root class, we dont have to update our parent. + * We simply deduct refcnt and return. ++ * For 5.4 and above kernels, calling nss_htb_destroy_class ++ * explicitly as there is no put_class which would have called ++ * nss_htb_destroy_class when refcnt becomes zero. + */ + if (!cl->parent) { + refcnt = nss_qdisc_atomic_sub_return(&cl->nq); + sch_tree_unlock(sch); ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) ++ nss_htb_destroy_class(sch, cl); ++#endif + return 0; + } + +@@ -596,6 +602,14 @@ static int nss_htb_delete_class(struct Q + refcnt = nss_qdisc_atomic_sub_return(&cl->nq); + sch_tree_unlock(sch); + ++ /* ++ * For 5.4 and above kernels, calling nss_htb_destroy_class ++ * explicitly as there is no put_class which would have called ++ * nss_htb_destroy_class when refcnt becomes zero. ++ */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) ++ nss_htb_destroy_class(sch, cl); ++#endif + return 0; + } + +@@ -898,6 +912,11 @@ static int nss_htb_change_qdisc(struct Q + */ + static void nss_htb_reset_class(struct nss_htb_class_data *cl) + { ++ if (cl->qdisc == &noop_qdisc) { ++ nss_qdisc_trace("Class %x has no child qdisc to reset\n", cl->nq.qos_tag); ++ return; ++ } ++ + nss_qdisc_reset(cl->qdisc); + nss_qdisc_trace("htb class %x reset\n", cl->nq.qos_tag); + } +--- a/nss_qdisc/nss_qdisc.c ++++ b/nss_qdisc/nss_qdisc.c +@@ -30,9 +30,6 @@ + + void *nss_qdisc_ctx; /* Shaping context for nss_qdisc */ + +-#define NSS_QDISC_COMMAND_TIMEOUT (10*HZ) /* We set 10sec to be the command */ +- /* timeout value for messages */ +- + /* + * Defines related to root hash maintenance + */ +@@ -40,6 +37,53 @@ void *nss_qdisc_ctx; /* Shaping contex + #define NSS_QDISC_ROOT_HASH_MASK (NSS_QDISC_ROOT_HASH_SIZE - 1) + + /* ++ * nss_qdisc_get_interface_msg() ++ * Returns the correct message that needs to be sent down to the NSS interface. ++ */ ++int nss_qdisc_get_interface_msg(bool is_bridge, uint32_t msg_type) ++{ ++ /* ++ * We re-assign the message based on whether this is for the I shaper ++ * or the B shaper. The is_bridge flag tells if we are on a bridge interface. ++ */ ++ if (is_bridge) { ++ switch (msg_type) { ++ case NSS_QDISC_IF_SHAPER_ASSIGN: ++ return NSS_IF_BSHAPER_ASSIGN; ++ case NSS_QDISC_IF_SHAPER_UNASSIGN: ++ return NSS_IF_BSHAPER_UNASSIGN; ++ case NSS_QDISC_IF_SHAPER_CONFIG: ++ return NSS_IF_BSHAPER_CONFIG; ++ default: ++ nss_qdisc_info("Unknown message type for a bridge - type %d", msg_type); ++ return -1; ++ } ++ } else { ++ switch (msg_type) { ++ case NSS_QDISC_IF_SHAPER_ASSIGN: ++ return NSS_IF_ISHAPER_ASSIGN; ++ case NSS_QDISC_IF_SHAPER_UNASSIGN: ++ return NSS_IF_ISHAPER_UNASSIGN; ++ case NSS_QDISC_IF_SHAPER_CONFIG: ++ return NSS_IF_ISHAPER_CONFIG; ++ default: ++ nss_qdisc_info("Unknown message type for an interface - type %d", msg_type); ++ return -1; ++ } ++ } ++} ++ ++/* ++ * nss_qdisc_msg_init() ++ * Initialize the qdisc specific message ++ */ ++void nss_qdisc_msg_init(struct nss_if_msg *nim, uint16_t if_num, uint32_t msg_type, uint32_t len, ++ nss_if_msg_callback_t cb, void *app_data) ++{ ++ nss_cmn_msg_init(&nim->cm, if_num, msg_type, len, (void *)cb, app_data); ++} ++ ++/* + * nss_qdisc_interface_is_virtual() + * Return true if it is redirect or bridge interface. + */ +@@ -122,53 +166,6 @@ static int nss_qdisc_ppe_init(struct Qdi + #endif + + /* +- * nss_qdisc_msg_init() +- * Initialize the qdisc specific message +- */ +-static void nss_qdisc_msg_init(struct nss_if_msg *nim, uint16_t if_num, uint32_t msg_type, uint32_t len, +- nss_if_msg_callback_t cb, void *app_data) +-{ +- nss_cmn_msg_init(&nim->cm, if_num, msg_type, len, (void*)cb, app_data); +-} +- +-/* +- * nss_qdisc_get_interface_msg() +- * Returns the correct message that needs to be sent down to the NSS interface. +- */ +-static inline int nss_qdisc_get_interface_msg(bool is_bridge, uint32_t msg_type) +-{ +- /* +- * We re-assign the message based on whether this is for the I shaper +- * or the B shaper. The is_bridge flag tells if we are on a bridge interface. +- */ +- if (is_bridge) { +- switch(msg_type) { +- case NSS_QDISC_IF_SHAPER_ASSIGN: +- return NSS_IF_BSHAPER_ASSIGN; +- case NSS_QDISC_IF_SHAPER_UNASSIGN: +- return NSS_IF_BSHAPER_UNASSIGN; +- case NSS_QDISC_IF_SHAPER_CONFIG: +- return NSS_IF_BSHAPER_CONFIG; +- default: +- nss_qdisc_info("Unknown message type for a bridge - type %d", msg_type); +- return -1; +- } +- } else { +- switch(msg_type) { +- case NSS_QDISC_IF_SHAPER_ASSIGN: +- return NSS_IF_ISHAPER_ASSIGN; +- case NSS_QDISC_IF_SHAPER_UNASSIGN: +- return NSS_IF_ISHAPER_UNASSIGN; +- case NSS_QDISC_IF_SHAPER_CONFIG: +- return NSS_IF_ISHAPER_CONFIG; +- default: +- nss_qdisc_info("Unknown message type for an interface - type %d", msg_type); +- return -1; +- } +- } +-} +- +-/* + * nss_qdisc_attach_bshaper_callback() + * Call back funtion for bridge shaper attach to an interface. + */ +@@ -613,7 +610,6 @@ static void nss_qdisc_root_cleanup_free_ + nss_qdisc_info("Root qdisc %px (type %d) free SUCCESS - response " + "type: %d\n", nq->qdisc, nq->type, + nim->msg.shaper_configure.config.response_type); +- + nss_qdisc_root_cleanup_shaper_unassign(nq); + } + +@@ -1168,8 +1164,15 @@ unsigned int nss_qdisc_drop(struct Qdisc + */ + void nss_qdisc_reset(struct Qdisc *sch) + { +- struct nss_qdisc *nq = qdisc_priv(sch); ++ struct nss_qdisc *nq; + ++ if(!(sch->flags & TCQ_F_NSS)) { ++ qdisc_reset_queue(sch); ++ nss_qdisc_info("Qdisc %px resetting non NSS qdisc\n", sch); ++ return; ++ } ++ ++ nq = qdisc_priv(sch); + nss_qdisc_info("Qdisc %px (type %d) resetting\n", + sch, nq->type); + +@@ -1891,6 +1894,7 @@ int nss_qdisc_configure(struct nss_qdisc + return 0; + } + ++ + /* + * nss_qdisc_register_configure_callback() + * Register shaper configure callback, which gets invoked on receiving a response. +@@ -2117,6 +2121,8 @@ int __nss_qdisc_init(struct Qdisc *sch, + */ + if ((sch->parent == TC_H_ROOT) && (!nq->is_class)) { + nss_qdisc_info("Qdisc %px (type %d) is root\n", nq->qdisc, nq->type); ++ nss_qdisc_info("Qdisc %px dev-name %s qdisc_dev(sch)->qdisc %px, qdisc_dev(sch)->qdisc->handle %x\n", qdisc_dev(sch), qdisc_dev(sch)->name, qdisc_dev(sch)->qdisc, qdisc_dev(sch)->qdisc->handle); ++ nss_qdisc_info("Qdisc %px (sch %px) is root, sch->handle %x\n", nq->qdisc, sch, sch->handle); + nq->is_root = true; + root = sch; + } else { +--- a/nss_qdisc/nss_qdisc.h ++++ b/nss_qdisc/nss_qdisc.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2018, 2020 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2018, 2020-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. +@@ -41,6 +41,9 @@ + #define NSS_QDISC_DEBUG_LEVEL_INFO 3 + #define NSS_QDISC_DEBUG_LEVEL_TRACE 4 + ++#define NSS_QDISC_COMMAND_TIMEOUT (10*HZ) /* We set 10sec to be the command */ ++ /* timeout value for messages */ ++ + /* + * Debug message for module init and exit + */ +@@ -486,3 +489,15 @@ extern unsigned long nss_qdisc_tcf_bind( + * Unbind the filter from the qdisc. + */ + extern void nss_qdisc_tcf_unbind(struct Qdisc *sch, unsigned long arg); ++ ++/* ++ * nss_qdisc_get_interface_msg() ++ * Returns the correct message that needs to be sent down to the NSS interface. ++ */ ++extern int nss_qdisc_get_interface_msg(bool is_bridge, uint32_t msg_type); ++ ++/* ++ * nss_qdisc_msg_init() ++ * Initialize the qdisc specific message ++ */ ++extern void nss_qdisc_msg_init(struct nss_if_msg *nim, uint16_t if_num, uint32_t msg_type, uint32_t len, nss_if_msg_callback_t cb, void *app_data); +--- a/nss_qdisc/nss_wrr.c ++++ b/nss_qdisc/nss_wrr.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2017, 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. +@@ -442,10 +442,19 @@ static int nss_wrr_delete_class(struct Q + refcnt = nss_qdisc_atomic_sub_return(&cl->nq); + + sch_tree_unlock(sch); ++ ++ /* ++ * For 5.4 and above kernels, calling nss_htb_destroy_class ++ * explicitly as there is no put_class which would have called ++ * nss_wrr_destroy_class when refcnt becomes zero. ++ */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) ++ nss_wrr_destroy_class(sch, cl); ++#else + if (!refcnt) { + nss_qdisc_error("Reference count should not be zero for class %px\n", cl); + } +- ++#endif + return 0; + } + +@@ -764,6 +773,11 @@ static int nss_wrr_change_qdisc(struct Q + + static void nss_wrr_reset_class(struct nss_wrr_class_data *cl) + { ++ if (cl->qdisc == &noop_qdisc) { ++ nss_qdisc_trace("Class %x has no child qdisc to reset\n", cl->nq.qos_tag); ++ return; ++ } ++ + nss_qdisc_reset(cl->qdisc); + nss_qdisc_info("Nsswrr class resetted %px\n", cl->qdisc); + } diff --git a/qca-nss-drv/Makefile b/qca-nss-drv/Makefile index b150d7e..9297ea6 100644 --- a/qca-nss-drv/Makefile +++ b/qca-nss-drv/Makefile @@ -56,7 +56,15 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_NSS_DRV_WIFIOFFLOAD_ENABLE \ CONFIG_NSS_DRV_WIFI_EXT_VDEV_ENABLE \ CONFIG_NSS_DRV_WIFI_MESH_ENABLE \ - CONFIG_NSS_DRV_WIFI_LEGACY_ENABLE + CONFIG_NSS_DRV_WIFI_LEGACY_ENABLE \ + CONFIG_NSS_FIRMWARE_VERSION_11_4 + +ifdef CONFIG_NSS_FIRMWARE_VERSION_11_4 +PKG_SOURCE_DATE:=2021-06-24 +PKG_SOURCE_VERSION:=dc14ca2 +PKG_MIRROR_HASH:=316d683281818ab3715ca31af42e9b82e1f1a9f13713a015030277f84febea25 +PATCH_DIR:=$(CURDIR)/patches-11.4 +endif include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk @@ -109,8 +117,6 @@ define Build/InstallDev $(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-drv/ ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_64" "ipq60xx" "ipq60xx_64" "ipq50xx" "ipq50xx_64")) $(RM) $(1)/usr/include/qca-nss-drv/nss_ipsecmgr.h - # $(INSTALL_DIR) $(1)/usr/include/qca-nss-clients - # $(CP) $(NSS_CLIENTS_DIR)/exports/nss_ipsecmgr.h $(1)/usr/include/qca-nss-clients/. endif endef diff --git a/qca-nss-drv/patches-11.4/0001-nss-drv-replace-ioremap_nocache-with-ioremap.patch b/qca-nss-drv/patches-11.4/0001-nss-drv-replace-ioremap_nocache-with-ioremap.patch new file mode 100644 index 0000000..c749a68 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0001-nss-drv-replace-ioremap_nocache-with-ioremap.patch @@ -0,0 +1,178 @@ +From dddfe22459a988a5b86d195bc3cc3bd3c2ac7037 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Sat, 14 Jan 2023 21:52:38 +0100 +Subject: [PATCH 1/4] nss-drv: replace ioremap_nocache() with ioremap() + +Since 5.5 ioremap_nocache is equal to ioremap on all archs and was removed +from the kernel, so just use ioremap instead. + +Signed-off-by: Robert Marko +--- + nss_hal/fsm9010/nss_hal_pvt.c | 2 +- + 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/ipq95xx/nss_hal_pvt.c | 6 +++--- + nss_hal/nss_hal.c | 4 ++-- + nss_meminfo.c | 2 +- + nss_ppe.c | 2 +- + 9 files changed, 20 insertions(+), 20 deletions(-) + +--- a/nss_hal/fsm9010/nss_hal_pvt.c ++++ b/nss_hal/fsm9010/nss_hal_pvt.c +@@ -145,7 +145,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; +--- 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/qca-nss-drv/patches-11.4/0002-Control-fab-scaling-from-package-Makefile.patch b/qca-nss-drv/patches-11.4/0002-Control-fab-scaling-from-package-Makefile.patch new file mode 100644 index 0000000..04c9bed --- /dev/null +++ b/qca-nss-drv/patches-11.4/0002-Control-fab-scaling-from-package-Makefile.patch @@ -0,0 +1,31 @@ +From 40d4b080f17883ac6b39c74a5feb1af384ab6a51 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Thu, 11 Jun 2020 16:57:39 +0200 +Subject: [PATCH] nss-drv: Control fab scaling from package Makefile + +Lets control the fab scaling from the package Makefile +instead of using kernel checks that dont work. +Fab scaling in OpenWrt is done in a external way. + +Signed-off-by: Robert Marko +--- + Makefile | 9 --------- + 1 file changed, 9 deletions(-) + +--- a/Makefile ++++ b/Makefile +@@ -481,14 +481,7 @@ NSS_CCFLAGS = -DNSS_DT_SUPPORT=1 -DNSS_F + ccflags-y += -I$(obj) + endif + +-# Fabric scaling is supported in 3.14 and 4.4 only +-ifneq ($(findstring 3.14, $(KERNELVERSION)),) +-NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=1 +-else ifneq ($(findstring 4.4, $(KERNELVERSION)),) +-NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=1 +-else + NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=0 +-endif + + # Disable Frequency scaling + ifeq "$(NSS_FREQ_SCALE_DISABLE)" "y" diff --git a/qca-nss-drv/patches-11.4/0005-fix-NULL-pointer-exception.patch b/qca-nss-drv/patches-11.4/0005-fix-NULL-pointer-exception.patch new file mode 100644 index 0000000..2100eac --- /dev/null +++ b/qca-nss-drv/patches-11.4/0005-fix-NULL-pointer-exception.patch @@ -0,0 +1,11 @@ +--- a/nss_core.c ++++ b/nss_core.c +@@ -1616,7 +1616,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; + } + diff --git a/qca-nss-drv/patches-11.4/0006-Fix-Kernel-Panic-dma-with-NULL-dev.patch b/qca-nss-drv/patches-11.4/0006-Fix-Kernel-Panic-dma-with-NULL-dev.patch new file mode 100644 index 0000000..a11dc94 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0006-Fix-Kernel-Panic-dma-with-NULL-dev.patch @@ -0,0 +1,30 @@ +From 89949decfd9a0f86427b502aae4fbc3a3ef399f0 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Tue, 23 Jun 2020 19:50:28 +0200 +Subject: [PATCH] Fix Kernel Panic dma with NULL dev + +--- + nss_coredump.c | 4 ++-- + nss_log.c | 8 +++++--- + 2 files changed, 8 insertions(+), 6 deletions(-) + +--- 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/qca-nss-drv/patches-11.4/0006-nss-drv-Fix-nss_clmap_stats-enum-int-compilation-error-GCC-13.patch b/qca-nss-drv/patches-11.4/0006-nss-drv-Fix-nss_clmap_stats-enum-int-compilation-error-GCC-13.patch new file mode 100644 index 0000000..7cdb012 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0006-nss-drv-Fix-nss_clmap_stats-enum-int-compilation-error-GCC-13.patch @@ -0,0 +1,11 @@ +--- a/nss_clmap_stats.c ++++ b/nss_clmap_stats.c +@@ -63,7 +63,7 @@ void nss_clmap_stats_session_unregister( + * nss_clmap_stats_session_register + * Register debug statistic for clmap session. + */ +-bool nss_clmap_stats_session_register(uint32_t if_num, uint32_t if_type, struct net_device *netdev) ++bool nss_clmap_stats_session_register(uint32_t if_num, enum nss_clmap_interface_type if_type, struct net_device *netdev) + { + uint32_t i; + bool stats_status = false; diff --git a/qca-nss-drv/patches-11.4/0007-Exported-set-nexthop-function.patch b/qca-nss-drv/patches-11.4/0007-Exported-set-nexthop-function.patch new file mode 100644 index 0000000..7c23a04 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0007-Exported-set-nexthop-function.patch @@ -0,0 +1,23 @@ +From f8cf061454a3707c0c84d0fca685e84455f91362 Mon Sep 17 00:00:00 2001 +From: Suruchi Suman +Date: Tue, 3 Dec 2019 12:57:38 +0530 +Subject: [qca-nss-drv] Exported set nexhop function from drv. + +Change-Id: I3df6658bef72fe574ac9acfb7aac61785769766f +Signed-off-by: Suruchi Suman +--- + nss_phys_if.c | 9 ++++++++- + 1 file changed, 8 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/qca-nss-drv/patches-11.4/0007-nss-drv-Fix-nss_wifili_if-compilation-error-GCC-13.patch b/qca-nss-drv/patches-11.4/0007-nss-drv-Fix-nss_wifili_if-compilation-error-GCC-13.patch new file mode 100644 index 0000000..df42b15 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0007-nss-drv-Fix-nss_wifili_if-compilation-error-GCC-13.patch @@ -0,0 +1,11 @@ +--- a/exports/nss_wifili_if.h ++++ b/exports/nss_wifili_if.h +@@ -1974,7 +1974,7 @@ nss_if_num_t nss_get_available_wifili_ex + */ + uint8_t nss_wifili_thread_scheme_alloc(struct nss_ctx_instance *nss_ctx, + int32_t radio_ifnum, +- uint32_t radio_priority); ++ enum nss_wifili_thread_scheme_priority radio_priority); + + /** + * nss_wifili_thread_scheme_dealloc diff --git a/qca-nss-drv/patches-11.4/0009-kernel-5.15-support.patch b/qca-nss-drv/patches-11.4/0009-kernel-5.15-support.patch new file mode 100644 index 0000000..2f5de03 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0009-kernel-5.15-support.patch @@ -0,0 +1,74 @@ +From 2a3b9f4659542e529f4e1a535c33dfde7e272707 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Tue, 5 Apr 2022 18:10:57 +0200 +Subject: [PATCH 2/4] nss-drv: add support for kernel 5.15 + +- Fix coredump panic notifier include change. +- Fix skb ZEROCOPY flag. +- Add skb reuse support for 5.15 kernel version. + +Signed-off-by: Ansuel Smith +--- + nss_core.c | 5 +++-- + nss_coredump.c | 4 ++++ + nss_hal/nss_hal.c | 1 + + 3 files changed, 9 insertions(+), 2 deletions(-) + +--- a/nss_core.c ++++ b/nss_core.c +@@ -53,7 +53,9 @@ + (((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, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)))))) ++(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)))) || \ ++(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)))) || \ ++(((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)))))) + #error "Check skb recycle code in this file to match Linux version" + #endif + +@@ -2578,7 +2580,7 @@ static inline bool nss_core_skb_can_reus + if (unlikely(irqs_disabled())) + return false; + +- if (unlikely(skb_shinfo(nbuf)->tx_flags & SKBTX_DEV_ZEROCOPY)) ++ if (unlikely(skb_shinfo(nbuf)->flags & SKBFL_ZEROCOPY_ENABLE)) + return false; + + if (unlikely(skb_is_nonlinear(nbuf))) +--- a/nss_coredump.c ++++ b/nss_coredump.c +@@ -23,7 +23,11 @@ + #include "nss_hal.h" + #include "nss_log.h" + #include ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)) + #include /* for panic_notifier_list */ ++#else ++#include ++#endif + #include /* for time */ + #include "nss_tx_rx_common.h" + +--- a/nss_hal/nss_hal.c ++++ b/nss_hal/nss_hal.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + #include "nss_hal.h" + #include "nss_arch.h" +@@ -57,9 +58,9 @@ int nss_hal_firmware_load(struct nss_ctx + int rc; + + if (nss_ctx->id == 0) { +- rc = request_firmware(&nss_fw, NSS_AP0_IMAGE, &(nss_dev->dev)); ++ rc = firmware_request_nowarn(&nss_fw, NSS_AP0_IMAGE, &(nss_dev->dev)); + } else if (nss_ctx->id == 1) { +- rc = request_firmware(&nss_fw, NSS_AP1_IMAGE, &(nss_dev->dev)); ++ rc = firmware_request_nowarn(&nss_fw, NSS_AP1_IMAGE, &(nss_dev->dev)); + } else { + nss_warning("%px: Invalid nss dev: %d\n", nss_ctx, nss_ctx->id); + return -EINVAL; diff --git a/qca-nss-drv/patches-11.4/0010-nss-drv-dynamic-interface-desc.patch b/qca-nss-drv/patches-11.4/0010-nss-drv-dynamic-interface-desc.patch new file mode 100644 index 0000000..6d3434b --- /dev/null +++ b/qca-nss-drv/patches-11.4/0010-nss-drv-dynamic-interface-desc.patch @@ -0,0 +1,18 @@ +--- a/nss_dynamic_interface_stats.c ++++ b/nss_dynamic_interface_stats.c +@@ -87,8 +87,15 @@ const char *nss_dynamic_interface_type_n + "NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N", + "NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0", + "NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1", ++ "NSS_DYNAMIC_INTERFACE_TYPE_TLS_INNER", ++ "NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER", ++ "NSS_DYNAMIC_INTERFACE_TYPE_MIRROR", ++ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_EXT_VDEV_WDS", + "NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_HOST_INNER", + "NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_OUTER", ++ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_EXT_VDEV_VLAN", ++ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER", ++ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER" + }; + + /* diff --git a/qca-nss-drv/patches-11.4/0011-rework-getting-the-reserved-memory-size.patch b/qca-nss-drv/patches-11.4/0011-rework-getting-the-reserved-memory-size.patch new file mode 100644 index 0000000..1adaabf --- /dev/null +++ b/qca-nss-drv/patches-11.4/0011-rework-getting-the-reserved-memory-size.patch @@ -0,0 +1,114 @@ +From 1c2b564d7b29644765925a784d468f40555ded8a Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Fri, 10 Feb 2023 12:50:51 +0100 +Subject: [PATCH] nss-drv: rework getting the reserved-memory size + +Currently, the way NSS DRV gets the reserved memory node strictly depends +on the nss@40000000 node being present so it can find it after globaly +looking for the reserved-memory node and then going through its children. + +After that its evaluation the address and size cells manually in order to +properly calculate the size of reserved-memory. + +We can make this way more reliable and generic, so lets pass the memory +region wia the NSS common DTS node, match it via its compatible and then +get the memory region phandle and simply convert it to a resource. + +Signed-off-by: Robert Marko +--- + nss_core.c | 70 +++++++++++++++++++++++------------------------------- + 1 file changed, 30 insertions(+), 40 deletions(-) + +--- a/nss_core.c ++++ b/nss_core.c +@@ -23,6 +23,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #ifdef CONFIG_BRIDGE_NETFILTER +@@ -450,50 +452,38 @@ static void nss_core_handle_crypto_pkt(s + */ + static uint32_t nss_soc_mem_info(void) + { +- struct device_node *node; +- struct device_node *snode; +- int addr_cells; +- int size_cells; +- int n_items; +- uint32_t nss_msize = 8 << 20; /* default: 8MB */ +- const __be32 *ppp; +- +- node = of_find_node_by_name(NULL, "reserved-memory"); +- if (!node) { +- nss_info_always("reserved-memory not found\n"); +- return nss_msize; +- } +- +- ppp = (__be32 *)of_get_property(node, "#address-cells", NULL); +- addr_cells = ppp ? be32_to_cpup(ppp) : 2; +- nss_info("%px addr cells %d\n", ppp, addr_cells); +- ppp = (__be32 *)of_get_property(node, "#size-cells", NULL); +- size_cells = ppp ? be32_to_cpup(ppp) : 2; +- nss_info("%px size cells %d\n", ppp, size_cells); +- +- for_each_child_of_node(node, snode) { +- /* +- * compare (snode->full_name, "/reserved-memory/nss@40000000") may be safer +- */ +- nss_info("%px snode %s fn %s\n", snode, snode->name, snode->full_name); +- if (strcmp(snode->name, "nss") == 0) +- break; +- } +- of_node_put(node); +- if (!snode) { +- nss_info_always("nss@node not found: needed to determine NSS reserved DDR\n"); +- return nss_msize; +- } +- +- ppp = (__be32 *)of_get_property(snode, "reg", &n_items); +- if (ppp) { +- n_items /= sizeof(ppp[0]); +- nss_msize = be32_to_cpup(ppp + addr_cells + size_cells - 1); +- nss_info_always("addr/size storage words %d %d # words %d in DTS, ddr size %x\n", +- addr_cells, size_cells, n_items, nss_msize); ++ struct device_node *common_node, *memory_node; ++ struct resource r; ++ int ret; ++ ++ common_node = of_find_compatible_node(NULL, NULL, "qcom,nss-common"); ++ if (!common_node) { ++ nss_info_always("NSS common node not found!\n"); ++ goto err_use_default_memsize; ++ } ++ ++ memory_node = of_parse_phandle(common_node, "memory-region", 0); ++ if (!memory_node) { ++ nss_info_always("NSS reserved-memory node not found!\n"); ++ goto err_use_default_memsize; ++ } ++ ++ ret = of_address_to_resource(memory_node, 0, &r); ++ of_node_put(common_node); ++ of_node_put(memory_node); ++ if (ret) { ++ nss_info_always("NSS reserved-memory resource not found!\n"); ++ goto err_use_default_memsize; + } +- of_node_put(snode); +- return nss_msize; ++ ++ nss_info_always("NSS DDR size is 0x%x\n", (uint32_t) resource_size(&r)); ++ ++ return resource_size(&r); ++ ++err_use_default_memsize: ++ nss_info_always("Using default NSS reserved-memory size of 0x%x !\n", SZ_8M); ++ ++ return SZ_8M; + } + + /* diff --git a/qca-nss-drv/patches-11.4/0012-Makefile-modularize-driver.patch b/qca-nss-drv/patches-11.4/0012-Makefile-modularize-driver.patch new file mode 100644 index 0000000..b5bb53e --- /dev/null +++ b/qca-nss-drv/patches-11.4/0012-Makefile-modularize-driver.patch @@ -0,0 +1,204 @@ +--- a/Makefile ++++ b/Makefile +@@ -5,6 +5,9 @@ + obj-m += qca-nss-drv.o + + # ++# Regular NSS path ++# ++# + # List the files that belong to the driver in alphabetical order. + # + qca-nss-drv-objs := \ +@@ -16,57 +19,38 @@ qca-nss-drv-objs := \ + nss_dynamic_interface.o \ + nss_dynamic_interface_log.o \ + nss_dynamic_interface_stats.o \ +- nss_eth_rx.o \ +- nss_eth_rx_stats.o \ +- nss_eth_rx_strings.o \ +- nss_gmac_stats.o \ +- nss_if.o \ +- nss_if_log.o \ + nss_init.o \ +- nss_ipv4.o \ +- nss_ipv4_stats.o \ +- nss_ipv4_strings.o \ +- nss_ipv4_log.o \ + nss_log.o \ +- nss_lso_rx.o \ +- nss_lso_rx_stats.o \ +- nss_lso_rx_strings.o \ + nss_meminfo.o \ + nss_n2h.o \ + nss_n2h_stats.o \ + nss_n2h_strings.o \ +- nss_phys_if.o \ + nss_pm.o \ + nss_profiler.o \ + nss_project.o \ +- nss_pppoe.o \ +- nss_pppoe_log.o \ +- nss_pppoe_stats.o \ +- nss_pppoe_strings.o \ + nss_rps.o \ + nss_stats.o \ + nss_strings.o \ +- nss_tx_msg_sync.o \ + nss_unaligned.o \ + nss_unaligned_log.o \ +- nss_unaligned_stats.o \ ++ nss_unaligned_stats.o ++ ++# Base NSS HAL support ++qca-nss-drv-objs += nss_hal/nss_hal.o ++ ++ifneq "$(NSS_DRV_POINT_OFFLOAD)" "y" ++qca-nss-drv-objs += \ ++ nss_gmac_stats.o \ ++ nss_if.o \ ++ nss_if_log.o \ ++ nss_phys_if.o \ ++ nss_tx_msg_sync.o \ + nss_virt_if.o \ +- nss_virt_if_stats.o \ +- nss_vlan.o \ +- nss_vlan_log.o \ +- nss_wifi.o \ +- nss_wifi_log.o \ +- nss_wifi_stats.o \ +- nss_wifi_vdev.o \ +- nss_wifili.o \ +- nss_wifili_log.o \ +- nss_wifili_stats.o \ +- nss_wifili_strings.o \ +- nss_wifi_mac_db.o ++ nss_virt_if_stats.o + +-# Base NSS data plane/HAL support ++# Base NSS data plane support + qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o +-qca-nss-drv-objs += nss_hal/nss_hal.o ++endif + + ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n" + ccflags-y += -DNSS_DRV_BRIDGE_ENABLE +@@ -332,7 +316,70 @@ qca-nss-drv-objs += \ + nss_udp_st_strings.o + endif + ++ifneq "$(NSS_DRV_IPV4_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_IPV4_ENABLE ++qca-nss-drv-objs += \ ++ nss_ipv4.o \ ++ nss_ipv4_stats.o \ ++ nss_ipv4_strings.o \ ++ nss_ipv4_log.o ++endif ++ ++ifneq "$(NSS_DRV_ETH_RX_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_ETH_RX_ENABLE ++qca-nss-drv-objs += \ ++ nss_eth_rx.o \ ++ nss_eth_rx_stats.o \ ++ nss_eth_rx_strings.o ++endif ++ ++ifneq "$(NSS_DRV_PPPOE_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_PPPOE_ENABLE ++qca-nss-drv-objs += \ ++ nss_pppoe.o \ ++ nss_pppoe_log.o \ ++ nss_pppoe_stats.o \ ++ nss_pppoe_strings.o ++endif ++ ++ifneq "$(NSS_DRV_WIFIOFFLOAD_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_WIFIOFFLOAD_ENABLE ++ifneq "$(NSS_DRV_WIFI_LEGACY_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_WIFI_LEGACY_ENABLE ++qca-nss-drv-objs += \ ++ nss_wifi.o \ ++ nss_wifi_log.o \ ++ nss_wifi_stats.o + ifeq ($(SoC),$(filter $(SoC),ipq806x)) ++ccflags-y += -DNSS_HAL_IPQ806x_SUPPORT ++endif ++endif ++qca-nss-drv-objs += \ ++ nss_wifi_vdev.o \ ++ nss_wifili.o \ ++ nss_wifili_log.o \ ++ nss_wifili_stats.o \ ++ nss_wifili_strings.o \ ++ nss_wifi_mac_db.o ++endif ++ ++ifneq "$(NSS_DRV_VLAN_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_VLAN_ENABLE ++qca-nss-drv-objs += \ ++ nss_vlan.o \ ++ nss_vlan_log.o ++endif ++ ++ifneq "$(NSS_DRV_LSO_RX_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_LSO_RX_ENABLE ++qca-nss-drv-objs += \ ++ nss_lso_rx.o \ ++ nss_lso_rx_stats.o \ ++ nss_lso_rx_strings.o ++endif ++ ++ifeq ($(SoC),$(filter $(SoC),ipq806x)) ++ccflags-y += -DNSS_DRV_IPV4_ENABLE -DNSS_DRV_IPV6_ENABLE + qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \ + nss_hal/ipq806x/nss_hal_pvt.o + +@@ -438,6 +485,8 @@ qca-nss-drv-objs += \ + endif + endif + ++ccflags-y += -DNSS_DATA_PLANE_GENERIC_SUPPORT ++ + ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64)) + qca-nss-drv-objs += nss_hal/ipq807x/nss_hal_pvt.o \ + nss_data_plane/hal/nss_ipq807x.o +@@ -496,6 +545,7 @@ ccflags-y += -I$(obj)/nss_hal/ipq50xx -D + endif + + ccflags-y += -I$(obj)/nss_hal/include -I$(obj)/nss_data_plane/include -I$(obj)/exports -DNSS_DEBUG_LEVEL=0 -DNSS_PKT_STATS_ENABLED=1 ++ + ccflags-y += -I$(obj)/nss_data_plane/hal/include + ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_REUSE_SUPPORT=1 + ccflags-y += -Wall -Werror +@@ -510,7 +560,14 @@ NSS_CCFLAGS = -DNSS_DT_SUPPORT=1 -DNSS_F + ccflags-y += -I$(obj) + endif + ++# Fabric scaling is supported in 3.14 and 4.4 only ++ifneq ($(findstring 3.14, $(KERNELVERSION)),) ++NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=1 ++else ifneq ($(findstring 4.4, $(KERNELVERSION)),) ++NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=1 ++else + NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=0 ++endif + + # Disable Frequency scaling + ifeq "$(NSS_FREQ_SCALE_DISABLE)" "y" +--- a/nss_init.c ++++ b/nss_init.c +@@ -880,6 +880,13 @@ static int __init nss_init(void) + #endif + + /* ++ * Init Wi-Fi mesh ++ */ ++#ifdef NSS_DRV_WIFI_MESH_ENABLE ++ nss_wifi_mesh_init(); ++#endif ++ ++ /* + * Register platform_driver + */ + return platform_driver_register(&nss_driver); diff --git a/qca-nss-drv/patches-11.4/0012-nss-drv-quiet-messages.patch b/qca-nss-drv/patches-11.4/0012-nss-drv-quiet-messages.patch new file mode 100644 index 0000000..71c0f37 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0012-nss-drv-quiet-messages.patch @@ -0,0 +1,80 @@ +--- a/nss_core.c ++++ b/nss_core.c +@@ -477,7 +477,7 @@ static uint32_t nss_soc_mem_info(void) + goto err_use_default_memsize; + } + +- nss_info_always("NSS DDR size is 0x%x\n", (uint32_t) resource_size(&r)); ++ nss_info("NSS DDR size is 0x%x\n", (uint32_t) resource_size(&r)); + + return resource_size(&r); + +--- a/nss_hal/ipq50xx/nss_hal_pvt.c ++++ b/nss_hal/ipq50xx/nss_hal_pvt.c +@@ -449,15 +449,15 @@ static int __nss_hal_clock_configure(str + } + } + +- nss_info_always("Supported Frequencies - "); ++ nss_info("Supported Frequencies - "); + for (i = 0; i < NSS_FREQ_MAX_SCALE; i++) { + switch (nss_runtime_samples.freq_scale[i].frequency) { + case NSS_FREQ_850: +- nss_info_always("850 MHz "); ++ nss_info("850 MHz "); + break; + + case NSS_FREQ_1000: +- nss_info_always("1 GHz "); ++ nss_info("1 GHz "); + break; + + case NSS_FREQ_SCALE_NA: +--- a/nss_hal/ipq60xx/nss_hal_pvt.c ++++ b/nss_hal/ipq60xx/nss_hal_pvt.c +@@ -532,16 +532,16 @@ static int __nss_hal_clock_configure(str + } + } + +- nss_info_always("Supported Frequencies - "); ++ nss_info("Supported Frequencies - "); + for (i = 0; i < NSS_FREQ_MAX_SCALE; i++) { + if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_187) { +- nss_info_always("187.2 MHz "); ++ nss_info("187.2 MHz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_748) { +- nss_info_always("748.8 MHz "); ++ nss_info("748.8 MHz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_1497) { +- nss_info_always("1.4976 GHz "); ++ nss_info("1.4976 GHz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_1689) { +- nss_info_always("1.6896 GHz "); ++ nss_info("1.6896 GHz "); + } else { + nss_info_always("Error\nNo Table/Invalid Frequency Found\n"); + return -EFAULT; +--- a/nss_hal/ipq807x/nss_hal_pvt.c ++++ b/nss_hal/ipq807x/nss_hal_pvt.c +@@ -571,16 +571,16 @@ static int __nss_hal_clock_configure(str + } + } + +- nss_info_always("Supported Frequencies - "); ++ nss_info("Supported Frequencies - "); + for (i = 0; i < NSS_FREQ_MAX_SCALE; i++) { + if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_187) { +- nss_info_always("187.2 MHz "); ++ nss_info("187.2 MHz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_748) { +- nss_info_always("748.8 MHz "); ++ nss_info("748.8 MHz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_1497) { +- nss_info_always("1.4976 GHz "); ++ nss_info("1.4976 GHz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_1689) { +- nss_info_always("1.6896 GHz "); ++ nss_info("1.6896 GHz "); + } else { + nss_info_always("Error\nNo Table/Invalid Frequency Found\n"); + return -EFAULT; diff --git a/qca-nss-drv/patches-11.4/0013-backport-12.4.patch b/qca-nss-drv/patches-11.4/0013-backport-12.4.patch new file mode 100644 index 0000000..70cf49e --- /dev/null +++ b/qca-nss-drv/patches-11.4/0013-backport-12.4.patch @@ -0,0 +1,2163 @@ +--- a/exports/nss_c2c_rx.h ++++ b/exports/nss_c2c_rx.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 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. +@@ -36,7 +36,7 @@ enum nss_c2c_rx_stats_types { + /**< Number of received simple pbufs. */ + NSS_C2C_RX_STATS_PBUF_SG, /**< Number of scatter-gather pbufs received. */ + NSS_C2C_RX_STATS_PBUF_RETURNING, /**< Number of returning scatter-gather pbufs. */ +- NSS_C2C_RX_STATS_INVAL_DEST, /**< Number of pbuf enqueue failures because of destination is invalid. */ ++ NSS_C2C_RX_STATS_INVAL_DEST, /**< Number of pbuf enqueue failures because destination is invalid. */ + NSS_C2C_RX_STATS_MAX, /**< Maximum message type. */ + }; + +--- a/exports/nss_c2c_tx.h ++++ b/exports/nss_c2c_tx.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2018-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. +@@ -72,9 +72,9 @@ enum nss_c2c_tx_test_type { + */ + enum nss_c2c_tx_stats_types { + NSS_C2C_TX_STATS_PBUF_SIMPLE = NSS_STATS_NODE_MAX, +- /**< Number of received simple pbuf. */ +- NSS_C2C_TX_STATS_PBUF_SG, /**< Number of scatter-gather pbuf received. */ +- NSS_C2C_TX_STATS_PBUF_RETURNING, /**< Number of returning scatter-gather pbuf. */ ++ /**< Number of received simple pbufs. */ ++ NSS_C2C_TX_STATS_PBUF_SG, /**< Number of scatter-gather pbufs received. */ ++ NSS_C2C_TX_STATS_PBUF_RETURNING, /**< Number of returning scatter-gather pbufs. */ + NSS_C2C_TX_STATS_MAX, /**< Maximum message type. */ + }; + +--- a/exports/nss_cmn.h ++++ b/exports/nss_cmn.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014, 2016-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014, 2016-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. +@@ -27,7 +27,7 @@ + * @{ + */ + +-/* ++/** + * Interface Number 1 Valid 7 Core 8 Type 16 Index + */ + typedef int32_t nss_if_num_t; +--- a/exports/nss_gre.h ++++ b/exports/nss_gre.h +@@ -1,6 +1,9 @@ + /* + **************************************************************************** + * Copyright (c) 2017-2019, 2021, The Linux Foundation. All rights reserved. ++ * ++ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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. +@@ -101,16 +104,16 @@ enum nss_gre_msg_types { + }; + + /** +- * GRE Mode Types ++ * GRE mode types. + */ + enum nss_gre_mode { +- NSS_GRE_MODE_TUN, /**< GRE Tunnel interface. */ +- NSS_GRE_MODE_TAP, /**< GRE Tap interface. */ ++ NSS_GRE_MODE_TUN, /**< GRE tunnel interface. */ ++ NSS_GRE_MODE_TAP, /**< GRE TAP interface. */ + NSS_GRE_MODE_MAX /**< Maxmum GRE mode. */ + }; + + /** +- * GRE IP Types ++ * GRE IP types. + */ + enum nss_gre_ip_types { + NSS_GRE_IP_IPV4, /**< Outer Tunnel is IPV4. */ +@@ -168,11 +171,11 @@ enum nss_gre_session_types { + * GRE create message structure. + */ + struct nss_gre_config_msg { +- uint32_t src_ip[4]; /**< Source IPv4 or IPv6 Adddress. */ +- uint32_t dest_ip[4]; /**< Destination IPv4 or IPv6 Adddress. */ ++ uint32_t src_ip[4]; /**< Source IPv4 or IPv6 address. */ ++ uint32_t dest_ip[4]; /**< Destination IPv4 or IPv6 address. */ + uint32_t flags; /**< GRE Flags. */ +- uint32_t ikey; /**< GRE rx KEY.*/ +- uint32_t okey; /**< GRE tx KEY. */ ++ uint32_t ikey; /**< GRE Rx key.*/ ++ uint32_t okey; /**< GRE Tx key. */ + uint32_t mode; /**< GRE TUN or TAP. */ + uint32_t ip_type; /**< IPv4 or IPv6 type. */ + uint32_t next_node_if_num; /**< To whom to forward packets. */ +@@ -185,7 +188,7 @@ struct nss_gre_config_msg { + }; + + /** +- * GRE link up message structure ++ * GRE link up message structure. + */ + struct nss_gre_linkup_msg { + int if_number; /**< Interface number. */ +@@ -202,11 +205,11 @@ struct nss_gre_linkdown_msg { + * GRE deconfig message structure + */ + struct nss_gre_deconfig_msg { +- int if_number; /**< Interface number */ ++ int if_number; /**< Interface number. */ + }; + + /** +- * GRE session statistics message ++ * GRE session statistics message. + */ + struct nss_gre_session_stats_msg { + struct nss_cmn_node_stats node_stats; /**< Common node statistics. */ +@@ -214,7 +217,7 @@ struct nss_gre_session_stats_msg { + }; + + /** +- * GRE base statistics message ++ * GRE base statistics message. + */ + struct nss_gre_base_stats_msg { + uint32_t stats[NSS_GRE_BASE_DEBUG_MAX]; /**< Base debug statistics. */ +@@ -241,10 +244,10 @@ struct nss_gre_session_stats_notificatio + + /** + * nss_gre_msg +- * Message structure to send/receive GRE messages ++ * Message structure to send/receive GRE messages. + */ + struct nss_gre_msg { +- struct nss_cmn_msg cm; /**< Common message header */ ++ struct nss_cmn_msg cm; /**< Common message header. */ + + /** + * Payload of a GRE message. +@@ -304,7 +307,7 @@ extern nss_tx_status_t nss_gre_tx_msg_sy + + /** + * nss_gre_tx_buf +- * Sends packet to the NSS ++ * Sends a packet to the NSS. + * + * @datatypes + * nss_ctx_instance \n +@@ -445,7 +448,17 @@ typedef void (*nss_gre_pkt_callback_t)(s + * @return + * None. + */ ++#ifdef NSS_DRV_GRE_ENABLE + extern void nss_gre_register_pkt_callback(nss_gre_pkt_callback_t cb); ++#else ++static inline void nss_gre_register_pkt_callback(nss_gre_pkt_callback_t cb) ++{ ++ /* ++ * Dummy registration function for external modules when GRE ++ * is disabled ++ */ ++} ++#endif + + /** + * nss_gre_unregister_pkt_callback +@@ -457,7 +470,17 @@ extern void nss_gre_register_pkt_callbac + * @return + * None. + */ ++#ifdef NSS_DRV_GRE_ENABLE + extern void nss_gre_unregister_pkt_callback(void); ++#else ++static inline void nss_gre_unregister_pkt_callback(void) ++{ ++ /* ++ * Dummy registration function for external modules when GRE ++ * is disabled ++ */ ++} ++#endif + + /** + * nss_gre_stats_unregister_notifier +--- a/exports/nss_gre_redir.h ++++ b/exports/nss_gre_redir.h +@@ -302,7 +302,7 @@ struct nss_gre_redir_stats_sync_msg { + + /** + * nss_gre_redir_tun_stats +- * GRE redirect statistics to accumulate all the stats values. ++ * GRE redirect statistics to accumulate all stats values. + */ + struct nss_gre_redir_tun_stats { + uint64_t rx_packets; /**< Number of packets received. */ +--- a/exports/nss_if.h ++++ b/exports/nss_if.h +@@ -321,6 +321,23 @@ extern struct nss_ctx_instance *nss_if_r + extern nss_tx_status_t nss_if_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, uint32_t if_num); + + /** ++ * nss_if_tx_msg_with_size ++ * Sends a message to the NSS interface. ++ * ++ * @datatypes ++ * nss_ctx_instance \n ++ * nss_if_msg ++ * ++ * @param[in,out] nss_ctx Pointer to the NSS context. ++ * @param[in] nim Pointer to the NSS interface message. ++ * @param[in] size Total message buffer size. ++ * ++ * @return ++ * Status of the Tx operation. ++ */ ++nss_tx_status_t nss_if_tx_msg_with_size(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim, uint32_t size); ++ ++/** + * nss_if_tx_msg + * Sends a message to the NSS interface. + * +@@ -338,7 +355,7 @@ nss_tx_status_t nss_if_tx_msg(struct nss + + /** + * nss_if_msg_sync +- * Sends a message to the NSS interface and wait for the response. ++ * Sends a message to the NSS interface and waits for the response. + * + * @datatypes + * nss_ctx_instance \n +@@ -385,7 +402,7 @@ nss_tx_status_t nss_if_reset_nexthop(str + + /** + * nss_if_change_mtu +- * Change the MTU of the interface. ++ * Changes the MTU of the interface. + * + * @datatypes + * nss_ctx_instance +@@ -401,7 +418,7 @@ nss_tx_status_t nss_if_change_mtu(struct + + /** + * nss_if_change_mac_addr +- * Change the MAC address of the interface. ++ * Changes the MAC address of the interface. + * + * @datatypes + * nss_ctx_instance +@@ -417,7 +434,7 @@ nss_tx_status_t nss_if_change_mac_addr(s + + /** + * nss_if_vsi_unassign +- * Detach the VSI ID from the given interface. ++ * Detaches the VSI ID from the given interface. + * + * @datatypes + * nss_ctx_instance +@@ -433,7 +450,7 @@ nss_tx_status_t nss_if_vsi_unassign(stru + + /** + * nss_if_vsi_assign +- * Attach the VSI ID to the given interface. ++ * Attaches the VSI ID to the given interface. + * + * @datatypes + * nss_ctx_instance +--- a/exports/nss_ipv4.h ++++ b/exports/nss_ipv4.h +@@ -1,9 +1,12 @@ + /* + ************************************************************************** + * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 +@@ -55,16 +58,16 @@ struct nss_ipv4_create { + /**< Source interface number (virtual or physical). */ + int32_t dest_interface_num; + /**< Destination interface number (virtual or physical). */ +- int32_t protocol; /**< L4 protocol (e.g., TCP or UDP). */ +- uint32_t flags; /**< Flags (if any) associated with this rule. */ ++ int32_t protocol; /**< L4 protocol, e.g., TCP or UDP. */ ++ uint32_t flags; /**< Flags associated with this rule. */ + uint32_t from_mtu; /**< MTU of the incoming interface. */ + uint32_t to_mtu; /**< MTU of the outgoing interface. */ + uint32_t src_ip; /**< Source IP address. */ +- int32_t src_port; /**< Source L4 port (e.g., TCP or UDP port). */ ++ int32_t src_port; /**< Source L4 port, e.g., TCP or UDP port. */ + uint32_t src_ip_xlate; /**< Translated source IP address (used with SNAT). */ + int32_t src_port_xlate; /**< Translated source L4 port (used with SNAT). */ + uint32_t dest_ip; /**< Destination IP address. */ +- int32_t dest_port; /**< Destination L4 port (e.g., TCP or UDP port). */ ++ int32_t dest_port; /**< Destination L4 port, e.g., TCP or UDP port. */ + uint32_t dest_ip_xlate; + /**< Translated destination IP address (used with DNAT). */ + int32_t dest_port_xlate; +@@ -82,7 +85,7 @@ struct nss_ipv4_create { + uint32_t flow_end; /**< TCP window end. */ + uint32_t flow_max_end; /**< TCP window maximum end. */ + uint32_t flow_pppoe_if_exist; +- /**< Flow direction: PPPoE interface exist flag. */ ++ /**< Flow direction: PPPoE interface existence flag. */ + int32_t flow_pppoe_if_num; + /**< Flow direction: PPPoE interface number. */ + uint16_t ingress_vlan_tag; /**< Ingress VLAN tag expected for this flow. */ +@@ -100,7 +103,7 @@ struct nss_ipv4_create { + /**< Return direction: PPPoE interface number. */ + uint16_t egress_vlan_tag; /**< Egress VLAN tag expected for this flow. */ + uint8_t spo_needed; /**< Indicates whether SPO is required. */ +- uint32_t param_a0; /**< Custom parameter 0. */ ++ struct net_device *top_ndev; /**< Netdevice associated with the top interface. */ + uint32_t param_a1; /**< Custom parameter 1. */ + uint32_t param_a2; /**< Custom parameter 2. */ + uint32_t param_a3; /**< Custom parameter 3. */ +@@ -131,9 +134,9 @@ struct nss_ipv4_create { + struct nss_ipv4_destroy { + int32_t protocol; /**< L4 protocol ID. */ + uint32_t src_ip; /**< Source IP address. */ +- int32_t src_port; /**< Source L4 port (e.g., TCP or UDP port). */ ++ int32_t src_port; /**< Source L4 port, e.g., TCP or UDP port. */ + uint32_t dest_ip; /**< Destination IP address. */ +- int32_t dest_port; /**< Destination L4 port (e.g., TCP or UDP port). */ ++ int32_t dest_port; /**< Destination L4 port, e.g., TCP or UDP port. */ + }; + + /** +@@ -900,6 +903,7 @@ enum nss_ipv4_exception_events { + NSS_IPV4_EXCEPTION_EVENT_ICMP_IPV4_GRE_HEADER_INCOMPLETE, + NSS_IPV4_EXCEPTION_EVENT_ICMP_IPV4_ESP_HEADER_INCOMPLETE, + NSS_IPV4_EXCEPTION_EVENT_EMESH_PRIO_MISMATCH, ++ NSS_IPV4_EXCEPTION_EVENT_MC_UCAST_DMAC, + NSS_IPV4_EXCEPTION_EVENT_MAX + }; + +@@ -956,10 +960,10 @@ struct nss_ipv4_node_sync { + /**< Number of multicast connection flushes. */ + + uint32_t ipv4_connection_create_invalid_mirror_ifnum; +- /**< Number of create request failed with an invalid mirror interface number. */ ++ /**< Number of failed create requests with an invalid mirror interface number. */ + + uint32_t ipv4_connection_create_invalid_mirror_iftype; +- /**< Number of create request failed with an invalid mirror interface type. */ ++ /**< Number of failed create requests with an invalid mirror interface type. */ + + uint32_t ipv4_mirror_failures; + /**< Mirror packet failed. */ +--- a/exports/nss_ipv6.h ++++ b/exports/nss_ipv6.h +@@ -1,9 +1,12 @@ + /* + ************************************************************************** + * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 +@@ -82,14 +85,14 @@ struct nss_ipv6_create { + /**< Source interface number (virtual or physical). */ + int32_t dest_interface_num; + /**< Destination interface number (virtual or physical). */ +- int32_t protocol; /**< L4 protocol (e.g., TCP or UDP). */ +- uint32_t flags; /**< Flags (if any) associated with this rule. */ ++ int32_t protocol; /**< L4 protocol, e.g., TCP or UDP,. */ ++ uint32_t flags; /**< Flags associated with this rule. */ + uint32_t from_mtu; /**< MTU of the incoming interface. */ + uint32_t to_mtu; /**< MTU of the outgoing interface. */ + uint32_t src_ip[4]; /**< Source IP address. */ +- int32_t src_port; /**< Source L4 port (e.g., TCP or UDP port). */ ++ int32_t src_port; /**< Source L4 port, e.g., TCP or UDP port. */ + uint32_t dest_ip[4]; /**< Destination IP address. */ +- int32_t dest_port; /**< Destination L4 port (e.g., TCP or UDP port). */ ++ int32_t dest_port; /**< Destination L4 port, e.g., TCP or UDP port. */ + uint8_t src_mac[ETH_ALEN]; /**< Source MAC address. */ + uint8_t dest_mac[ETH_ALEN]; /**< Destination MAC address. */ + uint8_t flow_window_scale; /**< Window scaling factor (TCP). */ +@@ -111,7 +114,7 @@ struct nss_ipv6_create { + uint32_t return_max_end; + /**< Maximum end for the return direction. */ + uint32_t return_pppoe_if_exist; +- /**< Return direction: PPPoE interface exist flag. */ ++ /**< Return direction: PPPoE interface existence flag. */ + int32_t return_pppoe_if_num; + /**< Return direction: PPPoE interface number. */ + uint16_t egress_vlan_tag; /**< Egress VLAN tag expected for this flow. */ +@@ -132,6 +135,7 @@ struct nss_ipv6_create { + /**< Egress VLAN tag expected for this flow. */ + uint8_t flow_dscp; /**< IP DSCP value for flow direction. */ + uint8_t return_dscp; /**< IP DSCP value for the return direction. */ ++ struct net_device *top_ndev; /**< Netdevice associated with the top interface. */ + }; + + /** +@@ -139,11 +143,11 @@ struct nss_ipv6_create { + * Information for an IPv6 flow or connection destroy rule. + */ + struct nss_ipv6_destroy { +- int32_t protocol; /**< L4 protocol (e.g., TCP or UDP). */ ++ int32_t protocol; /**< L4 protocol, e.g., TCP or UDP. */ + uint32_t src_ip[4]; /**< Source IP address. */ +- int32_t src_port; /**< Source L4 port (e.g., TCP or UDP port). */ ++ int32_t src_port; /**< Source L4 port, e.g., TCP or UDP port. */ + uint32_t dest_ip[4]; /**< Destination IP address. */ +- int32_t dest_port; /**< Destination L4 port (e.g., TCP or UDP port). */ ++ int32_t dest_port; /**< Destination L4 port, e.g., TCP or UDP port. */ + }; + + /** +@@ -951,10 +955,10 @@ struct nss_ipv6_node_sync { + /**< Number of multicast connection flushes. */ + + uint32_t ipv6_connection_create_invalid_mirror_ifnum; +- /**< Number of create request failed with an invalid mirror interface number. */ ++ /**< Number of failed create requests with an invalid mirror interface number. */ + + uint32_t ipv6_connection_create_invalid_mirror_iftype; +- /**< Number of create request failed with an invalid mirror interface type. */ ++ /**< Number of failed create requests with an invalid mirror interface type. */ + + uint32_t ipv6_mirror_failures; + /**< Mirror packet failed. */ +--- a/exports/nss_lso_rx.h ++++ b/exports/nss_lso_rx.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 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 +@@ -17,7 +17,7 @@ + */ + + /* +- * nss_lso_rx.h ++ * @file nss_lso_rx.h + * NSS driver LSO (Large Send Offload) Rx header file. + */ + +--- a/exports/nss_map_t.h ++++ b/exports/nss_map_t.h +@@ -36,14 +36,18 @@ + */ + #define NSS_MAX_MAP_T_DYNAMIC_INTERFACES 4 + ++/** ++ * MAP-T metadata flag. ++ */ + #define NSS_MAPT_MDATA_FLAG_DF_BIT (1 << 0) + +-/* +- * mapt meta data ++/** ++ * nss_map_t_mdata ++ * MAP-T metadata + */ + struct nss_map_t_mdata { +- uint16_t flags; +- uint16_t res[6]; ++ uint16_t flags; /**< Metadata flags. */ ++ uint16_t res[6]; /**< Reserved for future use. */ + }; + + /** +--- a/exports/nss_virt_if.h ++++ b/exports/nss_virt_if.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2017, 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. +@@ -93,8 +93,8 @@ struct nss_virt_if_interface_stats { + * Virtual interface statistics received from the NSS. + */ + struct nss_virt_if_stats { +- struct nss_virt_if_base_node_stats base_stats; +- struct nss_virt_if_interface_stats if_stats; ++ struct nss_virt_if_base_node_stats base_stats; /**< Virtual interface statistics of NSS base node. */ ++ struct nss_virt_if_interface_stats if_stats; /**< Virtual interface statistics of each pair of interfaces. */ + }; + + /** +--- a/nss_c2c_rx.c ++++ b/nss_c2c_rx.c +@@ -1,9 +1,12 @@ + /* + ************************************************************************** + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 +@@ -107,7 +110,7 @@ void nss_c2c_rx_register_handler(struct + + if (nss_ctx->id == NSS_CORE_0) { + nss_c2c_rx_stats_dentry_create(); ++ nss_c2c_rx_strings_dentry_create(); + } +- nss_c2c_rx_strings_dentry_create(); + } + EXPORT_SYMBOL(nss_c2c_rx_register_handler); +--- a/nss_c2c_tx.c ++++ b/nss_c2c_tx.c +@@ -1,9 +1,12 @@ + /* + ************************************************************************** + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 +@@ -142,8 +145,8 @@ void nss_c2c_tx_register_handler(struct + + if (nss_ctx->id == NSS_CORE_0) { + nss_c2c_tx_stats_dentry_create(); ++ nss_c2c_tx_strings_dentry_create(); + } +- nss_c2c_tx_strings_dentry_create(); + } + EXPORT_SYMBOL(nss_c2c_tx_register_handler); + +--- a/nss_core.c ++++ b/nss_core.c +@@ -522,7 +522,7 @@ static void nss_get_ddr_info(struct nss_ + const __be32 *ppp = (__be32 *)of_get_property(node, "reg", &n_items); + + n_items /= sizeof(ppp[0]); +- nss_info_always("node size %d # items %d\n", ++ nss_info("node size %d # items %d\n", + of_n_size_cells(node), n_items); + if (ppp) { + if (n_items & 1) { /* case 1 */ +@@ -549,7 +549,7 @@ case3: + n_items = 0; + if (n_items) { + of_node_put(node); +- nss_info_always("%s: %x %u (avl %u) items %d active_cores %d\n", ++ nss_info("%s: %x %u (avl %u) items %d active_cores %d\n", + name, mmu->start_address, mmu->ddr_size, + avail_ddr, n_items, mmu->num_active_cores); + /* +@@ -886,7 +886,7 @@ static inline void nss_core_handle_buffe + /* + * linearize or free if requested. + */ +- if (unlikely(skb_is_nonlinear(nbuf))) { ++ if (unlikely(skb_is_nonlinear(nbuf))) { + if (nss_core_skb_needs_linearize(nbuf, ndev->features) && __skb_linearize(nbuf)) { + dev_kfree_skb_any(nbuf); + return; +@@ -944,11 +944,11 @@ static inline void nss_core_handle_ext_b + ext_cb = subsys_dp_reg->ext_cb; + if (likely(ext_cb) && likely(ndev)) { + +- if (unlikely(skb_is_nonlinear(nbuf))) { ++ if (unlikely(skb_is_nonlinear(nbuf))) { + if (nss_core_skb_needs_linearize(nbuf, ndev->features) && __skb_linearize(nbuf)) { + /* +- * We needed to linearize, but __skb_linearize() failed. So free the nbuf. +- */ ++ * We needed to linearize, but __skb_linearize() failed. So free the nbuf. ++ */ + dev_kfree_skb_any(nbuf); + return; + } +@@ -1685,6 +1685,7 @@ static void nss_core_init_nss(struct nss + { + struct nss_top_instance *nss_top; + int ret; ++ int i; + + NSS_CORE_DMA_CACHE_MAINT((void *)if_map, sizeof(*if_map), DMA_FROM_DEVICE); + NSS_CORE_DSB(); +@@ -1700,6 +1701,9 @@ static void nss_core_init_nss(struct nss + #ifdef NSS_DRV_C2C_ENABLE + nss_ctx->c2c_start = nss_ctx->meminfo_ctx.c2c_start_dma; + #endif ++ for (i = 0; i < NSS_H2N_DESC_RING_NUM; i++) { ++ nss_ctx->h2n_desc_rings[i].nss_index_local = 0; ++ } + + nss_top = nss_ctx->nss_top; + spin_lock_bh(&nss_top->lock); +@@ -1723,12 +1727,15 @@ static void nss_core_init_nss(struct nss + * Configure the maximum number of IPv4/IPv6 + * connections supported by the accelerator. + */ +- nss_ipv4_conn_cfg = max_ipv4_conn; ++#ifdef NSS_DRV_IPV4_ENABLE ++ nss_ipv4_conn_cfg = max_ipv4_conn; ++ nss_ipv4_update_conn_count(max_ipv4_conn); ++#endif ++ + #ifdef NSS_DRV_IPV6_ENABLE + nss_ipv6_conn_cfg = max_ipv6_conn; +- nss_ipv6_update_conn_count(max_ipv6_conn); ++ nss_ipv6_update_conn_count(max_ipv6_conn); + #endif +- nss_ipv4_update_conn_count(max_ipv4_conn); + + #ifdef NSS_MEM_PROFILE_LOW + /* +@@ -3014,48 +3021,52 @@ int32_t nss_core_send_buffer(struct nss_ + * Take a lock for queue + */ + spin_lock_bh(&h2n_desc_ring->lock); +- +- /* +- * We need to work out if there's sufficent space in our transmit descriptor +- * ring to place all the segments of a nbuf. +- */ +- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->h2n_nss_index[qid], sizeof(uint32_t), DMA_FROM_DEVICE); +- NSS_CORE_DSB(); +- nss_index = if_map->h2n_nss_index[qid]; +- ++ nss_index = h2n_desc_ring->nss_index_local; + hlos_index = h2n_desc_ring->hlos_index; +- + count = ((nss_index - hlos_index - 1) + size) & (mask); + ++ /* ++ * If local index shows that there is not enough space in the ring, ++ * Read the actual index from the consumer's generation (NSS-FW). ++ */ + if (unlikely(count < (segments + 1))) { + /* +- * NOTE: tx_q_full_cnt and TX_STOPPED flags will be used +- * when we will add support for DESC Q congestion management +- * in future +- */ +- h2n_desc_ring->tx_q_full_cnt++; +- h2n_desc_ring->flags |= NSS_H2N_DESC_RING_FLAGS_TX_STOPPED; +- spin_unlock_bh(&h2n_desc_ring->lock); +- nss_warning("%px: Data/Command Queue full reached", nss_ctx); ++ * We need to work out if there's sufficent space in our transmit descriptor ++ * ring to place all the segments of a nbuf. ++ */ ++ NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->h2n_nss_index[qid], sizeof(uint32_t), DMA_FROM_DEVICE); ++ NSS_CORE_DSB(); ++ nss_index = if_map->h2n_nss_index[qid]; ++ h2n_desc_ring->nss_index_local = nss_index; ++ count = ((nss_index - hlos_index - 1) + size) & (mask); ++ if (unlikely(count < (segments + 1))) { ++ /* ++ * NOTE: tx_q_full_cnt and TX_STOPPED flags will be used ++ * when we will add support for DESC Q congestion management ++ * in future ++ */ ++ h2n_desc_ring->tx_q_full_cnt++; ++ h2n_desc_ring->flags |= NSS_H2N_DESC_RING_FLAGS_TX_STOPPED; ++ spin_unlock_bh(&h2n_desc_ring->lock); ++ nss_warning("%px: Data/Command Queue full reached", nss_ctx); + + #if (NSS_PKT_STATS_ENABLED == 1) +- if (nss_ctx->id == NSS_CORE_0) { +- NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_QUEUE_FULL_0]); +- } else if (nss_ctx->id == NSS_CORE_1) { +- NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_QUEUE_FULL_1]); +- } else { +- nss_warning("%px: Invalid nss core: %d\n", nss_ctx, nss_ctx->id); +- } ++ if (nss_ctx->id == NSS_CORE_0) { ++ NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_QUEUE_FULL_0]); ++ } else if (nss_ctx->id == NSS_CORE_1) { ++ NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_QUEUE_FULL_1]); ++ } else { ++ nss_warning("%px: Invalid nss core: %d\n", nss_ctx, nss_ctx->id); ++ } + #endif ++ /* ++ * Enable de-congestion interrupt from NSS ++ */ ++ nss_hal_enable_interrupt(nss_ctx, nss_ctx->int_ctx[0].shift_factor, NSS_N2H_INTR_TX_UNBLOCKED); + +- /* +- * Enable de-congestion interrupt from NSS +- */ +- nss_hal_enable_interrupt(nss_ctx, nss_ctx->int_ctx[0].shift_factor, NSS_N2H_INTR_TX_UNBLOCKED); +- +- return NSS_CORE_STATUS_FAILURE_QUEUE; ++ return NSS_CORE_STATUS_FAILURE_QUEUE; ++ } + } +- + desc = &desc_ring[hlos_index]; + + /* +--- a/nss_core.h ++++ b/nss_core.h +@@ -389,6 +389,7 @@ struct hlos_n2h_desc_ring { + struct hlos_h2n_desc_rings { + struct h2n_desc_if_instance desc_ring; /* Descriptor ring */ + uint32_t hlos_index; ++ uint32_t nss_index_local; /* Index number for the next descriptor (NSS owned) */ + spinlock_t lock; /* Lock to save from simultaneous access */ + uint32_t flags; /* Flags */ + uint64_t tx_q_full_cnt; /* Descriptor queue full count */ +--- a/nss_coredump.c ++++ b/nss_coredump.c +@@ -1,6 +1,8 @@ + /* + ************************************************************************** + * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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. +@@ -47,7 +49,8 @@ static struct workqueue_struct *coredump + */ + static void nss_coredump_wait(struct work_struct *work) + { +- panic("did not get all coredump finished signals\n"); ++ if (!(nss_cmd_buf.coredump & 0xFFFFFFFE)) ++ panic("did not get all coredump finished signals\n"); + } + + /* +--- a/nss_crypto_cmn.c ++++ b/nss_crypto_cmn.c +@@ -226,6 +226,12 @@ nss_tx_status_t nss_crypto_cmn_tx_msg_sy + * further details read Linux/Documentation/memory-barrier.txt + */ + smp_rmb(); ++ ++ if (msg->cm.response != NSS_CMN_RESPONSE_ACK) { ++ up(&pvt->sem); ++ return NSS_TX_FAILURE; ++ } ++ + up(&pvt->sem); + + return NSS_TX_SUCCESS; +--- a/nss_dynamic_interface.c ++++ b/nss_dynamic_interface.c +@@ -1,9 +1,12 @@ + /* + ************************************************************************** + * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 +@@ -320,7 +323,9 @@ nss_tx_status_t nss_dynamic_interface_de + void nss_dynamic_interface_register_handler(struct nss_ctx_instance *nss_ctx) + { + nss_core_register_handler(nss_ctx, NSS_DYNAMIC_INTERFACE, nss_dynamic_interface_handler, NULL); +- nss_dynamic_interface_stats_dentry_create(); ++ if (nss_ctx->id == NSS_CORE_0) { ++ nss_dynamic_interface_stats_dentry_create(); ++ } + } + + /* +--- a/nss_hal/ipq806x/nss_hal_pvt.c ++++ b/nss_hal/ipq806x/nss_hal_pvt.c +@@ -1,9 +1,12 @@ + /* + ************************************************************************** + * Copyright (c) 2013, 2015-2021, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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 +@@ -978,12 +981,12 @@ static int __nss_hal_clock_configure(str + * Check if turbo is supported + */ + if (npd->turbo_frequency) { +- nss_info_always("nss_driver - Turbo Support %d\n", npd->turbo_frequency); ++ nss_info("nss_driver - Turbo Support %d\n", npd->turbo_frequency); + #if (NSS_PM_SUPPORT == 1) + nss_pm_set_turbo(); + #endif + } else { +- nss_info_always("nss_driver - Turbo No Support %d\n", npd->turbo_frequency); ++ nss_info("nss_driver - Turbo No Support %d\n", npd->turbo_frequency); + } + + /* +@@ -1082,26 +1085,26 @@ clk_complete: + } + } + +- nss_info_always("Supported Frequencies - "); ++ nss_info("Supported Frequencies - "); + for (i = 0; i < NSS_FREQ_MAX_SCALE; i++) { + if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_110) { +- nss_info_always("110Mhz "); ++ nss_info("110Mhz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_275) { +- nss_info_always("275Mhz "); ++ nss_info("275Mhz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_550) { +- nss_info_always("550Mhz "); ++ nss_info("550Mhz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_600) { +- nss_info_always("600Mhz "); ++ nss_info("600Mhz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_733) { +- nss_info_always("733Mhz "); ++ nss_info("733Mhz "); + } else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_800) { +- nss_info_always("800Mhz "); ++ nss_info("800Mhz "); + } else { + nss_info_always("Error\nNo Table/Invalid Frequency Found - Loading Old Tables -"); + return -EFAULT; + } + } +- nss_info_always("\n"); ++ nss_info("\n"); + + /* + * Set default frequency +--- a/nss_hal/nss_hal.c ++++ b/nss_hal/nss_hal.c +@@ -41,7 +41,6 @@ + /* + * Macros + */ +-#define MIN_IMG_SIZE (64*1024) + #define NSS_AP0_IMAGE "qca-nss0.bin" + #define NSS_AP1_IMAGE "qca-nss1.bin" + +@@ -62,7 +61,7 @@ int nss_hal_firmware_load(struct nss_ctx + } else if (nss_ctx->id == 1) { + rc = firmware_request_nowarn(&nss_fw, NSS_AP1_IMAGE, &(nss_dev->dev)); + } else { +- nss_warning("%px: Invalid nss dev: %d\n", nss_ctx, nss_ctx->id); ++ nss_warning("%px: Invalid nss dev: %d", nss_ctx, nss_ctx->id); + return -EINVAL; + } + +@@ -74,10 +73,6 @@ int nss_hal_firmware_load(struct nss_ctx + return rc; + } + +- if (nss_fw->size < MIN_IMG_SIZE) { +- nss_info_always("%px: nss firmware is truncated, size:%d", nss_ctx, (int)nss_fw->size); +- return rc; +- } + + load_mem = ioremap(npd->load_addr, nss_fw->size); + if (!load_mem) { +@@ -86,7 +81,7 @@ int nss_hal_firmware_load(struct nss_ctx + return rc; + } + +- nss_info_always("nss_driver - fw of size %d bytes copied to load addr: %x, nss_id : %d\n", (int)nss_fw->size, npd->load_addr, nss_dev->id); ++ nss_info_always("nss_driver - fw of size %d bytes copied to load addr: %x, nss_id : %d", (int)nss_fw->size, npd->load_addr, nss_dev->id); + memcpy_toio(load_mem, nss_fw->data, nss_fw->size); + release_firmware(nss_fw); + iounmap(load_mem); +@@ -210,14 +205,14 @@ int nss_hal_probe(struct platform_device + if (nss_top_main.nss_hal_common_init_done == false) { + err = nss_top->hal_ops->common_reset(nss_dev); + if (err) { +- nss_info_always("NSS HAL common init failed\n"); ++ nss_info_always("NSS HAL common init failed"); + return -EFAULT; + } + } + + #if (NSS_DT_SUPPORT == 1) + if (!nss_dev->dev.of_node) { +- pr_err("nss-driver: Device tree not available\n"); ++ pr_err("nss-driver: Device tree not available"); + return -ENODEV; + } + +@@ -242,27 +237,27 @@ int nss_hal_probe(struct platform_device + */ + nss_ctx->dev = &nss_dev->dev; + +- nss_info("%px: NSS_DEV_ID %s\n", nss_ctx, dev_name(&nss_dev->dev)); ++ nss_info("%px: NSS_DEV_ID %s", nss_ctx, dev_name(&nss_dev->dev)); + + /* + * Do firmware load from nss-drv if required + */ + err = nss_top->hal_ops->firmware_load(nss_ctx, nss_dev, npd); + if (err) { +- nss_info_always("%px: firmware load from driver failed\n", nss_ctx); ++ nss_info_always("%px: firmware load from driver failed", nss_ctx); + goto err_init; + } + + err = nss_top->hal_ops->clock_configure(nss_ctx, nss_dev, npd); + if (err) { +- nss_info_always("%px: clock configure failed\n", nss_ctx); ++ nss_info_always("%px: clock configure failed", nss_ctx); + goto err_init; + } + + /* + * Get load address of NSS firmware + */ +- nss_info("%px: Setting NSS%d Firmware load address to %x\n", nss_ctx, nss_ctx->id, npd->load_addr); ++ nss_info_always("%px: Setting NSS%d Firmware load address to %x", nss_ctx, nss_ctx->id, npd->load_addr); + nss_top->nss[nss_ctx->id].load = npd->load_addr; + + /* +@@ -294,11 +289,11 @@ int nss_hal_probe(struct platform_device + * Physical address of logical registers space + */ + nss_ctx->vphys = npd->vphys; +- nss_info("%d:ctx=%px, vphys=%x, vmap=%px, nphys=%x, nmap=%px", nss_ctx->id, ++ nss_info_always("%d:ctx=%px, vphys=%x, vmap=%px, nphys=%x, nmap=%px", nss_ctx->id, + nss_ctx, nss_ctx->vphys, nss_ctx->vmap, nss_ctx->nphys, nss_ctx->nmap); + + if (!nss_meminfo_init(nss_ctx)) { +- nss_info_always("%px: meminfo init failed\n", nss_ctx); ++ nss_info_always("%px: meminfo init failed", nss_ctx); + err = -EFAULT; + goto err_init; + } +@@ -360,18 +355,25 @@ int nss_hal_probe(struct platform_device + } + #endif + ++#ifdef NSS_DRV_IPV4_ENABLE + if (npd->ipv4_enabled == NSS_FEATURE_ENABLED) { + nss_top->ipv4_handler_id = nss_dev->id; + nss_ipv4_register_handler(); ++#endif + + #ifdef NSS_DRV_EDMA_ENABLE + nss_top->edma_handler_id = nss_dev->id; + nss_edma_register_handler(); + #endif ++ ++#ifdef NSS_DRV_ETH_RX_ENABLE + nss_eth_rx_register_handler(nss_ctx); ++#endif ++ + #ifdef NSS_DRV_LAG_ENABLE + nss_lag_register_handler(); + #endif ++ + #ifdef NSS_DRV_TRUSTSEC_ENABLE + nss_top->trustsec_tx_handler_id = nss_dev->id; + nss_trustsec_tx_register_handler(); +@@ -466,10 +468,12 @@ int nss_hal_probe(struct platform_device + } + #endif + ++#ifdef NSS_DRV_PPPOE_ENABLE + if (npd->pppoe_enabled == NSS_FEATURE_ENABLED) { + nss_top->pppoe_handler_id = nss_dev->id; + nss_pppoe_register_handler(); + } ++#endif + + #ifdef NSS_DRV_PPE_ENABLE + if (npd->ppe_enabled == NSS_FEATURE_ENABLED) { +@@ -564,6 +568,7 @@ int nss_hal_probe(struct platform_device + } + #endif + ++#ifdef NSS_DRV_WIFIOFFLOAD_ENABLE + if (npd->wifioffload_enabled == NSS_FEATURE_ENABLED) { + nss_top->wifi_handler_id = nss_dev->id; + nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_VAP] = nss_dev->id; +@@ -591,6 +596,7 @@ int nss_hal_probe(struct platform_device + */ + nss_wifili_thread_scheme_db_init(nss_dev->id); + } ++#endif + + #ifdef NSS_DRV_OAM_ENABLE + if (npd->oam_enabled == NSS_FEATURE_ENABLED) { +@@ -607,11 +613,13 @@ int nss_hal_probe(struct platform_device + } + #endif + ++#ifdef NSS_DRV_VLAN_ENABLE + if (npd->vlan_enabled == NSS_FEATURE_ENABLED) { + nss_top->vlan_handler_id = nss_dev->id; + nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_VLAN] = nss_dev->id; + nss_vlan_register_handler(); + } ++#endif + + #ifdef NSS_DRV_QVPN_ENABLE + #if defined(NSS_HAL_IPQ807x_SUPPORT) || defined(NSS_HAL_IPQ60XX_SUPPORT) +@@ -712,7 +720,9 @@ int nss_hal_probe(struct platform_device + nss_freq_init_cpu_usage(); + #endif + ++#ifdef NSS_DRV_LSO_RX_ENABLE + nss_lso_rx_register_handler(nss_ctx); ++#endif + } + + nss_top->frequency_handler_id = nss_dev->id; +--- a/nss_if.c ++++ b/nss_if.c +@@ -160,10 +160,10 @@ nss_tx_status_t nss_if_tx_buf(struct nss + } + + /* +- * nss_if_tx_msg() +- * Transmit a message to the specific interface on this core. ++ * nss_if_tx_msg_with_size() ++ * Transmit a message to the specific interface on this core with a specified size. + */ +-nss_tx_status_t nss_if_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim) ++nss_tx_status_t nss_if_tx_msg_with_size(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim, uint32_t size) + { + struct nss_cmn_msg *ncm = &nim->cm; + struct net_device *dev; +@@ -198,7 +198,19 @@ nss_tx_status_t nss_if_tx_msg(struct nss + return NSS_TX_FAILURE_BAD_PARAM; + } + +- return nss_core_send_cmd(nss_ctx, nim, sizeof(*nim), NSS_NBUF_PAYLOAD_SIZE); ++ return nss_core_send_cmd(nss_ctx, nim, sizeof(*nim), size); ++} ++EXPORT_SYMBOL(nss_if_tx_msg_with_size); ++ ++/* ++ * nss_if_tx_msg() ++ * Transmit a message to the specific interface on this core. ++ */ ++nss_tx_status_t nss_if_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim) ++{ ++ NSS_VERIFY_CTX_MAGIC(nss_ctx); ++ ++ return nss_if_tx_msg_with_size(nss_ctx, nim, NSS_NBUF_PAYLOAD_SIZE); + } + + /* +--- a/nss_init.c ++++ b/nss_init.c +@@ -633,10 +633,24 @@ static struct ctl_table_header *nss_dev_ + */ + static int __init nss_init(void) + { ++#if defined(NSS_DRV_POINT_OFFLOAD) ++ struct device_node *pof = NULL; ++#endif ++ ++ + #if (NSS_DT_SUPPORT == 1) + struct device_node *cmn = NULL; + #endif +- nss_info("Init NSS driver"); ++ ++#if defined(NSS_DRV_POINT_OFFLOAD) ++ pof = of_find_node_by_name(NULL, "reg_update"); ++ if ((!pof) || (!of_property_read_bool(pof, "ubi_core_enable"))) { ++ nss_info_always("UBI is not enabled. Disable qca-nss-drv\n"); ++ return 0; ++ } ++#endif ++ ++nss_info("Init NSS driver"); + + #if (NSS_DT_SUPPORT == 1) + /* +@@ -739,7 +753,9 @@ static int __init nss_init(void) + /* + * Registering sysctl for ipv4/6 specific config. + */ ++#ifdef NSS_DRV_IPV4_ENABLE + nss_ipv4_register_sysctl(); ++#endif + #ifdef NSS_DRV_IPV6_ENABLE + nss_ipv6_register_sysctl(); + #endif +@@ -778,7 +794,9 @@ static int __init nss_init(void) + /* + * Registering sysctl for pppoe specific config. + */ ++#ifdef NSS_DRV_PPPOE_ENABLE + nss_pppoe_register_sysctl(); ++#endif + + /* + * Setup Runtime Sample values +@@ -880,13 +898,6 @@ static int __init nss_init(void) + #endif + + /* +- * Init Wi-Fi mesh +- */ +-#ifdef NSS_DRV_WIFI_MESH_ENABLE +- nss_wifi_mesh_init(); +-#endif +- +- /* + * Register platform_driver + */ + return platform_driver_register(&nss_driver); +@@ -923,13 +934,17 @@ static void __exit nss_cleanup(void) + /* + * Unregister pppoe specific sysctl + */ ++#ifdef NSS_DRV_PPPOE_ENABLE + nss_pppoe_unregister_sysctl(); ++#endif + + /* + * Unregister ipv4/6 specific sysctl and free allocated to connection tables + */ ++#ifdef NSS_DRV_IPV4_ENABLE + nss_ipv4_unregister_sysctl(); + nss_ipv4_free_conn_tables(); ++#endif + + #ifdef NSS_DRV_IPV6_ENABLE + nss_ipv6_unregister_sysctl(); +--- a/nss_meminfo.c ++++ b/nss_meminfo.c +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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 +@@ -408,7 +409,7 @@ static bool nss_meminfo_init_block_lists + + if (strcmp(r->name, "profile_dma_ctrl") == 0) { + mem_ctx->sdma_ctrl = kern_addr; +- nss_info_always("%px: set sdma %px\n", nss_ctx, kern_addr); ++ nss_info("%px: set sdma %px\n", nss_ctx, kern_addr); + } + + /* +@@ -535,6 +536,13 @@ static bool nss_meminfo_configure_n2h_h2 + } + + /* ++ * Returning true allows to execute firmware bin ++ */ ++ if (!mem_ctx->if_map) { ++ return true; ++ } ++ ++ /* + * Bring a fresh copy of if_map from memory in order to read it correctly. + */ + if_map = mem_ctx->if_map; +@@ -793,6 +801,6 @@ bool nss_meminfo_init(struct nss_ctx_ins + + nss_meminfo_init_debugfs(nss_ctx); + +- nss_info_always("%px: meminfo init succeed\n", nss_ctx); ++ nss_info("%px: meminfo init succeed\n", nss_ctx); + return true; + } +--- a/nss_n2h.c ++++ b/nss_n2h.c +@@ -2061,10 +2061,9 @@ void nss_n2h_register_handler(struct nss + + if (nss_ctx->id == NSS_CORE_0) { + nss_n2h_stats_dentry_create(); ++ nss_n2h_strings_dentry_create(); ++ nss_drv_strings_dentry_create(); + } +- nss_n2h_strings_dentry_create(); +- +- nss_drv_strings_dentry_create(); + } + + /* +--- a/nss_phys_if.h ++++ b/nss_phys_if.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-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. +@@ -70,6 +70,12 @@ struct nss_phys_if_estats { + uint32_t gmac_worst_case_ticks; /**< Worst case iteration of the GMAC in ticks */ + uint32_t gmac_iterations; /**< Number of iterations around the GMAC */ + uint32_t tx_pause_frames; /**< Number of pause frames sent by the GMAC */ ++ ++ /* ++ * On IPQ50xx, we rely on the SSDK to pull the mmc stats. ++ * The FAL layer does not do this on IPQ806x. ++ */ ++#if defined(NSS_HAL_IPQ806X_SUPPORT) + uint32_t mmc_rx_overflow_errors; + /**< Number of RX overflow errors */ + uint32_t mmc_rx_watchdog_timeout_errors; +@@ -94,6 +100,7 @@ struct nss_phys_if_estats { + uint32_t mmc_tx_single_col; /* Number of single collisions */ + uint32_t mmc_tx_multiple_col; /* Number of multiple collisions */ + uint32_t mmc_tx_octets_gb; /* Number of good/bad octets sent*/ ++#endif + }; + + /** +--- a/nss_profiler.c ++++ b/nss_profiler.c +@@ -1,9 +1,12 @@ + /* + ************************************************************************** + * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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 +@@ -97,7 +100,7 @@ nss_tx_status_t nss_profiler_if_tx_buf(v + return NSS_TX_FAILURE_TOO_LARGE; + } + +- npm = kzalloc(sizeof(*npm), GFP_KERNEL); ++ npm = kzalloc(sizeof(*npm), GFP_ATOMIC); + if (!npm) { + nss_warning("%px: Failed to allocate memory for message\n", nss_ctx); + return NSS_TX_FAILURE; +@@ -121,6 +124,7 @@ void *nss_profiler_alloc_dma(struct nss_ + { + int size; + void *kaddr; ++ dma_addr_t dma_addr; + struct nss_profile_sdma_producer *dma; + struct nss_profile_sdma_ctrl *ctrl = (struct nss_profile_sdma_ctrl *)nss_ctx->meminfo_ctx.sdma_ctrl; + if (!ctrl) +@@ -132,7 +136,13 @@ void *nss_profiler_alloc_dma(struct nss_ + kaddr = kmalloc(size, GFP_KERNEL | __GFP_ZERO); + + if (kaddr) { +- dma->desc_ring = dma_map_single(nss_ctx->dev, kaddr, size, DMA_FROM_DEVICE); ++ dma_addr = dma_map_single(nss_ctx->dev, kaddr, size, DMA_FROM_DEVICE); ++ if (unlikely(dma_mapping_error(nss_ctx->dev, dma_addr))) { ++ nss_info_always("%px: failed to map DDR block\n", nss_ctx); ++ kfree(kaddr); ++ return NULL; ++ } ++ dma->desc_ring = dma_addr; + NSS_CORE_DSB(); + } + ctrl->consumer[0].ring.kp = kaddr; +--- a/nss_qrfs.c ++++ b/nss_qrfs.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2017-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. +@@ -415,6 +415,65 @@ nss_tx_status_t nss_qrfs_set_flow_rule(s + EXPORT_SYMBOL(nss_qrfs_set_flow_rule); + + /* ++ * nss_qrfs_configure_flow_rule() ++ * Configures a QRFS flow rule to NSS firmware ++ */ ++nss_tx_status_t nss_qrfs_configure_flow_rule(uint32_t *dst_addr, uint32_t *src_addr, uint16_t dst_port, uint16_t src_port, uint32_t version, uint16_t proto, uint16_t cpu, enum nss_qrfs_msg_types type) { ++ ++ struct nss_qrfs_msg nqm; ++ struct nss_qrfs_flow_rule_msg *nqfrm; ++ nss_tx_status_t status; ++ struct nss_ctx_instance *nss_ctx = NULL; ++ nss_qrfs_msg_callback_t cb = NULL; ++ int i; ++ ++ ++ memset(&nqm, 0, sizeof(struct nss_qrfs_msg)); ++ nss_qrfs_msg_init(&nqm, NSS_QRFS_INTERFACE, type, ++ sizeof(struct nss_qrfs_flow_rule_msg), cb, (void *)nss_ctx); ++ if (type == NSS_QRFS_MSG_FLOW_ADD) { ++ nqfrm = &nqm.msg.flow_add; ++ cb = nss_qrfs_flow_add_msg_callback; ++ } else if (type == NSS_QRFS_MSG_FLOW_DELETE) { ++ nqfrm = &nqm.msg.flow_delete; ++ cb = nss_qrfs_flow_delete_msg_callback; ++ } else { ++ nss_warning("QRFS configure rule failed, not supported message type.\n"); ++ return NSS_TX_FAILURE_BAD_PARAM; ++ } ++ ++ ++ nqfrm->protocol = proto; ++ nqfrm->ip_version = version; ++ ++ if (version == 4) { ++ nqfrm->src_addr[0] = src_addr[0]; ++ nqfrm->dst_addr[0] = dst_addr[0]; ++ } else { ++ memcpy(nqfrm->src_addr, src_addr, sizeof(uint32_t) * 4); ++ memcpy(nqfrm->dst_addr, dst_addr, sizeof(uint32_t) * 4); ++ } ++ ++ nqfrm->src_port = src_port; ++ nqfrm->dst_port = dst_port; ++ nqfrm->cpu = cpu; ++ nqfrm->if_num = 0; ++ ++ for(i = 0; i < NSS_CORE_MAX; i++) { ++ nss_ctx = nss_qrfs_get_ctx(i); ++ status = nss_qrfs_tx_msg(nss_ctx, &nqm); ++ ++ if (status) { ++ nss_warning("%px: QRFS configure rule failed, error code: %d\n", nss_ctx, status); ++ return NSS_TX_FAILURE; ++ } ++ } ++ ++ return NSS_TX_SUCCESS; ++} ++EXPORT_SYMBOL(nss_qrfs_configure_flow_rule); ++ ++/* + * nss_qrfs_register_handler() + */ + void nss_qrfs_register_handler(struct nss_ctx_instance *nss_ctx) +--- a/nss_rmnet_rx.c ++++ b/nss_rmnet_rx.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 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 +@@ -243,6 +243,8 @@ static int nss_rmnet_rx_handle_destroy_s + rmnet_rx_handle[index_h2n] = NULL; + spin_unlock_bh(&nss_rmnet_rx_lock); + ++ kfree(handle->stats_h2n); ++ kfree(handle->stats_n2h); + kfree(handle->pvt); + kfree(handle); + +--- a/nss_rps.c ++++ b/nss_rps.c +@@ -278,6 +278,7 @@ static nss_tx_status_t nss_rps_cfg(struc + return NSS_SUCCESS; + } + ++#ifdef NSS_DRV_IPV4_ENABLE + /* + * nss_rps_ipv4_hash_bitmap_cfg() + * Send Message to NSS to configure hash_bitmap. +@@ -306,6 +307,7 @@ static nss_tx_status_t nss_rps_ipv4_hash + up(&nss_rps_cfg_pvt.sem); + return NSS_SUCCESS; + } ++#endif + + #ifdef NSS_DRV_IPV6_ENABLE + /* +@@ -456,8 +458,8 @@ static int nss_rps_hash_bitmap_cfg_handl + void __user *buffer, size_t *lenp, loff_t *ppos) + { + struct nss_top_instance *nss_top = &nss_top_main; +- struct nss_ctx_instance *nss_ctx = &nss_top->nss[0]; +- int ret, ret_ipv4, current_state; ++ struct nss_ctx_instance *nss_ctx __attribute__((unused)) = &nss_top->nss[0]; ++ int ret, current_state; + + current_state = nss_rps_hash_bitmap; + ret = proc_dointvec(ctl, write, buffer, lenp, ppos); +@@ -471,16 +473,24 @@ static int nss_rps_hash_bitmap_cfg_handl + return ret; + } + ++#if !defined(NSS_DRV_IPV4_ENABLE) || !defined(NSS_DRV_IPV6_ENABLE) ++ nss_info_always("%px: Feature is not supported\n", nss_ctx); ++ return 0; ++#else + if (nss_rps_hash_bitmap <= (NSS_RPS_MAX_CORE_HASH_BITMAP)) { + nss_info("Configuring NSS RPS hash_bitmap\n"); +- ret_ipv4 = nss_rps_ipv4_hash_bitmap_cfg(nss_ctx, nss_rps_hash_bitmap); ++#ifdef NSS_DRV_IPV4_ENABLE ++ { ++ int ret_ipv4; ++ ret_ipv4 = nss_rps_ipv4_hash_bitmap_cfg(nss_ctx, nss_rps_hash_bitmap); + +- if (ret_ipv4 != NSS_SUCCESS) { +- nss_warning("%px: ipv4 hash_bitmap config message failed\n", nss_ctx); +- nss_rps_hash_bitmap = current_state; +- return ret_ipv4; ++ if (ret_ipv4 != NSS_SUCCESS) { ++ nss_warning("%px: ipv4 hash_bitmap config message failed\n", nss_ctx); ++ nss_rps_hash_bitmap = current_state; ++ return ret_ipv4; ++ } + } +- ++#endif + #ifdef NSS_DRV_IPV6_ENABLE + { + int ret_ipv6; +@@ -501,6 +511,7 @@ static int nss_rps_hash_bitmap_cfg_handl + + nss_info_always("Invalid input value. Valid values are less than %d\n", (NSS_RPS_MAX_CORE_HASH_BITMAP)); + return ret; ++#endif + } + + /* nss_rps_pri_map_cfg_handler() +--- a/nss_stats.c ++++ b/nss_stats.c +@@ -1,9 +1,12 @@ + /* + ************************************************************************** + * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. 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 +@@ -149,6 +152,14 @@ int nss_stats_open(struct inode *inode, + } + + /* ++ * nss_clear_stats_write() ++ * Clear content of stats. ++ */ ++ssize_t nss_clear_stats_write(struct file *fp, const char __user *ubuf, size_t sz, loff_t *ppos) { ++ return -ESRCH; ++} ++ ++/* + * nss_stats_release() + * Releases stats file. + */ +--- a/nss_stats.h ++++ b/nss_stats.h +@@ -1,9 +1,12 @@ + /* + ************************************************************************** + * Copyright (c) 2016-2017, 2019-2020 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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 +@@ -38,10 +41,11 @@ + #define NSS_STATS_EXTRA_OUTPUT_LINES 35 + + #define NSS_STATS_DECLARE_FILE_OPERATIONS(name) \ +-static const struct file_operations nss_##name##_stats_ops = { \ ++static struct file_operations nss_##name##_stats_ops = { \ + .open = nss_stats_open, \ + .read = nss_##name##_stats_read, \ +- .llseek = generic_file_llseek, \ ++ .write = nss_clear_stats_write, \ ++ .llseek = generic_file_llseek, \ + .release = nss_stats_release, \ + }; + +@@ -68,6 +72,7 @@ extern void nss_stats_register_sysctl(vo + void nss_stats_init(void); + extern int nss_stats_release(struct inode *inode, struct file *filp); + extern int nss_stats_open(struct inode *inode, struct file *filp); ++extern ssize_t nss_clear_stats_write(struct file *fp, const char __user *ubuf, size_t sz, loff_t *ppos); + void nss_stats_create_dentry(char *name, const struct file_operations *ops); + extern void nss_stats_reset_common_stats(uint32_t if_num); + extern size_t nss_stats_fill_common_stats(uint32_t if_num, int instance, char *lbuf, size_t size_wr, size_t size_al, char *node); +--- a/nss_vxlan.c ++++ b/nss_vxlan.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 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. +@@ -226,6 +226,7 @@ bool nss_vxlan_unregister_if(uint32_t if + } + + nss_core_unregister_handler(nss_ctx, if_num); ++ nss_core_unregister_msg_handler(nss_ctx, if_num); + nss_core_unregister_subsys_dp(nss_ctx, if_num); + return true; + } +--- a/nss_wifi_vdev.c ++++ b/nss_wifi_vdev.c +@@ -199,8 +199,16 @@ EXPORT_SYMBOL(nss_wifi_vdev_tx_msg_ext); + */ + nss_tx_status_t nss_wifi_vdev_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, uint32_t if_num) + { ++ enum nss_dynamic_interface_type if_type; ++ + BUG_ON(((if_num < NSS_DYNAMIC_IF_START) || (if_num >= (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES)))); + ++ if_type = nss_dynamic_interface_get_type(nss_ctx, if_num); ++ if (if_type != NSS_DYNAMIC_INTERFACE_TYPE_VAP) { ++ nss_warning("%px: non vap %d packet tx not allowed", nss_ctx, if_num); ++ return NSS_TX_FAILURE_NOT_SUPPORTED; ++ } ++ + return nss_core_send_packet(nss_ctx, os_buf, if_num, H2N_BIT_FLAG_BUFFER_REUSABLE); + } + EXPORT_SYMBOL(nss_wifi_vdev_tx_buf); +--- a/nss_data_plane/include/nss_data_plane.h ++++ b/nss_data_plane/include/nss_data_plane.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2017,2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2017,2020-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. +@@ -25,6 +25,8 @@ + #include + #include "nss_phys_if.h" + ++#define NSS_DATA_PLANE_MAX_PACKET_LEN 65535 ++ + /* + * nss_data_plane_schedule_registration() + * Called from nss_init to schedule a work to do data_plane register to data plane host driver +--- a/nss_data_plane/nss_data_plane.c ++++ b/nss_data_plane/nss_data_plane.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2016-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. +@@ -101,12 +101,6 @@ static int __nss_data_plane_mac_addr(str + static int __nss_data_plane_change_mtu(struct nss_dp_data_plane_ctx *dpc, uint32_t mtu) + { + struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; +- +- if (mtu > NSS_DP_MAX_MTU_SIZE) { +- nss_warning("%px: MTU exceeds MAX size %d\n", dp, mtu); +- return NSS_DP_FAILURE; +- } +- + return nss_phys_if_change_mtu(dp->nss_ctx, mtu, dp->if_num); + } + +@@ -166,8 +160,9 @@ static netdev_tx_t __nss_data_plane_buf( + goto drop; + } + +- if (skb->len > NSS_DP_MAX_PACKET_LEN) { +- nss_warning("skb->len ( %u ) > Maximum packet length ( %u ) \n", skb->len, NSS_DP_MAX_PACKET_LEN); ++ if (skb->len > NSS_DATA_PLANE_MAX_PACKET_LEN) { ++ nss_warning("skb->len ( %u ) > Maximum packet length ( %u ) \n", ++ skb->len, NSS_DATA_PLANE_MAX_PACKET_LEN); + goto drop; + } + +--- a/exports/nss_wifi_vdev.h ++++ b/exports/nss_wifi_vdev.h +@@ -166,6 +166,7 @@ enum nss_wifi_vdev_ext_data_pkt_type { + /**< Mesh link VAP special packet. */ + NSS_WIFI_VDEV_MESH_EXT_DATA_PKT_TYPE_RX_MCAST_EXC = 16, + /**< Mesh link VAP multicast packet. */ ++ NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_4ADDR, /**< 4 address exception to host. */ + NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_MAX + }; + +@@ -815,6 +816,16 @@ struct nss_wifi_vdev_ppdu_metadata { + }; + + /** ++ * nss_wifi_vdev_addr4_data_metadata ++ * Address four metadata ++ */ ++struct nss_wifi_vdev_addr4_data_metadata { ++ uint16_t peer_id; /**< Peer ID. */ ++ uint8_t sa_valid; /**< Source address is valid. */ ++ uint8_t addr4_valid; /**< Address four is valid. */ ++}; ++ ++/** + * nss_wifi_vdev_per_packet_metadata + * Wi-Fi per packet metadata content. + */ +@@ -843,6 +854,8 @@ struct nss_wifi_vdev_per_packet_metadata + /**< Per packet Tx metadata structure for wireless distribution system mode. */ + struct nss_wifi_vdev_ppdu_metadata ppdu_metadata; + /**< Per packet PPDU metadata needed for per PPDU copy mode. */ ++ struct nss_wifi_vdev_addr4_data_metadata addr4_metadata; ++ /**< Create metadata for the WDS extension interface. */ + } metadata; + /**< Metadata payload for special data receive message. */ + }; +@@ -1039,6 +1052,8 @@ struct nss_wifi_vdev_stats_sync_msg { + uint32_t rx_mic_err; /**< Receive MIC error */ + uint32_t mcbc_exc_host_fail_cnt; + /**< Number of multicast/broadcast packets failed to send to host through exception path. */ ++ uint32_t addr4_exc_fail; /**< Number of failed 4 address exceptions. */ ++ uint32_t addr4_exc_pass; /**< Number of successful 4 address exceptions. */ + }; + + /** +@@ -1071,13 +1086,13 @@ struct nss_wifi_vdev_msg { + struct nss_wifi_vdev_me_snptbl_deny_grp_add_msg vdev_deny_member_add; + /**< Add a snooplist member to the deny list. */ + struct nss_wifi_vdev_me_hmmc_add_msg vdev_hmmc_member_add; +- /**< Adds a new member into the HMMC list. */ ++ /**< Adds a member to the HMMC list. */ + struct nss_wifi_vdev_me_hmmc_del_msg vdev_hmmc_member_del; +- /**< Delete a member from the HMMC list. */ ++ /**< Deletes a member from the HMMC list. */ + struct nss_wifi_vdev_me_deny_ip_add_msg vdev_deny_list_member_add; +- /**< Adds a new member into the deny list. */ ++ /**< Adds a member to the denylist. */ + struct nss_wifi_vdev_me_deny_ip_del_msg vdev_deny_list_member_del; +- /**< Delete a member from the deny list. */ ++ /**< Deletes a member from the denylist. */ + struct nss_wifi_vdev_txmsg vdev_txmsgext; + /**< Transmits special data. */ + struct nss_wifi_vdev_vow_dbg_cfg_msg vdev_vow_dbg_cfg; +--- a/exports/nss_wifi_ext_vdev_if.h ++++ b/exports/nss_wifi_ext_vdev_if.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2020, 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 +@@ -26,6 +26,11 @@ + + #define NSS_WIFI_EXT_VDEV_MAX 16 + ++/** ++ * @addtogroup nss_wifi_ext_vdev_subsystem ++ * @{ ++ */ ++ + /* + * nss_wifi_ext_vdev_msg_types + * WiFi extension virtual device mesage types. +@@ -294,4 +299,8 @@ extern struct nss_ctx_instance *nss_wifi + nss_wifi_ext_vdev_data_callback_t cb_func_data, nss_wifi_ext_vdev_ext_data_callback_t cb_func_ext, + nss_wifi_ext_vdev_msg_callback_t cb_func_msg, struct net_device *netdev, uint32_t features, + void *app_ctx); ++/** ++ * @} ++ */ ++ + #endif +--- a/exports/nss_wifili_if.h ++++ b/exports/nss_wifili_if.h +@@ -1,16 +1,19 @@ + /* + ************************************************************************** + * Copyright (c) 2017-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. ++ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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. ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + ************************************************************************** + */ + +@@ -84,7 +87,7 @@ + /**< Maximum DMA error codes. */ + #define NSS_WIFILI_MAX_TID 8 + /**< Maximum TID values. */ +-#define NSS_WIFILI_DELAY_INDEX_MAX 10 ++#define NSS_WIFILI_DELAY_INDEX_MAX 13 + /**< Maximum software enqueue delay buckets. */ + #define NSS_WIFILI_MAX_NUMBER_OF_ADDTNL_SEG 64 + /**< Maximum number of additional pages allocated from host. */ +@@ -94,6 +97,8 @@ + /**< Maximum number of flow queues. */ + #define NSS_WIFILI_WBM_INTERNAL_ERR_MAX 5 + /**< WBM internal maximum errors. */ ++#define NSS_WIFILI_MAX_VOW_TID_NUM 4 ++ /**< Maximum version 3 TID values. */ + + /* + * Peer Size in Bytes +@@ -101,6 +106,11 @@ + #define NSS_WIFILI_PEER_SIZE 1600 + + /* ++ * Maximum size of target SoC type string ++ */ ++#define NSS_WIFILI_SOC_STRING_SIZE_MAX 24 ++ ++/* + * Radio specific flags + */ + #define NSS_WIFILI_PDEV_FLAG_V3_STATS_ENABLED 0x00000008 +@@ -657,9 +667,12 @@ struct nss_wifili_stats { + * NSS wifili soc stats + */ + struct nss_wifili_soc_stats { +- uint32_t soc_maxpdev; /**< Maximum number of radios per SoC. */ ++ uint32_t soc_maxpdev; ++ /**< Maximum number of radios per SoC. */ + struct nss_wifili_stats stats_wifili; +- /**< Per-SoC statistics. */ ++ /**< Per-SoC statistics. */ ++ char soc_type[NSS_WIFILI_SOC_STRING_SIZE_MAX]; ++ /**< Target SoC type string. */ + }; + + /** +@@ -711,7 +724,7 @@ struct nss_wifili_hal_srng_soc_msg { + uint32_t shadow_wrptr_mem_addr; + /**< Shadow write pointer address. */ + uint32_t lmac_rings_start_id; +- /**< start id of LMAC rings. */ ++ /**< Start ID of LMAC rings. */ + }; + + /** +@@ -1264,6 +1277,8 @@ struct nss_wifili_device_stats { + struct nss_wifili_stats_sync_msg { + struct nss_wifili_device_stats stats; + /**< Device statistics. */ ++ uint32_t target_type; ++ /**< Target SoC type. */ + }; + + /** +--- a/exports/nss_wifi_mac_db_if.h ++++ b/exports/nss_wifi_mac_db_if.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2020, 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 +@@ -25,6 +25,11 @@ + + #define NSS_WIFI_MAC_DB_ENTRY_IF_LOCAL 0x1 + ++ /** ++ * @addtogroup nss_wifi_mac_db_if_subsystem ++ * @{ ++ */ ++ + /* + * MAX Wi-Fi MAC database entries sent in group + * is chosen considering the entry size and +@@ -72,6 +77,7 @@ enum nss_wifi_mac_db_if_opmode { + }; + + /** ++ * nss_wifi_mac_db_err_types + * Wi-Fi MAC database errors. + */ + enum nss_wifi_mac_db_err_types { +@@ -274,4 +280,9 @@ struct nss_ctx_instance *nss_register_wi + */ + void nss_unregister_wifi_mac_db_if(uint32_t if_num); + struct nss_ctx_instance *nss_wifi_mac_db_get_context(void); ++ ++/** ++ * @} ++ */ ++ + #endif /* __NSS_WIFI_MAC_DB_H */ +--- a/exports/nss_wifi_mesh.h ++++ b/exports/nss_wifi_mesh.h +@@ -102,7 +102,7 @@ enum nss_wifi_mesh_pre_header_type { + + /* + * nss_wifi_mesh_extended_data_pkt_types +- * Wi-Fi mesh extended data pkt types. ++ * Wi-Fi mesh extended data packet types. + */ + enum nss_wifi_mesh_extended_data_pkt_types { + WIFI_MESH_EXT_DATA_PKT_TYPE_NONE, /**< No packet type. */ +@@ -114,13 +114,13 @@ enum nss_wifi_mesh_extended_data_pkt_typ + * Wi-Fi header + */ + struct nss_wifi_mesh_ieee80211_hdr { +- uint16_t frame_ctl; /* Frame control. */ +- uint16_t duration_id; /* Duration ID. */ +- uint8_t addr1[ETH_ALEN]; /* Address 1. */ +- uint8_t addr2[ETH_ALEN]; /* Address 2. */ +- uint8_t addr3[ETH_ALEN]; /* Address 3. */ +- uint16_t seq_ctrl; /* Sequence control. */ +- uint8_t addr4[ETH_ALEN]; /* Address 4. */ ++ uint16_t frame_ctl; /**< Frame control. */ ++ uint16_t duration_id; /**< Duration ID. */ ++ uint8_t addr1[ETH_ALEN]; /**< Address 1. */ ++ uint8_t addr2[ETH_ALEN]; /**< Address 2. */ ++ uint8_t addr3[ETH_ALEN]; /**< Address 3. */ ++ uint16_t seq_ctrl; /**< Sequence control. */ ++ uint8_t addr4[ETH_ALEN]; /**< Address 4. */ + }__packed; + + /* +@@ -128,16 +128,16 @@ struct nss_wifi_mesh_ieee80211_hdr { + * Wi-Fi mesh header + */ + struct nss_wifi_mesh_ieee80211s_hdr { +- uint8_t flags; /* Mesh flags. */ +- uint8_t ttl; /* TTL. */ +- uint32_t seq_num; /* Sequence number. */ +- uint8_t eaddr1[ETH_ALEN]; /* Mesh Address1. */ +- uint8_t eaddr2[ETH_ALEN]; /* Mesh Address2. */ ++ uint8_t flags; /**< Mesh flags. */ ++ uint8_t ttl; /**< TTL. */ ++ uint32_t seq_num; /**< Sequence number. */ ++ uint8_t eaddr1[ETH_ALEN]; /**< Mesh Address1. */ ++ uint8_t eaddr2[ETH_ALEN]; /**< Mesh Address2. */ + }__packed; + + /* + * nss_wifi_mesh_per_packet_metadata +- * Wi-Fi mesh per packet metadata structure. ++ * Wi-Fi mesh per packet metadata structure. + */ + struct nss_wifi_mesh_per_packet_metadata { + uint16_t pkt_type; /* Packet type of the metadata. */ +@@ -150,8 +150,8 @@ struct nss_wifi_mesh_per_packet_metadata + * NSS-to-host path will be seen by ECM for rules. + */ + enum nss_wifi_mesh_dp_type { +- NSS_WIFI_MESH_DP_INNER, /**< Inner/Encapsulation Interface. */ +- NSS_WIFI_MESH_DP_OUTER, /**< Outer/Decapsulation Interface. */ ++ NSS_WIFI_MESH_DP_INNER, /**< Inner/encapsulation interface. */ ++ NSS_WIFI_MESH_DP_OUTER, /**< Outer/decapsulation interface. */ + }; + + /** +@@ -350,7 +350,7 @@ struct nss_wifi_mesh_proxy_path_del_msg + + /** + * nss_wifi_mesh_mpath_not_found_msg +- * Wi-Fi mesh path not found meesage. ++ * Wi-Fi mesh path not found message. + */ + struct nss_wifi_mesh_mpath_not_found_msg { + uint8_t dest_mac_addr[ETH_ALEN]; /**< Destination MAC address. */ +--- a/nss_wifili_stats.c ++++ b/nss_wifili_stats.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2017-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. +@@ -37,6 +37,38 @@ ATOMIC_NOTIFIER_HEAD(nss_wifili_stats_no + struct nss_wifili_soc_stats soc_stats[NSS_WIFILI_MAX_SOC_NUM]; + + /* ++ * nss_wifili_target_type_string() ++ * Convert Target Type Integer to String ++ */ ++void nss_wifili_target_type_to_string(uint32_t target_type, char *target_type_str) ++{ ++ switch (target_type) { ++ ++ case NSS_WIFILI_TARGET_TYPE_QCA8074: ++ snprintf(target_type_str, NSS_WIFILI_SOC_STRING_SIZE_MAX, "IPQ8074 V1"); ++ break; ++ case NSS_WIFILI_TARGET_TYPE_QCA8074V2: ++ case 0: ++ snprintf(target_type_str, NSS_WIFILI_SOC_STRING_SIZE_MAX, "IPQ8074 V2"); ++ break; ++ case NSS_WIFILI_TARGET_TYPE_QCA6018: ++ snprintf(target_type_str, NSS_WIFILI_SOC_STRING_SIZE_MAX, "IPQ6018"); ++ break; ++ case NSS_WIFILI_TARGET_TYPE_QCN9000: ++ snprintf(target_type_str, NSS_WIFILI_SOC_STRING_SIZE_MAX, "QCN9000"); ++ break; ++ case NSS_WIFILI_TARGET_TYPE_QCA5018: ++ snprintf(target_type_str, NSS_WIFILI_SOC_STRING_SIZE_MAX, "IPQ5018"); ++ break; ++ case NSS_WIFILI_TARGET_TYPE_QCN6122: ++ snprintf(target_type_str, NSS_WIFILI_SOC_STRING_SIZE_MAX, "QCN6122"); ++ break; ++ default : ++ snprintf(target_type_str, NSS_WIFILI_SOC_STRING_SIZE_MAX, "Unknown"); ++ } ++} ++ ++/* + * nss_wifili_stats_read() + * Read wifili statistics + */ +@@ -56,6 +88,7 @@ static ssize_t nss_wifili_stats_read(str + char *lbuf = NULL; + uint32_t soc_idx; + struct nss_wifili_stats *stats_wifili = NULL; ++ char pdev_tag[NSS_WIFILI_SOC_STRING_SIZE_MAX]; + + /* + * Max number of pdev depends on type of soc (Internal/Attached). +@@ -83,12 +116,17 @@ static ssize_t nss_wifili_stats_read(str + return 0; + } + +- size_wr += nss_stats_banner(lbuf, size_wr, size_al, "wifili", NSS_STATS_SINGLE_CORE); + + for (soc_idx = 0; soc_idx < NSS_WIFILI_MAX_SOC_NUM; soc_idx++) { ++ if (soc_stats[soc_idx].soc_maxpdev == 0) { ++ continue; ++ } ++ ++ size_wr += nss_stats_banner(lbuf, size_wr, size_al, soc_stats[soc_idx].soc_type, NSS_STATS_SINGLE_CORE); + stats_wifili = &(soc_stats[soc_idx].stats_wifili); + for (i = 0; i < soc_stats[soc_idx].soc_maxpdev; i++) { +- ++ snprintf(pdev_tag, NSS_WIFILI_SOC_STRING_SIZE_MAX, "PDEV %d", i); ++ size_wr += nss_stats_banner(lbuf, size_wr, size_al, pdev_tag, NSS_STATS_SINGLE_CORE); + spin_lock_bh(&nss_top_main.stats_lock); + size_wr += nss_stats_print("wifili", "txrx", i + , nss_wifili_strings_stats_txrx +@@ -238,6 +276,9 @@ void nss_wifili_stats_sync(struct nss_ct + struct nss_wifili_stats *stats = NULL; + struct nss_wifili_device_stats *devstats = &wlsoc_stats->stats; + uint32_t index; ++ char target_type_str[NSS_WIFILI_SOC_STRING_SIZE_MAX]; ++ ++ nss_wifili_target_type_to_string(wlsoc_stats->target_type, target_type_str); + + /* + * Max number of pdev depends on type of soc (Internal/Attached). +@@ -246,16 +287,19 @@ void nss_wifili_stats_sync(struct nss_ct + case NSS_WIFILI_INTERNAL_INTERFACE: + nwss = &soc_stats[0]; + nwss->soc_maxpdev = NSS_WIFILI_MAX_PDEV_NUM_MSG; ++ snprintf(nwss->soc_type, NSS_WIFILI_SOC_STRING_SIZE_MAX, "INTERNAL: %s", target_type_str); + break; + + case NSS_WIFILI_EXTERNAL_INTERFACE0: + nwss = &soc_stats[1]; + nwss->soc_maxpdev = NSS_WIFILI_SOC_ATTACHED_MAX_PDEV_NUM; ++ snprintf(nwss->soc_type, NSS_WIFILI_SOC_STRING_SIZE_MAX, "ATTACH 0: %s", target_type_str); + break; + + case NSS_WIFILI_EXTERNAL_INTERFACE1: + nwss = &soc_stats[2]; + nwss->soc_maxpdev = NSS_WIFILI_SOC_ATTACHED_MAX_PDEV_NUM; ++ snprintf(nwss->soc_type, NSS_WIFILI_SOC_STRING_SIZE_MAX, "ATTACH 1: %s", target_type_str); + break; + + default: +@@ -458,7 +502,7 @@ void nss_wifili_stats_notify(struct nss_ + struct nss_wifili_stats_notification *wifili_stats; + uint32_t index = 0; + +- wifili_stats = kzalloc(sizeof(struct nss_wifili_stats_notification), GFP_ATOMIC); ++ wifili_stats = kzalloc(sizeof(struct nss_wifili_stats_notification), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); + if (!wifili_stats) { + nss_warning("%px: Failed to allocate memory for wifili stats\n", nss_ctx); + return; +--- a/nss_wifili_stats.h ++++ b/nss_wifili_stats.h +@@ -22,6 +22,13 @@ + #ifndef __NSS_WIFILI_STATS_H + #define __NSS_WIFILI_STATS_H + ++#define NSS_WIFILI_TARGET_TYPE_QCA8074 20 ++#define NSS_WIFILI_TARGET_TYPE_QCA8074V2 24 ++#define NSS_WIFILI_TARGET_TYPE_QCA6018 25 ++#define NSS_WIFILI_TARGET_TYPE_QCN9000 26 ++#define NSS_WIFILI_TARGET_TYPE_QCA5018 29 ++#define NSS_WIFILI_TARGET_TYPE_QCN6122 30 ++ + #include "nss_core.h" + #include "nss_wifili_if.h" + +--- a/nss_wifili_strings.c ++++ b/nss_wifili_strings.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 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 +@@ -71,10 +71,10 @@ struct nss_stats_info nss_wifili_strings + * wifili tx comp stats + */ + struct nss_stats_info nss_wifili_strings_stats_tx_comp[NSS_WIFILI_STATS_TX_DESC_FREE_MAX] = { +- {"tx_desc_free_inv_bufsrc" , NSS_STATS_TYPE_ERROR}, +- {"tx_desc_free_inv_cookie" , NSS_STATS_TYPE_SPECIAL}, +- {"tx_desc_free_hw_ring_empty" , NSS_STATS_TYPE_SPECIAL}, +- {"tx_desc_free_reaped" , NSS_STATS_TYPE_SPECIAL} ++ {"tx_desc_free_inv_bufsrc" , NSS_STATS_TYPE_ERROR}, ++ {"tx_desc_free_inv_cookie" , NSS_STATS_TYPE_SPECIAL}, ++ {"tx_desc_free_hw_ring_empty" , NSS_STATS_TYPE_SPECIAL}, ++ {"tx_desc_free_reaped" , NSS_STATS_TYPE_SPECIAL} + }; + + /* +--- a/nss_wifi_mesh_stats.c ++++ b/nss_wifi_mesh_stats.c +@@ -223,7 +223,7 @@ static uint32_t nss_wifi_mesh_get_valid_ + static ssize_t nss_wifi_mesh_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos, uint16_t type) + { + uint32_t max_output_lines, max_stats; +- size_t size_al, size_wr; ++ size_t size_al, size_wr = 0; + ssize_t bytes_read = 0; + struct nss_stats_data *data = fp->private_data; + int ifindex; +--- a/nss_wifi_mesh_strings.c ++++ b/nss_wifi_mesh_strings.c +@@ -53,7 +53,7 @@ struct nss_stats_info nss_wifi_mesh_stri + {"expiry_notify_fail", NSS_STATS_TYPE_SPECIAL}, + {"no_headroom", NSS_STATS_TYPE_SPECIAL}, + {"path_refresh_sent", NSS_STATS_TYPE_SPECIAL}, +- {"linearise_failed", NSS_STATS_TYPE_SPECIAL} ++ {"linearise_failed", NSS_STATS_TYPE_SPECIAL}, + }; + + /* +@@ -89,7 +89,8 @@ struct nss_stats_info nss_wifi_mesh_stri + {"flag_updations", NSS_STATS_TYPE_SPECIAL}, + {"metric_updations", NSS_STATS_TYPE_SPECIAL}, + {"block_mesh_fwd_updations", NSS_STATS_TYPE_SPECIAL}, +- {"delete_failures", NSS_STATS_TYPE_SPECIAL} ++ {"delete_failures", NSS_STATS_TYPE_SPECIAL}, ++ + }; + + /* +@@ -106,22 +107,22 @@ static ssize_t nss_wifi_mesh_path_stats_ + * Wi-Fi mesh proxy path statistics string. + */ + struct nss_stats_info nss_wifi_mesh_strings_proxy_path_stats[NSS_WIFI_MESH_PROXY_PATH_STATS_TYPE_MAX] = { +- {"alloc_failures", NSS_STATS_TYPE_SPECIAL}, +- {"entry_exist_failures", NSS_STATS_TYPE_SPECIAL}, +- {"add_success", NSS_STATS_TYPE_SPECIAL}, +- {"table_full_errors", NSS_STATS_TYPE_SPECIAL}, +- {"insert_failures", NSS_STATS_TYPE_SPECIAL}, +- {"not_found", NSS_STATS_TYPE_SPECIAL}, +- {"unhashed_errors", NSS_STATS_TYPE_SPECIAL}, +- {"delete_failures", NSS_STATS_TYPE_SPECIAL}, +- {"delete_success", NSS_STATS_TYPE_SPECIAL}, +- {"update_success", NSS_STATS_TYPE_SPECIAL}, +- {"lookup_success", NSS_STATS_TYPE_SPECIAL}, +- {"add_requests", NSS_STATS_TYPE_SPECIAL}, +- {"del_requests", NSS_STATS_TYPE_SPECIAL}, +- {"update_requests", NSS_STATS_TYPE_SPECIAL}, +- {"mda_updations", NSS_STATS_TYPE_SPECIAL}, +- {"flag_updations", NSS_STATS_TYPE_SPECIAL} ++ {"alloc_failures", NSS_STATS_TYPE_SPECIAL}, ++ {"entry_exist_failures", NSS_STATS_TYPE_SPECIAL}, ++ {"add_success", NSS_STATS_TYPE_SPECIAL}, ++ {"table_full_errors", NSS_STATS_TYPE_SPECIAL}, ++ {"insert_failures", NSS_STATS_TYPE_SPECIAL}, ++ {"not_found", NSS_STATS_TYPE_SPECIAL}, ++ {"unhashed_errors", NSS_STATS_TYPE_SPECIAL}, ++ {"delete_failures", NSS_STATS_TYPE_SPECIAL}, ++ {"delete_success", NSS_STATS_TYPE_SPECIAL}, ++ {"update_success", NSS_STATS_TYPE_SPECIAL}, ++ {"lookup_success", NSS_STATS_TYPE_SPECIAL}, ++ {"add_requests", NSS_STATS_TYPE_SPECIAL}, ++ {"del_requests", NSS_STATS_TYPE_SPECIAL}, ++ {"update_requests", NSS_STATS_TYPE_SPECIAL}, ++ {"mda_updations", NSS_STATS_TYPE_SPECIAL}, ++ {"flag_updations", NSS_STATS_TYPE_SPECIAL}, + }; + + /* +--- a/nss_wifi_stats.c ++++ b/nss_wifi_stats.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2016-2017, 2019-2020 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2016-2017, 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. +@@ -86,7 +86,7 @@ struct nss_stats_info nss_wifi_stats_str + {"rx_htt_fetch_cnt" , NSS_STATS_TYPE_SPECIAL}, + {"total_tidq_bypass_cnt" , NSS_STATS_TYPE_SPECIAL}, + {"global_q_full_cnt" , NSS_STATS_TYPE_SPECIAL}, +- {"tidq_full_cnt" , NSS_STATS_TYPE_SPECIAL} ++ {"tidq_full_cnt" , NSS_STATS_TYPE_SPECIAL}, + }; + + uint64_t nss_wifi_stats[NSS_MAX_WIFI_RADIO_INTERFACES][NSS_WIFI_STATS_MAX]; /* WIFI statistics */ diff --git a/qca-nss-drv/patches-11.4/0013-nss-drv-remove-legacy-wifi.patch b/qca-nss-drv/patches-11.4/0013-nss-drv-remove-legacy-wifi.patch new file mode 100644 index 0000000..c159e98 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0013-nss-drv-remove-legacy-wifi.patch @@ -0,0 +1,12 @@ +--- a/nss_hal/nss_hal.c ++++ b/nss_hal/nss_hal.c +@@ -572,7 +572,9 @@ int nss_hal_probe(struct platform_device + if (npd->wifioffload_enabled == NSS_FEATURE_ENABLED) { + nss_top->wifi_handler_id = nss_dev->id; + nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_VAP] = nss_dev->id; ++#if defined(NSS_HAL_IPQ806x_SUPPORT) + nss_wifi_register_handler(); ++#endif + nss_wifili_register_handler(); + #ifdef NSS_DRV_WIFI_EXT_VDEV_ENABLE + nss_wifi_ext_vdev_register_handler(); diff --git a/qca-nss-drv/patches-11.4/0014-Add-kernel-6.1-support.patch b/qca-nss-drv/patches-11.4/0014-Add-kernel-6.1-support.patch new file mode 100644 index 0000000..1d405e4 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0014-Add-kernel-6.1-support.patch @@ -0,0 +1,183 @@ +--- a/nss_hal/fsm9010/nss_hal_pvt.c ++++ b/nss_hal/fsm9010/nss_hal_pvt.c +@@ -291,7 +291,7 @@ static int __nss_hal_request_irq(struct + } + + int_ctx->irq = npd->irq[irq_num]; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64); + return 0; + } + +--- a/nss_hal/ipq50xx/nss_hal_pvt.c ++++ b/nss_hal/ipq50xx/nss_hal_pvt.c +@@ -598,7 +598,7 @@ static int __nss_hal_request_irq(struct + return err; + } + +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt); + int_ctx->cause = cause; + err = request_irq(irq, nss_hal_handle_irq, 0, irq_name, int_ctx); + if (err) { +--- a/nss_hal/ipq60xx/nss_hal_pvt.c ++++ b/nss_hal/ipq60xx/nss_hal_pvt.c +@@ -614,62 +614,62 @@ static int __nss_hal_request_irq(struct + irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY); + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_SOS) { +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT); + int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFERS_SOS; + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_sos", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_QUEUE) { +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT); + int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFER_QUEUE; + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_queue", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_TX_UNBLOCKED) { +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT); + int_ctx->cause = NSS_N2H_INTR_TX_UNBLOCKED; + err = request_irq(irq, nss_hal_handle_irq, 0, "nss-tx-unblock", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_0) { +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_0; + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue0", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_1) { + int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_1; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue1", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_2) { + int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_2; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue2", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_3) { + int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_3; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue3", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_COREDUMP_COMPLETE) { + int_ctx->cause = NSS_N2H_INTR_COREDUMP_COMPLETE; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_coredump_complete", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PAGED_EMPTY_BUFFER_SOS) { +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT); + int_ctx->cause = NSS_N2H_INTR_PAGED_EMPTY_BUFFERS_SOS; + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_paged_empty_buf_sos", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PROFILE_DMA) { + int_ctx->cause = NSS_N2H_INTR_PROFILE_DMA; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_profile_dma", int_ctx); + } + +--- a/nss_hal/ipq806x/nss_hal_pvt.c ++++ b/nss_hal/ipq806x/nss_hal_pvt.c +@@ -1186,7 +1186,7 @@ static int __nss_hal_request_irq(struct + } + + int_ctx->irq = npd->irq[irq_num]; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64); + + return 0; + } +--- a/nss_hal/ipq807x/nss_hal_pvt.c ++++ b/nss_hal/ipq807x/nss_hal_pvt.c +@@ -657,62 +657,62 @@ static int __nss_hal_request_irq(struct + irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY); + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_SOS) { +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT); + int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFERS_SOS; + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_sos", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_QUEUE) { +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT); + int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFER_QUEUE; + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_queue", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_TX_UNBLOCKED) { +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT); + int_ctx->cause = NSS_N2H_INTR_TX_UNBLOCKED; + err = request_irq(irq, nss_hal_handle_irq, 0, "nss-tx-unblock", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_0) { +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_0; + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue0", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_1) { + int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_1; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue1", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_2) { + int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_2; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue2", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_3) { + int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_3; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue3", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_COREDUMP_COMPLETE) { + int_ctx->cause = NSS_N2H_INTR_COREDUMP_COMPLETE; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_coredump_complete", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PAGED_EMPTY_BUFFER_SOS) { +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT); + int_ctx->cause = NSS_N2H_INTR_PAGED_EMPTY_BUFFERS_SOS; + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_paged_empty_buf_sos", int_ctx); + } + + if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PROFILE_DMA) { + int_ctx->cause = NSS_N2H_INTR_PROFILE_DMA; +- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); ++ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT); + err = request_irq(irq, nss_hal_handle_irq, 0, "nss_profile_dma", int_ctx); + } + diff --git a/qca-nss-drv/patches-11.4/0014-nss-drv-avoid-recreating-virt_if.patch b/qca-nss-drv/patches-11.4/0014-nss-drv-avoid-recreating-virt_if.patch new file mode 100644 index 0000000..3de48d4 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0014-nss-drv-avoid-recreating-virt_if.patch @@ -0,0 +1,14 @@ +--- a/nss_stats.c ++++ b/nss_stats.c +@@ -388,8 +388,9 @@ size_t nss_stats_print(char *node, char + */ + void nss_stats_create_dentry(char *name, const struct file_operations *ops) + { +- if (!debugfs_create_file(name, 0400, nss_top_main.stats_dentry, &nss_top_main, ops)) { +- nss_warning("Failed to create debug entry for subsystem %s\n", name); ++ if (!debugfs_lookup(name, nss_top_main.stats_dentry)) ++ if (!debugfs_create_file(name, 0400, nss_top_main.stats_dentry, &nss_top_main, ops)) { ++ nss_warning("Failed to create debug entry for subsystem %s\n", name); + } + } + diff --git a/qca-nss-drv/patches-11.4/0015-nss-drv-fix-igs.patch b/qca-nss-drv/patches-11.4/0015-nss-drv-fix-igs.patch new file mode 100644 index 0000000..e027d8b --- /dev/null +++ b/qca-nss-drv/patches-11.4/0015-nss-drv-fix-igs.patch @@ -0,0 +1,40 @@ +--- a/nss_igs.c ++++ b/nss_igs.c +@@ -163,7 +163,7 @@ EXPORT_SYMBOL(nss_igs_register_if); + * nss_igs_get_context() + * Get the IGS context. + */ +-struct nss_ctx_instance *nss_igs_get_context() ++struct nss_ctx_instance *nss_igs_get_context(void) + { + return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.igs_handler_id]; + } +@@ -177,8 +177,9 @@ EXPORT_SYMBOL(nss_igs_get_context); + void nss_igs_module_save(struct tc_action_ops *act, struct module *module) + { + nss_assert(act); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)) + nss_assert(act->type == TCA_ACT_MIRRED_NSS); +- ++#endif + nss_igs_module = module; + } + EXPORT_SYMBOL(nss_igs_module_save); +@@ -188,7 +189,7 @@ EXPORT_SYMBOL(nss_igs_module_save); + * nss_igs_module_get() + * Get the ingress shaping module reference. + */ +-bool nss_igs_module_get() ++bool nss_igs_module_get(void) + { + nss_assert(nss_igs_module); + return try_module_get(nss_igs_module); +@@ -199,7 +200,7 @@ EXPORT_SYMBOL(nss_igs_module_get); + * nss_igs_module_put() + * Release the ingress shaping module reference. + */ +-void nss_igs_module_put() ++void nss_igs_module_put(void) + { + nss_assert(nss_igs_module); + module_put(nss_igs_module); diff --git a/qca-nss-drv/patches-11.4/0016-rework-NSS_CORE_DMA_CACHE_MAINT-ops.patch b/qca-nss-drv/patches-11.4/0016-rework-NSS_CORE_DMA_CACHE_MAINT-ops.patch new file mode 100644 index 0000000..8878150 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0016-rework-NSS_CORE_DMA_CACHE_MAINT-ops.patch @@ -0,0 +1,558 @@ +From e6814c47d22ee5133a71016375239f87ea265794 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Tue, 5 Apr 2022 15:38:18 +0200 +Subject: [PATCH 4/4] nss-drv: rework NSS_CORE_DMA_CACHE_MAINT ops + +Rework NSS_CORE_DMA_CACHE_MAINT ops to use standard dma sync ops instead +of using the direct arch function. This permit to skip any hack/patch +needed for nss-drv to correctly compile on upstream kernel. + +We drop any NSS_CORE_DMA_CACHE_MAINT use in nss_core and we correctly +use the dma_sync_single_for_device we correctly dma addr using the new +DMA helper. +We drop sync for IOREMAP addr and we just leave a memory block. +We hope the nss_profiler is correctly ported. +We finally drop the NSS_CORE_DMA_CACHE_MAINT jus in case someone wants +to use it. + +Signed-off-by: Christian Marangi +--- + nss_core.c | 136 +++++++++++++++++++++++++--------- + nss_core.h | 41 +++++----- + nss_hal/ipq806x/nss_hal_pvt.c | 5 +- + nss_hal/ipq807x/nss_hal_pvt.c | 5 +- + nss_meminfo.c | 5 +- + nss_profiler.c | 3 +- + 6 files changed, 127 insertions(+), 68 deletions(-) + +--- a/nss_core.c ++++ b/nss_core.c +@@ -1421,6 +1421,8 @@ static inline void nss_core_handle_empty + uint32_t count, uint32_t hlos_index, + uint16_t mask) + { ++ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; ++ + while (count) { + /* + * Since we only return the primary skb, we have no way to unmap +@@ -1474,7 +1476,9 @@ next: + n2h_desc_ring->hlos_index = hlos_index; + if_map->n2h_hlos_index[NSS_IF_N2H_EMPTY_BUFFER_RETURN_QUEUE] = hlos_index; + +- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->n2h_hlos_index[NSS_IF_N2H_EMPTY_BUFFER_RETURN_QUEUE], sizeof(uint32_t), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, ++ n2h_hlos_index_to_dma(mem_ctx->if_map_dma, NSS_IF_N2H_EMPTY_BUFFER_RETURN_QUEUE), ++ sizeof(uint32_t), DMA_TO_DEVICE); + NSS_CORE_DSB(); + } + +@@ -1496,6 +1500,7 @@ static int32_t nss_core_handle_cause_que + struct nss_ctx_instance *nss_ctx = int_ctx->nss_ctx; + struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; + struct nss_if_mem_map *if_map = mem_ctx->if_map; ++ int dma_size; + + qid = nss_core_cause_to_queue(cause); + +@@ -1507,7 +1512,8 @@ static int32_t nss_core_handle_cause_que + n2h_desc_ring = &nss_ctx->n2h_desc_ring[qid]; + desc_if = &n2h_desc_ring->desc_ring; + desc_ring = desc_if->desc; +- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->n2h_nss_index[qid], sizeof(uint32_t), DMA_FROM_DEVICE); ++ dma_sync_single_for_cpu(nss_ctx->dev, n2h_nss_index_to_dma(mem_ctx->if_map_dma, qid), ++ sizeof(uint32_t), DMA_FROM_DEVICE); + NSS_CORE_DSB(); + nss_index = if_map->n2h_nss_index[qid]; + +@@ -1536,13 +1542,23 @@ static int32_t nss_core_handle_cause_que + start = hlos_index; + end = (hlos_index + count) & mask; + if (end > start) { +- dmac_inv_range((void *)&desc_ring[start], (void *)&desc_ring[end] + sizeof(struct n2h_descriptor)); ++ dma_size = sizeof(struct n2h_descriptor) * (end - start + 1); ++ ++ dma_sync_single_for_cpu(nss_ctx->dev, n2h_desc_index_to_dma(if_map, qid, start), ++ dma_size, DMA_FROM_DEVICE); + } else { + /* + * We have wrapped around + */ +- dmac_inv_range((void *)&desc_ring[start], (void *)&desc_ring[mask] + sizeof(struct n2h_descriptor)); +- dmac_inv_range((void *)&desc_ring[0], (void *)&desc_ring[end] + sizeof(struct n2h_descriptor)); ++ dma_size = sizeof(struct n2h_descriptor) * (mask - start + 1); ++ ++ dma_sync_single_for_cpu(nss_ctx->dev, n2h_desc_index_to_dma(if_map, qid, start), ++ dma_size, DMA_FROM_DEVICE); ++ ++ dma_size = sizeof(struct n2h_descriptor) * (end + 1); ++ ++ dma_sync_single_for_cpu(nss_ctx->dev, n2h_desc_index_to_dma(if_map, qid, 0), dma_size, ++ DMA_FROM_DEVICE); + } + + /* +@@ -1671,7 +1687,8 @@ next: + n2h_desc_ring->hlos_index = hlos_index; + if_map->n2h_hlos_index[qid] = hlos_index; + +- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->n2h_hlos_index[qid], sizeof(uint32_t), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, n2h_hlos_index_to_dma(mem_ctx->if_map_dma, qid), ++ sizeof(uint32_t), DMA_TO_DEVICE); + NSS_CORE_DSB(); + + return count; +@@ -1683,11 +1700,12 @@ next: + */ + static void nss_core_init_nss(struct nss_ctx_instance *nss_ctx, struct nss_if_mem_map *if_map) + { ++ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; + struct nss_top_instance *nss_top; + int ret; + int i; + +- NSS_CORE_DMA_CACHE_MAINT((void *)if_map, sizeof(*if_map), DMA_FROM_DEVICE); ++ dma_sync_single_for_cpu(nss_ctx->dev, mem_ctx->if_map_dma, sizeof(*if_map), DMA_FROM_DEVICE); + NSS_CORE_DSB(); + + /* +@@ -1763,6 +1781,7 @@ static void nss_core_alloc_paged_buffers + uint16_t count, int16_t mask, int32_t hlos_index, uint32_t alloc_fail_count, + uint32_t buffer_type, uint32_t buffer_queue, uint32_t stats_index) + { ++ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; + struct sk_buff *nbuf; + struct page *npage; + struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[buffer_queue]; +@@ -1832,7 +1851,9 @@ static void nss_core_alloc_paged_buffers + /* + * Flush the descriptor + */ +- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, ++ h2n_desc_index_to_dma(if_map, buffer_queue, hlos_index), ++ sizeof(*desc), DMA_TO_DEVICE); + + hlos_index = (hlos_index + 1) & (mask); + count--; +@@ -1846,7 +1867,8 @@ static void nss_core_alloc_paged_buffers + h2n_desc_ring->hlos_index = hlos_index; + if_map->h2n_hlos_index[buffer_queue] = hlos_index; + +- NSS_CORE_DMA_CACHE_MAINT(&if_map->h2n_hlos_index[buffer_queue], sizeof(uint32_t), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_hlos_index_to_dma(mem_ctx->if_map_dma, buffer_queue), ++ sizeof(uint32_t), DMA_TO_DEVICE); + NSS_CORE_DSB(); + + NSS_PKT_STATS_INC(&nss_top->stats_drv[stats_index]); +@@ -1859,7 +1881,7 @@ static void nss_core_alloc_paged_buffers + static void nss_core_alloc_jumbo_mru_buffers(struct nss_ctx_instance *nss_ctx, struct nss_if_mem_map *if_map, + int jumbo_mru, uint16_t count, int16_t mask, int32_t hlos_index) + { +- ++ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; + struct sk_buff *nbuf; + struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_BUFFER_QUEUE]; + struct h2n_desc_if_instance *desc_if = &h2n_desc_ring->desc_ring; +@@ -1906,7 +1928,9 @@ static void nss_core_alloc_jumbo_mru_buf + /* + * Flush the descriptor + */ +- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, ++ h2n_desc_index_to_dma(if_map, NSS_IF_H2N_EMPTY_BUFFER_QUEUE, hlos_index), ++ sizeof(*desc), DMA_TO_DEVICE); + + hlos_index = (hlos_index + 1) & (mask); + count--; +@@ -1920,7 +1944,8 @@ static void nss_core_alloc_jumbo_mru_buf + h2n_desc_ring->hlos_index = hlos_index; + if_map->h2n_hlos_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE] = hlos_index; + +- NSS_CORE_DMA_CACHE_MAINT(&if_map->h2n_hlos_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE], sizeof(uint32_t), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_hlos_index_to_dma(mem_ctx->if_map_dma, NSS_IF_H2N_EMPTY_BUFFER_QUEUE), ++ sizeof(uint32_t), DMA_TO_DEVICE); + NSS_CORE_DSB(); + + NSS_PKT_STATS_INC(&nss_top->stats_drv[NSS_DRV_STATS_TX_EMPTY]); +@@ -1933,6 +1958,7 @@ static void nss_core_alloc_jumbo_mru_buf + static void nss_core_alloc_max_avail_size_buffers(struct nss_ctx_instance *nss_ctx, struct nss_if_mem_map *if_map, + uint16_t max_buf_size, uint16_t count, int16_t mask, int32_t hlos_index) + { ++ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; + struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_BUFFER_QUEUE]; + struct h2n_desc_if_instance *desc_if = &h2n_desc_ring->desc_ring; + struct h2n_descriptor *desc_ring = desc_if->desc; +@@ -1940,6 +1966,7 @@ static void nss_core_alloc_max_avail_siz + uint16_t payload_len = max_buf_size + NET_SKB_PAD; + uint16_t start = hlos_index; + uint16_t prev_hlos_index; ++ int dma_size; + + while (count) { + dma_addr_t buffer; +@@ -1992,13 +2019,26 @@ static void nss_core_alloc_max_avail_siz + * Flush the descriptors, including the descriptor at prev_hlos_index. + */ + if (prev_hlos_index > start) { +- dmac_clean_range((void *)&desc_ring[start], (void *)&desc_ring[prev_hlos_index] + sizeof(struct h2n_descriptor)); ++ dma_size = sizeof(struct h2n_descriptor) * (prev_hlos_index - start + 1); ++ ++ dma_sync_single_for_device(nss_ctx->dev, ++ h2n_desc_index_to_dma(if_map, NSS_IF_H2N_EMPTY_BUFFER_QUEUE, start), ++ dma_size, DMA_TO_DEVICE); + } else { + /* + * We have wrapped around + */ +- dmac_clean_range((void *)&desc_ring[start], (void *)&desc_ring[mask] + sizeof(struct h2n_descriptor)); +- dmac_clean_range((void *)&desc_ring[0], (void *)&desc_ring[prev_hlos_index] + sizeof(struct h2n_descriptor)); ++ dma_size = sizeof(struct h2n_descriptor) * (mask - start + 1); ++ ++ dma_sync_single_for_device(nss_ctx->dev, ++ h2n_desc_index_to_dma(if_map, NSS_IF_H2N_EMPTY_BUFFER_QUEUE, start), ++ dma_size, DMA_TO_DEVICE); ++ ++ dma_size = sizeof(struct h2n_descriptor) * (prev_hlos_index + 1); ++ ++ dma_sync_single_for_device(nss_ctx->dev, ++ h2n_desc_index_to_dma(if_map, NSS_IF_H2N_EMPTY_BUFFER_QUEUE, 0), ++ dma_size, DMA_TO_DEVICE); + } + + /* +@@ -2009,7 +2049,8 @@ static void nss_core_alloc_max_avail_siz + h2n_desc_ring->hlos_index = hlos_index; + if_map->h2n_hlos_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE] = hlos_index; + +- NSS_CORE_DMA_CACHE_MAINT(&if_map->h2n_hlos_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE], sizeof(uint32_t), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_hlos_index_to_dma(mem_ctx->if_map_dma, NSS_IF_H2N_EMPTY_BUFFER_QUEUE), ++ sizeof(uint32_t), DMA_TO_DEVICE); + NSS_CORE_DSB(); + + NSS_PKT_STATS_INC(&nss_top->stats_drv[NSS_DRV_STATS_TX_EMPTY]); +@@ -2022,6 +2063,7 @@ static void nss_core_alloc_max_avail_siz + static inline void nss_core_handle_empty_buffer_sos(struct nss_ctx_instance *nss_ctx, + struct nss_if_mem_map *if_map, uint16_t max_buf_size) + { ++ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; + uint16_t count, size, mask; + int32_t nss_index, hlos_index; + struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_BUFFER_QUEUE]; +@@ -2032,7 +2074,8 @@ static inline void nss_core_handle_empty + /* + * Check how many empty buffers could be filled in queue + */ +- NSS_CORE_DMA_CACHE_MAINT(&if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE], sizeof(uint32_t), DMA_FROM_DEVICE); ++ dma_sync_single_for_cpu(nss_ctx->dev, h2n_nss_index_to_dma(mem_ctx->if_map_dma, NSS_IF_H2N_EMPTY_BUFFER_QUEUE), ++ sizeof(uint32_t), DMA_FROM_DEVICE); + NSS_CORE_DSB(); + nss_index = if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE]; + +@@ -2077,6 +2120,7 @@ static inline void nss_core_handle_empty + static inline void nss_core_handle_paged_empty_buffer_sos(struct nss_ctx_instance *nss_ctx, + struct nss_if_mem_map *if_map, uint16_t max_buf_size) + { ++ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; + uint16_t count, size, mask; + int32_t nss_index, hlos_index; + struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE]; +@@ -2084,7 +2128,8 @@ static inline void nss_core_handle_paged + /* + * Check how many empty buffers could be filled in queue + */ +- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE], sizeof(uint32_t), DMA_FROM_DEVICE); ++ dma_sync_single_for_cpu(nss_ctx->dev, h2n_nss_index_to_dma(mem_ctx->if_map_dma, NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE), ++ sizeof(uint32_t), DMA_FROM_DEVICE); + NSS_CORE_DSB(); + nss_index = if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE]; + +@@ -2652,9 +2697,11 @@ void nss_skb_reuse(struct sk_buff *nbuf) + * Sends one skb to NSS FW + */ + static inline int32_t nss_core_send_buffer_simple_skb(struct nss_ctx_instance *nss_ctx, +- struct h2n_desc_if_instance *desc_if, uint32_t if_num, +- struct sk_buff *nbuf, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss) ++ struct h2n_desc_if_instance *desc_if, uint32_t if_num, struct sk_buff *nbuf, ++ uint16_t qid, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss) + { ++ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; ++ struct nss_if_mem_map *if_map = mem_ctx->if_map; + struct h2n_descriptor *desc_ring = desc_if->desc; + struct h2n_descriptor *desc; + uint16_t bit_flags; +@@ -2708,7 +2755,8 @@ static inline int32_t nss_core_send_buff + (nss_ptr_t)nbuf, (uint16_t)(nbuf->data - nbuf->head), nbuf->len, + sz, (uint32_t)nbuf->priority, mss, bit_flags); + +- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index), ++ sizeof(*desc), DMA_TO_DEVICE); + + /* + * We are done using the skb fields and can reuse it now +@@ -2732,7 +2780,8 @@ no_reuse: + (nss_ptr_t)nbuf, (uint16_t)(nbuf->data - nbuf->head), nbuf->len, + (uint16_t)skb_end_offset(nbuf), (uint32_t)nbuf->priority, mss, bit_flags); + +- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index), ++ sizeof(*desc), DMA_TO_DEVICE); + + NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_SIMPLE]); + return 1; +@@ -2746,9 +2795,11 @@ no_reuse: + * Used to differentiate from FRAGLIST + */ + static inline int32_t nss_core_send_buffer_nr_frags(struct nss_ctx_instance *nss_ctx, +- struct h2n_desc_if_instance *desc_if, uint32_t if_num, +- struct sk_buff *nbuf, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss) ++ struct h2n_desc_if_instance *desc_if, uint32_t if_num, struct sk_buff *nbuf, ++ uint16_t qid, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss) + { ++ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; ++ struct nss_if_mem_map *if_map = mem_ctx->if_map; + struct h2n_descriptor *desc_ring = desc_if->desc; + struct h2n_descriptor *desc; + const skb_frag_t *frag; +@@ -2788,7 +2839,8 @@ static inline int32_t nss_core_send_buff + (nss_ptr_t)NULL, nbuf->data - nbuf->head, nbuf->len - nbuf->data_len, + skb_end_offset(nbuf), (uint32_t)nbuf->priority, mss, bit_flags | H2N_BIT_FLAG_FIRST_SEGMENT); + +- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index), ++ sizeof(*desc), DMA_TO_DEVICE); + + /* + * Now handle rest of the fragments. +@@ -2812,7 +2864,8 @@ static inline int32_t nss_core_send_buff + (nss_ptr_t)NULL, 0, skb_frag_size(frag), skb_frag_size(frag), + nbuf->priority, mss, bit_flags); + +- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index), ++ sizeof(*desc), DMA_TO_DEVICE); + } + + /* +@@ -2828,7 +2881,8 @@ static inline int32_t nss_core_send_buff + desc->bit_flags &= ~(H2N_BIT_FLAG_DISCARD); + desc->opaque = (nss_ptr_t)nbuf; + +- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index), ++ sizeof(*desc), DMA_TO_DEVICE); + + NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_NR_FRAGS]); + return i+1; +@@ -2842,9 +2896,11 @@ static inline int32_t nss_core_send_buff + * Used to differentiate from FRAGS + */ + static inline int32_t nss_core_send_buffer_fraglist(struct nss_ctx_instance *nss_ctx, +- struct h2n_desc_if_instance *desc_if, uint32_t if_num, +- struct sk_buff *nbuf, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss) ++ struct h2n_desc_if_instance *desc_if, uint32_t if_num, struct sk_buff *nbuf, ++ uint16_t qid, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss) + { ++ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx; ++ struct nss_if_mem_map *if_map = mem_ctx->if_map; + struct h2n_descriptor *desc_ring = desc_if->desc; + struct h2n_descriptor *desc; + dma_addr_t buffer; +@@ -2883,7 +2939,8 @@ static inline int32_t nss_core_send_buff + (nss_ptr_t)nbuf, nbuf->data - nbuf->head, nbuf->len - nbuf->data_len, + skb_end_offset(nbuf), (uint32_t)nbuf->priority, mss, bit_flags | H2N_BIT_FLAG_FIRST_SEGMENT); + +- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index), ++ sizeof(*desc), DMA_TO_DEVICE); + + /* + * Walk the frag_list in nbuf +@@ -2936,7 +2993,8 @@ static inline int32_t nss_core_send_buff + (nss_ptr_t)iter, iter->data - iter->head, iter->len - iter->data_len, + skb_end_offset(iter), iter->priority, mss, bit_flags); + +- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index), ++ sizeof(*desc), DMA_TO_DEVICE); + + i++; + } +@@ -2955,7 +3013,8 @@ static inline int32_t nss_core_send_buff + * Update bit flag for last descriptor. + */ + desc->bit_flags |= H2N_BIT_FLAG_LAST_SEGMENT; +- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index), ++ sizeof(*desc), DMA_TO_DEVICE); + + NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_FRAGLIST]); + return i+1; +@@ -3034,8 +3093,10 @@ int32_t nss_core_send_buffer(struct nss_ + * We need to work out if there's sufficent space in our transmit descriptor + * ring to place all the segments of a nbuf. + */ +- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->h2n_nss_index[qid], sizeof(uint32_t), DMA_FROM_DEVICE); ++ dma_sync_single_for_cpu(nss_ctx->dev, h2n_nss_index_to_dma(mem_ctx->if_map_dma, qid), ++ sizeof(uint32_t), DMA_FROM_DEVICE); + NSS_CORE_DSB(); ++ + nss_index = if_map->h2n_nss_index[qid]; + h2n_desc_ring->nss_index_local = nss_index; + count = ((nss_index - hlos_index - 1) + size) & (mask); +@@ -3100,13 +3161,13 @@ int32_t nss_core_send_buffer(struct nss_ + count = 0; + if (likely((segments == 0) || is_bounce)) { + count = nss_core_send_buffer_simple_skb(nss_ctx, desc_if, if_num, +- nbuf, hlos_index, flags, buffer_type, mss); ++ nbuf, qid, hlos_index, flags, buffer_type, mss); + } else if (skb_has_frag_list(nbuf)) { + count = nss_core_send_buffer_fraglist(nss_ctx, desc_if, if_num, +- nbuf, hlos_index, flags, buffer_type, mss); ++ nbuf, qid, hlos_index, flags, buffer_type, mss); + } else { + count = nss_core_send_buffer_nr_frags(nss_ctx, desc_if, if_num, +- nbuf, hlos_index, flags, buffer_type, mss); ++ nbuf, qid, hlos_index, flags, buffer_type, mss); + } + + if (unlikely(count <= 0)) { +@@ -3130,7 +3191,8 @@ int32_t nss_core_send_buffer(struct nss_ + h2n_desc_ring->hlos_index = hlos_index; + if_map->h2n_hlos_index[qid] = hlos_index; + +- NSS_CORE_DMA_CACHE_MAINT(&if_map->h2n_hlos_index[qid], sizeof(uint32_t), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, h2n_hlos_index_to_dma(mem_ctx->if_map_dma, qid), ++ sizeof(uint32_t), DMA_TO_DEVICE); + NSS_CORE_DSB(); + + #ifdef CONFIG_DEBUG_KMEMLEAK +--- a/nss_core.h ++++ b/nss_core.h +@@ -100,31 +100,30 @@ + #endif + + /* +- * Cache operation ++ * DMA Offset helper + */ +-#define NSS_CORE_DSB() dsb(sy) +-#define NSS_CORE_DMA_CACHE_MAINT(start, size, dir) nss_core_dma_cache_maint(start, size, dir) ++#define n2h_desc_index_offset(_index) sizeof(struct n2h_descriptor) * (_index) ++#define h2n_desc_index_offset(_index) sizeof(struct h2n_descriptor) * (_index) ++ ++#define n2h_desc_index_to_dma(_if_map_addr, _qid, _index) (_if_map_addr)->n2h_desc_if[(_qid)].desc_addr + n2h_desc_index_offset(_index) ++#define h2n_desc_index_to_dma(_if_map_addr, _qid, _index) (_if_map_addr)->h2n_desc_if[(_qid)].desc_addr + h2n_desc_index_offset(_index) ++ ++#define h2n_nss_index_offset offsetof(struct nss_if_mem_map, h2n_nss_index) ++#define n2h_nss_index_offset offsetof(struct nss_if_mem_map, n2h_nss_index) ++#define h2n_hlos_index_offset offsetof(struct nss_if_mem_map, h2n_hlos_index) ++#define n2h_hlos_index_offset offsetof(struct nss_if_mem_map, n2h_hlos_index) ++ ++#define h2n_nss_index_to_dma(_if_map_addr, _index) (_if_map_addr) + h2n_nss_index_offset + (sizeof(uint32_t) * (_index)) ++#define n2h_nss_index_to_dma(_if_map_addr, _index) (_if_map_addr) + n2h_nss_index_offset + (sizeof(uint32_t) * (_index)) ++#define h2n_hlos_index_to_dma(_if_map_addr, _index) (_if_map_addr) + h2n_hlos_index_offset + (sizeof(uint32_t) * (_index)) ++#define n2h_hlos_index_to_dma(_if_map_addr, _index) (_if_map_addr) + n2h_hlos_index_offset + (sizeof(uint32_t) * (_index)) + + /* +- * nss_core_dma_cache_maint() +- * Perform the appropriate cache op based on direction ++ * Cache operation + */ +-static inline void nss_core_dma_cache_maint(void *start, uint32_t size, int direction) +-{ +- switch (direction) { +- case DMA_FROM_DEVICE:/* invalidate only */ +- dmac_inv_range(start, start + size); +- break; +- case DMA_TO_DEVICE:/* writeback only */ +- dmac_clean_range(start, start + size); +- break; +- case DMA_BIDIRECTIONAL:/* writeback and invalidate */ +- dmac_flush_range(start, start + size); +- break; +- default: +- BUG(); +- } +-} ++#define NSS_CORE_DSB() dsb(sy) ++#define NSS_CORE_DMA_CACHE_MAINT(dev, start, size, dir) BUILD_BUG_ON_MSG(1, \ ++ "NSS_CORE_DMA_CACHE_MAINT is deprecated. Fix the code to use correct dma_sync_* API") + + #define NSS_DEVICE_IF_START NSS_PHYSICAL_IF_START + +--- a/nss_hal/ipq806x/nss_hal_pvt.c ++++ b/nss_hal/ipq806x/nss_hal_pvt.c +@@ -477,10 +477,9 @@ static struct nss_platform_data *__nss_h + /* + * Clear TCM memory used by this core + */ +- for (i = 0; i < resource_size(&res_vphys) ; i += 4) { ++ for (i = 0; i < resource_size(&res_vphys) ; i += 4) + nss_write_32(npd->vmap, i, 0); +- NSS_CORE_DMA_CACHE_MAINT((npd->vmap + i), 4, DMA_TO_DEVICE); +- } ++ + NSS_CORE_DSB(); + + /* +--- a/nss_hal/ipq807x/nss_hal_pvt.c ++++ b/nss_hal/ipq807x/nss_hal_pvt.c +@@ -256,10 +256,9 @@ static struct nss_platform_data *__nss_h + /* + * Clear TCM memory used by this core + */ +- for (i = 0; i < resource_size(&res_vphys) ; i += 4) { ++ for (i = 0; i < resource_size(&res_vphys) ; i += 4) + nss_write_32(npd->vmap, i, 0); +- NSS_CORE_DMA_CACHE_MAINT((npd->vmap + i), 4, DMA_TO_DEVICE); +- } ++ + NSS_CORE_DSB(); + + /* +--- a/nss_meminfo.c ++++ b/nss_meminfo.c +@@ -415,7 +415,6 @@ static bool nss_meminfo_init_block_lists + /* + * Flush the updated meminfo request. + */ +- NSS_CORE_DMA_CACHE_MAINT(r, sizeof(struct nss_meminfo_request), DMA_TO_DEVICE); + NSS_CORE_DSB(); + + /* +@@ -546,7 +545,7 @@ static bool nss_meminfo_configure_n2h_h2 + * Bring a fresh copy of if_map from memory in order to read it correctly. + */ + if_map = mem_ctx->if_map; +- NSS_CORE_DMA_CACHE_MAINT((void *)if_map, sizeof(struct nss_if_mem_map), DMA_FROM_DEVICE); ++ dma_sync_single_for_cpu(nss_ctx->dev, mem_ctx->if_map_dma, sizeof(struct nss_if_mem_map), DMA_FROM_DEVICE); + NSS_CORE_DSB(); + + if_map->n2h_rings = NSS_N2H_RING_COUNT; +@@ -584,7 +583,7 @@ static bool nss_meminfo_configure_n2h_h2 + /* + * Flush the updated nss_if_mem_map. + */ +- NSS_CORE_DMA_CACHE_MAINT((void *)if_map, sizeof(struct nss_if_mem_map), DMA_TO_DEVICE); ++ dma_sync_single_for_device(nss_ctx->dev, mem_ctx->if_map_dma, sizeof(struct nss_if_mem_map), DMA_TO_DEVICE); + NSS_CORE_DSB(); + + return true; +--- a/nss_profiler.c ++++ b/nss_profiler.c +@@ -209,11 +209,12 @@ EXPORT_SYMBOL(nss_profile_dma_deregister + struct nss_profile_sdma_ctrl *nss_profile_dma_get_ctrl(struct nss_ctx_instance *nss_ctx) + { + struct nss_profile_sdma_ctrl *ctrl = nss_ctx->meminfo_ctx.sdma_ctrl; ++ int size = offsetof(struct nss_profile_sdma_ctrl, cidx); + if (!ctrl) { + return ctrl; + } + +- dmac_inv_range(ctrl, &ctrl->cidx); ++ dma_sync_single_for_cpu(nss_ctx->dev, (dma_addr_t) ctrl, size, DMA_FROM_DEVICE); + dsb(sy); + return ctrl; + } diff --git a/qca-nss-drv/patches-11.4/0017-nss-drv-remove-gmac-stat.patch b/qca-nss-drv/patches-11.4/0017-nss-drv-remove-gmac-stat.patch new file mode 100644 index 0000000..08782d7 --- /dev/null +++ b/qca-nss-drv/patches-11.4/0017-nss-drv-remove-gmac-stat.patch @@ -0,0 +1,39 @@ +--- a/nss_stats.c ++++ b/nss_stats.c +@@ -401,7 +401,7 @@ void nss_stats_create_dentry(char *name, + /* + * gmac_stats_ops + */ +-NSS_STATS_DECLARE_FILE_OPERATIONS(gmac); ++// NSS_STATS_DECLARE_FILE_OPERATIONS(gmac); + + /* + * wt_stats_ops +@@ -456,7 +456,7 @@ void nss_stats_init(void) + /* + * gmac_stats + */ +- nss_stats_create_dentry("gmac", &nss_gmac_stats_ops); ++ // nss_stats_create_dentry("gmac", &nss_gmac_stats_ops); + + /* + * Per-project stats +--- a/Makefile ++++ b/Makefile +@@ -40,7 +40,6 @@ qca-nss-drv-objs += nss_hal/nss_hal.o + + ifneq "$(NSS_DRV_POINT_OFFLOAD)" "y" + qca-nss-drv-objs += \ +- nss_gmac_stats.o \ + nss_if.o \ + nss_if_log.o \ + nss_phys_if.o \ +@@ -381,7 +380,7 @@ endif + ifeq ($(SoC),$(filter $(SoC),ipq806x)) + ccflags-y += -DNSS_DRV_IPV4_ENABLE -DNSS_DRV_IPV6_ENABLE + qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \ +- nss_hal/ipq806x/nss_hal_pvt.o ++ nss_hal/ipq806x/nss_hal_pvt.o nss_gmac_stats.o + + ifneq "$(NSS_DRV_C2C_ENABLE)" "n" + ccflags-y += -DNSS_DRV_C2C_ENABLE