diff --git a/qca-nss-clients/Makefile b/qca-nss-clients/Makefile index 8c62dd5..d1320d5 100644 --- a/qca-nss-clients/Makefile +++ b/qca-nss-clients/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-clients.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-10-04 -PKG_SOURCE_VERSION:=f058ae199b42f30be9925b2ed1ce53afb128200c -PKG_MIRROR_HASH:=90401b577a7750d3b7eadb423700aab7e1da1af392637598e08f6007f23a92e1 +PKG_SOURCE_DATE:=2021-08-17 +PKG_SOURCE_VERSION:=153998d70fdba508a59a28c13a606032cbf32686 +PKG_MIRROR_HASH:=8b0eb211da44c36022ef85fe0bf7c37836333f6ffa6c312117a43e5473dffdf8 PKG_BUILD_PARALLEL:=1 diff --git a/qca-nss-clients/patches/0016-vxlanmgr-fix-compile-error-in-5.15.patch b/qca-nss-clients/patches/0016-vxlanmgr-fix-compile-error-in-5.15.patch index 80173f8..e69de29 100644 --- a/qca-nss-clients/patches/0016-vxlanmgr-fix-compile-error-in-5.15.patch +++ b/qca-nss-clients/patches/0016-vxlanmgr-fix-compile-error-in-5.15.patch @@ -1,11 +0,0 @@ ---- a/vxlanmgr/nss_vxlanmgr.c -+++ b/vxlanmgr/nss_vxlanmgr.c -@@ -84,7 +84,7 @@ int32_t nss_vxlanmgr_bind_ipsec_by_ip(un - { - int32_t ipsec_if_num; - nss_vxlanmgr_get_ipsec_if_num_by_ip_callback_t ipsec_cb; -- struct nss_ctx_instance *nss_ctx = nss_vxlan_get_ctx(); -+ __attribute__((unused)) struct nss_ctx_instance *nss_ctx = nss_vxlan_get_ctx(); - - /* - * Check if the VxLAN interface is applied over an IPsec interface by querying the IPsec. diff --git a/qca-nss-clients/patches/0018-kernel-6.1-support.patch b/qca-nss-clients/patches/0018-kernel-6.1-support.patch index 81e11c1..fb9a27a 100644 --- a/qca-nss-clients/patches/0018-kernel-6.1-support.patch +++ b/qca-nss-clients/patches/0018-kernel-6.1-support.patch @@ -1,6 +1,6 @@ --- a/bridge/nss_bridge_mgr.c +++ b/bridge/nss_bridge_mgr.c -@@ -1081,7 +1081,7 @@ int nss_bridge_mgr_register_br(struct ne +@@ -1045,7 +1045,7 @@ int nss_bridge_mgr_register_br(struct ne } #endif @@ -8,8 +8,8 @@ + 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_4; -@@ -1242,7 +1242,7 @@ static int nss_bridge_mgr_changeaddr_eve + 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); @@ -104,7 +104,7 @@ retval = READ_ONCE(act->tcf_action); --- a/nss_qdisc/nss_qdisc.h +++ b/nss_qdisc/nss_qdisc.h -@@ -217,7 +217,7 @@ struct nss_qdisc { +@@ -188,7 +188,7 @@ struct nss_qdisc { /* Shaper configure callback for reading shaper specific * responses (e.g. memory size). */ @@ -113,7 +113,7 @@ 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 */ -@@ -464,7 +464,7 @@ extern int nss_qdisc_init(struct Qdisc * +@@ -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, @@ -139,7 +139,15 @@ --- a/nss_qdisc/nss_qdisc.c +++ b/nss_qdisc/nss_qdisc.c -@@ -2189,7 +2189,7 @@ int __nss_qdisc_init(struct Qdisc *sch, +@@ -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)) { @@ -148,7 +156,27 @@ " or the interface is currently down", nq->qdisc, nq->type); } -@@ -2606,12 +2606,14 @@ int nss_qdisc_init(struct Qdisc *sch, st +@@ -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, @@ -164,31 +192,26 @@ #else return gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), d, NULL, b); #endif ---- a/nss_qdisc/nss_qdisc_stats.c -+++ b/nss_qdisc/nss_qdisc_stats.c -@@ -160,7 +160,7 @@ static void nss_qdisc_stats_process_node - { - struct Qdisc *qdisc; - struct nss_qdisc *nq; -- struct gnet_stats_basic_packed *bstats; -+ struct gnet_stats_basic_sync *bstats; - struct gnet_stats_queue *qstats; - uint32_t qos_tag = response->qos_tag; - #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)) -@@ -214,8 +214,8 @@ static void nss_qdisc_stats_process_node - * 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); +@@ -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; - /* - * Update qdisc->qstats + 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 -@@ -787,7 +787,7 @@ static struct nss_vlan_pvt *nss_vlan_mgr +@@ -808,7 +808,7 @@ static struct nss_vlan_pvt *nss_vlan_mgr } v->mtu = dev->mtu; @@ -197,7 +220,7 @@ v->ifindex = dev->ifindex; v->refs = 1; -@@ -936,14 +936,14 @@ static int nss_vlan_mgr_changeaddr_event +@@ -956,14 +956,14 @@ static int nss_vlan_mgr_changeaddr_event } spin_unlock(&vlan_mgr_ctx.lock); @@ -216,7 +239,7 @@ nss_vlan_mgr_instance_deref(v_pvt); --- a/vxlanmgr/nss_vxlanmgr_tunnel.c +++ b/vxlanmgr/nss_vxlanmgr_tunnel.c -@@ -489,8 +489,8 @@ static void nss_vxlanmgr_tunnel_inner_st +@@ -465,8 +465,8 @@ static void nss_vxlanmgr_tunnel_inner_st tstats = this_cpu_ptr(dev->tstats); u64_stats_update_begin(&tstats->syncp); @@ -226,8 +249,8 @@ + u64_stats_add(&tstats->tx_bytes, stats->node_stats.tx_bytes); u64_stats_update_end(&tstats->syncp); netdev_stats->tx_dropped += dropped; - } -@@ -526,8 +526,8 @@ static void nss_vxlanmgr_tunnel_outer_st + 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); @@ -258,17 +281,6 @@ memset(dev->broadcast, 0xff, dev->addr_len); memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); } ---- a/clmapmgr/nss_clmapmgr.c -+++ b/clmapmgr/nss_clmapmgr.c -@@ -103,7 +103,7 @@ static struct rtnl_link_stats64 *nss_clm - * 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)); --- a/tls/nss_tlsmgr_tun.c +++ b/tls/nss_tlsmgr_tun.c @@ -185,7 +185,7 @@ static void nss_tlsmgr_tun_setup(struct diff --git a/qca-nss-clients/patches/0019-wifi-meshmgr-fix-uninitialized-and-implicit.patch b/qca-nss-clients/patches/0019-wifi-meshmgr-fix-uninitialized-and-implicit.patch index 87f1569..2adef69 100644 --- a/qca-nss-clients/patches/0019-wifi-meshmgr-fix-uninitialized-and-implicit.patch +++ b/qca-nss-clients/patches/0019-wifi-meshmgr-fix-uninitialized-and-implicit.patch @@ -1,8 +1,6 @@ -diff --git a/wifi_meshmgr/nss_wifi_meshmgr.c b/wifi_meshmgr/nss_wifi_meshmgr.c -index 498ed35..c8002c8 100644 --- 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_num(int32_t if_num, enum nss_dynamic_inte +@@ -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) { @@ -11,7 +9,7 @@ index 498ed35..c8002c8 100644 } /* -@@ -126,7 +126,7 @@ static void nss_wifi_meshmgr_cleanup(struct nss_wifi_meshmgr_mesh_ctx *wmesh_ctx +@@ -126,7 +126,7 @@ static void nss_wifi_meshmgr_cleanup(str * Unregister and dealloc decap DI. */ nss_unregister_wifi_mesh_if(decap_ifnum); @@ -20,7 +18,7 @@ index 498ed35..c8002c8 100644 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(struct nss_wifi_meshmgr_mesh_ctx *wmesh_ctx +@@ -135,7 +135,7 @@ static void nss_wifi_meshmgr_cleanup(str * Unregister and dealloc encap DI. */ nss_unregister_wifi_mesh_if(encap_ifnum); @@ -29,7 +27,7 @@ index 498ed35..c8002c8 100644 if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) { nss_wifi_meshmgr_warn("%px: Failed to dealloc encap: %d\n", &wmgr_ctx, nss_status); } -@@ -257,10 +257,10 @@ static void nss_wifi_meshmgr_tx_msg_cb(void *app_data, struct nss_cmn_msg *ncm) +@@ -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. */ @@ -42,7 +40,7 @@ index 498ed35..c8002c8 100644 } complete(&wmesh_ctx->complete); -@@ -289,10 +289,10 @@ static nss_wifi_meshmgr_status_t nss_wifi_meshmgr_tx_msg_sync(struct nss_wifi_me +@@ -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); @@ -55,7 +53,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); return status; } -@@ -324,7 +324,7 @@ nss_wifi_meshmgr_status_t nss_wifi_meshmgr_tx_buf(nss_wifi_mesh_handle_t mesh_ha +@@ -316,7 +316,7 @@ nss_wifi_meshmgr_status_t nss_wifi_meshm return NSS_WIFI_MESHMGR_FAILURE; } @@ -64,7 +62,7 @@ index 498ed35..c8002c8 100644 nss_wifi_meshmgr_ref_dec(wmesh_ctx); return nss_status; } -@@ -548,10 +548,10 @@ nss_wifi_meshmgr_dump_mesh_path_sync(nss_wifi_mesh_handle_t mesh_handle) +@@ -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); @@ -77,7 +75,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); -@@ -643,10 +643,10 @@ nss_wifi_meshmgr_dump_mesh_proxy_path_sync(nss_wifi_mesh_handle_t mesh_handle) +@@ -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); @@ -90,7 +88,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); -@@ -715,7 +715,7 @@ nss_wifi_meshmgr_assoc_link_vap(nss_wifi_mesh_handle_t mesh_handle, struct nss_w +@@ -707,7 +707,7 @@ nss_wifi_meshmgr_assoc_link_vap(nss_wifi /* * Send the link vap mesage to the NSS synchronously. */ @@ -99,7 +97,7 @@ index 498ed35..c8002c8 100644 if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) { nss_wifi_meshmgr_warn("%px: Mesh link vap association failed: %d.\n", &wmgr_ctx, nss_status); } -@@ -761,10 +761,10 @@ nss_wifi_meshmgr_assoc_link_vap_sync(nss_wifi_mesh_handle_t mesh_handle, struct +@@ -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); @@ -112,7 +110,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); -@@ -886,10 +886,10 @@ nss_wifi_meshmgr_mesh_config_update_sync(nss_wifi_mesh_handle_t mesh_handle, str +@@ -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); @@ -125,7 +123,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); -@@ -985,10 +985,10 @@ nss_wifi_meshmgr_mesh_proxy_path_delete_sync(nss_wifi_mesh_handle_t mesh_handle, +@@ -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); @@ -138,7 +136,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); -@@ -1084,10 +1084,10 @@ nss_wifi_meshmgr_mesh_proxy_path_update_sync(nss_wifi_mesh_handle_t mesh_handle, +@@ -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); @@ -151,7 +149,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); -@@ -1183,10 +1183,10 @@ nss_wifi_meshmgr_mesh_proxy_path_add_sync(nss_wifi_mesh_handle_t mesh_handle, st +@@ -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); @@ -164,7 +162,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); -@@ -1282,10 +1282,10 @@ nss_wifi_meshmgr_mesh_path_delete_sync(nss_wifi_mesh_handle_t mesh_handle, struc +@@ -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); @@ -177,7 +175,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); -@@ -1381,10 +1381,10 @@ nss_wifi_meshmgr_mesh_path_add_sync(nss_wifi_mesh_handle_t mesh_handle, struct n +@@ -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); @@ -190,7 +188,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); return nss_status; -@@ -1479,10 +1479,10 @@ nss_wifi_meshmgr_mesh_path_update_sync(nss_wifi_mesh_handle_t mesh_handle, struc +@@ -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); @@ -203,7 +201,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); -@@ -1578,10 +1578,10 @@ nss_wifi_meshmgr_mesh_path_exception_sync(nss_wifi_mesh_handle_t mesh_handle,str +@@ -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); @@ -216,20 +214,7 @@ index 498ed35..c8002c8 100644 up(&wmesh_ctx->sem); nss_wifi_meshmgr_ref_dec(wmesh_ctx); -@@ -1702,10 +1702,10 @@ nss_wifi_meshmgr_config_mesh_exception_sync(nss_wifi_mesh_handle_t mesh_handle,s - 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); -@@ -1795,7 +1795,7 @@ nss_wifi_mesh_handle_t nss_wifi_meshmgr_if_create_sync(struct net_device *dev, s +@@ -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; diff --git a/qca-nss-clients/patches/0020-capwapmgr-fix-compile-error.patch b/qca-nss-clients/patches/0020-capwapmgr-fix-compile-error.patch index 5a357c2..c8606fa 100644 --- a/qca-nss-clients/patches/0020-capwapmgr-fix-compile-error.patch +++ b/qca-nss-clients/patches/0020-capwapmgr-fix-compile-error.patch @@ -1,6 +1,6 @@ --- a/capwapmgr/nss_capwapmgr.c +++ b/capwapmgr/nss_capwapmgr.c -@@ -334,7 +334,7 @@ static struct rtnl_link_stats64 *nss_cap +@@ -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. */ @@ -9,7 +9,7 @@ memset(stats, 0, sizeof (struct rtnl_link_stats64)); nss_capwapmgr_fill_up_stats(stats, &global.tunneld); -@@ -379,7 +379,6 @@ static const struct net_device_ops nss_c +@@ -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, @@ -17,7 +17,7 @@ .ndo_get_stats64 = nss_capwapmgr_dev_tunnel_stats, }; -@@ -403,7 +402,7 @@ static void nss_capwapmgr_dummpy_netdev_ +@@ -400,7 +399,7 @@ static void nss_capwapmgr_dummpy_netdev_ #else dev->priv_destructor = NULL; #endif @@ -26,7 +26,7 @@ memset(dev->broadcast, 0xff, dev->addr_len); memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); } -@@ -572,7 +571,7 @@ static struct nss_capwapmgr_tunnel *nss_ +@@ -569,7 +568,7 @@ static struct nss_capwapmgr_tunnel *nss_ * nss_capwapmgr_netdev_create() * API to create a CAPWAP netdev */ @@ -35,7 +35,7 @@ { struct nss_capwapmgr_priv *priv; struct nss_capwapmgr_response *r; -@@ -1179,7 +1178,7 @@ static nss_capwapmgr_status_t nss_capwap +@@ -1168,7 +1167,7 @@ static nss_capwapmgr_status_t nss_capwap /* * Call NSS driver */ @@ -44,7 +44,7 @@ if (status != NSS_CAPWAPMGR_SUCCESS) { up(&r->sem); dev_put(dev); -@@ -1220,7 +1219,7 @@ static nss_capwapmgr_status_t nss_capwap +@@ -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; @@ -53,7 +53,7 @@ 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)); -@@ -1285,7 +1284,7 @@ static nss_capwapmgr_status_t nss_capwap +@@ -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); @@ -62,7 +62,7 @@ nss_capwapmgr_warn("%px: ctx: create encap data tunnel error %d \n", ctx, status); return status; } -@@ -1297,10 +1296,10 @@ static nss_capwapmgr_status_t nss_capwap +@@ -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 */ @@ -75,7 +75,7 @@ /* * Prepare the tunnel configuration parameter to send to NSS FW -@@ -1314,7 +1313,7 @@ static nss_tx_status_t nss_capwapmgr_tx_ +@@ -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); @@ -84,7 +84,7 @@ nss_capwapmgr_warn("%px: ctx: CMD: %d Tunnel error : %d \n", ctx, NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL, status); } -@@ -1326,7 +1325,7 @@ static nss_tx_status_t nss_capwapmgr_tx_ +@@ -1315,7 +1314,7 @@ static nss_tx_status_t nss_capwapmgr_tx_ * Common function for CAPWAP tunnel operation messages without * any message data structures. */ @@ -93,7 +93,7 @@ { struct nss_capwap_msg capwapmsg; nss_tx_status_t status; -@@ -1341,12 +1340,12 @@ static nss_tx_status_t nss_capwapmgr_tun +@@ -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); @@ -108,7 +108,7 @@ } /* -@@ -1471,7 +1470,6 @@ EXPORT_SYMBOL(nss_capwapmgr_update_path_ +@@ -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) { @@ -116,7 +116,7 @@ struct nss_capwapmgr_tunnel *t; nss_tx_status_t nss_status; nss_capwapmgr_status_t status = NSS_CAPWAPMGR_SUCCESS; -@@ -1487,7 +1485,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd +@@ -1476,7 +1474,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd } @@ -124,7 +124,7 @@ nss_capwapmgr_info("%px: %d: tunnel update mac Addr is being called\n", dev, tunnel_id); /* -@@ -1534,7 +1531,6 @@ EXPORT_SYMBOL(nss_capwapmgr_update_dest_ +@@ -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) { @@ -132,7 +132,7 @@ 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; -@@ -1548,7 +1544,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd +@@ -1537,7 +1533,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd } @@ -140,7 +140,7 @@ 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; -@@ -1587,7 +1582,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd +@@ -1576,7 +1571,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd /* * Destroy the IP rule only if it already exist. */ @@ -149,7 +149,7 @@ struct nss_ipv4_destroy v4_destroy; v4_destroy.protocol = IPPROTO_UDP; v4_destroy.src_ip = t->ip_rule.v4.src_ip; -@@ -1617,7 +1612,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd +@@ -1606,7 +1601,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd /* * Destroy the IP rule only if it already exist. */ @@ -158,7 +158,7 @@ struct nss_ipv6_destroy v6_destroy; if (t->capwap_rule.which_udp == NSS_CAPWAP_TUNNEL_UDP) { -@@ -1761,7 +1756,7 @@ nss_capwapmgr_status_t nss_capwapmgr_dsc +@@ -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; diff --git a/qca-nss-clients/patches/0022-netlink-modularize-makefile.patch b/qca-nss-clients/patches/0022-netlink-modularize-makefile.patch index 2e955a5..9f47c32 100644 --- a/qca-nss-clients/patches/0022-netlink-modularize-makefile.patch +++ b/qca-nss-clients/patches/0022-netlink-modularize-makefile.patch @@ -1,6 +1,6 @@ --- a/netlink/Makefile +++ b/netlink/Makefile -@@ -27,7 +27,6 @@ ccflags-y += -DCONFIG_NSS_NLPPTP=1 +@@ -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} @@ -8,15 +8,15 @@ qca-nss-netlink-objs := nss_nl.o qca-nss-netlink-objs += nss_nlgre_redir_family.o -@@ -49,7 +48,6 @@ qca-nss-netlink-objs += nss_nlmap_t.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 - qca-nss-netlink-objs += nss_nlqrfs.o ifneq (,$(filter $(capwapmgr), y)) -@@ -81,4 +79,11 @@ else + qca-nss-netlink-objs += nss_nlcapwap.o +@@ -79,4 +77,11 @@ else ccflags-y += -DCONFIG_NSS_NLEDMA=0 endif diff --git a/qca-nss-clients/patches/0025-pvxlanmgr-fix-compile-error-in-6.1.patch b/qca-nss-clients/patches/0025-pvxlanmgr-fix-compile-error-in-6.1.patch new file mode 100644 index 0000000..e15a4de --- /dev/null +++ b/qca-nss-clients/patches/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/0026-meshmgr-backport-12.4.patch b/qca-nss-clients/patches/0026-meshmgr-backport-12.4.patch new file mode 100644 index 0000000..e69de29 diff --git a/qca-nss-clients/patches/0026-qdisc-backport-12.4.patch b/qca-nss-clients/patches/0026-qdisc-backport-12.4.patch new file mode 100644 index 0000000..a16fc4c --- /dev/null +++ b/qca-nss-clients/patches/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..849ce71 100644 --- a/qca-nss-drv/Makefile +++ b/qca-nss-drv/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-nss-drv -PKG_RELEASE:=7 +PKG_RELEASE:=1 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-drv.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-01-04 -PKG_SOURCE_VERSION:=89cc01b57199c6b9845bcef48125f21b6a8c0cc2 -PKG_MIRROR_HASH:=2d505bff0602a74b14ea0c4aefee0604e20ce2f95dab0ebb2a70b36cd884e9f4 +PKG_SOURCE_DATE:=2021-06-24 +PKG_SOURCE_VERSION:=dc14ca2 +PKG_MIRROR_HASH:=316d683281818ab3715ca31af42e9b82e1f1a9f13713a015030277f84febea25 PKG_BUILD_PARALLEL:=1 PKG_FLAGS:=nonshared diff --git a/qca-nss-drv/patches/0001-nss-drv-replace-ioremap_nocache-with-ioremap.patch b/qca-nss-drv/patches/0001-nss-drv-replace-ioremap_nocache-with-ioremap.patch index b8ee7dd..c749a68 100644 --- a/qca-nss-drv/patches/0001-nss-drv-replace-ioremap_nocache-with-ioremap.patch +++ b/qca-nss-drv/patches/0001-nss-drv-replace-ioremap_nocache-with-ioremap.patch @@ -135,35 +135,6 @@ Signed-off-by: Robert Marko } 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/ipq95xx/nss_hal_pvt.c -+++ b/nss_hal/ipq95xx/nss_hal_pvt.c -@@ -291,7 +291,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; -@@ -303,7 +303,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; -@@ -608,7 +608,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) { @@ -171,10 +142,10 @@ Signed-off-by: Robert Marko return -EFAULT; --- a/nss_hal/nss_hal.c +++ b/nss_hal/nss_hal.c -@@ -81,9 +81,9 @@ int nss_hal_firmware_load(struct nss_ctx +@@ -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) { @@ -185,7 +156,7 @@ Signed-off-by: Robert Marko } --- a/nss_meminfo.c +++ b/nss_meminfo.c -@@ -735,7 +735,7 @@ bool nss_meminfo_init(struct nss_ctx_ins +@@ -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. */ diff --git a/qca-nss-drv/patches/0002-Control-fab-scaling-from-package-Makefile.patch b/qca-nss-drv/patches/0002-Control-fab-scaling-from-package-Makefile.patch new file mode 100644 index 0000000..04c9bed --- /dev/null +++ b/qca-nss-drv/patches/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/0002-nss-drv-add-support-for-kernel-5.15.patch b/qca-nss-drv/patches/0002-nss-drv-add-support-for-kernel-5.15.patch index 3b828fe..800b022 100644 --- a/qca-nss-drv/patches/0002-nss-drv-add-support-for-kernel-5.15.patch +++ b/qca-nss-drv/patches/0002-nss-drv-add-support-for-kernel-5.15.patch @@ -16,18 +16,20 @@ Signed-off-by: Ansuel Smith --- a/nss_core.c +++ b/nss_core.c -@@ -61,7 +61,9 @@ +@@ -52,7 +52,11 @@ (((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)))) || \ +(((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 -@@ -2658,7 +2660,7 @@ static inline bool nss_core_skb_can_reus +@@ -2579,7 +2583,7 @@ static inline bool nss_core_skb_can_reus if (unlikely(irqs_disabled())) return false; @@ -38,7 +40,7 @@ Signed-off-by: Ansuel Smith if (unlikely(skb_is_nonlinear(nbuf))) --- a/nss_coredump.c +++ b/nss_coredump.c -@@ -25,7 +25,11 @@ +@@ -23,7 +23,11 @@ #include "nss_hal.h" #include "nss_log.h" #include @@ -52,7 +54,7 @@ Signed-off-by: Ansuel Smith --- a/nss_hal/nss_hal.c +++ b/nss_hal/nss_hal.c -@@ -27,6 +27,7 @@ +@@ -24,6 +24,7 @@ #include #include #include @@ -60,7 +62,7 @@ Signed-off-by: Ansuel Smith #include "nss_hal.h" #include "nss_arch.h" -@@ -64,9 +65,9 @@ int nss_hal_firmware_load(struct nss_ctx +@@ -57,9 +58,9 @@ int nss_hal_firmware_load(struct nss_ctx int rc; if (nss_ctx->id == 0) { diff --git a/qca-nss-drv/patches/0003-DMA-Fix-NULL-pointer-exceptions.patch b/qca-nss-drv/patches/0003-DMA-Fix-NULL-pointer-exceptions.patch index 4577b8a..2100eac 100644 --- a/qca-nss-drv/patches/0003-DMA-Fix-NULL-pointer-exceptions.patch +++ b/qca-nss-drv/patches/0003-DMA-Fix-NULL-pointer-exceptions.patch @@ -1,23 +1,6 @@ -From a6e3e81daab4eb9acbdef0ad1fed056e1bfbe320 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Tue, 8 Jun 2021 23:24:43 +0200 -Subject: [PATCH 3/4] DMA: Fix NULL pointer exceptions - -There are multiple instances that pass NULL instead -of device to DMA functions. -That is incorrect and will cause kernel NULL pointer -exceptions. - -So, simply pass the device structure pointers. - -Signed-off-by: Robert Marko ---- - nss_core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - --- a/nss_core.c +++ b/nss_core.c -@@ -1660,7 +1660,7 @@ static int32_t nss_core_handle_cause_que +@@ -1616,7 +1616,7 @@ static int32_t nss_core_handle_cause_que * */ if (unlikely((buffer_type == N2H_BUFFER_CRYPTO_RESP))) { diff --git a/qca-nss-drv/patches/0004-nss-drv-backport-12.4.patch b/qca-nss-drv/patches/0004-nss-drv-backport-12.4.patch new file mode 100644 index 0000000..b45829a --- /dev/null +++ b/qca-nss-drv/patches/0004-nss-drv-backport-12.4.patch @@ -0,0 +1,1545 @@ +--- 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" + +@@ -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("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); + memcpy_toio(load_mem, nss_fw->data, nss_fw->size); + release_firmware(nss_fw); + iounmap(load_mem); +@@ -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; + } + diff --git a/qca-nss-drv/patches/0004-nss-drv-rework-NSS_CORE_DMA_CACHE_MAINT-ops.patch b/qca-nss-drv/patches/0004-nss-drv-rework-NSS_CORE_DMA_CACHE_MAINT-ops.patch index 17ad9cd..0cd5b65 100644 --- a/qca-nss-drv/patches/0004-nss-drv-rework-NSS_CORE_DMA_CACHE_MAINT-ops.patch +++ b/qca-nss-drv/patches/0004-nss-drv-rework-NSS_CORE_DMA_CACHE_MAINT-ops.patch @@ -27,7 +27,7 @@ Signed-off-by: Christian Marangi --- a/nss_core.c +++ b/nss_core.c -@@ -1472,6 +1472,8 @@ static inline void nss_core_handle_empty +@@ -1421,6 +1421,8 @@ static inline void nss_core_handle_empty uint32_t count, uint32_t hlos_index, uint16_t mask) { @@ -36,7 +36,7 @@ Signed-off-by: Christian Marangi while (count) { /* * Since we only return the primary skb, we have no way to unmap -@@ -1525,7 +1527,9 @@ next: +@@ -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; @@ -47,7 +47,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); } -@@ -1547,6 +1551,7 @@ static int32_t nss_core_handle_cause_que +@@ -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; @@ -55,7 +55,7 @@ Signed-off-by: Christian Marangi qid = nss_core_cause_to_queue(cause); -@@ -1558,7 +1563,8 @@ static int32_t nss_core_handle_cause_que +@@ -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; @@ -65,7 +65,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); nss_index = if_map->n2h_nss_index[qid]; -@@ -1587,13 +1593,23 @@ static int32_t nss_core_handle_cause_que +@@ -1536,13 +1542,23 @@ static int32_t nss_core_handle_cause_que start = hlos_index; end = (hlos_index + count) & mask; if (end > start) { @@ -92,7 +92,7 @@ Signed-off-by: Christian Marangi } /* -@@ -1722,7 +1738,8 @@ next: +@@ -1671,7 +1687,8 @@ next: n2h_desc_ring->hlos_index = hlos_index; if_map->n2h_hlos_index[qid] = hlos_index; @@ -102,7 +102,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); return count; -@@ -1734,11 +1751,12 @@ next: +@@ -1683,11 +1700,12 @@ next: */ static void nss_core_init_nss(struct nss_ctx_instance *nss_ctx, struct nss_if_mem_map *if_map) { @@ -116,7 +116,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); /* -@@ -1835,6 +1853,7 @@ static void nss_core_alloc_paged_buffers +@@ -1762,6 +1780,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) { @@ -124,7 +124,7 @@ Signed-off-by: Christian Marangi struct sk_buff *nbuf; struct page *npage; struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[buffer_queue]; -@@ -1904,7 +1923,9 @@ static void nss_core_alloc_paged_buffers +@@ -1831,7 +1850,9 @@ static void nss_core_alloc_paged_buffers /* * Flush the descriptor */ @@ -135,7 +135,7 @@ Signed-off-by: Christian Marangi hlos_index = (hlos_index + 1) & (mask); count--; -@@ -1918,7 +1939,8 @@ static void nss_core_alloc_paged_buffers +@@ -1845,7 +1866,8 @@ static void nss_core_alloc_paged_buffers h2n_desc_ring->hlos_index = hlos_index; if_map->h2n_hlos_index[buffer_queue] = hlos_index; @@ -145,7 +145,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); NSS_PKT_STATS_INC(&nss_top->stats_drv[stats_index]); -@@ -1931,7 +1953,7 @@ static void nss_core_alloc_paged_buffers +@@ -1858,7 +1880,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) { @@ -154,7 +154,7 @@ Signed-off-by: Christian Marangi 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; -@@ -1978,7 +2000,9 @@ static void nss_core_alloc_jumbo_mru_buf +@@ -1905,7 +1927,9 @@ static void nss_core_alloc_jumbo_mru_buf /* * Flush the descriptor */ @@ -165,7 +165,7 @@ Signed-off-by: Christian Marangi hlos_index = (hlos_index + 1) & (mask); count--; -@@ -1992,7 +2016,8 @@ static void nss_core_alloc_jumbo_mru_buf +@@ -1919,7 +1943,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; @@ -175,7 +175,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); NSS_PKT_STATS_INC(&nss_top->stats_drv[NSS_DRV_STATS_TX_EMPTY]); -@@ -2005,6 +2030,7 @@ static void nss_core_alloc_jumbo_mru_buf +@@ -1932,6 +1957,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) { @@ -183,7 +183,7 @@ Signed-off-by: Christian Marangi 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; -@@ -2012,6 +2038,7 @@ static void nss_core_alloc_max_avail_siz +@@ -1939,6 +1965,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; @@ -191,7 +191,7 @@ Signed-off-by: Christian Marangi while (count) { dma_addr_t buffer; -@@ -2064,13 +2091,26 @@ static void nss_core_alloc_max_avail_siz +@@ -1991,13 +2018,26 @@ static void nss_core_alloc_max_avail_siz * Flush the descriptors, including the descriptor at prev_hlos_index. */ if (prev_hlos_index > start) { @@ -221,7 +221,7 @@ Signed-off-by: Christian Marangi } /* -@@ -2081,7 +2121,8 @@ static void nss_core_alloc_max_avail_siz +@@ -2008,7 +2048,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; @@ -231,7 +231,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); NSS_PKT_STATS_INC(&nss_top->stats_drv[NSS_DRV_STATS_TX_EMPTY]); -@@ -2094,6 +2135,7 @@ static void nss_core_alloc_max_avail_siz +@@ -2021,6 +2062,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) { @@ -239,7 +239,7 @@ Signed-off-by: Christian Marangi 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]; -@@ -2104,7 +2146,8 @@ static inline void nss_core_handle_empty +@@ -2031,7 +2073,8 @@ static inline void nss_core_handle_empty /* * Check how many empty buffers could be filled in queue */ @@ -249,7 +249,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); nss_index = if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE]; -@@ -2149,6 +2192,7 @@ static inline void nss_core_handle_empty +@@ -2076,6 +2119,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) { @@ -257,7 +257,7 @@ Signed-off-by: Christian Marangi 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]; -@@ -2156,7 +2200,8 @@ static inline void nss_core_handle_paged +@@ -2083,7 +2127,8 @@ static inline void nss_core_handle_paged /* * Check how many empty buffers could be filled in queue */ @@ -267,7 +267,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); nss_index = if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE]; -@@ -2733,9 +2778,11 @@ void nss_skb_reuse(struct sk_buff *nbuf) +@@ -2651,9 +2696,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, @@ -281,7 +281,7 @@ Signed-off-by: Christian Marangi struct h2n_descriptor *desc_ring = desc_if->desc; struct h2n_descriptor *desc; uint16_t bit_flags; -@@ -2789,7 +2836,8 @@ static inline int32_t nss_core_send_buff +@@ -2707,7 +2754,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); @@ -291,7 +291,7 @@ Signed-off-by: Christian Marangi /* * We are done using the skb fields and can reuse it now -@@ -2813,7 +2861,8 @@ no_reuse: +@@ -2731,7 +2779,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); @@ -301,7 +301,7 @@ Signed-off-by: Christian Marangi NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_SIMPLE]); return 1; -@@ -2827,9 +2876,11 @@ no_reuse: +@@ -2745,9 +2794,11 @@ no_reuse: * Used to differentiate from FRAGLIST */ static inline int32_t nss_core_send_buffer_nr_frags(struct nss_ctx_instance *nss_ctx, @@ -315,7 +315,7 @@ Signed-off-by: Christian Marangi struct h2n_descriptor *desc_ring = desc_if->desc; struct h2n_descriptor *desc; const skb_frag_t *frag; -@@ -2869,7 +2920,8 @@ static inline int32_t nss_core_send_buff +@@ -2787,7 +2838,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); @@ -325,7 +325,7 @@ Signed-off-by: Christian Marangi /* * Now handle rest of the fragments. -@@ -2893,7 +2945,8 @@ static inline int32_t nss_core_send_buff +@@ -2811,7 +2863,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); @@ -335,7 +335,7 @@ Signed-off-by: Christian Marangi } /* -@@ -2909,7 +2962,8 @@ static inline int32_t nss_core_send_buff +@@ -2827,7 +2880,8 @@ static inline int32_t nss_core_send_buff desc->bit_flags &= ~(H2N_BIT_FLAG_DISCARD); desc->opaque = (nss_ptr_t)nbuf; @@ -345,7 +345,7 @@ Signed-off-by: Christian Marangi NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_NR_FRAGS]); return i+1; -@@ -2923,9 +2977,11 @@ static inline int32_t nss_core_send_buff +@@ -2841,9 +2895,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, @@ -359,7 +359,7 @@ Signed-off-by: Christian Marangi struct h2n_descriptor *desc_ring = desc_if->desc; struct h2n_descriptor *desc; dma_addr_t buffer; -@@ -2964,7 +3020,8 @@ static inline int32_t nss_core_send_buff +@@ -2882,7 +2938,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); @@ -369,7 +369,7 @@ Signed-off-by: Christian Marangi /* * Walk the frag_list in nbuf -@@ -3017,7 +3074,8 @@ static inline int32_t nss_core_send_buff +@@ -2935,7 +2992,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); @@ -379,7 +379,7 @@ Signed-off-by: Christian Marangi i++; } -@@ -3036,7 +3094,8 @@ static inline int32_t nss_core_send_buff +@@ -2954,7 +3012,8 @@ static inline int32_t nss_core_send_buff * Update bit flag for last descriptor. */ desc->bit_flags |= H2N_BIT_FLAG_LAST_SEGMENT; @@ -389,7 +389,7 @@ Signed-off-by: Christian Marangi NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_FRAGLIST]); return i+1; -@@ -3115,8 +3174,10 @@ int32_t nss_core_send_buffer(struct nss_ +@@ -3033,8 +3092,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. */ @@ -401,7 +401,7 @@ Signed-off-by: Christian Marangi nss_index = if_map->h2n_nss_index[qid]; h2n_desc_ring->nss_index_local = nss_index; count = ((nss_index - hlos_index - 1) + size) & (mask); -@@ -3181,13 +3242,13 @@ int32_t nss_core_send_buffer(struct nss_ +@@ -3099,13 +3160,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, @@ -418,7 +418,7 @@ Signed-off-by: Christian Marangi } if (unlikely(count <= 0)) { -@@ -3211,7 +3272,8 @@ int32_t nss_core_send_buffer(struct nss_ +@@ -3129,7 +3190,8 @@ int32_t nss_core_send_buffer(struct nss_ h2n_desc_ring->hlos_index = hlos_index; if_map->h2n_hlos_index[qid] = hlos_index; @@ -430,7 +430,7 @@ Signed-off-by: Christian Marangi #ifdef CONFIG_DEBUG_KMEMLEAK --- a/nss_core.h +++ b/nss_core.h -@@ -105,31 +105,30 @@ +@@ -100,31 +100,30 @@ #endif /* @@ -484,7 +484,7 @@ Signed-off-by: Christian Marangi --- a/nss_hal/ipq806x/nss_hal_pvt.c +++ b/nss_hal/ipq806x/nss_hal_pvt.c -@@ -474,10 +474,9 @@ static struct nss_platform_data *__nss_h +@@ -477,10 +477,9 @@ static struct nss_platform_data *__nss_h /* * Clear TCM memory used by this core */ @@ -514,7 +514,7 @@ Signed-off-by: Christian Marangi /* --- a/nss_meminfo.c +++ b/nss_meminfo.c -@@ -414,7 +414,6 @@ static bool nss_meminfo_init_block_lists +@@ -415,7 +415,6 @@ static bool nss_meminfo_init_block_lists /* * Flush the updated meminfo request. */ @@ -522,7 +522,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); /* -@@ -545,7 +544,7 @@ static bool nss_meminfo_configure_n2h_h2 +@@ -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; @@ -531,7 +531,7 @@ Signed-off-by: Christian Marangi NSS_CORE_DSB(); if_map->n2h_rings = NSS_N2H_RING_COUNT; -@@ -583,7 +582,7 @@ static bool nss_meminfo_configure_n2h_h2 +@@ -584,7 +583,7 @@ static bool nss_meminfo_configure_n2h_h2 /* * Flush the updated nss_if_mem_map. */ @@ -542,7 +542,7 @@ Signed-off-by: Christian Marangi return true; --- a/nss_profiler.c +++ b/nss_profiler.c -@@ -202,11 +202,12 @@ EXPORT_SYMBOL(nss_profile_dma_deregister +@@ -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; diff --git a/qca-nss-drv/patches/0005-nss-drv-rework-getting-the-reserved-memory-size.patch b/qca-nss-drv/patches/0005-nss-drv-rework-getting-the-reserved-memory-size.patch index ca7abbd..1adaabf 100644 --- a/qca-nss-drv/patches/0005-nss-drv-rework-getting-the-reserved-memory-size.patch +++ b/qca-nss-drv/patches/0005-nss-drv-rework-getting-the-reserved-memory-size.patch @@ -21,7 +21,7 @@ Signed-off-by: Robert Marko --- a/nss_core.c +++ b/nss_core.c -@@ -26,6 +26,8 @@ +@@ -23,6 +23,8 @@ #include #include #include @@ -30,7 +30,7 @@ Signed-off-by: Robert Marko #include #include #ifdef CONFIG_BRIDGE_NETFILTER -@@ -492,50 +494,38 @@ static void nss_core_handle_crypto_pkt(s +@@ -450,50 +452,38 @@ static void nss_core_handle_crypto_pkt(s */ static uint32_t nss_soc_mem_info(void) { diff --git a/qca-nss-drv/patches/0006-Fix-Kernel-Panic-dma-with-NULL-dev.patch b/qca-nss-drv/patches/0006-Fix-Kernel-Panic-dma-with-NULL-dev.patch new file mode 100644 index 0000000..a11dc94 --- /dev/null +++ b/qca-nss-drv/patches/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/0007-nss-drv-Fix-nss_wifili_if-compilation-error-GCC-13.patch b/qca-nss-drv/patches/0007-nss-drv-Fix-nss_wifili_if-compilation-error-GCC-13.patch index 0abeab1..df42b15 100644 --- a/qca-nss-drv/patches/0007-nss-drv-Fix-nss_wifili_if-compilation-error-GCC-13.patch +++ b/qca-nss-drv/patches/0007-nss-drv-Fix-nss_wifili_if-compilation-error-GCC-13.patch @@ -1,6 +1,6 @@ --- a/exports/nss_wifili_if.h +++ b/exports/nss_wifili_if.h -@@ -2207,7 +2207,7 @@ void nss_wifili_release_external_if(nss_ +@@ -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, diff --git a/qca-nss-drv/patches/0008-Add-kernel-6.1-support.patch b/qca-nss-drv/patches/0008-Add-kernel-6.1-support.patch index 95539ae..1d405e4 100644 --- a/qca-nss-drv/patches/0008-Add-kernel-6.1-support.patch +++ b/qca-nss-drv/patches/0008-Add-kernel-6.1-support.patch @@ -11,7 +11,7 @@ --- a/nss_hal/ipq50xx/nss_hal_pvt.c +++ b/nss_hal/ipq50xx/nss_hal_pvt.c -@@ -599,7 +599,7 @@ static int __nss_hal_request_irq(struct +@@ -598,7 +598,7 @@ static int __nss_hal_request_irq(struct return err; } @@ -22,7 +22,7 @@ if (err) { --- a/nss_hal/ipq60xx/nss_hal_pvt.c +++ b/nss_hal/ipq60xx/nss_hal_pvt.c -@@ -615,62 +615,62 @@ static int __nss_hal_request_irq(struct +@@ -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) { @@ -97,7 +97,7 @@ --- a/nss_hal/ipq806x/nss_hal_pvt.c +++ b/nss_hal/ipq806x/nss_hal_pvt.c -@@ -1185,7 +1185,7 @@ static int __nss_hal_request_irq(struct +@@ -1186,7 +1186,7 @@ static int __nss_hal_request_irq(struct } int_ctx->irq = npd->irq[irq_num]; @@ -108,7 +108,7 @@ } --- a/nss_hal/ipq807x/nss_hal_pvt.c +++ b/nss_hal/ipq807x/nss_hal_pvt.c -@@ -659,62 +659,62 @@ static int __nss_hal_request_irq(struct +@@ -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) { @@ -181,14 +181,3 @@ err = request_irq(irq, nss_hal_handle_irq, 0, "nss_profile_dma", int_ctx); } ---- a/nss_hal/ipq95xx/nss_hal_pvt.c -+++ b/nss_hal/ipq95xx/nss_hal_pvt.c -@@ -889,7 +889,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) { \ No newline at end of file diff --git a/qca-nss-drv/patches/0011-nss-drv-remove-gmac-stat.patch b/qca-nss-drv/patches/0011-nss-drv-remove-gmac-stat.patch index fceebae..8d9c849 100644 --- a/qca-nss-drv/patches/0011-nss-drv-remove-gmac-stat.patch +++ b/qca-nss-drv/patches/0011-nss-drv-remove-gmac-stat.patch @@ -1,28 +1,26 @@ --- a/nss_stats.c +++ b/nss_stats.c -@@ -392,9 +392,9 @@ void nss_stats_create_dentry(char *name, - /* - * gmac_stats_ops +@@ -398,11 +398,6 @@ void nss_stats_create_dentry(char *name, */ --#ifdef NSS_DATA_PLANE_GENERIC_SUPPORT --NSS_STATS_DECLARE_FILE_OPERATIONS(gmac); --#endif -+// #ifdef NSS_DATA_PLANE_GENERIC_SUPPORT -+// NSS_STATS_DECLARE_FILE_OPERATIONS(gmac); -+// #endif /* +- * gmac_stats_ops +- */ +-NSS_STATS_DECLARE_FILE_OPERATIONS(gmac); +- +-/* * wt_stats_ops -@@ -449,9 +449,9 @@ void nss_stats_init(void) - /* - * gmac_stats - */ --#ifdef NSS_DATA_PLANE_GENERIC_SUPPORT -- nss_stats_create_dentry("gmac", &nss_gmac_stats_ops); --#endif -+// #ifdef NSS_DATA_PLANE_GENERIC_SUPPORT -+// nss_stats_create_dentry("gmac", &nss_gmac_stats_ops); -+// #endif + */ + NSS_STATS_DECLARE_FILE_OPERATIONS(wt); +@@ -453,11 +448,6 @@ void nss_stats_init(void) + nss_drv_stats_dentry_create(); /* +- * gmac_stats +- */ +- nss_stats_create_dentry("gmac", &nss_gmac_stats_ops); +- +- /* * Per-project stats + */ + nss_top_main.project_dentry = debugfs_create_dir("project", diff --git a/qca-nss-drv/patches/0012-Makefile-modularize-driver.patch b/qca-nss-drv/patches/0012-Makefile-modularize-driver.patch new file mode 100644 index 0000000..b5bb53e --- /dev/null +++ b/qca-nss-drv/patches/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/0012-nss-drv-quiet-messages.patch b/qca-nss-drv/patches/0012-nss-drv-quiet-messages.patch deleted file mode 100644 index 9e35593..0000000 --- a/qca-nss-drv/patches/0012-nss-drv-quiet-messages.patch +++ /dev/null @@ -1,165 +0,0 @@ ---- a/nss_core.c -+++ b/nss_core.c -@@ -518,7 +518,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); - -@@ -563,7 +563,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 */ -@@ -590,7 +590,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); - /* ---- 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/ipq806x/nss_hal_pvt.c -+++ b/nss_hal/ipq806x/nss_hal_pvt.c -@@ -1081,7 +1081,7 @@ 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 "); ---- a/nss_hal/ipq807x/nss_hal_pvt.c -+++ b/nss_hal/ipq807x/nss_hal_pvt.c -@@ -570,16 +570,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/ipq95xx/nss_hal_pvt.c -+++ b/nss_hal/ipq95xx/nss_hal_pvt.c -@@ -724,19 +724,19 @@ 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_748: -- nss_info_always("748 MHz "); -+ nss_info("748 MHz "); - break; - - case NSS_FREQ_1497: -- nss_info_always("1.497 GHz "); -+ nss_info("1.497 GHz "); - break; - - case NSS_FREQ_1689: -- nss_info_always("1.689 GHz "); -+ nss_info("1.689 GHz "); - break; - - default: ---- a/nss_hal/nss_hal.c -+++ b/nss_hal/nss_hal.c -@@ -799,7 +799,7 @@ int nss_hal_probe(struct platform_device - nss_hal_enable_interrupt(nss_ctx, nss_ctx->int_ctx[i].shift_factor, NSS_HAL_SUPPORTED_INTERRUPTS); - } - -- nss_info_always("%px: All resources initialized and nss core%d has been brought out of reset", nss_ctx, nss_dev->id); -+ nss_info("%px: All resources initialized and nss core%d has been brought out of reset", nss_ctx, nss_dev->id); - goto out; - - err_register_irq: ---- a/nss_meminfo.c -+++ b/nss_meminfo.c -@@ -408,7 +408,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); - } - - /* -@@ -799,6 +799,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; - } diff --git a/qca-nss-drv/patches/0013-nss-drv-remove-legacy-wifi.patch b/qca-nss-drv/patches/0013-nss-drv-remove-legacy-wifi.patch index e5f8376..c159e98 100644 --- a/qca-nss-drv/patches/0013-nss-drv-remove-legacy-wifi.patch +++ b/qca-nss-drv/patches/0013-nss-drv-remove-legacy-wifi.patch @@ -1,27 +1,6 @@ ---- a/Makefile -+++ b/Makefile -@@ -352,10 +352,17 @@ 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 \ -+ 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 \ --- a/nss_hal/nss_hal.c +++ b/nss_hal/nss_hal.c -@@ -593,7 +593,9 @@ int nss_hal_probe(struct platform_device +@@ -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; diff --git a/qca-nss-drv/patches/0014-nss-drv-avoid-recreating-virt_if.patch b/qca-nss-drv/patches/0014-nss-drv-avoid-recreating-virt_if.patch index 6799f79..3de48d4 100644 --- a/qca-nss-drv/patches/0014-nss-drv-avoid-recreating-virt_if.patch +++ b/qca-nss-drv/patches/0014-nss-drv-avoid-recreating-virt_if.patch @@ -1,6 +1,6 @@ --- a/nss_stats.c +++ b/nss_stats.c -@@ -380,8 +380,9 @@ size_t nss_stats_print(char *node, char +@@ -388,8 +388,9 @@ size_t nss_stats_print(char *node, char */ void nss_stats_create_dentry(char *name, const struct file_operations *ops) { diff --git a/qca-nss-drv/patches/0016-nss-drv-add-4address-exception.patch b/qca-nss-drv/patches/0016-nss-drv-add-4address-exception.patch new file mode 100644 index 0000000..60faf24 --- /dev/null +++ b/qca-nss-drv/patches/0016-nss-drv-add-4address-exception.patch @@ -0,0 +1,45 @@ +--- 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. */ + }; + + /**