diff --git a/qca-nss-clients/Makefile b/qca-nss-clients/Makefile index 62d2164..df3d0b9 100644 --- a/qca-nss-clients/Makefile +++ b/qca-nss-clients/Makefile @@ -5,10 +5,10 @@ PKG_NAME:=qca-nss-clients PKG_RELEASE:=2 PKG_JOBS=-j4 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-clients -PKG_SOURCE_DATE:=2020-10-29 +PKG_SOURCE_DATE:=2020-01-06 PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=ef082a735fad96bd2f6f59b94d6ea81defc4796e -PKG_MIRROR_HASH:=9375f2bbdd17826b6ddebc77607ec73c98626570243a9831a1e34e1051eb436c +PKG_SOURCE_VERSION:=1c60cab4a2d40d81a023d4788da36e0e42ca28d3 +PKG_MIRROR_HASH:=d26946b38e2901ea751b0f4b09f7e594c4c6da26b8c1b6c0539c4069ae5d4a91 include $(INCLUDE_DIR)/package.mk diff --git a/qca-nss-clients/patches/0001-kernel-5.10.patch b/qca-nss-clients/patches/0001-kernel-5.10.patch index 814b2bb..b65a0d9 100644 --- a/qca-nss-clients/patches/0001-kernel-5.10.patch +++ b/qca-nss-clients/patches/0001-kernel-5.10.patch @@ -1,77 +1,67 @@ ---- a/Makefile -+++ b/Makefile -@@ -10,14 +10,11 @@ qca-nss-tun6rd-objs := nss_connmgr_tun6r - ccflags-y += -DNSS_TUN6RD_DEBUG_LEVEL=0 +--- a/vlan/Makefile ++++ b/vlan/Makefile +@@ -8,5 +8,5 @@ ifeq ($(SoC),$(filter $(SoC),ipq807x ipq + ccflags-y += -DNSS_VLAN_MGR_PPE_SUPPORT + endif + +-ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=0 ++ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=4 ccflags-y += -Werror - --KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION))) -- - obj-$(bridge-mgr)+= bridge/ - obj-$(capwapmgr)+= capwapmgr/ - obj-$(dtlsmgr)+= dtls/$(DTLSMGR_DIR)/ - obj-$(gre)+= gre/ - obj-$(ipsecmgr)+= ipsecmgr/$(IPSECMGR_DIR)/ --obj-$(ipsecmgr-klips)+= ipsecmgr/$(IPSECMGR_DIR)/plugins/klips/ - obj-$(l2tpv2)+= l2tp/l2tpv2/ - obj-$(lag-mgr)+= lag/ - obj-$(map-t)+= map/map-t/ ---- a/eogremgr/nss_eogremgr.c -+++ b/eogremgr/nss_eogremgr.c -@@ -19,6 +19,7 @@ - * NSS EOGRE manager - */ - -+#include - #include - #include - #include "nss_connmgr_gre_public.h" ---- a/gre/nss_connmgr_gre_v4.c -+++ b/gre/nss_connmgr_gre_v4.c -@@ -162,14 +162,6 @@ int nss_connmgr_gre_v4_set_config(struct - } +\ No newline at end of file +--- a/bridge/nss_bridge_mgr.c ++++ b/bridge/nss_bridge_mgr.c +@@ -1209,8 +1209,10 @@ static int nss_bridge_mgr_register_event + */ + b_pvt->ifnum = ifnum; + b_pvt->mtu = dev->mtu; ++#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT) + b_pvt->wan_if_num = -1; + b_pvt->wan_if_enabled = false; ++#endif + ether_addr_copy(b_pvt->dev_addr, dev->dev_addr); + spin_lock(&br_mgr_ctx.lock); + list_add(&b_pvt->list, &br_mgr_ctx.list); +--- a/bridge/nss_bridge_mgr.c ++++ b/bridge/nss_bridge_mgr.c +@@ -995,6 +995,7 @@ static int nss_bridge_mgr_bond_slave_cha + return NOTIFY_DONE; } -- /* -- * IP address validate -- */ -- if ((cfg->src_ip == 0) || (cfg->dest_ip == 0)) { -- nss_connmgr_gre_warning("Source ip/Destination IP is invalid"); -- return GRE_ERR_INVALID_IP; -- } -- - memset(t, 0, sizeof(struct ip_tunnel)); ++#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT) + /* + * Add or remove the slave based based on linking event + */ +--- a/bridge/nss_bridge_mgr.c ++++ b/bridge/nss_bridge_mgr.c +@@ -1010,6 +1010,7 @@ static int nss_bridge_mgr_bond_slave_cha + cu_info->upper_dev->name, master->name); + } + } ++#endif - priv->pad_len = (cfg->add_padding) ? GRE_HDR_PAD_LEN : 0; ---- a/gre/nss_connmgr_gre_v6.c -+++ b/gre/nss_connmgr_gre_v6.c -@@ -95,7 +95,8 @@ static int nss_connmgr_gre_v6_get_mac_ad - /* - * Find src MAC address - */ -- local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, 1); -+ local_dev = NULL; -+ local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, local_dev); - if (!local_dev) { - nss_connmgr_gre_warning("Unable to find local dev for %pI6", src_ip); - return GRE_ERR_NO_LOCAL_NETDEV; -@@ -106,7 +107,6 @@ static int nss_connmgr_gre_v6_get_mac_ad - /* - * Find dest MAC address - */ -- - rt = nss_connmgr_gre_v6_route_lookup(&init_net, &dst_addr); - if (!rt) { - nss_connmgr_gre_warning("Unable to find route lookup for %pI6", dest_ip); -@@ -140,8 +140,7 @@ static int nss_connmgr_gre_v6_get_mac_ad - * Release hold on existing route entry, and find the route entry again - */ - ip6_rt_put(rt); -- -- rt = nss_connmgr_gre_v6_route_lookup(&init_net, &dst_addr); -+ rt = rt6_lookup(&init_net, &dst_addr, NULL, 0, NULL, 0); - if (!rt) { - nss_connmgr_gre_warning("Unable to find route lookup for %pI6\n", dest_ip); - return GRE_ERR_NEIGH_LOOKUP; + return NOTIFY_DONE; + } +--- a/clmapmgr/nss_clmapmgr.c ++++ b/clmapmgr/nss_clmapmgr.c +@@ -109,7 +109,6 @@ struct rtnl_link_stats64 *nss_clmapmgr_d + memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64)); + dev_put(dev); + +- return stats; + } + + /* +--- a/dtls/v1.0/nss_connmgr_dtls_netdev.c ++++ b/dtls/v1.0/nss_connmgr_dtls_netdev.c +@@ -160,7 +160,7 @@ static void nss_dtlsmgr_dev_setup(struct + dev->ethtool_ops = NULL; + dev->header_ops = NULL; + dev->netdev_ops = &nss_dtlsmgr_session_ops; +- dev->destructor = NULL; ++ dev->priv_destructor = NULL; + + memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len); + memset(dev->broadcast, 0xff, dev->addr_len); --- a/gre/test/nss_connmgr_gre_test.c +++ b/gre/test/nss_connmgr_gre_test.c @@ -229,10 +229,12 @@ static int nss_connmgr_gre_test_open_pro @@ -91,53 +81,35 @@ }; /* ---- a/ipsecmgr/v1.0/nss_ipsecmgr.c -+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c -@@ -377,7 +377,7 @@ free: - * nss_ipsecmgr_tunnel_stats() - * get tunnel statistics - */ --static struct rtnl_link_stats64 *nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) -+void nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) - { - struct nss_ipsecmgr_priv *priv = netdev_priv(dev); +--- a/gre/nss_connmgr_gre_v4.c ++++ b/gre/nss_connmgr_gre_v4.c +@@ -168,14 +168,6 @@ int nss_connmgr_gre_v4_set_config(struct + } + } -@@ -389,8 +389,6 @@ static struct rtnl_link_stats64 *nss_ips - read_lock_bh(&ipsecmgr_ctx->lock); - memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64)); - read_unlock_bh(&ipsecmgr_ctx->lock); +- /* +- * IP address validate +- */ +- if ((cfg->src_ip == 0) || (cfg->dest_ip == 0)) { +- nss_connmgr_gre_warning("Source ip/Destination IP is invalid"); +- return GRE_ERR_INVALID_IP; +- } - -- return stats; - } - - /* -@@ -442,7 +440,7 @@ static void nss_ipsecmgr_tunnel_setup(st - dev->header_ops = NULL; - dev->netdev_ops = &nss_ipsecmgr_tunnel_ops; - -- dev->destructor = nss_ipsecmgr_tunnel_free; -+ dev->priv_destructor = nss_ipsecmgr_tunnel_free; + memset(t, 0, sizeof(struct ip_tunnel)); + priv->pad_len = (cfg->add_padding) ? GRE_HDR_PAD_LEN : 0; +--- a/gre/nss_connmgr_gre_v6.c ++++ b/gre/nss_connmgr_gre_v6.c +@@ -81,7 +81,8 @@ static int nss_connmgr_gre_v6_get_mac_ad /* - * get the MAC address from the ethernet device ---- a/ipsecmgr/v1.0/nss_ipsecmgr_sa.c -+++ b/ipsecmgr/v1.0/nss_ipsecmgr_sa.c -@@ -265,6 +265,7 @@ static bool nss_ipsecmgr_sa_del(struct n - write_unlock_bh(&ipsecmgr_ctx->lock); - return true; - } -+EXPORT_SYMBOL(nss_ipsecmgr_sa_del); - - /* - * nss_ipsecmgr_sa_add() -@@ -357,6 +358,7 @@ static bool nss_ipsecmgr_sa_add(struct n - write_unlock_bh(&ipsecmgr_ctx->lock); - return true; - } -+EXPORT_SYMBOL(nss_ipsecmgr_sa_add); - - /* - * nss_ipsecmgr_sa_alloc() + * Find src MAC address + */ +- local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, 1); ++ local_dev = NULL; ++ local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, local_dev); + if (!local_dev) { + nss_connmgr_gre_warning("Unable to find local dev for %pI6", src_ip); + return GRE_ERR_NO_LOCAL_NETDEV; --- a/l2tp/l2tpv2/nss_connmgr_l2tpv2.c +++ b/l2tp/l2tpv2/nss_connmgr_l2tpv2.c @@ -244,7 +244,7 @@ static struct nss_connmgr_l2tpv2_session @@ -149,6 +121,8 @@ data->l2tpv2.session.hdr_len = session->hdr_len; data->l2tpv2.session.reorder_timeout = session->reorder_timeout; data->l2tpv2.session.recv_seq = session->recv_seq; +--- a/l2tp/l2tpv2/nss_connmgr_l2tpv2.c ++++ b/l2tp/l2tpv2/nss_connmgr_l2tpv2.c @@ -253,7 +253,7 @@ static struct nss_connmgr_l2tpv2_session nss_connmgr_l2tpv2_info("sess %u, peer=%u nr=%u ns=%u off=%u hdr_len=%u timeout=%x" " recv_seq=%x send_seq=%x\n", @@ -175,6 +149,80 @@ /* * ---------------------------------------------------------------------------------- +--- a/exports/nss_dtlsmgr.h ++++ b/exports/nss_dtlsmgr.h +@@ -100,7 +100,7 @@ enum nss_dtlsmgr_metadata_result { + * NSS DTLS manager cryptographic structure to represent key and its length. + */ + struct nss_dtlsmgr_crypto_data { +- const uint8_t *data; /**< Pointer to key or nonce. */ ++ uint8_t *data; /**< Pointer to key or nonce. */ + uint16_t len; /**< Length of the key. */ + }; + +--- a/eogremgr/nss_eogremgr.c ++++ b/eogremgr/nss_eogremgr.c +@@ -19,6 +19,7 @@ + * NSS EOGRE manager + */ + ++#include + #include + #include + #include "nss_connmgr_gre_public.h" +--- a/ipsecmgr/v1.0/nss_ipsecmgr.c ++++ b/ipsecmgr/v1.0/nss_ipsecmgr.c +@@ -377,7 +377,7 @@ free: + * nss_ipsecmgr_tunnel_stats() + * get tunnel statistics + */ +-static struct rtnl_link_stats64 *nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) ++void nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) + { + struct nss_ipsecmgr_priv *priv = netdev_priv(dev); + +--- a/ipsecmgr/v1.0/nss_ipsecmgr.c ++++ b/ipsecmgr/v1.0/nss_ipsecmgr.c +@@ -389,8 +389,6 @@ void nss_ipsecmgr_tunnel_stats64(struct + read_lock_bh(&ipsecmgr_ctx->lock); + memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64)); + read_unlock_bh(&ipsecmgr_ctx->lock); +- +- return stats; + } + + /* +--- a/ipsecmgr/v1.0/nss_ipsecmgr.c ++++ b/ipsecmgr/v1.0/nss_ipsecmgr.c +@@ -440,7 +440,7 @@ static void nss_ipsecmgr_tunnel_setup(st + dev->header_ops = NULL; + dev->netdev_ops = &nss_ipsecmgr_tunnel_ops; + +- dev->destructor = nss_ipsecmgr_tunnel_free; ++ dev->priv_destructor = nss_ipsecmgr_tunnel_free; + + /* + * get the MAC address from the ethernet device +--- a/ipsecmgr/v1.0/nss_ipsecmgr_sa.c ++++ b/ipsecmgr/v1.0/nss_ipsecmgr_sa.c +@@ -265,6 +265,7 @@ static bool nss_ipsecmgr_sa_del(struct n + write_unlock_bh(&ipsecmgr_ctx->lock); + return true; + } ++EXPORT_SYMBOL(nss_ipsecmgr_sa_del); + + /* + * nss_ipsecmgr_sa_add() +--- a/ipsecmgr/v1.0/nss_ipsecmgr_sa.c ++++ b/ipsecmgr/v1.0/nss_ipsecmgr_sa.c +@@ -358,6 +358,7 @@ static bool nss_ipsecmgr_sa_add(struct n + write_unlock_bh(&ipsecmgr_ctx->lock); + return true; + } ++EXPORT_SYMBOL(nss_ipsecmgr_sa_add); + + /* + * nss_ipsecmgr_sa_alloc() --- a/l2tp/l2tpv2/nss_l2tpv2_stats.c +++ b/l2tp/l2tpv2/nss_l2tpv2_stats.c @@ -21,6 +21,7 @@ @@ -185,7 +233,9 @@ #include #include #include -@@ -103,14 +104,14 @@ void nss_l2tpv2_update_dev_stats(struct +--- a/l2tp/l2tpv2/nss_l2tpv2_stats.c ++++ b/l2tp/l2tpv2/nss_l2tpv2_stats.c +@@ -104,14 +104,14 @@ void nss_l2tpv2_update_dev_stats(struct /* * Update tunnel & session stats */ @@ -202,44 +252,9 @@ if (!session) { tunnel_put(tunnel); dev_put(dev); ---- a/match/nss_match.c -+++ b/match/nss_match.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - - /* - * nss_match_verify_config_msg() ---- a/match/nss_match_priv.h -+++ b/match/nss_match_priv.h -@@ -29,19 +29,19 @@ - /* - * Statically compile messages at different levels - */ --#if (NSS_match_DEBUG_LEVEL < 2) -+#if (NSS_MATCH_DEBUG_LEVEL < 2) - #define nss_match_warn(s, ...) - #else - #define nss_match_warn(s, ...) pr_warn("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__) - #endif - --#if (NSS_match_DEBUG_LEVEL < 3) -+#if (NSS_MATCH_DEBUG_LEVEL < 3) - #define nss_match_info(s, ...) - #else - #define nss_match_info(s, ...) pr_notice("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__) - #endif - --#if (NSS_match_DEBUG_LEVEL < 4) -+#if (NSS_MATCH_DEBUG_LEVEL < 4) - #define nss_match_trace(s, ...) - #else - #define nss_match_trace(s, ...) pr_info("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__) --- a/portifmgr/nss_portifmgr.c +++ b/portifmgr/nss_portifmgr.c -@@ -187,16 +187,20 @@ drop: +@@ -188,16 +188,20 @@ drop: } /* @@ -263,7 +278,9 @@ } /* -@@ -225,7 +229,7 @@ static const struct net_device_ops nss_p +--- a/portifmgr/nss_portifmgr.c ++++ b/portifmgr/nss_portifmgr.c +@@ -230,7 +230,7 @@ static const struct net_device_ops nss_p .ndo_start_xmit = nss_portifmgr_start_xmit, .ndo_set_mac_address = eth_mac_addr, .ndo_change_mtu = nss_portifmgr_change_mtu, @@ -272,6 +289,60 @@ }; /* +--- a/vlan/nss_vlan_mgr.c ++++ b/vlan/nss_vlan_mgr.c +@@ -820,8 +820,10 @@ static struct nss_vlan_pvt *nss_vlan_mgr + */ + static void nss_vlan_mgr_instance_free(struct nss_vlan_pvt *v) + { ++#ifdef NSS_VLAN_MGR_PPE_SUPPORT + int32_t i; + int ret = 0; ++#endif + + spin_lock(&vlan_mgr_ctx.lock); + BUG_ON(--v->refs); +--- a/vlan/nss_vlan_mgr.c ++++ b/vlan/nss_vlan_mgr.c +@@ -981,8 +981,11 @@ static int nss_vlan_mgr_register_event(s + int ret; + #endif + uint32_t vlan_tag; ++#ifdef NSS_VLAN_MGR_PPE_SUPPORT + struct net_device *slave; +- int32_t port, port_if; ++ int32_t port; ++#endif ++ int32_t port_if; + struct vlan_dev_priv *vlan; + struct net_device *real_dev; + bool is_bond_master = false; +--- a/vlan/nss_vlan_mgr.c ++++ b/vlan/nss_vlan_mgr.c +@@ -1359,8 +1359,10 @@ return_with_error: + int nss_vlan_mgr_join_bridge(struct net_device *dev, uint32_t bridge_vsi) + { + struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev); ++#ifdef NSS_VLAN_MGR_PPE_SUPPORT + struct net_device *real_dev; + int ret; ++#endif + + if (!v) + return 0; +--- a/vlan/nss_vlan_mgr.c ++++ b/vlan/nss_vlan_mgr.c +@@ -1422,8 +1422,10 @@ EXPORT_SYMBOL(nss_vlan_mgr_join_bridge); + int nss_vlan_mgr_leave_bridge(struct net_device *dev, uint32_t bridge_vsi) + { + struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev); ++#ifdef NSS_VLAN_MGR_PPE_SUPPORT + struct net_device *real_dev; + int ret; ++#endif + + if (!v) + return 0; --- a/profiler/profile.c +++ b/profiler/profile.c @@ -31,6 +31,7 @@ @@ -282,7 +353,9 @@ #include #include #include -@@ -937,12 +938,26 @@ static ssize_t debug_if(struct file *fil +--- a/profiler/profile.c ++++ b/profiler/profile.c +@@ -891,12 +891,26 @@ static ssize_t debug_if(struct file *fil return count; } @@ -309,7 +382,9 @@ /* * showing sample status on Linux console -@@ -971,6 +986,15 @@ static ssize_t profile_rate_write(struct +--- a/profiler/profile.c ++++ b/profiler/profile.c +@@ -939,6 +939,15 @@ static ssize_t profile_rate_write(struct return 0; } @@ -325,7 +400,9 @@ static const struct file_operations profile_rate_fops = { .open = profile_rate_open, .read = seq_read, -@@ -978,6 +1002,7 @@ static const struct file_operations prof +--- a/profiler/profile.c ++++ b/profiler/profile.c +@@ -955,6 +955,7 @@ static const struct file_operations prof .release = single_release, .write = profile_rate_write, }; @@ -333,158 +410,3 @@ /* * hexdump ---- a/vlan/Makefile -+++ b/vlan/Makefile -@@ -8,7 +8,7 @@ ifeq ($(SoC),$(filter $(SoC),ipq807x ipq - ccflags-y += -DNSS_VLAN_MGR_PPE_SUPPORT - endif - --ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=0 -+ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=4 - ccflags-y += -Werror - - ifneq (,$(filter $(CONFIG_BONDING),y m)) ---- a/vlan/nss_vlan_mgr.c -+++ b/vlan/nss_vlan_mgr.c -@@ -821,8 +821,10 @@ static struct nss_vlan_pvt *nss_vlan_mgr - */ - static void nss_vlan_mgr_instance_free(struct nss_vlan_pvt *v) - { -+#ifdef NSS_VLAN_MGR_PPE_SUPPORT - int32_t i; - int ret = 0; -+#endif - - spin_lock(&vlan_mgr_ctx.lock); - BUG_ON(--v->refs); -@@ -980,8 +982,11 @@ static int nss_vlan_mgr_register_event(s - int ret; - #endif - uint32_t vlan_tag; -+#ifdef NSS_VLAN_MGR_PPE_SUPPORT - struct net_device *slave; -- int32_t port, port_if; -+ int32_t port; -+#endif -+ int32_t port_if; - struct vlan_dev_priv *vlan; - struct net_device *real_dev; - bool is_bond_master = false; -@@ -1355,8 +1360,10 @@ return_with_error: - int nss_vlan_mgr_join_bridge(struct net_device *dev, uint32_t bridge_vsi) - { - struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev); -+#ifdef NSS_VLAN_MGR_PPE_SUPPORT - struct net_device *real_dev; - int ret; -+#endif - - if (!v) - return 0; -@@ -1416,8 +1423,10 @@ EXPORT_SYMBOL(nss_vlan_mgr_join_bridge); - int nss_vlan_mgr_leave_bridge(struct net_device *dev, uint32_t bridge_vsi) - { - struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev); -+#ifdef NSS_VLAN_MGR_PPE_SUPPORT - struct net_device *real_dev; - int ret; -+#endif - - if (!v) - return 0; ---- a/bridge/nss_bridge_mgr.c -+++ b/bridge/nss_bridge_mgr.c -@@ -1067,8 +1067,10 @@ int nss_bridge_mgr_register_br(struct ne - */ - b_pvt->ifnum = ifnum; - b_pvt->mtu = dev->mtu; -+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT) - b_pvt->wan_if_num = -1; - b_pvt->wan_if_enabled = false; -+#endif - ether_addr_copy(b_pvt->dev_addr, dev->dev_addr); - spin_lock(&br_mgr_ctx.lock); - list_add(&b_pvt->list, &br_mgr_ctx.list); -@@ -1130,6 +1132,7 @@ static int nss_bridge_mgr_bond_slave_cha - return NOTIFY_DONE; - } - -+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT) - /* - * Add or remove the slave based based on linking event - */ -@@ -1144,6 +1147,7 @@ static int nss_bridge_mgr_bond_slave_cha - cu_info->upper_dev->name, master->name); - } - } -+#endif - - return NOTIFY_DONE; - } ---- a/dtls/v1.0/nss_connmgr_dtls_netdev.c -+++ b/dtls/v1.0/nss_connmgr_dtls_netdev.c -@@ -160,7 +160,7 @@ static void nss_dtlsmgr_dev_setup(struct - dev->ethtool_ops = NULL; - dev->header_ops = NULL; - dev->netdev_ops = &nss_dtlsmgr_session_ops; -- dev->destructor = NULL; -+ dev->priv_destructor = NULL; - - memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len); - memset(dev->broadcast, 0xff, dev->addr_len); ---- a/exports/nss_dtlsmgr.h -+++ b/exports/nss_dtlsmgr.h -@@ -128,7 +128,7 @@ enum nss_dtlsmgr_metadata_result { - * NSS DTLS manager cryptographic structure to represent key and its length. - */ - struct nss_dtlsmgr_crypto_data { -- const uint8_t *data; /**< Pointer to key or nonce. */ -+ uint8_t *data; /**< Pointer to key or nonce. */ - uint16_t len; /**< Length of the key. */ - }; - ---- a/clmapmgr/nss_clmapmgr.c -+++ b/clmapmgr/nss_clmapmgr.c -@@ -87,14 +87,13 @@ fail: - * nss_clmapmgr_dev_stats64() - * Netdev ops function to retrieve stats. - */ --struct rtnl_link_stats64 *nss_clmapmgr_dev_stats64(struct net_device *dev, -+void nss_clmapmgr_dev_stats64(struct net_device *dev, - struct rtnl_link_stats64 *stats) - { - struct nss_clmapmgr_priv_t *priv; - - if (!stats) { - nss_clmapmgr_warning("%px: invalid rtnl structure\n", dev); -- return stats; - } - - dev_hold(dev); -@@ -109,7 +108,6 @@ struct rtnl_link_stats64 *nss_clmapmgr_d - memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64)); - dev_put(dev); - -- return stats; - } - - /* ---- a/tls/nss_tlsmgr_tun.c -+++ b/tls/nss_tlsmgr_tun.c -@@ -102,7 +102,7 @@ static int nss_tlsmgr_tun_open(struct ne - * nss_tlsmgr_tun_stats64() - * TLS manager tunnel device - */ --static struct rtnl_link_stats64 *nss_tlsmgr_tun_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) -+void nss_tlsmgr_tun_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) - { - struct nss_tlsmgr_tun *tun = netdev_priv(dev); - -@@ -113,7 +113,6 @@ static struct rtnl_link_stats64 *nss_tls - nss_tlsmgr_ctx_stats_copy(&tun->ctx_dec, stats); - read_unlock_bh(&tun->lock); - -- return stats; - } - - /* diff --git a/qca-nss-clients/patches/0002-11.4-netlink.patch b/qca-nss-clients/patches/0002-11.4-netlink.patch deleted file mode 100644 index 61dfde0..0000000 --- a/qca-nss-clients/patches/0002-11.4-netlink.patch +++ /dev/null @@ -1,2643 +0,0 @@ ---- a/netlink/include/nss_nldtls_if.h -+++ b/netlink/include/nss_nldtls_if.h -@@ -34,9 +34,9 @@ - #define NSS_NLDTLS_DECAP_SIDE 1 - #define NSS_NLDTLS_TX_PKTS_MODE_END_TO_END 0 - #define NSS_NLDTLS_TX_PKTS_MODE_HOST_TO_HOST 1 --#define NSS_NLDTLS_CKD_MAX 32 --#define NSS_NLDTLS_AKD_MAX 32 --#define NSS_NLDTLS_ND_MAX 20 -+#define NSS_NLDTLS_CIPHER_KEY_MAX 32 -+#define NSS_NLDTLS_AUTH_KEY_MAX 64 -+#define NSS_NLDTLS_NONCE_SIZE_MAX 4 - - /** - * @brief Enumeration for all command types. -@@ -51,11 +51,36 @@ enum nss_nldtls_cmd_type { - }; - - /** -+ * @brief Parameters for crypto keys -+ */ -+struct nss_nldtls_crypto_keys { -+ uint8_t cipher[NSS_NLDTLS_CIPHER_KEY_MAX]; /**< Cipher key data */ -+ uint8_t auth[NSS_NLDTLS_CIPHER_KEY_MAX]; /**< Cipher key data */ -+ uint8_t nonce[NSS_NLDTLS_CIPHER_KEY_MAX]; /**< Cipher key data */ -+}; -+ -+/** -+ * @brief Parameters for encap configuration -+ */ -+struct nss_nldtls_encap_config { -+ struct nss_dtlsmgr_encap_config cfg; -+ struct nss_nldtls_crypto_keys keys; -+}; -+ -+/** -+ * @brief Parameter for decap configuration -+ */ -+struct nss_nldtls_decap_config { -+ struct nss_dtlsmgr_decap_config cfg; -+ struct nss_nldtls_crypto_keys keys; -+}; -+ -+/** - * @brief Parameters to create a tunnel. - */ - struct nss_nldtls_create_tun { -- struct nss_dtlsmgr_encap_config encap; /**< Encap data. */ -- struct nss_dtlsmgr_decap_config decap; /**< Decap data. */ -+ struct nss_nldtls_encap_config encap; /**< Encap data. */ -+ struct nss_nldtls_decap_config decap; /**< Decap data. */ - uint32_t flags; /**< DTLS header flags. */ - uint32_t from_mtu; /**< Mtu of incoming interface. */ - uint32_t to_mtu; /**< Mtu of outgoing interface. */ -@@ -77,6 +102,7 @@ struct nss_nldtls_destroy_tun { - */ - struct nss_nldtls_update_config { - struct nss_dtlsmgr_config_update config_update; /**< Update config params */ -+ struct nss_nldtls_crypto_keys keys; /**< Crypto keys. */ - uint16_t epoch; /**< Dtls encap epoch. */ - uint16_t window_sz; /**< Dtls window size parameter. */ - char dev_name[IFNAMSIZ]; /**< Device whose config to be updated. */ -@@ -88,10 +114,11 @@ struct nss_nldtls_update_config { - */ - struct nss_nldtls_tx_pkts { - uint32_t num_pkts; /**< Number of packets to be transmitted */ -+ uint32_t seq_num; /**< starting sequence number */ - uint16_t pkt_sz; /**< Size of packet to be transmitted */ - char dev_name[IFNAMSIZ]; /**< Device used for transmission */ -- uint8_t ip_version; /**< Ip version [4 or 6] */ - uint8_t mode; /**< Can be end_to_end or host_to_host*/ -+ uint8_t ctype; /**< dtls content type */ - bool log_en; /**< Enable or disable wireless info */ - }; - ---- a/netlink/nss_nl.h -+++ b/netlink/nss_nl.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2015,2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2015,2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -25,6 +25,7 @@ - #define NSS_NL_DEBUG_LVL_WARN 2 - #define NSS_NL_DEBUG_LVL_INFO 3 - #define NSS_NL_DEBUG_LVL_TRACE 4 -+#define GENL_ID_GENERATE 0 - - - #if defined(CONFIG_DYNAMIC_DEBUG) -@@ -35,7 +36,8 @@ - #define nss_nl_warn(s, ...) pr_debug("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__) - #define nss_nl_info(s, ...) pr_debug("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__) - #define nss_nl_trace(s, ...) pr_debug("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__) -- -+#define nss_nl_hex_dump_bytes(prefix_str, prefix_type, buf, len) \ -+ dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true) - #else - /* - * Statically compile messages at different levels -@@ -55,6 +57,11 @@ - pr_notice("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__); \ - } \ - } -+#define nss_nl_hex_dump_bytes(prefix_str, prefix_type, buf, len) { \ -+ if (NSS_NL_DEBUG_LEVEL > NSS_NL_DEBUG_LVL_INFO) { \ -+ print_hex_dump_bytes(prefix_str, prefix_type, buf, len); \ -+ } \ -+} - #define nss_nl_trace(s, ...) { \ - if (NSS_NL_DEBUG_LEVEL > NSS_NL_DEBUG_LVL_TRACE) { \ - pr_info("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__); \ ---- a/netlink/nss_nlc2c_rx.c -+++ b/netlink/nss_nlc2c_rx.c -@@ -46,20 +46,6 @@ static int nss_nlc2c_rx_ops_get_stats(st - static int nss_nlc2c_rx_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * c2c_rx family definition -- */ --static struct genl_family nss_nlc2c_rx_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLC2C_RX_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_c2c_rx_stats_notification), /* NSS NETLINK c2c_rx stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLC2C_RX version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nlc2c_rx_mcgrp[] = { -@@ -74,6 +60,26 @@ static struct genl_ops nss_nlc2c_rx_ops[ - }; - - /* -+ * c2c_rx family definition -+ */ -+static struct genl_family nss_nlc2c_rx_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLC2C_RX_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_c2c_rx_stats_notification), /* NSS NETLINK c2c_rx stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLC2C_RX version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlc2c_rx_ops, -+ .n_ops = ARRAY_SIZE(nss_nlc2c_rx_ops), -+ .mcgrps = nss_nlc2c_rx_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlc2c_rx_mcgrp) -+}; -+ -+/* - * stats call back handler for c2c_rx from NSS - */ - static struct notifier_block nss_c2c_rx_stats_notifier_nb = { -@@ -125,7 +131,7 @@ bool nss_nlc2c_rx_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlc2c_rx_family, nss_nlc2c_rx_ops, nss_nlc2c_rx_mcgrp); -+ error = genl_register_family(&nss_nlc2c_rx_family); - if (error) { - nss_nl_info_always("Error: unable to register c2c_rx family\n"); - return false; ---- a/netlink/nss_nlc2c_tx.c -+++ b/netlink/nss_nlc2c_tx.c -@@ -46,20 +46,6 @@ static int nss_nlc2c_tx_ops_get_stats(st - static int nss_nlc2c_tx_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * c2c_tx family definition -- */ --static struct genl_family nss_nlc2c_tx_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLC2C_TX_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_c2c_tx_stats_notification), /* NSS NETLINK c2c_tx stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLC2C_TX version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nlc2c_tx_mcgrp[] = { -@@ -74,6 +60,26 @@ static struct genl_ops nss_nlc2c_tx_ops[ - }; - - /* -+ * c2c_tx family definition -+ */ -+static struct genl_family nss_nlc2c_tx_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLC2C_TX_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_c2c_tx_stats_notification), /* NSS NETLINK c2c_tx stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLC2C_TX version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlc2c_tx_ops, -+ .n_ops = ARRAY_SIZE(nss_nlc2c_tx_ops), -+ .mcgrps = nss_nlc2c_tx_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlc2c_tx_mcgrp) -+}; -+ -+/* - * stats call back handler for c2c_tx from NSS - */ - static struct notifier_block nss_c2c_tx_stats_notifier_nb = { -@@ -125,7 +131,7 @@ bool nss_nlc2c_tx_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlc2c_tx_family, nss_nlc2c_tx_ops, nss_nlc2c_tx_mcgrp); -+ error = genl_register_family(&nss_nlc2c_tx_family); - if (error) { - nss_nl_info_always("Error: unable to register c2c_tx family\n"); - return false; ---- a/netlink/nss_nldtls.c -+++ b/netlink/nss_nldtls.c -@@ -15,6 +15,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -34,6 +35,14 @@ - #include "nss_nldtls_if.h" - - /* -+ * prototypes -+ */ -+static int nss_nldtls_ops_create_tun(struct sk_buff *skb, struct genl_info *info); -+static int nss_nldtls_ops_destroy_tun(struct sk_buff *skb, struct genl_info *info); -+static int nss_nldtls_ops_update_config(struct sk_buff *skb, struct genl_info *info); -+static int nss_nldtls_ops_tx_pkts(struct sk_buff *skb, struct genl_info *info); -+ -+/* - * Initializing the global variables - */ - static struct nss_nldtls_gbl_ctx gbl_ctx = { -@@ -52,11 +61,24 @@ static const struct genl_multicast_group - }; - - /* -+ * nss_nldtls_ops -+ * Operation table called by the generic netlink layer based on the command -+ */ -+static struct genl_ops nss_nldtls_ops[] = { -+ {.cmd = NSS_NLDTLS_CMD_TYPE_CREATE_TUN, .doit = nss_nldtls_ops_create_tun,}, -+ {.cmd = NSS_NLDTLS_CMD_TYPE_DESTROY_TUN, .doit = nss_nldtls_ops_destroy_tun,}, -+ {.cmd = NSS_NLDTLS_CMD_TYPE_UPDATE_CONFIG, .doit = nss_nldtls_ops_update_config,}, -+ {.cmd = NSS_NLDTLS_CMD_TYPE_TX_PKTS, .doit = nss_nldtls_ops_tx_pkts,}, -+}; -+ -+/* - * nss_nldtls_family - * Dtls family definition - */ - struct genl_family nss_nldtls_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) - .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif - .name = NSS_NLDTLS_FAMILY, /* family name string */ - .hdrsize = sizeof(struct nss_nldtls_rule), /* NSS NETLINK dtls rule */ - .version = NSS_NL_VER, /* Set it to NSS_NLDTLS version */ -@@ -64,13 +86,17 @@ struct genl_family nss_nldtls_family = { - .netnsok = true, - .pre_doit = NULL, - .post_doit = NULL, -+ .ops = nss_nldtls_ops, -+ .n_ops = ARRAY_SIZE(nss_nldtls_ops), -+ .mcgrps = nss_nldtls_family_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nldtls_family_mcgrp) - }; - - /* -- * nss_nldtls_find_dtls_tun_gbl_ctx() -+ * nss_nldtls_find_tun_ctx() - * Returns the global context object of a tunnel - */ --static struct nss_nldtls_tun_ctx *nss_nldtls_find_dtls_tun_gbl_ctx(struct net_device *dev) -+static struct nss_nldtls_tun_ctx *nss_nldtls_find_tun_ctx(struct net_device *dev) - { - struct nss_nldtls_tun_ctx *entry; - -@@ -87,47 +113,6 @@ static struct nss_nldtls_tun_ctx *nss_nl - } - - /* -- * nss_nldtls_data_cb() -- * Data callback function for dtls -- */ --static void __maybe_unused nss_nldtls_data_cb(void *app_data __maybe_unused, struct sk_buff *skb __maybe_unused) --{ -- static bool first_pkt; -- unsigned long long duration; -- ktime_t delta; -- -- if (unlikely(!first_pkt)) { -- gbl_ctx.first_rx_pkt_time = ktime_get(); -- first_pkt = true; -- } -- -- /* -- * Remove meta header -- */ -- skb_pull(skb, sizeof(struct nss_dtlsmgr_metadata)); -- gbl_ctx.last_rx_pkt_time = ktime_get(); -- -- if (unlikely(gbl_ctx.log_en)) { -- struct net_device *dev; -- -- delta = ktime_sub(gbl_ctx.last_rx_pkt_time, gbl_ctx.first_rx_pkt_time); -- duration = (unsigned long long) ktime_to_ns(delta) >> 10; -- print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, skb->data, 32); -- dev = dev_get_by_index(&init_net, skb->skb_iif); -- if (dev) { -- nss_nl_error("In dev = %s, out_dev = %s\n", dev->name, skb->dev->name); -- dev_put(dev); -- } -- -- nss_nl_info("%px: DTLS RX (%s) pkt len = %d udp_csum = %s rx_time: %llu\n", skb, -- skb->dev->name, skb->len, udp_lib_checksum_complete(skb) ? -- "invalid" : "valid", duration); -- } -- -- dev_kfree_skb_any(skb); --} -- --/* - * nss_nldtls_dev_rx_handler() - * Common rx handler for all dtls dev - */ -@@ -416,6 +401,48 @@ static int nss_nldtls_create_ipv6_rule(s - } - - /* -+ * nss_nldtls_data_callback() -+ * Data callback function for dtls -+ */ -+static void nss_nldtls_data_callback(void *app_data, struct sk_buff *skb) -+{ -+ struct nss_dtlsmgr_metadata *ndm; -+ struct nss_nldtls_tun_ctx *tun; -+ struct nss_nldtls_stats *stats; -+ struct net_device *dev; -+ -+ dev = dev_get_by_index(&init_net, skb->skb_iif); -+ if (!dev) { -+ nss_nl_error("Unable to get net dev for skb_iif %d\n", skb->skb_iif); -+ dev_kfree_skb_any(skb); -+ return; -+ } -+ -+ ndm = (struct nss_dtlsmgr_metadata *)skb->data; -+ tun = nss_nldtls_find_tun_ctx(dev); -+ if (!tun) { -+ nss_nl_error("Unable find tunnel ctx for %s\n", dev->name); -+ dev_put(dev); -+ dev_kfree_skb_any(skb); -+ return; -+ } -+ -+ stats = &tun->stats[NSS_NLDTLS_CTYPE_TO_IDX(ndm->ctype)]; -+ spin_lock(&gbl_ctx.lock); -+ stats->rx_pkts++; -+ stats->rx_bytes += skb->len - sizeof(*ndm); -+ spin_unlock(&gbl_ctx.lock); -+ -+ if (unlikely(gbl_ctx.log_en)) { -+ nss_nl_hex_dump_bytes("", DUMP_PREFIX_OFFSET, skb->data, (skb->len > 64) ? 64 : skb->len); -+ } -+ -+ nss_nl_trace("%px Received DTLS packet\n", skb); -+ dev_put(dev); -+ dev_kfree_skb_any(skb); -+} -+ -+/* - * nss_nldtls_create_session() - * Create a DTLS session through dtlsmgr driver API. - */ -@@ -425,6 +452,7 @@ static struct net_device *nss_nldtls_cre - struct nss_dtlsmgr_config dcfg; - struct nss_dtlsmgr_ctx *ctx; - struct net_device *ndev; -+ uint16_t key_len; - uint8_t algo; - int err; - -@@ -434,24 +462,66 @@ static struct net_device *nss_nldtls_cre - } - - memset(&dcfg, 0, sizeof(struct nss_dtlsmgr_config)); -- algo = nl_rule->msg.create.encap.crypto.algo; -- dcfg.flags = flags; -+ algo = nl_rule->msg.create.encap.cfg.crypto.algo; -+ dcfg.flags = flags | (NSS_DTLSMGR_ENCAP_METADATA | NSS_DTLSMGR_HDR_CAPWAP); - if (algo == NSS_DTLSMGR_ALGO_AES_GCM) - dcfg.flags |= NSS_DTLSMGR_CIPHER_MODE_GCM; - - dcfg.app_data = NULL; - dcfg.notify = NULL; -- dcfg.data = NULL; -+ dcfg.data = nss_nldtls_data_callback; - - /* - * Encap configuration - */ -- memcpy((void *)&dcfg.encap, (void *)&nl_rule->msg.create.encap, sizeof(struct nss_dtlsmgr_encap_config)); -+ key_len = nl_rule->msg.create.encap.cfg.crypto.cipher_key.len; -+ if (key_len > NSS_NLDTLS_CIPHER_KEY_MAX) { -+ nss_nl_error("Invalid cipher length: %u\n", key_len); -+ return NULL; -+ } -+ -+ key_len = nl_rule->msg.create.encap.cfg.crypto.auth_key.len; -+ if (key_len > NSS_NLDTLS_AUTH_KEY_MAX) { -+ nss_nl_error("Invalid authentication length: %u\n", key_len); -+ return NULL; -+ } -+ -+ key_len = nl_rule->msg.create.encap.cfg.crypto.nonce.len; -+ if (key_len > NSS_NLDTLS_NONCE_SIZE_MAX) { -+ nss_nl_error("Invalid nonce length: %u\n", key_len); -+ return NULL; -+ } -+ -+ nl_rule->msg.create.encap.cfg.crypto.cipher_key.data = nl_rule->msg.create.encap.keys.cipher; -+ nl_rule->msg.create.encap.cfg.crypto.auth_key.data = nl_rule->msg.create.encap.keys.auth; -+ nl_rule->msg.create.encap.cfg.crypto.nonce.data = nl_rule->msg.create.encap.keys.nonce; -+ memcpy((void *)&dcfg.encap, (void *)&nl_rule->msg.create.encap.cfg, sizeof(struct nss_dtlsmgr_encap_config)); - - /* - * Decap configuration - */ -- memcpy((void *)&dcfg.decap, (void *)&nl_rule->msg.create.decap, sizeof(struct nss_dtlsmgr_decap_config)); -+ key_len = nl_rule->msg.create.decap.cfg.crypto.cipher_key.len; -+ if (key_len > NSS_NLDTLS_CIPHER_KEY_MAX) { -+ nss_nl_error("Invalid cipher length: %u\n", key_len); -+ return NULL; -+ } -+ -+ key_len = nl_rule->msg.create.decap.cfg.crypto.auth_key.len; -+ if (key_len > NSS_NLDTLS_AUTH_KEY_MAX) { -+ nss_nl_error("Invalid authentication length: %u\n", key_len); -+ return NULL; -+ } -+ -+ key_len = nl_rule->msg.create.decap.cfg.crypto.nonce.len; -+ if (key_len > NSS_NLDTLS_NONCE_SIZE_MAX) { -+ nss_nl_error("Invalid nonce length: %u\n", key_len); -+ return NULL; -+ } -+ -+ nl_rule->msg.create.decap.cfg.crypto.cipher_key.data = nl_rule->msg.create.decap.keys.cipher; -+ nl_rule->msg.create.decap.cfg.crypto.auth_key.data = nl_rule->msg.create.decap.keys.auth; -+ nl_rule->msg.create.decap.cfg.crypto.nonce.data = nl_rule->msg.create.decap.keys.nonce; -+ memcpy((void *)&dcfg.decap, (void *)&nl_rule->msg.create.decap.cfg, sizeof(struct nss_dtlsmgr_decap_config)); - dcfg.decap.nexthop_ifnum = NSS_N2H_INTERFACE; - - /* -@@ -484,6 +554,7 @@ static struct net_device *nss_nldtls_cre - dtls_tun_data = (struct nss_nldtls_tun_ctx *)kmalloc(sizeof(*dtls_tun_data), GFP_KERNEL); - dtls_tun_data->nl_rule = nl_rule; - memcpy(dtls_tun_data->dev_name, ndev->name, IFNAMSIZ); -+ memset(&dtls_tun_data->stats, 0, sizeof(dtls_tun_data->stats)); - - /* - * Adding tunnel to global list of tunnels -@@ -524,15 +595,15 @@ static int nss_nldtls_create_ipv4_rule_e - ipv4.src_interface_num = if_num; - ipv4.dest_interface_num = nss_dtlsmgr_get_interface(dtls_dev, NSS_DTLSMGR_INTERFACE_TYPE_OUTER); - -- ipv4.src_port = nl_rule->msg.create.encap.dport; -- ipv4.src_port_xlate = nl_rule->msg.create.encap.dport; -- ipv4.src_ip = nl_rule->msg.create.encap.dip[0]; -- ipv4.src_ip_xlate = nl_rule->msg.create.encap.dip[0]; -- -- ipv4.dest_ip = nl_rule->msg.create.encap.sip[0]; -- ipv4.dest_ip_xlate = nl_rule->msg.create.encap.sip[0]; -- ipv4.dest_port = nl_rule->msg.create.encap.sport; -- ipv4.dest_port_xlate = nl_rule->msg.create.encap.sport; -+ ipv4.src_port = nl_rule->msg.create.encap.cfg.dport; -+ ipv4.src_port_xlate = nl_rule->msg.create.encap.cfg.dport; -+ ipv4.src_ip = nl_rule->msg.create.encap.cfg.dip[0]; -+ ipv4.src_ip_xlate = nl_rule->msg.create.encap.cfg.dip[0]; -+ -+ ipv4.dest_ip = nl_rule->msg.create.encap.cfg.sip[0]; -+ ipv4.dest_ip_xlate = nl_rule->msg.create.encap.cfg.sip[0]; -+ ipv4.dest_port = nl_rule->msg.create.encap.cfg.sport; -+ ipv4.dest_port_xlate = nl_rule->msg.create.encap.cfg.sport; - - ipv4.protocol = IPPROTO_UDP; - ipv4.in_vlan_tag[0] = NSS_NLDTLS_VLAN_INVALID; -@@ -575,14 +646,14 @@ static int nss_nldtls_create_ipv6_rule_e - if_num = nss_cmn_get_interface_number_by_dev(ndev); - ipv6.src_interface_num = if_num; - ipv6.dest_interface_num = nss_dtlsmgr_get_interface(dtls_dev, NSS_DTLSMGR_INTERFACE_TYPE_OUTER); -- ipv6.src_port = nl_rule->msg.create.encap.dport; -- ipv6.dest_port = nl_rule->msg.create.encap.sport; -+ ipv6.src_port = nl_rule->msg.create.encap.cfg.dport; -+ ipv6.dest_port = nl_rule->msg.create.encap.cfg.sport; - - /* - * Configure IPv6 rule - */ -- memcpy(ipv6.src_ip, nl_rule->msg.create.encap.dip, sizeof(ipv6.src_ip)); -- memcpy(ipv6.dest_ip, nl_rule->msg.create.encap.sip, sizeof(ipv6.dest_ip)); -+ memcpy(ipv6.src_ip, nl_rule->msg.create.encap.cfg.dip, sizeof(ipv6.src_ip)); -+ memcpy(ipv6.dest_ip, nl_rule->msg.create.encap.cfg.sip, sizeof(ipv6.dest_ip)); - ipv6.protocol = IPPROTO_UDP; - - ipv6.in_vlan_tag[0] = NSS_NLDTLS_VLAN_INVALID; -@@ -602,29 +673,27 @@ static int nss_nldtls_create_ipv6_rule_e - * nss_nldtls_destroy_tun() - * Common handler for tunnel destroy - */ --static int nss_nldtls_destroy_tun(struct net_device *dtls_ndev) -+static int nss_nldtls_destroy_tun(struct net_device *dev) - { -- struct nss_nldtls_tun_ctx *dtls_tun_data; -+ struct nss_nldtls_tun_ctx *tun; - -- dtls_tun_data = nss_nldtls_find_dtls_tun_gbl_ctx(dtls_ndev); -- if (!dtls_tun_data) { -- nss_nl_error("Unable to find context of the tunnel: %s\n", dtls_ndev->name); -- dev_put(dtls_ndev); -+ tun = nss_nldtls_find_tun_ctx(dev); -+ if (!tun) { -+ nss_nl_error("Unable to find context of the tunnel: %s\n", dev->name); - return -EAGAIN; - } - - /* - * Delete tunnel node from the list - */ -- list_del_init(&dtls_tun_data->list); -- kfree(dtls_tun_data); -- dev_put(dtls_ndev); -+ list_del_init(&tun->list); -+ kfree(tun); - - /* - * Destroy the dtls session - */ -- if (nss_dtlsmgr_session_destroy(dtls_ndev)) { -- nss_nl_error("Unable to destroy the tunnel: %s\n", dtls_ndev->name); -+ if (nss_dtlsmgr_session_destroy(dev)) { -+ nss_nl_error("Unable to destroy the tunnel: %s\n", dev->name); - return -EAGAIN; - } - -@@ -709,8 +778,8 @@ static int nss_nldtls_ops_create_tun(str - static int nss_nldtls_ops_destroy_tun(struct sk_buff *skb, struct genl_info *info) - { - struct nss_nldtls_rule *nl_rule; -- struct net_device *dtls_ndev; - struct nss_nlcmn *nl_cm; -+ struct net_device *dev; - int ret; - - /* -@@ -727,18 +796,20 @@ static int nss_nldtls_ops_destroy_tun(st - */ - nl_rule = container_of(nl_cm, struct nss_nldtls_rule, cm); - -- dtls_ndev = dev_get_by_name(&init_net, nl_rule->msg.destroy.dev_name); -- if (!dtls_ndev) { -- nss_nl_error("%px: Unable to find dev: %s\n", skb, nl_rule->msg.destroy.dev_name); -+ dev = dev_get_by_name(&init_net, nl_rule->msg.destroy.dev_name); -+ if (!dev) { -+ nss_nl_error("%px Unable to find dev: %s\n", skb, nl_rule->msg.destroy.dev_name); - return -EINVAL; - } - -+ dev_put(dev); -+ - /* - * Common dtls handler for tunnel destroy - */ -- ret = nss_nldtls_destroy_tun(dtls_ndev); -+ ret = nss_nldtls_destroy_tun(dev); - if (ret < 0) { -- nss_nl_error("%px: Unable to destroy tunnel: %s\n", skb, dtls_ndev->name); -+ nss_nl_error("%px Unable to destroy tunnel: %s\n", skb, dev->name); - return -EAGAIN; - } - -@@ -753,13 +824,14 @@ static int nss_nldtls_ops_destroy_tun(st - */ - static int nss_nldtls_ops_update_config(struct sk_buff *skb, struct genl_info *info) - { -- struct nss_nldtls_tun_ctx *dtls_tun_data; - struct nss_dtlsmgr_config_update dcfg; - struct nss_nldtls_rule *nl_rule; -- struct net_device *dtls_ndev; -+ struct nss_nldtls_tun_ctx *tun; - struct nss_dtlsmgr_ctx *ctx; - nss_dtlsmgr_status_t status; - struct nss_nlcmn *nl_cm; -+ struct net_device *dev; -+ uint16_t key_len; - - /* - * extract the message payload -@@ -775,17 +847,17 @@ static int nss_nldtls_ops_update_config( - */ - nl_rule = container_of(nl_cm, struct nss_nldtls_rule, cm); - -- dtls_ndev = dev_get_by_name(&init_net, nl_rule->msg.update_config.dev_name); -- if (!dtls_ndev) { -- nss_nl_error("%px: Unable to find dev: %s\n", skb, nl_rule->msg.update_config.dev_name); -+ dev = dev_get_by_name(&init_net, nl_rule->msg.update_config.dev_name); -+ if (!dev) { -+ nss_nl_error("%px Unable to find dev: %s\n", skb, nl_rule->msg.update_config.dev_name); - return -EINVAL; - } - -- ctx = netdev_priv(dtls_ndev); -- dtls_tun_data = nss_nldtls_find_dtls_tun_gbl_ctx(dtls_ndev); -- if (!dtls_tun_data) { -- nss_nl_error("%px: Unable to find context of the tunnel: %s\n", ctx, dtls_ndev->name); -- dev_put(dtls_ndev); -+ ctx = netdev_priv(dev); -+ tun = nss_nldtls_find_tun_ctx(dev); -+ if (!tun) { -+ nss_nl_error("%px Unable to find context of the tunnel: %s\n", ctx, dev->name); -+ dev_put(dev); - return -EAGAIN; - } - -@@ -793,28 +865,46 @@ static int nss_nldtls_ops_update_config( - * Configure the dtls configuration - */ - dcfg.crypto.algo = nl_rule->msg.update_config.config_update.crypto.algo; -- dcfg.crypto.cipher_key.data = nl_rule->msg.update_config.config_update.crypto.cipher_key.data; -- dcfg.crypto.cipher_key.len = nl_rule->msg.update_config.config_update.crypto.cipher_key.len; -- dcfg.crypto.auth_key.data = nl_rule->msg.update_config.config_update.crypto.auth_key.data; -- dcfg.crypto.auth_key.len = nl_rule->msg.update_config.config_update.crypto.auth_key.len; -- dcfg.crypto.nonce.data = nl_rule->msg.update_config.config_update.crypto.nonce.data; -- dcfg.crypto.nonce.len = nl_rule->msg.update_config.config_update.crypto.nonce.len; -+ dcfg.crypto.cipher_key.data = nl_rule->msg.update_config.keys.cipher; -+ dcfg.crypto.auth_key.data = nl_rule->msg.update_config.keys.auth; -+ dcfg.crypto.nonce.data = nl_rule->msg.update_config.keys.nonce; -+ key_len = nl_rule->msg.update_config.config_update.crypto.cipher_key.len; -+ if (key_len > NSS_NLDTLS_CIPHER_KEY_MAX) { -+ nss_nl_error("Invalid cipher length: %u\n", key_len); -+ return -EINVAL; -+ } -+ -+ dcfg.crypto.cipher_key.len = key_len; -+ key_len = nl_rule->msg.update_config.config_update.crypto.auth_key.len; -+ if (key_len > NSS_NLDTLS_AUTH_KEY_MAX) { -+ nss_nl_error("Invalid authentication length: %u\n", key_len); -+ return -EINVAL; -+ } -+ -+ dcfg.crypto.auth_key.len = key_len; -+ key_len = nl_rule->msg.update_config.config_update.crypto.nonce.len; -+ if (key_len > NSS_NLDTLS_NONCE_SIZE_MAX) { -+ nss_nl_error("Invalid nonce length: %u\n", key_len); -+ return -EINVAL; -+ } -+ -+ dcfg.crypto.nonce.len = key_len; - dcfg.epoch = nl_rule->msg.update_config.config_update.epoch; - dcfg.window_size = nl_rule->msg.update_config.config_update.window_size; - if (!nl_rule->msg.update_config.dir) { -- status = nss_dtlsmgr_session_update_encap(dtls_ndev, &dcfg); -+ status = nss_dtlsmgr_session_update_encap(dev, &dcfg); - if (status != NSS_DTLSMGR_OK) { -- nss_nl_error("%px: Unable to update encap configuration\n", ctx); -- dev_put(dtls_ndev); -+ nss_nl_error("%px Unable to update encap configuration\n", ctx); -+ dev_put(dev); - return -EINVAL; - } - - nss_nl_info("%px: Successfully update the encap configuration\n", ctx); - } else { -- status = nss_dtlsmgr_session_update_decap(dtls_ndev, &dcfg); -+ status = nss_dtlsmgr_session_update_decap(dev, &dcfg); - if (status != NSS_DTLSMGR_OK) { -- nss_nl_error("%px: Unable to update decap configuration\n", ctx); -- dev_put(dtls_ndev); -+ nss_nl_error("%px Unable to update decap configuration\n", ctx); -+ dev_put(dev); - return -EINVAL; - } - -@@ -824,213 +914,65 @@ static int nss_nldtls_ops_update_config( - /* - * Update the tun data configuration - */ -- dtls_tun_data->nl_rule = nl_rule; -+ tun->nl_rule = nl_rule; -+ dev_put(dev); - return 0; - } - - /* -- * nss_nldtls_construct_ipv4_udp_header() -- * Creates an ipv4 + udp packet -- */ --static struct sk_buff *nss_nldtls_construct_ipv4_udp_header(struct net_device *dev, struct nss_nldtls_rule *nl_rule) --{ -- struct nss_nldtls_tun_ctx *tun_data; -- struct nss_nldtls_rule *dtls_rule; -- uint16_t hroom, troom; -- struct sk_buff *skb; -- struct udphdr *uh; -- struct iphdr *iph; -- -- /* -- * Get the tun data -- */ -- tun_data = nss_nldtls_find_dtls_tun_gbl_ctx(dev); -- dtls_rule = tun_data->nl_rule; -- hroom = dev->needed_headroom; -- troom = dev->needed_tailroom; -- skb = dev_alloc_skb(nl_rule->msg.tx_pkts.pkt_sz + hroom + troom); -- if (!skb) { -- nss_nl_info("Failed to allocate skb\n"); -- return NULL; -- } -- -- skb_reserve(skb, sizeof(struct udphdr) + sizeof(struct iphdr)); -- skb_put(skb, nl_rule->msg.tx_pkts.pkt_sz); -- -- /* -- * Fill the packet with dummy data -- */ -- memset(skb->data, NSS_NLDTLS_DUMMY_DATA, skb->len); -- -- /* -- * Fill udp header fields -- */ -- skb_push(skb, sizeof(struct udphdr)); -- uh = (struct udphdr *)skb->data; -- uh->source = htons(dtls_rule->msg.create.encap.sport); -- uh->dest = htons(dtls_rule->msg.create.encap.dport); -- uh->len = htons(skb->len); -- uh->check = 0; -- -- /* -- * Fill IP header fields -- */ -- skb_push(skb, sizeof(struct iphdr)); -- iph = (struct iphdr *)skb->data; -- iph->ihl = 5; -- iph->version = 4; -- iph->tot_len = (nl_rule->msg.tx_pkts.pkt_sz + sizeof(struct udphdr) + sizeof(struct iphdr)); -- iph->ttl = dtls_rule->msg.create.encap.ip_ttl; -- iph->protocol = IPPROTO_UDP; -- iph->saddr = dtls_rule->msg.create.encap.sip[0]; -- iph->daddr = dtls_rule->msg.create.encap.dip[0]; -- -- /* -- * UDP checksum -- */ -- uh->check = udp_csum(skb); -- uh->check = csum_tcpudp_magic(iph->saddr, iph->daddr, skb->len, -- IPPROTO_UDP, uh->check); -- -- if (nl_rule->msg.tx_pkts.log_en) { -- nss_nl_info("%px: DTLS TX pkt len:%d udp_csum:0x%x\n", skb, skb->len, uh->check); -- } -- -- return skb; --} -- --/* -- * nss_nldtls_construct_ipv6_udp_header() -- * Creates an ipv6 + udp packet -+ * nss_nldtls_alloc_pkt() -+ * Handler for forming ctype packet - */ --static struct sk_buff *nss_nldtls_construct_ipv6_udp_header(struct net_device *dev, struct nss_nldtls_rule *nl_rule) -+static struct sk_buff *nss_nldtls_alloc_pkt(struct nss_nldtls_rule *nl_rule, -+ struct net_device *dev, uint32_t pkt_sz, uint8_t ctype) - { -- struct nss_nldtls_tun_ctx *tun_data; -- struct nss_nldtls_rule *dtls_rule; -- uint16_t hroom, troom; -+ struct nss_dtlsmgr_metadata *ndm; -+ uint16_t hdr_len, payload_len; - struct sk_buff *skb; -- struct udphdr *uh; -- struct ipv6hdr *ip6h; - -- /* -- * Get the tun data -- */ -- tun_data = nss_nldtls_find_dtls_tun_gbl_ctx(dev); -- dtls_rule = tun_data->nl_rule; -- hroom = dev->needed_headroom; -- troom = dev->needed_tailroom; -- skb = dev_alloc_skb(nl_rule->msg.tx_pkts.pkt_sz + hroom + troom); -+ hdr_len = dev->needed_headroom + sizeof(*ndm); -+ payload_len = hdr_len + dev->needed_tailroom + pkt_sz; -+ skb = netdev_alloc_skb(dev, payload_len); - if (!skb) { -- nss_nl_info("Failed to allocate skb\n"); - return NULL; - } - -- skb_reserve(skb, sizeof(struct udphdr) + sizeof(struct iphdr)); -- skb_put(skb, nl_rule->msg.tx_pkts.pkt_sz); -+ skb_reserve(skb, hdr_len); - - /* - * Fill the packet with dummy data - */ -- memset(skb->data, NSS_NLDTLS_DUMMY_DATA, skb->len); -- -- /* -- * Fill udp header fields -- */ -- skb_push(skb, sizeof(struct udphdr)); -- uh = (struct udphdr *)skb->data; -- uh->source = htons(dtls_rule->msg.create.encap.sport); -- uh->dest = htons(dtls_rule->msg.create.encap.dport); -- uh->len = htons(skb->len); -- uh->check = 0; -+ memset(skb_put(skb, pkt_sz), NSS_NLDTLS_DUMMY_DATA, skb->len); - -- /* -- * Fill IP header fields -- */ -- skb_push(skb, sizeof(struct ipv6hdr)); -- ip6h = (struct ipv6hdr *)skb->data; -- ip6h->version = 6; -- ip6h->payload_len = htons(nl_rule->msg.tx_pkts.pkt_sz + sizeof(struct udphdr)); -- ip6h->hop_limit = 64; -- ip6h->nexthdr = IPPROTO_UDP; -- ip6h->saddr.in6_u.u6_addr32[0] = htonl(dtls_rule->msg.create.encap.sip[0]); -- ip6h->saddr.in6_u.u6_addr32[1] = htonl(dtls_rule->msg.create.encap.sip[1]); -- ip6h->saddr.in6_u.u6_addr32[2] = htonl(dtls_rule->msg.create.encap.sip[2]); -- ip6h->saddr.in6_u.u6_addr32[3] = htonl(dtls_rule->msg.create.encap.sip[3]); -+ ndm = nss_dtlsmgr_metadata_init(skb); -+ nss_dtlsmgr_metadata_set_seq(ndm, nl_rule->msg.tx_pkts.seq_num); -+ nss_dtlsmgr_metadata_set_ctype(ndm, ctype); - -- ip6h->saddr.in6_u.u6_addr32[0] = htonl(dtls_rule->msg.create.encap.dip[0]); -- ip6h->saddr.in6_u.u6_addr32[1] = htonl(dtls_rule->msg.create.encap.dip[1]); -- ip6h->saddr.in6_u.u6_addr32[2] = htonl(dtls_rule->msg.create.encap.dip[2]); -- ip6h->saddr.in6_u.u6_addr32[3] = htonl(dtls_rule->msg.create.encap.dip[3]); -- -- skb_set_transport_header(skb, sizeof(struct ipv6hdr)); -- /* -- * UDP checksum -- */ -- udp6_set_csum(false, skb, &ip6h->saddr, &ip6h->daddr, nl_rule->msg.tx_pkts.pkt_sz + sizeof(struct udphdr)); -- -- if (nl_rule->msg.tx_pkts.log_en) { -- nss_nl_info("%px: DTLS TX pkt len:%d udp_csum:0x%x\n", skb, skb->len, uh->check); -+ if (unlikely(nl_rule->msg.tx_pkts.log_en)) { -+ nss_nl_info("%px DTLS TX pkt len:%u\n", skb, skb->len); - } - - return skb; - } - - /* -- * nss_nldtls_tx_ipv4_pkts_host_to_host() -- * Handler for sending ipv4 traffic from one host to other -- */ --static bool nss_nldtls_tx_ipv4_pkts_host_to_host(struct nss_nldtls_rule *nl_rule, struct net_device *dtls_dev) --{ -- int i; -- for (i = 0; i < nl_rule->msg.tx_pkts.num_pkts; i++) { -- struct sk_buff *skb; -- -- skb = nss_nldtls_construct_ipv4_udp_header(dtls_dev, nl_rule); -- if (!skb) { -- nss_nl_error("%px: Unable to create ipv4 + udp packet\n", dtls_dev); -- return false; -- } -- -- dtls_dev->netdev_ops->ndo_start_xmit(skb, dtls_dev); -- } -- -- return true; --} -- --/* -- * nss_nldtls_tx_ipv6_pkts_host_to_host() -- * Handler for sending ipv6 traffic from one host to other -- */ --static bool nss_nldtls_tx_ipv6_pkts_host_to_host(struct nss_nldtls_rule *nl_rule, struct net_device *dtls_dev) --{ -- int i; -- for (i = 0; i < nl_rule->msg.tx_pkts.num_pkts; i++) { -- struct sk_buff *skb; -- -- skb = nss_nldtls_construct_ipv6_udp_header(dtls_dev, nl_rule); -- if (!skb) { -- nss_nl_error("%px: Unable to create ipv4 + udp packet\n", dtls_dev); -- return false; -- } -- -- dtls_dev->netdev_ops->ndo_start_xmit(skb, dtls_dev); -- } -- -- return true; --} -- --/* - * nss_nldtls_ops_tx_pkts() - * Handler for sending traffic - */ - static int nss_nldtls_ops_tx_pkts(struct sk_buff *skb, struct genl_info *info) - { -- struct nss_nldtls_tun_ctx *dtls_tun_data; - struct nss_nldtls_rule *nl_rule; -- struct net_device *dtls_ndev; -+ struct nss_nldtls_tun_ctx *tun; -+ struct nss_nldtls_stats *stats; - unsigned long long duration; - struct nss_nlcmn *nl_cm; -+ struct net_device *dev; -+ struct sk_buff *tx_skb; -+ uint32_t num_pkts; -+ uint32_t pkt_sz; -+ uint32_t count; - ktime_t delta; -+ uint8_t ctype; - - /* - * extract the message payload -@@ -1046,56 +988,149 @@ static int nss_nldtls_ops_tx_pkts(struct - */ - nl_rule = container_of(nl_cm, struct nss_nldtls_rule, cm); - -- dtls_ndev = dev_get_by_name(&init_net, nl_rule->msg.tx_pkts.dev_name); -- if (!dtls_ndev) { -- nss_nl_error("%px: Unable to find dev: %s\n", skb, nl_rule->msg.tx_pkts.dev_name); -+ ctype = nl_rule->msg.tx_pkts.ctype; -+ num_pkts = nl_rule->msg.tx_pkts.num_pkts; -+ -+ switch (ctype) { -+ case NSS_DTLSMGR_METADATA_CTYPE_CCS: -+ pkt_sz = NSS_NLDTLS_CCS_PKT_SZ; -+ break; -+ -+ case NSS_DTLSMGR_METADATA_CTYPE_ALERT: -+ pkt_sz = NSS_NLDTLS_ALERT_PKT_SZ; -+ break; -+ -+ case NSS_DTLSMGR_METADATA_CTYPE_HANDSHAKE: -+ pkt_sz = NSS_NLDTLS_HANDSHAKE_PKT_SZ; -+ break; -+ -+ case NSS_DTLSMGR_METADATA_CTYPE_APP: -+ pkt_sz = nl_rule->msg.tx_pkts.pkt_sz; -+ break; -+ -+ default: - return -EINVAL; - } - -- dtls_tun_data = nss_nldtls_find_dtls_tun_gbl_ctx(dtls_ndev); -- if (!dtls_tun_data) { -- nss_nl_error("%px: Unable to find context of the tunnel: %s\n", skb, dtls_ndev->name); -- dev_put(dtls_ndev); -- return -EAGAIN; -+ dev = dev_get_by_name(&init_net, nl_rule->msg.tx_pkts.dev_name); -+ if (!dev) { -+ nss_nl_error("%px Unable to find dev: %s\n", skb, nl_rule->msg.tx_pkts.dev_name); -+ return -EINVAL; -+ } -+ -+ tun = nss_nldtls_find_tun_ctx(dev); -+ if (!tun) { -+ nss_nl_error("%px Unable to find context of the tunnel: %s\n", skb, dev->name); -+ dev_put(dev); -+ return -EINVAL; - } - - spin_lock(&gbl_ctx.lock); - gbl_ctx.log_en = nl_rule->msg.tx_pkts.log_en; - spin_unlock(&gbl_ctx.lock); - -- /* -- * Send traffic from host to host -- */ - gbl_ctx.first_tx_pkt_time = ktime_get(); -- if (nl_rule->msg.tx_pkts.ip_version == NSS_NLDTLS_IP_VERS_4) { -- if (!nss_nldtls_tx_ipv4_pkts_host_to_host(nl_rule, dtls_ndev)) { -- nss_nl_error("%px: Error in transmission\n", skb); -- return -EAGAIN; -- } -- } else { -- if (!nss_nldtls_tx_ipv6_pkts_host_to_host(nl_rule, dtls_ndev)) { -- nss_nl_error("%px: Error in transmission\n", skb); -- return -EAGAIN; -+ -+ for (count = 0; count < num_pkts; count++) { -+ tx_skb = nss_nldtls_alloc_pkt(nl_rule, dev, pkt_sz, ctype); -+ if (!tx_skb) { -+ nss_nl_error("%px Failed to allocate skb\n", dev); -+ break; - } -+ -+ dev->netdev_ops->ndo_start_xmit(tx_skb, dev); -+ } -+ -+ stats = &tun->stats[NSS_NLDTLS_CTYPE_TO_IDX(ctype)]; -+ spin_lock(&gbl_ctx.lock); -+ stats->tx_pkts += count; -+ stats->tx_bytes += (count * pkt_sz); -+ spin_unlock(&gbl_ctx.lock); -+ dev_put(dev); -+ -+ if (count != num_pkts) { -+ nss_nl_error("%px Error in transmission\n", skb); -+ return -EAGAIN; - } - - gbl_ctx.last_tx_pkt_time = ktime_get(); - delta = ktime_sub(gbl_ctx.last_tx_pkt_time, gbl_ctx.first_tx_pkt_time); - duration = (unsigned long long) ktime_to_ns(delta) >> 10; -- nss_nl_info("%px: Packets sent in %llu usecs", dtls_ndev, duration); -- nss_nl_info("%px: Traffic transmission successful\n", skb); -+ nss_nl_info("%px Packets sent in %llu usecs", dev, duration); -+ nss_nl_info("%px Traffic transmission successful\n", skb); - return 0; - } - - /* -- * nss_nldtls_cmd_ops -- * Operation table called by the generic netlink layer based on the command -+ * nss_nldtls_tunnel_stats_read() -+ * reads the per tunnel tx and rx packets stats for every ctypes - */ --struct genl_ops nss_nldtls_cmd_ops[] = { -- {.cmd = NSS_NLDTLS_CMD_TYPE_CREATE_TUN, .doit = nss_nldtls_ops_create_tun,}, -- {.cmd = NSS_NLDTLS_CMD_TYPE_DESTROY_TUN, .doit = nss_nldtls_ops_destroy_tun,}, -- {.cmd = NSS_NLDTLS_CMD_TYPE_UPDATE_CONFIG, .doit = nss_nldtls_ops_update_config,}, -- {.cmd = NSS_NLDTLS_CMD_TYPE_TX_PKTS, .doit = nss_nldtls_ops_tx_pkts,}, -+static ssize_t nss_nldtls_tunnel_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *f_ppos) -+{ -+ struct nss_nldtls_stats stats[NSS_NLDTLS_CTYPE_MAX]; -+ struct nss_nldtls_tun_ctx *entry; -+ uint32_t max_output_lines; -+ char dev_name[IFNAMSIZ]; -+ ssize_t bytes_read = 0; -+ ssize_t size_wr = 0; -+ ssize_t size_al; -+ char *lbuf; -+ -+ max_output_lines = 2 + (NSS_NLDTLS_MAX_TUNNELS * NSS_NLDTLS_STATS_MAX_ROW); -+ size_al = NSS_NLDTLS_STATS_MAX_STR_LEN * max_output_lines; -+ -+ lbuf = vzalloc(size_al); -+ -+ if (!lbuf) { -+ nss_nl_error("%px Could not allocate buffer for debug entry\n", f_ppos); -+ return 0; -+ } -+ -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\nDTLS netlink ctype stats:\n"); -+ list_for_each_entry(entry, &gbl_ctx.dtls_list_head, list) { -+ spin_lock_bh(&gbl_ctx.lock); -+ memcpy(&stats, &entry->stats, sizeof(stats)); -+ strlcpy(dev_name, entry->dev_name, IFNAMSIZ); -+ spin_unlock_bh(&gbl_ctx.lock); -+ -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n--------------------------------"); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n%s:\t %s", "dev", dev_name); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n change_cipher_spec"); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "tx_pkts", stats[0].tx_pkts); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "tx_bytes", stats[0].tx_bytes); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "rx_pkts", stats[0].rx_pkts); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "rx_bytes", stats[0].rx_bytes); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n alert"); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "tx_pkts", stats[1].tx_pkts); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "tx_bytes", stats[1].tx_bytes); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "rx_pkts", stats[1].rx_pkts); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "rx_bytes", stats[1].rx_bytes); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n handshake"); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "tx_pkts", stats[2].tx_pkts); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "tx_bytes", stats[2].tx_bytes); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "rx_pkts", stats[2].rx_pkts); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "rx_bytes", stats[2].rx_bytes); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n app_data"); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "tx_pkts", stats[3].tx_pkts); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "tx_bytes", stats[3].tx_bytes); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "rx_pkts", stats[3].rx_pkts); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n\t%s:\t %llu", "rx_bytes", stats[3].rx_bytes); -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n--------------------------------\n"); -+ } -+ -+ size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\nDTLS netlink ctype stats end\n\n"); -+ bytes_read = simple_read_from_buffer(ubuf, sz, f_ppos, lbuf, size_wr); -+ -+ vfree(lbuf); -+ return bytes_read; -+} -+ -+/* -+ * nss_nldtls_stats_ops() -+ * file operation handler for dentry -+ */ -+static const struct file_operations nss_nldtls_stats_ops = { -+ .read = nss_nldtls_tunnel_stats_read, - }; - - /* -@@ -1111,14 +1146,35 @@ bool nss_nldtls_init(void) - /* - * register NETLINK ops with the family - */ -- err = genl_register_family_with_ops_groups(&nss_nldtls_family, nss_nldtls_cmd_ops, nss_nldtls_family_mcgrp); -+ err = genl_register_family(&nss_nldtls_family); - if (err) { - nss_nl_info_always("Error: %d unable to register gre_redir family\n", err); - genl_unregister_family(&nss_nldtls_family); - return false; - } - -+ /* -+ * Create a debugfs entry for netlink dtls -+ */ -+ gbl_ctx.dentry = debugfs_create_dir("nldtls", NULL); -+ if (!gbl_ctx.dentry) { -+ nss_nl_info_always("Cannot create nldtls directory\n"); -+ goto free_family; -+ } -+ -+ if (!debugfs_create_file("stats", 0400, gbl_ctx.dentry, NULL, &nss_nldtls_stats_ops)) { -+ nss_nl_info_always("Cannot create nldtls dentry file\n"); -+ goto free_debugfs; -+ } -+ - return true; -+ -+free_debugfs: -+ debugfs_remove_recursive(gbl_ctx.dentry); -+free_family: -+ genl_unregister_family(&nss_nldtls_family); -+ -+ return false; - } - - /* -@@ -1128,7 +1184,7 @@ bool nss_nldtls_init(void) - bool nss_nldtls_exit(void) - { - struct nss_nldtls_tun_ctx *entry, *tmp; -- struct net_device *dtls_ndev; -+ struct net_device *dev; - int err; - - nss_nl_info_always("Exit NSS netlink dtls handler\n"); -@@ -1137,9 +1193,10 @@ bool nss_nldtls_exit(void) - * Destroy all active tunnel before exiting - */ - list_for_each_entry_safe(entry, tmp, &gbl_ctx.dtls_list_head, list) { -- dtls_ndev = dev_get_by_name(&init_net, entry->dev_name); -- if (dtls_ndev) { -- nss_nldtls_destroy_tun(dtls_ndev); -+ dev = dev_get_by_name(&init_net, entry->dev_name); -+ if (dev) { -+ dev_put(dev); -+ nss_nldtls_destroy_tun(dev); - } - } - ---- a/netlink/nss_nldtls.h -+++ b/netlink/nss_nldtls.h -@@ -27,6 +27,27 @@ - #define NSS_NLDTLS_VLAN_INVALID 0xFFF - #define NSS_NLDTLS_IP_VERS_4 4 - #define NSS_NLDTLS_DUMMY_DATA 0xcc -+#define NSS_NLDTLS_STATS_MAX_ROW 23 -+#define NSS_NLDTLS_STATS_MAX_STR_LEN 35 -+ -+#define NSS_NLDTLS_CTYPE_MAX 4 -+#define NSS_NLDTLS_CTYPE_BASE NSS_DTLSMGR_METADATA_CTYPE_CCS -+#define NSS_NLDTLS_CTYPE_TO_IDX(ctype) ((ctype) - NSS_NLDTLS_CTYPE_BASE) -+ -+#define NSS_NLDTLS_CCS_PKT_SZ 1 -+#define NSS_NLDTLS_ALERT_PKT_SZ 2 -+#define NSS_NLDTLS_HANDSHAKE_PKT_SZ 56 -+ -+/* -+ * nss_dtls_stats -+ * netlink DTLS TX and RX statistics -+ */ -+struct nss_nldtls_stats { -+ uint64_t rx_pkts; -+ uint64_t rx_bytes; -+ uint64_t tx_pkts; -+ uint64_t tx_bytes; -+}; - - /* - * nss_nldtls_tun_ctx -@@ -36,6 +57,8 @@ struct nss_nldtls_tun_ctx { - struct list_head list; /**< List for holding different tunnel info */ - struct nss_nldtls_rule *nl_rule; /**< Dtls rule structure */ - char dev_name[IFNAMSIZ]; /**< Dtls session netdev */ -+ struct nss_nldtls_stats stats[NSS_NLDTLS_CTYPE_MAX]; -+ /**< Dtls stats */ - }; - - /* -@@ -51,6 +74,7 @@ struct nss_nldtls_gbl_ctx { - ktime_t first_tx_pkt_time; - ktime_t last_rx_pkt_time; - ktime_t last_tx_pkt_time; -+ struct dentry *dentry; - }; - - #if (CONFIG_NSS_NLDTLS == 1) ---- a/netlink/nss_nldynamic_interface.c -+++ b/netlink/nss_nldynamic_interface.c -@@ -46,20 +46,6 @@ static int nss_nldynamic_interface_ops_g - static int nss_nldynamic_interface_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * dynamic interface family definition -- */ --static struct genl_family nss_nldynamic_interface_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLDYNAMIC_INTERFACE_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_dynamic_interface_notification), /* NSS NETLINK dynamic interface information */ -- .version = NSS_NL_VER, /* Set it to NSS_NLDYNAMIC_INTERFACE version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nldynamic_interface_mcgrp[] = { -@@ -74,6 +60,26 @@ static struct genl_ops nss_nldynamic_int - }; - - /* -+ * dynamic interface family definition -+ */ -+static struct genl_family nss_nldynamic_interface_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLDYNAMIC_INTERFACE_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_dynamic_interface_notification), /* NSS NETLINK dynamic interface information */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLDYNAMIC_INTERFACE version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nldynamic_interface_ops, -+ .n_ops = ARRAY_SIZE(nss_nldynamic_interface_ops), -+ .mcgrps = nss_nldynamic_interface_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nldynamic_interface_mcgrp) -+}; -+ -+/* - * destroy interface call back handler for dynamic interface from NSS - */ - static struct notifier_block nss_dynamic_interface_stats_notifier_nb = { -@@ -125,7 +131,7 @@ bool nss_nldynamic_interface_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nldynamic_interface_family, nss_nldynamic_interface_ops, nss_nldynamic_interface_mcgrp); -+ error = genl_register_family(&nss_nldynamic_interface_family); - if (error) { - nss_nl_info_always("Error: unable to register dynamic_interface family\n"); - return false; ---- a/netlink/nss_nledma.c -+++ b/netlink/nss_nledma.c -@@ -45,20 +45,6 @@ static int nss_nledma_ops_get_stats(stru - static int nss_nledma_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * Edma family definition -- */ --static struct genl_family nss_nledma_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLEDMA_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_nledma_stats), /* NSS NETLINK Edma stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLEDMA version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nledma_mcgrp[] = { -@@ -73,6 +59,26 @@ static struct genl_ops nss_nledma_ops[] - }; - - /* -+ * Edma family definition -+ */ -+static struct genl_family nss_nledma_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLEDMA_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_nledma_stats), /* NSS NETLINK Edma stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLEDMA version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nledma_ops, -+ .n_ops = ARRAY_SIZE(nss_nledma_ops), -+ .mcgrps = nss_nledma_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nledma_mcgrp) -+}; -+ -+/* - * statistics call back handler for edma from NSS - */ - static struct notifier_block nss_edma_stats_notifier_nb = { -@@ -130,7 +136,7 @@ bool nss_nledma_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nledma_family, nss_nledma_ops, nss_nledma_mcgrp); -+ error = genl_register_family(&nss_nledma_family); - if (error) { - nss_nl_info_always("Error: unable to register Edma family\n"); - return false; ---- a/netlink/nss_nlethrx.c -+++ b/netlink/nss_nlethrx.c -@@ -46,20 +46,6 @@ static int nss_nlethrx_ops_get_stats(str - static int nss_nlethrx_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * eth_rx family definition -- */ --static struct genl_family nss_nlethrx_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLETHRX_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_eth_rx_stats_notification), /* NSS NETLINK eth_rx rule */ -- .version = NSS_NL_VER, /* Set it to NSS_NLETHRX version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nlethrx_mcgrp[] = { -@@ -74,6 +60,26 @@ static struct genl_ops nss_nlethrx_ops[] - }; - - /* -+ * eth_rx family definition -+ */ -+static struct genl_family nss_nlethrx_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLETHRX_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_eth_rx_stats_notification), /* NSS NETLINK eth_rx rule */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLETHRX version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlethrx_ops, -+ .n_ops = ARRAY_SIZE(nss_nlethrx_ops), -+ .mcgrps = nss_nlethrx_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlethrx_mcgrp) -+}; -+ -+/* - * statistics call back handler for eth_rx from NSS - */ - static struct notifier_block nss_eth_rx_stats_notifier_nb = { -@@ -125,7 +131,7 @@ bool nss_nlethrx_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlethrx_family, nss_nlethrx_ops, nss_nlethrx_mcgrp); -+ error = genl_register_family(&nss_nlethrx_family); - if (error) { - nss_nl_info_always("Error: unable to register eth_rx family\n"); - return false; ---- a/netlink/nss_nlgre_redir_cmd.c -+++ b/netlink/nss_nlgre_redir_cmd.c -@@ -43,11 +43,46 @@ static DEFINE_SPINLOCK(lock); - static enum nss_nlgre_redir_cmd_deploy_mode deploy_mode; - - /* -+ * prototypes -+ */ -+static int nss_nlgre_redir_cmd_ops_tun_create(struct sk_buff *skb, struct genl_info *info); -+static int nss_nlgre_redir_cmd_ops_tun_destroy(struct sk_buff *skb, struct genl_info *info); -+static int nss_nlgre_redir_cmd_ops_map(struct sk_buff *skb, struct genl_info *info); -+static int nss_nlgre_redir_cmd_ops_unmap(struct sk_buff *skb, struct genl_info *info); -+static int nss_nlgre_redir_cmd_ops_set_next(struct sk_buff *skb, struct genl_info *info); -+static int nss_nlgre_redir_cmd_ops_add_hash(struct sk_buff *skb, struct genl_info *info); -+static int nss_nlgre_redir_cmd_ops_del_hash(struct sk_buff *skb, struct genl_info *info); -+ -+/* -+ * nss_nlgre_redir_cmd_mcgrp -+ * Multicast group for sending message status & events -+ */ -+static const struct genl_multicast_group nss_nlgre_redir_family_mcgrp[] = { -+ {.name = NSS_NLGRE_REDIR_MCAST_GRP}, -+}; -+ -+/* -+ * nss_nlgre_redir_ops -+ * Operation table called by the generic netlink layer based on the command -+ */ -+static struct genl_ops nss_nlgre_redir_ops[] = { -+ {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_CREATE_TUN, .doit = nss_nlgre_redir_cmd_ops_tun_create,}, -+ {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_DESTROY_TUN, .doit = nss_nlgre_redir_cmd_ops_tun_destroy,}, -+ {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_MAP, .doit = nss_nlgre_redir_cmd_ops_map,}, -+ {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_UNMAP, .doit = nss_nlgre_redir_cmd_ops_unmap,}, -+ {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_SET_NEXT_HOP, .doit = nss_nlgre_redir_cmd_ops_set_next,}, -+ {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_ADD_HASH, .doit = nss_nlgre_redir_cmd_ops_add_hash,}, -+ {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_DEL_HASH, .doit = nss_nlgre_redir_cmd_ops_del_hash,}, -+}; -+ -+/* - * nss_nlgre_redir_cmd_family - * Gre_redir family definition - */ - struct genl_family nss_nlgre_redir_cmd_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) - .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif - .name = NSS_NLGRE_REDIR_FAMILY, /* family name string */ - .hdrsize = sizeof(struct nss_nlgre_redir_rule), /* NSS NETLINK gre_redir rule */ - .version = NSS_NL_VER, /* Set it to NSS_NLGRE_REDIR version */ -@@ -55,6 +90,10 @@ struct genl_family nss_nlgre_redir_cmd_f - .netnsok = true, - .pre_doit = NULL, - .post_doit = NULL, -+ .ops = nss_nlgre_redir_ops, -+ .n_ops = ARRAY_SIZE(nss_nlgre_redir_ops), -+ .mcgrps = nss_nlgre_redir_family_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlgre_redir_family_mcgrp) - }; - - /* -@@ -134,7 +173,7 @@ done: - } - - /* -- * nss_nlgre_redir_cmd_ops_destroy_tun() -+ * nss_nlgre_redir_cmd_ops_tun_destroy() - * Handler to destroy tunnel - */ - static int nss_nlgre_redir_cmd_ops_tun_destroy(struct sk_buff *skb, struct genl_info *info) -@@ -287,7 +326,7 @@ static int nss_nlgre_redir_cmd_ops_unmap - } - - /* -- * nss_nlgre_redir_cmd_set_next() -+ * nss_nlgre_redir_cmd_ops_set_next() - * Handler for set_next command - */ - static int nss_nlgre_redir_cmd_ops_set_next(struct sk_buff *skb, struct genl_info *info) -@@ -340,7 +379,7 @@ done: - } - - /* -- * nss_nlgre_redir_cmd_add_hash() -+ * nss_nlgre_redir_cmd_ops_add_hash() - * Handler for adding hash a value - */ - static int nss_nlgre_redir_cmd_ops_add_hash(struct sk_buff *skb, struct genl_info *info) -@@ -373,7 +412,7 @@ static int nss_nlgre_redir_cmd_ops_add_h - } - - /* -- * nss_nlgre_redir_cmd_del_hash() -+ * nss_nlgre_redir_cmd_ops_del_hash() - * Handler for deleting a hash value - */ - static int nss_nlgre_redir_cmd_ops_del_hash(struct sk_buff *skb, struct genl_info *info) -@@ -410,20 +449,6 @@ static int nss_nlgre_redir_cmd_ops_del_h - } - - /* -- * nss_nlgre_redir_cmd_ops -- * Operation table called by the generic netlink layer based on the command -- */ --struct genl_ops nss_nlgre_redir_cmd_ops[] = { -- {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_CREATE_TUN, .doit = nss_nlgre_redir_cmd_ops_tun_create,}, -- {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_DESTROY_TUN, .doit = nss_nlgre_redir_cmd_ops_tun_destroy,}, -- {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_MAP, .doit = nss_nlgre_redir_cmd_ops_map,}, -- {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_UNMAP, .doit = nss_nlgre_redir_cmd_ops_unmap,}, -- {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_SET_NEXT_HOP, .doit = nss_nlgre_redir_cmd_ops_set_next,}, -- {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_ADD_HASH, .doit = nss_nlgre_redir_cmd_ops_add_hash,}, -- {.cmd = NSS_NLGRE_REDIR_CMD_TYPE_DEL_HASH, .doit = nss_nlgre_redir_cmd_ops_del_hash,}, --}; -- --/* - * nss_nlgre_redir_cmd_get_ifnum() - * Get the interface number corresponding to netdev - */ ---- a/netlink/nss_nlgre_redir_cmd.h -+++ b/netlink/nss_nlgre_redir_cmd.h -@@ -38,11 +38,6 @@ enum nss_nlgre_redir_cmd_deploy_mode { - extern struct genl_family nss_nlgre_redir_cmd_family; - - /* -- * Gre_redir generic netlink operations -- */ --extern struct genl_ops nss_nlgre_redir_cmd_ops[NSS_NLGRE_REDIR_CMD_MAX]; -- --/* - * nss_nlgre_redir_cmd_get_ifnum() - * Get the interface number corresponding to netdev - */ ---- a/netlink/nss_nlgre_redir_cmn.c -+++ b/netlink/nss_nlgre_redir_cmn.c -@@ -354,6 +354,24 @@ static struct rtnl_link_stats64 *nss_nlg - } - - /* -+ * nss_nlgre_redir_cmn_dev_stats64 -+ * Report packet statistics to linux -+ */ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)) -+static struct rtnl_link_stats64 *nss_nlgre_redir_cmn_dev_stats64(struct net_device *dev, -+ struct rtnl_link_stats64 *stats) -+{ -+ return nss_nlgre_redir_cmn_get_stats64(dev, stats); -+} -+#else -+static void nss_nlgre_redir_cmn_dev_stats64(struct net_device *dev, -+ struct rtnl_link_stats64 *stats) -+{ -+ nss_nlgre_redir_cmn_get_stats64(dev, stats); -+} -+#endif -+ -+/* - * nss_nlgre_redir_cmn_set_mac_address() - * Sets the mac address of netdev - */ -@@ -389,7 +407,11 @@ static void nss_nlgre_redir_cmn_dev_setu - ether_setup(dev); - dev->needed_headroom = NSS_NLGRE_REDIR_CMN_NEEDED_HEADROOM; - dev->netdev_ops = &gre_redir_netdev_ops; -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)) - dev->destructor = nss_nlgre_redir_cmn_netdev_destructor; -+#else -+ dev->priv_destructor = nss_nlgre_redir_cmn_netdev_destructor; -+#endif - eth_hw_addr_random(dev); - } - -@@ -401,7 +423,7 @@ static const struct net_device_ops gre_r - .ndo_open = nss_nlgre_redir_cmn_open_interface, - .ndo_stop = nss_nlgre_redir_cmn_close_interface, - .ndo_start_xmit = nss_nlgre_redir_cmn_xmit_data, -- .ndo_get_stats64 = nss_nlgre_redir_cmn_get_stats64, -+ .ndo_get_stats64 = nss_nlgre_redir_cmn_dev_stats64, - .ndo_set_mac_address = nss_nlgre_redir_cmn_set_mac_address, - }; - ---- a/netlink/nss_nlgre_redir_family.c -+++ b/netlink/nss_nlgre_redir_family.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2015-2016,2018-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2015-2016,2018-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -28,14 +28,6 @@ - #include "nss_nlgre_redir_cmd.h" - - /* -- * nss_nlgre_redir_cmd_mcgrp -- * Multicast group for sending message status & events -- */ --static const struct genl_multicast_group nss_nlgre_redir_family_mcgrp[] = { -- {.name = NSS_NLGRE_REDIR_MCAST_GRP}, --}; -- --/* - * nss_nlgre_redir_family_init() - * handler init - */ -@@ -47,7 +39,7 @@ bool nss_nlgre_redir_family_init(void) - /* - * register NETLINK ops with the family - */ -- err = genl_register_family_with_ops_groups(&nss_nlgre_redir_cmd_family, nss_nlgre_redir_cmd_ops, nss_nlgre_redir_family_mcgrp); -+ err = genl_register_family(&nss_nlgre_redir_cmd_family); - if (err) { - nss_nl_info_always("Error: %d unable to register gre_redir family\n", err); - return false; ---- a/netlink/nss_nlipsec.c -+++ b/netlink/nss_nlipsec.c -@@ -43,6 +43,16 @@ - #include "nss_nlipv4_if.h" - - /* -+ * Function prototypes -+ */ -+static int nss_nlipsec_op_create_tunnel(struct sk_buff *skb, struct genl_info *info); -+static int nss_nlipsec_op_destroy_tunnel(struct sk_buff *skb, struct genl_info *info); -+static int nss_nlipsec_op_add_sa(struct sk_buff *skb, struct genl_info *info); -+static int nss_nlipsec_op_delete_sa(struct sk_buff *skb, struct genl_info *info); -+// static int nss_nlipsec_op_add_flow(struct sk_buff *skb, struct genl_info *info); -+// static int nss_nlipsec_op_delete_flow(struct sk_buff *skb, struct genl_info *info); -+ -+/* - * Hold netdevice references - */ - struct nss_nlipsec_ref { -@@ -72,10 +82,49 @@ struct nss_nlipsec_ctx { - static struct nss_nlipsec_ctx gbl_ctx; - - /* -+ * Multicast group for sending message status & events -+ */ -+static const struct genl_multicast_group nss_nlipsec_mcgrp[] = { -+ {.name = NSS_NLIPSEC_MCAST_GRP}, -+}; -+ -+/* -+ * Operation table called by the generic netlink layer based on the command -+ */ -+static struct genl_ops nss_nlipsec_ops[] = { -+ { /* Create tunnel */ -+ .cmd = NSS_NLIPSEC_CMD_ADD_TUNNEL, -+ .doit = nss_nlipsec_op_create_tunnel, -+ }, -+ { /* Destroy tunnel */ -+ .cmd = NSS_NLIPSEC_CMD_DEL_TUNNEL, -+ .doit = nss_nlipsec_op_destroy_tunnel, -+ }, -+ { /* Add Security Association */ -+ .cmd = NSS_NLIPSEC_CMD_ADD_SA, -+ .doit = nss_nlipsec_op_add_sa, -+ }, -+ { /* Delete Security Association */ -+ .cmd = NSS_NLIPSEC_CMD_DEL_SA, -+ .doit = nss_nlipsec_op_delete_sa, -+ }, -+ // { /* Add flow */ -+ // .cmd = NSS_NLIPSEC_CMD_ADD_FLOW, -+ // .doit = nss_nlipsec_op_add_flow, -+ // }, -+ // { /* Delete flow */ -+ // .cmd = NSS_NLIPSEC_CMD_DEL_FLOW, -+ // .doit = nss_nlipsec_op_delete_flow, -+ // }, -+}; -+ -+/* - * IPsec family definition - */ - static struct genl_family nss_nlipsec_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) - .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif - .name = NSS_NLIPSEC_FAMILY, /* Family name string */ - .hdrsize = sizeof(struct nss_nlipsec_rule),/* NSS NETLINK IPsec rule */ - .version = NSS_NL_VER, /* Set it to NSS_NL version */ -@@ -83,13 +132,10 @@ static struct genl_family nss_nlipsec_fa - .netnsok = true, - .pre_doit = NULL, - .post_doit = NULL, --}; -- --/* -- * Multicast group for sending message status & events -- */ --static const struct genl_multicast_group nss_nlipsec_mcgrp[] = { -- {.name = NSS_NLIPSEC_MCAST_GRP}, -+ .ops = nss_nlipsec_ops, -+ .n_ops = ARRAY_SIZE(nss_nlipsec_ops), -+ .mcgrps = nss_nlipsec_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlipsec_mcgrp) - }; - - /* -@@ -501,7 +547,7 @@ static int nss_nlipsec_op_add_sa(struct - sa_data->cmn.keys.auth_key = sa_rule->auth_key; - sa_data->cmn.keys.nonce = sa_rule->nonce; - -- error = nss_ipsecmgr_sa_add_sync(dev, &sa_rule->tuple, sa_data, &if_num); -+ error = nss_ipsecmgr_sa_add(dev, &sa_rule->tuple, sa_data, &if_num); - if (error) { - nss_nl_error("%d: Failed to add SA for net device(%s), error:%d\n", pid, nl_rule->ifname, error); - goto free_dev; -@@ -579,102 +625,73 @@ static int nss_nlipsec_op_delete_sa(stru - * nss_nlipsec_op_add_flow() - * Add a flow - */ --static int nss_nlipsec_op_add_flow(struct sk_buff *skb, struct genl_info *info) --{ -- struct nss_ipsecmgr_flow_tuple *flow_tuple; -- struct nss_ipsecmgr_sa_tuple *sa_tuple; -- struct nss_nlipsec_rule *nl_rule; -- struct net_device *dev; -- uint32_t pid; -- int error = 0; -- -- nl_rule = nss_nlipsec_get_rule(info, NSS_NLIPSEC_CMD_ADD_FLOW, &dev); -- if (!nl_rule) { -- nss_nl_error("Failed to extract SA data\n"); -- return -EINVAL; -- } -- -- pid = nl_rule->cm.pid; -- nss_nl_error("%d: device(%s)", pid, dev->name); -- -- flow_tuple = &nl_rule->rule.flow.tuple; -- sa_tuple = &nl_rule->rule.flow.sa; -- -- error = nss_ipsecmgr_flow_add_sync(dev, flow_tuple, sa_tuple); -- if (error) { -- nss_nl_error("%d: Failed to add subnet for net_device(%s)", pid, nl_rule->ifname); -- } -- -- /* -- * dev_put for dev_get done on nss_nlipsec_get_rule -- */ -- dev_put(dev); -- return error; --} -+// static int nss_nlipsec_op_add_flow(struct sk_buff *skb, struct genl_info *info) -+// { -+// struct nss_ipsecmgr_flow_tuple *flow_tuple; -+// struct nss_ipsecmgr_sa_tuple *sa_tuple; -+// struct nss_nlipsec_rule *nl_rule; -+// struct net_device *dev; -+// uint32_t pid; -+// int error = 0; -+// -+// nl_rule = nss_nlipsec_get_rule(info, NSS_NLIPSEC_CMD_ADD_FLOW, &dev); -+// if (!nl_rule) { -+// nss_nl_error("Failed to extract SA data\n"); -+// return -EINVAL; -+// } -+// -+// pid = nl_rule->cm.pid; -+// nss_nl_error("%d: device(%s)", pid, dev->name); -+// -+// flow_tuple = &nl_rule->rule.flow.tuple; -+// sa_tuple = &nl_rule->rule.flow.sa; -+// -+// //struct nss_ipsecmgr_ref *nss_ipsecmgr_flow_alloc(struct nss_ipsecmgr_priv *priv, struct nss_ipsecmgr_key *key) -+// error = nss_ipsecmgr_flow_add_sync(dev, flow_tuple, sa_tuple); -+// if (error) { -+// nss_nl_error("%d: Failed to add subnet for net_device(%s)", pid, nl_rule->ifname); -+// } -+// -+// /* -+// * dev_put for dev_get done on nss_nlipsec_get_rule -+// */ -+// dev_put(dev); -+// return error; -+// } - - /* - * nss_nlipsec_op_delete_flow() - * Delete a flow - */ --static int nss_nlipsec_op_delete_flow(struct sk_buff *skb, struct genl_info *info) --{ -- struct nss_ipsecmgr_flow_tuple *flow_tuple; -- struct nss_ipsecmgr_sa_tuple *sa_tuple; -- struct nss_nlipsec_rule *nl_rule; -- struct net_device *dev; -- uint32_t pid; -- int error = 0; -- -- nl_rule = nss_nlipsec_get_rule(info, NSS_NLIPSEC_CMD_DEL_FLOW, &dev); -- if (!nl_rule) { -- nss_nl_error("Failed to extract SA data\n"); -- return -EINVAL; -- } -- -- pid = nl_rule->cm.pid; -- nss_nl_error("%d: device(%s)", pid, dev->name); -- -- flow_tuple = &nl_rule->rule.flow.tuple; -- sa_tuple = &nl_rule->rule.flow.sa; -- -- nss_ipsecmgr_flow_del(dev, flow_tuple, sa_tuple); -- -- /* -- * dev_put for dev_get done on nss_nlipsec_get_rule -- */ -- dev_put(dev); -- return error; --} -- --/* -- * Operation table called by the generic netlink layer based on the command -- */ --static struct genl_ops nss_nlipsec_ops[] = { -- { /* Create tunnel */ -- .cmd = NSS_NLIPSEC_CMD_ADD_TUNNEL, -- .doit = nss_nlipsec_op_create_tunnel, -- }, -- { /* Destroy tunnel */ -- .cmd = NSS_NLIPSEC_CMD_DEL_TUNNEL, -- .doit = nss_nlipsec_op_destroy_tunnel, -- }, -- { /* Add Security Association */ -- .cmd = NSS_NLIPSEC_CMD_ADD_SA, -- .doit = nss_nlipsec_op_add_sa, -- }, -- { /* Delete Security Association */ -- .cmd = NSS_NLIPSEC_CMD_DEL_SA, -- .doit = nss_nlipsec_op_delete_sa, -- }, -- { /* Add flow */ -- .cmd = NSS_NLIPSEC_CMD_ADD_FLOW, -- .doit = nss_nlipsec_op_add_flow, -- }, -- { /* Delete flow */ -- .cmd = NSS_NLIPSEC_CMD_DEL_FLOW, -- .doit = nss_nlipsec_op_delete_flow, -- }, --}; -+// static int nss_nlipsec_op_delete_flow(struct sk_buff *skb, struct genl_info *info) -+// { -+// struct nss_ipsecmgr_flow_tuple *flow_tuple; -+// struct nss_ipsecmgr_sa_tuple *sa_tuple; -+// struct nss_nlipsec_rule *nl_rule; -+// struct net_device *dev; -+// uint32_t pid; -+// int error = 0; -+// -+// nl_rule = nss_nlipsec_get_rule(info, NSS_NLIPSEC_CMD_DEL_FLOW, &dev); -+// if (!nl_rule) { -+// nss_nl_error("Failed to extract SA data\n"); -+// return -EINVAL; -+// } -+// -+// pid = nl_rule->cm.pid; -+// nss_nl_error("%d: device(%s)", pid, dev->name); -+// -+// flow_tuple = &nl_rule->rule.flow.tuple; -+// sa_tuple = &nl_rule->rule.flow.sa; -+// -+// nss_ipsecmgr_flow_del(dev, flow_tuple, sa_tuple); -+// -+// /* -+// * dev_put for dev_get done on nss_nlipsec_get_rule -+// */ -+// dev_put(dev); -+// return error; -+// } - - /* - * nss_nlipsec_init() -@@ -700,7 +717,7 @@ bool nss_nlipsec_init(void) - /* - * Register with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlipsec_family, nss_nlipsec_ops, nss_nlipsec_mcgrp); -+ error = genl_register_family(&nss_nlipsec_family); - if (error != 0) { - nss_nl_info_always("Error: unable to register IPsec family\n"); - return false; ---- a/netlink/nss_nlipv4.c -+++ b/netlink/nss_nlipv4.c -@@ -71,20 +71,6 @@ static int nss_nlipv4_ops_destroy_rule(s - static int nss_nlipv4_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * IPv4 family definition -- */ --static struct genl_family nss_nlipv4_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLIPV4_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_nlipv4_rule), /* NSS NETLINK IPv4 rule */ -- .version = NSS_NL_VER, /* Set it to NSS_NLIPv4 version */ -- .maxattr = NSS_IPV4_MAX_MSG_TYPES, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nlipv4_mcgrp[] = { -@@ -100,6 +86,26 @@ static struct genl_ops nss_nlipv4_ops[] - }; - - /* -+ * IPv4 family definition -+ */ -+static struct genl_family nss_nlipv4_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLIPV4_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_nlipv4_rule), /* NSS NETLINK IPv4 rule */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLIPv4 version */ -+ .maxattr = NSS_IPV4_MAX_MSG_TYPES, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlipv4_ops, -+ .n_ops = ARRAY_SIZE(nss_nlipv4_ops), -+ .mcgrps = nss_nlipv4_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlipv4_mcgrp) -+}; -+ -+/* - * statistics call back handler for ipv4 from NSS - */ - static struct notifier_block nss_ipv4_stats_notifier_nb = { -@@ -915,7 +921,7 @@ bool nss_nlipv4_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlipv4_family, nss_nlipv4_ops, nss_nlipv4_mcgrp); -+ error = genl_register_family(&nss_nlipv4_family); - if (error != 0) { - nss_nl_info_always("Error: unable to register IPv4 family\n"); - return false; ---- a/netlink/nss_nlipv4_reasm.c -+++ b/netlink/nss_nlipv4_reasm.c -@@ -46,20 +46,6 @@ static int nss_nlipv4_reasm_ops_get_stat - static int nss_nlipv4_reasm_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * ipv4_reasm family definition -- */ --static struct genl_family nss_nlipv4_reasm_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLIPV4_REASM_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_ipv4_reasm_stats_notification), /* NSS NETLINK ipv4_reasm stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLIPV4_REASM version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nlipv4_reasm_mcgrp[] = { -@@ -74,6 +60,26 @@ static struct genl_ops nss_nlipv4_reasm_ - }; - - /* -+ * ipv4_reasm family definition -+ */ -+static struct genl_family nss_nlipv4_reasm_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLIPV4_REASM_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_ipv4_reasm_stats_notification), /* NSS NETLINK ipv4_reasm stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLIPV4_REASM version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlipv4_reasm_ops, -+ .n_ops = ARRAY_SIZE(nss_nlipv4_reasm_ops), -+ .mcgrps = nss_nlipv4_reasm_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlipv4_reasm_mcgrp) -+}; -+ -+/* - * stats call back handler for ipv4_reasm from NSS - */ - static struct notifier_block nss_ipv4_reasm_stats_notifier_nb = { -@@ -125,7 +131,7 @@ bool nss_nlipv4_reasm_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlipv4_reasm_family, nss_nlipv4_reasm_ops, nss_nlipv4_reasm_mcgrp); -+ error = genl_register_family(&nss_nlipv4_reasm_family); - if (error) { - nss_nl_info_always("Error: unable to register ipv4_reasm family\n"); - return false; ---- a/netlink/nss_nlipv6.c -+++ b/netlink/nss_nlipv6.c -@@ -79,20 +79,6 @@ static int nss_nlipv6_ops_destroy_rule(s - static int nss_nlipv6_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * IPV6 family definition -- */ --static struct genl_family nss_nlipv6_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLIPV6_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_nlipv6_rule), /* NSS NETLINK IPV6 rule */ -- .version = NSS_NL_VER, /* Set it to NSS_NLIPV6 version */ -- .maxattr = NSS_IPV6_MAX_MSG_TYPES, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static struct genl_multicast_group nss_nlipv6_mcgrp[] = { -@@ -108,6 +94,26 @@ static struct genl_ops nss_nlipv6_ops[] - }; - - /* -+ * IPV6 family definition -+ */ -+static struct genl_family nss_nlipv6_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLIPV6_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_nlipv6_rule), /* NSS NETLINK IPV6 rule */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLIPV6 version */ -+ .maxattr = NSS_IPV6_MAX_MSG_TYPES, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlipv6_ops, -+ .n_ops = ARRAY_SIZE(nss_nlipv6_ops), -+ .mcgrps = nss_nlipv6_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlipv6_mcgrp) -+}; -+ -+/* - * statistics call back handler for ipv6 from NSS - */ - static struct notifier_block nss_ipv6_stats_notifier_nb = { -@@ -131,7 +137,11 @@ static struct neighbour *nss_nlipv6_get_ - - IPV6_ADDR_TO_IN6_ADDR(daddr, dst_addr); - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)) - rt = rt6_lookup(&init_net, &daddr, NULL, 0, 0); -+#else -+ rt = rt6_lookup(&init_net, &daddr, NULL, 0, NULL, 0); -+#endif - if (!rt) { - return NULL; - } -@@ -916,7 +926,7 @@ bool nss_nlipv6_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlipv6_family, nss_nlipv6_ops, nss_nlipv6_mcgrp); -+ error = genl_register_family(&nss_nlipv6_family); - if (error != 0) { - nss_nl_info_always("Error: unable to register IPV6 family\n"); - return false; ---- a/netlink/nss_nlipv6_reasm.c -+++ b/netlink/nss_nlipv6_reasm.c -@@ -46,20 +46,6 @@ static int nss_nlipv6_reasm_ops_get_stat - static int nss_nlipv6_reasm_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * ipv6_reasm family definition -- */ --static struct genl_family nss_nlipv6_reasm_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLIPV6_REASM_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_ipv6_reasm_stats_notification), /* NSS NETLINK ipv6_reasm stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLIPV6_REASM version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nlipv6_reasm_mcgrp[] = { -@@ -74,6 +60,26 @@ static struct genl_ops nss_nlipv6_reasm_ - }; - - /* -+ * ipv6_reasm family definition -+ */ -+static struct genl_family nss_nlipv6_reasm_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLIPV6_REASM_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_ipv6_reasm_stats_notification), /* NSS NETLINK ipv6_reasm stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLIPV6_REASM version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlipv6_reasm_ops, -+ .n_ops = ARRAY_SIZE(nss_nlipv6_reasm_ops), -+ .mcgrps = nss_nlipv6_reasm_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlipv6_reasm_mcgrp) -+}; -+ -+/* - * stats call back handler for ipv6_reasm from NSS - */ - static struct notifier_block nss_ipv6_reasm_stats_notifier_nb = { -@@ -125,7 +131,7 @@ bool nss_nlipv6_reasm_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlipv6_reasm_family, nss_nlipv6_reasm_ops, nss_nlipv6_reasm_mcgrp); -+ error = genl_register_family(&nss_nlipv6_reasm_family); - if (error) { - nss_nl_info_always("Error: unable to register ipv6_reasm family\n"); - return false; ---- a/netlink/nss_nll2tpv2.c -+++ b/netlink/nss_nll2tpv2.c -@@ -47,20 +47,6 @@ static int nss_nll2tpv2_ops_get_stats(st - static int nss_nll2tpv2_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * l2tpv2 family definition -- */ --static struct genl_family nss_nll2tpv2_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLL2TPV2_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_l2tpv2_stats_notification), /* NSS NETLINK l2tpv2 stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLL2TPV2 version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nll2tpv2_mcgrp[] = { -@@ -75,6 +61,26 @@ static struct genl_ops nss_nll2tpv2_ops[ - }; - - /* -+ * l2tpv2 family definition -+ */ -+static struct genl_family nss_nll2tpv2_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLL2TPV2_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_l2tpv2_stats_notification), /* NSS NETLINK l2tpv2 stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLL2TPV2 version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nll2tpv2_ops, -+ .n_ops = ARRAY_SIZE(nss_nll2tpv2_ops), -+ .mcgrps = nss_nll2tpv2_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nll2tpv2_mcgrp) -+}; -+ -+/* - * device call back handler for l2tpv2 from NSS - */ - static struct notifier_block nss_l2tpv2_stats_notifier_nb = { -@@ -126,7 +132,7 @@ bool nss_nll2tpv2_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nll2tpv2_family, nss_nll2tpv2_ops, nss_nll2tpv2_mcgrp); -+ error = genl_register_family(&nss_nll2tpv2_family); - if (error) { - nss_nl_info_always("Error: unable to register l2tpv2 family\n"); - return false; ---- a/netlink/nss_nllso_rx.c -+++ b/netlink/nss_nllso_rx.c -@@ -47,20 +47,6 @@ static int nss_nllso_rx_ops_get_stats(st - static int nss_nllso_rx_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * lso_rx family definition -- */ --static struct genl_family nss_nllso_rx_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLLSO_RX_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_lso_rx_stats_notification), /* NSS NETLINK lso_rx stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLLSO_RX version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nllso_rx_mcgrp[] = { -@@ -75,6 +61,26 @@ static struct genl_ops nss_nllso_rx_ops[ - }; - - /* -+ * lso_rx family definition -+ */ -+static struct genl_family nss_nllso_rx_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLLSO_RX_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_lso_rx_stats_notification), /* NSS NETLINK lso_rx stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLLSO_RX version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nllso_rx_ops, -+ .n_ops = ARRAY_SIZE(nss_nllso_rx_ops), -+ .mcgrps = nss_nllso_rx_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nllso_rx_mcgrp) -+}; -+ -+/* - * device call back handler for lso_rx from NSS - */ - static struct notifier_block nss_lso_rx_stats_notifier_nb = { -@@ -126,7 +132,7 @@ bool nss_nllso_rx_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nllso_rx_family, nss_nllso_rx_ops, nss_nllso_rx_mcgrp); -+ error = genl_register_family(&nss_nllso_rx_family); - if (error) { - nss_nl_info_always("Error: unable to register lso_rx family\n"); - return false; ---- a/netlink/nss_nlmap_t.c -+++ b/netlink/nss_nlmap_t.c -@@ -47,20 +47,6 @@ static int nss_nlmap_t_ops_get_stats(str - static int nss_nlmap_t_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * map_t family definition -- */ --static struct genl_family nss_nlmap_t_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLMAP_T_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_map_t_stats_notification), /* NSS NETLINK map_t stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLMAP_T version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nlmap_t_mcgrp[] = { -@@ -75,6 +61,26 @@ static struct genl_ops nss_nlmap_t_ops[] - }; - - /* -+ * map_t family definition -+ */ -+static struct genl_family nss_nlmap_t_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLMAP_T_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_map_t_stats_notification), /* NSS NETLINK map_t stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLMAP_T version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlmap_t_ops, -+ .n_ops = ARRAY_SIZE(nss_nlmap_t_ops), -+ .mcgrps = nss_nlmap_t_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlmap_t_mcgrp) -+}; -+ -+/* - * device call back handler for map_t from NSS - */ - static struct notifier_block nss_map_t_stats_notifier_nb = { -@@ -126,7 +132,7 @@ bool nss_nlmap_t_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlmap_t_family, nss_nlmap_t_ops, nss_nlmap_t_mcgrp); -+ error = genl_register_family(&nss_nlmap_t_family); - if (error) { - nss_nl_info_always("Error: unable to register map_t family\n"); - return false; ---- a/netlink/nss_nln2h.c -+++ b/netlink/nss_nln2h.c -@@ -46,20 +46,6 @@ static int nss_nln2h_ops_get_stats(struc - static int nss_nln2h_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * n2h family definition -- */ --static struct genl_family nss_nln2h_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLN2H_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_n2h_stats_notification), /* NSS NETLINK n2h stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLN2H version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nln2h_mcgrp[] = { -@@ -74,6 +60,26 @@ static struct genl_ops nss_nln2h_ops[] = - }; - - /* -+ * n2h family definition -+ */ -+static struct genl_family nss_nln2h_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLN2H_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_n2h_stats_notification), /* NSS NETLINK n2h stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLN2H version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nln2h_ops, -+ .n_ops = ARRAY_SIZE(nss_nln2h_ops), -+ .mcgrps = nss_nln2h_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nln2h_mcgrp) -+}; -+ -+/* - * stats call back handler for n2h from NSS - */ - static struct notifier_block nss_n2h_stats_notifier_nb = { -@@ -125,7 +131,7 @@ bool nss_nln2h_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nln2h_family, nss_nln2h_ops, nss_nln2h_mcgrp); -+ error = genl_register_family(&nss_nln2h_family); - if (error) { - nss_nl_info_always("Error: unable to register n2h family\n"); - return false; ---- a/netlink/nss_nloam.c -+++ b/netlink/nss_nloam.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016,2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016,2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -82,11 +82,25 @@ struct nss_nloam_msg_map global_nloam_ms - }, - }; - -+static struct genl_multicast_group nss_nloam_mcgrp[] = { -+ {.name = NSS_NLOAM_MCAST_GRP}, -+}; -+ -+/* -+ * operation table called by the generic netlink layer based on the command -+ */ -+static struct genl_ops nss_nloam_ops[] = { -+ {.cmd = NSS_NLOAM_CMD_NONE, .doit = nss_nloam_op_none,}, -+ {.cmd = NSS_NLOAM_CMD_GET_REQ, .doit = nss_nloam_op_get_req,}, -+}; -+ - /* - * OAM family definition - */ - static struct genl_family nss_nloam_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) - .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif - .name = NSS_NLOAM_FAMILY, /* family name string */ - .hdrsize = sizeof(struct nss_nloam_rule), /* NLOAM msg size */ - .version = NSS_NL_VER, /* nss netlink version */ -@@ -94,18 +108,10 @@ static struct genl_family nss_nloam_fami - .netnsok = false, - .pre_doit = NULL, - .post_doit = NULL, --}; -- --static struct genl_multicast_group nss_nloam_mcgrp[] = { -- {.name = NSS_NLOAM_MCAST_GRP}, --}; -- --/* -- * operation table called by the generic netlink layer based on the command -- */ --static struct genl_ops nss_nloam_ops[] = { -- {.cmd = NSS_NLOAM_CMD_NONE, .doit = nss_nloam_op_none,}, -- {.cmd = NSS_NLOAM_CMD_GET_REQ, .doit = nss_nloam_op_get_req,}, -+ .ops = nss_nloam_ops, -+ .n_ops = ARRAY_SIZE(nss_nloam_ops), -+ .mcgrps = nss_nloam_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nloam_mcgrp) - }; - - #define NSS_NLOAM_OPS_SZ ARRAY_SIZE(nss_nloam_ops) -@@ -340,7 +346,7 @@ bool nss_nloam_init(void) - /* - * register with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nloam_family, nss_nloam_ops, nss_nloam_mcgrp); -+ error = genl_register_family(&nss_nloam_family); - if (error != 0) { - nss_nl_info_always("unable to register OAM family\n"); - return false; ---- a/netlink/nss_nlpppoe.c -+++ b/netlink/nss_nlpppoe.c -@@ -47,20 +47,6 @@ static int nss_nlpppoe_ops_get_stats(str - static int nss_nlpppoe_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * pppoe family definition -- */ --static struct genl_family nss_nlpppoe_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLPPPOE_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_pppoe_stats_notification), /* NSS NETLINK pppoe stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLPPPOE version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nlpppoe_mcgrp[] = { -@@ -75,6 +61,26 @@ static struct genl_ops nss_nlpppoe_ops[] - }; - - /* -+ * pppoe family definition -+ */ -+static struct genl_family nss_nlpppoe_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLPPPOE_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_pppoe_stats_notification), /* NSS NETLINK pppoe stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLPPPOE version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlpppoe_ops, -+ .n_ops = ARRAY_SIZE(nss_nlpppoe_ops), -+ .mcgrps = nss_nlpppoe_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlpppoe_mcgrp) -+}; -+ -+/* - * device call back handler for pppoe from NSS - */ - static struct notifier_block nss_pppoe_stats_notifier_nb = { -@@ -126,7 +132,7 @@ bool nss_nlpppoe_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlpppoe_family, nss_nlpppoe_ops, nss_nlpppoe_mcgrp); -+ error = genl_register_family(&nss_nlpppoe_family); - if (error) { - nss_nl_info_always("Error: unable to register pppoe family\n"); - return false; ---- a/netlink/nss_nlpptp.c -+++ b/netlink/nss_nlpptp.c -@@ -47,20 +47,6 @@ static int nss_nlpptp_ops_get_stats(stru - static int nss_nlpptp_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * pptp family definition -- */ --static struct genl_family nss_nlpptp_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLPPTP_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_pptp_stats_notification), /* NSS NETLINK pptp stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLPPTP version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nlpptp_mcgrp[] = { -@@ -75,6 +61,26 @@ static struct genl_ops nss_nlpptp_ops[] - }; - - /* -+ * pptp family definition -+ */ -+static struct genl_family nss_nlpptp_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLPPTP_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_pptp_stats_notification), /* NSS NETLINK pptp stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLPPTP version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlpptp_ops, -+ .n_ops = ARRAY_SIZE(nss_nlpptp_ops), -+ .mcgrps = nss_nlpptp_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlpptp_mcgrp) -+}; -+ -+/* - * device call back handler for pptp from NSS - */ - static struct notifier_block nss_pptp_stats_notifier_nb = { -@@ -126,7 +132,7 @@ bool nss_nlpptp_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlpptp_family, nss_nlpptp_ops, nss_nlpptp_mcgrp); -+ error = genl_register_family(&nss_nlpptp_family); - if (error) { - nss_nl_info_always("Error: unable to register pptp family\n"); - return false; ---- a/netlink/nss_nlwifili.c -+++ b/netlink/nss_nlwifili.c -@@ -47,20 +47,6 @@ static int nss_nlwifili_ops_get_stats(st - static int nss_nlwifili_process_notify(struct notifier_block *nb, unsigned long val, void *data); - - /* -- * wifili family definition -- */ --static struct genl_family nss_nlwifili_family = { -- .id = GENL_ID_GENERATE, /* Auto generate ID */ -- .name = NSS_NLWIFILI_FAMILY, /* family name string */ -- .hdrsize = sizeof(struct nss_wifili_stats_notification), /* NSS NETLINK wifili stats */ -- .version = NSS_NL_VER, /* Set it to NSS_NLWIFILI version */ -- .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -- .netnsok = true, -- .pre_doit = NULL, -- .post_doit = NULL, --}; -- --/* - * multicast group for sending message status & events - */ - static const struct genl_multicast_group nss_nlwifili_mcgrp[] = { -@@ -75,6 +61,26 @@ static struct genl_ops nss_nlwifili_ops[ - }; - - /* -+ * wifili family definition -+ */ -+static struct genl_family nss_nlwifili_family = { -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)) -+ .id = GENL_ID_GENERATE, /* Auto generate ID */ -+#endif -+ .name = NSS_NLWIFILI_FAMILY, /* family name string */ -+ .hdrsize = sizeof(struct nss_wifili_stats_notification), /* NSS NETLINK wifili stats */ -+ .version = NSS_NL_VER, /* Set it to NSS_NLWIFILI version */ -+ .maxattr = NSS_STATS_EVENT_MAX, /* maximum commands supported */ -+ .netnsok = true, -+ .pre_doit = NULL, -+ .post_doit = NULL, -+ .ops = nss_nlwifili_ops, -+ .n_ops = ARRAY_SIZE(nss_nlwifili_ops), -+ .mcgrps = nss_nlwifili_mcgrp, -+ .n_mcgrps = ARRAY_SIZE(nss_nlwifili_mcgrp) -+}; -+ -+/* - * device call back handler for wifili from NSS - */ - static struct notifier_block nss_wifili_stats_notifier_nb = { -@@ -126,7 +132,7 @@ bool nss_nlwifili_init(void) - /* - * register NETLINK ops with the family - */ -- error = genl_register_family_with_ops_groups(&nss_nlwifili_family, nss_nlwifili_ops, nss_nlwifili_mcgrp); -+ error = genl_register_family(&nss_nlwifili_family); - if (error) { - nss_nl_info_always("Error: unable to register wifili family\n"); - return false; ---- a/netlink/nss_nlcapwap.c -+++ b/netlink/nss_nlcapwap.c -@@ -36,7 +36,6 @@ - #include - #include - #include --#include "nss_crypto_defines.h" - #include "nss_nl.h" - #include "nss_nlcapwap_if.h" - #include "nss_nlcapwap.h" -@@ -1510,7 +1509,7 @@ bool nss_nlcapwap_init(void) - /* - * register NETLINK ops with the family - */ -- err = genl_register_family_with_ops_groups(&nss_nlcapwap_family, nss_nlcapwap_cmd_ops, nss_nlcapwap_family_mcgrp); -+ err = genl_register_family(&nss_nlcapwap_family); - if (err) { - nss_nl_info_always("Error: %d unable to register capwap family\n", err); - goto free; diff --git a/qca-nss-clients/patches/0003-11.4-netlink-optimize.patch b/qca-nss-clients/patches/0003-11.4-netlink-optimize.patch deleted file mode 100644 index 9c6f544..0000000 --- a/qca-nss-clients/patches/0003-11.4-netlink-optimize.patch +++ /dev/null @@ -1,336 +0,0 @@ ---- a/netlink/Makefile -+++ b/netlink/Makefile -@@ -1,3 +1,4 @@ -+GRE_ENABLED := $(strip $(if $(filter $(gre), y), 1 , 0)) - CAPWAP_ENABLED := $(strip $(if $(filter $(capwapmgr), y), 1 , 0)) - IPSEC_ENABLED := $(strip $(if $(filter $(ipsecmgr), y), 1 , 0)) - DTLS_ENABLED := $(strip $(if $(filter $(dtlsmgr), y), 1 , 0)) -@@ -10,44 +11,39 @@ ccflags-y += -DNSS_CLIENT_BUILD_ID="$(BU - - ccflags-y += -DCONFIG_NSS_NLIPV4=1 - ccflags-y += -DCONFIG_NSS_NLIPV6=1 --ccflags-y += -DCONFIG_NSS_NLOAM=1 --ccflags-y += -DCONFIG_NSS_NLGRE_REDIR_FAMILY=1 -+ccflags-y += -DCONFIG_NSS_NLOAM=0 -+ccflags-y += -DCONFIG_NSS_NLGRE_REDIR_FAMILY=${GRE_ENABLED} - ccflags-y += -DCONFIG_NSS_NLETHRX=1 - ccflags-y += -DCONFIG_NSS_NLDYNAMIC_INTERFACE=1 - ccflags-y += -DCONFIG_NSS_NLN2H=1 --ccflags-y += -DCONFIG_NSS_NLIPV4_REASM=1 --ccflags-y += -DCONFIG_NSS_NLIPV6_REASM=1 -+ccflags-y += -DCONFIG_NSS_NLIPV4_REASM=0 -+ccflags-y += -DCONFIG_NSS_NLIPV6_REASM=0 - ccflags-y += -DCONFIG_NSS_NLWIFILI=1 - ccflags-y += -DCONFIG_NSS_NLLSO_RX=1 --ccflags-y += -DCONFIG_NSS_NLMAP_T=1 --ccflags-y += -DCONFIG_NSS_NLPPPOE=1 --ccflags-y += -DCONFIG_NSS_NLL2TPV2=1 --ccflags-y += -DCONFIG_NSS_NLPPTP=1 -+ccflags-y += -DCONFIG_NSS_NLMAP_T=0 -+ccflags-y += -DCONFIG_NSS_NLPPPOE=0 -+ccflags-y += -DCONFIG_NSS_NLL2TPV2=0 -+ccflags-y += -DCONFIG_NSS_NLPPTP=0 - ccflags-y += -DCONFIG_NSS_NLCAPWAP=${CAPWAP_ENABLED} - ccflags-y += -DCONFIG_NSS_NLIPSEC=${IPSEC_ENABLED} - ccflags-y += -DCONFIG_NSS_NLDTLS=${DTLS_ENABLED} - - qca-nss-netlink-objs := nss_nl.o --qca-nss-netlink-objs += nss_nlgre_redir_family.o --qca-nss-netlink-objs += nss_nlgre_redir_cmd.o --qca-nss-netlink-objs += nss_nlgre_redir_cmn.o --qca-nss-netlink-objs += nss_nlgre_redir.o --qca-nss-netlink-objs += nss_nlgre_redir_lag.o - qca-nss-netlink-objs += nss_nlipv4.o - qca-nss-netlink-objs += nss_nlipv6.o --qca-nss-netlink-objs += nss_nloam.o -+# qca-nss-netlink-objs += nss_nloam.o - qca-nss-netlink-objs += nss_nlethrx.o - qca-nss-netlink-objs += nss_nldynamic_interface.o - qca-nss-netlink-objs += nss_nln2h.o --qca-nss-netlink-objs += nss_nlipv4_reasm.o --qca-nss-netlink-objs += nss_nlipv6_reasm.o -+# qca-nss-netlink-objs += nss_nlipv4_reasm.o -+# qca-nss-netlink-objs += nss_nlipv6_reasm.o - qca-nss-netlink-objs += nss_nlwifili.o - qca-nss-netlink-objs += nss_nllso_rx.o --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_nlmap_t.o -+# qca-nss-netlink-objs += nss_nlpppoe.o -+# qca-nss-netlink-objs += nss_nll2tpv2.o -+# qca-nss-netlink-objs += nss_nlpptp.o -+# - ifneq (,$(filter $(capwapmgr), y)) - qca-nss-netlink-objs += nss_nlcapwap.o - endif -@@ -60,6 +56,14 @@ ifneq (,$(filter $(ipsecmgr), y)) - qca-nss-netlink-objs += nss_nlipsec.o - endif - -+ifneq (,$(filter $(gre), y)) -+qca-nss-netlink-objs += nss_nlgre_redir_family.o -+qca-nss-netlink-objs += nss_nlgre_redir_cmd.o -+qca-nss-netlink-objs += nss_nlgre_redir_cmn.o -+qca-nss-netlink-objs += nss_nlgre_redir.o -+qca-nss-netlink-objs += nss_nlgre_redir_lag.o -+endif -+ - ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64)) - ccflags-y += -DCONFIG_NSS_NLC2C_TX=1 - ccflags-y += -DCONFIG_NSS_NLC2C_RX=1 ---- a/netlink/nss_nl.c -+++ b/netlink/nss_nl.c -@@ -35,8 +35,6 @@ - #include "nss_nlcmn_if.h" - #include "nss_nldtls.h" - #include "nss_nldtls_if.h" --#include "nss_nlgre_redir_if.h" --#include "nss_nlgre_redir_family.h" - #include "nss_nlipsec.h" - #include "nss_nlipsec_if.h" - #include "nss_nlipv4.h" -@@ -59,10 +57,6 @@ - #include "nss_nlc2c_tx_if.h" - #include "nss_nlc2c_rx.h" - #include "nss_nlc2c_rx_if.h" --#include "nss_nlipv4_reasm.h" --#include "nss_nlipv4_reasm_if.h" --#include "nss_nlipv6_reasm.h" --#include "nss_nlipv6_reasm_if.h" - #include "nss_nlwifili.h" - #include "nss_nlwifili_if.h" - #include "nss_nllso_rx.h" -@@ -106,24 +100,6 @@ static struct nss_nl_family family_handl - }, - { - /* -- * NSS_NLIPSEC -- */ -- .name = NSS_NLIPSEC_FAMILY, /* ipsec */ -- .entry = NSS_NLIPSEC_INIT, /* init */ -- .exit = NSS_NLIPSEC_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLIPSEC /* 1 or 0 */ -- }, -- { -- /* -- * NSS_NLOAM -- */ -- .name = NSS_NLOAM_FAMILY, /* oam */ -- .entry = NSS_NLOAM_INIT, /* init */ -- .exit = NSS_NLOAM_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLOAM /* 1 or 0 */ -- }, -- { -- /* - * NSS_NLIPV6 - */ - .name = NSS_NLIPV6_FAMILY, /* ipv6 */ -@@ -133,24 +109,6 @@ static struct nss_nl_family family_handl - }, - { - /* -- * NSS_NLGRE_REDIR -- */ -- .name = NSS_NLGRE_REDIR_FAMILY, /* gre_redir */ -- .entry = NSS_NLGRE_REDIR_FAMILY_INIT, /* init */ -- .exit = NSS_NLGRE_REDIR_FAMILY_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLGRE_REDIR_FAMILY /* 1 or 0 */ -- }, -- { -- /* -- * NSS_NLCAPWAP -- */ -- .name = NSS_NLCAPWAP_FAMILY, /* capwap */ -- .entry = NSS_NLCAPWAP_INIT, /* init */ -- .exit = NSS_NLCAPWAP_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLCAPWAP /* 1 or 0 */ -- }, -- { -- /* - * NSS_NLDTLS - */ - .name = NSS_NLDTLS_FAMILY, /* dtls */ -@@ -169,15 +127,6 @@ static struct nss_nl_family family_handl - }, - { - /* -- * NSS_NLEDMA -- */ -- .name = NSS_NLEDMA_FAMILY, /* edma */ -- .entry = NSS_NLEDMA_INIT, /* init */ -- .exit = NSS_NLEDMA_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLEDMA /* 1 or 0 */ -- }, -- { -- /* - * NSS_NLDYNAMIC_INTERFACE - */ - .name = NSS_NLDYNAMIC_INTERFACE_FAMILY, /* dynamic interface */ -@@ -196,42 +145,6 @@ static struct nss_nl_family family_handl - }, - { - /* -- * NSS_NLC2C_TX -- */ -- .name = NSS_NLC2C_TX_FAMILY, /* c2c_tx */ -- .entry = NSS_NLC2C_TX_INIT, /* init */ -- .exit = NSS_NLC2C_TX_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLC2C_TX /* 1 or 0 */ -- }, -- { -- /* -- * NSS_NLC2C_RX -- */ -- .name = NSS_NLC2C_RX_FAMILY, /* c2c_rx */ -- .entry = NSS_NLC2C_RX_INIT, /* init */ -- .exit = NSS_NLC2C_RX_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLC2C_RX /* 1 or 0 */ -- }, -- { -- /* -- * NSS_NLIPV4_REASM -- */ -- .name = NSS_NLIPV4_REASM_FAMILY, /* ipv4_reasm */ -- .entry = NSS_NLIPV4_REASM_INIT, /* init */ -- .exit = NSS_NLIPV4_REASM_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLIPV4_REASM /* 1 or 0 */ -- }, -- { -- /* -- * NSS_NLIPV6_REASM -- */ -- .name = NSS_NLIPV6_REASM_FAMILY, /* ipv6_reasm */ -- .entry = NSS_NLIPV6_REASM_INIT, /* init */ -- .exit = NSS_NLIPV6_REASM_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLIPV6_REASM /* 1 or 0 */ -- }, -- { -- /* - * NSS_NLWIFILI - */ - .name = NSS_NLWIFILI_FAMILY, /* wifili */ -@@ -248,42 +161,6 @@ static struct nss_nl_family family_handl - .exit = NSS_NLLSO_RX_EXIT, /* exit */ - .valid = CONFIG_NSS_NLLSO_RX /* 1 or 0 */ - }, -- { -- /* -- * NSS_NLMAP_T -- */ -- .name = NSS_NLMAP_T_FAMILY, /* map_t */ -- .entry = NSS_NLMAP_T_INIT, /* init */ -- .exit = NSS_NLMAP_T_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLMAP_T /* 1 or 0 */ -- }, -- { -- /* -- * NSS_NLPPPOE -- */ -- .name = NSS_NLPPPOE_FAMILY, /* pppoe */ -- .entry = NSS_NLPPPOE_INIT, /* init */ -- .exit = NSS_NLPPPOE_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLPPPOE /* 1 or 0 */ -- }, -- { -- /* -- * NSS_NLL2TPV2 -- */ -- .name = NSS_NLL2TPV2_FAMILY, /* l2tpv2 */ -- .entry = NSS_NLL2TPV2_INIT, /* init */ -- .exit = NSS_NLL2TPV2_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLL2TPV2 /* 1 or 0 */ -- }, -- { -- /* -- * NSS_NLPPTP -- */ -- .name = NSS_NLPPTP_FAMILY, /* pptp */ -- .entry = NSS_NLPPTP_INIT, /* init */ -- .exit = NSS_NLPPTP_EXIT, /* exit */ -- .valid = CONFIG_NSS_NLPPTP /* 1 or 0 */ -- }, - }; - - #define NSS_NL_FAMILY_HANDLER_SZ ARRAY_SIZE(family_handlers) ---- a/netlink/nss_nlipv4.c -+++ b/netlink/nss_nlipv4.c -@@ -336,20 +336,6 @@ static int nss_nlipv4_verify_conn_rule(s - tuple->return_ident, tuple->flow_ident); - break; - -- case NSS_NL_IFTYPE_TUNNEL_GRE: -- /* -- * Currently this implementation is only for gre_redir -- */ -- conn->flow_interface_num = nss_nlgre_redir_cmd_get_ifnum(flow_dev, tuple->protocol); -- if (conn->flow_interface_num < 0 ) { -- nss_nl_error("%px: Failed to get flow interface number (dev:%s, type:%d)\n", -- flow_dev, flow_dev->name, flow_iftype); -- return -EINVAL; -- } -- -- conn->flow_mtu = nss_nlgre_redir_cmd_get_mtu(flow_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV4, conn->flow_interface_num); -- break; -- - case NSS_NL_IFTYPE_VLAN: - conn->flow_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(flow_dev)); - if (conn->flow_interface_num < 0 ) { -@@ -396,17 +382,6 @@ static int nss_nlipv4_verify_conn_rule(s - tuple->return_ident, tuple->flow_ident); - break; - -- case NSS_NL_IFTYPE_TUNNEL_GRE: -- conn->return_interface_num = nss_nlgre_redir_cmd_get_ifnum(return_dev, tuple->protocol); -- if (conn->return_interface_num < 0 ) { -- nss_nl_error("%px: Failed to get return interface number (dev:%s, type:%d)\n", -- return_dev, return_dev->name, return_iftype); -- return -EINVAL; -- } -- -- conn->return_mtu = nss_nlgre_redir_cmd_get_mtu(return_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV4, conn->return_interface_num); -- break; -- - case NSS_NL_IFTYPE_VLAN: - conn->return_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(return_dev)); - if (conn->return_interface_num < 0 ) { ---- a/netlink/nss_nlipv6.c -+++ b/netlink/nss_nlipv6.c -@@ -353,17 +353,6 @@ static int nss_nlipv6_verify_conn_rule(s - tuple->return_ident, tuple->flow_ident); - break; - -- case NSS_NL_IFTYPE_TUNNEL_GRE: -- conn->flow_interface_num = nss_nlgre_redir_cmd_get_ifnum(flow_dev, tuple->protocol); -- if (conn->flow_interface_num < 0 ) { -- nss_nl_error("%px: Failed to get flow interface number (dev:%s, type:%d)\n", -- flow_dev, flow_dev->name, flow_iftype); -- return -EINVAL; -- } -- -- conn->flow_mtu = nss_nlgre_redir_cmd_get_mtu(flow_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV6, conn->flow_interface_num); -- break; -- - case NSS_NL_IFTYPE_VLAN: - conn->flow_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(flow_dev)); - if (conn->flow_interface_num < 0 ) { -@@ -411,17 +400,6 @@ static int nss_nlipv6_verify_conn_rule(s - tuple->return_ident, tuple->flow_ident); - break; - -- case NSS_NL_IFTYPE_TUNNEL_GRE: -- conn->return_interface_num = nss_nlgre_redir_cmd_get_ifnum(return_dev, tuple->protocol); -- if (conn->return_interface_num < 0 ) { -- nss_nl_error("%px: Failed to get return interface number (dev:%s, type:%d)\n", -- return_dev, return_dev->name, return_iftype); -- return -EINVAL; -- } -- -- conn->return_mtu = nss_nlgre_redir_cmd_get_mtu(return_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV6, conn->return_interface_num); -- break; -- - case NSS_NL_IFTYPE_VLAN: - conn->return_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(return_dev)); - if (conn->return_interface_num < 0 ) { diff --git a/qca-nss-clients/patches/0003-11.4-qdisc.patch b/qca-nss-clients/patches/0003-11.4-qdisc.patch index 4762d21..fe6729a 100644 --- a/qca-nss-clients/patches/0003-11.4-qdisc.patch +++ b/qca-nss-clients/patches/0003-11.4-qdisc.patch @@ -358,7 +358,7 @@ err = tcf_register_action(&nss_mirred_act_ops, NSS_MIRRED_TAB_MASK); if (err) { unregister_netdevice_notifier(&nss_mirred_device_notifier); -@@ -538,6 +731,13 @@ static int __init nss_mirred_init_module +@@ -538,6 +731,18 @@ static int __init nss_mirred_init_module unregister_netdevice_notifier(&nss_mirred_device_notifier); return err; } @@ -369,13 +369,23 @@ + return err; + } +#endif ++ ++ /* ++ * Set the IGS module reference variable. ++ */ ++ nss_igs_module_save(&nss_mirred_act_ops, THIS_MODULE); - /* - * Set the IGS module reference variable. -@@ -559,12 +759,16 @@ static void __exit nss_mirred_cleanup_mo - */ - nss_igs_module_save(&nss_mirred_act_ops, NULL); - + nss_ifb_init(); + return 0; +@@ -549,12 +754,21 @@ static int __init nss_mirred_init_module + */ + static void __exit nss_mirred_cleanup_module(void) + { ++ /* ++ * Reset the IGS module reference variable. ++ */ ++ nss_igs_module_save(&nss_mirred_act_ops, NULL); ++ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)) nf_unregister_hooks(nss_mirred_igs_nf_ops, ARRAY_SIZE(nss_mirred_igs_nf_ops)); @@ -432,6 +442,23 @@ + --- a/nss_qdisc/nss_bf.c +++ b/nss_qdisc/nss_bf.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -58,7 +58,7 @@ static inline struct nss_bf_class_data * + struct Qdisc_class_common *clc; + clc = qdisc_class_find(&q->clhash, classid); + if (clc == NULL) { +- nss_qdisc_info("Cannot find class with classid %u in qdisc %p hash table %p\n", classid, sch, &q->clhash); ++ nss_qdisc_info("Cannot find class with classid %u in qdisc %px hash table %px\n", classid, sch, &q->clhash); + return NULL; + } + return container_of(clc, struct nss_bf_class_data, cl_common); @@ -68,12 +68,20 @@ static inline struct nss_bf_class_data * * nss_bf_change_class() * Configures a new class. @@ -467,7 +494,16 @@ if (!qopt) { return -EINVAL; } -@@ -111,7 +124,7 @@ static int nss_bf_change_class(struct Qd +@@ -102,7 +115,7 @@ static int nss_bf_change_class(struct Qd + return -EINVAL; + } + +- nss_qdisc_info("Bf class %u allocated %p\n", classid, cl); ++ nss_qdisc_info("Bf class %u allocated %px\n", classid, cl); + cl->cl_common.classid = classid; + + /* +@@ -111,17 +124,18 @@ static int nss_bf_change_class(struct Qd * reference count should not be 0. */ cl->qdisc = &noop_qdisc; @@ -475,8 +511,11 @@ + nss_qdisc_atomic_set(&cl->nq); *arg = (unsigned long)cl; - nss_qdisc_info("Adding classid %u to qdisc %px hash queue %px\n", classid, sch, &q->clhash); -@@ -121,7 +134,8 @@ static int nss_bf_change_class(struct Qd +- nss_qdisc_info("Adding classid %u to qdisc %p hash queue %p\n", classid, sch, &q->clhash); ++ nss_qdisc_info("Adding classid %u to qdisc %px hash queue %px\n", classid, sch, &q->clhash); + + /* + * This is where a class gets initialized. Classes do not have a init function * that is registered to Linux. Therefore we initialize the NSSBF_GROUP shaper * here. */ @@ -486,6 +525,26 @@ nss_qdisc_error("Nss init for class %u failed\n", classid); kfree(cl); return -EINVAL; +@@ -229,7 +243,7 @@ static void nss_bf_destroy_class(struct + struct nss_bf_sched_data *q = qdisc_priv(sch); + struct nss_if_msg nim; + +- nss_qdisc_info("Destroying bf class %p from qdisc %p\n", cl, sch); ++ nss_qdisc_info("Destroying bf class %px from qdisc %px\n", cl, sch); + + /* + * Note, this function gets called even for NSSBF and not just for NSSBF_GROUP. +@@ -238,8 +252,8 @@ static void nss_bf_destroy_class(struct + * only for the root qdisc. + */ + if (cl == &q->root) { +- nss_qdisc_info("We do not destroy bf class %p here since this is " +- "the qdisc %p\n", cl, sch); ++ nss_qdisc_info("We do not destroy bf class %px here since this is " ++ "the qdisc %px\n", cl, sch); + return; + } + @@ -260,7 +274,7 @@ static void nss_bf_destroy_class(struct /* * And now we destroy the child. @@ -507,7 +566,16 @@ { struct nss_bf_sched_data *q = qdisc_priv(sch); struct nss_bf_class_data *cl = (struct nss_bf_class_data *)arg; -@@ -311,7 +329,7 @@ static int nss_bf_delete_class(struct Qd +@@ -300,7 +318,7 @@ static int nss_bf_delete_class(struct Qd + /* + * The message to NSS should be sent to the parent of this class + */ +- nss_qdisc_info("Detaching bf class: %p\n", cl); ++ nss_qdisc_info("Detaching bf class: %px\n", cl); + nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag; + nim.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_detach.child_qos_tag = cl->nq.qos_tag; + if (nss_qdisc_node_detach(&q->nq, nq_child, &nim, +@@ -311,10 +329,10 @@ static int nss_bf_delete_class(struct Qd sch_tree_lock(sch); qdisc_reset(cl->qdisc); qdisc_class_hash_remove(&q->clhash, &cl->cl_common); @@ -515,7 +583,11 @@ + refcnt = nss_qdisc_atomic_sub_return(&cl->nq); sch_tree_unlock(sch); if (!refcnt) { - nss_qdisc_error("Reference count should not be zero for class %px\n", cl); +- nss_qdisc_error("Reference count should not be zero for class %p\n", cl); ++ nss_qdisc_error("Reference count should not be zero for class %px\n", cl); + } + + return 0; @@ -324,8 +342,13 @@ static int nss_bf_delete_class(struct Qd * nss_bf_graft_class() * Replaces the qdisc attached to the provided class. @@ -530,7 +602,59 @@ { struct nss_bf_sched_data *q = qdisc_priv(sch); struct nss_bf_class_data *cl = (struct nss_bf_class_data *)arg; -@@ -415,6 +438,7 @@ static void nss_bf_qlen_notify(struct Qd +@@ -333,10 +356,10 @@ static int nss_bf_graft_class(struct Qdi + struct nss_if_msg nim_attach; + struct nss_qdisc *nq_new = qdisc_priv(new); + +- nss_qdisc_info("Grafting class %p\n", sch); ++ nss_qdisc_info("Grafting class %px\n", sch); + + if (cl == &q->root) { +- nss_qdisc_error("Can't graft root class %p\n", cl); ++ nss_qdisc_error("Can't graft root class %px\n", cl); + return -EINVAL; + } + +@@ -351,10 +374,10 @@ static int nss_bf_graft_class(struct Qdi + * Since we initially attached a noop qdisc as child (in Linux), + * we do not perform a detach in the NSS if its a noop qdisc. + */ +- nss_qdisc_info("Grafting old: %p with new: %p\n", *old, new); ++ nss_qdisc_info("Grafting old: %px with new: %px\n", *old, new); + if (*old != &noop_qdisc) { + struct nss_qdisc *nq_old = (struct nss_qdisc *)qdisc_priv(*old); +- nss_qdisc_info("Detaching old: %p\n", *old); ++ nss_qdisc_info("Detaching old: %px\n", *old); + nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag; + if (nss_qdisc_node_detach(&cl->nq, nq_old, &nim_detach, + NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) { +@@ -367,7 +390,7 @@ static int nss_bf_graft_class(struct Qdi + * to the NSS. + */ + if (new != &noop_qdisc) { +- nss_qdisc_info("Attaching new: %p\n", new); ++ nss_qdisc_info("Attaching new: %px\n", new); + nim_attach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag; + nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_group_attach.child_qos_tag = nq_new->qos_tag; + if (nss_qdisc_node_attach(&cl->nq, nq_new, &nim_attach, +@@ -393,7 +416,7 @@ static int nss_bf_graft_class(struct Qdi + static struct Qdisc *nss_bf_leaf_class(struct Qdisc *sch, unsigned long arg) + { + struct nss_bf_class_data *cl = (struct nss_bf_class_data *)arg; +- nss_qdisc_info("bf class leaf %p\n", cl); ++ nss_qdisc_info("bf class leaf %px\n", cl); + + /* + * Since all nss_bf groups are leaf nodes, we can always +@@ -408,13 +431,14 @@ static struct Qdisc *nss_bf_leaf_class(s + */ + static void nss_bf_qlen_notify(struct Qdisc *sch, unsigned long arg) + { +- nss_qdisc_info("bf qlen notify %p\n", sch); ++ nss_qdisc_info("bf qlen notify %px\n", sch); + /* + * Gets called when qlen of child changes (Useful for deactivating) + * Not useful for us here. */ } @@ -538,7 +662,23 @@ /* * nss_bf_get_class() * Fetches the class pointer if provided the classid. -@@ -444,10 +468,24 @@ static void nss_bf_put_class(struct Qdis +@@ -423,7 +447,7 @@ static unsigned long nss_bf_get_class(st + { + struct nss_bf_class_data *cl = nss_bf_find_class(classid, sch); + +- nss_qdisc_info("Get bf class %p - class match = %p\n", sch, cl); ++ nss_qdisc_info("Get bf class %px - class match = %px\n", sch, cl); + + if (cl != NULL) + atomic_add(1, &cl->nq.refcnt); +@@ -438,16 +462,30 @@ static unsigned long nss_bf_get_class(st + static void nss_bf_put_class(struct Qdisc *sch, unsigned long arg) + { + struct nss_bf_class_data *cl = (struct nss_bf_class_data *)arg; +- nss_qdisc_info("bf put class for %p\n", cl); ++ nss_qdisc_info("bf put class for %px\n", cl); + + /* * We are safe to destroy the qdisc if the reference count * goes down to 0. */ @@ -564,6 +704,15 @@ /* * nss_bf_dump_class() +@@ -460,7 +498,7 @@ static int nss_bf_dump_class(struct Qdis + struct nlattr *opts; + struct tc_nssbf_class_qopt qopt; + +- nss_qdisc_info("Dumping class %p of Qdisc %p\n", cl, sch); ++ nss_qdisc_info("Dumping class %px of Qdisc %px\n", cl, sch); + + qopt.burst = cl->burst; + qopt.rate = cl->rate; @@ -475,7 +513,7 @@ static int nss_bf_dump_class(struct Qdis tcm->tcm_handle = cl->cl_common.classid; tcm->tcm_info = cl->qdisc->handle; @@ -582,6 +731,15 @@ nss_qdisc_gnet_stats_copy_queue(d, &nq->qstats) < 0) { return -1; } +@@ -514,7 +552,7 @@ static void nss_bf_walk(struct Qdisc *sc + struct nss_bf_class_data *cl; + unsigned int i; + +- nss_qdisc_info("In bf walk %p\n", sch); ++ nss_qdisc_info("In bf walk %px\n", sch); + if (arg->stop) + return; + @@ -538,9 +576,15 @@ static void nss_bf_walk(struct Qdisc *sc * nss_bf_change_qdisc() * Can be used to configure a nssbf qdisc. @@ -611,6 +769,35 @@ if (!qopt) { return -EINVAL; } +@@ -587,7 +635,7 @@ static int nss_bf_change_qdisc(struct Qd + static void nss_bf_reset_class(struct nss_bf_class_data *cl) + { + nss_qdisc_reset(cl->qdisc); +- nss_qdisc_info("Nssbf class resetted %p\n", cl->qdisc); ++ nss_qdisc_info("Nssbf class resetted %px\n", cl->qdisc); + } + + /* +@@ -607,7 +655,7 @@ static void nss_bf_reset_qdisc(struct Qd + } + + nss_qdisc_reset(sch); +- nss_qdisc_info("Nssbf qdisc resetted %p\n", sch); ++ nss_qdisc_info("Nssbf qdisc resetted %px\n", sch); + } + + /* +@@ -634,8 +682,8 @@ static void nss_bf_destroy_qdisc(struct + * care of by the nss_bf_destroy() function. + */ + if (cl == &q->root) { +- nss_qdisc_info("We do not detach or destroy bf class %p here since this is " +- "the qdisc %p\n", cl, sch); ++ nss_qdisc_info("We do not detach or destroy bf class %px here since this is " ++ "the qdisc %px\n", cl, sch); + continue; + } + @@ -643,7 +691,7 @@ static void nss_bf_destroy_qdisc(struct * Reduce refcnt by 1 before destroying. This is to * ensure that polling of stat stops properly. @@ -620,7 +807,15 @@ /* * Detach class before destroying it. We dont check for noop qdisc here -@@ -684,9 +732,17 @@ static void nss_bf_destroy_qdisc(struct +@@ -677,21 +725,29 @@ static void nss_bf_destroy_qdisc(struct + * will be taken care of by the graft call. + */ + nss_qdisc_destroy(&q->nq); +- nss_qdisc_info("Nssbf destroyed %p\n", sch); ++ nss_qdisc_info("Nssbf destroyed %px\n", sch); + } + + /* * nss_bf_init_qdisc() * Initializes the nssbf qdisc. */ @@ -638,6 +833,12 @@ struct tc_nssbf_qopt *qopt; int err; unsigned int accel_mode; + +- nss_qdisc_info("Init bf qdisc %p\n", sch); ++ nss_qdisc_info("Init bf qdisc %px\n", sch); + + err = qdisc_class_hash_init(&q->clhash); + if (err < 0) { @@ -710,7 +766,11 @@ static int nss_bf_init_qdisc(struct Qdis if (!opt) { accel_mode = TCA_NSS_ACCEL_MODE_NSS_FW; @@ -1044,6 +1245,14 @@ .destroy = nss_codel_destroy, --- a/nss_qdisc/nss_fifo.c +++ b/nss_qdisc/nss_fifo.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014, 2016-2017, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014, 2016-2017, 2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. @@ -29,9 +29,18 @@ static struct nla_policy nss_fifo_policy [TCA_NSSFIFO_PARMS] = { .len = sizeof(struct tc_nssfifo_qopt) }, }; @@ -1117,7 +1326,7 @@ { struct nss_fifo_sched_data *q = qdisc_priv(sch); struct nss_qdisc *nq = &q->nq; -@@ -150,28 +175,45 @@ fail: +@@ -150,29 +175,46 @@ fail: /* * Fallback to nss qdisc if PPE Qdisc configuration failed at init time. */ @@ -1147,10 +1356,11 @@ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) if (nss_fifo_params_validate_and_save(sch, opt) < 0) { +- nss_qdisc_warning("nss_fifo %p params validate and save failed\n", sch); +#else + if (nss_fifo_params_validate_and_save(sch, opt, extack) < 0) { +#endif - nss_qdisc_warning("nss_fifo %px params validate and save failed\n", sch); ++ nss_qdisc_warning("nss_fifo %px params validate and save failed\n", sch); return -EINVAL; } @@ -1158,12 +1368,32 @@ if (nq->mode == NSS_QDISC_MODE_PPE) { +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) if (nss_fifo_ppe_change(sch, opt) < 0) { +- nss_qdisc_warning("nss_fifo %p params validate and save failed\n", sch); +#else + if (nss_fifo_ppe_change(sch, opt, extack) < 0) { +#endif - nss_qdisc_warning("nss_fifo %px params validate and save failed\n", sch); ++ nss_qdisc_warning("nss_fifo %px params validate and save failed\n", sch); return -EINVAL; } + return 0; +@@ -183,7 +225,7 @@ static int nss_fifo_change(struct Qdisc + nim.msg.shaper_configure.config.msg.shaper_node_config.snc.fifo_param.limit = q->limit; + nim.msg.shaper_configure.config.msg.shaper_node_config.snc.fifo_param.drop_mode = NSS_SHAPER_FIFO_DROP_MODE_TAIL; + if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM) < 0) { +- nss_qdisc_error("nss_fifo %p configuration failed\n", sch); ++ nss_qdisc_error("nss_fifo %px configuration failed\n", sch); + return -EINVAL; + } + +@@ -199,7 +241,7 @@ static int nss_fifo_change(struct Qdisc + * Set this qdisc to be the default qdisc for enqueuing packets. + */ + if (nss_qdisc_set_default(nq) < 0) { +- nss_qdisc_error("nss_fifo %p set_default failed\n", sch); ++ nss_qdisc_error("nss_fifo %px set_default failed\n", sch); + return -EINVAL; + } + @@ -208,9 +250,17 @@ static int nss_fifo_change(struct Qdisc return 0; } @@ -1245,6 +1475,14 @@ .destroy = nss_fifo_destroy, --- a/nss_qdisc/nss_htb.c +++ b/nss_qdisc/nss_htb.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. @@ -83,10 +83,16 @@ static inline struct nss_htb_class_data * nss_htb_class_params_validate_and_save() * Validates and saves the qdisc configuration parameters. @@ -1275,6 +1513,15 @@ if (!qopt) { return -EINVAL; } +@@ -202,7 +212,7 @@ static struct nss_htb_class_data *nss_ht + return NULL; + } + +- nss_qdisc_trace("htb class %x allocated - addr %p\n", classid, cl); ++ nss_qdisc_trace("htb class %x allocated - addr %px\n", classid, cl); + cl->parent = parent; + cl->sch_common.classid = classid; + @@ -219,7 +229,7 @@ static struct nss_htb_class_data *nss_ht * reference count should not be 0. */ @@ -1591,7 +1838,119 @@ .owner = THIS_MODULE --- a/nss_qdisc/nss_ppe.c +++ b/nss_qdisc/nss_ppe.c -@@ -1773,7 +1773,7 @@ int nss_ppe_set_parent(struct Qdisc *sch +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -391,10 +391,10 @@ static int nss_ppe_l1_res_free(struct ns + } + + /* +- * Bridge interface will have one level less than the max shaper levels. ++ * Loopback will have one level less than the max shaper levels. + * L1 scheduler was configured at init time, so resources were allocated. + */ +- if (nq->is_bridge) { ++ if (nq->needs_ppe_loopback) { + offset = npq->l0spid - nss_ppe_base_get(port_num, NSS_PPE_L0_SP); + if (nss_ppe_res_free(port_num, offset, NSS_PPE_L0_SP) != 0) { + nss_qdisc_error("Used res:%d not found for port:%d, type:%d\n", npq->l0spid, port_num, NSS_PPE_L0_SP); +@@ -465,10 +465,10 @@ static int nss_ppe_l1_res_alloc(struct n + } + + /* +- * For bridge, we use loopback which has no dedicated L1 schedulers. L0 +- * SP is the only resource we need to allocate. ++ * Loopback has no dedicated L1 schedulers. L0 SP is the only resource we ++ * need to allocate. + */ +- if (nq->is_bridge) { ++ if (nq->needs_ppe_loopback) { + npq->l0spid = nss_ppe_base_get(port_num, NSS_PPE_L0_SP) + l0sp->offset; + npq->l1_valid = true; + nss_qdisc_info("Level1 scheduler resource allocation successful\n"); +@@ -633,10 +633,10 @@ static int nss_ppe_l1_queue_scheduler_se + struct nss_ppe_qdisc *npq = &nq->npq; + + /* +- * Bridge interface will have one level less than the max shaper levels. ++ * Loopback will have one level less than the max shaper levels. + * L1 scheduler was configured at init time, so no need to allocate resources. + */ +- if (nq->is_bridge) { ++ if (nq->needs_ppe_loopback) { + /* + * Allocate resource if we have not already done so. + */ +@@ -717,7 +717,6 @@ static int nss_ppe_l0_res_free(struct ns + return -EINVAL; + } + +- + /* + * Reset Res id values in qdisc + */ +@@ -1229,9 +1228,9 @@ static int nss_ppe_max_level_get(struct + int level = NSS_PPE_MAX_LEVEL; + + /* +- * For bridge ports, one level is being used by loopback. ++ * Loopback uses one level. + */ +- if (nq->is_bridge) { ++ if (nq->needs_ppe_loopback) { + level = level - 1; + } + +@@ -1252,7 +1251,7 @@ static void nss_ppe_attach_free(uint32_t + ppe_port->res_free[res->type] = res; + spin_unlock_bh(&ppe_port->lock); + +- nss_qdisc_info("port:%d, type:%d, res:%p\n", port, res->type, res); ++ nss_qdisc_info("port:%d, type:%d, res:%px\n", port, res->type, res); + return; + } + +@@ -1319,7 +1318,7 @@ int nss_ppe_res_free(uint32_t port, uint + + success: + nss_ppe_attach_free(port, res); +- nss_qdisc_info("port:%d, type:%d, res:%p\n", port, type, res); ++ nss_qdisc_info("port:%d, type:%d, res:%px\n", port, type, res); + return 0; + } + +@@ -1345,7 +1344,7 @@ struct nss_ppe_res *nss_ppe_res_alloc(ui + } + spin_unlock_bh(&ppe_port->lock); + +- nss_qdisc_info("port:%d, type:%d, res:%p\n", port, type, res); ++ nss_qdisc_info("port:%d, type:%d, res:%px\n", port, type, res); + return res; + } + +@@ -1370,7 +1369,7 @@ static int nss_ppe_default_conf_set(uint + nss_ppe_all_queue_disable(port_num); + + /* +- * No resources were allocated for Port 0 (bridge interface). ++ * No resources were allocated for Port 0 (Loopback port). + * L1 scheduler was configured at init time. + */ + if (port_num == 0) { +@@ -1669,7 +1668,6 @@ static int nss_ppe_scheduler_set(struct + nss_ppe_queue_disable(nq); + } + } else { +- + /* + * When a classful qdisc say HTB is configured with max levels of hierarchy, + * and then if a qdisc say FIFO is attached at the last level, we will have all +@@ -1775,7 +1773,7 @@ int nss_ppe_set_parent(struct Qdisc *sch struct net_device *dev = qdisc_dev(sch); struct nss_qdisc *parent_nq = NULL; struct Qdisc *parent_qdisc = NULL; @@ -1600,7 +1959,21 @@ /* * PPE Qdisc cannot be attached to NSS Qdisc. -@@ -1812,8 +1812,11 @@ int nss_ppe_set_parent(struct Qdisc *sch +@@ -1788,7 +1786,7 @@ int nss_ppe_set_parent(struct Qdisc *sch + } + + if ((parent_nq) && (parent_nq->mode == NSS_QDISC_MODE_NSS)) { +- nss_qdisc_info("HW qdisc/class %p cannot be attached to nss qdisc/class\n", nq->qdisc); ++ nss_qdisc_info("HW qdisc/class %px cannot be attached to nss qdisc/class\n", nq->qdisc); + return NSS_PPE_QDISC_PARENT_NOT_PPE; + } + +@@ -1810,21 +1808,26 @@ int nss_ppe_set_parent(struct Qdisc *sch + */ + if ((parent_nq) && (parent_nq->npq.sub_type != NSS_SHAPER_CONFIG_PPE_SN_TYPE_PRIO) && (TC_H_MIN(parent))) { + if (!parent_qdisc) { +- nss_qdisc_info("HW qdisc/class %p cannot be attached to non-existing class %x\n", nq->qdisc, parent); ++ nss_qdisc_info("HW qdisc/class %px cannot be attached to non-existing class %x\n", nq->qdisc, parent); return NSS_PPE_QDISC_PARENT_NOT_EXISTING; } @@ -1612,8 +1985,10 @@ +#endif if (!parent_class) { nq->parent = NULL; - nss_qdisc_info("HW qdisc/class %px cannot be attached to non-existing class %x\n", nq->qdisc, parent); -@@ -1822,7 +1825,9 @@ int nss_ppe_set_parent(struct Qdisc *sch +- nss_qdisc_info("HW qdisc/class %p cannot be attached to non-existing class %x\n", nq->qdisc, parent); ++ nss_qdisc_info("HW qdisc/class %px cannot be attached to non-existing class %x\n", nq->qdisc, parent); + return NSS_PPE_QDISC_PARENT_NOT_EXISTING; + } nq->parent = (struct nss_qdisc *)parent_class; @@ -1623,7 +1998,90 @@ } } -@@ -2200,14 +2205,22 @@ fail: +@@ -1929,7 +1932,7 @@ int nss_ppe_port_num_get(struct nss_qdis + * Fetch port number based on interface type. + * TODO: Change this when API from DP is available + */ +- if (!(nq->is_bridge)) { ++ if (!nq->needs_ppe_loopback) { + port_num = nq->nss_interface_number; + } + +@@ -1938,6 +1941,32 @@ int nss_ppe_port_num_get(struct nss_qdis + } + + /* ++ * nss_ppe_all_queue_enable_hybrid() ++ * Enables PPE queues when NSS queuing Qdiscs are attached in the hieracrchy. ++ */ ++void nss_ppe_all_queue_enable_hybrid(struct nss_qdisc *nq) ++{ ++ struct nss_qdisc *nq_root = qdisc_priv(qdisc_root(nq->qdisc)); ++ ++ if (!nq_root->hybrid_configured) { ++ return; ++ } ++ ++ /* ++ * In case of hybrid mode, we disable the PPE queues until ++ * queueing Qdisc is attached in the hierarchy. ++ */ ++ if((nq->type == NSS_SHAPER_NODE_TYPE_CODEL) ++ || (nq->type == NSS_SHAPER_NODE_TYPE_FIFO) ++ || (nq->type == NSS_SHAPER_NODE_TYPE_BF) ++ || (nq->type == NSS_SHAPER_NODE_TYPE_WRED)) { ++ uint32_t port_num = nss_ppe_port_num_get(nq); ++ nss_ppe_all_queue_enable(port_num); ++ nss_qdisc_info("Queues in hybrid mode enabled successfully for Qdisc %px (type %d)\n", nq, nq->type); ++ } ++} ++ ++/* + * nss_ppe_node_detach() + * Configuration function that helps detach a child shaper node from a parent. + */ +@@ -1951,7 +1980,7 @@ int nss_ppe_node_detach(struct nss_qdisc + */ + if (nq_child->mode != NSS_QDISC_MODE_PPE) { + if (nss_qdisc_set_hybrid_mode(nq_child, NSS_QDISC_HYBRID_MODE_DISABLE, 0) < 0) { +- nss_qdisc_warning("detach of old qdisc %p failed\n", nq_child->qdisc); ++ nss_qdisc_warning("detach of old qdisc %px failed\n", nq_child->qdisc); + return -EINVAL; + } + +@@ -1960,7 +1989,7 @@ int nss_ppe_node_detach(struct nss_qdisc + + nss_ppe_destroy(nq_child); + +- nss_qdisc_info("Qdisc:%p, node:%p\n", nq, nq_child); ++ nss_qdisc_info("Qdisc:%px, node:%px\n", nq, nq_child); + return 0; + } + +@@ -1999,10 +2028,10 @@ int nss_ppe_node_attach(struct nss_qdisc + } + + /* +- * Return error in case NSS Qdisc is attached to PPE qdisc on bridge interface. ++ * Return error in case NSS Qdisc is attached to loopback. + */ +- if (nq->is_bridge) { +- nss_qdisc_warning("NSS Qdisc cannot be attached to PPE Qdisc on bridge interface.\n"); ++ if (nq->needs_ppe_loopback) { ++ nss_qdisc_warning("NSS Qdisc cannot be attached to PPE Qdisc on loopback interface.\n"); + return -EINVAL; + } + +@@ -2052,7 +2081,7 @@ int nss_ppe_node_attach(struct nss_qdisc + + nq_root->hybrid_configured = true; + +- nss_qdisc_info("Qdisc:%p, node:%p\n", nq, nq_child); ++ nss_qdisc_info("Qdisc:%px, node:%px\n", nq, nq_child); + return 0; + } + +@@ -2176,14 +2205,22 @@ fail: * nss_ppe_fallback_to_nss() * Calls the initialization of NSS Qdisc when PPE initialization fails. */ @@ -1646,9 +2104,57 @@ nss_qdisc_warning("Fallback to NSS Qdisc failed.\n"); return -EINVAL; } +@@ -2218,7 +2255,7 @@ int nss_ppe_init(struct Qdisc *sch, stru + uint32_t port_num = nss_ppe_port_num_get(nq); + + /* +- * HW qdisc is supported only on physical and bridge interfaces. ++ * HW qdisc is supported only on physical and loopbaack ports. + */ + if (port_num >= NSS_PPE_PORT_MAX) { + nss_qdisc_info("HW qdisc not supported on port %d\n", port_num); +@@ -2300,7 +2337,7 @@ int nss_ppe_init(struct Qdisc *sch, stru + * in qdisc that needs resource allocation in PPE. HTB qdisc on the other hand does + * nothing useful and thus we don't allocate any resource". + */ +- nss_qdisc_trace("Qdisc parent = %p, handle=%x\n", nq->parent, nq->parent->qos_tag); ++ nss_qdisc_trace("Qdisc parent = %px, handle=%x\n", nq->parent, nq->parent->qos_tag); + if ((nq->parent->npq.sub_type == NSS_SHAPER_CONFIG_PPE_SN_TYPE_HTB)) { + nq->npq.level = nq->parent->npq.level; + } else { +@@ -2317,7 +2354,7 @@ int nss_ppe_init(struct Qdisc *sch, stru + nq->mode = NSS_QDISC_MODE_PPE; + if (alloc_scheduler) { + if (nss_ppe_scheduler_set(nq) < 0) { +- nss_qdisc_warning("%p SSDK scheduler configuration failed\n", sch); ++ nss_qdisc_warning("%px SSDK scheduler configuration failed\n", sch); + memset(&nq->npq, 0, sizeof(struct nss_ppe_qdisc)); + nq->mode = NSS_QDISC_MODE_NSS; + return -1; --- a/nss_qdisc/nss_ppe.h +++ b/nss_qdisc/nss_ppe.h -@@ -269,7 +269,11 @@ extern int nss_ppe_configure(struct nss_ +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2017, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2017, 2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -242,6 +242,12 @@ extern int nss_ppe_set_parent(struct Qdi + extern int nss_ppe_get_max_prio_bands(struct nss_qdisc *nq); + + /* ++ * nss_ppe_all_queue_enable_hybrid() ++ * Enables PPE queues when NSS queuing Qdiscs are attached in the hieracrchy. ++ */ ++extern void nss_ppe_all_queue_enable_hybrid(struct nss_qdisc *nq); ++ ++/* + * nss_ppe_node_detach() + * Configuration function that helps detach a child shaper node from a parent. + */ +@@ -263,7 +269,11 @@ extern int nss_ppe_configure(struct nss_ * nss_ppe_fallback_to_nss() * Calls the initialization of NSS Qdisc when PPE initialization fails. */ @@ -1662,6 +2168,14 @@ * nss_ppe_destroy() --- a/nss_qdisc/nss_prio.c +++ b/nss_qdisc/nss_prio.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. @@ -37,9 +37,18 @@ static struct nla_policy nss_prio_policy * nss_prio_enqueue() * Enqueues a skb to nssprio qdisc. @@ -1812,6 +2326,19 @@ { struct nss_prio_sched_data *q = qdisc_priv(sch); struct nss_qdisc *nq_new = qdisc_priv(new); +@@ -300,10 +348,10 @@ static int nss_prio_graft(struct Qdisc * + *old = q->queues[band]; + sch_tree_unlock(sch); + +- nss_qdisc_info("Grafting old: %p with new: %p\n", *old, new); ++ nss_qdisc_info("Grafting old: %px with new: %px\n", *old, new); + if (*old != &noop_qdisc) { + struct nss_qdisc *nq_old = qdisc_priv(*old); +- nss_qdisc_info("Detaching old: %p\n", *old); ++ nss_qdisc_info("Detaching old: %px\n", *old); + nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag; + + if (q->nq.mode == NSS_QDISC_MODE_NSS) { @@ -365,6 +413,7 @@ static struct Qdisc *nss_prio_leaf(struc return q->queues[band]; } @@ -1887,12 +2414,312 @@ @@ -1,6 +1,6 @@ /* ************************************************************************** -- * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved. +- * Copyright (c) 2014-2019 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. -@@ -927,7 +927,11 @@ static inline void nss_qdisc_add_to_tail +@@ -14,6 +14,7 @@ + ************************************************************************** + */ + ++#include + #include "nss_qdisc.h" + #include "nss_fifo.h" + #include "nss_codel.h" +@@ -68,12 +69,25 @@ static int nss_qdisc_ppe_init(struct Qdi + * Fallback to NSS Qdisc if PPE Qdisc configuration failed. + */ + if (nq->ppe_init_failed) { +- nss_qdisc_info("Qdisc %p (type %d) HW Qdisc initialization already tried, creating NSS Qdisc\n", ++ nss_qdisc_info("Qdisc %px (type %d) HW Qdisc initialization already tried, creating NSS Qdisc\n", + nq->qdisc, nq->type); + return 0; + } + + /* ++ * Bridge and IFB needs PPE looback port shapers. ++ */ ++ if (nq->is_bridge || nss_igs_verify_if_num(nq->nss_interface_number)) { ++ nss_qdisc_info("Qdisc %px (type %d) init qdisc: %px, needs PPE loopback port\n", ++ nq->qdisc, nq->type, nq->qdisc); ++ nq->needs_ppe_loopback = true; ++ } else { ++ nss_qdisc_info("Qdisc %px (type %d) init qdisc: %px, does not need PPE loopback port\n", ++ nq->qdisc, nq->type, nq->qdisc); ++ nq->needs_ppe_loopback = false; ++ } ++ ++ /* + * Set the parent of PPE qdisc. + */ + status = nss_ppe_set_parent(sch, nq, parent); +@@ -93,13 +107,13 @@ static int nss_qdisc_ppe_init(struct Qdi + * Therefore fallback only applies to qdiscs. + */ + if (nq->is_class) { +- nss_qdisc_error("Qdisc %p (type %d) initializing HW class failed", nq->qdisc, nq->type); ++ nss_qdisc_error("Qdisc %px (type %d) initializing HW class failed", nq->qdisc, nq->type); + return -1; + } +- nss_qdisc_info("Qdisc %p (type %d) initializing HW Qdisc failed, initializing NSS Qdisc \n", ++ nss_qdisc_info("Qdisc %px (type %d) initializing HW Qdisc failed, initializing NSS Qdisc \n", + nq->qdisc, nq->type); + } else { +- nss_qdisc_info("Qdisc %p (type %d) successfully created in PPE\n", nq->qdisc, nq->type); ++ nss_qdisc_info("Qdisc %px (type %d) successfully created in PPE\n", nq->qdisc, nq->type); + } + + return 0; +@@ -190,7 +204,7 @@ static int nss_qdisc_attach_bshaper(stru + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_warning("qdisc %p (type %d) is not ready: State - %d\n", ++ nss_qdisc_warning("qdisc %px (type %d) is not ready: State - %d\n", + sch, nq->type, state); + return -1; + } +@@ -283,7 +297,7 @@ static int nss_qdisc_detach_bshaper(stru + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_warning("qdisc %p (type %d) is not ready: %d\n", ++ nss_qdisc_warning("qdisc %px (type %d) is not ready: %d\n", + sch, nq->type, state); + return -1; + } +@@ -475,7 +489,7 @@ nextdev: + */ + static void nss_qdisc_root_cleanup_final(struct nss_qdisc *nq) + { +- nss_qdisc_info("Root qdisc %p (type %d) final cleanup\n", ++ nss_qdisc_info("Root qdisc %px (type %d) final cleanup\n", + nq->qdisc, nq->type); + + /* +@@ -486,7 +500,7 @@ static void nss_qdisc_root_cleanup_final + /* + * Unregister for bouncing to the NSS for bridge shaping + */ +- nss_qdisc_info("Unregister for bridge bouncing: %p\n", ++ nss_qdisc_info("Unregister for bridge bouncing: %px\n", + nq->bounce_context); + nss_shaper_unregister_shaper_bounce_bridge(nq->nss_interface_number); + +@@ -494,7 +508,7 @@ static void nss_qdisc_root_cleanup_final + * Unregister the virtual interface we use to act as shaper + * for bridge shaping. + */ +- nss_qdisc_info("Release root bridge virtual interface: %p\n", ++ nss_qdisc_info("Release root bridge virtual interface: %px\n", + nq->virt_if_ctx); + } + +@@ -507,7 +521,7 @@ static void nss_qdisc_root_cleanup_final + /* + * Unregister for interface bouncing of packets + */ +- nss_qdisc_info("Unregister for interface bouncing: %p\n", ++ nss_qdisc_info("Unregister for interface bouncing: %px\n", + nq->bounce_context); + nss_shaper_unregister_shaper_bounce_interface(nq->nss_interface_number); + } +@@ -534,7 +548,7 @@ static void nss_qdisc_root_cleanup_shape + { + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_error("Root qdisc %p (type %d) shaper unsassign FAILED\n", nq->qdisc, nq->type); ++ nss_qdisc_error("Root qdisc %px (type %d) shaper unsassign FAILED\n", nq->qdisc, nq->type); + atomic_set(&nq->state, NSS_QDISC_STATE_UNASSIGN_SHAPER_FAIL); + wake_up(&nq->wait_queue); + return; +@@ -553,7 +567,7 @@ static void nss_qdisc_root_cleanup_shape + nss_tx_status_t rc; + int msg_type; + +- nss_qdisc_info("Root qdisc %p (type %d): shaper unassign: %d\n", ++ nss_qdisc_info("Root qdisc %px (type %d): shaper unassign: %d\n", + nq->qdisc, nq->type, nq->shaper_id); + + msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_UNASSIGN); +@@ -571,7 +585,7 @@ static void nss_qdisc_root_cleanup_shape + return; + } + +- nss_qdisc_error("Root qdisc %p (type %d): unassign command send failed: " ++ nss_qdisc_error("Root qdisc %px (type %d): unassign command send failed: " + "%d, shaper id: %d\n", nq->qdisc, nq->type, rc, nq->shaper_id); + + atomic_set(&nq->state, NSS_QDISC_STATE_UNASSIGN_SHAPER_SEND_FAIL); +@@ -587,7 +601,7 @@ static void nss_qdisc_root_cleanup_free_ + { + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_error("Root qdisc %p (type %d) free FAILED response " ++ nss_qdisc_error("Root qdisc %px (type %d) free FAILED response " + "type: %d\n", nq->qdisc, nq->type, + nim->msg.shaper_configure.config.response_type); + atomic_set(&nq->state, NSS_QDISC_STATE_NODE_FREE_FAIL); +@@ -595,7 +609,7 @@ static void nss_qdisc_root_cleanup_free_ + return; + } + +- nss_qdisc_info("Root qdisc %p (type %d) free SUCCESS - response " ++ 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); + +@@ -612,7 +626,7 @@ static void nss_qdisc_root_cleanup_free_ + nss_tx_status_t rc; + int msg_type; + +- nss_qdisc_info("Root qdisc %p (type %d): freeing shaper node\n", ++ nss_qdisc_info("Root qdisc %px (type %d): freeing shaper node\n", + nq->qdisc, nq->type); + + /* +@@ -634,7 +648,7 @@ static void nss_qdisc_root_cleanup_free_ + return; + } + +- nss_qdisc_error("Qdisc %p (type %d): free command send " ++ nss_qdisc_error("Qdisc %px (type %d): free command send " + "failed: %d, qos tag: %x\n", nq->qdisc, nq->type, + rc, nq->qos_tag); + +@@ -652,7 +666,7 @@ static void nss_qdisc_root_init_root_ass + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_warning("Root assign FAILED for qdisc %p (type %d), " ++ nss_qdisc_warning("Root assign FAILED for qdisc %px (type %d), " + "response type: %d\n", nq->qdisc, nq->type, + nim->msg.shaper_configure.config.response_type); + nq->pending_final_state = NSS_QDISC_STATE_ROOT_SET_FAIL; +@@ -660,7 +674,7 @@ static void nss_qdisc_root_init_root_ass + return; + } + +- nss_qdisc_info("Qdisc %p (type %d): set as root is done. Response - %d" ++ nss_qdisc_info("Qdisc %px (type %d): set as root is done. Response - %d" + , nq->qdisc, nq->type, nim->msg.shaper_configure.config.response_type); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + wake_up(&nq->wait_queue); +@@ -678,7 +692,7 @@ static void nss_qdisc_root_init_alloc_no + int msg_type; + + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_info("Qdisc %p (type %d) root alloc node FAILED " ++ nss_qdisc_info("Qdisc %px (type %d) root alloc node FAILED " + "response type: %d\n", nq->qdisc, nq->type, + nim->msg.shaper_configure.config.response_type); + +@@ -691,7 +705,7 @@ static void nss_qdisc_root_init_alloc_no + return; + } + +- nss_qdisc_info("Qdisc %p (type %d), shaper node alloc success: %u\n", ++ nss_qdisc_info("Qdisc %px (type %d), shaper node alloc success: %u\n", + nq->qdisc, nq->type, nq->shaper_id); + + /* +@@ -752,7 +766,7 @@ static void nss_qdisc_root_init_shaper_a + * Shaper has been allocated and assigned + */ + nq->shaper_id = nim->msg.shaper_assign.new_shaper_id; +- nss_qdisc_info("Qdisc %p (type %d), shaper assigned: %u\n", ++ nss_qdisc_info("Qdisc %px (type %d), shaper assigned: %u\n", + nq->qdisc, nq->type, nq->shaper_id); + + /* +@@ -774,14 +788,13 @@ static void nss_qdisc_root_init_shaper_a + /* + * Unable to send alloc node command, cleanup from unassigning the shaper + */ +- nss_qdisc_warning("Qdisc %p (type %d) create command failed: %d\n", ++ nss_qdisc_warning("Qdisc %px (type %d) create command failed: %d\n", + nq->qdisc, nq->type, rc); + + nq->pending_final_state = NSS_QDISC_STATE_NODE_ALLOC_SEND_FAIL; + nss_qdisc_root_cleanup_shaper_unassign(nq); + } + +- + /* + * nss_qdisc_child_cleanup_final() + * Perform final cleanup of a shaper node after all shaper node +@@ -789,7 +802,7 @@ static void nss_qdisc_root_init_shaper_a + */ + static void nss_qdisc_child_cleanup_final(struct nss_qdisc *nq) + { +- nss_qdisc_info("Final cleanup type %d: %p\n", ++ nss_qdisc_info("Final cleanup type %d: %px\n", + nq->type, nq->qdisc); + + /* +@@ -805,7 +818,6 @@ static void nss_qdisc_child_cleanup_fina + wake_up(&nq->wait_queue); + } + +- + /* + * nss_qdisc_child_cleanup_free_node_callback() + * Invoked on the response to freeing a child shaper node +@@ -816,14 +828,14 @@ static void nss_qdisc_child_cleanup_free + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_error("Qdisc %p (type %d qos_tag %x): child free FAILED response type: %d\n", ++ nss_qdisc_error("Qdisc %px (type %d qos_tag %x): child free FAILED response type: %d\n", + nq->qdisc, nq->type, nq->qos_tag, nim->msg.shaper_configure.config.response_type); + atomic_set(&nq->state, NSS_QDISC_STATE_NODE_FREE_FAIL); + wake_up(&nq->wait_queue); + return; + } + +- nss_qdisc_info("Qdisc %p (type %d): child shaper node " ++ nss_qdisc_info("Qdisc %px (type %d): child shaper node " + "free complete\n", nq->qdisc, nq->type); + + /* +@@ -842,7 +854,7 @@ static void nss_qdisc_child_cleanup_free + nss_tx_status_t rc; + int msg_type; + +- nss_qdisc_info("Qdisc %p (type %d qos_tag %x): free shaper node command\n", ++ nss_qdisc_info("Qdisc %px (type %d qos_tag %x): free shaper node command\n", + nq->qdisc, nq->type, nq->qos_tag); + + /* +@@ -860,7 +872,7 @@ static void nss_qdisc_child_cleanup_free + return; + } + +- nss_qdisc_error("Qdisc %p (type %d): child free node command send " ++ nss_qdisc_error("Qdisc %px (type %d): child free node command send " + "failed: %d, qos tag: %x\n", nq->qdisc, nq->type, + rc, nq->qos_tag); + +@@ -877,7 +889,7 @@ static void nss_qdisc_child_init_alloc_n + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_error("Qdisc %p (type %d): child alloc node FAILED, response " ++ nss_qdisc_error("Qdisc %px (type %d): child alloc node FAILED, response " + "type: %d\n", nq->qdisc, nq->type, nim->msg.shaper_configure.config.response_type); + /* + * Cleanup from final stage +@@ -890,7 +902,7 @@ static void nss_qdisc_child_init_alloc_n + /* + * Shaper node has been allocated + */ +- nss_qdisc_info("Qdisc %p (type %d): shaper node successfully " ++ nss_qdisc_info("Qdisc %px (type %d): shaper node successfully " + "created as a child node\n", nq->qdisc, nq->type); + + atomic_set(&nq->state, NSS_QDISC_STATE_READY); +@@ -915,7 +927,11 @@ static inline void nss_qdisc_add_to_tail * We do not use the qdisc_enqueue_tail() API here in order * to prevent stats from getting updated by the API. */ @@ -1904,7 +2731,7 @@ spin_unlock_bh(&nq->bounce_protection_lock); }; -@@ -942,7 +946,11 @@ static inline void nss_qdisc_add_to_tail +@@ -930,7 +946,11 @@ static inline void nss_qdisc_add_to_tail * We do not use the qdisc_enqueue_tail() API here in order * to prevent stats from getting updated by the API. */ @@ -1916,7 +2743,7 @@ }; /* -@@ -964,10 +972,12 @@ static inline struct sk_buff *nss_qdisc_ +@@ -952,10 +972,12 @@ static inline struct sk_buff *nss_qdisc_ * We use __skb_dequeue() to ensure that * stats don't get updated twice. */ @@ -1931,7 +2758,7 @@ return skb; }; -@@ -981,7 +991,11 @@ static inline struct sk_buff *nss_qdisc_ +@@ -969,7 +991,11 @@ static inline struct sk_buff *nss_qdisc_ * We use __skb_dequeue() to ensure that * stats don't get updated twice. */ @@ -1943,16 +2770,16 @@ }; /* -@@ -1059,24 +1073,33 @@ struct Qdisc *nss_qdisc_replace(struct Q +@@ -1047,24 +1073,33 @@ struct Qdisc *nss_qdisc_replace(struct Q * nss_qdisc_qopt_get() * Extracts qopt from opt. */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) -+void *nss_qdisc_qopt_get(struct nlattr *opt, struct nla_policy *policy, -+ struct nlattr *tb[], uint32_t tca_max, uint32_t tca_params) -+#else void *nss_qdisc_qopt_get(struct nlattr *opt, struct nla_policy *policy, - uint32_t tca_max, uint32_t tca_params) ++ struct nlattr *tb[], uint32_t tca_max, uint32_t tca_params) ++#else ++void *nss_qdisc_qopt_get(struct nlattr *opt, struct nla_policy *policy, + struct nlattr *tb[], uint32_t tca_max, uint32_t tca_params, struct netlink_ext_ack *extack) +#endif { @@ -1982,7 +2809,7 @@ } /* -@@ -1102,16 +1125,17 @@ struct sk_buff *nss_qdisc_peek(struct Qd +@@ -1090,16 +1125,17 @@ struct sk_buff *nss_qdisc_peek(struct Qd struct sk_buff *skb; if (!nq->is_virtual) { @@ -2002,7 +2829,7 @@ /* * nss_qdisc_drop() * Called to drop the packet at the head of queue -@@ -1134,6 +1158,7 @@ unsigned int nss_qdisc_drop(struct Qdisc +@@ -1122,6 +1158,7 @@ unsigned int nss_qdisc_drop(struct Qdisc return ret; } @@ -2010,7 +2837,25 @@ /* * nss_qdisc_reset() -@@ -1181,7 +1206,11 @@ static bool nss_qdisc_iterate_fl(struct +@@ -1131,7 +1168,7 @@ void nss_qdisc_reset(struct Qdisc *sch) + { + struct nss_qdisc *nq = qdisc_priv(sch); + +- nss_qdisc_info("Qdisc %p (type %d) resetting\n", ++ nss_qdisc_info("Qdisc %px (type %d) resetting\n", + sch, nq->type); + + /* +@@ -1148,7 +1185,7 @@ void nss_qdisc_reset(struct Qdisc *sch) + spin_unlock_bh(&nq->bounce_protection_lock); + } + +- nss_qdisc_info("Qdisc %p (type %d) reset complete\n", ++ nss_qdisc_info("Qdisc %px (type %d) reset complete\n", + sch, nq->type); + } + +@@ -1169,7 +1206,11 @@ static bool nss_qdisc_iterate_fl(struct return 0; } @@ -2023,7 +2868,7 @@ if ((status == TC_ACT_STOLEN) || (status == TC_ACT_QUEUED)) { return 1; } -@@ -1203,7 +1232,11 @@ static bool nss_qdisc_iterate_fl(struct +@@ -1191,7 +1232,11 @@ static bool nss_qdisc_iterate_fl(struct * nss_qdisc_enqueue() * Generic enqueue call for enqueuing packets into NSS for shaping */ @@ -2036,7 +2881,18 @@ { struct nss_qdisc *nq = qdisc_priv(sch); nss_tx_status_t status; -@@ -1263,11 +1296,18 @@ int nss_qdisc_enqueue(struct sk_buff *sk +@@ -1200,8 +1245,8 @@ int nss_qdisc_enqueue(struct sk_buff *sk + * If we are not the root qdisc then we should not be getting packets!! + */ + if (unlikely(!nq->is_root)) { +- nss_qdisc_error("Qdisc %p (type %d): unexpected packet " +- "for child qdisc - skb: %p\n", sch, nq->type, skb); ++ nss_qdisc_error("Qdisc %px (type %d): unexpected packet " ++ "for child qdisc - skb: %px\n", sch, nq->type, skb); + nss_qdisc_add_to_tail(skb, sch); + __netif_schedule(sch); + return NET_XMIT_SUCCESS; +@@ -1251,11 +1296,18 @@ int nss_qdisc_enqueue(struct sk_buff *sk /* * Skip the shaping of already shaped packets. */ @@ -2055,7 +2911,27 @@ if (!nq->is_virtual) { /* -@@ -1316,12 +1356,15 @@ enqueue_drop: +@@ -1277,7 +1329,7 @@ int nss_qdisc_enqueue(struct sk_buff *sk + return NET_XMIT_SUCCESS; + } + +- nss_qdisc_trace("Qdisc %p (type %d): failed to bounce for bridge %d, skb: %p\n", ++ nss_qdisc_trace("Qdisc %px (type %d): failed to bounce for bridge %d, skb: %px\n", + sch, nq->type, nq->nss_interface_number, skb); + goto enqueue_drop; + } +@@ -1295,8 +1347,8 @@ int nss_qdisc_enqueue(struct sk_buff *sk + /* + * We failed to bounce the packet for shaping on a virtual interface + */ +- nss_qdisc_trace("Qdisc %p (type %d): failed to bounce for " +- "interface: %d, skb: %p\n", sch, nq->type, ++ nss_qdisc_trace("Qdisc %px (type %d): failed to bounce for " ++ "interface: %d, skb: %px\n", sch, nq->type, + nq->nss_interface_number, skb); + + enqueue_drop: +@@ -1304,12 +1356,15 @@ enqueue_drop: * We were unable to transmit the packet for bridge shaping. * We therefore drop it. */ @@ -2072,7 +2948,323 @@ return NET_XMIT_DROP; } -@@ -1882,7 +1925,12 @@ void nss_qdisc_destroy(struct nss_qdisc +@@ -1343,14 +1398,14 @@ static void nss_qdisc_set_hybrid_mode_ca + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_error("Qdisc %p (type %d): shaper node set default FAILED, response type: %d\n", ++ nss_qdisc_error("Qdisc %px (type %d): shaper node set default FAILED, response type: %d\n", + nq->qdisc, nq->type, nim->msg.shaper_configure.config.response_type); + atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE); + wake_up(&nq->wait_queue); + return; + } + +- nss_qdisc_info("Qdisc %p (type %d): attach complete\n", nq->qdisc, nq->type); ++ nss_qdisc_info("Qdisc %px (type %d): attach complete\n", nq->qdisc, nq->type); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + wake_up(&nq->wait_queue); + } +@@ -1365,12 +1420,12 @@ int nss_qdisc_set_hybrid_mode(struct nss + int msg_type; + struct nss_if_msg nim; + +- nss_qdisc_info("Setting qdisc %p (type %d) as hybrid mode\n", ++ nss_qdisc_info("Setting qdisc %px (type %d) as hybrid mode\n", + nq->qdisc, nq->type); + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_warning("Qdisc %p (type %d): qdisc state not ready: %d\n", ++ nss_qdisc_warning("Qdisc %px (type %d): qdisc state not ready: %d\n", + nq->qdisc, nq->type, state); + return -1; + } +@@ -1417,13 +1472,13 @@ int nss_qdisc_set_hybrid_mode(struct nss + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_error("Qdisc %p (type %d): failed to set hybrid mode " ++ nss_qdisc_error("Qdisc %px (type %d): failed to set hybrid mode " + "State: %d\n", nq->qdisc, nq->type, state); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + return -1; + } + +- nss_qdisc_info("Qdisc %p (type %d): shaper node set hybrid mode complete\n", ++ nss_qdisc_info("Qdisc %px (type %d): shaper node set hybrid mode complete\n", + nq->qdisc, nq->type); + return 0; + } +@@ -1438,14 +1493,14 @@ static void nss_qdisc_set_default_callba + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_error("Qdisc %p (type %d): shaper node set default FAILED, response type: %d\n", ++ nss_qdisc_error("Qdisc %px (type %d): shaper node set default FAILED, response type: %d\n", + nq->qdisc, nq->type, nim->msg.shaper_configure.config.response_type); + atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE); + wake_up(&nq->wait_queue); + return; + } + +- nss_qdisc_info("Qdisc %p (type %d): attach complete\n", nq->qdisc, nq->type); ++ nss_qdisc_info("Qdisc %px (type %d): attach complete\n", nq->qdisc, nq->type); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + wake_up(&nq->wait_queue); + } +@@ -1460,12 +1515,12 @@ int nss_qdisc_set_default(struct nss_qdi + int msg_type; + struct nss_if_msg nim; + +- nss_qdisc_info("Setting qdisc %p (type %d) as default\n", ++ nss_qdisc_info("Setting qdisc %px (type %d) as default\n", + nq->qdisc, nq->type); + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_warning("Qdisc %p (type %d): qdisc state not ready: %d\n", ++ nss_qdisc_warning("Qdisc %px (type %d): qdisc state not ready: %d\n", + nq->qdisc, nq->type, state); + return -1; + } +@@ -1506,13 +1561,13 @@ int nss_qdisc_set_default(struct nss_qdi + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_error("Qdisc %p (type %d): failed to default " ++ nss_qdisc_error("Qdisc %px (type %d): failed to default " + "State: %d\n", nq->qdisc, nq->type, state); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + return -1; + } + +- nss_qdisc_info("Qdisc %p (type %d): shaper node default complete\n", ++ nss_qdisc_info("Qdisc %px (type %d): shaper node default complete\n", + nq->qdisc, nq->type); + return 0; + } +@@ -1527,7 +1582,7 @@ static void nss_qdisc_node_attach_callba + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_info("Qdisc %p (type %d) shaper node attach FAILED - response " ++ nss_qdisc_info("Qdisc %px (type %d) shaper node attach FAILED - response " + "type: %d\n", nq->qdisc, nq->type, + nim->msg.shaper_configure.config.response_type); + atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE); +@@ -1535,7 +1590,7 @@ static void nss_qdisc_node_attach_callba + return; + } + +- nss_qdisc_info("qdisc type %d: %p, attach complete\n", ++ nss_qdisc_info("qdisc type %d: %px, attach complete\n", + nq->type, nq->qdisc); + + atomic_set(&nq->state, NSS_QDISC_STATE_READY); +@@ -1552,12 +1607,12 @@ int nss_qdisc_node_attach(struct nss_qdi + int32_t state, rc; + int msg_type; + +- nss_qdisc_info("Qdisc %p (type %d) attaching\n", ++ nss_qdisc_info("Qdisc %px (type %d) attaching\n", + nq->qdisc, nq->type); + #if defined(NSS_QDISC_PPE_SUPPORT) + if (nq->mode == NSS_QDISC_MODE_PPE) { + if (nss_ppe_node_attach(nq, nq_child) < 0) { +- nss_qdisc_warning("attach of new qdisc %p failed\n", nq_child->qdisc); ++ nss_qdisc_warning("attach of new qdisc %px failed\n", nq_child->qdisc); + return -EINVAL; + + } +@@ -1567,7 +1622,7 @@ int nss_qdisc_node_attach(struct nss_qdi + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_warning("Qdisc %p (type %d): not ready, state: %d\n", ++ nss_qdisc_warning("Qdisc %px (type %d): not ready, state: %d\n", + nq->qdisc, nq->type, state); + return -1; + } +@@ -1607,7 +1662,7 @@ int nss_qdisc_node_attach(struct nss_qdi + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_error("Qdisc %p (type %d) failed to attach child " ++ nss_qdisc_error("Qdisc %px (type %d) failed to attach child " + "node, State: %d\n", nq->qdisc, nq->type, state); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + return -1; +@@ -1620,7 +1675,15 @@ int nss_qdisc_node_attach(struct nss_qdi + nq_child->parent = nq; + spin_unlock_bh(&nq_child->lock); + +- nss_qdisc_info("Qdisc %p (type %d): shaper node attach complete\n", ++#if defined(NSS_QDISC_PPE_SUPPORT) ++ /* ++ * In case of hybrid mode, enable PPE queues when NSS queuing ++ * Qdiscs are attached in the hierarchy. ++ */ ++ nss_ppe_all_queue_enable_hybrid(nq_child); ++#endif ++ ++ nss_qdisc_info("Qdisc %px (type %d): shaper node attach complete\n", + nq->qdisc, nq->type); + return 0; + } +@@ -1635,7 +1698,7 @@ static void nss_qdisc_node_detach_callba + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_info("Qdisc %p (type %d): shaper node detach FAILED - response " ++ nss_qdisc_info("Qdisc %px (type %d): shaper node detach FAILED - response " + "type: %d\n", nq->qdisc, nq->type, + nim->msg.shaper_configure.config.response_type); + atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE); +@@ -1643,7 +1706,7 @@ static void nss_qdisc_node_detach_callba + return; + } + +- nss_qdisc_info("Qdisc %p (type %d): detach complete\n", ++ nss_qdisc_info("Qdisc %px (type %d): detach complete\n", + nq->qdisc, nq->type); + + atomic_set(&nq->state, NSS_QDISC_STATE_READY); +@@ -1659,13 +1722,13 @@ int nss_qdisc_node_detach(struct nss_qdi + { + int32_t state, rc, msg_type; + +- nss_qdisc_info("Qdisc %p (type %d) detaching\n", ++ nss_qdisc_info("Qdisc %px (type %d) detaching\n", + nq->qdisc, nq->type); + + #if defined(NSS_QDISC_PPE_SUPPORT) + if (nq->mode == NSS_QDISC_MODE_PPE) { + if (nss_ppe_node_detach(nq, nq_child) < 0) { +- nss_qdisc_warning("detach of old qdisc %p failed\n", nq_child->qdisc); ++ nss_qdisc_warning("detach of old qdisc %px failed\n", nq_child->qdisc); + return -1; + } + nim->msg.shaper_configure.config.msg.shaper_node_config.snc.ppe_sn_detach.child_qos_tag = nq_child->qos_tag; +@@ -1674,7 +1737,7 @@ int nss_qdisc_node_detach(struct nss_qdi + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_warning("Qdisc %p (type %d): not ready, state: %d\n", ++ nss_qdisc_warning("Qdisc %px (type %d): not ready, state: %d\n", + nq->qdisc, nq->type, state); + return -1; + } +@@ -1695,7 +1758,7 @@ int nss_qdisc_node_detach(struct nss_qdi + rc = nss_if_tx_msg(nq->nss_shaping_ctx, nim); + + if (rc != NSS_TX_SUCCESS) { +- nss_qdisc_warning("Qdisc %p (type %d): Failed to send configure " ++ nss_qdisc_warning("Qdisc %px (type %d): Failed to send configure " + "message.", nq->qdisc, nq->type); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + return -1; +@@ -1714,7 +1777,7 @@ int nss_qdisc_node_detach(struct nss_qdi + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_error("Qdisc %p (type %d): failed to detach child node, " ++ nss_qdisc_error("Qdisc %px (type %d): failed to detach child node, " + "State: %d\n", nq->qdisc, nq->type, state); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + return -1; +@@ -1724,7 +1787,7 @@ int nss_qdisc_node_detach(struct nss_qdi + nq_child->parent = NULL; + spin_unlock_bh(&nq_child->lock); + +- nss_qdisc_info("Qdisc %p (type %d): shaper node detach complete\n", ++ nss_qdisc_info("Qdisc %px (type %d): shaper node detach complete\n", + nq->qdisc, nq->type); + return 0; + } +@@ -1739,7 +1802,7 @@ static void nss_qdisc_configure_callback + struct nss_qdisc *nq = (struct nss_qdisc *)app_data; + + if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { +- nss_qdisc_info("Qdisc %p (type %d): shaper node configure FAILED " ++ nss_qdisc_info("Qdisc %px (type %d): shaper node configure FAILED " + "response type: %d\n", nq->qdisc, nq->type, + nim->msg.shaper_configure.config.response_type); + atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE); +@@ -1755,7 +1818,7 @@ static void nss_qdisc_configure_callback + nq->config_cb(nq, &nim->msg.shaper_configure.config); + } + +- nss_qdisc_info("Qdisc %p (type %d): configuration complete\n", ++ nss_qdisc_info("Qdisc %px (type %d): configuration complete\n", + nq->qdisc, nq->type); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + wake_up(&nq->wait_queue); +@@ -1771,11 +1834,11 @@ int nss_qdisc_configure(struct nss_qdisc + int32_t state, rc; + int msg_type; + +- nss_qdisc_info("Qdisc %p (type %d) configuring\n", nq->qdisc, nq->type); ++ nss_qdisc_info("Qdisc %px (type %d) configuring\n", nq->qdisc, nq->type); + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_warning("Qdisc %p (type %d): not ready for configure, " ++ nss_qdisc_warning("Qdisc %px (type %d): not ready for configure, " + "state : %d\n", nq->qdisc, nq->type, state); + return -1; + } +@@ -1796,7 +1859,7 @@ int nss_qdisc_configure(struct nss_qdisc + rc = nss_if_tx_msg(nq->nss_shaping_ctx, nim); + + if (rc != NSS_TX_SUCCESS) { +- nss_qdisc_warning("Qdisc %p (type %d): Failed to send configure " ++ nss_qdisc_warning("Qdisc %px (type %d): Failed to send configure " + "message\n", nq->qdisc, nq->type); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + return -1; +@@ -1815,13 +1878,13 @@ int nss_qdisc_configure(struct nss_qdisc + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_error("Qdisc %p (type %d): failed to configure shaper " ++ nss_qdisc_error("Qdisc %px (type %d): failed to configure shaper " + "node: State: %d\n", nq->qdisc, nq->type, state); + atomic_set(&nq->state, NSS_QDISC_STATE_READY); + return -1; + } + +- nss_qdisc_info("Qdisc %p (type %d): shaper node configure complete\n", ++ nss_qdisc_info("Qdisc %px (type %d): shaper node configure complete\n", + nq->qdisc, nq->type); + return 0; + } +@@ -1832,7 +1895,7 @@ int nss_qdisc_configure(struct nss_qdisc + */ + void nss_qdisc_register_configure_callback(struct nss_qdisc *nq, nss_qdisc_configure_callback_t cb) + { +- nss_qdisc_assert(!nq->config_cb, "Qdisc %p: config callback already registered", nq); ++ nss_qdisc_assert(!nq->config_cb, "Qdisc %px: config callback already registered", nq); + nq->config_cb = cb; + } + +@@ -1842,7 +1905,7 @@ void nss_qdisc_register_configure_callba + */ + void nss_qdisc_register_stats_callback(struct nss_qdisc *nq, nss_qdisc_stats_callback_t cb) + { +- nss_qdisc_assert(!nq->stats_cb, "Qdisc %p: config callback already registered", nq); ++ nss_qdisc_assert(!nq->stats_cb, "Qdisc %px: config callback already registered", nq); + nq->stats_cb = cb; + } + +@@ -1856,13 +1919,18 @@ void nss_qdisc_destroy(struct nss_qdisc + int32_t state; + nss_tx_status_t cmd_status; + +- nss_qdisc_info("Qdisc %p (type %d) destroy\n", ++ nss_qdisc_info("Qdisc %px (type %d) destroy\n", + nq->qdisc, nq->type); + /* * Destroy any attached filter over qdisc. */ @@ -2085,7 +3277,63 @@ #if defined(NSS_QDISC_PPE_SUPPORT) if (nq->mode == NSS_QDISC_MODE_PPE) { nss_ppe_destroy(nq); -@@ -1960,12 +2008,19 @@ void nss_qdisc_destroy(struct nss_qdisc +@@ -1871,7 +1939,7 @@ void nss_qdisc_destroy(struct nss_qdisc + + state = atomic_read(&nq->state); + if (state != NSS_QDISC_STATE_READY) { +- nss_qdisc_warning("Qdisc %p (type %d): destroy not ready, " ++ nss_qdisc_warning("Qdisc %px (type %d): destroy not ready, " + "state: %d\n", nq->qdisc, nq->type, state); + return; + } +@@ -1880,14 +1948,16 @@ void nss_qdisc_destroy(struct nss_qdisc + * How we begin to tidy up depends on whether we are root or child + */ + nq->pending_final_state = NSS_QDISC_STATE_IDLE; +- if (nq->is_root) { ++ if (!nq->is_root) { ++ nss_qdisc_child_cleanup_free_node(nq); ++ } else { + + /* + * If this is root on a bridge interface, then unassign + * the bshaper from all the attached interfaces. + */ + if (nq->is_bridge) { +- nss_qdisc_info("Qdisc %p (type %d): is root on bridge. Need to " ++ nss_qdisc_info("Qdisc %px (type %d): is root on bridge. Need to " + "unassign bshapers from its interfaces\n", nq->qdisc, nq->type); + nss_qdisc_refresh_bshaper_assignment(nq->qdisc, NSS_QDISC_SCAN_AND_UNASSIGN_BSHAPER); + } +@@ -1897,8 +1967,12 @@ void nss_qdisc_destroy(struct nss_qdisc + */ + nss_qdisc_root_cleanup_free_node(nq); + +- } else { +- nss_qdisc_child_cleanup_free_node(nq); ++ /* ++ * In case of IGS interface, release the reference of the IGS module. ++ */ ++ if (nss_igs_verify_if_num(nq->nss_interface_number)) { ++ nss_igs_module_put(); ++ } + } + + /* +@@ -1923,23 +1997,30 @@ void nss_qdisc_destroy(struct nss_qdisc + */ + cmd_status = nss_virt_if_destroy_sync(nq->virt_if_ctx); + if (cmd_status != NSS_TX_SUCCESS) { +- nss_qdisc_error("Qdisc %p virtual interface %p destroy failed: %d\n", ++ nss_qdisc_error("Qdisc %px virtual interface %px destroy failed: %d\n", + nq->qdisc, nq->virt_if_ctx, cmd_status); + } + nq->virt_if_ctx = NULL; + } + +- nss_qdisc_info("Qdisc %p (type %d): destroy complete\n", ++ nss_qdisc_info("Qdisc %px (type %d): destroy complete\n", + nq->qdisc, nq->type); } /* @@ -2107,15 +3355,19 @@ struct Qdisc *root; u32 parent; nss_tx_status_t rc; -@@ -1978,7 +2033,6 @@ int nss_qdisc_init(struct Qdisc *sch, st +@@ -1951,9 +2032,9 @@ int nss_qdisc_init(struct Qdisc *sch, st + #if defined(NSS_QDISC_PPE_SUPPORT) bool mode_ppe = false; #endif - bool igs_put = false; - ++ bool igs_put = false; if (accel_mode >= TCA_NSS_ACCEL_MODE_MAX) { - nss_qdisc_warning("Qdisc %px (type %d) accel_mode:%u should be < %u\n", +- nss_qdisc_warning("Qdisc %p (type %d) accel_mode:%u should be < %u\n", ++ nss_qdisc_warning("Qdisc %px (type %d) accel_mode:%u should be < %u\n", sch, nq->type, accel_mode, TCA_NSS_ACCEL_MODE_MAX); -@@ -2037,8 +2091,9 @@ int nss_qdisc_init(struct Qdisc *sch, st + return -1; + } +@@ -2010,8 +2091,9 @@ int nss_qdisc_init(struct Qdisc *sch, st /* * Initialize filter list. */ @@ -2126,10 +3378,25 @@ /* * If we are a class, then classid is used as the qos tag. * Else the qdisc handle will be used as the qos tag. -@@ -2073,6 +2128,25 @@ int nss_qdisc_init(struct Qdisc *sch, st +@@ -2032,11 +2114,11 @@ int nss_qdisc_init(struct Qdisc *sch, st + * true for classes. This is the reason why we check for classid. + */ + if ((sch->parent == TC_H_ROOT) && (!nq->is_class)) { +- nss_qdisc_info("Qdisc %p (type %d) is root\n", nq->qdisc, nq->type); ++ nss_qdisc_info("Qdisc %px (type %d) is root\n", nq->qdisc, nq->type); + nq->is_root = true; + root = sch; + } else { +- nss_qdisc_info("Qdisc %p (type %d) not root\n", nq->qdisc, nq->type); ++ nss_qdisc_info("Qdisc %px (type %d) not root\n", nq->qdisc, nq->type); + nq->is_root = false; + root = qdisc_root(sch); + } +@@ -2046,24 +2128,43 @@ int nss_qdisc_init(struct Qdisc *sch, st * or on a net device that is represented by a virtual NSS interface (e.g. WIFI) */ dev = qdisc_dev(sch); +- nss_qdisc_info("Qdisc %p (type %d) init dev: %p\n", nq->qdisc, nq->type, dev); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) + /* @@ -2149,28 +3416,285 @@ + } +#endif + - nss_qdisc_info("Qdisc %px (type %d) init dev: %px\n", nq->qdisc, nq->type, dev); ++ nss_qdisc_info("Qdisc %px (type %d) init dev: %px\n", nq->qdisc, nq->type, dev); /* -@@ -2098,6 +2172,8 @@ int nss_qdisc_init(struct Qdisc *sch, st + * Determine if dev is a bridge or not as this determines if we + * interract with an I or B shaper. + */ + if (dev->priv_flags & IFF_EBRIDGE) { +- nss_qdisc_info("Qdisc %p (type %d) init qdisc: %p, is bridge\n", ++ nss_qdisc_info("Qdisc %px (type %d) init qdisc: %px, is bridge\n", + nq->qdisc, nq->type, nq->qdisc); + nq->is_bridge = true; + } else { +- nss_qdisc_info("Qdisc %p (type %d) init qdisc: %p, not bridge\n", ++ nss_qdisc_info("Qdisc %px (type %d) init qdisc: %px, not bridge\n", + nq->qdisc, nq->type, nq->qdisc); + nq->is_bridge = false; + } + +- nss_qdisc_info("Qdisc %p (type %d) init root: %p, qos tag: %x, " +- "parent: %x rootid: %s owner: %p\n", nq->qdisc, nq->type, root, ++ nss_qdisc_info("Qdisc %px (type %d) init root: %px, qos tag: %x, " ++ "parent: %x rootid: %s owner: %px\n", nq->qdisc, nq->type, root, + nq->qos_tag, parent, root->ops->id, root->ops->owner); + + /* +@@ -2071,7 +2172,9 @@ int nss_qdisc_init(struct Qdisc *sch, st * This is to prevent mixing NSS and PPE qdisc with linux qdisc. */ if ((parent != TC_H_ROOT) && (root->ops->owner != THIS_MODULE)) { +- nss_qdisc_warning("NSS qdisc %p (type %d) used along with non-nss qdiscs," + nss_qdisc_warning("parent (%d) and TC_H_ROOT (%d))", parent, TC_H_ROOT); + nss_qdisc_warning("root->ops->owner (%px) and THIS_MODULE (%px))", root->ops->owner , THIS_MODULE); - nss_qdisc_warning("NSS qdisc %px (type %d) used along with non-nss qdiscs," ++ nss_qdisc_warning("NSS qdisc %px (type %d) used along with non-nss qdiscs," " or the interface is currently down", nq->qdisc, nq->type); } -@@ -2394,7 +2470,7 @@ int nss_qdisc_init(struct Qdisc *sch, st - if (igs_put) { - nss_igs_module_put(); + +@@ -2092,7 +2195,7 @@ int nss_qdisc_init(struct Qdisc *sch, st + if (!nq->is_root) { + struct nss_if_msg nim_alloc; + +- nss_qdisc_info("Qdisc %p (type %d) initializing non-root qdisc\n", ++ nss_qdisc_info("Qdisc %px (type %d) initializing non-root qdisc\n", + nq->qdisc, nq->type); + + /* +@@ -2103,7 +2206,7 @@ int nss_qdisc_init(struct Qdisc *sch, st + */ + nq->nss_interface_number = nss_cmn_get_interface_number(nq->nss_shaping_ctx, dev); + if (nq->nss_interface_number < 0) { +- nss_qdisc_error("Qdisc %p (type %d) net device unknown to " ++ nss_qdisc_error("Qdisc %px (type %d) net device unknown to " + "nss driver %s\n", nq->qdisc, nq->type, dev->name); + nss_shaper_unregister_shaping(nq->nss_shaping_ctx); + atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED); +@@ -2120,7 +2223,7 @@ int nss_qdisc_init(struct Qdisc *sch, st + * Try initializing PPE Qdisc first. + */ + if (mode_ppe && nss_qdisc_ppe_init(sch, nq, type, parent) < 0) { +- nss_qdisc_error("Qdisc %p (type %d) init failed", nq->qdisc, nq->type); ++ nss_qdisc_error("Qdisc %px (type %d) init failed", nq->qdisc, nq->type); + nss_shaper_unregister_shaping(nq->nss_shaping_ctx); + atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED); + goto init_fail; +@@ -2131,7 +2234,7 @@ int nss_qdisc_init(struct Qdisc *sch, st + * Create a shaper node for requested type. + * Essentially all we need to do is create the shaper node. + */ +- nss_qdisc_info("Qdisc %p (type %d) non-root (child) create\n", ++ nss_qdisc_info("Qdisc %px (type %d) non-root (child) create\n", + nq->qdisc, nq->type); + + /* +@@ -2147,7 +2250,7 @@ int nss_qdisc_init(struct Qdisc *sch, st + rc = nss_if_tx_msg(nq->nss_shaping_ctx, &nim_alloc); + + if (rc != NSS_TX_SUCCESS) { +- nss_qdisc_error("Qdisc %p (type %d) create command " ++ nss_qdisc_error("Qdisc %px (type %d) create command " + "failed: %d\n", nq->qdisc, nq->type, rc); + nq->pending_final_state = NSS_QDISC_STATE_CHILD_ALLOC_SEND_FAIL; + nss_qdisc_child_cleanup_final(nq); +@@ -2164,7 +2267,7 @@ int nss_qdisc_init(struct Qdisc *sch, st } + + state = atomic_read(&nq->state); +- nss_qdisc_info("Qdisc %p (type %d): initialised with state: %d\n", ++ nss_qdisc_info("Qdisc %px (type %d): initialised with state: %d\n", + nq->qdisc, nq->type, state); + + /* +@@ -2184,13 +2287,13 @@ int nss_qdisc_init(struct Qdisc *sch, st + * bridge shaping. Further, when operating on a bridge, we monitor for + * bridge port changes and assign B shapers to the interfaces of the ports. + */ +- nss_qdisc_info("init qdisc type %d : %p, ROOT\n", nq->type, nq->qdisc); ++ nss_qdisc_info("init qdisc type %d : %px, ROOT\n", nq->type, nq->qdisc); + + /* + * Detect if we are operating on a bridge or interface + */ + if (nq->is_bridge) { +- nss_qdisc_info("Qdisc %p (type %d): initializing root qdisc on bridge\n", ++ nss_qdisc_info("Qdisc %px (type %d): initializing root qdisc on bridge\n", + nq->qdisc, nq->type); + + /* +@@ -2208,13 +2311,13 @@ int nss_qdisc_init(struct Qdisc *sch, st + */ + nq->virt_if_ctx = nss_virt_if_create_sync(dev); + if (!nq->virt_if_ctx) { +- nss_qdisc_error("Qdisc %p (type %d): cannot create virtual interface\n", ++ nss_qdisc_error("Qdisc %px (type %d): cannot create virtual interface\n", + nq->qdisc, nq->type); + nss_shaper_unregister_shaping(nq->nss_shaping_ctx); + atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED); + goto init_fail; + } +- nss_qdisc_info("Qdisc %p (type %d): virtual interface registered in NSS: %p\n", ++ nss_qdisc_info("Qdisc %px (type %d): virtual interface registered in NSS: %px\n", + nq->qdisc, nq->type, nq->virt_if_ctx); + + /* +@@ -2227,7 +2330,7 @@ int nss_qdisc_init(struct Qdisc *sch, st + * Save the virtual interface number + */ + nq->nss_interface_number = nss_virt_if_get_interface_num(nq->virt_if_ctx); +- nss_qdisc_info("Qdisc %p (type %d) virtual interface number: %d\n", ++ nss_qdisc_info("Qdisc %px (type %d) virtual interface number: %d\n", + nq->qdisc, nq->type, nq->nss_interface_number); + } + +@@ -2238,19 +2341,19 @@ int nss_qdisc_init(struct Qdisc *sch, st + * register for bridge bouncing as it will be responsible for + * bouncing packets to the NSS for bridge shaping. + */ +- if (nss_igs_verify_if_num(nq->nss_interface_number)) { ++ if (!nss_igs_verify_if_num(nq->nss_interface_number)) { ++ nq->bounce_context = nss_shaper_register_shaper_bounce_bridge(nq->nss_interface_number, ++ nss_qdisc_bounce_callback, nq->qdisc, THIS_MODULE); ++ } else { + nss_qdisc_error("Since %d is an IFB device, it cannot" + " register for bridge bouncing\n", nq->nss_interface_number); + nss_shaper_unregister_shaping(nq->nss_shaping_ctx); + atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED); + goto init_fail; +- } else { +- nq->bounce_context = nss_shaper_register_shaper_bounce_bridge(nq->nss_interface_number, +- nss_qdisc_bounce_callback, nq->qdisc, THIS_MODULE); + } + + if (!nq->bounce_context) { +- nss_qdisc_error("Qdisc %p (type %d): is root but cannot register " ++ nss_qdisc_error("Qdisc %px (type %d): is root but cannot register " + "for bridge bouncing\n", nq->qdisc, nq->type); + nss_shaper_unregister_shaping(nq->nss_shaping_ctx); + atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED); +@@ -2258,7 +2361,7 @@ int nss_qdisc_init(struct Qdisc *sch, st + } + + } else { +- nss_qdisc_info("Qdisc %p (type %d): is interface\n", nq->qdisc, nq->type); ++ nss_qdisc_info("Qdisc %px (type %d): is interface\n", nq->qdisc, nq->type); + + /* + * The device we are operational on MUST be recognised as an NSS interface. +@@ -2268,7 +2371,7 @@ int nss_qdisc_init(struct Qdisc *sch, st + */ + nq->nss_interface_number = nss_cmn_get_interface_number(nq->nss_shaping_ctx, dev); + if (nq->nss_interface_number < 0) { +- nss_qdisc_error("Qdisc %p (type %d): interface unknown to nss driver %s\n", ++ nss_qdisc_error("Qdisc %px (type %d): interface unknown to nss driver %s\n", + nq->qdisc, nq->type, dev->name); + nss_shaper_unregister_shaping(nq->nss_shaping_ctx); + atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED); +@@ -2281,25 +2384,44 @@ int nss_qdisc_init(struct Qdisc *sch, st + */ + nq->is_virtual = nss_qdisc_interface_is_virtual(nq->nss_shaping_ctx, nq->nss_interface_number); + if (!nq->is_virtual) { +- nss_qdisc_info("Qdisc %p (type %d): interface %u is physical\n", ++ nss_qdisc_info("Qdisc %px (type %d): interface %u is physical\n", + nq->qdisc, nq->type, nq->nss_interface_number); + } else { +- nss_qdisc_info("Qdisc %p (type %d): interface %u is virtual\n", ++ nss_qdisc_info("Qdisc %px (type %d): interface %u is virtual\n", + nq->qdisc, nq->type, nq->nss_interface_number); + + /* + * Register for interface bounce shaping. + */ +- if (nss_igs_verify_if_num(nq->nss_interface_number)) { ++ if (!nss_igs_verify_if_num(nq->nss_interface_number)) { + nq->bounce_context = nss_shaper_register_shaper_bounce_interface(nq->nss_interface_number, +- nss_qdisc_mark_and_schedule, nq->qdisc, THIS_MODULE); ++ nss_qdisc_bounce_callback, nq->qdisc, THIS_MODULE); + } else { ++ ++ /* ++ * In case of IGS interface, take the reference of IGS module. ++ */ ++ if (!nss_igs_module_get()) { ++ nss_qdisc_error("Module reference failed for IGS interface %d" ++ " , Qdisc %px (type %d)\n", nq->nss_interface_number, ++ nq->qdisc, nq->type); ++ nss_shaper_unregister_shaping(nq->nss_shaping_ctx); ++ atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED); ++ goto init_fail; ++ } ++ ++ /* ++ * Set the flag to indicate the IGS module reference get is successful. ++ * This flag will be used to decrement the IGS module reference in case ++ * of any error conditions. ++ */ ++ igs_put = true; + nq->bounce_context = nss_shaper_register_shaper_bounce_interface(nq->nss_interface_number, +- nss_qdisc_bounce_callback, nq->qdisc, THIS_MODULE); ++ nss_qdisc_mark_and_schedule, nq->qdisc, THIS_MODULE); + } + + if (!nq->bounce_context) { +- nss_qdisc_error("Qdisc %p (type %d): is root but failed " ++ nss_qdisc_error("Qdisc %px (type %d): is root but failed " + "to register for interface bouncing\n", nq->qdisc, nq->type); + nss_shaper_unregister_shaping(nq->nss_shaping_ctx); + atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED); +@@ -2313,7 +2435,7 @@ int nss_qdisc_init(struct Qdisc *sch, st + * Try initializing PPE Qdisc first. + */ + if (mode_ppe && nss_qdisc_ppe_init(sch, nq, type, parent) < 0) { +- nss_qdisc_error("Qdisc %p (type %d) init failed", nq->qdisc, nq->type); ++ nss_qdisc_error("Qdisc %px (type %d) init failed", nq->qdisc, nq->type); + nss_shaper_unregister_shaping(nq->nss_shaping_ctx); + atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED); + goto init_fail; +@@ -2342,12 +2464,18 @@ int nss_qdisc_init(struct Qdisc *sch, st + */ + if (!wait_event_timeout(nq->wait_queue, atomic_read(&nq->state) != NSS_QDISC_STATE_IDLE, + NSS_QDISC_COMMAND_TIMEOUT)) { - nss_qdisc_error("init for qdisc %x timedout!\n", nq->qos_tag); ++ /* ++ * Decrement the IGS module reference. ++ */ ++ if (igs_put) { ++ nss_igs_module_put(); ++ } + nss_qdisc_error("init for qdisc %x timedout!\n", nq->qos_tag); return -1; } -@@ -2465,6 +2541,20 @@ init_fail: + state = atomic_read(&nq->state); +- nss_qdisc_info("Qdisc %p (type %d): is initialised with state: %d\n", ++ nss_qdisc_info("Qdisc %px (type %d): is initialised with state: %d\n", + nq->qdisc, nq->type, state); + + if (state > 0) { +@@ -2380,6 +2508,13 @@ int nss_qdisc_init(struct Qdisc *sch, st + + init_fail: + ++ /* ++ * Decrement the IGS module reference. ++ */ ++ if (igs_put) { ++ nss_igs_module_put(); ++ } ++ + #if defined(NSS_QDISC_PPE_SUPPORT) + if (nq->mode == NSS_QDISC_MODE_PPE) { + nss_ppe_destroy(nq); +@@ -2396,7 +2531,7 @@ init_fail: + */ + cmd_status = nss_virt_if_destroy_sync(nq->virt_if_ctx); + if (cmd_status != NSS_TX_SUCCESS) { +- nss_qdisc_error("Qdisc %p virtual interface %p destroy failed: %d\n", ++ nss_qdisc_error("Qdisc %px virtual interface %px destroy failed: %d\n", + nq->qdisc, nq->virt_if_ctx, cmd_status); + } + nq->virt_if_ctx = NULL; +@@ -2406,6 +2541,20 @@ init_fail: } /* @@ -2191,7 +3715,7 @@ * nss_qdisc_basic_stats_callback() * Invoked after getting basic stats */ -@@ -2476,7 +2566,11 @@ static void nss_qdisc_basic_stats_callba +@@ -2417,10 +2566,14 @@ static void nss_qdisc_basic_stats_callba struct gnet_stats_basic_packed *bstats; struct gnet_stats_queue *qstats; struct nss_shaper_node_stats_response *response; @@ -2202,8 +3726,12 @@ +#endif if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { - nss_qdisc_warning("Qdisc %px (type %d): Receive stats FAILED - " -@@ -2539,7 +2633,11 @@ static void nss_qdisc_basic_stats_callba +- nss_qdisc_warning("Qdisc %p (type %d): Receive stats FAILED - " ++ nss_qdisc_warning("Qdisc %px (type %d): Receive stats FAILED - " + "response: type: %d\n", qdisc, nq->type, + nim->msg.shaper_configure.config.response_type); + atomic_sub(1, &nq->pending_stat_requests); +@@ -2480,7 +2633,11 @@ static void nss_qdisc_basic_stats_callba * All access to nq fields below do not need lock protection. They * do not get manipulated on different thread contexts. */ @@ -2215,7 +3743,7 @@ atomic_sub(1, &nq->pending_stat_requests); wake_up(&nq->wait_queue); return; -@@ -2561,9 +2659,18 @@ static void nss_qdisc_basic_stats_callba +@@ -2502,9 +2659,18 @@ static void nss_qdisc_basic_stats_callba * nss_qdisc_get_stats_timer_callback() * Invoked periodically to get updated stats */ @@ -2234,7 +3762,16 @@ nss_tx_status_t rc; struct nss_if_msg nim; int msg_type; -@@ -2610,9 +2717,14 @@ void nss_qdisc_start_basic_stats_polling +@@ -2524,7 +2690,7 @@ static void nss_qdisc_get_stats_timer_ca + * Check if we failed to send the stats request to NSS. + */ + if (rc != NSS_TX_SUCCESS) { +- nss_qdisc_info("%p: stats fetch request dropped, causing " ++ nss_qdisc_info("%px: stats fetch request dropped, causing " + "delay in stats fetch\n", nq->qdisc); + + /* +@@ -2551,9 +2717,14 @@ void nss_qdisc_start_basic_stats_polling return; } @@ -2249,7 +3786,7 @@ nq->stats_get_timer.expires = jiffies + HZ; atomic_set(&nq->pending_stat_requests, 1); add_timer(&nq->stats_get_timer); -@@ -2650,13 +2762,15 @@ void nss_qdisc_stop_basic_stats_polling( +@@ -2591,13 +2762,15 @@ void nss_qdisc_stop_basic_stats_polling( * nss_qdisc_gnet_stats_copy_basic() * Wrapper around gnet_stats_copy_basic() */ @@ -2267,7 +3804,7 @@ #endif } -@@ -2695,10 +2809,8 @@ static int nss_qdisc_if_event_cb(struct +@@ -2636,10 +2809,8 @@ static int nss_qdisc_if_event_cb(struct switch (event) { case NETDEV_BR_JOIN: @@ -2279,7 +3816,7 @@ dev->name); br = nss_qdisc_get_dev_master(dev); if_num = nss_cmn_get_interface_number(nss_qdisc_ctx, dev); -@@ -2754,6 +2866,7 @@ static int nss_qdisc_if_event_cb(struct +@@ -2695,6 +2866,7 @@ static int nss_qdisc_if_event_cb(struct return NOTIFY_DONE; } @@ -2287,13 +3824,13 @@ /* * nss_qdisc_tcf_chain() * Return the filter list of qdisc. -@@ -2778,8 +2891,29 @@ struct tcf_proto __rcu **nss_qdisc_tcf_c +@@ -2719,8 +2891,29 @@ struct tcf_proto __rcu **nss_qdisc_tcf_c if (nq->is_root) { return &(nq->filter_list); } + -+ return NULL; -+} + return NULL; + } +#else +/* + * nss_qdisc_tcf_block() @@ -2311,8 +3848,8 @@ + return nq->block; + } + - return NULL; - } ++ return NULL; ++} +#endif /* @@ -2345,7 +3882,15 @@ #if defined(NSS_QDISC_PPE_SUPPORT) #include "nss_ppe.h" -@@ -186,7 +190,11 @@ struct nss_qdisc { +@@ -145,6 +149,7 @@ struct nss_qdisc { + * the NSS e.g. perhaps operating on a wifi interface + * or bridge. + */ ++ bool needs_ppe_loopback; /* True when qdisc is on bridge or igs */ + bool destroy_virtual_interface; /* Set if the interface is first registered in NSS by + * us. This means it needs to be un-regisreted when the + * module goes down. +@@ -185,7 +190,11 @@ struct nss_qdisc { */ struct gnet_stats_basic_packed bstats; /* Basic class statistics */ struct gnet_stats_queue qstats; /* Qstats for use by classes */ @@ -2357,7 +3902,7 @@ struct timer_list stats_get_timer; /* Timer used to poll for stats */ atomic_t pending_stat_requests; /* Number of pending stats responses */ wait_queue_head_t wait_queue; /* Wait queue used to wait on responses from the NSS */ -@@ -201,6 +209,9 @@ struct nss_qdisc { +@@ -200,6 +209,9 @@ struct nss_qdisc { */ #endif struct tcf_proto __rcu *filter_list; /* Filter list */ @@ -2367,7 +3912,7 @@ }; /* -@@ -238,11 +249,81 @@ enum nss_qdisc_hybrid_mode { +@@ -237,11 +249,81 @@ enum nss_qdisc_hybrid_mode { }; /* @@ -2450,7 +3995,7 @@ /* * nss_qdisc_mode_get() -@@ -256,11 +337,13 @@ extern uint8_t nss_qdisc_accel_mode_get( +@@ -255,11 +337,13 @@ extern uint8_t nss_qdisc_accel_mode_get( */ extern struct sk_buff *nss_qdisc_peek(struct Qdisc *sch); @@ -2464,7 +4009,7 @@ /* * nss_qdisc_reset() -@@ -272,7 +355,11 @@ extern void nss_qdisc_reset(struct Qdisc +@@ -271,7 +355,11 @@ extern void nss_qdisc_reset(struct Qdisc * nss_qdisc_enqueue() * Generic enqueue call for enqueuing packets into NSS for shaping */ @@ -2476,7 +4021,7 @@ /* * nss_qdisc_dequeue() -@@ -338,7 +425,8 @@ extern void nss_qdisc_destroy(struct nss +@@ -337,7 +425,8 @@ extern void nss_qdisc_destroy(struct nss * Initializes a shaper in NSS, based on the position of this qdisc (child or root) * and if its a normal interface or a bridge interface. */ @@ -2486,7 +4031,7 @@ /* * nss_qdisc_start_basic_stats_polling() -@@ -356,8 +444,8 @@ extern void nss_qdisc_stop_basic_stats_p +@@ -355,8 +444,8 @@ extern void nss_qdisc_stop_basic_stats_p * nss_qdisc_gnet_stats_copy_basic() * Wrapper around gnet_stats_copy_basic() */ @@ -2497,7 +4042,7 @@ /* * nss_qdisc_gnet_stats_copy_queue() -@@ -373,11 +461,19 @@ extern int nss_qdisc_gnet_stats_copy_que +@@ -372,11 +461,19 @@ extern int nss_qdisc_gnet_stats_copy_que extern struct Qdisc *nss_qdisc_replace(struct Qdisc *sch, struct Qdisc *new, struct Qdisc **pold); @@ -2519,6 +4064,14 @@ * nss_qdisc_tcf_bind() --- a/nss_qdisc/nss_tbl.c +++ b/nss_qdisc/nss_tbl.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. @@ -29,9 +29,18 @@ static struct nla_policy nss_tbl_policy[ [TCA_NSSTBL_PARMS] = { .len = sizeof(struct tc_nsstbl_qopt) }, }; @@ -2697,6 +4250,28 @@ { struct nss_tbl_sched_data *q = qdisc_priv(sch); struct nss_qdisc *nq_new = (struct nss_qdisc *)qdisc_priv(new); +@@ -301,10 +358,10 @@ static int nss_tbl_graft(struct Qdisc *s + *old = q->qdisc; + sch_tree_unlock(sch); + +- nss_qdisc_info("Grafting old: %p with new: %p\n", *old, new); ++ nss_qdisc_info("Grafting old: %px with new: %px\n", *old, new); + if (*old != &noop_qdisc) { + struct nss_qdisc *nq_old = (struct nss_qdisc *)qdisc_priv(*old); +- nss_qdisc_info("Detaching old: %p\n", *old); ++ nss_qdisc_info("Detaching old: %px\n", *old); + nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag; + if (nss_qdisc_node_detach(&q->nq, nq_old, &nim_detach, + NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) { +@@ -313,7 +370,7 @@ static int nss_tbl_graft(struct Qdisc *s + } + + if (new != &noop_qdisc) { +- nss_qdisc_info("Attaching new: %p\n", new); ++ nss_qdisc_info("Attaching new: %px\n", new); + nim_attach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag; + nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_attach.child_qos_tag = nq_new->qos_tag; + if (nss_qdisc_node_attach(&q->nq, nq_new, &nim_attach, @@ -339,6 +396,7 @@ static struct Qdisc *nss_tbl_leaf(struct return q->qdisc; } @@ -2746,8 +4321,21 @@ .init = nss_tbl_init, .reset = nss_tbl_reset, .destroy = nss_tbl_destroy, +@@ -389,4 +463,3 @@ struct Qdisc_ops nss_tbl_qdisc_ops __rea + .dump = nss_tbl_dump, + .owner = THIS_MODULE, + }; +- --- a/nss_qdisc/nss_wred.c +++ b/nss_qdisc/nss_wred.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2017, 2020 The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. @@ -55,9 +55,18 @@ static struct nla_policy nss_wred_policy * nss_wred_enqueue() * Enqueue API for nsswred qdisc @@ -2838,18 +4426,20 @@ if (!qopt) { return -EINVAL; } -@@ -253,7 +282,11 @@ static int nss_wred_change(struct Qdisc +@@ -253,8 +282,12 @@ static int nss_wred_change(struct Qdisc #if defined(NSS_QDISC_PPE_SUPPORT) if (q->nq.mode == NSS_QDISC_MODE_PPE) { +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) if (nss_wred_ppe_change(sch, opt) < 0) { +- nss_qdisc_warning("nss_wred %p params validate and save failed\n", sch); +#else + if (nss_wred_ppe_change(sch, opt, extack) < 0) { +#endif - nss_qdisc_warning("nss_wred %px params validate and save failed\n", sch); ++ nss_qdisc_warning("nss_wred %px params validate and save failed\n", sch); return -EINVAL; } + return 0; @@ -298,16 +331,28 @@ static int nss_wred_change(struct Qdisc * nss_wred_init() * Init the nsswred qdisc @@ -2930,6 +4520,43 @@ .destroy = nss_wred_destroy, --- a/nss_qdisc/nss_wrr.c +++ b/nss_qdisc/nss_wrr.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -42,7 +42,7 @@ static inline struct nss_wrr_class_data + struct Qdisc_class_common *clc; + clc = qdisc_class_find(&q->clhash, classid); + if (clc == NULL) { +- nss_qdisc_info("Cannot find class with classid %u in qdisc %p hash table %p\n", classid, sch, &q->clhash); ++ nss_qdisc_info("Cannot find class with classid %u in qdisc %px hash table %px\n", classid, sch, &q->clhash); + return NULL; + } + return container_of(clc, struct nss_wrr_class_data, cl_common); +@@ -53,7 +53,7 @@ static void nss_wrr_destroy_class(struct + struct nss_wrr_sched_data *q = qdisc_priv(sch); + struct nss_if_msg nim; + +- nss_qdisc_info("Destroying nss_wrr class %p from qdisc %p\n", cl, sch); ++ nss_qdisc_info("Destroying nss_wrr class %px from qdisc %px\n", cl, sch); + + /* + * Note, this function gets called even for NSSWRR and not just for NSSWRR_GROUP. +@@ -62,8 +62,8 @@ static void nss_wrr_destroy_class(struct + * only for the root qdisc. + */ + if (cl == &q->root) { +- nss_qdisc_info("We do not destroy nss_wrr class %p here since this is " +- "the qdisc %p\n", cl, sch); ++ nss_qdisc_info("We do not destroy nss_wrr class %px here since this is " ++ "the qdisc %px\n", cl, sch); + return; + } + @@ -84,7 +84,7 @@ static void nss_wrr_destroy_class(struct /* * And now we destroy the child. @@ -2997,7 +4624,16 @@ nss_qdisc_warning("validation of configuration parameters for wrr class %x failed\n", sch->handle); return -EINVAL; -@@ -275,7 +296,7 @@ static int nss_wrr_change_class(struct Q +@@ -266,7 +287,7 @@ static int nss_wrr_change_class(struct Q + return -EINVAL; + } + +- nss_qdisc_info("NSS_wrr class %u allocated %p\n", classid, cl); ++ nss_qdisc_info("NSS_wrr class %u allocated %px\n", classid, cl); + cl->cl_common.classid = classid; + + /* +@@ -275,10 +296,10 @@ static int nss_wrr_change_class(struct Q * reference count should not be 0. */ cl->qdisc = &noop_qdisc; @@ -3005,7 +4641,11 @@ + nss_qdisc_atomic_set(&cl->nq); *arg = (unsigned long)cl; - nss_qdisc_info("Adding classid %u to qdisc %px hash queue %px\n", classid, sch, &q->clhash); +- nss_qdisc_info("Adding classid %u to qdisc %p hash queue %p\n", classid, sch, &q->clhash); ++ nss_qdisc_info("Adding classid %u to qdisc %px hash queue %px\n", classid, sch, &q->clhash); + + /* + * This is where a class gets initialized. Classes do not have a init function @@ -286,7 +307,8 @@ static int nss_wrr_change_class(struct Q * here. */ @@ -3028,7 +4668,16 @@ { struct nss_wrr_sched_data *q = qdisc_priv(sch); struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)arg; -@@ -412,7 +438,9 @@ static int nss_wrr_delete_class(struct Q +@@ -401,7 +427,7 @@ static int nss_wrr_delete_class(struct Q + /* + * The message to NSS should be sent to the parent of this class + */ +- nss_qdisc_info("Detaching nss_wrr class: %p\n", cl); ++ nss_qdisc_info("Detaching nss_wrr class: %px\n", cl); + nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag; + nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wrr_detach.child_qos_tag = cl->nq.qos_tag; + if (nss_qdisc_node_detach(&q->nq, &cl->nq, &nim, +@@ -412,17 +438,24 @@ static int nss_wrr_delete_class(struct Q sch_tree_lock(sch); qdisc_reset(cl->qdisc); qdisc_class_hash_remove(&q->clhash, &cl->cl_common); @@ -3038,8 +4687,10 @@ + sch_tree_unlock(sch); if (!refcnt) { - nss_qdisc_error("Reference count should not be zero for class %px\n", cl); -@@ -421,8 +449,13 @@ static int nss_wrr_delete_class(struct Q +- nss_qdisc_error("Reference count should not be zero for class %p\n", cl); ++ nss_qdisc_error("Reference count should not be zero for class %px\n", cl); + } + return 0; } @@ -3053,7 +4704,59 @@ { struct nss_wrr_sched_data *q = qdisc_priv(sch); struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)arg; -@@ -504,6 +537,7 @@ static void nss_wrr_qlen_notify(struct Q +@@ -430,10 +463,10 @@ static int nss_wrr_graft_class(struct Qd + struct nss_if_msg nim_attach; + struct nss_qdisc *nq_new = qdisc_priv(new); + +- nss_qdisc_info("Grafting class %p\n", sch); ++ nss_qdisc_info("Grafting class %px\n", sch); + + if (cl == &q->root) { +- nss_qdisc_error("Can't graft root class %p\n", cl); ++ nss_qdisc_error("Can't graft root class %px\n", cl); + return -EINVAL; + } + +@@ -448,10 +481,10 @@ static int nss_wrr_graft_class(struct Qd + * Since we initially attached a noop qdisc as child (in Linux), + * we do not perform a detach in the NSS if its a noop qdisc. + */ +- nss_qdisc_info("Grafting old: %p with new: %p\n", *old, new); ++ nss_qdisc_info("Grafting old: %px with new: %px\n", *old, new); + if (*old != &noop_qdisc) { + struct nss_qdisc *nq_child = qdisc_priv(*old); +- nss_qdisc_info("Detaching old: %p\n", *old); ++ nss_qdisc_info("Detaching old: %px\n", *old); + nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag; + if (nss_qdisc_node_detach(&cl->nq, nq_child, &nim_detach, + NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) { +@@ -464,7 +497,7 @@ static int nss_wrr_graft_class(struct Qd + * to the NSS. + */ + if (new != &noop_qdisc) { +- nss_qdisc_info("Attaching new: %p\n", new); ++ nss_qdisc_info("Attaching new: %px\n", new); + nim_attach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag; + nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.wrr_group_attach.child_qos_tag = nq_new->qos_tag; + if (nss_qdisc_node_attach(&cl->nq, nq_new, &nim_attach, +@@ -486,7 +519,7 @@ static int nss_wrr_graft_class(struct Qd + static struct Qdisc *nss_wrr_leaf_class(struct Qdisc *sch, unsigned long arg) + { + struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)arg; +- nss_qdisc_info("nss_wrr class leaf %p\n", cl); ++ nss_qdisc_info("nss_wrr class leaf %px\n", cl); + + /* + * Since all nss_wrr groups are leaf nodes, we can always +@@ -497,18 +530,19 @@ static struct Qdisc *nss_wrr_leaf_class( + + static void nss_wrr_qlen_notify(struct Qdisc *sch, unsigned long arg) + { +- nss_qdisc_info("nss_wrr qlen notify %p\n", sch); ++ nss_qdisc_info("nss_wrr qlen notify %px\n", sch); + /* + * Gets called when qlen of child changes (Useful for deactivating) + * Not useful for us here. */ } @@ -3061,7 +4764,20 @@ static unsigned long nss_wrr_get_class(struct Qdisc *sch, u32 classid) { struct nss_wrr_class_data *cl = nss_wrr_find_class(classid, sch); -@@ -526,10 +560,24 @@ static void nss_wrr_put_class(struct Qdi + +- nss_qdisc_info("Get nss_wrr class %p - class match = %p\n", sch, cl); ++ nss_qdisc_info("Get nss_wrr class %px - class match = %px\n", sch, cl); + + if (cl != NULL) { + atomic_add(1, &cl->nq.refcnt); +@@ -520,16 +554,30 @@ static unsigned long nss_wrr_get_class(s + static void nss_wrr_put_class(struct Qdisc *sch, unsigned long arg) + { + struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)arg; +- nss_qdisc_info("nss_wrr put class for %p\n", cl); ++ nss_qdisc_info("nss_wrr put class for %px\n", cl); + + /* * We are safe to destroy the qdisc if the reference count * goes down to 0. */ @@ -3087,6 +4803,15 @@ static int nss_wrr_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, struct tcmsg *tcm) +@@ -538,7 +586,7 @@ static int nss_wrr_dump_class(struct Qdi + struct nlattr *opts; + struct tc_nsswrr_class_qopt qopt; + +- nss_qdisc_info("Dumping class %p of Qdisc %x\n", cl, sch->handle); ++ nss_qdisc_info("Dumping class %px of Qdisc %x\n", cl, sch->handle); + + qopt.quantum = cl->quantum; + @@ -550,7 +598,7 @@ static int nss_wrr_dump_class(struct Qdi tcm->tcm_handle = cl->cl_common.classid; tcm->tcm_info = cl->qdisc->handle; @@ -3105,7 +4830,16 @@ nss_qdisc_gnet_stats_copy_queue(d, &nq->qstats) < 0) { return -1; } -@@ -600,9 +648,17 @@ static void nss_wrr_walk(struct Qdisc *s +@@ -580,7 +628,7 @@ static void nss_wrr_walk(struct Qdisc *s + struct nss_wrr_class_data *cl; + unsigned int i; + +- nss_qdisc_info("In nss_wrr walk %p\n", sch); ++ nss_qdisc_info("In nss_wrr walk %px\n", sch); + if (arg->stop) + return; + +@@ -600,14 +648,22 @@ static void nss_wrr_walk(struct Qdisc *s } } @@ -3123,6 +4857,12 @@ int err; struct nss_if_msg nim; struct tc_nsswrr_qopt *qopt; + +- nss_qdisc_info("Init nss_wrr qdisc %p\n", sch); ++ nss_qdisc_info("Init nss_wrr qdisc %px\n", sch); + + err = qdisc_class_hash_init(&q->clhash); + if (err < 0) { @@ -620,7 +676,11 @@ static int nss_wrr_init_qdisc(struct Qdi qdisc_class_hash_insert(&q->clhash, &q->root.cl_common); qdisc_class_hash_grow(sch, &q->clhash); @@ -3173,6 +4913,35 @@ if (!qopt) { return -EINVAL; } +@@ -695,7 +765,7 @@ static int nss_wrr_change_qdisc(struct Q + static void nss_wrr_reset_class(struct nss_wrr_class_data *cl) + { + nss_qdisc_reset(cl->qdisc); +- nss_qdisc_info("Nsswrr class resetted %p\n", cl->qdisc); ++ nss_qdisc_info("Nsswrr class resetted %px\n", cl->qdisc); + } + + static void nss_wrr_reset_qdisc(struct Qdisc *sch) +@@ -711,7 +781,7 @@ static void nss_wrr_reset_qdisc(struct Q + } + + nss_qdisc_reset(sch); +- nss_qdisc_info("Nsswrr qdisc resetted %p\n", sch); ++ nss_qdisc_info("Nsswrr qdisc resetted %px\n", sch); + } + + static void nss_wrr_destroy_qdisc(struct Qdisc *sch) +@@ -734,8 +804,8 @@ static void nss_wrr_destroy_qdisc(struct + * care of by the nss_wrr_destroy() function. + */ + if (cl == &q->root) { +- nss_qdisc_info("We do not detach or destroy nss_wrr class %p here since this is " +- "the qdisc %p\n", cl, sch); ++ nss_qdisc_info("We do not detach or destroy nss_wrr class %px here since this is " ++ "the qdisc %px\n", cl, sch); + continue; + } + @@ -743,7 +813,7 @@ static void nss_wrr_destroy_qdisc(struct * Reduce refcnt by 1 before destroying. This is to * ensure that polling of stat stops properly. @@ -3182,6 +4951,15 @@ /* * Detach class before destroying it. We dont check for noop qdisc here +@@ -776,7 +846,7 @@ static void nss_wrr_destroy_qdisc(struct + * will be taken care of by the graft call. + */ + nss_qdisc_destroy(&q->nq); +- nss_qdisc_info("Nsswrr destroyed %p\n", sch); ++ nss_qdisc_info("Nsswrr destroyed %px\n", sch); + } + + static int nss_wrr_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) @@ -794,7 +864,7 @@ static int nss_wrr_dump_qdisc(struct Qdi opt.accel_mode = nss_qdisc_accel_mode_get(&q->nq); @@ -3270,7 +5048,7 @@ .bind_tcf = nss_qdisc_tcf_bind, .unbind_tcf = nss_qdisc_tcf_unbind, .dump = nss_wrr_dump_class, -@@ -883,7 +982,9 @@ struct Qdisc_ops nss_wfq_qdisc_ops __rea +@@ -883,9 +982,10 @@ struct Qdisc_ops nss_wfq_qdisc_ops __rea .enqueue = nss_wrr_enqueue, .dequeue = nss_wrr_dequeue, .peek = qdisc_peek_dequeued, @@ -3280,3 +5058,5 @@ .cl_ops = &nss_wrr_class_ops, .priv_size = sizeof(struct nss_wrr_sched_data), .owner = THIS_MODULE + }; +- diff --git a/qca-nss-clients/patches/0004-11.4-tunipip6.patch b/qca-nss-clients/patches/0004-11.4-tunipip6.patch index e11ff08..b39cec5 100644 --- a/qca-nss-clients/patches/0004-11.4-tunipip6.patch +++ b/qca-nss-clients/patches/0004-11.4-tunipip6.patch @@ -1,458 +1,3 @@ -diff --git a/exports/nss_connmgr_tunipip6.h b/exports/nss_connmgr_tunipip6.h -index 7f8bd2c..e1a5e21 100644 ---- a/exports/nss_connmgr_tunipip6.h -+++ b/exports/nss_connmgr_tunipip6.h -@@ -28,12 +28,13 @@ enum nss_connmgr_tunipip6_err_codes { - NSS_CONNMGR_TUNIPIP6_TUN_DESTROY_FAILURE, /**< Tunnel destroy failure. */ - NSS_CONNMGR_TUNIPIP6_TUN_NONE, /**< Invalid tunnel type */ - NSS_CONNMGR_TUNIPIP6_NETDEV_TYPE_FAILURE, /**< Netdevice is not of type ipv6-in-ipv4. */ -- NSS_CONNMGR_TUNIPIP6_MAPRULE_ADD_FAILURE, /**< BMR/FMR addition failure. */ -- NSS_CONNMGR_TUNIPIP6_MAPRULE_DEL_FAILURE, /**< BMR/FMR deletion failure. */ -- NSS_CONNMGR_TUNIPIP6_FMR_RULE_FLUSH_FAILURE, /**< FMR flush failure. */ -+ NSS_CONNMGR_TUNIPIP6_MAPRULE_ADD_FAILURE, /**< BMR/FMR addition failure. */ -+ NSS_CONNMGR_TUNIPIP6_MAPRULE_DEL_FAILURE, /**< BMR/FMR deletion failure. */ -+ NSS_CONNMGR_TUNIPIP6_FMR_RULE_FLUSH_FAILURE, /**< FMR flush failure. */ - NSS_CONNMGR_TUNIPIP6_NO_DEV, /**< No NSS node found. */ - NSS_CONNMGR_TUNIPIP6_INVALID_PARAM, /**< Invalid tunnel parameters. */ - NSS_CONNMGR_TUNIPIP6_INVALID_RULE_TYPE, /**< Invalid maprule type. */ -+ NSS_CONNMGR_TUNIPIP6_CONTEXT_FAILURE, /**< Tunnel host context not found. */ - }; - - /* -diff --git a/tunipip6/Makefile b/tunipip6/Makefile -index 4c22939..1500a9d 100644 ---- a/tunipip6/Makefile -+++ b/tunipip6/Makefile -@@ -4,7 +4,7 @@ ccflags-y += -DNSS_CLIENT_BUILD_ID="$(BUILD_ID)" - ccflags-y += -DNSS_TUNIPIP6_DEBUG_LEVEL=0 - ccflags-y += -Werror - obj-m += qca-nss-tunipip6.o --qca-nss-tunipip6-objs := nss_connmgr_tunipip6.o nss_connmgr_tunipip6_sysctl.o -+qca-nss-tunipip6-objs := nss_connmgr_tunipip6.o nss_connmgr_tunipip6_sysctl.o nss_connmgr_tunipip6_stats.o - ifneq ($(findstring 4.4, $(KERNELVERSION)),) - ccflags-y += -DDRAFT03_SUPPORT - endif -diff --git a/tunipip6/nss_connmgr_tunipip6.c b/tunipip6/nss_connmgr_tunipip6.c -index 5391724..a7d24c6 100644 ---- a/tunipip6/nss_connmgr_tunipip6.c -+++ b/tunipip6/nss_connmgr_tunipip6.c -@@ -20,7 +20,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -29,71 +28,123 @@ - #include - #include - #include --#include - #include - #include "nss_connmgr_tunipip6.h" - #include "nss_connmgr_tunipip6_sysctl.h" -+#include "nss_connmgr_tunipip6_priv.h" -+ -+#define NSS_TUNIPIP6_MAX_FMR 255 /* Maximum number of forward mapping rule (FMR). */ - - /* -- * NSS tunipip6 debug macros -+ * Frag Id update is disabled by default - */ --#if (NSS_TUNIPIP6_DEBUG_LEVEL < 1) --#define nss_tunipip6_assert(fmt, args...) --#else --#define nss_tunipip6_assert(c) if (!(c)) { BUG_ON(!(c)); } --#endif -- --#if defined(CONFIG_DYNAMIC_DEBUG) -+bool frag_id_update = false; -+/* -+ * Creating custom ipip6 interface is disabled by default. -+ */ -+static bool enable_custom; -+module_param(enable_custom, bool, 0); - - /* -- * Compile messages for dynamic enable/disable -+ * tunipip6 global context. - */ --#define nss_tunipip6_warning(s, ...) pr_debug("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__) --#define nss_tunipip6_info(s, ...) pr_debug("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__) --#define nss_tunipip6_trace(s, ...) pr_debug("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__) --#else -+struct nss_tunipip6_context tunipip6_ctx; - - /* -- * Statically compile messages at different levels -+ * nss_tunipip6_alloc_instance() -+ * Allocate tunipip6 interface instance. - */ --#if (NSS_TUNIPIP6_DEBUG_LEVEL < 2) --#define nss_tunipip6_warning(s, ...) --#else --#define nss_tunipip6_warning(s, ...) pr_warn("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__) --#endif -+static struct nss_tunipip6_instance *nss_tunipip6_alloc_instance(struct net_device *dev, -+ int inner_ifnum, -+ int outer_ifnum) -+{ -+ struct nss_tunipip6_instance*ntii; - --#if (NSS_TUNIPIP6_DEBUG_LEVEL < 3) --#define nss_tunipip6_info(s, ...) --#else --#define nss_tunipip6_info(s, ...) pr_notice("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__) --#endif -+ ntii = vzalloc(sizeof(*ntii)); -+ if (!ntii) { -+ nss_tunipip6_warning("%px: Not able to allocate tunipip6 instance\n", dev); -+ return NULL; -+ } - --#if (NSS_TUNIPIP6_DEBUG_LEVEL < 4) --#define nss_tunipip6_trace(s, ...) --#else --#define nss_tunipip6_trace(s, ...) pr_info("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__) --#endif --#endif -+ ntii->dev = dev; -+ -+ /* -+ * Create statistics dentry. -+ */ -+ if (!nss_tunipip6_stats_dentry_create(ntii)) { -+ vfree(ntii); -+ nss_tunipip6_warning("%px: Not able to create tunipip6 statistics dentry\n", dev); -+ return NULL; -+ } -+ -+ INIT_LIST_HEAD(&ntii->list); -+ ntii->inner_ifnum = inner_ifnum; -+ ntii->outer_ifnum = outer_ifnum; -+ dev_hold(dev); -+ return ntii; -+} - - /* -- * Frag Id update is disabled by default -+ * nss_tunipip6_free_instance() -+ * Delete the tunipip6 interface instance from the list and free it. -+ * -+ * Note: tunnel list lock is expected to be held by the caller. - */ --bool frag_id_update = false; -+static void nss_tunipip6_free_instance(struct nss_tunipip6_instance *ntii) -+{ -+ if (!list_empty(&ntii->list)) { -+ list_del(&ntii->list); -+ } -+ -+ vfree(ntii); -+} -+ - /* -- * Creating custom ipip6 interface is disabled by default. -+ * nss_tunipip6_find_instance() -+ * Find tunipip6 interface instance from list. -+ * -+ * Note: tunnel list lock is expected to be held by the caller. - */ --static bool enable_custom; --module_param(enable_custom, bool, 0); -+struct nss_tunipip6_instance *nss_tunipip6_find_instance(struct net_device *dev) -+{ -+ struct nss_tunipip6_instance *ntii; -+ -+ /* -+ * Check if dev instance is in the list -+ */ -+ list_for_each_entry(ntii, &tunipip6_ctx.dev_list, list) { -+ if (ntii->dev == dev) { -+ return ntii; -+ } -+ } -+ -+ return NULL; -+} - - /* -- * tunipip6 stats structure -+ * nss_tunipip6_find_and_free_instance() -+ * Find and free the tunipip6 instance. - */ --struct nss_tunipip6_stats { -- uint32_t rx_packets; /* Number of received packets */ -- uint32_t rx_bytes; /* Number of received bytes */ -- uint32_t tx_packets; /* Number of transmitted packets */ -- uint32_t tx_bytes; /* Number of transmitted bytes */ --}; -+static enum nss_connmgr_tunipip6_err_codes nss_tunipip6_find_and_free_instance(struct net_device *netdev) -+{ -+ struct dentry *dentry; -+ struct nss_tunipip6_instance *ntii; -+ -+ spin_lock_bh(&tunipip6_ctx.lock); -+ ntii = nss_tunipip6_find_instance(netdev); -+ if (!ntii) { -+ spin_unlock_bh(&tunipip6_ctx.lock); -+ nss_tunipip6_warning("%px: Not able to find tunipip6 instance for dev:%s\n", netdev, netdev->name); -+ return NSS_CONNMGR_TUNIPIP6_CONTEXT_FAILURE; -+ } -+ -+ dentry = ntii->dentry; -+ nss_tunipip6_free_instance(ntii); -+ spin_unlock_bh(&tunipip6_ctx.lock); -+ debugfs_remove(dentry); -+ dev_put(netdev); -+ return NSS_CONNMGR_TUNIPIP6_SUCCESS; -+} - - /* - * nss_tunipip6_encap_exception() -@@ -289,20 +340,29 @@ static void nss_tunipip6_decap_exception(struct net_device *dev, struct sk_buff - - /* - * nss_tunipip6_update_dev_stats -- * Update the Dev stats received from NetAp -+ * Update the Dev stats received from NSS - */ - static void nss_tunipip6_update_dev_stats(struct net_device *dev, -- struct nss_tunipip6_stats_sync_msg *sync_stats) -+ struct nss_tunipip6_msg *tnlmsg) - { - struct pcpu_sw_netstats stats; -+ enum nss_dynamic_interface_type interface_type; -+ struct nss_tunipip6_stats_sync_msg *sync_stats = (struct nss_tunipip6_stats_sync_msg *)&tnlmsg->msg.stats_sync; -+ -+ interface_type = nss_dynamic_interface_get_type(nss_tunipip6_get_context(), tnlmsg->cm.interface); -+ -+ memset(&stats, 0, sizeof(stats)); -+ if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_INNER) { -+ stats.tx_packets = sync_stats->node_stats.tx_packets; -+ stats.tx_bytes = sync_stats->node_stats.tx_bytes; -+ } else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_OUTER) { -+ stats.rx_packets = sync_stats->node_stats.rx_packets; -+ stats.rx_bytes = sync_stats->node_stats.rx_bytes; -+ } else { -+ nss_tunipip6_warning("%px: Invalid interface type received from NSS\n", dev); -+ return; -+ } - -- u64_stats_init(&stats.syncp); -- u64_stats_update_begin(&stats.syncp); -- stats.rx_packets = sync_stats->node_stats.rx_packets; -- stats.rx_bytes = sync_stats->node_stats.rx_bytes; -- stats.tx_packets = sync_stats->node_stats.tx_packets; -- stats.tx_bytes = sync_stats->node_stats.tx_bytes; -- u64_stats_update_end(&stats.syncp); - dev->stats.rx_dropped += nss_cmn_rx_dropped_sum(&sync_stats->node_stats); - - /* TODO: Update rx_dropped stats in ip6_update_offload_stats() */ -@@ -316,11 +376,20 @@ static void nss_tunipip6_update_dev_stats(struct net_device *dev, - void nss_tunipip6_event_receive(void *if_ctx, struct nss_tunipip6_msg *tnlmsg) - { - struct net_device *netdev = NULL; -+ - netdev = (struct net_device *)if_ctx; - - switch (tnlmsg->cm.type) { - case NSS_TUNIPIP6_RX_STATS_SYNC: -- nss_tunipip6_update_dev_stats(netdev, (struct nss_tunipip6_stats_sync_msg *)&tnlmsg->msg.stats_sync); -+ /* -+ * Update netdevice statistics. -+ */ -+ nss_tunipip6_update_dev_stats(netdev, tnlmsg); -+ -+ /* -+ * Update NSS statistics for tunipip6. -+ */ -+ nss_tunipip6_stats_sync(netdev, tnlmsg); - break; - - default: -@@ -415,7 +484,7 @@ static void nss_tunipip6_dev_parse_param(struct net_device *netdev, struct nss_c - tnlcfg->ttl_inherit = false; - tnlcfg->tos_inherit = true; - tnlcfg->frag_id_update = frag_id_update; -- -+ tnlcfg->fmr_max = NSS_TUNIPIP6_MAX_FMR; - /* - * Flow Label In kernel is stored in big endian format. - */ -@@ -454,9 +523,9 @@ static void nss_connmgr_tunipip6_configure_fmr(struct net_device *netdev) - tunnel = (struct ip6_tnl *)netdev_priv(netdev); - - /* -- * Configure FMR table up to NSS_TUNIPIP6_MAX_FMR_NUMBER, the rest will be forwarded to BR -+ * Configure FMR table up to NSS_TUNIPIP6_MAX_FMR, the rest will be forwarded to BR - */ -- for (fmr = tunnel->parms.fmrs; fmr && fmr_number < NSS_TUNIPIP6_MAX_FMR_NUMBER; fmr = fmr->next, fmr_number++) { -+ for (fmr = tunnel->parms.fmrs; fmr && fmr_number < NSS_TUNIPIP6_MAX_FMR; fmr = fmr->next, fmr_number++) { - /* - * Prepare "rulecfg" - */ -@@ -497,6 +566,7 @@ enum nss_connmgr_tunipip6_err_codes nss_connmgr_tunipip6_create_interface(struct - int inner_ifnum, outer_ifnum; - uint32_t features = 0; - nss_tx_status_t status; -+ struct nss_tunipip6_instance *ntii; - - #if IS_ENABLED(CONFIG_MAP_E_SUPPORT) - #ifndef DRAFT03_SUPPORT -@@ -626,7 +696,7 @@ configure_tunnel: - status = nss_tunipip6_tx_sync(nss_ctx, &tnlmsg); - if (status != NSS_TX_SUCCESS) { - nss_tunipip6_warning("%px: Tunnel up command error %d\n", netdev, status); -- goto config_fail; -+ goto context_alloc_fail; - } - - /* -@@ -644,12 +714,28 @@ configure_tunnel: - status = nss_tunipip6_tx_sync(nss_ctx, &tnlmsg); - if (status != NSS_TX_SUCCESS) { - nss_tunipip6_warning("%px: Tunnel up command error %d\n", netdev, status); -- goto config_fail; -+ goto context_alloc_fail; - } - -+ /* -+ * Initialize tunipip6 instance. -+ */ -+ ntii = nss_tunipip6_alloc_instance(netdev, inner_ifnum, outer_ifnum); -+ if (!ntii) { -+ nss_tunipip6_warning("%px: Not able to create tunipip6 instance\n", netdev); -+ goto context_alloc_fail; -+ } -+ -+ /* -+ * Add the new tunipip6 instance to the global list. -+ */ -+ spin_lock_bh(&tunipip6_ctx.lock); -+ list_add(&ntii->list, &tunipip6_ctx.dev_list); -+ spin_unlock_bh(&tunipip6_ctx.lock); -+ - return NSS_CONNMGR_TUNIPIP6_SUCCESS; - --config_fail: -+context_alloc_fail: - nss_unregister_tunipip6_if(outer_ifnum); - outer_reg_fail: - nss_unregister_tunipip6_if(inner_ifnum); -@@ -675,6 +761,8 @@ EXPORT_SYMBOL(nss_connmgr_tunipip6_create_interface); - */ - enum nss_connmgr_tunipip6_err_codes nss_connmgr_tunipip6_destroy_interface(struct net_device *netdev) - { -+ enum nss_connmgr_tunipip6_err_codes ret; -+ - /* - * Validate netdev for ipv6-in-ipv4 Tunnel - */ -@@ -682,7 +770,20 @@ enum nss_connmgr_tunipip6_err_codes nss_connmgr_tunipip6_destroy_interface(struc - return NSS_CONNMGR_TUNIPIP6_NETDEV_TYPE_FAILURE; - } - -- return _nss_tunipip6_dyn_interface_destroy(netdev); -+ /* -+ * Destroy tunipip6 NSS context. -+ */ -+ ret = _nss_tunipip6_dyn_interface_destroy(netdev); -+ if (ret != NSS_CONNMGR_TUNIPIP6_SUCCESS) { -+ nss_tunipip6_warning("%px: Not able to destroy NSS context. Err: %d\n", netdev, ret); -+ return ret; -+ } -+ -+ /* -+ * Find and free the tunipip6 instance. -+ */ -+ ret = nss_tunipip6_find_and_free_instance(netdev); -+ return ret; - } - EXPORT_SYMBOL(nss_connmgr_tunipip6_destroy_interface); - -@@ -940,6 +1041,39 @@ static int nss_tunipip6_dev_event(struct notifier_block *nb, - return NOTIFY_DONE; - } - -+/* -+ * nss_tunipip6_destroy_interface_all() -+ * Destroy NSS interfaces and free instance for all tunipip6 interfaces. -+ */ -+static void nss_tunipip6_destroy_interface_all(void) -+{ -+ struct net_device *netdev; -+ struct dentry *dentry; -+ struct nss_tunipip6_instance *ntii; -+ -+ spin_lock_bh(&tunipip6_ctx.lock); -+ ntii = list_first_entry_or_null(&tunipip6_ctx.dev_list, struct nss_tunipip6_instance, list); -+ do { -+ if (!ntii) { -+ spin_unlock_bh(&tunipip6_ctx.lock); -+ return; -+ } -+ -+ netdev = ntii->dev; -+ dentry = ntii->dentry; -+ nss_tunipip6_free_instance(ntii); -+ spin_unlock_bh(&tunipip6_ctx.lock); -+ -+ dev_put(netdev); -+ debugfs_remove(dentry); -+ _nss_tunipip6_dyn_interface_destroy(netdev); -+ -+ spin_lock_bh(&tunipip6_ctx.lock); -+ ntii = list_first_entry_or_null(&tunipip6_ctx.dev_list, struct nss_tunipip6_instance, list); -+ } while (ntii); -+ spin_unlock_bh(&tunipip6_ctx.lock); -+} -+ - /* - * Linux Net device Notifier - */ -@@ -964,6 +1098,20 @@ int __init nss_tunipip6_init_module(void) - nss_tunipip6_info("module (platform - IPQ806x , %s) loaded\n", - NSS_CLIENT_BUILD_ID); - -+ /* -+ * Initialize lock and dev list. -+ */ -+ INIT_LIST_HEAD(&tunipip6_ctx.dev_list); -+ spin_lock_init(&tunipip6_ctx.lock); -+ -+ /* -+ * Create the debugfs directory for statistics. -+ */ -+ if (!nss_tunipip6_stats_dentry_init()) { -+ nss_tunipip6_trace("Failed to initialize debugfs\n"); -+ return -1; -+ } -+ - /* - * Do not register net device notification for - * custom tunnel. Net device notification is used only -@@ -999,6 +1147,16 @@ void __exit nss_tunipip6_exit_module(void) - } - #endif - -+ /* -+ * Free Host and NSS tunipip6 instances. -+ */ -+ nss_tunipip6_destroy_interface_all(); -+ -+ /* -+ * De-initialize debugfs. -+ */ -+ nss_tunipip6_stats_dentry_deinit(); -+ - /* - * Unregister net device notification for standard tunnel. - */ -diff --git a/tunipip6/nss_connmgr_tunipip6_priv.h b/tunipip6/nss_connmgr_tunipip6_priv.h -new file mode 100644 -index 0000000..3893038 --- /dev/null +++ b/tunipip6/nss_connmgr_tunipip6_priv.h @@ -0,0 +1,94 @@ @@ -550,9 +95,6 @@ index 0000000..3893038 +struct nss_tunipip6_instance *nss_tunipip6_find_instance(struct net_device *dev); + +#endif /* __NSS_CONNMGR_TUNIPIP6_PRIV_H_ */ -diff --git a/tunipip6/nss_connmgr_tunipip6_stats.c b/tunipip6/nss_connmgr_tunipip6_stats.c -new file mode 100644 -index 0000000..0843300 --- /dev/null +++ b/tunipip6/nss_connmgr_tunipip6_stats.c @@ -0,0 +1,225 @@ @@ -781,9 +323,6 @@ index 0000000..0843300 + + return true; +} -diff --git a/tunipip6/nss_connmgr_tunipip6_stats.h b/tunipip6/nss_connmgr_tunipip6_stats.h -new file mode 100644 -index 0000000..bbe7311 --- /dev/null +++ b/tunipip6/nss_connmgr_tunipip6_stats.h @@ -0,0 +1,73 @@ @@ -860,65 +399,3 @@ index 0000000..bbe7311 +extern bool nss_tunipip6_stats_dentry_create(struct nss_tunipip6_instance *tun_inst); + +#endif /* _NSS_CONNMGR_TUNIPIP6_STATS_H_ */ -diff --git a/tunipip6/nss_connmgr_tunipip6_sysctl.c b/tunipip6/nss_connmgr_tunipip6_sysctl.c -index fed8d81..3632d62 100644 ---- a/tunipip6/nss_connmgr_tunipip6_sysctl.c -+++ b/tunipip6/nss_connmgr_tunipip6_sysctl.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. - - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above -@@ -61,7 +61,7 @@ static int nss_tunipip6_data_parser(struct ctl_table *ctl, int write, void __use - bool ipv4_prefix_valid = false, ipv4_prefix_len_valid = false, ipv6_suffix_len_valid = false; - bool rule_type_valid = false, ea_len_valid = false, psid_offset_valid = false, netdev_valid = false; - struct nss_connmgr_tunipip6_maprule_cfg mrcfg = {0}; -- char *buf = kzalloc(MAX_PROC_SIZE, GFP_KERNEL); -+ char *buf; - enum nss_connmgr_tunipip6_err_codes status; - struct net_device *dev = NULL; - char *pfree; -@@ -69,7 +69,11 @@ static int nss_tunipip6_data_parser(struct ctl_table *ctl, int write, void __use - int ret; - int count; - -+ if (!write) { -+ return -EINVAL; -+ } - -+ buf = kzalloc(MAX_PROC_SIZE, GFP_KERNEL); - if (!buf) { - return -ENOMEM; - } -@@ -122,6 +126,7 @@ static int nss_tunipip6_data_parser(struct ctl_table *ctl, int write, void __use - - if ((rule_type !=NSS_CONNMGR_TUNIPIP6_RULE_BMR) && - (rule_type != NSS_CONNMGR_TUNIPIP6_RULE_FMR)) { -+ kfree(pfree); - goto fail; - } - rule_type_valid = true; -@@ -135,6 +140,7 @@ static int nss_tunipip6_data_parser(struct ctl_table *ctl, int write, void __use - } - - if (frag_id != 0 && frag_id != 1) { -+ kfree(pfree); - goto fail; - } - continue; -@@ -396,9 +402,9 @@ static int nss_tunipip6_cmd_procfs_read_help(struct ctl_table *ctl, int write, v - b. To delete maprule(BMR):\n\ - echo dev= rule_type=<1> > remove_map_rule\n\ - 3. To flush FMR entries:\n\ -- echo dev= > flush_fmr_rule\n\ -- 4. To enable/disable frag id:\n\ -- echo frag_id_update=<0/1> > frag_id\n\ -+ echo dev= > flush_fmr_rule\n"); -+ pr_info("\t\t\t4. To enable/disable frag id: \n\ -+ echo frag_id_update=<0/1> > frag_id \n\ - =====end of help=====\n"); - *lenp = 0; - return ret; diff --git a/qca-nss-clients/patches/0005-12.0-match.patch b/qca-nss-clients/patches/0005-12.0-match.patch deleted file mode 100644 index dbd29aa..0000000 --- a/qca-nss-clients/patches/0005-12.0-match.patch +++ /dev/null @@ -1,96 +0,0 @@ -diff --git a/match/nss_match_l2.c b/match/nss_match_l2.c -index a415fbc..5f54cef 100644 ---- a/match/nss_match_l2.c -+++ b/match/nss_match_l2.c -@@ -1,6 +1,7 @@ - /* - ******************************************************************************* - * Copyright (c) 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 -@@ -133,7 +134,7 @@ static int nss_match_l2_cmd_parse(char *input_msg, struct nss_match_msg *rule_ms - struct nss_ctx_instance *nss_ctx = nss_match_get_context(); - int ret = 0; - uint32_t mask_val[4] = {0}; -- uint32_t actions = 0, if_num = 0, setprio = 0, nexthop = 0; -+ uint32_t actions = 0, if_num = 0, setprio = NSS_MAX_NUM_PRI, nexthop = 0; - uint16_t smac[3] = {0}, dmac[3] = {0}, mask_id = 0, ethertype = 0; - uint8_t mac_addr_tmp[6]; - char tmp[4]; -@@ -340,22 +341,22 @@ static int nss_match_l2_cmd_parse(char *input_msg, struct nss_match_msg *rule_ms - - switch(actions) { - case NSS_MATCH_ACTION_SETPRIO: -- if (nexthop || !setprio || setprio >= NSS_MAX_NUM_PRI) { -+ if (nexthop || setprio >= NSS_MAX_NUM_PRI) { - goto fail; - } - break; - case NSS_MATCH_ACTION_FORWARD: -- if (setprio || !nexthop) { -+ if (!(setprio == NSS_MAX_NUM_PRI) || !nexthop) { - goto fail; - } - break; - case NSS_MATCH_ACTION_SETPRIO | NSS_MATCH_ACTION_FORWARD: -- if (!setprio || !nexthop || setprio >= NSS_MAX_NUM_PRI) { -+ if (!nexthop || setprio >= NSS_MAX_NUM_PRI) { - goto fail; - } - break; - case NSS_MATCH_ACTION_DROP: -- if (setprio || nexthop) { -+ if (!(setprio == NSS_MAX_NUM_PRI) || nexthop) { - goto fail; - } - break; -diff --git a/match/nss_match_vow.c b/match/nss_match_vow.c -index cc395a9..2d27bd3 100644 ---- a/match/nss_match_vow.c -+++ b/match/nss_match_vow.c -@@ -1,6 +1,6 @@ - /* - ******************************************************************************* -- * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above -@@ -122,7 +122,7 @@ static int nss_match_vow_cmd_parse(char *input_msg, struct nss_match_msg *rule_m - char *token, *param, *value; - struct nss_ctx_instance *nss_ctx = nss_match_get_context(); - int ret = 0; -- uint32_t actions = 0, if_num = 0, dscp = 0, outer_prio = 0, inner_prio = 0, setprio = 0, nexthop = 0; -+ uint32_t actions = 0, if_num = 0, dscp = 0, outer_prio = 0, inner_prio = 0, setprio = NSS_MAX_NUM_PRI, nexthop = 0; - uint16_t mask_id = 0; - uint32_t mask_val = 0; - -@@ -301,22 +301,22 @@ static int nss_match_vow_cmd_parse(char *input_msg, struct nss_match_msg *rule_m - - switch(actions) { - case NSS_MATCH_ACTION_SETPRIO: -- if (nexthop || !setprio || setprio >= NSS_MAX_NUM_PRI) { -+ if (nexthop || setprio >= NSS_MAX_NUM_PRI) { - goto fail; - } - break; - case NSS_MATCH_ACTION_FORWARD: -- if (setprio || !nexthop) { -+ if (!(setprio == NSS_MAX_NUM_PRI) || !nexthop) { - goto fail; - } - break; - case NSS_MATCH_ACTION_SETPRIO | NSS_MATCH_ACTION_FORWARD: -- if (!setprio || !nexthop || setprio >= NSS_MAX_NUM_PRI) { -+ if (!nexthop || setprio >= NSS_MAX_NUM_PRI) { - goto fail; - } - break; - case NSS_MATCH_ACTION_DROP: -- if (setprio || nexthop) { -+ if (!(setprio == NSS_MAX_NUM_PRI) || nexthop) { - goto fail; - } - break; diff --git a/qca-nss-clients/patches/0007-12.0-pppoe.patch b/qca-nss-clients/patches/0007-12.0-pppoe.patch new file mode 100644 index 0000000..6dcc82d --- /dev/null +++ b/qca-nss-clients/patches/0007-12.0-pppoe.patch @@ -0,0 +1,245 @@ +--- a/pppoe/Makefile ++++ b/pppoe/Makefile +@@ -1,6 +1,10 @@ + # Makefile for pppoe client + ccflags-y += -I$(obj)/../exports -I$(obj)/.. -I$(obj)/nss_hal/include + ccflags-y += -DNSS_PPPOE_DEBUG_LEVEL=0 +-ccflags-y += -Werror ++ccflags-y += -Wall -Werror + obj-m += qca-nss-pppoe.o + qca-nss-pppoe-objs := nss_connmgr_pppoe.o ++ ++ifneq (,$(filter $(CONFIG_BONDING),y m)) ++ccflags-y += -DBONDING_SUPPORT ++endif +--- a/pppoe/nss_connmgr_pppoe.c ++++ b/pppoe/nss_connmgr_pppoe.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #ifdef CONFIG_OF + #include + #endif +@@ -50,25 +51,29 @@ static int nss_connmgr_pppoe_get_session + int ppp_ch_count; + + if (ppp_is_multilink(dev)) { +- nss_connmgr_pppoe_warn("%p: channel is multilink PPP\n", dev); ++ nss_connmgr_pppoe_warn("%px: channel is multilink PPP\n", dev); + return -1; + } + + ppp_ch_count = ppp_hold_channels(dev, channel, 1); +- nss_connmgr_pppoe_info("%p: PPP hold channel ret %d\n", dev, ppp_ch_count); ++ nss_connmgr_pppoe_info("%px: PPP hold channel ret %d\n", dev, ppp_ch_count); + if (ppp_ch_count != 1) { +- nss_connmgr_pppoe_warn("%p: hold channel for netdevice failed\n", dev); ++ nss_connmgr_pppoe_warn("%px: hold channel for netdevice failed\n", dev); + return -1; + } + + px_proto = ppp_channel_get_protocol(channel[0]); + if (px_proto != PX_PROTO_OE) { +- nss_connmgr_pppoe_warn("%p: session socket is not of type PX_PROTO_OE\n", dev); ++ nss_connmgr_pppoe_warn("%px: session socket is not of type PX_PROTO_OE\n", dev); + ppp_release_channels(channel, 1); + return -1; + } + +- pppoe_channel_addressing_get(channel[0], addressing); ++ if (pppoe_channel_addressing_get(channel[0], addressing)) { ++ nss_connmgr_pppoe_warn("%px: failed to get addressing information\n", dev); ++ ppp_release_channels(channel, 1); ++ return -1; ++ } + + dev_put(addressing->dev); + ppp_release_channels(channel, 1); +@@ -88,7 +93,7 @@ static struct nss_connmgr_pppoe_session_ + entry = kmalloc(sizeof(struct nss_connmgr_pppoe_session_entry), + GFP_KERNEL); + if (!entry) { +- nss_connmgr_pppoe_warn("%p: failed to allocate pppoe session entry\n", dev); ++ nss_connmgr_pppoe_warn("%px: failed to allocate pppoe session entry\n", dev); + return NULL; + } + +@@ -101,7 +106,7 @@ static struct nss_connmgr_pppoe_session_ + ether_addr_copy(info->server_mac, opt->pa.remote); + ether_addr_copy(info->local_mac, opt->dev->dev_addr); + +- nss_connmgr_pppoe_info("%p: Added PPPoE session with session_id=%u server_mac=%pM local_mac %pM\n", ++ nss_connmgr_pppoe_info("%px: Added PPPoE session with session_id=%u server_mac=%pM local_mac %pM\n", + dev, info->session_id, info->server_mac, info->local_mac); + + entry->dev = dev; +@@ -144,7 +149,7 @@ static int nss_connmgr_pppoe_disconnect( + */ + if_number = nss_cmn_get_interface_number_by_dev(dev); + if (if_number < 0) { +- nss_connmgr_pppoe_warn("%p: Net device is not registered with nss\n", dev); ++ nss_connmgr_pppoe_warn("%px: Net device is not registered with nss\n", dev); + return NOTIFY_DONE; + } + +@@ -161,7 +166,7 @@ static int nss_connmgr_pppoe_disconnect( + } + + if (!found) { +- nss_connmgr_pppoe_warn("%p: PPPoE session is not found for device: %s\n", dev, dev->name); ++ nss_connmgr_pppoe_warn("%px: PPPoE session is not found for device: %s\n", dev, dev->name); + return NOTIFY_DONE; + } + +@@ -177,15 +182,15 @@ static int nss_connmgr_pppoe_disconnect( + nss_pppoe_msg_init(&npm, if_number, NSS_PPPOE_MSG_SESSION_DESTROY, sizeof(struct nss_pppoe_destroy_msg), NULL, NULL); + status = nss_pppoe_tx_msg_sync(nss_pppoe_get_context(), &npm); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pppoe_warn("%p: pppoe session destroy command failed, if_number = %d\n", dev, if_number); ++ nss_connmgr_pppoe_warn("%px: pppoe session destroy command failed, if_number = %d\n", dev, if_number); + goto done; + } + nss_unregister_pppoe_session_if(if_number); + status = nss_dynamic_interface_dealloc_node(if_number, NSS_DYNAMIC_INTERFACE_TYPE_PPPOE); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pppoe_warn("%p: pppoe dealloc node failure for if_number=%d\n", dev, if_number); ++ nss_connmgr_pppoe_warn("%px: pppoe dealloc node failure for if_number=%d\n", dev, if_number); + } else { +- nss_connmgr_pppoe_info("%p: PPPoE session is destroyed with if_number %d, session_id %d, server_mac %pM, local_mac %pM\n", ++ nss_connmgr_pppoe_info("%px: PPPoE session is destroyed with if_number %d, session_id %d, server_mac %pM, local_mac %pM\n", + dev, if_number, entry->info.session_id, + entry->info.server_mac, entry->info.local_mac); + } +@@ -223,13 +228,13 @@ static int nss_connmgr_pppoe_connect(str + */ + if_number = nss_cmn_get_interface_number_by_dev(dev); + if (if_number >= 0) { +- nss_connmgr_pppoe_warn("%p: Net device is already registered with nss\n", dev); ++ nss_connmgr_pppoe_warn("%px: Net device is already registered with nss\n", dev); + return NOTIFY_DONE; + } + + ret = nss_connmgr_pppoe_get_session(dev, &opt); + if (ret < 0) { +- nss_connmgr_pppoe_warn("%p: Unable to get pppoe session from the netdev\n", dev); ++ nss_connmgr_pppoe_warn("%px: Unable to get pppoe session from the netdev\n", dev); + return NOTIFY_DONE; + } + +@@ -238,20 +243,20 @@ static int nss_connmgr_pppoe_connect(str + */ + if_number = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_PPPOE); + if (if_number == -1) { +- nss_connmgr_pppoe_warn("%p: Request interface number failed\n", dev); ++ nss_connmgr_pppoe_warn("%px: Request interface number failed\n", dev); + return NOTIFY_DONE; + } + + if (!nss_is_dynamic_interface(if_number)) { +- nss_connmgr_pppoe_warn("%p: Invalid NSS dynamic I/F number %d\n", dev, if_number); ++ nss_connmgr_pppoe_warn("%px: Invalid NSS dynamic I/F number %d\n", dev, if_number); + goto connect_fail1; + } + +- nss_connmgr_pppoe_info("%p: PPPoE dynamic interface allocation is successful with if_number %d\n", dev, if_number); ++ nss_connmgr_pppoe_info("%px: PPPoE dynamic interface allocation is successful with if_number %d\n", dev, if_number); + + entry = nss_connmgr_add_pppoe_session(dev, &opt); + if (!entry) { +- nss_connmgr_pppoe_warn("%p: PPPoE session add failed %d\n", dev, if_number); ++ nss_connmgr_pppoe_warn("%px: PPPoE session add failed %d\n", dev, if_number); + goto connect_fail1; + } + +@@ -264,12 +269,11 @@ static int nss_connmgr_pppoe_connect(str + features, + entry); + if (!nss_ctx) { +- nss_connmgr_pppoe_warn("%p: nss_register_pppoe_session_if failed\n", dev); ++ nss_connmgr_pppoe_warn("%px: nss_register_pppoe_session_if failed\n", dev); + goto connect_fail2; + } + +- nss_connmgr_pppoe_info("%p: PPPoE session interface registration is successful\n", nss_ctx); +- ++ nss_connmgr_pppoe_info("%px: PPPoE session interface registration is successful\n", nss_ctx); + + memset(&npm, 0, sizeof(struct nss_pppoe_msg)); + npm_create = &npm.msg.create; +@@ -282,11 +286,11 @@ static int nss_connmgr_pppoe_connect(str + */ + if (netif_is_bond_master(opt.dev)) { + int32_t bondid = -1; +-#if IS_ENABLED(CONFIG_BONDING) ++#if defined(BONDING_SUPPORT) + bondid = bond_get_id(opt.dev); + #endif + if (bondid < 0) { +- nss_connmgr_pppoe_warn("%p: Invalid LAG group id 0x%x\n", dev, bondid); ++ nss_connmgr_pppoe_warn("%px: Invalid LAG group id 0x%x\n", dev, bondid); + goto connect_fail3; + } + npm_create->base_if_num = bondid + NSS_LAG0_INTERFACE_NUM; +@@ -298,7 +302,7 @@ static int nss_connmgr_pppoe_connect(str + */ + struct net_device *port = br_port_dev_get(opt.dev, info->server_mac, NULL, 0); + if (!port) { +- nss_connmgr_pppoe_warn("%p: Unable to get the bridge port device from the bridge interface: %s\n", ++ nss_connmgr_pppoe_warn("%px: Unable to get the bridge port device from the bridge interface: %s\n", + dev, opt.dev->name); + goto connect_fail3; + } +@@ -327,20 +331,20 @@ static int nss_connmgr_pppoe_connect(str + ether_addr_copy(npm_create->local_mac, info->local_mac); + npm_create->mtu = dev->mtu; + +- nss_connmgr_pppoe_info("%p: pppoe info\n", dev); +- nss_connmgr_pppoe_info("%p: session_id %d server_mac %pM local_mac %pM base_if %s (%d)\n", ++ nss_connmgr_pppoe_info("%px: pppoe info\n", dev); ++ nss_connmgr_pppoe_info("%px: session_id %d server_mac %pM local_mac %pM base_if %s (%d)\n", + dev, npm_create->session_id, + npm_create->server_mac, npm_create->local_mac, opt.dev->name, npm_create->base_if_num); +- nss_connmgr_pppoe_info("%p: Sending pppoe session create command to NSS\n", dev); ++ nss_connmgr_pppoe_info("%px: Sending pppoe session create command to NSS\n", dev); + + nss_pppoe_msg_init(&npm, if_number, NSS_PPPOE_MSG_SESSION_CREATE, sizeof(struct nss_pppoe_create_msg), NULL, NULL); + + status = nss_pppoe_tx_msg_sync(nss_ctx, &npm); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pppoe_warn("%p: nss pppoe session creation command error %d\n", dev, status); ++ nss_connmgr_pppoe_warn("%px: nss pppoe session creation command error %d\n", dev, status); + goto connect_fail3; + } +- nss_connmgr_pppoe_info("%p: PPPoE session creation is successful\n", dev); ++ nss_connmgr_pppoe_info("%px: PPPoE session creation is successful\n", dev); + + return NOTIFY_DONE; + +@@ -355,7 +359,7 @@ connect_fail2: + connect_fail1: + status = nss_dynamic_interface_dealloc_node(if_number, NSS_DYNAMIC_INTERFACE_TYPE_PPPOE); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pppoe_warn("%p: Unable to dealloc the node[%d] in the NSS fw!\n", dev, if_number); ++ nss_connmgr_pppoe_warn("%px: Unable to dealloc the node[%d] in the NSS fw!\n", dev, if_number); + } + + return NOTIFY_DONE; +@@ -377,7 +381,7 @@ static int nss_connmgr_pppoe_channel_not + case PPP_CHANNEL_DISCONNECT: + return nss_connmgr_pppoe_disconnect(dev); + default: +- nss_connmgr_pppoe_info("%p: Unhandled channel event: %lu\n", dev, event); ++ nss_connmgr_pppoe_info("%px: Unhandled channel event: %lu\n", dev, event); + break; + } + diff --git a/qca-nss-clients/patches/0008-12.0-pptp.patch b/qca-nss-clients/patches/0008-12.0-pptp.patch new file mode 100644 index 0000000..ea57542 --- /dev/null +++ b/qca-nss-clients/patches/0008-12.0-pptp.patch @@ -0,0 +1,479 @@ +--- a/pptp/Makefile ++++ b/pptp/Makefile +@@ -1,6 +1,6 @@ + # Makefile for pptp client + ccflags-y += -I$(obj)/../exports -I$(obj)/.. -I$(obj)/nss_hal/include + ccflags-y += -DNSS_PPTP_DEBUG_LEVEL=0 +-ccflags-y += -Werror ++ccflags-y += -Wall -Werror + obj-m += qca-nss-pptp.o + qca-nss-pptp-objs := nss_connmgr_pptp.o +--- a/pptp/nss_connmgr_pptp.c ++++ b/pptp/nss_connmgr_pptp.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2015-2018, 2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -99,13 +99,13 @@ static int nss_connmgr_pptp_client_xmit( + */ + host_inner_if = nss_cmn_get_interface_number_by_dev_and_type(dev, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER); + if (host_inner_if < 0) { +- nss_connmgr_pptp_warning("%p: Net device is not registered\n", dev); ++ nss_connmgr_pptp_warning("%px: Net device is not registered\n", dev); + return -1; + } + + nss_pptp_ctx = nss_pptp_get_context(); + if (!nss_pptp_ctx) { +- nss_connmgr_pptp_warning("%p: NSS PPTP context not found for if_number %d\n", dev, host_inner_if); ++ nss_connmgr_pptp_warning("%px: NSS PPTP context not found for if_number %d\n", dev, host_inner_if); + return -1; + } + +@@ -121,11 +121,11 @@ static int nss_connmgr_pptp_client_xmit( + * Found a match for a session and successfully posted + * packet to firmware. Retrun success. + */ +- nss_connmgr_pptp_info("%p: NSS FW tx success if_number %d\n", dev, host_inner_if); ++ nss_connmgr_pptp_info("%px: NSS FW tx success if_number %d\n", dev, host_inner_if); + return 0; + } + +- nss_connmgr_pptp_info("%p: NSS FW tx failed if_number %d\n", dev, host_inner_if); ++ nss_connmgr_pptp_info("%px: NSS FW tx failed if_number %d\n", dev, host_inner_if); + return -1; + } + +@@ -146,31 +146,36 @@ static int nss_connmgr_pptp_get_session( + /* + * check whether the interface is of type PPP + */ +- if (dev->type != ARPHRD_PPP || !(dev->priv_flags & IFF_PPP_PPTP)) { +- nss_connmgr_pptp_info("%p: netdevice is not a PPP tunnel type\n", dev); ++ if (dev->type != ARPHRD_PPP || !(dev->priv_flags_ext & IFF_EXT_PPP_PPTP)) { ++ nss_connmgr_pptp_info("%px: netdevice is not a PPP tunnel type\n", dev); + return -1; + } + + if (ppp_is_multilink(dev)) { +- nss_connmgr_pptp_warning("%p: channel is multilink PPP\n", dev); ++ nss_connmgr_pptp_warning("%px: channel is multilink PPP\n", dev); ++ return -1; ++ } ++ ++ if (ppp_is_cp_enabled(dev)) { ++ nss_connmgr_pptp_warning("%px: rx or tx compression is enabled for PPP\n", dev); + return -1; + } + + ppp_ch_count = ppp_hold_channels(dev, channel, 1); +- nss_connmgr_pptp_info("%p: PPP hold channel ret %d\n", dev, ppp_ch_count); ++ nss_connmgr_pptp_info("%px: PPP hold channel ret %d\n", dev, ppp_ch_count); + if (ppp_ch_count != 1) { +- nss_connmgr_pptp_warning("%p: hold channel for netdevice failed\n", dev); ++ nss_connmgr_pptp_warning("%px: hold channel for netdevice failed\n", dev); + return -1; + } + + if (!channel[0]) { +- nss_connmgr_pptp_warning("%p: channel don't have a ppp_channel\n", dev); ++ nss_connmgr_pptp_warning("%px: channel don't have a ppp_channel\n", dev); + return -1; + } + + px_proto = ppp_channel_get_protocol(channel[0]); + if (px_proto != PX_PROTO_PPTP) { +- nss_connmgr_pptp_warning("%p: session socket is not of type PX_PROTO_PPTP\n", dev); ++ nss_connmgr_pptp_warning("%px: session socket is not of type PX_PROTO_PPTP\n", dev); + ppp_release_channels(channel, 1); + return -1; + } +@@ -195,7 +200,7 @@ static struct nss_connmgr_pptp_session_e + pptp_session_data = kmalloc(sizeof(struct nss_connmgr_pptp_session_entry), + GFP_KERNEL); + if (!pptp_session_data) { +- nss_connmgr_pptp_warning("%p: failed to allocate pptp_session_data\n", dev); ++ nss_connmgr_pptp_warning("%px: failed to allocate pptp_session_data\n", dev); + return NULL; + } + +@@ -209,7 +214,7 @@ static struct nss_connmgr_pptp_session_e + data->src_ip = session->src_addr.sin_addr.s_addr; + data->dst_ip = session->dst_addr.sin_addr.s_addr; + +- nss_connmgr_pptp_info("%p: src_call_id=%u peer_call_id=%u\n", dev, data->src_call, data->dst_call); ++ nss_connmgr_pptp_info("%px: src_call_id=%u peer_call_id=%u\n", dev, data->src_call, data->dst_call); + + /* + * This netdev hold will be released when netdev +@@ -224,7 +229,7 @@ static struct nss_connmgr_pptp_session_e + */ + physical_dev = ip_dev_find(&init_net, data->src_ip); + if (!physical_dev) { +- nss_connmgr_pptp_warning("%p: couldn't find a phycal dev %s\n", dev, dev->name); ++ nss_connmgr_pptp_warning("%px: couldn't find a phycal dev %s\n", dev, dev->name); + dev_put(dev); + kfree(pptp_session_data); + return NULL; +@@ -261,7 +266,7 @@ static void nss_connmgr_pptp_event_recei + return; + } + +- nss_connmgr_pptp_info("%p: Update PPP stats for PPTP netdev %p\n", session_info, netdev); ++ nss_connmgr_pptp_info("%px: Update PPP stats for PPTP netdev %px\n", session_info, netdev); + sync_stats = (struct nss_pptp_sync_session_stats_msg *)&tnlmsg->msg.stats; + dev_hold(netdev); + +@@ -284,7 +289,7 @@ static void nss_connmgr_pptp_event_recei + break; + + default: +- nss_connmgr_pptp_warning("%p: Unknown Event from NSS\n", session_info); ++ nss_connmgr_pptp_warning("%px: Unknown Event from NSS\n", session_info); + break; + } + } +@@ -332,7 +337,7 @@ static void nss_connmgr_pptp_decap_excep + gre_hdr = (struct nss_pptp_gre_hdr *)skb->data; + if ((ntohs(gre_hdr->protocol) != NSS_PPTP_GRE_PROTO) && + (gre_hdr->flags_ver == NSS_PPTP_GRE_VER)) { +- nss_connmgr_pptp_warning("%p, Not PPTP_GRE_PROTO, so freeing\n", dev); ++ nss_connmgr_pptp_warning("%px, Not PPTP_GRE_PROTO, so freeing\n", dev); + dev_kfree_skb_any(skb); + return; + } +@@ -346,16 +351,16 @@ static void nss_connmgr_pptp_decap_excep + rt = ip_route_output_ports(&init_net, &fl4, NULL, tunnel_peer_ip, + tunnel_local_ip, 0, 0, IPPROTO_GRE, RT_TOS(0), 0); + if (unlikely(IS_ERR(rt))) { +- nss_connmgr_pptp_warning("%p: Martian packets, drop\n", dev); +- nss_connmgr_pptp_warning("%p: No route or out dev, drop packet...\n", dev); ++ nss_connmgr_pptp_warning("%px: Martian packets, drop\n", dev); ++ nss_connmgr_pptp_warning("%px: No route or out dev, drop packet...\n", dev); + dev_kfree_skb_any(skb); + return; + } + + if (likely(rt->dst.dev)) { +- nss_connmgr_pptp_info("%p: dst route dev is %s\n", session_info, rt->dst.dev->name); ++ nss_connmgr_pptp_info("%px: dst route dev is %s\n", session_info, rt->dst.dev->name); + } else { +- nss_connmgr_pptp_warning("%p: No out dev, drop packet...\n", dev); ++ nss_connmgr_pptp_warning("%px: No out dev, drop packet...\n", dev); + dev_kfree_skb_any(skb); + } + +@@ -381,7 +386,7 @@ static void nss_connmgr_pptp_decap_excep + } + } + rcu_read_unlock(); +- nss_connmgr_pptp_warning("%p: unable to find session for PPTP exception packet from %s, so freeing\n", dev, dev->name); ++ nss_connmgr_pptp_warning("%px: unable to find session for PPTP exception packet from %s, so freeing\n", dev, dev->name); + dev_kfree_skb_any(skb); + } + +@@ -421,7 +426,7 @@ static void nss_connmgr_pptp_encap_excep + } else if (iph_outer->version == 6) { + skb->protocol = htons(ETH_P_IPV6); + } else { +- nss_connmgr_pptp_info("%p: pkt may be a control packet\n", dev); ++ nss_connmgr_pptp_info("%px: pkt may be a control packet\n", dev); + } + + skb_reset_network_header(skb); +@@ -429,12 +434,12 @@ static void nss_connmgr_pptp_encap_excep + skb->skb_iif = dev->ifindex; + skb->ip_summed = CHECKSUM_NONE; + skb->dev = dev; +- nss_connmgr_pptp_info("%p: send decapsulated packet through network stack", dev); ++ nss_connmgr_pptp_info("%px: send decapsulated packet through network stack", dev); + netif_receive_skb(skb); + return; + } + rcu_read_unlock(); +- nss_connmgr_pptp_warning("%p: unable to find session for PPTP exception packet from %s, so freeing\n", dev, dev->name); ++ nss_connmgr_pptp_warning("%px: unable to find session for PPTP exception packet from %s, so freeing\n", dev, dev->name); + dev_kfree_skb_any(skb); + } + +@@ -465,40 +470,40 @@ static int nss_connmgr_pptp_dev_up(struc + */ + inner_if = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_PPTP_INNER); + if (inner_if < 0) { +- nss_connmgr_pptp_warning("%p: Request inner interface number failed\n", dev); ++ nss_connmgr_pptp_warning("%px: Request inner interface number failed\n", dev); + return NOTIFY_DONE; + } + + if (!nss_is_dynamic_interface(inner_if)) { +- nss_connmgr_pptp_warning("%p: Invalid NSS dynamic I/F number %d\n", dev, inner_if); ++ nss_connmgr_pptp_warning("%px: Invalid NSS dynamic I/F number %d\n", dev, inner_if); + goto inner_fail; + } + + outer_if = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_PPTP_OUTER); + if (outer_if < 0) { +- nss_connmgr_pptp_warning("%p: Request outer interface number failed\n", dev); ++ nss_connmgr_pptp_warning("%px: Request outer interface number failed\n", dev); + goto inner_fail; + } + + if (!nss_is_dynamic_interface(outer_if)) { +- nss_connmgr_pptp_warning("%p: Invalid NSS dynamic I/F number %d\n", dev, outer_if); ++ nss_connmgr_pptp_warning("%px: Invalid NSS dynamic I/F number %d\n", dev, outer_if); + goto outer_fail; + } + + host_inner_if = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER); + if (host_inner_if < 0) { +- nss_connmgr_pptp_warning("%p: Request host inner interface number failed\n", dev); ++ nss_connmgr_pptp_warning("%px: Request host inner interface number failed\n", dev); + goto outer_fail; + } + + if (!nss_is_dynamic_interface(host_inner_if)) { +- nss_connmgr_pptp_warning("%p: Invalid NSS dynamic I/F number %d\n", dev, host_inner_if); ++ nss_connmgr_pptp_warning("%px: Invalid NSS dynamic I/F number %d\n", dev, host_inner_if); + goto host_inner_fail; + } + + session_info = nss_connmgr_add_pptp_session(dev, &opt); + if (!session_info) { +- nss_connmgr_pptp_warning("%p: PPTP session add failed\n", dev); ++ nss_connmgr_pptp_warning("%px: PPTP session add failed\n", dev); + goto host_inner_fail; + } + +@@ -514,11 +519,11 @@ static int nss_connmgr_pptp_dev_up(struc + session_info); + + if (!nss_ctx) { +- nss_connmgr_pptp_warning("%p: nss_register_pptp_if failed for inner\n", dev); ++ nss_connmgr_pptp_warning("%px: nss_register_pptp_if failed for inner\n", dev); + goto register_inner_if_fail; + } + +- nss_connmgr_pptp_info("%p: inner interface registration successful\n", nss_ctx); ++ nss_connmgr_pptp_info("%px: inner interface registration successful\n", nss_ctx); + + /* + * Register pptp tunnel outer interface with NSS +@@ -532,11 +537,11 @@ static int nss_connmgr_pptp_dev_up(struc + session_info); + + if (!nss_ctx) { +- nss_connmgr_pptp_warning("%p: nss_register_pptp_if failed for outer\n", dev); ++ nss_connmgr_pptp_warning("%px: nss_register_pptp_if failed for outer\n", dev); + goto register_outer_if_fail; + } + +- nss_connmgr_pptp_info("%p: outer interface registration successful\n", nss_ctx); ++ nss_connmgr_pptp_info("%px: outer interface registration successful\n", nss_ctx); + + /* + * Register pptp tunnel inner interface with NSS +@@ -550,11 +555,11 @@ static int nss_connmgr_pptp_dev_up(struc + session_info); + + if (!nss_ctx) { +- nss_connmgr_pptp_warning("%p: nss_register_pptp_if failed for host inner\n", dev); ++ nss_connmgr_pptp_warning("%px: nss_register_pptp_if failed for host inner\n", dev); + goto register_host_inner_if_fail; + } + +- nss_connmgr_pptp_info("%p: host inner interface registration successful\n", nss_ctx); ++ nss_connmgr_pptp_info("%px: host inner interface registration successful\n", nss_ctx); + + /* + * Initialize and configure inner I/F. +@@ -584,20 +589,20 @@ static int nss_connmgr_pptp_dev_up(struc + pptpcfg->sibling_ifnum_pri = outer_if; + pptpcfg->sibling_ifnum_aux = host_inner_if; + +- nss_connmgr_pptp_info("%p: pptp info\n", dev); +- nss_connmgr_pptp_info("%p: local_call_id %d peer_call_id %d\n", dev, ++ nss_connmgr_pptp_info("%px: pptp info\n", dev); ++ nss_connmgr_pptp_info("%px: local_call_id %d peer_call_id %d\n", dev, + pptpcfg->src_call_id, + pptpcfg->dst_call_id); +- nss_connmgr_pptp_info("%p: saddr 0x%x daddr 0x%x \n", dev, pptpcfg->sip, pptpcfg->dip); ++ nss_connmgr_pptp_info("%px: saddr 0x%x daddr 0x%x \n", dev, pptpcfg->sip, pptpcfg->dip); + + nss_pptp_msg_init(&pptpmsg, inner_if, NSS_PPTP_MSG_SESSION_CONFIGURE, sizeof(struct nss_pptp_session_configure_msg), NULL, NULL); + + status = nss_pptp_tx_msg_sync(nss_ctx, &pptpmsg); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: nss pptp session creation command error %d\n", dev, status); ++ nss_connmgr_pptp_warning("%px: nss pptp session creation command error %d\n", dev, status); + goto tx_msg_fail; + } +- nss_connmgr_pptp_info("%p: nss_pptp_tx() successful for inner\n", dev); ++ nss_connmgr_pptp_info("%px: nss_pptp_tx() successful for inner\n", dev); + + /* + * Initialize and configure outer I/F. +@@ -609,10 +614,10 @@ static int nss_connmgr_pptp_dev_up(struc + + status = nss_pptp_tx_msg_sync(nss_ctx, &pptpmsg); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: nss pptp session creation command error %d\n", dev, status); ++ nss_connmgr_pptp_warning("%px: nss pptp session creation command error %d\n", dev, status); + goto tx_msg_fail; + } +- nss_connmgr_pptp_info("%p: nss_pptp_tx() successful for outer\n", dev); ++ nss_connmgr_pptp_info("%px: nss_pptp_tx() successful for outer\n", dev); + + /* + * Initialize and configure host inner I/F. +@@ -624,10 +629,10 @@ static int nss_connmgr_pptp_dev_up(struc + + status = nss_pptp_tx_msg_sync(nss_ctx, &pptpmsg); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: nss pptp session creation command error %d\n", dev, status); ++ nss_connmgr_pptp_warning("%px: nss pptp session creation command error %d\n", dev, status); + goto tx_msg_fail; + } +- nss_connmgr_pptp_info("%p: nss_pptp_tx() successful for host inner\n", dev); ++ nss_connmgr_pptp_info("%px: nss_pptp_tx() successful for host inner\n", dev); + + /* + * Enable the offload mode for Linux PPTP kernel driver. After this +@@ -652,17 +657,17 @@ register_inner_if_fail: + host_inner_fail: + status = nss_dynamic_interface_dealloc_node(host_inner_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: Unable to dealloc the node[%d] in the NSS fw!\n", dev, host_inner_if); ++ nss_connmgr_pptp_warning("%px: Unable to dealloc the node[%d] in the NSS fw!\n", dev, host_inner_if); + } + outer_fail: + status = nss_dynamic_interface_dealloc_node(inner_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_OUTER); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: Unable to dealloc the node[%d] in the NSS fw!\n", dev, outer_if); ++ nss_connmgr_pptp_warning("%px: Unable to dealloc the node[%d] in the NSS fw!\n", dev, outer_if); + } + inner_fail: + status = nss_dynamic_interface_dealloc_node(inner_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_INNER); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: Unable to dealloc the node[%d] in the NSS fw!\n", dev, inner_if); ++ nss_connmgr_pptp_warning("%px: Unable to dealloc the node[%d] in the NSS fw!\n", dev, inner_if); + } + + return NOTIFY_DONE; +@@ -686,8 +691,8 @@ static int nss_connmgr_pptp_dev_down(str + /* + * check whether the interface is of type PPP + */ +- if (dev->type != ARPHRD_PPP || !(dev->priv_flags & IFF_PPP_PPTP)) { +- nss_connmgr_pptp_info("%p: netdevice is not a pptp tunnel type\n", dev); ++ if (dev->type != ARPHRD_PPP || !(dev->priv_flags_ext & IFF_EXT_PPP_PPTP)) { ++ nss_connmgr_pptp_info("%px: netdevice is not a pptp tunnel type\n", dev); + return NOTIFY_DONE; + } + +@@ -696,7 +701,7 @@ static int nss_connmgr_pptp_dev_down(str + */ + inner_if = nss_cmn_get_interface_number_by_dev_and_type(dev, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_INNER); + if (inner_if < 0) { +- nss_connmgr_pptp_warning("%p: outer I/F is not registered\n", dev); ++ nss_connmgr_pptp_warning("%px: outer I/F is not registered\n", dev); + return NOTIFY_DONE; + } + +@@ -705,7 +710,7 @@ static int nss_connmgr_pptp_dev_down(str + */ + outer_if = nss_cmn_get_interface_number_by_dev_and_type(dev, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_OUTER); + if (outer_if < 0) { +- nss_connmgr_pptp_warning("%p: inner I/F is not registered\n", dev); ++ nss_connmgr_pptp_warning("%px: inner I/F is not registered\n", dev); + return NOTIFY_DONE; + } + +@@ -714,7 +719,7 @@ static int nss_connmgr_pptp_dev_down(str + */ + host_inner_if = nss_cmn_get_interface_number_by_dev_and_type(dev, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER); + if (host_inner_if < 0) { +- nss_connmgr_pptp_warning("%p: Net device is not registered\n", dev); ++ nss_connmgr_pptp_warning("%px: Net device is not registered\n", dev); + return NOTIFY_DONE; + } + +@@ -729,7 +734,7 @@ static int nss_connmgr_pptp_dev_down(str + } + + if (!session_found) { +- nss_connmgr_pptp_warning("%p: pptp session is not found for this device", dev); ++ nss_connmgr_pptp_warning("%px: pptp session is not found for this device", dev); + return NOTIFY_DONE; + } + +@@ -753,21 +758,21 @@ static int nss_connmgr_pptp_dev_down(str + nss_pptp_msg_init(&pptpmsg, inner_if, NSS_PPTP_MSG_SESSION_DECONFIGURE, sizeof(struct nss_pptp_session_deconfigure_msg), NULL, NULL); + status = nss_pptp_tx_msg_sync(nss_pptp_get_context(), &pptpmsg); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: pptp session destroy command failed, if_number = %d\n", dev, inner_if); ++ nss_connmgr_pptp_warning("%px: pptp session destroy command failed, if_number = %d\n", dev, inner_if); + goto fail; + } + + nss_pptp_msg_init(&pptpmsg, outer_if, NSS_PPTP_MSG_SESSION_DECONFIGURE, sizeof(struct nss_pptp_session_deconfigure_msg), NULL, NULL); + status = nss_pptp_tx_msg_sync(nss_pptp_get_context(), &pptpmsg); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: pptp session destroy command failed, if_number = %d\n", dev, outer_if); ++ nss_connmgr_pptp_warning("%px: pptp session destroy command failed, if_number = %d\n", dev, outer_if); + goto fail; + } + + nss_pptp_msg_init(&pptpmsg, host_inner_if, NSS_PPTP_MSG_SESSION_DECONFIGURE, sizeof(struct nss_pptp_session_deconfigure_msg), NULL, NULL); + status = nss_pptp_tx_msg_sync(nss_pptp_get_context(), &pptpmsg); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: pptp session destroy command failed, if_number = %d\n", dev, host_inner_if); ++ nss_connmgr_pptp_warning("%px: pptp session destroy command failed, if_number = %d\n", dev, host_inner_if); + goto fail; + } + +@@ -783,23 +788,23 @@ static int nss_connmgr_pptp_dev_down(str + */ + status = nss_dynamic_interface_dealloc_node(inner_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_INNER); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: pptp dealloc node failure for inner if_number=%d\n", dev, inner_if); ++ nss_connmgr_pptp_warning("%px: pptp dealloc node failure for inner if_number=%d\n", dev, inner_if); + goto fail; + } + + status = nss_dynamic_interface_dealloc_node(outer_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_OUTER); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: pptp dealloc node failure for outer if_number=%d\n", dev, outer_if); ++ nss_connmgr_pptp_warning("%px: pptp dealloc node failure for outer if_number=%d\n", dev, outer_if); + goto fail; + } + + status = nss_dynamic_interface_dealloc_node(host_inner_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER); + if (status != NSS_TX_SUCCESS) { +- nss_connmgr_pptp_warning("%p: pptp dealloc node failure for host inner if_number=%d\n", dev, host_inner_if); ++ nss_connmgr_pptp_warning("%px: pptp dealloc node failure for host inner if_number=%d\n", dev, host_inner_if); + goto fail; + } + +- nss_connmgr_pptp_info("%p: deleting pptpsession, if_number %d, local_call_id %d, peer_call_id %d\n", dev, ++ nss_connmgr_pptp_info("%px: deleting pptpsession, if_number %d, local_call_id %d, peer_call_id %d\n", dev, + dev->ifindex, session_info->data.src_call, session_info->data.dst_call); + + fail: +@@ -819,11 +824,11 @@ static int nss_connmgr_pptp_dev_event(st + + switch (event) { + case NETDEV_UP: +- nss_connmgr_pptp_info("%p: netdevice '%s' UP event\n", netdev, netdev->name); ++ nss_connmgr_pptp_info("%px: netdevice '%s' UP event\n", netdev, netdev->name); + return nss_connmgr_pptp_dev_up(netdev); + + case NETDEV_DOWN: +- nss_connmgr_pptp_info("%p: netdevice '%s' Down event\n", netdev, netdev->name); ++ nss_connmgr_pptp_info("%px: netdevice '%s' Down event\n", netdev, netdev->name); + return nss_connmgr_pptp_dev_down(netdev); + + default: diff --git a/qca-nss-drv/Makefile b/qca-nss-drv/Makefile index 52b0d2f..37dbe5b 100644 --- a/qca-nss-drv/Makefile +++ b/qca-nss-drv/Makefile @@ -5,9 +5,10 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-drv PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2020-03-20 -PKG_SOURCE_VERSION:=3cfb9f43 -PKG_MIRROR_HASH:=87ab6dab1c0a441b2df95b6c5d992f86a07c6ecd69a0d13eba35014fadaf98d8 +PKG_SOURCE_DATE:=2019-12-12 +PKG_SOURCE_VERSION:=f147342b4437ce91429d0676e5125adbe9a465e3 +PKG_MIRROR_HASH:=1af498932f3cd5e16d5aae60c6f4879ababde620ff7ed6b13ab1ad12aafcbe92 +# PKG_MIRROR_HASH:=87ab6dab1c0a441b2df95b6c5d992f86a07c6ecd69a0d13eba35014fadaf98d8 PKG_JOBS=-j4 PKG_BUILD_PARALLEL:=1 @@ -127,7 +128,6 @@ ifeq ($(CONFIG_TARGET_BOARD), "ipq806x") DRV_MAKE_OPTS+= \ TARGET_NSS_MINOR_VERSION=$(TARGET_NSS_MINOR_VERSION) DRV_MAKE_OPTS+= \ - NSS_DRV_C2C_ENABLE=n \ NSS_DRV_CAPWAP_ENABLE=n \ NSS_DRV_IPSEC_ENABLE=n \ NSS_DRV_BRIDGE_ENABLE=n \ @@ -135,7 +135,6 @@ ifeq ($(CONFIG_TARGET_BOARD), "ipq806x") NSS_DRV_VLAN_ENABLE=n \ NSS_DRV_L2TP_ENABLE=n \ NSS_DRV_LAG_ENABLE=n \ - NSS_DRV_PVXLAN_ENABLE=n \ NSS_DRV_GRE_ENABLE=n \ NSS_DRV_GRE_REDIR_ENABLE=n \ NSS_DRV_GRE_TUNNEL_ENABLE=n \ @@ -145,7 +144,7 @@ ifeq ($(CONFIG_TARGET_BOARD), "ipq806x") NSS_DRV_TUNIPIP6_ENABLE=n \ NSS_DRV_QRFS_ENABLE=n \ NSS_DRV_RMNET_ENABLE=n \ - NSS_DRV_OAM_ENABLE=y \ + NSS_DRV_OAM_ENABLE=n \ NSS_DRV_CLMAP_ENABLE=n \ NSS_DRV_VXLAN_ENABLE=n \ NSS_DRV_MATCH_ENABLE=n \ diff --git a/qca-nss-drv/patches/0001-kernel-5.4-support.patch b/qca-nss-drv/patches/0001-kernel-5.4-support.patch index 28beb58..f384db1 100644 --- a/qca-nss-drv/patches/0001-kernel-5.4-support.patch +++ b/qca-nss-drv/patches/0001-kernel-5.4-support.patch @@ -9,3 +9,50 @@ #define NSS_DATA_PLANE_GMAC_MAX_INTERFACES 4 static DEFINE_SPINLOCK(nss_data_plane_gmac_stats_lock); +--- a/nss_core.c ++++ b/nss_core.c +@@ -45,7 +45,9 @@ + (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)))) || \ + (((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(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \ ++(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \ ++(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)))))) + #error "Check skb recycle code in this file to match Linux version" + #endif + +@@ -447,7 +449,11 @@ static void nss_get_ddr_info(struct nss_ + struct device_node *node; + + si_meminfo(&vals); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)) + cached = global_page_state(NR_FILE_PAGES); ++#else ++ cached = global_node_page_state(NR_FILE_PAGES); ++#endif + avail_ddr = (vals.totalram + cached + vals.sharedram) * vals.mem_unit; + mmu->num_active_cores = nss_top_main.num_nss; + +@@ -744,7 +750,11 @@ static inline void nss_core_handle_virt_ + * Mimic Linux behavior to allow multi-queue netdev choose which queue to use + */ + if (ndev->netdev_ops->ndo_select_queue) { ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)) + queue_offset = ndev->netdev_ops->ndo_select_queue(ndev, nbuf, NULL, NULL); ++#else ++ queue_offset = ndev->netdev_ops->ndo_select_queue(ndev, nbuf, NULL); ++#endif + } + + skb_set_queue_mapping(nbuf, queue_offset); +--- a/nss_tx_rx_common.h ++++ b/nss_tx_rx_common.h +@@ -23,6 +23,7 @@ + #define __NSS_TX_RX_COMMON_H + + #include ++#include + #include + #include + #include "nss_tx_msg_sync.h" 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 index 77c450f..939560c 100644 --- 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 @@ -14,7 +14,509 @@ Signed-off-by: Robert Marko --- a/Makefile +++ b/Makefile -@@ -405,14 +405,7 @@ NSS_CCFLAGS = -DNSS_DT_SUPPORT=1 -DNSS_F +@@ -8,125 +8,64 @@ obj-m += qca-nss-drv.o + # List the files that belong to the driver in alphabetical order. + # + qca-nss-drv-objs := \ +- nss_bridge.o \ +- nss_bridge_log.o \ +- nss_c2c_tx.o \ +- nss_c2c_tx_log.o \ +- nss_c2c_tx_stats.o \ +- nss_c2c_rx.o \ +- nss_c2c_rx_stats.o \ +- nss_capwap.o \ +- nss_capwap_log.o \ +- nss_capwap_stats.o \ +- nss_clmap.o \ +- nss_clmap_log.o \ +- nss_clmap_stats.o \ + nss_cmn.o \ + nss_core.o \ + nss_coredump.o \ + nss_dynamic_interface.o \ + nss_dynamic_interface_log.o \ +- nss_edma.o \ +- nss_edma_stats.o \ + nss_eth_rx.o \ + nss_eth_rx_stats.o \ +- nss_gre.o \ +- nss_gre_log.o \ +- nss_gre_stats.o \ +- nss_gre_redir.o \ +- nss_gre_redir_log.o \ +- nss_gre_redir_lag_ds.o \ +- nss_gre_redir_lag_ds_log.o \ +- nss_gre_redir_lag_ds_stats.o \ +- nss_gre_redir_lag_us.o \ +- nss_gre_redir_lag_us_log.o \ +- nss_gre_redir_lag_us_stats.o \ +- nss_gre_redir_stats.o \ +- nss_gre_redir_mark.o \ +- nss_gre_redir_mark_log.o \ +- nss_gre_redir_mark_stats.o \ +- nss_gre_tunnel.o \ +- nss_gre_tunnel_log.o \ +- nss_gre_tunnel_stats.o \ + nss_if.o \ +- nss_igs.o \ +- nss_igs_stats.o \ + nss_init.o \ + nss_ipv4.o \ + nss_ipv4_stats.o \ + nss_ipv4_log.o \ +- nss_ipv4_reasm.o \ +- nss_ipv4_reasm_stats.o \ +- nss_ipv6.o \ +- nss_ipv6_stats.o \ +- nss_ipv6_log.o \ +- nss_ipv6_reasm.o \ +- nss_ipv6_reasm_stats.o \ +- nss_l2tpv2.o \ +- nss_l2tpv2_log.o \ +- nss_l2tpv2_stats.o \ +- nss_lag.o \ +- nss_lag_log.o \ + nss_log.o \ + nss_lso_rx.o \ + nss_lso_rx_stats.o \ +- nss_map_t.o \ +- nss_map_t_log.o \ +- nss_map_t_stats.o \ + nss_meminfo.o \ + nss_n2h.o \ + nss_n2h_stats.o \ +- nss_oam.o \ +- nss_oam_log.o \ + nss_phys_if.o \ + nss_pm.o \ + nss_profiler.o \ + nss_project.o \ +- nss_portid.o \ +- nss_portid_log.o \ +- nss_portid_stats.o \ +- nss_ppe.o \ +- nss_ppe_log.o \ +- nss_ppe_stats.o \ +- nss_pppoe.o \ +- nss_pppoe_log.o \ +- nss_pppoe_stats.o \ +- nss_pptp.o \ +- nss_pptp_log.o \ +- nss_pptp_stats.o \ +- nss_pvxlan.o \ +- nss_pvxlan_log.o \ +- nss_pvxlan_stats.o \ +- nss_qrfs.o \ +- nss_qrfs_log.o \ +- nss_qrfs_stats.o \ +- nss_rmnet_rx.o \ +- nss_rmnet_rx_stats.o \ + nss_rps.o \ +- nss_shaper.o \ +- nss_sjack.o \ +- nss_sjack_log.o \ +- nss_sjack_stats.o \ + nss_stats.o \ +- nss_tstamp.o \ +- nss_tstamp_stats.o \ +- nss_tun6rd.o \ +- nss_tun6rd_log.o \ +- nss_trustsec_tx.o \ +- nss_trustsec_tx_log.o \ +- nss_trustsec_tx_stats.o \ +- nss_tunipip6.o \ +- nss_tunipip6_log.o \ + nss_tx_msg_sync.o \ + nss_unaligned.o \ + nss_unaligned_log.o \ +- nss_unaligned_stats.o \ ++ nss_unaligned_stats.o ++ ++# Base NSS data plane/HAL support ++qca-nss-drv-objs += nss_data_plane/nss_data_plane.o ++qca-nss-drv-objs += nss_hal/nss_hal.o ++ ++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 ++endif ++ ++ifneq "$(NSS_DRV_VIRT_IF_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_VIRT_IF_ENABLE ++qca-nss-drv-objs += \ + nss_virt_if.o \ +- nss_virt_if_stats.o \ ++ nss_virt_if_stats.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 \ +- nss_tstamp.o \ +- nss_wifi.o \ ++ nss_vlan_log.o ++endif ++ ++ifneq "$(NSS_DRV_WIFI_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_WIFI_ENABLE ++qca-nss-drv-objs += nss_wifi.o \ + nss_wifi_log.o \ + nss_wifi_stats.o \ + nss_wifi_vdev.o \ +@@ -135,58 +74,312 @@ qca-nss-drv-objs := \ + nss_wifili.o \ + nss_wifili_log.o \ + nss_wifili_stats.o ++endif + +-# Base NSS data plane/HAL support +-qca-nss-drv-objs += nss_data_plane/nss_data_plane.o +-qca-nss-drv-objs += nss_hal/nss_hal.o ++ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_BRIDGE_ENABLE ++qca-nss-drv-objs += \ ++ nss_bridge.o \ ++ nss_bridge_log.o ++endif ++ ++ifneq "$(NSS_DRV_IPV4_REASM_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_IPV4_REASM_ENABLE ++qca-nss-drv-objs += \ ++ nss_ipv4_reasm.o \ ++ nss_ipv4_reasm_stats.o ++endif ++ ++ifneq "$(NSS_DRV_L2TP_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_L2TP_ENABLE ++qca-nss-drv-objs += \ ++ nss_l2tpv2.o \ ++ nss_l2tpv2_log.o \ ++ nss_l2tpv2_stats.o ++endif ++ ++ifneq "$(NSS_DRV_LAG_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_LAG_ENABLE ++qca-nss-drv-objs += \ ++ nss_lag.o \ ++ nss_lag_log.o ++endif ++ ++ifneq "$(NSS_DRV_PVXLAN_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_PVXLAN_ENABLE ++qca-nss-drv-objs += \ ++ nss_pvxlan.o \ ++ nss_pvxlan_log.o \ ++ nss_pvxlan_stats.o ++endif ++ ++ifneq "$(NSS_DRV_IPV6_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_IPV6_ENABLE ++qca-nss-drv-objs += \ ++ nss_ipv6.o \ ++ nss_ipv6_stats.o \ ++ nss_ipv6_log.o ++ifneq "$(NSS_DRV_IPV6_REASM_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_IPV6_REASM_ENABLE ++qca-nss-drv-objs += \ ++ nss_ipv6_reasm.o \ ++ nss_ipv6_reasm_stats.o ++endif ++endif ++ ++ifneq "$(NSS_DRV_TSTAMP_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_TSTAMP_ENABLE ++qca-nss-drv-objs += \ ++ nss_tstamp.o \ ++ nss_tstamp_stats.o ++endif ++ ++ifneq "$(NSS_DRV_GRE_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_GRE_ENABLE ++qca-nss-drv-objs += \ ++ nss_gre.o \ ++ nss_gre_log.o \ ++ nss_gre_stats.o ++endif ++ ++ifneq "$(NSS_DRV_GRE_REDIR_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_GRE_REDIR_ENABLE ++qca-nss-drv-objs += \ ++ nss_gre_redir.o \ ++ nss_gre_redir_log.o \ ++ nss_gre_redir_lag_ds.o \ ++ nss_gre_redir_lag_ds_log.o \ ++ nss_gre_redir_lag_ds_stats.o \ ++ nss_gre_redir_lag_us.o \ ++ nss_gre_redir_lag_us_log.o \ ++ nss_gre_redir_lag_us_stats.o \ ++ nss_gre_redir_stats.o \ ++ nss_gre_redir_mark.o \ ++ nss_gre_redir_mark_log.o \ ++ nss_gre_redir_mark_stats.o ++endif ++ ++ifneq "$(NSS_DRV_GRE_TUNNEL_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_GRE_TUNNEL_ENABLE ++qca-nss-drv-objs += \ ++ nss_gre_tunnel.o \ ++ nss_gre_tunnel_log.o \ ++ nss_gre_tunnel_stats.o ++endif ++ ++ifneq "$(NSS_DRV_CAPWAP_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_CAPWAP_ENABLE ++qca-nss-drv-objs += \ ++ nss_capwap.o \ ++ nss_capwap_log.o \ ++ nss_capwap_stats.o ++endif ++ ++ifneq "$(NSS_DRV_MAPT_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_MAPT_ENABLE ++qca-nss-drv-objs += \ ++ nss_map_t.o \ ++ nss_map_t_log.o \ ++ nss_map_t_stats.o ++endif ++ ++ifneq "$(NSS_DRV_PPTP_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_PPTP_ENABLE ++qca-nss-drv-objs += \ ++ nss_pptp.o \ ++ nss_pptp_log.o \ ++ nss_pptp_stats.o ++endif ++ ++ifneq "$(NSS_DRV_SHAPER_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_SHAPER_ENABLE ++qca-nss-drv-objs += \ ++ nss_shaper.o ++endif ++ ++ifneq "$(NSS_DRV_SJACK_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_SJACK_ENABLE ++qca-nss-drv-objs += \ ++ nss_sjack.o \ ++ nss_sjack_log.o \ ++ nss_sjack_stats.o ++endif ++ ++ifneq "$(NSS_DRV_TUN6RD_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_TUN6RD_ENABLE ++qca-nss-drv-objs += \ ++ nss_tun6rd.o \ ++ nss_tun6rd_log.o ++endif ++ ++ifneq "$(NSS_DRV_TRUSTSEC_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_TRUSTSEC_ENABLE ++qca-nss-drv-objs += \ ++ nss_trustsec_tx.o \ ++ nss_trustsec_tx_log.o \ ++ nss_trustsec_tx_stats.o ++endif ++ ++ifneq "$(NSS_DRV_TUNIPIP6_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_TUNIPIP6_ENABLE ++qca-nss-drv-objs += \ ++ nss_tunipip6.o \ ++ nss_tunipip6_log.o ++endif ++ ++ifneq "$(NSS_DRV_QRFS_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_QRFS_ENABLE ++qca-nss-drv-objs += \ ++ nss_qrfs.o \ ++ nss_qrfs_log.o \ ++ nss_qrfs_stats.o ++endif ++ ++ifneq "$(NSS_DRV_RMNET_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_RMNET_ENABLE ++qca-nss-drv-objs += \ ++ nss_rmnet_rx.o \ ++ nss_rmnet_rx_stats.o ++endif ++ ++ifneq "$(NSS_DRV_PORTID_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_PORTID_ENABLE ++qca-nss-drv-objs += \ ++ nss_portid.o \ ++ nss_portid_log.o \ ++ nss_portid_stats.o ++endif ++ ++ifneq "$(NSS_DRV_IGS_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_IGS_ENABLE ++qca-nss-drv-objs += \ ++ nss_igs.o \ ++ nss_igs_stats.o ++endif ++ ++ifneq "$(NSS_DRV_OAM_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_OAM_ENABLE ++qca-nss-drv-objs += \ ++ nss_oam.o \ ++ nss_oam_log.o ++endif + +-ifeq ($(SoC),$(filter $(SoC),ipq806x ipq40xx)) ++ifneq "$(NSS_DRV_CLMAP_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_CLMAP_ENABLE ++qca-nss-drv-objs += \ ++ nss_clmap.o \ ++ nss_clmap_log.o \ ++ nss_clmap_stats.o ++endif ++ ++ ++ifeq ($(SoC),$(filter $(SoC),ipq806x)) + qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \ +- nss_hal/ipq806x/nss_hal_pvt.o \ +- nss_dtls.o \ +- nss_dtls_log.o \ +- nss_dtls_stats.o \ +- nss_crypto.o \ +- nss_crypto_log.o \ ++ nss_hal/ipq806x/nss_hal_pvt.o ++ ++ifneq "$(NSS_DRV_C2C_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_C2C_ENABLE ++qca-nss-drv-objs += \ ++ nss_c2c_tx.o \ ++ nss_c2c_tx_log.o \ ++ nss_c2c_tx_stats.o \ ++ nss_c2c_rx.o \ ++ nss_c2c_rx_stats.o ++endif ++ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_IPSEC_ENABLE ++qca-nss-drv-objs += \ + nss_ipsec_log.o \ + nss_ipsec.o ++endif ++ ++ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_CRYPTO_ENABLE ++qca-nss-drv-objs += \ ++ nss_crypto.o \ ++ nss_crypto_log.o ++endif ++ ++ifneq "$(NSS_DRV_DTLS_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_DTLS_ENABLE ++qca-nss-drv-objs += \ ++ nss_dtls.o \ ++ nss_dtls_log.o \ ++ nss_dtls_stats.o ++endif + ccflags-y += -I$(obj)/nss_hal/ipq806x -DNSS_HAL_IPQ806X_SUPPORT + endif + +-ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64)) +-qca-nss-drv-objs += nss_data_plane/nss_data_plane_edma.o \ +- nss_hal/ipq807x/nss_hal_pvt.o \ +- nss_dtls_cmn.o \ +- nss_dtls_cmn_log.o \ +- nss_crypto_cmn.o \ +- nss_crypto_cmn_log.o \ ++ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64 ipq807x ipq807x_64)) ++qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \ ++ nss_edma.o \ ++ nss_edma_stats.o \ ++ nss_ppe.o \ ++ nss_ppe_log.o \ ++ nss_ppe_stats.o \ ++ ++ccflags-y += -DNSS_DRV_PPE_ENABLE ++ccflags-y += -DNSS_DRV_EDMA_ENABLE ++ ++ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_IPSEC_ENABLE ++qca-nss-drv-objs += \ + nss_ipsec_cmn_log.o \ +- nss_ipsec_cmn.o \ +- nss_qvpn.o \ +- nss_qvpn_stats.o \ +- nss_qvpn_log.o ++ nss_ipsec_cmn.o ++endif ++ ++ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_CRYPTO_ENABLE ++ccflags-y += -DNSS_DRV_DMA_ENABLE ++ ++qca-nss-drv-objs += \ ++ nss_crypto_cmn.o \ ++ nss_crypto_cmn_log.o ++endif ++ ++ifneq "$(NSS_DRV_DTLS_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_DTLS_ENABLE ++qca-nss-drv-objs += \ ++ nss_dtls_cmn.o \ ++ nss_dtls_cmn_log.o ++endif ++ ++ifneq "$(NSS_DRV_QVPN_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_QVPN_ENABLE ++qca-nss-drv-objs += \ ++ nss_qvpn.o \ ++ nss_qvpn_log.o \ ++ nss_qvpn_stats.o ++endif ++endif ++ ++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 ++ifneq "$(NSS_DRV_C2C_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_C2C_ENABLE ++qca-nss-drv-objs += \ ++ nss_c2c_tx.o \ ++ nss_c2c_tx_log.o \ ++ nss_c2c_tx_stats.o \ ++ nss_c2c_rx.o \ ++ nss_c2c_rx_stats.o ++endif + ccflags-y += -I$(obj)/nss_hal/ipq807x -DNSS_HAL_IPQ807x_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT + endif + + ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64)) +-qca-nss-drv-objs += nss_data_plane/nss_data_plane_edma.o \ +- nss_hal/ipq60xx/nss_hal_pvt.o \ +- nss_dtls_cmn.o \ +- nss_dtls_cmn_log.o \ +- nss_crypto_cmn.o \ +- nss_crypto_cmn_log.o \ +- nss_ipsec_cmn_log.o \ +- nss_ipsec_cmn.o \ +- nss_qvpn.o \ +- nss_qvpn_stats.o \ +- nss_qvpn_log.o ++qca-nss-drv-objs += nss_hal/ipq60xx/nss_hal_pvt.o \ ++ nss_data_plane/hal/nss_ipq60xx.o + ccflags-y += -I$(obj)/nss_hal/ipq60xx -DNSS_HAL_IPQ60XX_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT + 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 += -Werror ++ccflags-y += -Wall -Werror ++ ++KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION))) + + ifneq ($(findstring 3.4, $(KERNELVERSION)),) + NSS_CCFLAGS = -DNSS_DT_SUPPORT=0 -DNSS_FW_DBG_SUPPORT=1 -DNSS_PM_SUPPORT=1 +@@ -196,14 +389,7 @@ NSS_CCFLAGS = -DNSS_DT_SUPPORT=1 -DNSS_F ccflags-y += -I$(obj) endif diff --git a/qca-nss-drv/patches/0003-qca-nss-qdisc-support.patch b/qca-nss-drv/patches/0003-qca-nss-qdisc-support.patch index 97ce0fe..ae6f494 100644 --- a/qca-nss-drv/patches/0003-qca-nss-qdisc-support.patch +++ b/qca-nss-drv/patches/0003-qca-nss-qdisc-support.patch @@ -1,6 +1,6 @@ --- a/nss_core.c +++ b/nss_core.c -@@ -1116,7 +1116,7 @@ static inline bool nss_core_handle_nr_fr +@@ -1042,7 +1042,7 @@ static inline bool nss_core_handle_nr_fr * ingress shaped flag set. */ if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { @@ -9,7 +9,7 @@ } #endif goto pull; -@@ -1156,7 +1156,7 @@ static inline bool nss_core_handle_nr_fr +@@ -1082,7 +1082,7 @@ static inline bool nss_core_handle_nr_fr * ingress shaped flag set. */ if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { @@ -18,7 +18,7 @@ } #endif -@@ -1271,7 +1271,7 @@ static inline bool nss_core_handle_linea +@@ -1194,7 +1194,7 @@ static inline bool nss_core_handle_linea * ingress shaped flag set. */ if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { @@ -27,7 +27,7 @@ } #endif -@@ -1329,7 +1329,7 @@ static inline bool nss_core_handle_linea +@@ -1252,7 +1252,7 @@ static inline bool nss_core_handle_linea * ingress shaped flag set. */ if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { diff --git a/qca-nss-drv/patches/0004-fix-ioremap-call.patch b/qca-nss-drv/patches/0004-fix-ioremap-call.patch index f530717..fdab24d 100644 --- a/qca-nss-drv/patches/0004-fix-ioremap-call.patch +++ b/qca-nss-drv/patches/0004-fix-ioremap-call.patch @@ -1,6 +1,6 @@ --- a/nss_meminfo.c +++ b/nss_meminfo.c -@@ -711,7 +711,7 @@ bool nss_meminfo_init(struct nss_ctx_ins +@@ -706,7 +706,7 @@ bool nss_meminfo_init(struct nss_ctx_ins /* * meminfo_start is the label where the start address of meminfo map is stored. */ @@ -22,7 +22,7 @@ goto out; --- a/nss_hal/ipq60xx/nss_hal_pvt.c +++ b/nss_hal/ipq60xx/nss_hal_pvt.c -@@ -207,13 +207,13 @@ static struct nss_platform_data *__nss_h +@@ -206,13 +206,13 @@ static struct nss_platform_data *__nss_h npd->nphys = res_nphys.start; npd->qgic_phys = res_qgic_phys.start; @@ -38,7 +38,7 @@ if (!npd->qgic_map) { nss_info_always("%p: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); goto out; -@@ -434,13 +434,13 @@ static int __nss_hal_common_reset(struct +@@ -433,13 +433,13 @@ static int __nss_hal_common_reset(struct of_node_put(cmn); @@ -76,7 +76,7 @@ return -EFAULT; --- a/nss_hal/ipq807x/nss_hal_pvt.c +++ b/nss_hal/ipq807x/nss_hal_pvt.c -@@ -234,7 +234,7 @@ static struct nss_platform_data *__nss_h +@@ -233,7 +233,7 @@ static struct nss_platform_data *__nss_h npd->vphys = res_vphys.start; npd->qgic_phys = res_qgic_phys.start; @@ -85,7 +85,7 @@ if (!npd->nmap) { nss_info_always("%p: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); goto out; -@@ -246,7 +246,7 @@ static struct nss_platform_data *__nss_h +@@ -245,7 +245,7 @@ static struct nss_platform_data *__nss_h goto out; } @@ -94,7 +94,7 @@ if (!npd->qgic_map) { nss_info_always("%p: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); goto out; -@@ -466,7 +466,7 @@ static int __nss_hal_common_reset(struct +@@ -465,7 +465,7 @@ static int __nss_hal_common_reset(struct } of_node_put(cmn); diff --git a/qca-nss-drv/patches/0004-qca-nss-igs-support.patch b/qca-nss-drv/patches/0004-qca-nss-igs-support.patch new file mode 100644 index 0000000..d426092 --- /dev/null +++ b/qca-nss-drv/patches/0004-qca-nss-igs-support.patch @@ -0,0 +1,153 @@ +--- a/nss_igs.c ++++ b/nss_igs.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -17,6 +17,14 @@ + #include "nss_tx_rx_common.h" + #include "nss_igs_stats.h" + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)) ++#ifdef CONFIG_NET_CLS_ACT ++#include ++#endif ++#endif ++ ++static struct module *nss_igs_module; ++ + /* + * nss_igs_verify_if_num() + * Verify interface number passed to us. +@@ -51,12 +59,12 @@ static void nss_igs_handler(struct nss_c + * Is this a valid request/response packet? + */ + if (ncm->type >= NSS_IGS_MSG_MAX) { +- nss_warning("%p: received invalid message %d for IGS interface", nss_ctx, ncm->type); ++ nss_warning("%px: received invalid message %d for IGS interface", nss_ctx, ncm->type); + return; + } + + if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_igs_msg)) { +- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); ++ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); + return; + } + +@@ -87,7 +95,7 @@ static void nss_igs_handler(struct nss_c + * call igs callback + */ + if (!cb) { +- nss_warning("%p: No callback for igs interface %d", ++ nss_warning("%px: No callback for igs interface %d", + nss_ctx, ncm->interface); + return; + } +@@ -152,3 +160,40 @@ struct nss_ctx_instance *nss_igs_get_con + return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.igs_handler_id]; + } + EXPORT_SYMBOL(nss_igs_get_context); ++ ++#ifdef CONFIG_NET_CLS_ACT ++/* ++ * nss_igs_module_save() ++ * Save the ingress shaping module reference. ++ */ ++void nss_igs_module_save(struct tc_action_ops *act, struct module *module) ++{ ++ nss_assert(act); ++ nss_assert(act->type == TCA_ACT_MIRRED_NSS); ++ ++ nss_igs_module = module; ++} ++EXPORT_SYMBOL(nss_igs_module_save); ++#endif ++ ++/* ++ * nss_igs_module_get() ++ * Get the ingress shaping module reference. ++ */ ++bool nss_igs_module_get() ++{ ++ nss_assert(nss_igs_module); ++ return try_module_get(nss_igs_module); ++} ++EXPORT_SYMBOL(nss_igs_module_get); ++ ++/* ++ * nss_igs_module_put() ++ * Release the ingress shaping module reference. ++ */ ++void nss_igs_module_put() ++{ ++ nss_assert(nss_igs_module); ++ module_put(nss_igs_module); ++} ++EXPORT_SYMBOL(nss_igs_module_put); +--- a/exports/nss_igs.h ++++ b/exports/nss_igs.h +@@ -22,8 +22,14 @@ + #ifndef _NSS_IGS_H_ + #define _NSS_IGS_H_ + ++#ifndef DOXYGEN_SHOULD_SKIP_THIS ++#ifdef CONFIG_NET_CLS_ACT ++#include ++#endif ++#endif ++ + /** +- * @addtogroup NSS ingress shaper subsystem ++ * @addtogroup nss_ingress_shaper_subsystem + * @{ + */ + +@@ -163,6 +169,44 @@ extern void nss_igs_unregister_if(uint32 + */ + extern bool nss_igs_verify_if_num(uint32_t if_num); + ++ ++#ifdef CONFIG_NET_CLS_ACT ++/* ++ * nss_igs_module_save() ++ * Save the ingress shaping module reference. ++ * ++ * @datatypes ++ * tc_action_ops \n ++ * module ++ * ++ * @param[in] act Operation structure for ingress shaping action. ++ * @param[in] module Module structure of ingress shaping module. ++ * ++ * @return ++ * None. ++ */ ++extern void nss_igs_module_save(struct tc_action_ops *act, struct module *module); ++#endif ++ ++/* ++ * nss_igs_module_get() ++ * Get the ingress shaping module reference. ++ * ++ * @return ++ * False if not able to take the ingress shaping module reference, otherwise true. ++ * ++ */ ++extern bool nss_igs_module_get(void); ++ ++/* ++ * nss_igs_module_put() ++ * Release the ingress shaping module reference. ++ * ++ * @return ++ * None. ++ */ ++extern void nss_igs_module_put(void); ++ + /** + * @} + */ diff --git a/qca-nss-drv/patches/0005-fix-NULL-pointer-exception.patch b/qca-nss-drv/patches/0005-fix-NULL-pointer-exception.patch index 3d8bba9..aed8d56 100644 --- a/qca-nss-drv/patches/0005-fix-NULL-pointer-exception.patch +++ b/qca-nss-drv/patches/0005-fix-NULL-pointer-exception.patch @@ -1,6 +1,6 @@ --- a/nss_core.c +++ b/nss_core.c -@@ -1599,7 +1599,7 @@ static int32_t nss_core_handle_cause_que +@@ -1522,7 +1522,7 @@ static int32_t nss_core_handle_cause_que * */ if (unlikely((buffer_type == N2H_BUFFER_CRYPTO_RESP))) { diff --git a/qca-nss-drv/patches/0007-Exported-set-nexthop-function.patch b/qca-nss-drv/patches/0007-Exported-set-nexthop-function.patch index 7c23a04..b473dc3 100644 --- a/qca-nss-drv/patches/0007-Exported-set-nexthop-function.patch +++ b/qca-nss-drv/patches/0007-Exported-set-nexthop-function.patch @@ -1,23 +1,40 @@ -From f8cf061454a3707c0c84d0fca685e84455f91362 Mon Sep 17 00:00:00 2001 -From: Suruchi Suman -Date: Tue, 3 Dec 2019 12:57:38 +0530 -Subject: [qca-nss-drv] Exported set nexhop function from drv. +commit f8cf061454a3707c0c84d0fca685e84455f91362 +Author: Suruchi Suman +Date: Tue Dec 3 12:57:38 2019 +0530 -Change-Id: I3df6658bef72fe574ac9acfb7aac61785769766f -Signed-off-by: Suruchi Suman ---- - nss_phys_if.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) + [qca-nss-drv] Exported set nexhop function from drv. + + Change-Id: I3df6658bef72fe574ac9acfb7aac61785769766f + Signed-off-by: Suruchi Suman ---- a/nss_core.c -+++ b/nss_core.c -@@ -52,7 +52,8 @@ - (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)))) || \ - (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \ - (((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \ --(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))))) -+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \ -+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)))))) - #error "Check skb recycle code in this file to match Linux version" - #endif +--- a/nss_phys_if.c ++++ b/nss_phys_if.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -583,6 +583,12 @@ nss_tx_status_t nss_phys_if_set_nexthop( + struct nss_phys_if_msg nim; + NSS_VERIFY_CTX_MAGIC(nss_ctx); ++ ++ if (nexthop >= NSS_MAX_NET_INTERFACES) { ++ nss_warning("%p: Invalid nexthop interface number: %d", nss_ctx, nexthop); ++ return NSS_TX_FAILURE_BAD_PARAM; ++ } ++ + nss_info("%p: Phys If nexthop will be set to %d, id:%d\n", nss_ctx, nexthop, if_num); + + nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_SET_NEXTHOP, +@@ -591,6 +597,7 @@ nss_tx_status_t nss_phys_if_set_nexthop( + + return nss_phys_if_msg_sync(nss_ctx, &nim); + } ++EXPORT_SYMBOL(nss_phys_if_set_nexthop); + + /* + * nss_get_state() diff --git a/qca-nss-drv/patches/0008-QSDK-11.2.patch b/qca-nss-drv/patches/0008-QSDK-11.2.patch deleted file mode 100644 index 56491ab..0000000 --- a/qca-nss-drv/patches/0008-QSDK-11.2.patch +++ /dev/null @@ -1,18619 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -26,6 +26,7 @@ qca-nss-drv-objs := \ - 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 \ -@@ -93,10 +94,9 @@ qca-nss-drv-objs := \ - nss_wifi_mac_db.o - - # Base NSS data plane/HAL support --qca-nss-drv-objs += nss_data_plane/nss_data_plane.o -+qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o - qca-nss-drv-objs += nss_hal/nss_hal.o - -- - ifneq "$(NSS_DRV_L2TP_ENABLE)" "n" - ccflags-y += -DNSS_DRV_L2TP_ENABLE - qca-nss-drv-objs += \ -@@ -317,7 +317,7 @@ ccflags-y += -I$(obj)/nss_hal/ipq806x -D - endif - - ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64 ipq807x ipq807x_64)) --qca-nss-drv-objs += nss_data_plane/nss_data_plane_edma.o -+qca-nss-drv-objs += nss_data_plane/nss_data_plane.o - - ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" - ccflags-y += -DNSS_DRV_IPSEC_ENABLE -@@ -328,9 +328,15 @@ endif - - ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n" - ccflags-y += -DNSS_DRV_CRYPTO_ENABLE -+ccflags-y += -DNSS_DRV_DMA_ENABLE -+ - qca-nss-drv-objs += \ - nss_crypto_cmn.o \ -- nss_crypto_cmn_log.o -+ nss_crypto_cmn_log.o \ -+ nss_dma.o \ -+ nss_dma_log.o \ -+ nss_dma_stats.o \ -+ nss_dma_strings.o - endif - - ifneq "$(NSS_DRV_DTLS_ENABLE)" "n" -@@ -356,18 +362,21 @@ endif - endif - - ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64)) --qca-nss-drv-objs += nss_hal/ipq807x/nss_hal_pvt.o -+qca-nss-drv-objs += nss_hal/ipq807x/nss_hal_pvt.o \ -+ nss_data_plane/hal/nss_ipq807x.o - ccflags-y += -I$(obj)/nss_hal/ipq807x -DNSS_HAL_IPQ807x_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT - endif - - ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64)) --qca-nss-drv-objs += nss_hal/ipq60xx/nss_hal_pvt.o -+qca-nss-drv-objs += nss_hal/ipq60xx/nss_hal_pvt.o \ -+ nss_data_plane/hal/nss_ipq60xx.o - ccflags-y += -I$(obj)/nss_hal/ipq60xx -DNSS_HAL_IPQ60XX_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT - endif - - ifeq ($(SoC),$(filter $(SoC),ipq50xx ipq50xx_64)) --qca-nss-drv-objs += nss_data_plane/nss_data_plane_edma.o \ -- nss_hal/ipq50xx/nss_hal_pvt.o -+qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \ -+ nss_hal/ipq50xx/nss_hal_pvt.o \ -+ nss_data_plane/hal/nss_ipq50xx.o - - ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" - ccflags-y += -DNSS_DRV_IPSEC_ENABLE -@@ -393,10 +402,12 @@ 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 += -Werror - -+KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION))) -+ - ifneq ($(findstring 3.4, $(KERNELVERSION)),) - NSS_CCFLAGS = -DNSS_DT_SUPPORT=0 -DNSS_FW_DBG_SUPPORT=1 -DNSS_PM_SUPPORT=1 - else ---- a/Makefile.fsm -+++ b/Makefile.fsm -@@ -36,6 +36,7 @@ qca-nss-drv-objs := \ - nss_gre_tunnel_log.o \ - nss_gre_tunnel_stats.o \ - nss_if.o \ -+ nss_if_log.o \ - nss_init.o \ - nss_ipsec.o \ - nss_ipsec_log.o \ -@@ -110,7 +111,7 @@ qca-nss-drv-objs := \ - - qca-nss-drv-objs += nss_hal/nss_hal.o - qca-nss-drv-objs += nss_hal/fsm9010/nss_hal_pvt.o --qca-nss-drv-objs += nss_data_plane/nss_data_plane.o -+qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o - qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o - - ccflags-y += -I$(obj)/nss_hal/include ---- a/exports/nss_api_if.h -+++ b/exports/nss_api_if.h -@@ -44,10 +44,12 @@ - #include "nss_ipv6.h" - #include "nss_shaper.h" - #include "nss_if.h" -+#include "nss_phy_if.h" - #include "nss_virt_if.h" - #include "nss_pppoe.h" - #include "nss_crypto.h" - #include "nss_crypto_cmn.h" -+#include "nss_dma.h" - - #include "nss_profiler.h" - #include "nss_dynamic_interface.h" -@@ -117,7 +119,7 @@ - #define NSS_MAX_PHYSICAL_INTERFACES 8 /**< Maximum number of physical interfaces. */ - #define NSS_MAX_VIRTUAL_INTERFACES 16 /**< Maximum number of virtual interfaces. */ - #define NSS_MAX_TUNNEL_INTERFACES 4 /**< Maximum number of tunnel interfaces. */ --#define NSS_MAX_SPECIAL_INTERFACES 66 /**< Maximum number of special interfaces. */ -+#define NSS_MAX_SPECIAL_INTERFACES 67 /**< Maximum number of special interfaces. */ - #define NSS_MAX_WIFI_RADIO_INTERFACES 3 /**< Maximum number of radio interfaces. */ - - /* -@@ -262,9 +264,12 @@ - #define NSS_TLS_INTERFACE (NSS_SPECIAL_IF_START + 61) - /**< Special interface number for TLS. */ - #define NSS_PPE_VP_INTERFACE (NSS_SPECIAL_IF_START + 62) -- /**< Special interface number for the virtual port interface. */ -+ /**< Special interface number for the virtual port (62, 63, 64) interface. */ - #define NSS_WIFI_MAC_DB_INTERFACE (NSS_SPECIAL_IF_START + 65) - /**< Special interface number for the Wi-Fi MAC database. */ -+#define NSS_DMA_INTERFACE (NSS_SPECIAL_IF_START + 66) -+ /**< Special interface number for the DMA interface. */ -+ - - #ifdef __KERNEL__ /* only kernel will use. */ - ---- a/exports/nss_bridge.h -+++ b/exports/nss_bridge.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2018,2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -338,8 +338,8 @@ nss_tx_status_t nss_bridge_tx_vsi_unassi - * @datatypes - * nss_bridge_fdb_learn_mode - * -- * @param[in] if_num Interface number of the bridge. -- * @param[in] fdb_learn FDB learning disable/enable. -+ * @param[in] bridge_if_num Interface number of the bridge. -+ * @param[in] fdb_learn FDB learning disable/enable. - * - * @return - * Status of the Tx operation. ---- a/exports/nss_clmap.h -+++ b/exports/nss_clmap.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -22,6 +22,11 @@ - #ifndef __NSS_CLMAP_H - #define __NSS_CLMAP_H - -+ /** -+ * @addtogroup nss_clmap_subsystem -+ * @{ -+ */ -+ - /** - * Maximum number of supported client map interface. - */ -@@ -87,7 +92,7 @@ struct nss_clmap_stats_msg { - - /** - * nss_clmap_mac_msg -- * CLient map MAC message structure. -+ * Client map MAC message structure. - */ - struct nss_clmap_mac_msg { - uint32_t vlan_id; /**< VLAN ID. */ -@@ -200,7 +205,7 @@ extern nss_tx_status_t nss_clmap_tx_msg_ - * sk_buff - * - * @param[in] nss_ctx Pointer to the NSS context. -- * @param[in] os_buf Pointer to the data buffer. -+ * @param[in] buf Pointer to the data buffer. - * @param[in] if_num NSS interface number. - * - * @return ---- /dev/null -+++ b/exports/nss_dma.h -@@ -0,0 +1,264 @@ -+/* -+ ************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for -+ * any purpose with or without fee is hereby granted, provided that the -+ * above copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ ************************************************************************** -+ */ -+/** -+ * @file nss_dma.h -+ * NSS DMA for linearization and split interface definitions. -+ */ -+ -+#ifndef __NSS_DMA_H -+#define __NSS_DMA_H -+ -+/** -+ * @addtogroup nss_dma_subsystem -+ * @{ -+ */ -+ -+/** -+ * nss_dma_msg_type -+ * Supported message types. -+ */ -+enum nss_dma_msg_type { -+ NSS_DMA_MSG_TYPE_NONE, /**< Invalid message type. */ -+ NSS_DMA_MSG_TYPE_CONFIGURE, /**< Configure DMA. */ -+ NSS_DMA_MSG_TYPE_SYNC_STATS, /**< Statistics synchronization. */ -+ NSS_DMA_MSG_TYPE_TEST_PERF, /**< Performance test. */ -+ NSS_DMA_MSG_TYPE_MAX /**< Maximum message type. */ -+}; -+ -+/** -+ * nss_dma_msg_error -+ * Message error types. -+ */ -+enum nss_dma_msg_error { -+ NSS_DMA_MSG_ERROR_NONE, /**< No error. */ -+ NSS_DMA_MSG_ERROR_HW_INIT, /**< Invalid operation. */ -+ NSS_DMA_MSG_ERROR_UNHANDLED, /**< Invalid test ID. */ -+ NSS_DMA_MSG_ERROR_TEST, /**< Performance test failed. */ -+ NSS_DMA_MSG_ERROR_MAX /**< Maximum error type. */ -+}; -+ -+/** -+ * nss_dma_test_type -+ * DMA Test types. -+ */ -+enum nss_dma_test_type { -+ NSS_DMA_TEST_TYPE_DEFAULT = 0, /**< Test default segment size. */ -+ NSS_DMA_TEST_TYPE_SWEEP, /**< Test sweep segment size. */ -+ NSS_DMA_TEST_TYPE_LARGE, /**< Test large segment size. */ -+ NSS_DMA_TEST_TYPE_VERIFY, /**< Verify contents at receive processing. */ -+ NSS_DMA_TEST_TYPE_MAX /**< Maximum test type. */ -+}; -+ -+#ifdef __KERNEL__ /* only kernel will use. */ -+/* -+ * Maximum number of HW specific statistics -+ */ -+#define NSS_DMA_HW_ERROR_MAX 16 -+ -+/* -+ * Test configuration flags -+ */ -+#define NSS_DMA_TEST_FLAGS_LINEARIZE 0x01 /**< Linearize test. */ -+#define NSS_DMA_TEST_FLAGS_SPLIT 0x02 /**< Split test. */ -+ -+/** -+ * nss_dma_test_cfg -+ * Test configuration. -+ */ -+struct nss_dma_test_cfg { -+ struct nss_cmn_node_stats node_stats; /**< Common node statistics for DMA interface. */ -+ uint32_t flags; /**< Test configuration flags. */ -+ uint32_t time_delta; /**< Difference between start and end. */ -+ uint16_t packet_count; /**< Number of packets to send. */ -+ uint16_t type; /**< Type of test to run. */ -+}; -+ -+/** -+ * nss_dma_stats -+ * DMA statistics. -+ */ -+struct nss_dma_stats { -+ struct nss_cmn_node_stats node_stats; /**< Common node statistics for DMA interface. */ -+ uint32_t no_req; /**< Request descriptor not available. */ -+ uint32_t no_desc; /**< DMA descriptors not available. */ -+ uint32_t fail_nexthop; /**< Failed to retrive next hop. */ -+ uint32_t fail_nexthop_queue; /**< Failed to queue next hop. */ -+ uint32_t fail_linear_sz; /**< Failed to get memory for linearization. */ -+ uint32_t fail_linear_alloc; /**< Failed to allocate buffer for linearization. */ -+ uint32_t fail_linear_no_sg; /**< Skip linearization due to non-SG packet. */ -+ uint32_t fail_split_sz; /**< Failed to spliting buffer into multiple buffers. */ -+ uint32_t fail_split_alloc; /**< Failed to allocate buffer for split. */ -+ uint32_t fail_sync_alloc; /**< Failed to allocate buffer for sending statistics. */ -+ uint32_t fail_ctx_active; /**< Failed to queue as the node is not active. */ -+ uint32_t fail_hw[NSS_DMA_HW_ERROR_MAX]; /**< Hardware failures. */ -+}; -+ -+/** -+ * nss_dma_msg -+ * Message structure for configuring the DMA interface. -+ */ -+struct nss_dma_msg { -+ struct nss_cmn_msg cm; /**< Common message header. */ -+ -+ /** -+ * Payload of a NSS core-to-core transmission rule or statistics message. -+ */ -+ union { -+ struct nss_dma_test_cfg test_cfg; -+ /**< DMA test configuration. */ -+ struct nss_dma_stats stats; /**< DMA interface statistics. */ -+ } msg; /**< Message payload. */ -+}; -+ -+/** -+ * nss_dma_register_handler -+ * Registers the DMA message handler. -+ * -+ * @datatypes -+ * nss_ctx_instance -+ * -+ * @param[in] nss_ctx Pointer to the NSS context. -+ * -+ * @return -+ * None. -+ */ -+void nss_dma_register_handler(void); -+ -+/** -+ * Callback function for receiving DMA messages. -+ * -+ * @datatypes -+ * nss_c2c_tx_msg -+ * -+ * @param[in] app_data Pointer to the application context of the message. -+ * @param[in] msg Pointer to the message data. -+ */ -+typedef void (*nss_dma_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); -+ -+/** -+ * nss_dma_tx_msg -+ * Transmits a DMA message to the NSS. -+ * -+ * @datatypes -+ * nss_ctx_instance \n -+ * nss_dma_msg -+ * -+ * @param[in] nss_ctx Pointer to the NSS context. -+ * @param[in] ndm Pointer to the message data. -+ * -+ * @return -+ * Status of the transmit operation. -+ */ -+extern nss_tx_status_t nss_dma_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_dma_msg *ndm); -+ -+/** -+ * nss_dma_msg_init -+ * Initializes DMA messages. -+ * -+ * @datatypes -+ * nss_dma_msg \n -+ * nss_dma_msg_callback_t -+ * -+ * @param[in] ndm Pointer to the NSS interface message. -+ * @param[in] if_num NSS interface number. -+ * @param[in] type Type of message. -+ * @param[in] len Size of the payload. -+ * @param[in] cb Callback function for the message. -+ * @param[in] app_data Pointer to the application context of the message. -+ * -+ * @return -+ * None. -+ */ -+extern void nss_dma_msg_init(struct nss_dma_msg *ndm, uint16_t if_num, uint32_t type, uint32_t len, -+ nss_dma_msg_callback_t cb, void *app_data); -+ -+/** -+ * nss_dma_notify_register -+ * Registers a notifier callback for DMA messages with the NSS. -+ * -+ * @datatypes -+ * nss_dma_msg_callback_t -+ * -+ * @param[in] core NSS core number index to the notifier callback table. -+ * @param[in] cb Callback function for the message. -+ * @param[in] app_data Pointer to the application context of the message. -+ * -+ * @return -+ * Pointer to the NSS core context. -+ */ -+struct nss_ctx_instance *nss_dma_notify_register(int core, nss_dma_msg_callback_t cb, void *app_data); -+ -+/** -+ * nss_dma_notify_unregister -+ * Deregisters a DMA message notifier callback from the NSS. -+ * -+ * @param[in] core NSS core number index to the notifier callback table. -+ * -+ * @return -+ * None. -+ * -+ * @dependencies -+ * The notifier callback must have been previously registered. -+ */ -+void nss_dma_notify_unregister(int core); -+ -+/** -+ * nss_dma_register_sysctl -+ * Registers the DMA interface to Linux system control tree. -+ * -+ * @return -+ * None. -+ */ -+extern void nss_dma_register_sysctl(void); -+ -+/** -+ * nss_dma_unregister_sysctl -+ * Deregisters the DMA interface from Linux system control tree. -+ * -+ * @return -+ * None. -+ * -+ * @dependencies -+ * The system control must have been previously registered. -+ */ -+extern void nss_dma_unregister_sysctl(void); -+ -+/** -+ * nss_dma_init -+ * Initializes the DMA interface. -+ * -+ * @return -+ * None. -+ */ -+void nss_dma_init(void); -+ -+/** -+ * nss_dma_get_context -+ * Get the per NSS core context enabled for DMA. -+ * -+ * @return -+ * Pointer to the NSS core context. -+ */ -+extern struct nss_ctx_instance *nss_dma_get_context(void); -+#endif /*__KERNEL__ */ -+ -+/** -+ * @} -+ */ -+ -+#endif /* __NSS_C2C_TX_H */ ---- a/exports/nss_dtls_cmn.h -+++ b/exports/nss_dtls_cmn.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -31,8 +31,10 @@ - #define NSS_DTLS_CMN_CTX_HDR_UDPLITE 0x0002 /**< DTLS with UDPLite. */ - #define NSS_DTLS_CMN_CTX_HDR_CAPWAP 0x0004 /**< DTLS with CAPWAP. */ - #define NSS_DTLS_CMN_CTX_CIPHER_MODE_GCM 0x0008 /**< DTLS with GCM cipher mode. */ --#define NSS_DTLS_CMN_CTX_OUTER_UDPLITE_CSUM 0x10000 /**< Checksum only UDPLite header. */ --#define NSS_DTLS_CMN_CTX_INNER_ACCEPT_ALL 0x20000 -+#define NSS_DTLS_CMN_CTX_ENCAP_UDPLITE_CSUM 0x10000 /**< Checksum only UDPLite header. */ -+#define NSS_DTLS_CMN_CTX_ENCAP_METADATA 0x20000 /**< Valid metadata in encapsulation direction. */ -+#define NSS_DTLS_CMN_CTX_DECAP_ACCEPT_ALL 0x40000 /**< Exception all error packets to host. */ -+ - #define NSS_DTLS_CMN_CLE_MAX 32 /**< Max classification error. */ - - /** ---- a/exports/nss_gre_tunnel.h -+++ b/exports/nss_gre_tunnel.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2018,2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -104,7 +104,7 @@ enum nss_gre_tunnel_error_types { - struct nss_gre_tunnel_di_to_wlan_id { - uint32_t dynamic_interface_num; /**< Dynamic interface number. */ - uint16_t wlan_id; /**< WLAN ID number. */ -- uint16_t reserved0; /**< Reserved padding. */ -+ uint16_t fwd_policy; /**< Forward policy bits. */ - }; - - /** ---- a/exports/nss_if.h -+++ b/exports/nss_if.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -22,6 +22,8 @@ - #ifndef __NSS_IF_H - #define __NSS_IF_H - -+#define NSS_IF_TX_TIMEOUT 3000 /* 3 Seconds */ -+ - /** - * @addtogroup nss_driver_subsystem - * @{ -@@ -323,20 +325,51 @@ extern nss_tx_status_t nss_if_tx_buf(str - nss_tx_status_t nss_if_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim); - - /** -- * nss_phys_if_set_nexthop -- * Configure nexthop for an interface. -+ * nss_if_msg_sync -+ * Sends a message to the NSS interface and wait for the response. -+ * -+ * @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. -+ * -+ * @return -+ * Status of the Tx operation. -+ */ -+nss_tx_status_t nss_if_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim); -+ -+/** -+ * nss_if_set_nexthop -+ * Configure the next hop for an interface. - * - * @datatypes - * nss_ctx_instance - * - * @param[in] nss_ctx Pointer to the NSS context. -- * @param[in] if_num Network physical or virtual interface number. -- * @param[in] nexthop Network physical or virtual interface number. -+ * @param[in] if_num NSS interface number. -+ * @param[in] nexthop NSS interface number for next hop node. -+ * -+ * @return -+ * Status of the Tx operation. -+ */ -+nss_tx_status_t nss_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num, uint32_t nexthop); -+ -+/** -+ * nss_if_reset_nexthop -+ * De-configure the next hop for an interface. -+ * -+ * @datatypes -+ * nss_ctx_instance -+ * -+ * @param[in] nss_ctx Pointer to the NSS context. -+ * @param[in] if_num NSS interface number. - * - * @return - * Status of the Tx operation. - */ --nss_tx_status_t nss_phys_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num, uint32_t nexthop); -+nss_tx_status_t nss_if_reset_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num); - - /** - * @} ---- a/exports/nss_ipsec_cmn.h -+++ b/exports/nss_ipsec_cmn.h -@@ -23,7 +23,7 @@ - #define __NSS_IPSEC_CMN_H_ - - /** -- * @addtogroup nss_nss_ipsec_subsystem -+ * @addtogroup nss_ipsec_subsystem - * @{ - */ - ---- a/exports/nss_l2tpv2.h -+++ b/exports/nss_l2tpv2.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2015,2017-2020, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2015, 2017-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -103,7 +103,7 @@ struct nss_l2tpv2_session_destroy_msg { - - /** - * nss_l2tpv2_bind_ipsec_if_msg -- * Message for binding IPsec interface with L2TP. -+ * Message for binding the IPsec interface with L2TP. - * - * Message for configuring the L2TP session with an - * IPsec inner interface number. This is used when -@@ -139,7 +139,7 @@ struct nss_l2tpv2_sync_session_stats_msg - uint32_t decap_pbuf_alloc_fail; - /**< Buffer allocation failure during decapsulation. */ - uint32_t decap_l2tpoipsec_src_error; -- /**< Packets dropped due to wrong source for L2TPoIPsec flow. */ -+ /**< Packets dropped due to the wrong source for the L2TPoIPsec flow. */ - } debug_stats; /**< Debug statistics object for l2tp v2. */ - }; - ---- /dev/null -+++ b/exports/nss_phy_if.h -@@ -0,0 +1,67 @@ -+/* -+ ************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for -+ * any purpose with or without fee is hereby granted, provided that the -+ * above copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ ************************************************************************** -+ */ -+ -+/** -+ * @file nss_phy_if.h.h -+ * NSS physical interface definitions. -+ */ -+ -+#ifndef __NSS_PHY_IF_H -+#define __NSS_PHY_IF_H -+ -+/** -+ * @addtogroup nss_driver_subsystem -+ * @{ -+ */ -+ -+/** -+ * nss_phys_if_reset_nexthop -+ * De-configure nexthop for an interface. -+ * -+ * @datatypes -+ * nss_ctx_instance -+ * -+ * @param[in] nss_ctx Pointer to the NSS context. -+ * @param[in] if_num Network physical interface number. -+ * -+ * @return -+ * Status of the Tx operation. -+ */ -+nss_tx_status_t nss_phys_if_reset_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num); -+ -+/** -+ * nss_phys_if_set_nexthop -+ * Configure nexthop for an interface. -+ * -+ * @datatypes -+ * nss_ctx_instance -+ * -+ * @param[in] nss_ctx Pointer to the NSS context. -+ * @param[in] if_num Network physical interface number. -+ * @param[in] nexthop Network physical or virtual interface number. -+ * -+ * @return -+ * Status of the Tx operation. -+ */ -+nss_tx_status_t nss_phys_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num, uint32_t nexthop); -+ -+/** -+ * @} -+ */ -+ -+#endif /* __NSS_PHY_IF_H */ ---- a/exports/nss_pvxlan.h -+++ b/exports/nss_pvxlan.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -270,7 +270,7 @@ extern nss_tx_status_t nss_pvxlan_tx_msg - * sk_buff - * - * @param[in] nss_ctx Pointer to the NSS context. -- * @param[in] os_buf Pointer to the data buffer. -+ * @param[in] buf Pointer to the data buffer. - * @param[in] if_num NSS interface number. - * - * @return ---- a/exports/nss_rmnet_rx.h -+++ b/exports/nss_rmnet_rx.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above -@@ -27,7 +27,7 @@ - #include "nss_if.h" - - /** -- * @addtogroup nss_virtual_if_subsystem -+ * @addtogroup nss_rmnet_subsystem - * @{ - */ - ---- a/exports/nss_trustsec_tx.h -+++ b/exports/nss_trustsec_tx.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2017, 2020 The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -32,10 +32,11 @@ - * Message types for TrustSec Tx requests and responses. - */ - enum nss_trustsec_tx_msg_types { -- NSS_TRUSTSEC_TX_CONFIGURE_MSG, -- NSS_TRUSTSEC_TX_UNCONFIGURE_MSG, -- NSS_TRUSTSEC_TX_STATS_SYNC_MSG, -- NSS_TRUSTSEC_TX_MAX_MSG_TYPE -+ NSS_TRUSTSEC_TX_MSG_CONFIGURE, /** Configure the TrustSec node. */ -+ NSS_TRUSTSEC_TX_MSG_UNCONFIGURE, /** Unconfigure the TrustSec node. */ -+ NSS_TRUSTSEC_TX_MSG_STATS_SYNC, /** Statistics sychronization. */ -+ NSS_TRUSTSEC_TX_MSG_UPDATE_NEXTHOP, /** Update next hop. */ -+ NSS_TRUSTSEC_TX_MSG_MAX /** Maximum message type. */ - }; - - /** -@@ -43,11 +44,14 @@ enum nss_trustsec_tx_msg_types { - * Error types for the TrustSec Tx interface. - */ - enum nss_trustsec_tx_error_types { -- NSS_TRUSTSEC_TX_ERR_INVAL_SRC_IF, -- NSS_TRUSTSEC_TX_ERR_RECONFIGURE_SRC_IF, -- NSS_TRUSTSEC_TX_ERR_DEST_IF_NOT_FOUND, -- NSS_TRUSTSEC_TX_ERR_NOT_CONFIGURED, -- NSS_TRUSTSEC_TX_ERR_UNKNOWN, -+ NSS_TRUSTSEC_TX_ERR_NONE, /** No error */ -+ NSS_TRUSTSEC_TX_ERR_INVAL_SRC_IF, /** Source interface is invalid. */ -+ NSS_TRUSTSEC_TX_ERR_RECONFIGURE_SRC_IF, /** Source interface is already configured. */ -+ NSS_TRUSTSEC_TX_ERR_DEST_IF_NOT_FOUND, /** Destination interface is not found. */ -+ NSS_TRUSTSEC_TX_ERR_NOT_CONFIGURED, /** Source interface is not configured. */ -+ NSS_TRUSTSEC_TX_ERR_SGT_MISMATCH, /** SGT mismatches. */ -+ NSS_TRUSTSEC_TX_ERR_UNKNOWN, /** Error is unknown. */ -+ NSS_TRUSTSEC_TX_ERR_MAX, /** Maximum error message. */ - }; - - /** -@@ -83,6 +87,17 @@ struct nss_trustsec_tx_stats_sync_msg { - }; - - /** -+ * nss_trustsec_tx_update_nexthop_msg -+ * Message information for updating the next hop for a TrustSec Tx interface. -+ */ -+struct nss_trustsec_tx_update_nexthop_msg { -+ uint32_t src; /**< Interface number of the source tunnel. */ -+ uint32_t dest; /**< Outgoing interface number. */ -+ uint16_t sgt; /**< Security Group Tag value to embed in the TrustSec header. */ -+ uint8_t reserved[2]; /**< Reserved for word alignment. */ -+}; -+ -+/** - * nss_trustsec_tx_msg - * Data for sending and receiving TrustSec Tx messages. - */ -@@ -99,6 +114,8 @@ struct nss_trustsec_tx_msg { - /**< De-configure TrustSec Tx. */ - struct nss_trustsec_tx_stats_sync_msg stats_sync; - /**< Synchronize TrustSec Tx statistics. */ -+ struct nss_trustsec_tx_update_nexthop_msg upd_nexthop; -+ /**< Update next hop of TrustSec Tx. */ - } msg; /**< Message payload. */ - }; - -@@ -166,6 +183,19 @@ extern nss_tx_status_t nss_trustsec_tx_m - extern nss_tx_status_t nss_trustsec_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_trustsec_tx_msg *msg); - - /** -+ * nss_trustsec_tx_update_nexthop -+ * Updates the next hop of the TrustSec. -+ * -+ * @param[in] src Source interface number. -+ * @param[in] dest Destination interface number. -+ * @param[in] sgt Security Group Tag value. -+ * -+ * @return -+ * Pointer to the NSS core context. -+ */ -+extern nss_tx_status_t nss_trustsec_tx_update_nexthop(uint32_t src, uint32_t dest, uint16_t sgt); -+ -+/** - * nss_trustsec_tx_get_ctx - * Gets the NSS context. - * -@@ -180,7 +210,7 @@ extern struct nss_ctx_instance *nss_trus - * - * @param[in] src Source interface number. - * @param[in] dest Destination interface number. -- * @param[in] sgt Security Group Tag value -+ * @param[in] sgt Security Group Tag value. - * - * @return - * Pointer to the NSS core context. ---- a/exports/nss_tunipip6.h -+++ b/exports/nss_tunipip6.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014, 2017-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014, 2017-2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -30,16 +30,18 @@ - #define NSS_TUNIPIP6_MAX_FMR_NUMBER 4 /**< Maximum number of forward mapping rule (FMR). */ - - /** -- * nss_tunipip6_fmr -- * Forward mapping rule (FMR) for direct forwarding traffic to the node in the same domain. -+ * nss_tunipip6_map_rule -+ * Mapping rule (FMR/BMR) for forwarding traffic to the node in the same domain. - */ --struct nss_tunipip6_fmr { -+struct nss_tunipip6_map_rule { - uint32_t ip6_prefix[4]; /**< An IPv6 prefix assigned by a mapping rule. */ - uint32_t ip4_prefix; /**< An IPv4 prefix assigned by a mapping rule. */ - uint32_t ip6_prefix_len; /**< IPv6 prefix length. */ - uint32_t ip4_prefix_len; /**< IPv4 prefix length. */ -+ uint32_t ip6_suffix[4]; /**< IPv6 suffix. */ -+ uint32_t ip6_suffix_len; /**< IPv6 suffix length. */ - uint32_t ea_len; /**< Embedded Address (EA) bits. */ -- uint32_t offset; /**< PSID offset default 6. */ -+ uint32_t psid_offset; /**< PSID offset default 6. */ - }; - - /** -@@ -50,6 +52,11 @@ enum nss_tunipip6_metadata_types { - NSS_TUNIPIP6_TX_ENCAP_IF_CREATE, - NSS_TUNIPIP6_TX_DECAP_IF_CREATE, - NSS_TUNIPIP6_RX_STATS_SYNC, -+ NSS_TUNIPIP6_FMR_RULE_ADD, -+ NSS_TUNIPIP6_FMR_RULE_DEL, -+ NSS_TUNIPIP6_FMR_RULE_FLUSH, -+ NSS_TUNIPIP6_BMR_RULE_ADD, -+ NSS_TUNIPIP6_BMR_RULE_DEL, - NSS_TUNIPIP6_MAX, - }; - -@@ -58,16 +65,16 @@ enum nss_tunipip6_metadata_types { - * Payload for configuring the DS-Lite interface. - */ - struct nss_tunipip6_create_msg { -- struct nss_tunipip6_fmr fmr[NSS_TUNIPIP6_MAX_FMR_NUMBER]; /**< Tunnel FMR array. */ - uint32_t saddr[4]; /**< Tunnel source address. */ - uint32_t daddr[4]; /**< Tunnel destination address. */ - uint32_t flowlabel; /**< Tunnel IPv6 flow label. */ - uint32_t flags; /**< Tunnel additional flags. */ -- uint32_t fmr_number; /**< Tunnel FMR number. */ - uint32_t sibling_if_num; /**< Sibling interface number. */ -- uint16_t reserved1; /**< Reserved for alignment. */ - uint8_t hop_limit; /**< Tunnel IPv6 hop limit. */ - uint8_t draft03; /**< Use MAP-E draft03 specification. */ -+ bool ttl_inherit; /**< Inherit IPv4 TTL to hoplimit. */ -+ bool tos_inherit; /**< Inherit IPv4 ToS. */ -+ bool frag_id_update; /**< Enable update of fragment identifier of IPv4. */ - }; - - /** -@@ -90,10 +97,12 @@ struct nss_tunipip6_msg { - */ - union { - struct nss_tunipip6_create_msg tunipip6_create; -- /**< Create a DS-Lite tunnel. */ -+ /**< Create a DS-Lite/IPIP6 tunnel. */ - struct nss_tunipip6_stats_sync_msg stats_sync; - /**< Synchronized statistics for the DS-Lite interface. */ -- } msg; /**< Message payload for IPIP6 Tunnel messages exchanged with NSS core. */ -+ struct nss_tunipip6_map_rule map_rule; -+ /**< BMR/FMR rule to add/delete, new or existing rules. */ -+ } msg; /**< Message payload for IPIP6 tunnel messages exchanged with NSS core. */ - }; - - /** -@@ -124,6 +133,22 @@ typedef void (*nss_tunipip6_msg_callback - extern nss_tx_status_t nss_tunipip6_tx(struct nss_ctx_instance *nss_ctx, struct nss_tunipip6_msg *msg); - - /** -+ * nss_tunipip6_tx_sync -+ * Sends a DS-Lite message to NSS core synchronously. -+ * -+ * @datatypes -+ * nss_ctx_instance \n -+ * nss_tunipip6_msg -+ * -+ * @param[in] nss_ctx Pointer to the NSS context. -+ * @param[in] msg Pointer to the message data. -+ * -+ * @return -+ * Status of the Tx operation. -+ */ -+extern nss_tx_status_t nss_tunipip6_tx_sync(struct nss_ctx_instance *nss_ctx, struct nss_tunipip6_msg *msg); -+ -+/** - * Callback function for receiving DS-Lite data. - * - * @datatypes ---- a/exports/nss_wifi.h -+++ b/exports/nss_wifi.h -@@ -90,6 +90,8 @@ enum nss_wifi_metadata_types { - NSS_WIFI_CMD_MSG, - NSS_WIFI_ENABLE_OL_STATSV2_MSG, - NSS_WIFI_OL_PEER_TIME_MSG, -+ NSS_WIFI_PEER_SET_VLAN_ID_MSG, -+ NSS_WIFI_PEER_ISOLATION_MSG, - NSS_WIFI_MAX_MSG - }; - -@@ -739,7 +741,16 @@ struct nss_wifi_ol_stats_msg { - * Station kickout message from NSS Firmware - */ - struct nss_wifi_sta_kickout_msg { -- uint32_t peer_id; /**< ID of the peer. */ -+ uint32_t peer_id; /**< Peer ID. */ -+}; -+ -+/** -+ * nss_wifi_peer_isolation_msg -+ * Peer isolation message -+ */ -+struct nss_wifi_peer_isolation_msg { -+ uint16_t peer_id; /**< Peer ID. */ -+ uint16_t isolation; /**< Isolation enabled/disabled. */ - }; - - /** -@@ -905,6 +916,8 @@ struct nss_wifi_msg { - /**< Enable version 2 tx/rx stats. */ - struct nss_wifi_ol_peer_time_msg wopt_msg; - /**< Send per peer/TID timestamp statistics to host. */ -+ struct nss_wifi_peer_isolation_msg isolation_msg; -+ /**< Enable or disable peer isolation. */ - } msg; /**< Message Payload. */ - }; - ---- a/exports/nss_wifi_vdev.h -+++ b/exports/nss_wifi_vdev.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -762,6 +762,9 @@ struct nss_wifi_vdev_per_packet_metadata - */ - struct nss_wifi_vdev_meshmode_rx_metadata { - uint16_t rs_ratephy; /**< PHY rate. */ -+ uint16_t rs_ratephy_lo; /**< PHY rate lower bytes. */ -+ uint16_t rs_ratephy_hi; /**< PHY rate higher bytes. */ -+ uint16_t cntr_chan_freq; /** Center channel frequency. */ - uint16_t vdev_id; /**< Virtual device ID. */ - uint16_t peer_id; /**< Peer ID. */ - uint16_t rs_rssi; /**< Received signal strength indication (noise floor adjusted). */ ---- a/exports/nss_wifili_if.h -+++ b/exports/nss_wifili_if.h -@@ -92,6 +92,8 @@ - /**< Maximum number of physical devices on the external SoC. */ - #define NSS_WIFILI_PEER_AST_FLOWQ_MAX 4 - /**< Maximum number of flow queues. */ -+#define NSS_WIFILI_WBM_INTERNAL_ERR_MAX 5 -+ /**< WBM internal maximum errors. */ - - /* - * Radio specific flags -@@ -179,6 +181,9 @@ enum nss_wifili_msg_types { - NSS_WIFILI_PEER_AST_FLOWID_MAP_MSG, - NSS_WIFILI_PEER_MEC_AGEOUT_MSG, - NSS_WIFILI_JITTER_STATS_MSG, -+ NSS_WIFILI_ISOLATION_MSG, -+ NSS_WIFILI_PEER_EXT_STATS_MSG, -+ NSS_WIFILI_CLR_STATS, - NSS_WIFILI_MAX_MSG - }; - -@@ -558,6 +563,7 @@ enum nss_wifili_stats_rxdma_ring { - * Wifili WBM(Wireless Buffer Manager) ring statistics. - */ - enum nss_wifili_stats_wbm { -+ NSS_WIFILI_STATS_WBM_IE_LOCAL_ALLOC_FAIL, /**< Number of Wireless Buffer Manger internal local allocation failures. */ - NSS_WIFILI_STATS_WBM_SRC_DMA, /**< Number of Rx invalid source DMA. */ - NSS_WIFILI_STATS_WBM_SRC_DMA_CODE_INV, /**< Number of Rx invalid source DMA. */ - NSS_WIFILI_STATS_WBM_SRC_REO, /**< Number of Rx invalid source reorder. */ -@@ -762,7 +768,7 @@ struct nss_wifili_pdev_init_msg { - uint32_t hwmode; - /**< MAC hardware mode. */ - uint32_t lmac_id; -- /**< lower MAC ID. */ -+ /**< Lower MAC ID. */ - uint32_t num_rx_swdesc; - /**< Number of descriptors per Rx pool. */ - uint32_t target_pdev_id; -@@ -807,14 +813,16 @@ struct nss_wifili_peer_msg { - /**< Hardware address search table index. */ - uint8_t is_nawds; - /**< NAWDS enabled for peer. */ -- uint8_t reserved; -- /**< Padding for alignment. */ -+ uint8_t pext_stats_valid; -+ /**< Peer extended statistics valid. */ - uint16_t psta_vdev_id; - /**< Proxy station VAP ID. */ - uint32_t nss_peer_mem; - /**< Holds peer memory adderss for NSS. */ - uint32_t tx_ast_hash; - /**< AST hash to be used during packet transmission. */ -+ uint32_t pext_stats_mem; -+ /**< Peer extended statistics memory. */ - }; - - /** -@@ -980,6 +988,8 @@ struct nss_wifili_rx_wbm_ring_stats { - /**< Rx reoder error codes. */ - uint32_t err_dma_codes[NSS_WIFILI_DMA_CODE_MAX]; - /**< DMA error codes. */ -+ uint32_t err_internal_codes[NSS_WIFILI_WBM_INTERNAL_ERR_MAX]; -+ /**< Wireless Buffer Manger error codes. */ - }; - - /** -@@ -1119,9 +1129,9 @@ struct nss_wifili_v3_tx_rx_per_ac_stats - */ - struct nss_wifili_radio_tx_rx_stats_v3 { - struct nss_wifili_v3_tx_rx_per_tid_stats tid_stats[NSS_WIFILI_MAX_TID]; -- /**< Per TID Tx and Rx statistics. */ -+ /**< Per-TID Tx and Rx statistics. */ - struct nss_wifili_v3_tx_rx_per_ac_stats ac_stats[NSS_WIFILI_WME_AC_MAX]; -- /**< Per Access Category Tx and Rx statistics. */ -+ /**< Per-Access Category Tx and Rx statistics. */ - }; - - /** -@@ -1130,7 +1140,7 @@ struct nss_wifili_radio_tx_rx_stats_v3 { - */ - struct nss_wifili_radio_delay_stats_v3 { - struct nss_wifili_v3_delay_per_tid_stats v3_delay_stats[NSS_WIFILI_MAX_TID]; -- /**< Per TID delay statistics. */ -+ /**< Per-TID delay statistics. */ - }; - - /** -@@ -1320,8 +1330,8 @@ struct nss_wifili_peer_stats_msg { - * Wifili sojourn per TID statistics. - */ - struct nss_wifili_sojourn_per_tid_stats { -- uint32_t avg_sojourn_msdu; /**< Average per TID of all time difference. */ -- uint32_t sum_sojourn_msdu; /**< Sum per TID of all time difference. */ -+ uint32_t avg_sojourn_msdu; /**< Average per-TID of all time difference. */ -+ uint32_t sum_sojourn_msdu; /**< Sum per-TID of all time difference. */ - uint32_t num_msdus; /**< MSDUs per TID. */ - }; - -@@ -1373,7 +1383,6 @@ struct nss_wifili_jitter_stats_msg { - struct nss_wifili_jitter_stats jitter_stats[1]; /**< Jitter statistics. */ - }; - -- - /** - * nss_wifili_wds_peer_msg - * Wi-Fi Wireless distribution system (WDS) peer-specific message. -@@ -1387,6 +1396,34 @@ struct nss_wifili_wds_peer_msg { - }; - - /** -+ * nss_wifili_peer_delay_stats -+ * Per-peer delay statistics. -+ */ -+struct nss_wifili_peer_delay_stats { -+ struct nss_wifili_delay_stats swq_delay; /**< Software enqueue delay. */ -+ struct nss_wifili_delay_stats hwtx_delay; /**< Hardware transmit delay. */ -+}; -+ -+/** -+ * nss_wifili_peer_ext_stats -+ * Peer extended statistics. -+ */ -+struct nss_wifili_peer_ext_stats { -+ uint32_t peer_id; /**< Peer ID. */ -+ struct nss_wifili_peer_delay_stats delay_stats[NSS_WIFILI_MAX_TID]; -+ /**< Delay statistics. */ -+}; -+ -+/** -+ * nss_wifili_peer_ext_stats_msg -+ * Peer extended statistics message. -+ */ -+struct nss_wifili_peer_ext_stats_msg { -+ uint32_t npeers; /**< Number of peers. */ -+ struct nss_wifili_peer_ext_stats ext_stats[1]; /**< Extended statistics. */ -+}; -+ -+/** - * nss_wifili_stats_cfg_msg - * Wifili stats enable/disable configuration message. - */ -@@ -1484,6 +1521,15 @@ struct nss_wifili_peer_vlan_id_msg { - }; - - /** -+ * nss_wifili_peer_isolation_msg -+ * Wifili peer isolation message. -+ */ -+struct nss_wifili_peer_isolation_msg { -+ uint16_t peer_id; /**< Peer ID. */ -+ uint16_t isolation; /**< Isolation enabled/disabled. */ -+}; -+ -+/** - * nss_wifili_dbdc_repeater_set_msg - * Wifili DBDC repeater set message. - */ -@@ -1528,6 +1574,14 @@ struct nss_wifili_enable_v3_stats_msg { - }; - - /** -+ * nss_wifili_clr_stats_msg -+ * NSS firmware statistics clear message. -+ */ -+struct nss_wifili_clr_stats_msg { -+ uint8_t vdev_id;; /**< VAP ID. */ -+}; -+ -+/** - * nss_wifili_update_pdev_lmac_id_msg - * Physical device ID and lower MAC ID update message. - */ -@@ -1652,6 +1706,13 @@ struct nss_wifili_msg { - /**< Multicast echo check active information specific message. */ - struct nss_wifili_jitter_stats_msg jt_stats_msg; - /**type >= NSS_BRIDGE_MSG_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for bridge interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for bridge interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_bridge_msg)) { -- nss_warning("%p: length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -150,12 +150,12 @@ nss_tx_status_t nss_bridge_tx_msg(struct - * Sanity check the message - */ - if (!nss_is_dynamic_interface(ncm->interface)) { -- nss_warning("%p: tx request for interface that is not a bridge: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for interface that is not a bridge: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_BRIDGE_MSG_TYPE_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -186,7 +186,7 @@ nss_tx_status_t nss_bridge_tx_msg_sync(s - - status = nss_bridge_tx_msg(nss_ctx, nbm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: bridge_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: bridge_tx_msg failed\n", nss_ctx); - up(&bridge_pvt.sem); - return status; - } -@@ -194,7 +194,7 @@ nss_tx_status_t nss_bridge_tx_msg_sync(s - ret = wait_for_completion_timeout(&bridge_pvt.complete, msecs_to_jiffies(NSS_BRIDGE_TX_TIMEOUT)); - - if (!ret) { -- nss_warning("%p: bridge msg tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: bridge msg tx failed due to timeout\n", nss_ctx); - bridge_pvt.response = NSS_TX_FAILURE; - } - -@@ -229,7 +229,7 @@ nss_tx_status_t nss_bridge_tx_vsi_assign - } - - if (nss_bridge_verify_if_num(if_num) == false) { -- nss_warning("%p: invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: invalid interface %d", nss_ctx, if_num); - return NSS_TX_FAILURE; - } - -@@ -257,7 +257,7 @@ nss_tx_status_t nss_bridge_tx_vsi_unassi - } - - if (nss_bridge_verify_if_num(if_num) == false) { -- nss_warning("%p: invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: invalid interface %d", nss_ctx, if_num); - return NSS_TX_FAILURE; - } - -@@ -286,7 +286,7 @@ nss_tx_status_t nss_bridge_tx_set_mtu_ms - } - - if (nss_bridge_verify_if_num(bridge_if_num) == false) { -- nss_warning("%p: received invalid interface %d", nss_ctx, bridge_if_num); -+ nss_warning("%px: received invalid interface %d", nss_ctx, bridge_if_num); - return NSS_TX_FAILURE; - } - -@@ -316,7 +316,7 @@ nss_tx_status_t nss_bridge_tx_set_mac_ad - } - - if (nss_bridge_verify_if_num(bridge_if_num) == false) { -- nss_warning("%p: received invalid interface %d", nss_ctx, bridge_if_num); -+ nss_warning("%px: received invalid interface %d", nss_ctx, bridge_if_num); - return NSS_TX_FAILURE; - } - -@@ -345,13 +345,13 @@ nss_tx_status_t nss_bridge_tx_join_msg(u - } - - if (nss_bridge_verify_if_num(bridge_if_num) == false) { -- nss_warning("%p: received invalid interface %d\n", nss_ctx, bridge_if_num); -+ nss_warning("%px: received invalid interface %d\n", nss_ctx, bridge_if_num); - return NSS_TX_FAILURE; - } - - slave_if_num = nss_cmn_get_interface_number_by_dev(netdev); - if (slave_if_num < 0) { -- nss_warning("%p: invalid slave device %p\n", nss_ctx, netdev); -+ nss_warning("%px: invalid slave device %px\n", nss_ctx, netdev); - return NSS_TX_FAILURE; - } - -@@ -379,13 +379,13 @@ nss_tx_status_t nss_bridge_tx_leave_msg( - } - - if (nss_bridge_verify_if_num(bridge_if_num) == false) { -- nss_warning("%p: received invalid interface %d\n", nss_ctx, bridge_if_num); -+ nss_warning("%px: received invalid interface %d\n", nss_ctx, bridge_if_num); - return NSS_TX_FAILURE; - } - - slave_if_num = nss_cmn_get_interface_number_by_dev(netdev); - if (slave_if_num < 0) { -- nss_warning("%p: invalid slave device %p\n", nss_ctx, netdev); -+ nss_warning("%px: invalid slave device %px\n", nss_ctx, netdev); - return NSS_TX_FAILURE; - } - -@@ -412,12 +412,12 @@ nss_tx_status_t nss_bridge_tx_set_fdb_le - } - - if (nss_bridge_verify_if_num(bridge_if_num) == false) { -- nss_warning("%p: received invalid interface %d\n", nss_ctx, bridge_if_num); -+ nss_warning("%px: received invalid interface %d\n", nss_ctx, bridge_if_num); - return NSS_TX_FAILURE; - } - - if (fdb_learn >= NSS_BRIDGE_FDB_LEARN_MODE_MAX) { -- nss_warning("%p: received invalid fdb learn mode %d\n", nss_ctx, fdb_learn); -+ nss_warning("%px: received invalid fdb learn mode %d\n", nss_ctx, fdb_learn); - return NSS_TX_FAILURE; - } - ---- a/nss_bridge_log.c -+++ b/nss_bridge_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -38,7 +38,7 @@ static int8_t *nss_bridge_log_message_ty - static void nss_bridge_join_msg(struct nss_bridge_msg *nbm) - { - struct nss_bridge_join_msg *nbjm __maybe_unused = &nbm->msg.br_join; -- nss_trace("%p: NSS Bridge Join message \n" -+ nss_trace("%px: NSS Bridge Join message \n" - "Interface Number: %d\n", - nbm, nbjm->if_num); - } -@@ -50,7 +50,7 @@ static void nss_bridge_join_msg(struct n - static void nss_bridge_leave_msg(struct nss_bridge_msg *nbm) - { - struct nss_bridge_leave_msg *nblm __maybe_unused = &nbm->msg.br_leave; -- nss_trace("%p: NSS Bridge Leave message: \n" -+ nss_trace("%px: NSS Bridge Leave message: \n" - "Interface Number: %d\n", - nbm, nblm->if_num); - } -@@ -63,7 +63,7 @@ static void nss_bridge_fdb_learn_msg(str - { - struct nss_bridge_set_fdb_learn_msg *nbflm __maybe_unused = - &nbm->msg.fdb_learn; -- nss_trace("%p: NSS Bridge Set FDB Learn message: \n" -+ nss_trace("%px: NSS Bridge Set FDB Learn message: \n" - "Mode: %d\n", - nbm, nbflm->mode); - } -@@ -88,7 +88,7 @@ static void nss_bridge_log_verbose(struc - break; - - default: -- nss_trace("%p: Invalid message type\n", nbm); -+ nss_trace("%px: Invalid message type\n", nbm); - break; - } - } -@@ -100,11 +100,11 @@ static void nss_bridge_log_verbose(struc - void nss_bridge_log_tx_msg(struct nss_bridge_msg *nbm) - { - if (nbm->cm.type >= NSS_BRIDGE_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", nbm); -+ nss_warning("%px: Invalid message type\n", nbm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nbm, nbm->cm.type, nss_bridge_log_message_types_str[nbm->cm.type - NSS_IF_MAX_MSG_TYPES - 1]); -+ nss_info("%px: type[%d]:%s\n", nbm, nbm->cm.type, nss_bridge_log_message_types_str[nbm->cm.type - NSS_IF_MAX_MSG_TYPES - 1]); - nss_bridge_log_verbose(nbm); - } - -@@ -115,18 +115,18 @@ void nss_bridge_log_tx_msg(struct nss_br - void nss_bridge_log_rx_msg(struct nss_bridge_msg *nbm) - { - if (nbm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nbm); -+ nss_warning("%px: Invalid response\n", nbm); - return; - } - - if (nbm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nbm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nbm, nbm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nbm, nbm->cm.type, - nss_bridge_log_message_types_str[nbm->cm.type - NSS_IF_MAX_MSG_TYPES - 1], - nbm->cm.response, nss_cmn_response_str[nbm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - nbm, nbm->cm.type, nss_bridge_log_message_types_str[nbm->cm.type - NSS_IF_MAX_MSG_TYPES - 1], - nbm->cm.response, nss_cmn_response_str[nbm->cm.response]); - ---- a/nss_c2c_rx.c -+++ b/nss_c2c_rx.c -@@ -43,7 +43,7 @@ static void nss_c2c_rx_interface_handler - nss_c2c_rx_msg_callback_t cb; - - if (!nss_c2c_rx_verify_if_num(ncm->interface)) { -- nss_warning("%p: invalid interface %d for c2c_tx\n", nss_ctx, ncm->interface); -+ nss_warning("%px: invalid interface %d for c2c_tx\n", nss_ctx, ncm->interface); - return; - } - -@@ -51,12 +51,12 @@ static void nss_c2c_rx_interface_handler - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_C2C_RX_MSG_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for c2c_rx", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for c2c_rx", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_c2c_rx_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - ---- a/nss_c2c_tx.c -+++ b/nss_c2c_tx.c -@@ -68,7 +68,7 @@ static void nss_c2c_tx_msg_handler(struc - nss_c2c_tx_msg_callback_t cb; - - if (!nss_c2c_tx_verify_if_num(ncm->interface)) { -- nss_warning("%p: invalid interface %d for c2c_tx\n", nss_ctx, ncm->interface); -+ nss_warning("%px: invalid interface %d for c2c_tx\n", nss_ctx, ncm->interface); - return; - } - -@@ -76,12 +76,12 @@ static void nss_c2c_tx_msg_handler(struc - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_C2C_TX_MSG_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for c2c_tx", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for c2c_tx", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_c2c_tx_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -137,7 +137,7 @@ static void nss_c2c_tx_msg_handler(struc - */ - void nss_c2c_tx_register_handler(struct nss_ctx_instance *nss_ctx) - { -- nss_info("%p: nss_c2c_tx_register_handler", nss_ctx); -+ nss_info("%px: nss_c2c_tx_register_handler", nss_ctx); - nss_core_register_handler(nss_ctx, NSS_C2C_TX_INTERFACE, nss_c2c_tx_msg_handler, NULL); - - if (nss_ctx->id == NSS_CORE_0) { -@@ -159,12 +159,12 @@ nss_tx_status_t nss_c2c_tx_tx_msg(struct - * Sanity check the message - */ - if (!nss_c2c_tx_verify_if_num(ncm->interface)) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_C2C_TX_MSG_TYPE_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -185,11 +185,11 @@ static void nss_c2c_tx_msg_cfg_map_callb - { - struct nss_ctx_instance *nss_ctx __attribute__((unused)) = (struct nss_ctx_instance *)app_data; - if (nctm->cm.response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: nss c2c_tx_map configuration failed: %d for NSS core %d\n", -+ nss_warning("%px: nss c2c_tx_map configuration failed: %d for NSS core %d\n", - nss_ctx, nctm->cm.error, nss_ctx->id); - } - -- nss_info("%p: nss c2c_tx_map configuration succeeded for NSS core %d\n", -+ nss_info("%px: nss c2c_tx_map configuration succeeded for NSS core %d\n", - nss_ctx, nss_ctx->id); - } - -@@ -205,13 +205,13 @@ static void nss_c2c_tx_msg_performance_t - * Test start has been failed. Restore the value to initial state. - */ - if (nctm->cm.response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: nss c2c_tx test start failed: %d for NSS core %d\n", -+ nss_warning("%px: nss c2c_tx test start failed: %d for NSS core %d\n", - nss_ctx, nctm->cm.error, nss_ctx->id); - nss_c2c_tx_test_id = -1; - return; - } - -- nss_info("%p: nss c2c_tx test successfully initialized for NSS core %d\n", -+ nss_info("%px: nss c2c_tx test successfully initialized for NSS core %d\n", - nss_ctx, nss_ctx->id); - } - -@@ -225,7 +225,7 @@ nss_tx_status_t nss_c2c_tx_msg_cfg_map(s - struct nss_c2c_tx_msg nctm; - struct nss_c2c_tx_map *cfg_map; - -- nss_info("%p: C2C map:%x\n", nss_ctx, tx_map); -+ nss_info("%px: C2C map:%x\n", nss_ctx, tx_map); - nss_c2c_tx_msg_init(&nctm, NSS_C2C_TX_INTERFACE, NSS_C2C_TX_MSG_TYPE_TX_MAP, - sizeof(struct nss_c2c_tx_map), nss_c2c_tx_msg_cfg_map_callback, (void *)nss_ctx); - -@@ -251,7 +251,7 @@ nss_tx_status_t nss_c2c_tx_msg_performan - struct nss_c2c_tx_msg nctm; - struct nss_c2c_tx_test *test; - -- nss_info("%p: C2C test message:%x\n", nss_ctx, test_id); -+ nss_info("%px: C2C test message:%x\n", nss_ctx, test_id); - nss_c2c_tx_msg_init(&nctm, NSS_C2C_TX_INTERFACE, NSS_C2C_TX_MSG_TYPE_PERFORMANCE_TEST, - sizeof(struct nss_c2c_tx_test), nss_c2c_tx_msg_performance_test_callback, (void *)nss_ctx); - -@@ -299,12 +299,12 @@ static int nss_c2c_tx_performance_test_h - } - - if (current_state != -1) { -- nss_warning("%p: Another test is running.\n", nss_ctx); -+ nss_warning("%px: Another test is running.\n", nss_ctx); - return -EINVAL; - } - - if (nss_c2c_tx_test_id >= NSS_C2C_TX_TEST_TYPE_MAX || nss_c2c_tx_test_id <= 0) { -- nss_warning("%p: Invalid test ID.\n", nss_ctx); -+ nss_warning("%px: Invalid test ID.\n", nss_ctx); - nss_c2c_tx_test_id = current_state; - return -EINVAL; - } -@@ -313,7 +313,7 @@ static int nss_c2c_tx_performance_test_h - ret_c2c_tx = nss_c2c_tx_msg_performance_test(nss_ctx, nss_c2c_tx_test_id); - - if (ret_c2c_tx != NSS_SUCCESS) { -- nss_warning("%p: Starting the test has failed.\n", nss_ctx); -+ nss_warning("%px: Starting the test has failed.\n", nss_ctx); - nss_c2c_tx_test_id = -1; - } - ---- a/nss_c2c_tx_log.c -+++ b/nss_c2c_tx_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -46,7 +46,7 @@ static int8_t *nss_c2c_tx_log_error_resp - static void nss_c2c_tx_map_msg(struct nss_c2c_tx_msg *nctm) - { - struct nss_c2c_tx_map *nctmm __maybe_unused = &nctm->msg.map; -- nss_trace("%p: NSS C2C TX Map message: \n" -+ nss_trace("%px: NSS C2C TX Map message: \n" - "C2C Receiver Queue Start Address: %d\n" - "C2C Interrupt Register Address: %d\n", - nctm, -@@ -65,7 +65,7 @@ static void nss_c2c_tx_log_verbose(struc - break; - - default: -- nss_trace("%p: Invalid message type\n", nctm); -+ nss_trace("%px: Invalid message type\n", nctm); - break; - } - } -@@ -77,11 +77,11 @@ static void nss_c2c_tx_log_verbose(struc - void nss_c2c_tx_log_tx_msg(struct nss_c2c_tx_msg *nctm) - { - if (nctm->cm.type >= NSS_C2C_TX_MSG_TYPE_MAX) { -- nss_info("%p: Invalid message type\n", nctm); -+ nss_info("%px: Invalid message type\n", nctm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nctm, nctm->cm.type, nss_c2c_tx_log_message_types_str[nctm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nctm, nctm->cm.type, nss_c2c_tx_log_message_types_str[nctm->cm.type]); - nss_c2c_tx_log_verbose(nctm); - } - -@@ -92,26 +92,26 @@ void nss_c2c_tx_log_tx_msg(struct nss_c2 - void nss_c2c_tx_log_rx_msg(struct nss_c2c_tx_msg *nctm) - { - if (nctm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nctm); -+ nss_warning("%px: Invalid response\n", nctm); - return; - } - - if (nctm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nctm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nctm, nctm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nctm, nctm->cm.type, - nss_c2c_tx_log_message_types_str[nctm->cm.type], - nctm->cm.response, nss_cmn_response_str[nctm->cm.response]); - goto verbose; - } - - if (nctm->cm.error >= NSS_C2C_TX_MSG_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nctm, nctm->cm.type, nss_c2c_tx_log_message_types_str[nctm->cm.type], - nctm->cm.response, nss_cmn_response_str[nctm->cm.response], - nctm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nctm, nctm->cm.type, nss_c2c_tx_log_message_types_str[nctm->cm.type], - nctm->cm.response, nss_cmn_response_str[nctm->cm.response], - nctm->cm.error, nss_c2c_tx_log_error_response_types_str[nctm->cm.error]); ---- a/nss_capwap.c -+++ b/nss_capwap.c -@@ -192,12 +192,12 @@ static void nss_capwap_msg_handler(struc - * Is this a valid request/response packet? - */ - if (ncm->type > NSS_CAPWAP_MSG_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for CAPWAP interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for CAPWAP interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_capwap_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -234,7 +234,7 @@ static void nss_capwap_msg_handler(struc - * Do we have a callback - */ - if (!ncm->cb) { -- nss_trace("%p: cb is null for interface %d", nss_ctx, ncm->interface); -+ nss_trace("%px: cb is null for interface %d", nss_ctx, ncm->interface); - return; - } - -@@ -255,7 +255,7 @@ static bool nss_capwap_instance_alloc(st - */ - h = kmalloc(sizeof(struct nss_capwap_handle), GFP_ATOMIC); - if (h == NULL) { -- nss_warning("%p: no memory for allocating CAPWAP instance for interface : %d", nss_ctx, if_num); -+ nss_warning("%px: no memory for allocating CAPWAP instance for interface : %d", nss_ctx, if_num); - return false; - } - -@@ -266,7 +266,7 @@ static bool nss_capwap_instance_alloc(st - if (nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] != NULL) { - spin_unlock(&nss_capwap_spinlock); - kfree(h); -- nss_warning("%p: Another thread is already allocated instance for :%d", nss_ctx, if_num); -+ nss_warning("%px: Another thread is already allocated instance for :%d", nss_ctx, if_num); - return false; - } - -@@ -302,7 +302,7 @@ nss_tx_status_t nss_capwap_tx_msg(struct - spin_lock(&nss_capwap_spinlock); - if (!nss_capwap_hdl[if_num]) { - spin_unlock(&nss_capwap_spinlock); -- nss_warning("%p: capwap tunnel if_num is not there: %d", nss_ctx, msg->cm.interface); -+ nss_warning("%px: capwap tunnel if_num is not there: %d", nss_ctx, msg->cm.interface); - return NSS_TX_FAILURE_BAD_PARAM; - } - nss_capwap_refcnt_inc(msg->cm.interface); -@@ -372,14 +372,14 @@ struct nss_ctx_instance *nss_capwap_noti - nss_ctx = &nss_top_main.nss[nss_top_main.capwap_handler_id]; - - if (nss_capwap_verify_if_num(if_num) == false) { -- nss_warning("%p: notfiy register received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: notfiy register received for invalid interface %d", nss_ctx, if_num); - return NULL; - } - - spin_lock(&nss_capwap_spinlock); - if (nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] != NULL) { - spin_unlock(&nss_capwap_spinlock); -- nss_warning("%p: notfiy register tunnel already exists for interface %d", nss_ctx, if_num); -+ nss_warning("%px: notfiy register tunnel already exists for interface %d", nss_ctx, if_num); - return NULL; - } - spin_unlock(&nss_capwap_spinlock); -@@ -399,13 +399,13 @@ nss_tx_status_t nss_capwap_notify_unregi - int index; - - if (nss_capwap_verify_if_num(if_num) == false) { -- nss_warning("%p: notify unregister received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: notify unregister received for invalid interface %d", nss_ctx, if_num); - return NSS_TX_FAILURE_BAD_PARAM; - } - - nss_top = nss_ctx->nss_top; - if (nss_top == NULL) { -- nss_warning("%p: notify unregister received for invalid nss_top %d", nss_ctx, if_num); -+ nss_warning("%px: notify unregister received for invalid nss_top %d", nss_ctx, if_num); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -413,7 +413,7 @@ nss_tx_status_t nss_capwap_notify_unregi - spin_lock(&nss_capwap_spinlock); - if (nss_capwap_hdl[index] == NULL) { - spin_unlock(&nss_capwap_spinlock); -- nss_warning("%p: notify unregister received for unallocated if_num: %d", nss_ctx, if_num); -+ nss_warning("%px: notify unregister received for unallocated if_num: %d", nss_ctx, if_num); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -423,7 +423,7 @@ nss_tx_status_t nss_capwap_notify_unregi - */ - if (nss_capwap_refcnt(if_num) != 0) { - spin_unlock(&nss_capwap_spinlock); -- nss_warning("%p: notify unregister tunnel %d: has reference", nss_ctx, if_num); -+ nss_warning("%px: notify unregister tunnel %d: has reference", nss_ctx, if_num); - return NSS_TX_FAILURE_QUEUE; - } - -@@ -445,7 +445,7 @@ struct nss_ctx_instance *nss_capwap_data - - nss_ctx = nss_capwap_get_ctx(); - if (nss_capwap_verify_if_num(if_num) == false) { -- nss_warning("%p: data register received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: data register received for invalid interface %d", nss_ctx, if_num); - return NULL; - } - -@@ -458,12 +458,12 @@ struct nss_ctx_instance *nss_capwap_data - - core_status = nss_core_register_handler(nss_ctx, if_num, nss_capwap_msg_handler, NULL); - if (core_status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: nss core register handler failed for if_num:%d with error :%d", nss_ctx, if_num, core_status); -+ nss_warning("%px: nss core register handler failed for if_num:%d with error :%d", nss_ctx, if_num, core_status); - return NULL; - } - - if (nss_capwap_instance_alloc(nss_ctx, if_num) == false) { -- nss_warning("%p: couldn't allocate tunnel instance for if_num:%d", nss_ctx, if_num); -+ nss_warning("%px: couldn't allocate tunnel instance for if_num:%d", nss_ctx, if_num); - return NULL; - } - -@@ -484,7 +484,7 @@ bool nss_capwap_data_unregister(uint32_t - - nss_ctx = nss_capwap_get_ctx(); - if (nss_capwap_verify_if_num(if_num) == false) { -- nss_warning("%p: data unregister received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: data unregister received for invalid interface %d", nss_ctx, if_num); - return false; - } - -@@ -494,7 +494,7 @@ bool nss_capwap_data_unregister(uint32_t - */ - if (nss_capwap_refcnt(if_num) != 0) { - spin_unlock(&nss_capwap_spinlock); -- nss_warning("%p: notify unregister tunnel %d: has reference", nss_ctx, if_num); -+ nss_warning("%px: notify unregister tunnel %d: has reference", nss_ctx, if_num); - return false; - } - h = nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START]; -@@ -533,7 +533,7 @@ int nss_capwap_ifnum_with_core_id(int if - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (nss_is_dynamic_interface(if_num) == false) { -- nss_info("%p: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); -+ nss_info("%px: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); - return 0; - } - return NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num); ---- a/nss_capwap_log.c -+++ b/nss_capwap_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -69,10 +69,10 @@ static int8_t *nss_capwap_log_error_resp - static void nss_capwap_rule_msg(struct nss_capwap_msg *ncm) - { - struct nss_capwap_rule_msg *ncrm __maybe_unused = &ncm->msg.rule; -- nss_trace("%p: NSS CAPWAP Rule message \n" -- "Encap Rule Src IP: %p\n" -+ nss_trace("%px: NSS CAPWAP Rule message \n" -+ "Encap Rule Src IP: %px\n" - "Encap Rule Src Port: %d\n" -- "Encap Rule Dst Ip: %p\n" -+ "Encap Rule Dst Ip: %px\n" - "Encap Rule Dst Port: %d\n" - "Encap Rule Path MTU: %d\n" - "Decap Rule Reassembly Timeout: %d\n" -@@ -87,7 +87,7 @@ static void nss_capwap_rule_msg(struct n - "GMAC Interface Number: %d\n" - "Enabled Features: %x\n" - "DTLS Interface Number: %d\n" -- "BSSID: %p\n" -+ "BSSID: %px\n" - "Outer Segment Value: %x\n", - ncrm, - &ncrm->encap.src_ip.ip, -@@ -114,7 +114,7 @@ static void nss_capwap_rule_msg(struct n - static void nss_capwap_path_mtu_msg(struct nss_capwap_msg *ncm) - { - struct nss_capwap_path_mtu_msg *ncpmm __maybe_unused = &ncm->msg.mtu; -- nss_trace("%p: NSS CAPWAP Path MTU message \n" -+ nss_trace("%px: NSS CAPWAP Path MTU message \n" - "CAPWAP Path MTU: %d\n", - ncpmm, - ncpmm->path_mtu); -@@ -127,7 +127,7 @@ static void nss_capwap_path_mtu_msg(stru - static void nss_capwap_version_msg(struct nss_capwap_msg *ncm) - { - struct nss_capwap_version_msg *ncvm __maybe_unused = &ncm->msg.version; -- nss_trace("%p: NSS CAPWAP Version message \n" -+ nss_trace("%px: NSS CAPWAP Version message \n" - "CAPWAP Version: %d\n", - ncvm, - ncvm->version); -@@ -140,7 +140,7 @@ static void nss_capwap_version_msg(struc - static void nss_capwap_dtls_msg(struct nss_capwap_msg *ncm) - { - struct nss_capwap_dtls_msg *ncdm __maybe_unused = &ncm->msg.dtls; -- nss_trace("%p: NSS CAPWAP dtls message \n" -+ nss_trace("%px: NSS CAPWAP dtls message \n" - "CAPWAP DTLS Enable: %d\n" - "CAPWAP DTLS Inner Interface Number: %d\n" - "CAPWAP MTU Adjust: %d\n" -@@ -156,7 +156,7 @@ static void nss_capwap_dtls_msg(struct n - */ - static void nss_capwap_flow_rule_msg(struct nss_capwap_flow_rule_msg *ncfrm) - { -- nss_trace("%p: NSS CAPWAP Flow Rule message \n" -+ nss_trace("%px: NSS CAPWAP Flow Rule message \n" - "CAPWAP IP Version: %d\n" - "CAPWAP Layer 4 Protocol: %d\n" - "CAPWAP Source Port: %d\n" -@@ -226,7 +226,7 @@ static void nss_capwap_log_verbose(struc - break; - - default: -- nss_trace("%p: Invalid message type\n", ncm); -+ nss_trace("%px: Invalid message type\n", ncm); - break; - } - } -@@ -238,11 +238,11 @@ static void nss_capwap_log_verbose(struc - void nss_capwap_log_tx_msg(struct nss_capwap_msg *ncm) - { - if (ncm->cm.type >= NSS_CAPWAP_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", ncm); -+ nss_warning("%px: Invalid message type\n", ncm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ncm, ncm->cm.type, nss_capwap_log_message_types_str[ncm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ncm, ncm->cm.type, nss_capwap_log_message_types_str[ncm->cm.type]); - nss_capwap_log_verbose(ncm); - } - -@@ -253,26 +253,26 @@ void nss_capwap_log_tx_msg(struct nss_ca - void nss_capwap_log_rx_msg(struct nss_capwap_msg *ncm) - { - if (ncm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ncm); -+ nss_warning("%px: Invalid response\n", ncm); - return; - } - - if (ncm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ncm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, - nss_capwap_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response]); - goto verbose; - } - - if (ncm->cm.error >= NSS_CAPWAP_ERROR_MSG_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ncm, ncm->cm.type, nss_capwap_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ncm, ncm->cm.type, nss_capwap_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error, nss_capwap_log_error_response_types_str[ncm->cm.error]); ---- a/nss_capwap_stats.c -+++ b/nss_capwap_stats.c -@@ -117,15 +117,18 @@ static ssize_t nss_capwap_stats_decap(ch - tcnt = s->rx_queue_full_drops; - return snprintf(line, len, "%s = %llu (n2h = %llu)\n", nss_capwap_strings_decap_stats[i].stats_name, tcnt, s->rx_n2h_queue_full_drops); - case 10: -- tcnt = s->rx_mem_failure_drops; -+ tcnt = s->rx_n2h_queue_full_drops; - break; - case 11: -- tcnt = s->rx_csum_drops; -+ tcnt = s->rx_mem_failure_drops; - break; - case 12: -- tcnt = s->rx_malformed; -+ tcnt = s->rx_csum_drops; - break; - case 13: -+ tcnt = s->rx_malformed; -+ break; -+ case 14: - tcnt = s->fast_mem; - break; - default: ---- a/nss_clmap.c -+++ b/nss_clmap.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -88,12 +88,12 @@ static void nss_clmap_msg_handler(struct - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_CLMAP_MSG_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for clmap interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for clmap interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_clmap_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -113,7 +113,7 @@ static void nss_clmap_msg_handler(struct - * Update the callback and app_data for NOTIFY messages. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_top_main.if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->nss_rx_interface_handlers[nss_ctx->id][ncm->interface].app_data; - } - -@@ -122,7 +122,7 @@ static void nss_clmap_msg_handler(struct - */ - cb = (nss_clmap_msg_callback_t)ncm->cb; - if (!cb) { -- nss_trace("%p: cb is null for interface %d", nss_ctx, ncm->interface); -+ nss_trace("%px: cb is null for interface %d", nss_ctx, ncm->interface); - return; - } - -@@ -169,14 +169,14 @@ nss_tx_status_t nss_clmap_tx_msg_sync(st - - status = nss_clmap_tx_msg(nss_ctx, nclm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: clmap_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: clmap_tx_msg failed\n", nss_ctx); - up(&clmap_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&clmap_pvt.complete, msecs_to_jiffies(NSS_CLMAP_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: clmap tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: clmap tx sync failed due to timeout\n", nss_ctx); - clmap_pvt.response = NSS_TX_FAILURE; - } - -@@ -205,19 +205,25 @@ EXPORT_SYMBOL(nss_clmap_tx_buf); - bool nss_clmap_unregister(uint32_t if_num) - { - struct nss_ctx_instance *nss_ctx; -+ int status; - - nss_ctx = nss_clmap_get_ctx(); - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (!nss_clmap_verify_if_num(if_num)) { -- nss_warning("%p: clmap unregister request received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: clmap unregister request received for invalid interface %d", nss_ctx, if_num); -+ return false; -+ } -+ -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Failed to unregister handler for clmap NSS I/F:%u\n", nss_ctx, if_num); - return false; - } - -- nss_clmap_stats_session_unregister(if_num); -- nss_core_unregister_handler(nss_ctx, if_num); - nss_core_unregister_subsys_dp(nss_ctx, if_num); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ nss_core_unregister_handler(nss_ctx, if_num); -+ nss_clmap_stats_session_unregister(if_num); - - return true; - } -@@ -242,8 +248,8 @@ struct nss_ctx_instance *nss_clmap_regis - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (!nss_clmap_verify_if_num(if_num)) { -- nss_warning("%p: clmap register request received for invalid interface %d", nss_ctx, if_num); -- return NULL; -+ nss_warning("%px: clmap register request received for invalid interface %d", nss_ctx, if_num); -+ goto fail; - } - - if (di_type == NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_US) { -@@ -253,22 +259,33 @@ struct nss_ctx_instance *nss_clmap_regis - } - - if (!stats_status) { -- nss_warning("%p: statistics registration failed for interface: %d\n", nss_ctx, if_num); -- return NULL; -+ nss_warning("%px: statistics registration failed for interface: %d\n", nss_ctx, if_num); -+ goto fail; - } - - core_status = nss_core_register_handler(nss_ctx, if_num, nss_clmap_msg_handler, (void *)netdev); - if (core_status != NSS_CORE_STATUS_SUCCESS) { -- nss_clmap_stats_session_unregister(if_num); -- nss_warning("%p: NSS core register handler failed for if_num:%d with error :%d", nss_ctx, if_num, core_status); -- return NULL; -+ goto core_reg_fail; -+ } -+ -+ core_status = nss_core_register_msg_handler(nss_ctx, if_num, notify_cb); -+ if (core_status != NSS_CORE_STATUS_SUCCESS) { -+ goto msg_reg_fail; - } - - nss_core_register_subsys_dp(nss_ctx, if_num, data_cb, NULL, (void *)netdev, netdev, features); - nss_core_set_subsys_dp_type(nss_ctx, netdev, if_num, di_type); -- nss_top_main.if_rx_msg_callback[if_num] = notify_cb; - - return nss_ctx; -+ -+msg_reg_fail: -+ nss_core_unregister_handler(nss_ctx, if_num); -+core_reg_fail: -+ nss_clmap_stats_session_unregister(if_num); -+ nss_warning("%px: NSS core register handler failed for if_num:%d with error :%d", nss_ctx, if_num, core_status); -+fail: -+ return NULL; -+ - } - EXPORT_SYMBOL(nss_clmap_register); - -@@ -282,7 +299,7 @@ int nss_clmap_ifnum_with_core_id(int if_ - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (!nss_is_dynamic_interface(if_num)) { -- nss_warning("%p: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); -+ nss_warning("%px: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); - return 0; - } - return NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num); ---- a/nss_clmap_log.c -+++ b/nss_clmap_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -59,7 +59,7 @@ static char *nss_clmap_log_error_types_s - */ - static void nss_clmap_log_mac_msg(struct nss_clmap_mac_msg *npvcm) - { -- nss_trace("%p: NSS clmap MAC message \n" -+ nss_trace("%px: NSS clmap MAC message \n" - "Clmap Mac Addr: %x : %x : %x" - "Clmap Flags: %u\n" - "Clmap VLAN ID: %u\n" -@@ -76,7 +76,7 @@ static void nss_clmap_log_mac_msg(struct - */ - static void nss_clmap_log_interface_enable_msg(struct nss_clmap_msg *npvm) - { -- nss_trace("%p: NSS clmap interface state message: Enable \n", npvm); -+ nss_trace("%px: NSS clmap interface state message: Enable \n", npvm); - } - - /* -@@ -85,7 +85,7 @@ static void nss_clmap_log_interface_enab - */ - static void nss_clmap_log_interface_disable_msg(struct nss_clmap_msg *npvm) - { -- nss_trace("%p: NSS clmap interface state message: Disable \n", npvm); -+ nss_trace("%px: NSS clmap interface state message: Disable \n", npvm); - } - - /* -@@ -115,7 +115,7 @@ static void nss_clmap_log_mac_del_msg(st - static void nss_clmap_log_mac_flush_msg(struct nss_clmap_msg *npvm) - { - struct nss_clmap_flush_mac_msg *npvcm __maybe_unused = &npvm->msg.mac_flush; -- nss_trace("%p: NSS clmap MAC flush message \n" -+ nss_trace("%px: NSS clmap MAC flush message \n" - "Clmap Next-hop Interface Number: %d\n", - npvcm, npvcm->nexthop_ifnum); - } -@@ -151,7 +151,7 @@ static void nss_clmap_log_verbose(struct - break; - - default: -- nss_trace("%p: Invalid message type\n", npvm); -+ nss_trace("%px: Invalid message type\n", npvm); - break; - } - } -@@ -163,11 +163,11 @@ static void nss_clmap_log_verbose(struct - void nss_clmap_log_tx_msg(struct nss_clmap_msg *npvm) - { - if (npvm->cm.type >= NSS_CLMAP_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", npvm); -+ nss_warning("%px: Invalid message type\n", npvm); - return; - } - -- nss_info("%p: type[%d]:%s\n", npvm, npvm->cm.type, nss_clmap_log_message_types_str[npvm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", npvm, npvm->cm.type, nss_clmap_log_message_types_str[npvm->cm.type]); - nss_clmap_log_verbose(npvm); - } - -@@ -178,26 +178,26 @@ void nss_clmap_log_tx_msg(struct nss_clm - void nss_clmap_log_rx_msg(struct nss_clmap_msg *npvm) - { - if (npvm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", npvm); -+ nss_warning("%px: Invalid response\n", npvm); - return; - } - - if (npvm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (npvm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", npvm, npvm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", npvm, npvm->cm.type, - nss_clmap_log_message_types_str[npvm->cm.type], - npvm->cm.response, nss_cmn_response_str[npvm->cm.response]); - goto verbose; - } - - if (npvm->cm.error >= NSS_CLMAP_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - npvm, npvm->cm.type, nss_clmap_log_message_types_str[npvm->cm.type], - npvm->cm.response, nss_cmn_response_str[npvm->cm.response], - npvm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - npvm, npvm->cm.type, nss_clmap_log_message_types_str[npvm->cm.type], - npvm->cm.response, nss_cmn_response_str[npvm->cm.response], - npvm->cm.error, nss_clmap_log_error_types_str[npvm->cm.error]); ---- a/nss_clmap_stats.c -+++ b/nss_clmap_stats.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -79,7 +79,7 @@ bool nss_clmap_stats_session_register(ui - if (!stats_db[i]) { - stats_db[i] = (struct nss_clmap_stats *)kzalloc(sizeof(struct nss_clmap_stats), GFP_KERNEL); - if (!stats_db[i]) { -- nss_warning("%p: could not allocate memory for statistics database for interface id: %d\n", netdev, if_num); -+ nss_warning("%px: could not allocate memory for statistics database for interface id: %d\n", netdev, if_num); - break; - } - stats_db[i]->valid = true; -@@ -228,7 +228,7 @@ void nss_clmap_stats_sync(struct nss_ctx - - if (!s) { - spin_unlock_bh(&nss_clmap_stats_lock); -- nss_warning("%p: Interface not found: %u", nss_ctx, if_num); -+ nss_warning("%px: Interface not found: %u", nss_ctx, if_num); - return; - } - ---- a/nss_cmn.c -+++ b/nss_cmn.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -75,7 +75,7 @@ int32_t nss_cmn_get_interface_number(str - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: Interface number could not be found as core not ready\n", nss_ctx); -+ nss_warning("%px: Interface number could not be found as core not ready\n", nss_ctx); - return -1; - } - -@@ -90,7 +90,7 @@ int32_t nss_cmn_get_interface_number(str - } - } - -- nss_warning("%p: Interface number could not be found as interface has not registered yet\n", nss_ctx); -+ nss_warning("%px: Interface number could not be found as interface has not registered yet\n", nss_ctx); - return -1; - } - EXPORT_SYMBOL(nss_cmn_get_interface_number); -@@ -119,7 +119,7 @@ struct net_device *nss_cmn_get_interface - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: Interface device could not be found as core not ready\n", nss_ctx); -+ nss_warning("%px: Interface device could not be found as core not ready\n", nss_ctx); - return NULL; - } - -@@ -152,7 +152,7 @@ int32_t nss_cmn_get_interface_number_by_ - } - } - -- nss_warning("Interface number could not be found for %p (%s) as interface has not registered yet\n", dev, dev->name); -+ nss_warning("Interface number could not be found for %px (%s) as interface has not registered yet\n", dev, dev->name); - return -1; - } - EXPORT_SYMBOL(nss_cmn_get_interface_number_by_dev_and_type); -@@ -287,7 +287,7 @@ nss_cb_register_status_t nss_cmn_registe - /* - * We already have a callback registered for this service code. - */ -- nss_warning("%p: a callback is registered already for this service code %d\n", nss_ctx, service_code); -+ nss_warning("%px: a callback is registered already for this service code %d\n", nss_ctx, service_code); - - return NSS_CB_REGISTER_FAILED; - } -@@ -310,7 +310,7 @@ nss_cb_unregister_status_t nss_cmn_unreg - /* - * No callback was registered for this service code. - */ -- nss_warning("%p: no callback is registered for this service code %d\n", nss_ctx, service_code); -+ nss_warning("%px: no callback is registered for this service code %d\n", nss_ctx, service_code); - return NSS_CB_UNREGISTER_FAILED; - } - ---- a/nss_core.c -+++ b/nss_core.c -@@ -382,7 +382,7 @@ void nss_core_handle_nss_status_pkt(stru - * Check for version number - */ - if (ncm->version != expected_version) { -- nss_warning("%p: Message %d for interface %d received with invalid version %d, expected version %d", -+ nss_warning("%px: Message %d for interface %d received with invalid version %d, expected version %d", - nss_ctx, ncm->type, nss_if, ncm->version, expected_version); - return; - } -@@ -391,7 +391,7 @@ void nss_core_handle_nss_status_pkt(stru - * Validate message size - */ - if (ncm->len > nbuf->len) { -- nss_warning("%p: Message %d for interface %d received with invalid length %d, expected length %d", -+ nss_warning("%px: Message %d for interface %d received with invalid length %d, expected length %d", - nss_ctx, ncm->type, nss_if, nbuf->len, ncm->len); - return; - } -@@ -400,7 +400,7 @@ void nss_core_handle_nss_status_pkt(stru - * Check for validity of interface number - */ - if (nss_if >= NSS_MAX_NET_INTERFACES) { -- nss_warning("%p: Message %d received with invalid interface number %d", nss_ctx, ncm->type, nss_if); -+ nss_warning("%px: Message %d received with invalid interface number %d", nss_ctx, ncm->type, nss_if); - return; - } - -@@ -408,14 +408,14 @@ void nss_core_handle_nss_status_pkt(stru - app_data = nss_ctx->nss_rx_interface_handlers[nss_ctx->id][nss_if].app_data; - - if (!cb) { -- nss_warning("%p: Callback not registered for interface %d", nss_ctx, nss_if); -+ nss_warning("%px: Callback not registered for interface %d", nss_ctx, nss_if); - return; - } - - cb(nss_ctx, ncm, app_data); - - if (ncm->interface != nss_if) { -- nss_warning("%p: Invalid NSS I/F %d expected %d", nss_ctx, ncm->interface, nss_if); -+ nss_warning("%px: Invalid NSS I/F %d expected %d", nss_ctx, ncm->interface, nss_if); - } - - return; -@@ -465,16 +465,16 @@ static uint32_t nss_soc_mem_info(void) - - ppp = (__be32 *)of_get_property(node, "#address-cells", NULL); - addr_cells = ppp ? be32_to_cpup(ppp) : 2; -- nss_info("%p addr cells %d\n", ppp, addr_cells); -+ nss_info("%px addr cells %d\n", ppp, addr_cells); - ppp = (__be32 *)of_get_property(node, "#size-cells", NULL); - size_cells = ppp ? be32_to_cpup(ppp) : 2; -- nss_info("%p size cells %d\n", ppp, size_cells); -+ nss_info("%px size cells %d\n", ppp, size_cells); - - for_each_child_of_node(node, snode) { - /* - * compare (snode->full_name, "/reserved-memory/nss@40000000") may be safer - */ -- nss_info("%p snode %s fn %s\n", snode, snode->name, snode->full_name); -+ nss_info("%px snode %s fn %s\n", snode, snode->name, snode->full_name); - if (strcmp(snode->name, "nss") == 0) - break; - } -@@ -510,8 +510,9 @@ static void nss_get_ddr_info(struct nss_ - #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)) - cached = global_page_state(NR_FILE_PAGES); - #else -- cached = global_zone_page_state(NR_FILE_PAGES); -+ cached = global_node_page_state(NR_FILE_PAGES); - #endif -+ - avail_ddr = (vals.totalram + cached + vals.sharedram) * vals.mem_unit; - mmu->num_active_cores = nss_top_main.num_nss; - -@@ -570,7 +571,7 @@ case3: - } - } - of_node_put(node); -- nss_info_always("incorrect memory info %p items %d\n", -+ nss_info_always("incorrect memory info %px items %d\n", - ppp, n_items); - } - -@@ -600,7 +601,7 @@ static void nss_send_ddr_info(struct nss - struct nss_n2h_msg nnm; - struct nss_cmn_msg *ncm = &nnm.cm; - uint32_t ret; -- nss_info("%p: send DDR info\n", nss_own); -+ nss_info("%px: send DDR info\n", nss_own); - - nss_cmn_msg_init(ncm, NSS_N2H_INTERFACE, NSS_TX_DDR_INFO_VIA_N2H_CFG, - sizeof(struct nss_mmu_ddr_info), NULL, NULL); -@@ -610,7 +611,7 @@ static void nss_send_ddr_info(struct nss - - ret = nss_core_send_cmd(nss_own, &nnm, sizeof(nnm), NSS_NBUF_PAYLOAD_SIZE); - if (ret != NSS_TX_SUCCESS) { -- nss_info_always("%p: Failed to send DDR info for core %d\n", nss_own, nss_own->id); -+ nss_info_always("%px: Failed to send DDR info for core %d\n", nss_own, nss_own->id); - } - } - -@@ -654,7 +655,7 @@ static inline uint16_t nss_core_cause_to - static inline void nss_dump_desc(struct nss_ctx_instance *nss_ctx, struct n2h_descriptor *desc) - { - printk("bad descriptor dump for nss core = %d\n", nss_ctx->id); -- printk("\topaque = %p\n", (void *)desc->opaque); -+ printk("\topaque = %px\n", (void *)desc->opaque); - printk("\tinterface = %d\n", desc->interface_num); - printk("\tbuffer_type = %d\n", desc->buffer_type); - printk("\tbit_flags = %x\n", desc->bit_flags); -@@ -760,7 +761,7 @@ static inline void nss_core_handle_virt_ - */ - ndev = subsys_dp_reg->ndev; - if (unlikely(!ndev)) { -- nss_warning("%p: Received packet for unregistered virtual interface %d", -+ nss_warning("%px: Received packet for unregistered virtual interface %d", - nss_ctx, interface_num); - - /* -@@ -831,7 +832,7 @@ static inline void nss_core_handle_virt_ - xmit_ret = ndev->netdev_ops->ndo_start_xmit(nbuf, ndev); - if (unlikely(xmit_ret == NETDEV_TX_BUSY)) { - dev_kfree_skb_any(nbuf); -- nss_info("%p: Congestion at virtual interface %d, %p", nss_ctx, interface_num, ndev); -+ nss_info("%px: Congestion at virtual interface %d, %px", nss_ctx, interface_num, ndev); - } - dev_put(ndev); - } -@@ -983,7 +984,7 @@ static inline void nss_core_rx_pbuf(stru - - if (interface_num >= NSS_MAX_NET_INTERFACES) { - NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_INVALID_INTERFACE]); -- nss_warning("%p: Invalid interface_num: %d", nss_ctx, interface_num); -+ nss_warning("%px: Invalid interface_num: %d", nss_ctx, interface_num); - dev_kfree_skb_any(nbuf); - return; - } -@@ -993,7 +994,7 @@ static inline void nss_core_rx_pbuf(stru - */ - if (core_id > nss_top_main.num_nss) { - NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_INVALID_CORE_ID]); -- nss_warning("%p: Invalid core id: %d", nss_ctx, core_id); -+ nss_warning("%px: Invalid core id: %d", nss_ctx, core_id); - dev_kfree_skb_any(nbuf); - return; - } -@@ -1052,14 +1053,14 @@ static inline void nss_core_rx_pbuf(stru - status = nss_core_send_buffer(nss_ctx, 0, nbuf, NSS_IF_H2N_DATA_QUEUE, H2N_BUFFER_RATE_TEST, H2N_BIT_FLAG_BUFFER_REUSABLE); - if (unlikely(status != NSS_CORE_STATUS_SUCCESS)) { - dev_kfree_skb_any(nbuf); -- nss_warning("%p: Unable to enqueue\n", nss_ctx); -+ nss_warning("%px: Unable to enqueue\n", nss_ctx); - } - nss_hal_send_interrupt(nss_ctx, NSS_H2N_INTR_DATA_COMMAND_QUEUE); - break; - - default: - NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_INVALID_BUFFER_TYPE]); -- nss_warning("%p: Invalid buffer type %d received from NSS", nss_ctx, buffer_type); -+ nss_warning("%px: Invalid buffer type %d received from NSS", nss_ctx, buffer_type); - dev_kfree_skb_any(nbuf); - } - } -@@ -1092,7 +1093,7 @@ static inline bool nss_core_handle_nr_fr - * Free the old head as the frag list is corrupt. - */ - if (unlikely(jumbo_start)) { -- nss_warning("%p: received a full frame before a last", jumbo_start); -+ nss_warning("%px: received a full frame before a last", jumbo_start); - dev_kfree_skb_any(jumbo_start); - *jumbo_start_ptr = NULL; - } -@@ -1139,7 +1140,7 @@ static inline bool nss_core_handle_nr_fr - * Free the old head as the frag list is corrupt. - */ - if (unlikely(jumbo_start)) { -- nss_warning("%p: received the second head before a last", jumbo_start); -+ nss_warning("%px: received the second head before a last", jumbo_start); - dev_kfree_skb_any(jumbo_start); - } - -@@ -1182,7 +1183,7 @@ static inline bool nss_core_handle_nr_fr - /* - * Middle before first! Free the middle. - */ -- nss_warning("%p: saw a middle skb before head", nbuf); -+ nss_warning("%px: saw a middle skb before head", nbuf); - dev_kfree_skb_any(nbuf); - return false; - } -@@ -1220,7 +1221,7 @@ pull: - if (buffer_type != N2H_BUFFER_STATUS) { - if (!pskb_may_pull(nbuf, ETH_HLEN)) { - dev_kfree_skb(nbuf); -- nss_warning("%p: could not pull eth header", nbuf); -+ nss_warning("%px: could not pull eth header", nbuf); - return false; - } - } -@@ -1259,7 +1260,7 @@ static inline bool nss_core_handle_linea - * Free the old head as the frag list is corrupt. - */ - if (unlikely(head)) { -- nss_warning("%p: received a full frame before a last", head); -+ nss_warning("%px: received a full frame before a last", head); - dev_kfree_skb_any(head); - *head_ptr = NULL; - } -@@ -1301,7 +1302,7 @@ static inline bool nss_core_handle_linea - * Free the old head as the frag list is corrupt. - */ - if (unlikely(head)) { -- nss_warning("%p: received the second head before a last", head); -+ nss_warning("%px: received the second head before a last", head); - NSS_PKT_STATS_DEC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_NSS_SKB_COUNT]); - dev_kfree_skb_any(head); - } -@@ -1313,7 +1314,7 @@ static inline bool nss_core_handle_linea - /* - * We don't support chain in a chain. - */ -- nss_warning("%p: skb already has a fraglist", nbuf); -+ nss_warning("%px: skb already has a fraglist", nbuf); - NSS_PKT_STATS_DEC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_NSS_SKB_COUNT]); - dev_kfree_skb_any(nbuf); - return false; -@@ -1353,7 +1354,7 @@ static inline bool nss_core_handle_linea - /* - * Middle before first! Free the middle. - */ -- nss_warning("%p: saw a middle skb before head", nbuf); -+ nss_warning("%px: saw a middle skb before head", nbuf); - dev_kfree_skb_any(nbuf); - - return false; -@@ -1613,8 +1614,8 @@ static int32_t nss_core_handle_cause_que - * a linear skb chain. If so we need to free. - */ - if (unlikely(n2h_desc_ring->head)) { -- nss_warning("%p: we should not have an incomplete paged skb while" -- " constructing a linear skb %p", nbuf, n2h_desc_ring->head); -+ nss_warning("%px: we should not have an incomplete paged skb while" -+ " constructing a linear skb %px", nbuf, n2h_desc_ring->head); - - NSS_PKT_STATS_DEC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_NSS_SKB_COUNT]); - dev_kfree_skb_any(n2h_desc_ring->head); -@@ -1633,8 +1634,8 @@ static int32_t nss_core_handle_cause_que - * a paged skb. If so we need to free the paged_skb and handle the linear skb. - */ - if (unlikely(n2h_desc_ring->jumbo_start)) { -- nss_warning("%p: we should not have an incomplete linear skb while" -- " constructing a paged skb %p", nbuf, n2h_desc_ring->jumbo_start); -+ nss_warning("%px: we should not have an incomplete linear skb while" -+ " constructing a paged skb %px", nbuf, n2h_desc_ring->jumbo_start); - - NSS_PKT_STATS_DEC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_NSS_SKB_COUNT]); - dev_kfree_skb_any(n2h_desc_ring->jumbo_start); -@@ -1727,7 +1728,7 @@ static void nss_core_init_nss(struct nss - */ - ret = nss_n2h_cfg_empty_pool_size(nss_ctx, NSS_LOW_MEM_EMPTY_POOL_BUF_SZ); - if (ret != NSS_TX_SUCCESS) { -- nss_warning("%p: Failed to update empty buffer pool config\n", nss_ctx); -+ nss_warning("%px: Failed to update empty buffer pool config\n", nss_ctx); - } - #endif - } else { -@@ -1765,7 +1766,7 @@ static void nss_core_alloc_paged_buffers - * ERR: - */ - NSS_PKT_STATS_INC(&nss_top->stats_drv[alloc_fail_count]); -- nss_warning("%p: Could not obtain empty paged buffer", nss_ctx); -+ nss_warning("%px: Could not obtain empty paged buffer", nss_ctx); - break; - } - -@@ -1776,7 +1777,7 @@ static void nss_core_alloc_paged_buffers - */ - dev_kfree_skb_any(nbuf); - NSS_PKT_STATS_INC(&nss_top->stats_drv[alloc_fail_count]); -- nss_warning("%p: Could not obtain empty page", nss_ctx); -+ nss_warning("%px: Could not obtain empty page", nss_ctx); - break; - } - -@@ -1799,7 +1800,7 @@ static void nss_core_alloc_paged_buffers - * ERR: - */ - dev_kfree_skb_any(nbuf); -- nss_warning("%p: DMA mapping failed for empty buffer", nss_ctx); -+ nss_warning("%px: DMA mapping failed for empty buffer", nss_ctx); - break; - } - /* -@@ -1857,7 +1858,7 @@ static void nss_core_alloc_jumbo_mru_buf - * ERR: - */ - NSS_PKT_STATS_INC(&nss_top->stats_drv[NSS_DRV_STATS_NBUF_ALLOC_FAILS]); -- nss_warning("%p: Could not obtain empty jumbo mru buffer", nss_ctx); -+ nss_warning("%px: Could not obtain empty jumbo mru buffer", nss_ctx); - break; - } - -@@ -1872,7 +1873,7 @@ static void nss_core_alloc_jumbo_mru_buf - * ERR: - */ - dev_kfree_skb_any(nbuf); -- nss_warning("%p: DMA mapping failed for empty buffer", nss_ctx); -+ nss_warning("%px: DMA mapping failed for empty buffer", nss_ctx); - break; - } - -@@ -1933,7 +1934,7 @@ static void nss_core_alloc_max_avail_siz - * ERR: - */ - NSS_PKT_STATS_INC(&nss_top->stats_drv[NSS_DRV_STATS_NBUF_ALLOC_FAILS]); -- nss_warning("%p: Could not obtain empty buffer", nss_ctx); -+ nss_warning("%px: Could not obtain empty buffer", nss_ctx); - break; - } - -@@ -1947,7 +1948,7 @@ static void nss_core_alloc_max_avail_siz - * ERR: - */ - dev_kfree_skb_any(nbuf); -- nss_warning("%p: DMA mapping failed for empty buffer", nss_ctx); -+ nss_warning("%px: DMA mapping failed for empty buffer", nss_ctx); - break; - } - -@@ -2024,7 +2025,7 @@ static inline void nss_core_handle_empty - mask = size - 1; - count = ((nss_index - hlos_index - 1) + size) & (mask); - -- nss_trace("%p: Adding %d buffers to empty queue\n", nss_ctx, count); -+ nss_trace("%px: Adding %d buffers to empty queue\n", nss_ctx, count); - - /* - * Fill empty buffer queue with buffers leaving one empty descriptor -@@ -2075,7 +2076,7 @@ static inline void nss_core_handle_paged - - mask = size - 1; - count = ((nss_index - hlos_index - 1) + size) & (mask); -- nss_trace("%p: Adding %d buffers to paged buffer queue", nss_ctx, count); -+ nss_trace("%px: Adding %d buffers to paged buffer queue", nss_ctx, count); - - /* - * Fill empty buffer queue with buffers leaving one empty descriptor -@@ -2102,7 +2103,7 @@ static inline void nss_core_handle_paged - static inline void nss_core_handle_tx_unblocked(struct nss_ctx_instance *nss_ctx) - { - int32_t i; -- nss_trace("%p: Data queue unblocked", nss_ctx); -+ nss_trace("%px: Data queue unblocked", nss_ctx); - - /* - * Call callback functions of drivers that have registered with us -@@ -2154,7 +2155,7 @@ static void nss_core_handle_cause_nonque - nss_core_init_nss(nss_ctx, if_map); - nss_send_ddr_info(nss_ctx); - -- nss_info_always("%p: nss core %d booted successfully\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss core %d booted successfully\n", nss_ctx, nss_ctx->id); - nss_top = nss_ctx->nss_top; - - #ifdef NSS_DRV_C2C_ENABLE -@@ -2349,7 +2350,7 @@ int nss_core_handle_napi(struct napi_str - break; - - default: -- nss_warning("%p: Invalid cause %x received from nss", nss_ctx, int_cause); -+ nss_warning("%px: Invalid cause %x received from nss", nss_ctx, int_cause); - nss_assert(0); - break; - } -@@ -2706,7 +2707,7 @@ no_reuse: - bit_flags &= ~H2N_BIT_FLAG_BUFFER_REUSABLE; - frag0phyaddr = nss_core_dma_map_single(nss_ctx->dev, nbuf); - if (unlikely(dma_mapping_error(nss_ctx->dev, frag0phyaddr))) { -- nss_warning("%p: DMA mapping failed for virtual address = %p", nss_ctx, nbuf->head); -+ nss_warning("%px: DMA mapping failed for virtual address = %px", nss_ctx, nbuf->head); - return 0; - } - -@@ -2742,7 +2743,7 @@ static inline int32_t nss_core_send_buff - - uint32_t frag0phyaddr = nss_core_dma_map_single(nss_ctx->dev, nbuf); - if (unlikely(dma_mapping_error(nss_ctx->dev, frag0phyaddr))) { -- nss_warning("%p: DMA mapping failed for virtual address = %p", nss_ctx, nbuf->head); -+ nss_warning("%px: DMA mapping failed for virtual address = %px", nss_ctx, nbuf->head); - return 0; - } - -@@ -2782,7 +2783,7 @@ static inline int32_t nss_core_send_buff - - buffer = skb_frag_dma_map(nss_ctx->dev, frag, 0, skb_frag_size(frag), DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(nss_ctx->dev, buffer))) { -- nss_warning("%p: DMA mapping failed for fragment", nss_ctx); -+ nss_warning("%px: DMA mapping failed for fragment", nss_ctx); - nss_core_send_unwind_dma(nss_ctx->dev, desc_if, hlos_index, i + 1, false); - return -(i + 1); - } -@@ -2837,7 +2838,7 @@ static inline int32_t nss_core_send_buff - - uint32_t frag0phyaddr = nss_core_dma_map_single(nss_ctx->dev, nbuf); - if (unlikely(dma_mapping_error(nss_ctx->dev, frag0phyaddr))) { -- nss_warning("%p: DMA mapping failed for virtual address = %p", nss_ctx, nbuf->head); -+ nss_warning("%px: DMA mapping failed for virtual address = %px", nss_ctx, nbuf->head); - return 0; - } - -@@ -2876,7 +2877,7 @@ static inline int32_t nss_core_send_buff - - buffer = nss_core_dma_map_single(nss_ctx->dev, iter); - if (unlikely(dma_mapping_error(nss_ctx->dev, buffer))) { -- nss_warning("%p: DMA mapping failed for virtual address = %p", nss_ctx, iter->head); -+ nss_warning("%px: DMA mapping failed for virtual address = %px", nss_ctx, iter->head); - nss_core_send_unwind_dma(nss_ctx->dev, desc_if, hlos_index, i + 1, true); - return -(i+1); - } -@@ -2887,7 +2888,7 @@ static inline int32_t nss_core_send_buff - */ - nr_frags = skb_shinfo(iter)->nr_frags; - if (unlikely(nr_frags > 0)) { -- nss_warning("%p: fraglist with page data are not supported: %p\n", nss_ctx, iter); -+ nss_warning("%px: fraglist with page data are not supported: %px\n", nss_ctx, iter); - nss_core_send_unwind_dma(nss_ctx->dev, desc_if, hlos_index, i + 1, true); - return -(i+1); - } -@@ -2994,7 +2995,7 @@ int32_t nss_core_send_buffer(struct nss_ - * Check that segments do not overflow the number of descriptors - */ - if (unlikely(segments > size)) { -- nss_warning("%p: Unable to fit in skb - %d segments in our descriptors", nss_ctx, segments); -+ nss_warning("%px: Unable to fit in skb - %d segments in our descriptors", nss_ctx, segments); - return NSS_CORE_STATUS_FAILURE; - } - } -@@ -3025,7 +3026,7 @@ int32_t nss_core_send_buffer(struct nss_ - 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("%p: Data/Command Queue full reached", nss_ctx); -+ nss_warning("%px: Data/Command Queue full reached", nss_ctx); - - #if (NSS_PKT_STATS_ENABLED == 1) - if (nss_ctx->id == NSS_CORE_0) { -@@ -3033,7 +3034,7 @@ int32_t nss_core_send_buffer(struct nss_ - } 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("%p: Invalid nss core: %d\n", nss_ctx, nss_ctx->id); -+ nss_warning("%px: Invalid nss core: %d\n", nss_ctx, nss_ctx->id); - } - #endif - -@@ -3091,7 +3092,7 @@ int32_t nss_core_send_buffer(struct nss_ - /* - * We failed and hence we need to unmap dma regions - */ -- nss_warning("%p: failed to map DMA regions:%d", nss_ctx, -count); -+ nss_warning("%px: failed to map DMA regions:%d", nss_ctx, -count); - spin_unlock_bh(&h2n_desc_ring->lock); - return NSS_CORE_STATUS_FAILURE; - } -@@ -3145,18 +3146,18 @@ int32_t nss_core_send_cmd(struct nss_ctx - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: interface: %d type: %d message dropped as core not ready\n", nss_ctx, ncm->interface, ncm->type); -+ nss_warning("%px: interface: %d type: %d message dropped as core not ready\n", nss_ctx, ncm->interface, ncm->type); - return NSS_TX_FAILURE_NOT_READY; - } - - if (nss_cmn_get_msg_len(ncm) > size) { -- nss_warning("%p: interface: %d type: %d message length %d is invalid, size = %d\n", -+ nss_warning("%px: interface: %d type: %d message length %d is invalid, size = %d\n", - nss_ctx, ncm->interface, ncm->type, nss_cmn_get_msg_len(ncm), size); - return NSS_TX_FAILURE_TOO_LARGE; - } - - if (buf_size > PAGE_SIZE) { -- nss_warning("%p: interface: %d type: %d tx request size too large: %u", -+ nss_warning("%px: interface: %d type: %d tx request size too large: %u", - nss_ctx, ncm->interface, ncm->type, buf_size); - return NSS_TX_FAILURE_BAD_PARAM; - } -@@ -3164,7 +3165,7 @@ int32_t nss_core_send_cmd(struct nss_ctx - nbuf = dev_alloc_skb(buf_size); - if (unlikely(!nbuf)) { - NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_NBUF_ALLOC_FAILS]); -- nss_warning("%p: interface: %d type: %d msg dropped as command allocation failed", nss_ctx, ncm->interface, ncm->type); -+ nss_warning("%px: interface: %d type: %d msg dropped as command allocation failed", nss_ctx, ncm->interface, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -3174,7 +3175,7 @@ int32_t nss_core_send_cmd(struct nss_ctx - if (status != NSS_CORE_STATUS_SUCCESS) { - dev_kfree_skb_any(nbuf); - NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_CMD_QUEUE_FULL]); -- nss_warning("%p: interface: %d type: %d unable to enqueue message status %d\n", nss_ctx, ncm->interface, ncm->type, status); -+ nss_warning("%px: interface: %d type: %d unable to enqueue message status %d\n", nss_ctx, ncm->interface, ncm->type, status); - return status; - } - -@@ -3194,7 +3195,7 @@ int32_t nss_core_send_packet(struct nss_ - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: interface: %d packet dropped as core not ready\n", nss_ctx, if_num); -+ nss_warning("%px: interface: %d packet dropped as core not ready\n", nss_ctx, if_num); - return NSS_TX_FAILURE_NOT_READY; - } - -@@ -3206,7 +3207,7 @@ int32_t nss_core_send_packet(struct nss_ - #endif - status = nss_core_send_buffer(nss_ctx, if_num, nbuf, NSS_IF_H2N_DATA_QUEUE + queue_id, H2N_BUFFER_PACKET, flag); - if (status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: interface: %d unable to enqueue packet status %d\n", nss_ctx, if_num, status); -+ nss_warning("%px: interface: %d unable to enqueue packet status %d\n", nss_ctx, if_num, status); - return status; - } - ---- a/nss_core.h -+++ b/nss_core.h -@@ -556,12 +556,11 @@ struct nss_top_instance { - uint8_t tls_handler_id; - uint8_t mirror_handler_id; - uint8_t wmdb_handler_id; -+ uint8_t dma_handler_id; - - /* - * Data/Message callbacks for various interfaces - */ -- nss_if_rx_msg_callback_t if_rx_msg_callback[NSS_MAX_NET_INTERFACES]; -- /* All interfaces message callback functions */ - nss_phys_if_msg_callback_t phys_if_msg_callback[NSS_MAX_PHYSICAL_INTERFACES]; - /* Physical interface event callback functions */ - nss_virt_if_msg_callback_t virt_if_msg_callback[NSS_MAX_VIRTUAL_INTERFACES]; -@@ -909,7 +908,7 @@ static inline void nss_core_log_msg_fail - /* - * TODO: Is it worth doing value to name on these values? - */ -- nss_warning("%p: msg failure - interface: %d, type: %d, response: %d, error: %d", -+ nss_warning("%px: msg failure - interface: %d, type: %d, response: %d, error: %d", - nss_ctx, ncm->interface, ncm->type, ncm->response, ncm->error); - } - ---- a/nss_coredump.c -+++ b/nss_coredump.c -@@ -79,7 +79,7 @@ static int nss_panic_handler(struct noti - continue; - nss_ctx->state |= NSS_CORE_STATE_PANIC; - nss_hal_send_interrupt(nss_ctx, NSS_H2N_INTR_TRIGGER_COREDUMP); -- nss_warning("panic call NSS FW %p to dump %x\n", -+ nss_warning("panic call NSS FW %px to dump %x\n", - nss_ctx->nmap, nss_ctx->state); - } - -@@ -138,7 +138,7 @@ void nss_fw_coredump_notify(struct nss_c - dma_addr_t dma_addr; - uint32_t offset, index; - -- nss_warning("%p: COREDUMP %x Baddr %p stat %x", -+ nss_warning("%px: COREDUMP %x Baddr %px stat %x", - nss_own, intr, nss_own->nmap, nss_own->state); - nss_own->state |= NSS_CORE_STATE_FW_DEAD; - queue_delayed_work(coredump_workqueue, &coredump_queuewait, -@@ -161,7 +161,7 @@ void nss_fw_coredump_notify(struct nss_c - * only print whatever is in the buffer. Otherwise, dump last NSS_LOG_COREDUMP_LINE_NUM - * to the dmessage. - */ -- nss_info_always("%p: Starting NSS-FW logbuffer dump for core %u\n", -+ nss_info_always("%px: Starting NSS-FW logbuffer dump for core %u\n", - nss_own, nss_own->id); - nle_init = nld->log_ring_buffer; - if (nld->current_entry <= NSS_LOG_COREDUMP_LINE_NUM) { -@@ -183,7 +183,7 @@ void nss_fw_coredump_notify(struct nss_c - + offsetof(struct nss_log_descriptor, log_ring_buffer); - dma_sync_single_for_cpu(nss_own->dev, dma_addr + offset, - sizeof(struct nss_log_entry), DMA_FROM_DEVICE); -- nss_info_always("%p: %s\n", nss_own, nle_print->message); -+ nss_info_always("%px: %s\n", nss_own, nle_print->message); - nle_print++; - } - -@@ -223,7 +223,7 @@ void nss_fw_coredump_notify(struct nss_c - * Notify any live core to dump. - */ - if (!(nss_ctx->state & NSS_CORE_STATE_FW_DEAD) && nss_ctx->nmap) { -- nss_warning("notify NSS FW %p for coredump\n", nss_ctx->nmap); -+ nss_warning("notify NSS FW %px for coredump\n", nss_ctx->nmap); - nss_hal_send_interrupt(nss_ctx, NSS_H2N_INTR_TRIGGER_COREDUMP); - continue; - } ---- a/nss_crypto.c -+++ b/nss_crypto.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2013,2015-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013,2015-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -67,22 +67,22 @@ static void nss_crypto_msg_handler(struc - * Sanity check the message type - */ - if (ncm->type > NSS_CRYPTO_MSG_TYPE_MAX) { -- nss_warning("%p: rx message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: rx message type out of range: %d", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_crypto_msg)) { -- nss_warning("%p: rx message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: rx message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - - if (ncm->interface != NSS_CRYPTO_INTERFACE) { -- nss_warning("%p: rx message request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: rx message request for another interface: %d", nss_ctx, ncm->interface); - return; - } - - if (ncm->response == NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: rx message response for if %d, type %d, is invalid: %d", nss_ctx, ncm->interface, -+ nss_warning("%px: rx message response for if %d, type %d, is invalid: %d", nss_ctx, ncm->interface, - ncm->type, ncm->response); - return; - } -@@ -92,7 +92,6 @@ static void nss_crypto_msg_handler(struc - ncm->app_data = (nss_ptr_t)crypto_ctx; - } - -- - nss_core_log_msg_failures(nss_ctx, ncm); - - /* -@@ -105,7 +104,7 @@ static void nss_crypto_msg_handler(struc - */ - cb = (nss_crypto_msg_callback_t)ncm->cb; - if (unlikely(!cb)) { -- nss_trace("%p: rx handler has been unregistered for i/f: %d", nss_ctx, ncm->interface); -+ nss_trace("%px: rx handler has been unregistered for i/f: %d", nss_ctx, ncm->interface); - return; - } - cb((void *)ncm->app_data, nim); -@@ -124,20 +123,20 @@ nss_tx_status_t nss_crypto_tx_msg(struct - { - struct nss_cmn_msg *ncm = &msg->cm; - -- nss_info("%p: tx message %d for if %d\n", nss_ctx, ncm->type, ncm->interface); -+ nss_info("%px: tx message %d for if %d\n", nss_ctx, ncm->type, ncm->interface); - - BUILD_BUG_ON(NSS_NBUF_PAYLOAD_SIZE < sizeof(struct nss_crypto_msg)); - - if (ncm->interface != NSS_CRYPTO_INTERFACE) { -- nss_warning("%p: tx message request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx message request for another interface: %d", nss_ctx, ncm->interface); - } - - if (ncm->type > NSS_CRYPTO_MSG_TYPE_MAX) { -- nss_warning("%p: tx message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: tx message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -- nss_info("msg params version:%d, interface:%d, type:%d, cb:%p, app_data:%p, len:%d\n", -+ nss_info("msg params version:%d, interface:%d, type:%d, cb:%px, app_data:%px, len:%d\n", - ncm->version, ncm->interface, ncm->type, (void *)ncm->cb, (void *)ncm->app_data, ncm->len); - - /* -@@ -156,17 +155,17 @@ nss_tx_status_t nss_crypto_tx_buf(struct - { - int32_t status; - -- nss_trace("%p: tx_data buf=%p", nss_ctx, skb); -+ nss_trace("%px: tx_data buf=%px", nss_ctx, skb); - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: tx_data packet dropped as core not ready", nss_ctx); -+ nss_warning("%px: tx_data packet dropped as core not ready", nss_ctx); - return NSS_TX_FAILURE_NOT_READY; - } - - status = nss_core_send_buffer(nss_ctx, if_num, skb, NSS_IF_H2N_DATA_QUEUE, H2N_BUFFER_PACKET, H2N_BIT_FLAG_BUFFER_REUSABLE); - if (unlikely(status != NSS_CORE_STATUS_SUCCESS)) { -- nss_warning("%p: tx_data Unable to enqueue packet", nss_ctx); -+ nss_warning("%px: tx_data Unable to enqueue packet", nss_ctx); - if (status == NSS_CORE_STATUS_FAILURE_QUEUE) { - return NSS_TX_FAILURE_QUEUE; - } -@@ -226,7 +225,7 @@ struct nss_ctx_instance *nss_crypto_data - nss_ctx = &nss_top_main.nss[nss_top_main.crypto_handler_id]; - - if ((if_num >= NSS_MAX_NET_INTERFACES) && (if_num < NSS_MAX_PHYSICAL_INTERFACES)) { -- nss_warning("%p: data register received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: data register received for invalid interface %d", nss_ctx, if_num); - return NULL; - } - -@@ -245,7 +244,7 @@ struct nss_ctx_instance *nss_crypto_data - void nss_crypto_data_unregister(struct nss_ctx_instance *nss_ctx, uint32_t if_num) - { - if ((if_num >= NSS_MAX_NET_INTERFACES) && (if_num < NSS_MAX_PHYSICAL_INTERFACES)) { -- nss_warning("%p: data unregister received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: data unregister received for invalid interface %d", nss_ctx, if_num); - return; - } - ---- a/nss_crypto_cmn.c -+++ b/nss_crypto_cmn.c -@@ -62,7 +62,7 @@ static void nss_crypto_cmn_msg_handler(s - * Sanity check the message type - */ - if (ncm->type > NSS_CRYPTO_CMN_MSG_TYPE_MAX) { -- nss_warning("%p: rx message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: rx message type out of range: %d", nss_ctx, ncm->type); - return; - } - -@@ -72,12 +72,12 @@ static void nss_crypto_cmn_msg_handler(s - * the intended interface. - */ - if (nss_cmn_get_msg_len(ncm) > sizeof(*nim)) { -- nss_warning("%p: rx message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: rx message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - - if (ncm->response == NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: rx message response for if %d, type %d, is invalid: %d", nss_ctx, -+ nss_warning("%px: rx message response for if %d, type %d, is invalid: %d", nss_ctx, - ncm->interface, ncm->type, ncm->response); - return; - } -@@ -99,7 +99,7 @@ static void nss_crypto_cmn_msg_handler(s - */ - cb = (nss_crypto_cmn_msg_callback_t)ncm->cb; - if (unlikely(!cb)) { -- nss_warning("%p: rx handler has been unregistered for i/f: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: rx handler has been unregistered for i/f: %d", nss_ctx, ncm->interface); - return; - } - -@@ -115,12 +115,12 @@ nss_tx_status_t nss_crypto_cmn_tx_msg(st - struct nss_cmn_msg *ncm = &msg->cm; - uint16_t msg_len = nss_cmn_get_msg_len(ncm); - -- nss_info("%p: tx message %d for if %d", nss_ctx, ncm->type, ncm->interface); -+ nss_info("%px: tx message %d for if %d", nss_ctx, ncm->type, ncm->interface); - - BUILD_BUG_ON(NSS_NBUF_PAYLOAD_SIZE < sizeof(*msg)); - - if (ncm->type > NSS_CRYPTO_CMN_MSG_TYPE_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -129,11 +129,11 @@ nss_tx_status_t nss_crypto_cmn_tx_msg(st - * the sender accidentally programmed a incorrect length into the message. - */ - if (msg_len != sizeof(*msg)) { -- nss_warning("%p: message request len bad: %d", nss_ctx, msg_len); -+ nss_warning("%px: message request len bad: %d", nss_ctx, msg_len); - return NSS_TX_FAILURE_BAD_PARAM; - } - -- nss_trace("%p: msg params version:%d, interface:%d, type:%d, cb:%p, app_data:%p, len:%d", -+ nss_trace("%px: msg params version:%d, interface:%d, type:%d, cb:%px, app_data:%px, len:%d", - nss_ctx, ncm->version, ncm->interface, ncm->type, - (void *)ncm->cb, (void *)ncm->app_data, ncm->len); - -@@ -189,7 +189,7 @@ nss_tx_status_t nss_crypto_cmn_tx_msg_sy - - status = nss_crypto_cmn_tx_msg(nss_ctx, msg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: tx_msg failed", nss_ctx); -+ nss_warning("%px: tx_msg failed", nss_ctx); - up(&pvt->sem); - return status; - } -@@ -200,7 +200,7 @@ nss_tx_status_t nss_crypto_cmn_tx_msg_sy - ret = wait_for_completion_timeout(&pvt->complete, NSS_CRYPTO_CMN_TX_TIMEO_TICKS); - if (!ret) { - atomic_inc(&pvt->seq_no); -- nss_warning("%p: tx_msg_sync timed out", nss_ctx); -+ nss_warning("%px: tx_msg_sync timed out", nss_ctx); - up(&pvt->sem); - return NSS_TX_FAILURE; - } -@@ -229,7 +229,7 @@ nss_tx_status_t nss_crypto_cmn_tx_buf(st - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: tx_data packet dropped as core not ready", nss_ctx); -+ nss_warning("%px: tx_data packet dropped as core not ready", nss_ctx); - return NSS_TX_FAILURE_NOT_READY; - } - -@@ -239,11 +239,11 @@ nss_tx_status_t nss_crypto_cmn_tx_buf(st - break; - - case NSS_CORE_STATUS_FAILURE_QUEUE: /* queue full condition */ -- nss_warning("%p: H2N queue full for tx_buf", nss_ctx); -+ nss_warning("%px: H2N queue full for tx_buf", nss_ctx); - return NSS_TX_FAILURE_QUEUE; - - default: -- nss_warning("%p: general failure for tx_buf", nss_ctx); -+ nss_warning("%px: general failure for tx_buf", nss_ctx); - return NSS_TX_FAILURE; - } - -@@ -298,7 +298,7 @@ struct nss_ctx_instance *nss_crypto_cmn_ - nss_ctx = &nss_top_main.nss[nss_top_main.crypto_handler_id]; - - if (if_num < NSS_SPECIAL_IF_START) { -- nss_warning("%p: interface number is not special interface %d", nss_ctx, if_num); -+ nss_warning("%px: interface number is not special interface %d", nss_ctx, if_num); - return NULL; - } - -@@ -325,7 +325,7 @@ EXPORT_SYMBOL(nss_crypto_cmn_data_regist - void nss_crypto_cmn_data_unregister(struct nss_ctx_instance *nss_ctx, uint32_t if_num) - { - if (if_num < NSS_SPECIAL_IF_START) { -- nss_warning("%p: interface number is not special interface %d", nss_ctx, if_num); -+ nss_warning("%px: interface number is not special interface %d", nss_ctx, if_num); - return; - } - ---- a/nss_crypto_cmn_log.c -+++ b/nss_crypto_cmn_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -65,7 +65,7 @@ static int8_t *nss_crypto_cmn_log_error_ - static void nss_crypto_cmn_node_msg(struct nss_crypto_cmn_msg *ncm) - { - struct nss_crypto_cmn_node *ncnm __maybe_unused = &ncm->msg.node; -- nss_trace("%p: NSS crypto common node message:\n" -+ nss_trace("%px: NSS crypto common node message:\n" - "Crypto Common Max DMA Rings: %d\n" - "Crypto Common Max Contex: %d\n" - "Crypto Common Max Context Size: %d\n", -@@ -80,8 +80,8 @@ static void nss_crypto_cmn_node_msg(stru - static void nss_crypto_cmn_engine_msg(struct nss_crypto_cmn_msg *ncm) - { - struct nss_crypto_cmn_engine *ncem __maybe_unused = &ncm->msg.eng; -- nss_trace("%p: NSS crypto common engine message \n" -- "Crypto Common Firmware Version: %p\n" -+ nss_trace("%px: NSS crypto common engine message \n" -+ "Crypto Common Firmware Version: %px\n" - "Crypto Common DMA Mask: %x\n" - "Crypto Common Token Count: %d\n", - ncem, &ncem->fw_ver, -@@ -95,7 +95,7 @@ static void nss_crypto_cmn_engine_msg(st - static void nss_crypto_cmn_dma_msg(struct nss_crypto_cmn_msg *ncm) - { - struct nss_crypto_cmn_dma *ncdm __maybe_unused = &ncm->msg.dma; -- nss_trace("%p: NSS crypto common dma message \n" -+ nss_trace("%px: NSS crypto common dma message \n" - "Crypto Common DMA Pair ID: %d\n", - ncdm, ncdm->pair_id); - } -@@ -107,13 +107,13 @@ static void nss_crypto_cmn_dma_msg(struc - static void nss_crypto_cmn_ctx_msg(struct nss_crypto_cmn_msg *ncm) - { - struct nss_crypto_cmn_ctx *nccm __maybe_unused = &ncm->msg.ctx; -- nss_trace("%p: NSS crypto common context message \n" -- "Crypto Common Context Spare Words: %p\n" -+ nss_trace("%px: NSS crypto common context message \n" -+ "Crypto Common Context Spare Words: %px\n" - "Crypto Common Index: %d\n" - "Crypto Common Secure Offset: %d\n" -- "Crypto Common Cipher Key: %p\n" -- "Crypto Common Authorization Key: %p\n" -- "Crypto Common Nonce Value: %p\n" -+ "Crypto Common Cipher Key: %px\n" -+ "Crypto Common Authorization Key: %px\n" -+ "Crypto Common Nonce Value: %px\n" - "Crypto Common Algorithm: %x\n" - "Crypto Common Context Specific Flags: %x\n", - nccm, &nccm->spare, -@@ -154,7 +154,7 @@ static void nss_crypto_cmn_log_verbose(s - break; - - default: -- nss_warning("%p: Invalid message type\n", ncm); -+ nss_warning("%px: Invalid message type\n", ncm); - break; - } - } -@@ -166,11 +166,11 @@ static void nss_crypto_cmn_log_verbose(s - void nss_crypto_cmn_log_tx_msg(struct nss_crypto_cmn_msg *ncm) - { - if (ncm->cm.type >= NSS_CRYPTO_CMN_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", ncm); -+ nss_warning("%px: Invalid message type\n", ncm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ncm, ncm->cm.type, nss_crypto_cmn_log_message_types_str[ncm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ncm, ncm->cm.type, nss_crypto_cmn_log_message_types_str[ncm->cm.type]); - nss_crypto_cmn_log_verbose(ncm); - } - -@@ -181,26 +181,26 @@ void nss_crypto_cmn_log_tx_msg(struct ns - void nss_crypto_cmn_log_rx_msg(struct nss_crypto_cmn_msg *ncm) - { - if (ncm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ncm); -+ nss_warning("%px: Invalid response\n", ncm); - return; - } - - if (ncm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ncm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, - nss_crypto_cmn_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response]); - goto verbose; - } - - if (ncm->cm.error >= NSS_CRYPTO_CMN_MSG_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ncm, ncm->cm.type, nss_crypto_cmn_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ncm, ncm->cm.type, nss_crypto_cmn_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error, nss_crypto_cmn_log_error_response_types_str[ncm->cm.error]); ---- a/nss_crypto_log.c -+++ b/nss_crypto_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -53,12 +53,12 @@ static int8_t *nss_crypto_log_error_resp - static void nss_crypto_config_eng_msg(struct nss_crypto_msg *ncm) - { - struct nss_crypto_config_eng *nccem __maybe_unused = &ncm->msg.eng; -- nss_trace("%p: NSS Crypto Config Engine Message:\n" -+ nss_trace("%px: NSS Crypto Config Engine Message:\n" - "Crypto Engine Number: %d\n" - "Crypto BAM Physical Base Address: %x\n" - "Crypto Physical Base Address: %x\n" -- "Crypto Pipe Description Address: %p\n" -- "Crypto Session Indices: %p\n", -+ "Crypto Pipe Description Address: %px\n" -+ "Crypto Session Indices: %px\n", - nccem, nccem->eng_id, - nccem->bam_pbase, nccem->crypto_pbase, - &nccem->desc_paddr, &nccem->idx); -@@ -71,7 +71,7 @@ static void nss_crypto_config_eng_msg(st - static void nss_crypto_config_session_msg(struct nss_crypto_msg *ncm) - { - struct nss_crypto_config_session *nccsm __maybe_unused = &ncm->msg.session; -- nss_trace("%p: NSS Crypto Config Session message \n" -+ nss_trace("%px: NSS Crypto Config Session message \n" - "Crypto Session Index: %d\n" - "Crypto Session State: %d\n" - "Crypto Session Initialization Vector Length: %d\n", -@@ -95,7 +95,7 @@ static void nss_crypto_log_verbose(struc - break; - - default: -- nss_warning("%p: Invalid message type\n", ncm); -+ nss_warning("%px: Invalid message type\n", ncm); - break; - } - } -@@ -107,11 +107,11 @@ static void nss_crypto_log_verbose(struc - void nss_crypto_log_tx_msg(struct nss_crypto_msg *ncm) - { - if (ncm->cm.type >= NSS_CRYPTO_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", ncm); -+ nss_warning("%px: Invalid message type\n", ncm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ncm, ncm->cm.type, nss_crypto_log_message_types_str[ncm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ncm, ncm->cm.type, nss_crypto_log_message_types_str[ncm->cm.type]); - nss_crypto_log_verbose(ncm); - } - -@@ -122,26 +122,26 @@ void nss_crypto_log_tx_msg(struct nss_cr - void nss_crypto_log_rx_msg(struct nss_crypto_msg *ncm) - { - if (ncm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ncm); -+ nss_warning("%px: Invalid response\n", ncm); - return; - } - - if (ncm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ncm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, - nss_crypto_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response]); - goto verbose; - } - - if (ncm->cm.error >= NSS_CRYPTO_MSG_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ncm, ncm->cm.type, nss_crypto_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ncm, ncm->cm.type, nss_crypto_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error, nss_crypto_log_error_response_types_str[ncm->cm.error]); ---- /dev/null -+++ b/nss_data_plane/hal/include/nss_data_plane_hal.h -@@ -0,0 +1,37 @@ -+/* -+ * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for any -+ * purpose with or without fee is hereby granted, provided that the above -+ * copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ */ -+ -+#include "nss_phys_if.h" -+#include -+ -+/* -+ * nss_data_plane_param -+ */ -+struct nss_data_plane_param { -+ struct nss_dp_data_plane_ctx dpc; /* data plane ctx base class */ -+ int if_num; /* physical interface number */ -+ struct nss_ctx_instance *nss_ctx; /* which nss core */ -+ struct nss_dp_gmac_stats gmac_stats; /* SoC specific stats for GMAC */ -+ int notify_open; /* This data plane interface has been opened or not */ -+ uint32_t features; /* skb types supported by this interface */ -+ uint32_t bypass_nw_process; /* Do we want to bypass NW processing in NSS for this data plane? */ -+}; -+ -+void nss_data_plane_hal_add_dp_ops(struct nss_dp_data_plane_ops *dp_ops); -+void nss_data_plane_hal_register(struct nss_ctx_instance *nss_ctx); -+void nss_data_plane_hal_unregister(struct nss_ctx_instance *nss_ctx); -+uint16_t nss_data_plane_hal_get_mtu_sz(uint16_t mtu); -+void nss_data_plane_hal_stats_sync(struct nss_data_plane_param *ndpp, struct nss_phys_if_stats *stats); ---- /dev/null -+++ b/nss_data_plane/hal/nss_ipq60xx.c -@@ -0,0 +1,106 @@ -+/* -+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for any -+ * purpose with or without fee is hereby granted, provided that the above -+ * copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ */ -+ -+#include "nss_core.h" -+#include "nss_data_plane_hal.h" -+ -+/* -+ * nss_data_plane_hal_vsi_assign() -+ * Called by nss-dp to assign vsi of a data plane -+ */ -+static int nss_data_plane_hal_vsi_assign(struct nss_dp_data_plane_ctx *dpc, uint32_t vsi) -+{ -+ struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; -+ -+ return nss_phys_if_vsi_assign(dp->nss_ctx, vsi, dp->if_num); -+} -+ -+/* -+ * nss_data_plane_hal_vsi_unassign() -+ * Called by nss-dp to unassign vsi of a data plane -+ */ -+static int nss_data_plane_hal_vsi_unassign(struct nss_dp_data_plane_ctx *dpc, uint32_t vsi) -+{ -+ struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; -+ -+ return nss_phys_if_vsi_unassign(dp->nss_ctx, vsi, dp->if_num); -+} -+ -+/* -+ * nss_data_plane_hal_get_stats() -+ * Called by nss-dp to get GMAC stats -+ */ -+static void nss_data_plane_hal_get_stats(struct nss_dp_data_plane_ctx *dpc, -+ struct nss_dp_gmac_stats *stats) -+{ -+ /* -+ * EDMA doesn't send extended statistics. -+ */ -+} -+ -+/* -+ * nss_data_plane_hal_add_dp_ops() -+ */ -+void nss_data_plane_hal_add_dp_ops(struct nss_dp_data_plane_ops *dp_ops) -+{ -+ dp_ops->vsi_assign = nss_data_plane_hal_vsi_assign; -+ dp_ops->vsi_unassign = nss_data_plane_hal_vsi_unassign; -+ dp_ops->get_stats = nss_data_plane_hal_get_stats; -+} -+ -+/* -+ * nss_data_plane_hal_register() -+ */ -+void nss_data_plane_hal_register(struct nss_ctx_instance *nss_ctx) -+{ -+ /* -+ * Packets with the ptp service code should be delivered to -+ * PHY driver for timestamping. -+ */ -+ nss_cmn_register_service_code(nss_ctx, nss_phy_tstamp_rx_buf, -+ NSS_PTP_EVENT_SERVICE_CODE, nss_ctx); -+} -+ -+/* -+ * nss_data_plane_hal_unregister() -+ */ -+void nss_data_plane_hal_unregister(struct nss_ctx_instance *nss_ctx) -+{ -+ nss_cmn_unregister_service_code(nss_ctx, nss_phy_tstamp_rx_buf, -+ NSS_PTP_EVENT_SERVICE_CODE); -+} -+ -+/* -+ * nss_data_plane_hal_stats_sync() -+ */ -+void nss_data_plane_hal_stats_sync(struct nss_data_plane_param *ndpp, -+ struct nss_phys_if_stats *stats) -+{ -+ /* -+ * EDMA does not pass sync interface stats through phys_if_stats -+ */ -+} -+ -+/* -+ * nss_data_plane_hal_get_mtu_sz() -+ */ -+uint16_t nss_data_plane_hal_get_mtu_sz(uint16_t mtu) -+{ -+ /* -+ * Reserve space for preheader -+ */ -+ return mtu + NSS_DP_PREHEADER_SIZE; -+} ---- /dev/null -+++ b/nss_data_plane/hal/nss_ipq807x.c -@@ -0,0 +1,106 @@ -+/* -+ * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for any -+ * purpose with or without fee is hereby granted, provided that the above -+ * copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ */ -+ -+#include "nss_core.h" -+#include "nss_data_plane_hal.h" -+ -+/* -+ * nss_data_plane_hal_vsi_assign() -+ * Called by nss-dp to assign vsi of a data plane -+ */ -+static int nss_data_plane_hal_vsi_assign(struct nss_dp_data_plane_ctx *dpc, uint32_t vsi) -+{ -+ struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; -+ -+ return nss_phys_if_vsi_assign(dp->nss_ctx, vsi, dp->if_num); -+} -+ -+/* -+ * nss_data_plane_hal_vsi_unassign() -+ * Called by nss-dp to unassign vsi of a data plane -+ */ -+static int nss_data_plane_hal_vsi_unassign(struct nss_dp_data_plane_ctx *dpc, uint32_t vsi) -+{ -+ struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; -+ -+ return nss_phys_if_vsi_unassign(dp->nss_ctx, vsi, dp->if_num); -+} -+ -+/* -+ * nss_data_plane_hal_get_stats() -+ * Called by nss-dp to get GMAC stats -+ */ -+static void nss_data_plane_hal_get_stats(struct nss_dp_data_plane_ctx *dpc, -+ struct nss_dp_gmac_stats *stats) -+{ -+ /* -+ * EDMA doesn't send extended statistics. -+ */ -+} -+ -+/* -+ * nss_data_plane_hal_add_dp_ops() -+ */ -+void nss_data_plane_hal_add_dp_ops(struct nss_dp_data_plane_ops *dp_ops) -+{ -+ dp_ops->vsi_assign = nss_data_plane_hal_vsi_assign; -+ dp_ops->vsi_unassign = nss_data_plane_hal_vsi_unassign; -+ dp_ops->get_stats = nss_data_plane_hal_get_stats; -+} -+ -+/* -+ * nss_data_plane_hal_register() -+ */ -+void nss_data_plane_hal_register(struct nss_ctx_instance *nss_ctx) -+{ -+ /* -+ * Packets with the ptp service code should be delivered to -+ * PHY driver for timestamping. -+ */ -+ nss_cmn_register_service_code(nss_ctx, nss_phy_tstamp_rx_buf, -+ NSS_PTP_EVENT_SERVICE_CODE, nss_ctx); -+} -+ -+/* -+ * nss_data_plane_hal_unregister() -+ */ -+void nss_data_plane_hal_unregister(struct nss_ctx_instance *nss_ctx) -+{ -+ nss_cmn_unregister_service_code(nss_ctx, nss_phy_tstamp_rx_buf, -+ NSS_PTP_EVENT_SERVICE_CODE); -+} -+ -+/* -+ * nss_data_plane_hal_stats_sync() -+ */ -+void nss_data_plane_hal_stats_sync(struct nss_data_plane_param *ndpp, -+ struct nss_phys_if_stats *stats) -+{ -+ /* -+ * EDMA does not pass sync interface stats through phys_if_stats -+ */ -+} -+ -+/* -+ * nss_data_plane_hal_get_mtu_sz() -+ */ -+uint16_t nss_data_plane_hal_get_mtu_sz(uint16_t mtu) -+{ -+ /* -+ * Reserve space for preheader -+ */ -+ return mtu + NSS_DP_PREHEADER_SIZE; -+} ---- 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, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2017,2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -54,7 +54,7 @@ struct nss_data_plane_ops { - }; - - extern struct nss_data_plane_ops nss_data_plane_gmac_ops; --extern struct nss_data_plane_ops nss_data_plane_edma_ops; -+extern struct nss_data_plane_ops nss_data_plane_ops; - - extern int nss_skip_nw_process; - #endif ---- a/nss_data_plane/nss_data_plane.c -+++ b/nss_data_plane/nss_data_plane.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -16,69 +16,390 @@ - - #include "nss_data_plane.h" - #include "nss_core.h" -+#include "nss_tx_rx_common.h" -+#include "nss_data_plane_hal.h" - --static struct delayed_work nss_data_plane_work; --static struct workqueue_struct *nss_data_plane_workqueue; -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)) -+#define NSS_DATA_PLANE_SUPPORTED_FEATURES (NETIF_F_HIGHDMA \ -+ | NETIF_F_HW_CSUM \ -+ | NETIF_F_RXCSUM \ -+ | NETIF_F_SG \ -+ | NETIF_F_FRAGLIST \ -+ | (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO)) -+#else -+#define NSS_DATA_PLANE_SUPPORTED_FEATURES (NETIF_F_HIGHDMA \ -+ | NETIF_F_HW_CSUM \ -+ | NETIF_F_RXCSUM \ -+ | NETIF_F_SG \ -+ | NETIF_F_FRAGLIST \ -+ | (NETIF_F_TSO | NETIF_F_TSO6)) -+#endif - --extern bool pn_mq_en; --extern uint16_t pn_qlimits[NSS_MAX_NUM_PRI]; -+/* -+ * nss_data_plane_param -+ */ -+struct nss_data_plane_param nss_data_plane_params[NSS_DP_MAX_INTERFACES]; - - /* -- * nss_data_plane_work_function() -- * Work function that gets queued to "install" the data plane overlays -+ * __nss_data_plane_init() - */ --static void nss_data_plane_work_function(struct work_struct *work) -+static int __nss_data_plane_init(struct nss_dp_data_plane_ctx *dpc) - { -- int ret; -- struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[NSS_CORE_0]; -- struct nss_top_instance *nss_top = nss_ctx->nss_top; -+ struct net_device *netdev = dpc->dev; -+ netdev->needed_headroom += 32; -+ return NSS_DP_SUCCESS; -+} -+ -+/* -+ * __nss_data_plane_open() -+ * Called by nss-dp to notify open to nss-fw -+ */ -+static int __nss_data_plane_open(struct nss_dp_data_plane_ctx *dpc, uint32_t tx_desc_ring, uint32_t rx_desc_ring, uint32_t mode) -+{ -+ struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; -+ -+ if (dp->notify_open) { -+ return NSS_DP_SUCCESS; -+ } -+ -+ if (nss_phys_if_open(dp->nss_ctx, tx_desc_ring, rx_desc_ring, mode, dp->if_num, dp->bypass_nw_process) == NSS_TX_SUCCESS) { -+ dp->notify_open = 1; -+ return NSS_DP_SUCCESS; -+ } -+ return NSS_DP_FAILURE; -+} -+ -+/* -+ * __nss_data_plane_close() -+ * Called by nss-dp to notify close to nss-fw -+ */ -+static int __nss_data_plane_close(struct nss_dp_data_plane_ctx *dpc) -+{ -+ struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; -+ -+ if (!dp->notify_open) { -+ return NSS_DP_SUCCESS; -+ } -+ -+ if (nss_phys_if_close(dp->nss_ctx, dp->if_num) == NSS_TX_SUCCESS) { -+ dp->notify_open = 0; -+ return NSS_DP_SUCCESS; -+ } -+ return NSS_DP_FAILURE; -+} -+ -+/* -+ * __nss_data_plane_link_state() -+ * Called by nss-dp to notify link state change to nss-fw -+ */ -+static int __nss_data_plane_link_state(struct nss_dp_data_plane_ctx *dpc, uint32_t link_state) -+{ -+ struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; -+ -+ return nss_phys_if_link_state(dp->nss_ctx, link_state, dp->if_num); -+} -+ -+/* -+ * __nss_data_plane_mac_addr() -+ * Called by nss-dp to set mac address -+ */ -+static int __nss_data_plane_mac_addr(struct nss_dp_data_plane_ctx *dpc, uint8_t *addr) -+{ -+ struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; - -+ return nss_phys_if_mac_addr(dp->nss_ctx, addr, dp->if_num); -+} -+ -+/* -+ * __nss_data_plane_change_mtu() -+ * Called by nss-dp to change mtu of a data plane -+ */ -+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); -+} -+ -+/* -+ * __nss_data_plane_pause_on_off() -+ * Called by nss-dp to enable/disable pause frames -+ */ -+static int __nss_data_plane_pause_on_off(struct nss_dp_data_plane_ctx *dpc, uint32_t pause_on) -+{ -+ struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; -+ -+ return nss_phys_if_pause_on_off(dp->nss_ctx, pause_on, dp->if_num); -+} -+ -+#ifdef NSS_DRV_QRFS_ENABLE -+/* -+ * __nss_data_plane_rx_flow_steer() -+ * Called by nss-dp to set flow rule of a data plane -+ */ -+static int __nss_data_plane_rx_flow_steer(struct nss_dp_data_plane_ctx *dpc, struct sk_buff *skb, -+ uint32_t cpu, bool is_add) -+{ -+ if (is_add) { -+ return nss_qrfs_set_flow_rule(skb, cpu, NSS_QRFS_MSG_FLOW_ADD); -+ } -+ -+ return nss_qrfs_set_flow_rule(skb, cpu, NSS_QRFS_MSG_FLOW_DELETE); -+} -+#endif -+ -+/* -+ * __nss_data_plane_deinit() -+ * Place holder for nss-dp ops to free NSS data plane resources -+ */ -+static int __nss_data_plane_deinit(struct nss_dp_data_plane_ctx *dpc) -+{ - /* -- * The queue config command is a synchronous command and needs to be issued -- * in process context, before NSS data plane switch. -+ * TODO: Implement free up of NSS data plane resources - */ -- ret = nss_n2h_update_queue_config_sync(nss_ctx, pn_mq_en, pn_qlimits); -- if (ret != NSS_TX_SUCCESS) { -- nss_warning("Failed to send pnode queue config to core 0\n"); -+ return NSS_TX_SUCCESS; -+} -+ -+/* -+ * __nss_data_plane_buf() -+ * Called by nss-dp to pass a sk_buff for xmit -+ */ -+static netdev_tx_t __nss_data_plane_buf(struct nss_dp_data_plane_ctx *dpc, struct sk_buff *skb) -+{ -+ struct nss_data_plane_param *dp = (struct nss_data_plane_param *)dpc; -+ int extra_head = dpc->dev->needed_headroom - skb_headroom(skb); -+ int extra_tail = 0; -+ nss_tx_status_t status; -+ struct net_device *dev = dpc->dev; -+ -+ if (skb->len < ETH_HLEN) { -+ nss_warning("skb->len ( %u ) < ETH_HLEN ( %u ) \n", skb->len, ETH_HLEN); -+ goto drop; - } - -- nss_top->data_plane_ops->data_plane_register(nss_ctx); -+ 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); -+ goto drop; -+ } -+ -+ if (skb_cloned(skb) || extra_head > 0) { -+ /* -+ * If it is a clone and headroom is already enough, -+ * We just make a copy and clear the clone flag. -+ */ -+ if (extra_head <= 0) -+ extra_head = extra_tail = 0; -+ /* -+ * If tailroom is enough to accommodate the added headroom, -+ * then allocate a buffer of same size and do relocations. -+ * It might help kmalloc_reserve() not double the size. -+ */ -+ if (skb->end - skb->tail >= extra_head) -+ extra_tail = -extra_head; -+ -+ if (pskb_expand_head(skb, extra_head, extra_tail, GFP_ATOMIC)) { -+ nss_warning("%px: Unable to expand skb for headroom\n", dp); -+ goto drop; -+ } -+ } -+ -+ status = nss_phys_if_buf(dp->nss_ctx, skb, dp->if_num); -+ if (likely(status == NSS_TX_SUCCESS)) { -+ return NETDEV_TX_OK; -+ } else if (status == NSS_TX_FAILURE_QUEUE) { -+ return NETDEV_TX_BUSY; -+ } -+ -+drop: -+ dev_kfree_skb_any(skb); -+ dev->stats.tx_dropped++; -+ -+ return NETDEV_TX_OK; -+} -+ -+/* -+ * __nss_data_plane_set_features() -+ * Called by nss-dp to allow data plane to modify the set of features it supports -+ */ -+static void __nss_data_plane_set_features(struct nss_dp_data_plane_ctx *dpc) -+{ -+ dpc->dev->features |= NSS_DATA_PLANE_SUPPORTED_FEATURES; -+ dpc->dev->hw_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES; -+ dpc->dev->vlan_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES; -+ dpc->dev->wanted_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES; - } - - /* -- * nss_data_plane_schedule_registration() -- * Called from nss_init to schedule a work to do data_plane register to data plane host -+ * nss offload data plane ops - */ --bool nss_data_plane_schedule_registration(void) -+static struct nss_dp_data_plane_ops dp_ops = { -+ .init = __nss_data_plane_init, -+ .open = __nss_data_plane_open, -+ .close = __nss_data_plane_close, -+ .link_state = __nss_data_plane_link_state, -+ .mac_addr = __nss_data_plane_mac_addr, -+ .change_mtu = __nss_data_plane_change_mtu, -+ .xmit = __nss_data_plane_buf, -+ .set_features = __nss_data_plane_set_features, -+ .pause_on_off = __nss_data_plane_pause_on_off, -+#ifdef NSS_DRV_QRFS_ENABLE -+ .rx_flow_steer = __nss_data_plane_rx_flow_steer, -+#endif -+ .deinit = __nss_data_plane_deinit, -+}; -+ -+/* -+ * nss_data_plane_register_to_nss_dp() -+ */ -+static bool nss_data_plane_register_to_nss_dp(struct nss_ctx_instance *nss_ctx, int if_num) - { -- if (!queue_work_on(1, nss_data_plane_workqueue, &nss_data_plane_work.work)) { -- nss_warning("Failed to register data plane workqueue on core 1\n"); -+ struct nss_data_plane_param *ndpp = &nss_data_plane_params[if_num]; -+ struct nss_top_instance *nss_top = nss_ctx->nss_top; -+ struct net_device *netdev; -+ bool is_open; -+ int core; -+ -+ netdev = nss_dp_get_netdev_by_nss_if_num(if_num); -+ if (!netdev) { -+ nss_info("%px: Platform don't have data plane%d enabled, \ -+ don't bring up nss_phys_if and don't register to nss-dp\n", -+ nss_ctx, if_num); - return false; - } - -- nss_info("Register data plane workqueue on core 1\n"); -+ is_open = nss_dp_is_in_open_state(netdev); -+ ndpp->dpc.dev = netdev; -+ ndpp->nss_ctx = nss_ctx; -+ ndpp->if_num = if_num; -+ ndpp->notify_open = 0; -+ ndpp->features = 0; -+ -+ /* -+ * Add data plane ops applicable to this SoC. -+ */ -+ nss_data_plane_hal_add_dp_ops(&dp_ops); -+ -+ /* -+ * Check if NSS NW processing to be bypassed for this data plane -+ */ -+ if (nss_skip_nw_process) { -+ ndpp->bypass_nw_process = 1; -+ } else { -+ ndpp->bypass_nw_process = 0; -+ } -+ -+ if (nss_dp_override_data_plane(netdev, &dp_ops, (struct nss_dp_data_plane_ctx *)ndpp) != NSS_DP_SUCCESS) { -+ nss_info("%px: Override nss-dp data plane for port %dfailed\n", nss_ctx, if_num); -+ return false; -+ } -+ -+ /* -+ * Setup the receive callback so that data pkts received form NSS-FW will -+ * be redirected to the nss-dp driver as we are overriding the data plane -+ */ -+ nss_top->phys_if_handler_id[if_num] = nss_ctx->id; -+ nss_phys_if_register_handler(nss_ctx, if_num); -+ -+ /* -+ * Packets recieved on physical interface can be exceptioned to HLOS -+ * from any NSS core so we need to register data plane for all -+ */ -+ for (core = 0; core < nss_top->num_nss; core++) { -+ nss_core_register_subsys_dp(&nss_top->nss[core], if_num, nss_dp_receive, NULL, NULL, netdev, ndpp->features); -+ } -+ -+ /* -+ * Now we are registered and our side is ready, if the data plane was opened, ask it to start again -+ */ -+ if (is_open) { -+ nss_dp_start_data_plane(netdev, (struct nss_dp_data_plane_ctx *)ndpp); -+ } - return true; - } - - /* -- * nss_data_plane_init_delay_work() -+ * nss_data_plane_unregister_from_nss_dp() -+ */ -+static void nss_data_plane_unregister_from_nss_dp(int if_num) -+{ -+ /* -+ * Do any SoC specific un-registrations. -+ */ -+ nss_data_plane_hal_unregister(nss_data_plane_params[if_num].nss_ctx); -+ -+ nss_dp_restore_data_plane(nss_data_plane_params[if_num].dpc.dev); -+ nss_data_plane_params[if_num].dpc.dev = NULL; -+ nss_data_plane_params[if_num].nss_ctx = NULL; -+ nss_data_plane_params[if_num].if_num = 0; -+ nss_data_plane_params[if_num].notify_open = 0; -+ nss_data_plane_params[if_num].bypass_nw_process = 0; -+} -+ -+/* -+ * __nss_data_plane_register() - */ --int nss_data_plane_init_delay_work(void) -+static void __nss_data_plane_register(struct nss_ctx_instance *nss_ctx) - { -- nss_data_plane_workqueue = create_singlethread_workqueue("nss_data_plane_workqueue"); -- if (!nss_data_plane_workqueue) { -- nss_warning("Can't allocate workqueue\n"); -- return -ENOMEM; -+ int i; -+ -+ for (i = NSS_DP_START_IFNUM; i < NSS_DP_MAX_INTERFACES; i++) { -+ if (!nss_data_plane_register_to_nss_dp(nss_ctx, i)) { -+ nss_warning("%px: Register data plane failed for data plane %d\n", nss_ctx, i); -+ } else { -+ nss_info("%px: Register data plan to data plane %d success\n", nss_ctx, i); -+ } - } - -- INIT_DELAYED_WORK(&nss_data_plane_work, nss_data_plane_work_function); -- return 0; -+ /* -+ * Do any SoC specific registrations. -+ */ -+ nss_data_plane_hal_register(nss_ctx); - } - - /* -- * nss_data_plane_destroy_delay_work() -+ * __nss_data_plane_unregister() - */ --void nss_data_plane_destroy_delay_work(void) -+static void __nss_data_plane_unregister(void) - { -- destroy_workqueue(nss_data_plane_workqueue); -+ int i, core; -+ -+ for (core = 0; core < nss_top_main.num_nss; core++) { -+ for (i = NSS_DP_START_IFNUM; i < NSS_DP_MAX_INTERFACES; i++) { -+ if (nss_top_main.nss[core].subsys_dp_register[i].ndev) { -+ nss_data_plane_unregister_from_nss_dp(i); -+ nss_core_unregister_subsys_dp(&nss_top_main.nss[core], i); -+ } -+ } -+ } -+} -+ -+/* -+ * __nss_data_plane_stats_sync() -+ */ -+static void __nss_data_plane_stats_sync(struct nss_phys_if_stats *stats, uint16_t interface) -+{ -+ nss_data_plane_hal_stats_sync(&nss_data_plane_params[interface], stats); - } -+ -+/* -+ * __nss_data_plane_get_mtu_sz() -+ */ -+static uint16_t __nss_data_plane_get_mtu_sz(uint16_t mtu) -+{ -+ return nss_data_plane_hal_get_mtu_sz(mtu); -+} -+ -+/* -+ * nss_data_plane_ops -+ */ -+struct nss_data_plane_ops nss_data_plane_ops = { -+ .data_plane_register = &__nss_data_plane_register, -+ .data_plane_unregister = &__nss_data_plane_unregister, -+ .data_plane_stats_sync = &__nss_data_plane_stats_sync, -+ .data_plane_get_mtu_sz = &__nss_data_plane_get_mtu_sz, -+}; ---- /dev/null -+++ b/nss_data_plane/nss_data_plane_common.c -@@ -0,0 +1,84 @@ -+/* -+ ************************************************************************** -+ * Copyright (c) 2014-2016,2020 The Linux Foundation. All rights reserved. -+ * Permission to use, copy, modify, and/or distribute this software for -+ * any purpose with or without fee is hereby granted, provided that the -+ * above copyright notice and this permission notice appear in all copies. -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ ************************************************************************** -+ */ -+ -+#include "nss_data_plane.h" -+#include "nss_core.h" -+ -+static struct delayed_work nss_data_plane_work; -+static struct workqueue_struct *nss_data_plane_workqueue; -+ -+extern bool pn_mq_en; -+extern uint16_t pn_qlimits[NSS_MAX_NUM_PRI]; -+ -+/* -+ * nss_data_plane_work_function() -+ * Work function that gets queued to "install" the data plane overlays -+ */ -+static void nss_data_plane_work_function(struct work_struct *work) -+{ -+ int ret; -+ struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[NSS_CORE_0]; -+ struct nss_top_instance *nss_top = nss_ctx->nss_top; -+ -+ /* -+ * The queue config command is a synchronous command and needs to be issued -+ * in process context, before NSS data plane switch. -+ */ -+ ret = nss_n2h_update_queue_config_sync(nss_ctx, pn_mq_en, pn_qlimits); -+ if (ret != NSS_TX_SUCCESS) { -+ nss_warning("Failed to send pnode queue config to core 0\n"); -+ } -+ -+ nss_top->data_plane_ops->data_plane_register(nss_ctx); -+} -+ -+/* -+ * nss_data_plane_schedule_registration() -+ * Called from nss_init to schedule a work to do data_plane register to data plane host -+ */ -+bool nss_data_plane_schedule_registration(void) -+{ -+ if (!queue_work_on(1, nss_data_plane_workqueue, &nss_data_plane_work.work)) { -+ nss_warning("Failed to register data plane workqueue on core 1\n"); -+ return false; -+ } -+ -+ nss_info("Register data plane workqueue on core 1\n"); -+ return true; -+} -+ -+/* -+ * nss_data_plane_init_delay_work() -+ */ -+int nss_data_plane_init_delay_work(void) -+{ -+ nss_data_plane_workqueue = create_singlethread_workqueue("nss_data_plane_workqueue"); -+ if (!nss_data_plane_workqueue) { -+ nss_warning("Can't allocate workqueue\n"); -+ return -ENOMEM; -+ } -+ -+ INIT_DELAYED_WORK(&nss_data_plane_work, nss_data_plane_work_function); -+ return 0; -+} -+ -+/* -+ * nss_data_plane_destroy_delay_work() -+ */ -+void nss_data_plane_destroy_delay_work(void) -+{ -+ destroy_workqueue(nss_data_plane_workqueue); -+} ---- a/nss_data_plane/nss_data_plane_edma.c -+++ /dev/null -@@ -1,425 +0,0 @@ --/* -- ************************************************************************** -- * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. -- * Permission to use, copy, modify, and/or distribute this software for -- * any purpose with or without fee is hereby granted, provided that the -- * above copyright notice and this permission notice appear in all copies. -- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ************************************************************************** -- */ -- --#include "nss_data_plane.h" --#include "nss_core.h" --#include "nss_tx_rx_common.h" --#include -- --#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)) --#define NSS_DP_EDMA_SUPPORTED_FEATURES (NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_FRAGLIST | (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO)) --#else --#define NSS_DP_EDMA_SUPPORTED_FEATURES (NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_FRAGLIST | (NETIF_F_TSO | NETIF_F_TSO6)) --#endif --#define NSS_DATA_PLANE_EDMA_MAX_INTERFACES 6 --#define NSS_DATA_PLANE_EDMA_MAX_MTU_SIZE 9216 --#define NSS_DATA_PLANE_EDMA_PREHEADER_SIZE 32 --#define NSS_DATA_PLANE_EDMA_MAX_PACKET_LEN 65535 -- --/* -- * nss_data_plane_edma_param -- */ --struct nss_data_plane_edma_param { -- struct nss_dp_data_plane_ctx dpc; /* data plane ctx base class */ -- int if_num; /* physical interface number */ -- struct nss_ctx_instance *nss_ctx; /* which nss core */ -- int notify_open; /* This data plane interface has been opened or not */ -- uint32_t features; /* skb types supported by this interface */ -- uint32_t bypass_nw_process; /* Do we want to bypass NW processing in NSS for this data plane? */ --} nss_data_plane_edma_params[NSS_DATA_PLANE_EDMA_MAX_INTERFACES + 1]; -- --/* -- * __nss_data_plane_init() -- */ --static int __nss_data_plane_init(struct nss_dp_data_plane_ctx *dpc) --{ -- struct net_device *netdev = dpc->dev; -- netdev->needed_headroom += 32; -- return NSS_DP_SUCCESS; --} -- --/* -- * __nss_data_plane_open() -- * Called by nss-dp to notify open to nss-fw -- */ --static int __nss_data_plane_open(struct nss_dp_data_plane_ctx *dpc, uint32_t tx_desc_ring, uint32_t rx_desc_ring, uint32_t mode) --{ -- struct nss_data_plane_edma_param *dp = (struct nss_data_plane_edma_param *)dpc; -- -- if (dp->notify_open) { -- return NSS_DP_SUCCESS; -- } -- if (nss_phys_if_open(dp->nss_ctx, tx_desc_ring, rx_desc_ring, mode, dp->if_num, dp->bypass_nw_process) == NSS_TX_SUCCESS) { -- dp->notify_open = 1; -- return NSS_DP_SUCCESS; -- } -- return NSS_DP_FAILURE; --} -- --/* -- * __nss_data_plane_close() -- * Called by nss-dp to notify close to nss-fw -- */ --static int __nss_data_plane_close(struct nss_dp_data_plane_ctx *dpc) --{ -- struct nss_data_plane_edma_param *dp = (struct nss_data_plane_edma_param *)dpc; -- -- if (!dp->notify_open) { -- return NSS_DP_SUCCESS; -- } -- if (nss_phys_if_close(dp->nss_ctx, dp->if_num) == NSS_TX_SUCCESS) { -- dp->notify_open = 0; -- return NSS_DP_SUCCESS; -- } -- return NSS_DP_FAILURE; --} -- --/* -- * __nss_data_plane_link_state() -- * Called by nss-dp to notify link state change to nss-fw -- */ --static int __nss_data_plane_link_state(struct nss_dp_data_plane_ctx *dpc, uint32_t link_state) --{ -- struct nss_data_plane_edma_param *dp = (struct nss_data_plane_edma_param *)dpc; -- -- return nss_phys_if_link_state(dp->nss_ctx, link_state, dp->if_num); --} -- --/* -- * __nss_data_plane_mac_addr() -- * Called by nss-dp to set mac address -- */ --static int __nss_data_plane_mac_addr(struct nss_dp_data_plane_ctx *dpc, uint8_t *addr) --{ -- struct nss_data_plane_edma_param *dp = (struct nss_data_plane_edma_param *)dpc; -- -- return nss_phys_if_mac_addr(dp->nss_ctx, addr, dp->if_num); --} -- --/* -- * __nss_data_plane_change_mtu() -- * Called by nss-dp to change mtu of a data plane -- */ --static int __nss_data_plane_change_mtu(struct nss_dp_data_plane_ctx *dpc, uint32_t mtu) --{ -- struct nss_data_plane_edma_param *dp = (struct nss_data_plane_edma_param *)dpc; -- -- if (mtu > NSS_DATA_PLANE_EDMA_MAX_MTU_SIZE) { -- nss_warning("%p: 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); --} -- --/* -- * __nss_data_plane_pause_on_off() -- * Called by nss-dp to enable/disable pause frames -- */ --static int __nss_data_plane_pause_on_off(struct nss_dp_data_plane_ctx *dpc, uint32_t pause_on) --{ -- struct nss_data_plane_edma_param *dp = (struct nss_data_plane_edma_param *)dpc; -- -- return nss_phys_if_pause_on_off(dp->nss_ctx, pause_on, dp->if_num); --} -- --/* -- * __nss_data_plane_vsi_assign() -- * Called by nss-dp to assign vsi of a data plane -- */ --static int __nss_data_plane_vsi_assign(struct nss_dp_data_plane_ctx *dpc, uint32_t vsi) --{ -- struct nss_data_plane_edma_param *dp = (struct nss_data_plane_edma_param *)dpc; -- -- return nss_phys_if_vsi_assign(dp->nss_ctx, vsi, dp->if_num); --} -- --/* -- * __nss_data_plane_vsi_unassign() -- * Called by nss-dp to unassign vsi of a data plane -- */ --static int __nss_data_plane_vsi_unassign(struct nss_dp_data_plane_ctx *dpc, uint32_t vsi) --{ -- struct nss_data_plane_edma_param *dp = (struct nss_data_plane_edma_param *)dpc; -- -- return nss_phys_if_vsi_unassign(dp->nss_ctx, vsi, dp->if_num); --} -- --#ifdef NSS_DRV_QRFS_ENABLE --/* -- * __nss_data_plane_rx_flow_steer() -- * Called by nss-dp to set flow rule of a data plane -- */ --static int __nss_data_plane_rx_flow_steer(struct nss_dp_data_plane_ctx *dpc, struct sk_buff *skb, -- uint32_t cpu, bool is_add) --{ -- if (is_add) { -- return nss_qrfs_set_flow_rule(skb, cpu, NSS_QRFS_MSG_FLOW_ADD); -- } -- -- return nss_qrfs_set_flow_rule(skb, cpu, NSS_QRFS_MSG_FLOW_DELETE); --} --#endif -- --/* -- * __nss_data_plane_deinit() -- * Place holder for nss-dp ops to free NSS data plane resources -- */ --static int __nss_data_plane_deinit(struct nss_dp_data_plane_ctx *dpc) --{ -- /* -- * TODO: Implement free up of NSS data plane resources -- */ -- return NSS_TX_SUCCESS; --} -- --/* -- * __nss_data_plane_buf() -- * Called by nss-dp to pass a sk_buff for xmit -- */ --static netdev_tx_t __nss_data_plane_buf(struct nss_dp_data_plane_ctx *dpc, struct sk_buff *skb) --{ -- struct nss_data_plane_edma_param *dp = (struct nss_data_plane_edma_param *)dpc; -- int extra_head = dpc->dev->needed_headroom - skb_headroom(skb); -- int extra_tail = 0; -- nss_tx_status_t status; -- struct net_device *dev = dpc->dev; -- -- if (skb->len < ETH_HLEN) { -- nss_warning("skb->len ( %u ) < ETH_HLEN ( %u ) \n", skb->len, ETH_HLEN); -- goto drop; -- } -- -- if (skb->len > NSS_DATA_PLANE_EDMA_MAX_PACKET_LEN) { -- nss_warning("skb->len ( %u ) > Maximum packet length ( %u ) \n", skb->len, NSS_DATA_PLANE_EDMA_MAX_PACKET_LEN); -- goto drop; -- } -- -- if (skb_cloned(skb) || extra_head > 0) { -- /* -- * If it is a clone and headroom is already enough, -- * We just make a copy and clear the clone flag. -- */ -- if (extra_head <= 0) -- extra_head = extra_tail = 0; -- /* -- * If tailroom is enough to accommodate the added headroom, -- * then allocate a buffer of same size and do relocations. -- * It might help kmalloc_reserve() not double the size. -- */ -- if (skb->end - skb->tail >= extra_head) -- extra_tail = -extra_head; -- -- if (pskb_expand_head(skb, extra_head, extra_tail, GFP_ATOMIC)) { -- nss_warning("%p: Unable to expand skb for headroom\n", dp); -- goto drop; -- } -- } -- -- status = nss_phys_if_buf(dp->nss_ctx, skb, dp->if_num); -- if (likely(status == NSS_TX_SUCCESS)) { -- return NETDEV_TX_OK; -- } else if (status == NSS_TX_FAILURE_QUEUE) { -- return NETDEV_TX_BUSY; -- } -- --drop: -- dev_kfree_skb_any(skb); -- dev->stats.tx_dropped++; -- -- return NETDEV_TX_OK; --} -- --/* -- * __nss_data_plane_set_features() -- * Called by nss-dp to allow data plane to modify the set of features it supports --*/ --static void __nss_data_plane_set_features(struct nss_dp_data_plane_ctx *dpc) --{ -- dpc->dev->features |= NSS_DP_EDMA_SUPPORTED_FEATURES; -- dpc->dev->hw_features |= NSS_DP_EDMA_SUPPORTED_FEATURES; -- dpc->dev->vlan_features |= NSS_DP_EDMA_SUPPORTED_FEATURES; -- dpc->dev->wanted_features |= NSS_DP_EDMA_SUPPORTED_FEATURES; --} -- --/* -- * nss offload data plane ops -- */ --static struct nss_dp_data_plane_ops dp_ops = { -- .init = __nss_data_plane_init, -- .open = __nss_data_plane_open, -- .close = __nss_data_plane_close, -- .link_state = __nss_data_plane_link_state, -- .mac_addr = __nss_data_plane_mac_addr, -- .change_mtu = __nss_data_plane_change_mtu, -- .xmit = __nss_data_plane_buf, -- .set_features = __nss_data_plane_set_features, -- .pause_on_off = __nss_data_plane_pause_on_off, -- .vsi_assign = __nss_data_plane_vsi_assign, -- .vsi_unassign = __nss_data_plane_vsi_unassign, --#ifdef NSS_DRV_QRFS_ENABLE -- .rx_flow_steer = __nss_data_plane_rx_flow_steer, --#endif -- .deinit = __nss_data_plane_deinit, --}; -- --/* -- * nss_data_plane_register_to_nss_dp() -- */ --static bool nss_data_plane_register_to_nss_dp(struct nss_ctx_instance *nss_ctx, int if_num) --{ -- struct nss_data_plane_edma_param *ndpp = &nss_data_plane_edma_params[if_num]; -- struct nss_top_instance *nss_top = nss_ctx->nss_top; -- struct net_device *netdev; -- bool is_open; -- int core; -- -- netdev = nss_dp_get_netdev_by_macid(if_num); -- if (!netdev) { -- nss_info("%p: Platform don't have data plane%d enabled, don't bring up nss_phys_if and don't register to nss-dp\n", nss_ctx, if_num); -- return false; -- } -- -- is_open = nss_dp_is_in_open_state(netdev); -- ndpp->dpc.dev = netdev; -- ndpp->nss_ctx = nss_ctx; -- ndpp->if_num = if_num; -- ndpp->notify_open = 0; -- ndpp->features = 0; -- -- /* -- * Check if NSS NW processing to be bypassed for this data plane -- */ -- if (nss_skip_nw_process) { -- ndpp->bypass_nw_process = 1; -- } else { -- ndpp->bypass_nw_process = 0; -- } -- -- if (nss_dp_override_data_plane(netdev, &dp_ops, (struct nss_dp_data_plane_ctx *)ndpp) != NSS_DP_SUCCESS) { -- nss_info("%p: Override nss-dp data plane for port %dfailed\n", nss_ctx, if_num); -- return false; -- } -- -- /* -- * Setup the receive callback so that data pkts received form NSS-FW will -- * be redirected to the nss-dp driver as we are overriding the data plane -- */ -- nss_top->phys_if_handler_id[if_num] = nss_ctx->id; -- nss_phys_if_register_handler(nss_ctx, if_num); -- -- /* -- * Packets recieved on physical interface can be exceptioned to HLOS -- * from any NSS core so we need to register data plane for all -- */ -- for (core = 0; core < nss_top->num_nss; core++) { -- nss_core_register_subsys_dp(&nss_top->nss[core], if_num, nss_dp_receive, NULL, NULL, netdev, ndpp->features); -- } -- -- /* -- * Now we are registered and our side is ready, if the data plane was opened, ask it to start again -- */ -- if (is_open) { -- nss_dp_start_data_plane(netdev, (struct nss_dp_data_plane_ctx *)ndpp); -- } -- return true; --} -- --/* -- * nss_data_plane_unregister_from_nss_dp() -- */ --static void nss_data_plane_unregister_from_nss_dp(int if_num) --{ -- nss_cmn_unregister_service_code(nss_data_plane_edma_params[if_num].nss_ctx, -- nss_phy_tstamp_rx_buf, NSS_PTP_EVENT_SERVICE_CODE); -- nss_dp_restore_data_plane(nss_data_plane_edma_params[if_num].dpc.dev); -- nss_data_plane_edma_params[if_num].dpc.dev = NULL; -- nss_data_plane_edma_params[if_num].nss_ctx = NULL; -- nss_data_plane_edma_params[if_num].if_num = 0; -- nss_data_plane_edma_params[if_num].notify_open = 0; -- nss_data_plane_edma_params[if_num].bypass_nw_process = 0; --} -- --/* -- * __nss_data_plane_register() -- */ --static void __nss_data_plane_register(struct nss_ctx_instance *nss_ctx) --{ -- int i; -- -- for (i = 1; i < NSS_DATA_PLANE_EDMA_MAX_INTERFACES + 1; i++) { -- if (!nss_data_plane_register_to_nss_dp(nss_ctx, i)) { -- nss_warning("%p: Register data plane failed for data plane %d\n", nss_ctx, i); -- } else { -- nss_info("%p: Register data plan to data plane %d success\n", nss_ctx, i); -- } -- } -- -- /* -- * Packets with the ptp service code should be delivered to PHY driver for timestamping -- */ -- nss_cmn_register_service_code(nss_ctx, nss_phy_tstamp_rx_buf, -- NSS_PTP_EVENT_SERVICE_CODE, nss_ctx); -- --} -- --/* -- * __nss_data_plane_unregister() -- */ --static void __nss_data_plane_unregister(void) --{ -- int i, core; -- -- for (core = 0; core < nss_top_main.num_nss; core++) { -- for (i = 1; i < NSS_DATA_PLANE_EDMA_MAX_INTERFACES + 1; i++) { -- if (nss_top_main.nss[core].subsys_dp_register[i].ndev) { -- nss_data_plane_unregister_from_nss_dp(i); -- nss_core_unregister_subsys_dp(&nss_top_main.nss[core], i); -- } -- } -- } --} -- --/* -- * __nss_data_plane_stats_sync() -- */ --static void __nss_data_plane_stats_sync(struct nss_phys_if_stats *stats, uint16_t interface) --{ -- /* -- * EDMA does not pass sync interface stats through phys_if_stats -- */ --} -- --/* -- * __nss_data_plane_get_mtu_sz() -- */ --static uint16_t __nss_data_plane_get_mtu_sz(uint16_t mtu) --{ -- /* -- * Reserve space for preheader -- */ -- return mtu + NSS_DATA_PLANE_EDMA_PREHEADER_SIZE; --} -- --/* -- * nss_data_plane_edma_ops -- */ --struct nss_data_plane_ops nss_data_plane_edma_ops = { -- .data_plane_register = &__nss_data_plane_register, -- .data_plane_unregister = &__nss_data_plane_unregister, -- .data_plane_stats_sync = &__nss_data_plane_stats_sync, -- .data_plane_get_mtu_sz = &__nss_data_plane_get_mtu_sz, --}; ---- a/nss_data_plane/nss_data_plane_gmac.c -+++ b/nss_data_plane/nss_data_plane_gmac.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -250,9 +250,9 @@ static void __nss_data_plane_register(st - - for (i = 0; i < NSS_DATA_PLANE_GMAC_MAX_INTERFACES; i++) { - if (!nss_data_plane_register_to_nss_gmac(nss_ctx, i)) { -- nss_warning("%p: Register data plane failed for gmac:%d\n", nss_ctx, i); -+ nss_warning("%px: Register data plane failed for gmac:%d\n", nss_ctx, i); - } else { -- nss_info("%p: Register data plan to gmac:%d success\n", nss_ctx, i); -+ nss_info("%px: Register data plan to gmac:%d success\n", nss_ctx, i); - } - } - } ---- /dev/null -+++ b/nss_dma.c -@@ -0,0 +1,501 @@ -+/* -+ ************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for -+ * any purpose with or without fee is hereby granted, provided that the -+ * above copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ ************************************************************************** -+ */ -+ -+/* -+ * nss_dma.c -+ * NSS DMA APIs -+ */ -+ -+#include -+#include "nss_dma_stats.h" -+#include "nss_dma_log.h" -+#include "nss_dma_strings.h" -+ -+/* -+ * Test configuration value -+ */ -+struct nss_dma_test_cfg_val { -+ int val; /* field value */ -+ int min; /* Minimum value */ -+ int max; /* Maximum value */ -+}; -+ -+/* -+ * Test configuration for user -+ */ -+struct nss_dma_test_cfg_user { -+ struct nss_dma_test_cfg_val run; /* test run state */ -+ struct nss_dma_test_cfg_val code; /* test run code */ -+ struct nss_dma_test_cfg_val type; /* test type code */ -+ struct nss_dma_test_cfg_val packets; /* packet count per loop */ -+ int result_tx_packets; /* test results TX packets */ -+ int result_rx_packets; /* test result RX packets */ -+ int result_time; /* test time */ -+}; -+ -+static struct nss_dma_test_cfg_user test_cfg = { -+ .run = {.val = 0, .min = 0 /* stopped */, .max = 1 /* running */}, -+ .code = {.val = 1, .min = 1 /* linearize */, .max = 2 /* split */}, -+ .type = {.val = NSS_DMA_TEST_TYPE_DEFAULT, .min = NSS_DMA_TEST_TYPE_DEFAULT, .max = NSS_DMA_TEST_TYPE_MAX}, -+ .packets = {.val = 1, .min = 1, .max = 65536}, -+}; -+ -+/* -+ * Private data structure. -+ */ -+struct nss_dma_pvt { -+ struct semaphore sem; /* Semaphore structure. */ -+ struct completion complete; /* Completion structure. */ -+ int response; /* Response from FW. */ -+ void *cb; /* Original cb for sync msgs. */ -+ void *app_data; /* Original app_data for sync msgs. */ -+}; -+ -+static struct nss_dma_pvt nss_dma_cfg_pvt; -+ -+/* -+ * nss_dma_verify_if_num() -+ * Verify if_num passed to us. -+ */ -+static inline bool nss_dma_verify_if_num(uint32_t if_num) -+{ -+ return if_num == NSS_DMA_INTERFACE; -+} -+ -+/* -+ * nss_dma_interface_handler() -+ * Handle NSS -> HLOS messages for DMA Statistics -+ */ -+static void nss_dma_msg_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm, -+ __attribute__((unused))void *app_data) -+{ -+ struct nss_dma_msg *ndm = (struct nss_dma_msg *)ncm; -+ nss_dma_msg_callback_t cb; -+ -+ if (!nss_dma_verify_if_num(ncm->interface)) { -+ nss_warning("%px: invalid interface %d for dma\n", nss_ctx, ncm->interface); -+ return; -+ } -+ -+ /* -+ * Is this a valid request/response packet? -+ */ -+ if (ncm->type >= NSS_DMA_MSG_TYPE_MAX) { -+ nss_warning("%px: received invalid message %d for dma", nss_ctx, ncm->type); -+ return; -+ } -+ -+ if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_dma_msg)) { -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ return; -+ } -+ -+ /* -+ * Trace messages. -+ */ -+ nss_dma_log_rx_msg(ndm); -+ -+ /* -+ * Log failures -+ */ -+ nss_core_log_msg_failures(nss_ctx, ncm); -+ -+ /* -+ * Update driver statistics and send statistics notifications to the registered modules. -+ */ -+ if (ndm->cm.type == NSS_DMA_MSG_TYPE_SYNC_STATS) { -+ nss_dma_stats_sync(nss_ctx, &ndm->msg.stats); -+ -+ } -+ -+ /* -+ * Update the callback and app_data for NOTIFY messages -+ */ -+ if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); -+ ncm->app_data = (nss_ptr_t)nss_ctx->nss_rx_interface_handlers[nss_ctx->id][ncm->interface].app_data; -+ } -+ -+ /* -+ * Do we have a callback? -+ */ -+ if (!ncm->cb) { -+ return; -+ } -+ -+ /* -+ * callback -+ */ -+ cb = (nss_dma_msg_callback_t)ncm->cb; -+ cb((void *)ncm->app_data, ncm); -+} -+ -+/* -+ * nss_dma_register_handler() -+ * Register handler for messaging -+ */ -+void nss_dma_register_handler(void) -+{ -+ struct nss_ctx_instance *nss_ctx = nss_dma_get_context(); -+ -+ nss_info("%px: nss_dma_register_handler", nss_ctx); -+ nss_core_register_handler(nss_ctx, NSS_DMA_INTERFACE, nss_dma_msg_handler, NULL); -+ -+ nss_dma_stats_dentry_create(); -+ nss_dma_strings_dentry_create(); -+} -+EXPORT_SYMBOL(nss_dma_register_handler); -+ -+/* -+ * nss_dma_tx_msg() -+ * Transmit an dma message to the FW with a specified size. -+ */ -+nss_tx_status_t nss_dma_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_dma_msg *ndm) -+{ -+ struct nss_cmn_msg *ncm = &ndm->cm; -+ -+ /* -+ * Sanity check the message -+ */ -+ if (!nss_dma_verify_if_num(ncm->interface)) { -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); -+ return NSS_TX_FAILURE; -+ } -+ -+ if (ncm->type >= NSS_DMA_MSG_TYPE_MAX) { -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); -+ return NSS_TX_FAILURE; -+ } -+ -+ /* -+ * Trace messages. -+ */ -+ nss_dma_log_tx_msg(ndm); -+ -+ return nss_core_send_cmd(nss_ctx, ndm, sizeof(*ndm), NSS_NBUF_PAYLOAD_SIZE); -+} -+EXPORT_SYMBOL(nss_dma_tx_msg); -+ -+/* -+ * nss_dma_msg_test_callback() -+ * Callback function for dma test start configuration -+ */ -+static void nss_dma_msg_test_callback(void *app_data, struct nss_cmn_msg *ncm) -+{ -+ struct nss_ctx_instance *nss_ctx __attribute__((unused)) = (struct nss_ctx_instance *)app_data; -+ struct nss_dma_msg *ndm = (struct nss_dma_msg *)ncm; -+ struct nss_dma_test_cfg *ndtc = &ndm->msg.test_cfg; -+ struct nss_cmn_node_stats *ncns = &ndtc->node_stats; -+ -+ test_cfg.run.val = 0; /* test completed */ -+ -+ /* -+ * Test start has been failed. Restore the value to initial state. -+ */ -+ if (ndm->cm.response != NSS_CMN_RESPONSE_ACK) { -+ nss_warning("%px: nss dma test failed: %d \n", nss_ctx, ndm->cm.error); -+ test_cfg.result_tx_packets = 0; -+ test_cfg.result_rx_packets = 0; -+ test_cfg.result_time = 0; -+ return; -+ } -+ -+ test_cfg.result_tx_packets = ncns->tx_packets; -+ test_cfg.result_rx_packets = ncns->rx_packets; -+ test_cfg.result_time = ndtc->time_delta; -+ -+ nss_info("%px: nss dma test complete\n", nss_ctx); -+ nss_info("%px: results tx=%u, rx=%u, time=%u\n", ndm, ncns->tx_packets, ncns->rx_packets, ndtc->time_delta); -+} -+ -+/* -+ * nss_dma_msg_test() -+ * Send NSS DMA test start message. -+ */ -+static nss_tx_status_t nss_dma_msg_test(struct nss_ctx_instance *nss_ctx) -+{ -+ struct nss_dma_msg ndm; -+ uint32_t flags = 0; -+ int32_t status; -+ size_t len; -+ -+ len = sizeof(struct nss_cmn_msg) + sizeof(struct nss_dma_test_cfg); -+ -+ nss_info("%px: DMA test message:%x\n", nss_ctx, test_cfg.run.val); -+ if (test_cfg.code.val == 1) { -+ flags = NSS_DMA_TEST_FLAGS_LINEARIZE; -+ } -+ -+ nss_dma_msg_init(&ndm, NSS_DMA_INTERFACE, NSS_DMA_MSG_TYPE_TEST_PERF, len, nss_dma_msg_test_callback, nss_ctx); -+ -+ ndm.msg.test_cfg.packet_count = test_cfg.packets.val; -+ ndm.msg.test_cfg.type = test_cfg.type.val; -+ ndm.msg.test_cfg.flags = flags; -+ -+ status = nss_dma_tx_msg(nss_ctx, &ndm); -+ if (unlikely(status != NSS_TX_SUCCESS)) { -+ return status; -+ } -+ -+ /* -+ * Test is now running -+ */ -+ test_cfg.run.val = 1; -+ return NSS_TX_SUCCESS; -+} -+ -+/* -+ * nss_dma_msg_init() -+ * Initialize DMA message. -+ */ -+void nss_dma_msg_init(struct nss_dma_msg *ndm, uint16_t if_num, uint32_t type, uint32_t len, nss_dma_msg_callback_t cb, -+ void *app_data) -+{ -+ nss_cmn_msg_init(&ndm->cm, if_num, type, len, (void *)cb, app_data); -+} -+EXPORT_SYMBOL(nss_dma_msg_init); -+ -+/* -+ * nss_crypto_cmn_get_context() -+ * get NSS context instance for crypto handle -+ */ -+struct nss_ctx_instance *nss_dma_get_context(void) -+{ -+ return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.dma_handler_id]; -+} -+EXPORT_SYMBOL(nss_dma_get_context); -+ -+/* -+ * nss_dma_test_handler() -+ * Handles the performance test. -+ */ -+static int nss_dma_test_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos) -+{ -+ struct nss_ctx_instance *nss_ctx = nss_dma_get_context(); -+ int cur_state = test_cfg.run.val; -+ int ret; -+ -+ ret = proc_dointvec(ctl, write, buffer, lenp, ppos); -+ if (ret != NSS_SUCCESS) { -+ return ret; -+ } -+ -+ if (!write) { -+ return ret; -+ } -+ -+ /* -+ * Check any tests are already scheduled -+ */ -+ if (cur_state > 0) { -+ nss_info("%px: Test is already running, stopping it.\n", nss_ctx); -+ } else { -+ nss_info("%px: Test is not running, starting it.\n", nss_ctx); -+ } -+ -+ ret = nss_dma_msg_test(nss_ctx); -+ if (ret != NSS_SUCCESS) { -+ nss_warning("%px: Test configuration has failed.\n", nss_ctx); -+ test_cfg.run.val = 0; -+ } -+ -+ return ret; -+} -+ -+static struct ctl_table nss_dma_table[] = { -+ { -+ .procname = "test_run", -+ .data = &test_cfg.run.val, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = nss_dma_test_handler, -+ .extra1 = &test_cfg.run.min, -+ .extra2 = &test_cfg.run.max, -+ }, -+ { -+ .procname = "test_code", -+ .data = &test_cfg.code.val, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec_minmax, -+ .extra1 = &test_cfg.code.min, -+ .extra2 = &test_cfg.code.max, -+ }, -+ { -+ .procname = "test_type", -+ .data = &test_cfg.type.val, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec_minmax, -+ .extra1 = &test_cfg.type.min, -+ .extra2 = &test_cfg.type.max, -+ }, -+ { -+ .procname = "test_packets", -+ .data = &test_cfg.packets.val, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec_minmax, -+ .extra1 = &test_cfg.packets.min, -+ .extra2 = &test_cfg.packets.max, -+ }, -+ { -+ .procname = "result_tx", -+ .data = &test_cfg.result_tx_packets, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec, -+ }, -+ { -+ .procname = "result_rx", -+ .data = &test_cfg.result_rx_packets, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec, -+ }, -+ { -+ .procname = "result_time", -+ .data = &test_cfg.result_time, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec, -+ }, -+ { } -+}; -+ -+static struct ctl_table nss_dma_dir[] = { -+ { -+ .procname = "dma", -+ .mode = 0555, -+ .child = nss_dma_table, -+ }, -+ { } -+}; -+ -+static struct ctl_table nss_dma_root_dir[] = { -+ { -+ .procname = "nss", -+ .mode = 0555, -+ .child = nss_dma_dir, -+ }, -+ { } -+}; -+ -+static struct ctl_table nss_dma_root[] = { -+ { -+ .procname = "dev", -+ .mode = 0555, -+ .child = nss_dma_root_dir, -+ }, -+ { } -+}; -+ -+static struct ctl_table_header *nss_dma_header; -+ -+/* -+ * nss_dma_register_sysctl() -+ */ -+void nss_dma_register_sysctl(void) -+{ -+ -+ /* -+ * dma sema init. -+ */ -+ sema_init(&nss_dma_cfg_pvt.sem, 1); -+ init_completion(&nss_dma_cfg_pvt.complete); -+ -+ /* -+ * Register sysctl table. -+ */ -+ nss_dma_header = register_sysctl_table(nss_dma_root); -+} -+ -+/* -+ * nss_dma_unregister_sysctl() -+ * Unregister sysctl specific to dma -+ */ -+void nss_dma_unregister_sysctl(void) -+{ -+ /* -+ * Unregister sysctl table. -+ */ -+ if (nss_dma_header) { -+ unregister_sysctl_table(nss_dma_header); -+ } -+} -+ -+/* -+ * nss_dma_notify_register() -+ * Register to receive dma notify messages. -+ */ -+struct nss_ctx_instance *nss_dma_notify_register(int core, nss_dma_msg_callback_t cb, void *app_data) -+{ -+ struct nss_ctx_instance *nss_ctx = nss_dma_get_context(); -+ uint32_t ret; -+ -+ ret = nss_core_register_handler(nss_ctx, NSS_DMA_INTERFACE, nss_dma_msg_handler, app_data); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to register event handler for DMA interface", nss_ctx); -+ return NULL; -+ } -+ -+ ret = nss_core_register_msg_handler(nss_ctx, NSS_DMA_INTERFACE, cb); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, NSS_DMA_INTERFACE); -+ nss_warning("%px: unable to register event handler for DMA interface", nss_ctx); -+ return NULL; -+ } -+ -+ return nss_ctx; -+} -+EXPORT_SYMBOL(nss_dma_notify_register); -+ -+/* -+ * nss_dma_notify_unregister() -+ * Unregister to receive dma notify messages. -+ */ -+void nss_dma_notify_unregister(int core) -+{ -+ struct nss_ctx_instance *nss_ctx = nss_dma_get_context(); -+ uint32_t ret; -+ -+ BUG_ON(!nss_ctx); -+ -+ ret = nss_core_unregister_msg_handler(nss_ctx, NSS_DMA_INTERFACE); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to unregister event handler for DMA interface", nss_ctx); -+ return; -+ } -+ -+ ret = nss_core_unregister_handler(nss_ctx, NSS_DMA_INTERFACE); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to unregister event handler for DMA interface", nss_ctx); -+ return; -+ } -+ -+ return; -+} -+EXPORT_SYMBOL(nss_dma_notify_unregister); -+ -+/* -+ * nss_dma_init() -+ */ -+void nss_dma_init(void) -+{ -+ nss_dma_register_sysctl(); -+} ---- /dev/null -+++ b/nss_dma_log.c -@@ -0,0 +1,140 @@ -+/* -+ ************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for -+ * any purpose with or without fee is hereby granted, provided that the -+ * above copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ ************************************************************************** -+ */ -+ -+/* -+ * nss_dma_log.c -+ * NSS DMA logger file. -+ */ -+ -+#include "nss_core.h" -+ -+/* -+ * nss_dma_log_message_types_str -+ * DMA message strings -+ */ -+static int8_t *nss_dma_log_message_types_str[NSS_DMA_MSG_TYPE_MAX] __maybe_unused = { -+ "DMA invalid message", -+ "DMA Configure message", -+ "DMA Statistics sync message", -+ "DMA Test linearization performance", -+}; -+ -+/* -+ * nss_dma_log_error_response_types_str -+ * Strings for error types for DMA messages -+ */ -+static int8_t *nss_dma_log_error_response_types_str[NSS_DMA_MSG_ERROR_MAX] __maybe_unused = { -+ "No error", -+ "HW initialization failed", -+ "Unhandled message type for node", -+ "Error performing the test", -+}; -+ -+/* -+ * nss_dma_map_msg() -+ * Log NSS DMA configure message. -+ */ -+static void nss_dma_configure_msg(struct nss_dma_msg *ndm) -+{ -+ nss_trace("%px: NSS DMA configure message: \n",ndm); -+} -+ -+/* -+ * nss_dma_test_perf_msg() -+ * Log NSS DMA performace test message. -+ */ -+static void nss_dma_test_perf_msg(struct nss_dma_msg *ndm) -+{ -+ struct nss_dma_test_cfg *ndtc = &ndm->msg.test_cfg; -+ struct nss_cmn_node_stats *ncns = &ndtc->node_stats; -+ -+ nss_trace("%px: NSS DMA test perf message: \n",ndm); -+ nss_trace("%px: processed (TX: %u, RX:%u, time:%u)\n", ndm, ncns->tx_packets, ncns->rx_packets, ndtc->time_delta); -+ nss_trace("%px: test parameters (type:%u, packet_cnt:%u)\n", ndm, ndtc->type, ndtc->packet_count); -+} -+ -+/* -+ * nss_dma_log_verbose() -+ * Log message contents. -+ */ -+static void nss_dma_log_verbose(struct nss_dma_msg *ndm) -+{ -+ switch (ndm->cm.type) { -+ case NSS_DMA_MSG_TYPE_CONFIGURE: -+ nss_dma_configure_msg(ndm); -+ break; -+ -+ case NSS_DMA_MSG_TYPE_TEST_PERF: -+ nss_dma_test_perf_msg(ndm); -+ break; -+ -+ default: -+ nss_trace("%px: Invalid message type\n", ndm); -+ break; -+ } -+} -+ -+/* -+ * nss_dma_log_tx_msg() -+ * Log messages transmitted to FW. -+ */ -+void nss_dma_log_tx_msg(struct nss_dma_msg *ndm) -+{ -+ if (ndm->cm.type >= NSS_DMA_MSG_TYPE_MAX) { -+ nss_info("%px: Invalid message type\n", ndm); -+ return; -+ } -+ -+ nss_info("%px: type[%d]:%s\n", ndm, ndm->cm.type, nss_dma_log_message_types_str[ndm->cm.type]); -+ nss_dma_log_verbose(ndm); -+} -+ -+/* -+ * nss_dma_log_rx_msg() -+ * Log messages received from FW. -+ */ -+void nss_dma_log_rx_msg(struct nss_dma_msg *ndm) -+{ -+ if (ndm->cm.response >= NSS_CMN_RESPONSE_LAST) { -+ nss_warning("%px: Invalid response\n", ndm); -+ return; -+ } -+ -+ if (ndm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ndm->cm.response == NSS_CMN_RESPONSE_ACK)) { -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ndm, ndm->cm.type, -+ nss_dma_log_message_types_str[ndm->cm.type], -+ ndm->cm.response, nss_cmn_response_str[ndm->cm.response]); -+ goto verbose; -+ } -+ -+ if (ndm->cm.error >= NSS_DMA_MSG_ERROR_MAX) { -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ ndm, ndm->cm.type, nss_dma_log_message_types_str[ndm->cm.type], -+ ndm->cm.response, nss_cmn_response_str[ndm->cm.response], -+ ndm->cm.error); -+ goto verbose; -+ } -+ -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ ndm, ndm->cm.type, nss_dma_log_message_types_str[ndm->cm.type], -+ ndm->cm.response, nss_cmn_response_str[ndm->cm.response], -+ ndm->cm.error, nss_dma_log_error_response_types_str[ndm->cm.error]); -+ -+verbose: -+ nss_dma_log_verbose(ndm); -+} ---- /dev/null -+++ b/nss_dma_log.h -@@ -0,0 +1,38 @@ -+/* -+ ****************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for -+ * any purpose with or without fee is hereby granted, provided that the -+ * above copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ * **************************************************************************** -+ */ -+ -+#ifndef __NSS_DMA_LOG_H -+#define __NSS_DMA_LOG_H -+/* -+ * nss_dma_log.h -+ * NSS DMA Log Header File -+ */ -+ -+/* -+ * nss_dma_log_tx_msg -+ * Logs an DMA message that is sent to the NSS firmware. -+ */ -+void nss_dma_log_tx_msg(struct nss_dma_msg *ndm); -+ -+/* -+ * nss_dma_log_rx_msg -+ * Logs an DMA message that is received from the NSS firmware. -+ */ -+void nss_dma_log_rx_msg(struct nss_dma_msg *ndm); -+ -+#endif /* __NSS_DMA_LOG_H */ ---- /dev/null -+++ b/nss_dma_stats.c -@@ -0,0 +1,119 @@ -+/* -+ ************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for -+ * any purpose with or without fee is hereby granted, provided that the -+ * above copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ ************************************************************************** -+ */ -+ -+#include "nss_core.h" -+#include "nss_dma_stats.h" -+#include "nss_dma_strings.h" -+ -+/* -+ * Spinlock to protect DMA statistics update/read -+ */ -+DEFINE_SPINLOCK(nss_dma_stats_lock); -+ -+/* -+ * nss_dma_stats -+ * DMA statistics -+ */ -+uint64_t nss_dma_stats[NSS_DMA_STATS_MAX]; -+ -+/* -+ * nss_dma_stats_read() -+ * Read DMA statistics -+ */ -+static ssize_t nss_dma_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos) -+{ -+ /* -+ * Max output lines = #stats * NSS_MAX_CORES + -+ * few blank lines for banner printing + Number of Extra outputlines for future reference to add new stats -+ */ -+ uint32_t max_output_lines = NSS_DMA_STATS_MAX + NSS_STATS_EXTRA_OUTPUT_LINES; -+ size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines; -+ uint64_t *stats_shadow; -+ ssize_t bytes_read = 0; -+ size_t size_wr = 0; -+ char *lbuf; -+ int32_t i; -+ -+ lbuf = vzalloc(size_al); -+ if (!lbuf) { -+ nss_warning("Could not allocate memory for local statistics buffer"); -+ return -ENOMEM; -+ } -+ -+ stats_shadow = vzalloc(NSS_DMA_STATS_MAX * 8); -+ if (!stats_shadow) { -+ nss_warning("Could not allocate memory for local shadow buffer"); -+ vfree(lbuf); -+ return -ENOMEM; -+ } -+ -+ /* -+ * DMA statistics -+ */ -+ spin_lock_bh(&nss_dma_stats_lock); -+ for (i = 0; i < NSS_DMA_STATS_MAX; i++) { -+ stats_shadow[i] = nss_dma_stats[i]; -+ } -+ spin_unlock_bh(&nss_dma_stats_lock); -+ -+ size_wr += nss_stats_banner(lbuf, size_wr, size_al, "dma", nss_top_main.dma_handler_id); -+ size_wr += nss_stats_print("dma", NULL, NSS_STATS_SINGLE_INSTANCE, nss_dma_strings_stats, -+ stats_shadow, NSS_DMA_STATS_MAX, lbuf, size_wr, size_al); -+ -+ bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf)); -+ -+ vfree(lbuf); -+ vfree(stats_shadow); -+ return bytes_read; -+} -+ -+/* -+ * nss_dma_stats_ops -+ */ -+NSS_STATS_DECLARE_FILE_OPERATIONS(dma); -+ -+/* -+ * nss_dma_stats_dentry_create() -+ * Create DMA statistics debug entry. -+ */ -+void nss_dma_stats_dentry_create(void) -+{ -+ nss_stats_create_dentry("dma", &nss_dma_stats_ops); -+} -+ -+/* -+ * nss_dma_stats_sync() -+ * Handle the syncing of NSS DMA statistics. -+ */ -+void nss_dma_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_dma_stats *nds) -+{ -+ uint64_t *dma_stats; -+ uint32_t *msg_stats; -+ uint16_t i = 0; -+ -+ spin_lock_bh(&nss_dma_stats_lock); -+ -+ msg_stats = (uint32_t *)nds; -+ dma_stats = nss_dma_stats; -+ -+ for (i = 0; i < NSS_DMA_STATS_MAX; i++, dma_stats++, msg_stats++) { -+ *dma_stats += *msg_stats; -+ } -+ -+ spin_unlock_bh(&nss_dma_stats_lock); -+} ---- /dev/null -+++ b/nss_dma_stats.h -@@ -0,0 +1,65 @@ -+/* -+ ****************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for -+ * any purpose with or without fee is hereby granted, provided that the -+ * above copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ * **************************************************************************** -+ */ -+ -+#ifndef __NSS_DMA_STATS_H -+#define __NSS_DMA_STATS_H -+ -+#include -+ -+/** -+ * nss_dma_stats_types -+ * DMA node statistics. -+ */ -+enum nss_dma_stats_types { -+ NSS_DMA_STATS_NO_REQ = NSS_STATS_NODE_MAX, /**< Request descriptor not available. */ -+ NSS_DMA_STATS_NO_DESC, /**< DMA descriptors not available. */ -+ NSS_DMA_STATS_NEXTHOP, /**< Failed to retrive next hop. */ -+ NSS_DMA_STATS_FAIL_NEXTHOP_QUEUE, /**< Failed to queue next hop. */ -+ NSS_DMA_STATS_FAIL_LINEAR_SZ, /**< Failed to get memory for linearization. */ -+ NSS_DMA_STATS_FAIL_LINEAR_ALLOC, /**< Failed to allocate buffer for linearization. */ -+ NSS_DMA_STATS_FAIL_LINEAR_NO_SG, /**< Skip linearization due to non-SG packet. */ -+ NSS_DMA_STATS_FAIL_SPLIT_SZ, /**< Failed to spliting buffer into multiple buffers. */ -+ NSS_DMA_STATS_FAIL_SPLIT_ALLOC, /**< Failed to allocate buffer for split. */ -+ NSS_DMA_STATS_FAIL_SYNC_ALLOC, /**< Failed to allocate buffer for sending statistics. */ -+ NSS_DMA_STATS_FAIL_CTX_ACTIVE, /**< Failed to queue as the node is not active. */ -+ NSS_DMA_STATS_FAIL_HW_E0, /**< Failed to process in HW, error code E0. */ -+ NSS_DMA_STATS_FAIL_HW_E1, /**< Failed to process in HW, error code E1. */ -+ NSS_DMA_STATS_FAIL_HW_E2, /**< Failed to process in HW, error code E2. */ -+ NSS_DMA_STATS_FAIL_HW_E3, /**< Failed to process in HW, error code E3. */ -+ NSS_DMA_STATS_FAIL_HW_E4, /**< Failed to process in HW, error code E4. */ -+ NSS_DMA_STATS_FAIL_HW_E5, /**< Failed to process in HW, error code E5. */ -+ NSS_DMA_STATS_FAIL_HW_E6, /**< Failed to process in HW, error code E6. */ -+ NSS_DMA_STATS_FAIL_HW_E7, /**< Failed to process in HW, error code E7. */ -+ NSS_DMA_STATS_FAIL_HW_E8, /**< Failed to process in HW, error code E8. */ -+ NSS_DMA_STATS_FAIL_HW_E9, /**< Failed to process in HW, error code E9. */ -+ NSS_DMA_STATS_FAIL_HW_E10, /**< Failed to process in HW, error code E10. */ -+ NSS_DMA_STATS_FAIL_HW_E11, /**< Failed to process in HW, error code E11. */ -+ NSS_DMA_STATS_FAIL_HW_E12, /**< Failed to process in HW, error code E12. */ -+ NSS_DMA_STATS_FAIL_HW_E13, /**< Failed to process in HW, error code E13. */ -+ NSS_DMA_STATS_FAIL_HW_E14, /**< Failed to process in HW, error code E14. */ -+ NSS_DMA_STATS_FAIL_HW_E15, /**< Failed to process in HW, error code E15. */ -+ NSS_DMA_STATS_MAX, /**< Maximum message type. */ -+}; -+ -+/* -+ * DMA statistics APIs -+ */ -+extern void nss_dma_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_dma_stats *nds); -+extern void nss_dma_stats_dentry_create(void); -+ -+#endif /* __NSS_DMA_STATS_H */ ---- /dev/null -+++ b/nss_dma_strings.c -@@ -0,0 +1,88 @@ -+/* -+ ************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for -+ * any purpose with or without fee is hereby granted, provided that the -+ * above copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ ************************************************************************** -+ */ -+ -+#include "nss_stats.h" -+#include "nss_core.h" -+#include "nss_strings.h" -+#include "nss_dma_stats.h" -+ -+/* -+ * nss_dma_strings_stats -+ * DMA statistics strings. -+ */ -+struct nss_stats_info nss_dma_strings_stats[NSS_DMA_STATS_MAX] = { -+ {"rx_pkts" , NSS_STATS_TYPE_COMMON}, -+ {"rx_byts" , NSS_STATS_TYPE_COMMON}, -+ {"tx_pkts" , NSS_STATS_TYPE_COMMON}, -+ {"tx_byts" , NSS_STATS_TYPE_COMMON}, -+ {"rx_queue[0]_drops" , NSS_STATS_TYPE_DROP}, -+ {"rx_queue[1]_drops" , NSS_STATS_TYPE_DROP}, -+ {"rx_queue[2]_drops" , NSS_STATS_TYPE_DROP}, -+ {"rx_queue[3]_drops" , NSS_STATS_TYPE_DROP}, -+ {"no_req" , NSS_STATS_TYPE_SPECIAL}, -+ {"no_desc" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_nexthop" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_nexthop_queue" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_linear_sz" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_linear_alloc" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_linear_no_sg" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_split_sz" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_split_alloc" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_sync_alloc" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_ctx_active" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[0]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[1]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[2]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[3]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[4]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[5]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[6]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[7]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[8]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[9]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[10]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[11]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[12]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[13]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[14]" , NSS_STATS_TYPE_SPECIAL}, -+ {"fail_hw[15]" , NSS_STATS_TYPE_SPECIAL}, -+}; -+ -+ -+/* -+ * nss_dma_strings_read() -+ * Read DMA node statistics names -+ */ -+static ssize_t nss_dma_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos) -+{ -+ return nss_strings_print(ubuf, sz, ppos, nss_dma_strings_stats, NSS_DMA_STATS_MAX); -+} -+ -+/* -+ * nss_dma_strings_ops -+ */ -+NSS_STRINGS_DECLARE_FILE_OPERATIONS(dma); -+ -+/* -+ * nss_dma_strings_dentry_create() -+ * Create DMA statistics strings debug entry. -+ */ -+void nss_dma_strings_dentry_create(void) -+{ -+ nss_strings_create_dentry("dma", &nss_dma_strings_ops); -+} ---- /dev/null -+++ b/nss_dma_strings.h -@@ -0,0 +1,25 @@ -+/* -+ ************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * -+ * Permission to use, copy, modify, and/or distribute this software for -+ * any purpose with or without fee is hereby granted, provided that the -+ * above copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ ************************************************************************** -+ */ -+ -+#ifndef __NSS_DMA_STRINGS_H -+#define __NSS_DMA_STRINGS_H -+ -+extern struct nss_stats_info nss_dma_strings_stats[NSS_DMA_STATS_MAX]; -+extern void nss_dma_strings_dentry_create(void); -+ -+#endif /* __NSS_DMA_STRINGS_H */ ---- a/nss_dtls.c -+++ b/nss_dtls.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -163,14 +163,14 @@ static void nss_dtls_handler(struct nss_ - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_DTLS_MSG_MAX) { -- nss_warning("%p: received invalid message %d " -+ nss_warning("%px: received invalid message %d " - "for DTLS interface %d", - nss_ctx, ncm->type, ncm->interface); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_dtls_msg)) { -- nss_warning("%p: dtls message length is invalid: %d", -+ nss_warning("%px: dtls message length is invalid: %d", - nss_ctx, ncm->len); - return; - } -@@ -211,7 +211,7 @@ static void nss_dtls_handler(struct nss_ - * call dtls session callback - */ - if (!cb) { -- nss_warning("%p: No callback for dtls session interface %d", -+ nss_warning("%px: No callback for dtls session interface %d", - nss_ctx, ncm->interface); - return; - } -@@ -279,7 +279,7 @@ nss_tx_status_t nss_dtls_tx_msg(struct n - BUG_ON(!nss_dtls_verify_if_num(ncm->interface)); - - if (ncm->type > NSS_DTLS_MSG_MAX) { -- nss_warning("%p: dtls message type out of range: %d", -+ nss_warning("%px: dtls message type out of range: %d", - nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } -@@ -312,7 +312,7 @@ nss_tx_status_t nss_dtls_tx_msg_sync(str - - status = nss_dtls_tx_msg(nss_ctx, msg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: dtls_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: dtls_tx_msg failed\n", nss_ctx); - up(&dtls_pvt.sem); - return status; - } -@@ -320,7 +320,7 @@ nss_tx_status_t nss_dtls_tx_msg_sync(str - ret = wait_for_completion_timeout(&dtls_pvt.complete, msecs_to_jiffies(NSS_DTLS_TX_TIMEOUT)); - - if (!ret) { -- nss_warning("%p: DTLS msg tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: DTLS msg tx failed due to timeout\n", nss_ctx); - dtls_pvt.response = NSS_TX_FAILURE; - } - -@@ -364,13 +364,13 @@ struct nss_ctx_instance *nss_dtls_regist - spin_unlock_bh(&nss_dtls_session_stats_lock); - - if (i == NSS_MAX_DTLS_SESSIONS) { -- nss_warning("%p: Cannot find free slot for " -+ nss_warning("%px: Cannot find free slot for " - "DTLS session stats, I/F:%u\n", nss_ctx, if_num); - return NULL; - } - - if (nss_ctx->subsys_dp_register[if_num].ndev) { -- nss_warning("%p: Cannot find free slot for " -+ nss_warning("%px: Cannot find free slot for " - "DTLS NSS I/F:%u\n", nss_ctx, if_num); - - return NULL; -@@ -407,12 +407,12 @@ void nss_dtls_unregister_if(uint32_t if_ - spin_unlock_bh(&nss_dtls_session_stats_lock); - - if (i == NSS_MAX_DTLS_SESSIONS) { -- nss_warning("%p: Cannot find debug stats for DTLS session %d\n", nss_ctx, if_num); -+ nss_warning("%px: Cannot find debug stats for DTLS session %d\n", nss_ctx, if_num); - return; - } - - if (!nss_ctx->subsys_dp_register[if_num].ndev) { -- nss_warning("%p: Cannot find registered netdev for DTLS NSS I/F:%u\n", nss_ctx, if_num); -+ nss_warning("%px: Cannot find registered netdev for DTLS NSS I/F:%u\n", nss_ctx, if_num); - - return; - } ---- a/nss_dtls_cmn.c -+++ b/nss_dtls_cmn.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -147,18 +147,18 @@ static void nss_dtls_cmn_handler(struct - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - -- nss_trace("%p: handle event for interface num :%u", nss_ctx, ncm->interface); -+ nss_trace("%px: handle event for interface num :%u", nss_ctx, ncm->interface); - - /* - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_DTLS_CMN_MSG_MAX) { -- nss_warning("%p:Bad message type(%d) for DTLS interface %d", nss_ctx, ncm->type, ncm->interface); -+ nss_warning("%px:Bad message type(%d) for DTLS interface %d", nss_ctx, ncm->type, ncm->interface); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_dtls_cmn_msg)) { -- nss_warning("%p:Bad message length(%d)", nss_ctx, ncm->len); -+ nss_warning("%px:Bad message length(%d)", nss_ctx, ncm->len); - return; - } - -@@ -169,7 +169,7 @@ static void nss_dtls_cmn_handler(struct - * Update the callback and app_data for NOTIFY messages. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_top_main.if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->nss_rx_interface_handlers[nss_ctx->id][ncm->interface].app_data; - } - -@@ -193,11 +193,11 @@ static void nss_dtls_cmn_handler(struct - * Call DTLS session callback. - */ - if (!cb) { -- nss_warning("%p: No callback for dtls session interface %d", nss_ctx, ncm->interface); -+ nss_warning("%px: No callback for dtls session interface %d", nss_ctx, ncm->interface); - return; - } - -- nss_trace("%p: calling dtlsmgr event handler(%u)", nss_ctx, ncm->interface); -+ nss_trace("%px: calling dtlsmgr event handler(%u)", nss_ctx, ncm->interface); - cb(app_data, ncm); - } - -@@ -242,12 +242,12 @@ nss_tx_status_t nss_dtls_cmn_tx_msg(stru - struct nss_cmn_msg *ncm = &msg->cm; - - if (ncm->type >= NSS_DTLS_CMN_MSG_MAX) { -- nss_warning("%p: dtls message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: dtls message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - - if (!nss_dtls_cmn_verify_ifnum(nss_ctx, ncm->interface)) { -- nss_warning("%p: dtls message interface is bad: %u", nss_ctx, ncm->interface); -+ nss_warning("%px: dtls message interface is bad: %u", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - -@@ -276,7 +276,7 @@ nss_tx_status_t nss_dtls_cmn_tx_msg_sync - * Length of the message should be the based on type. - */ - if (len > sizeof(ndcm_local.msg)) { -- nss_warning("%p: (%u)Bad message length(%u) for type (%d)", nss_ctx, if_num, len, type); -+ nss_warning("%px: (%u)Bad message length(%u) for type (%d)", nss_ctx, if_num, len, type); - return NSS_TX_FAILURE_TOO_LARGE; - } - -@@ -284,7 +284,7 @@ nss_tx_status_t nss_dtls_cmn_tx_msg_sync - * Response buffer is a required for copying the response for message. - */ - if (!resp) { -- nss_warning("%p: (%u)Response buffer is empty, type(%d)", nss_ctx, if_num, type); -+ nss_warning("%px: (%u)Response buffer is empty, type(%d)", nss_ctx, if_num, type); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -306,13 +306,13 @@ nss_tx_status_t nss_dtls_cmn_tx_msg_sync - - status = nss_dtls_cmn_tx_msg(nss_ctx, &ndcm_local); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: dtls_tx_msg failed", nss_ctx); -+ nss_warning("%px: dtls_tx_msg failed", nss_ctx); - goto done; - } - - ret = wait_for_completion_timeout(&dtls_cmn_pvt.complete, msecs_to_jiffies(NSS_DTLS_CMN_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: DTLS msg tx failed due to timeout", nss_ctx); -+ nss_warning("%px: DTLS msg tx failed due to timeout", nss_ctx); - status = NSS_TX_FAILURE_NOT_READY; - goto done; - } -@@ -354,11 +354,16 @@ struct nss_ctx_instance *nss_dtls_cmn_no - - ret = nss_core_register_handler(nss_ctx, if_num, nss_dtls_cmn_handler, app_data); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: unable to register event handler for interface(%u)", nss_ctx, if_num); -+ nss_warning("%px: unable to register event handler for interface(%u)", nss_ctx, if_num); - return NULL; - } - -- nss_top_main.if_rx_msg_callback[if_num] = ev_cb; -+ ret = nss_core_register_msg_handler(nss_ctx, if_num, ev_cb); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, if_num); -+ nss_warning("%px: unable to register event handler for interface(%u)", nss_ctx, if_num); -+ return NULL; -+ } - - return nss_ctx; - } -@@ -375,13 +380,17 @@ void nss_dtls_cmn_notify_unregister(uint - - BUG_ON(!nss_ctx); - -- ret = nss_core_unregister_handler(nss_ctx, if_num); -+ ret = nss_core_unregister_msg_handler(nss_ctx, if_num); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: unable to un register event handler for interface(%u)", nss_ctx, if_num); -+ nss_warning("%px: unable to unregister event handler for interface(%u)", nss_ctx, if_num); - return; - } - -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ ret = nss_core_unregister_handler(nss_ctx, if_num); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to unregister event handler for interface(%u)", nss_ctx, if_num); -+ return; -+ } - - return; - } -@@ -403,12 +412,12 @@ struct nss_ctx_instance *nss_dtls_cmn_re - uint32_t ret; - - if (!nss_dtls_cmn_verify_ifnum(nss_ctx, if_num)) { -- nss_warning("%p: DTLS Interface is not dynamic:%u", nss_ctx, if_num); -+ nss_warning("%px: DTLS Interface is not dynamic:%u", nss_ctx, if_num); - return NULL; - } - - if (nss_ctx->subsys_dp_register[if_num].ndev) { -- nss_warning("%p: Cannot find free slot for DTLS NSS I/F:%u", nss_ctx, if_num); -+ nss_warning("%px: Cannot find free slot for DTLS NSS I/F:%u", nss_ctx, if_num); - return NULL; - } - -@@ -417,11 +426,16 @@ struct nss_ctx_instance *nss_dtls_cmn_re - - ret = nss_core_register_handler(nss_ctx, if_num, nss_dtls_cmn_handler, app_data); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: unable to register event handler for interface(%u)", nss_ctx, if_num); -+ nss_warning("%px: unable to register event handler for interface(%u)", nss_ctx, if_num); - return NULL; - } - -- nss_top_main.if_rx_msg_callback[if_num] = ev_cb; -+ ret = nss_core_register_msg_handler(nss_ctx, if_num, ev_cb); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, if_num); -+ nss_warning("%px: unable to register event handler for interface(%u)", nss_ctx, if_num); -+ return NULL; -+ } - - /* - * Atomically set the bitmap for the interface number. -@@ -438,9 +452,10 @@ EXPORT_SYMBOL(nss_dtls_cmn_register_if); - void nss_dtls_cmn_unregister_if(uint32_t if_num) - { - struct nss_ctx_instance *nss_ctx = nss_dtls_cmn_get_context(); -+ uint32_t ret; - - if (!nss_ctx->subsys_dp_register[if_num].ndev) { -- nss_warning("%p: Cannot find registered netdev for DTLS NSS I/F:%u", nss_ctx, if_num); -+ nss_warning("%px: Cannot find registered netdev for DTLS NSS I/F:%u", nss_ctx, if_num); - return; - } - -@@ -449,8 +464,13 @@ void nss_dtls_cmn_unregister_if(uint32_t - */ - clear_bit(if_num, dtls_cmn_pvt.if_map); - -+ ret = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to unregister event handler for interface(%u)", nss_ctx, if_num); -+ return; -+ } -+ - nss_core_unregister_handler(nss_ctx, if_num); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; - - nss_core_unregister_subsys_dp(nss_ctx, if_num); - nss_ctx->subsys_dp_register[if_num].type = 0; ---- a/nss_dtls_cmn_log.c -+++ b/nss_dtls_cmn_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -63,12 +63,12 @@ static int8_t *nss_dtls_cmn_log_error_re - static void nss_dtls_cmn_hdr_config_msg(struct nss_dtls_cmn_msg *ndm) - { - struct nss_dtls_cmn_ctx_config_hdr *ndchm __maybe_unused = &ndm->msg.hdr_cfg; -- nss_trace("%p: NSS DTLS_CMN Header Configure Message:\n" -+ nss_trace("%px: NSS DTLS_CMN Header Configure Message:\n" - "DTLS_CMN flags: %x\n" - "DTLS_CMN destination interface number: %d\n" - "DTLS_CMN source interface number: %d\n" -- "DTLS_CMN source ip: %p\n" -- "DTLS_CMN destination ip: %p\n" -+ "DTLS_CMN source ip: %px\n" -+ "DTLS_CMN destination ip: %px\n" - "DTLS_CMN source port: %d\n" - "DTLS_CMN destination port: %d\n" - "DTLS_CMN time to live: %d\n" -@@ -90,7 +90,7 @@ static void nss_dtls_cmn_hdr_config_msg( - static void nss_dtls_cmn_dtls_config_msg(struct nss_dtls_cmn_msg *ndm) - { - struct nss_dtls_cmn_ctx_config_dtls *ndcdm __maybe_unused = &ndm->msg.dtls_cfg; -- nss_trace("%p: NSS DTLS_CMN DTLS Configure Message:\n" -+ nss_trace("%px: NSS DTLS_CMN DTLS Configure Message:\n" - "DTLS_CMN version: %d\n" - "DTLS_CMN crypto Index: %d\n" - "DTLS_CMN window size: %d\n" -@@ -122,7 +122,7 @@ static void nss_dtls_cmn_log_verbose(str - break; - - default: -- nss_warning("%p: Invalid message type\n", ndm); -+ nss_warning("%px: Invalid message type\n", ndm); - break; - } - } -@@ -134,11 +134,11 @@ static void nss_dtls_cmn_log_verbose(str - void nss_dtls_cmn_log_tx_msg(struct nss_dtls_cmn_msg *ndm) - { - if (ndm->cm.type >= NSS_DTLS_CMN_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", ndm); -+ nss_warning("%px: Invalid message type\n", ndm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ndm, ndm->cm.type, nss_dtls_cmn_log_message_types_str[ndm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ndm, ndm->cm.type, nss_dtls_cmn_log_message_types_str[ndm->cm.type]); - nss_dtls_cmn_log_verbose(ndm); - } - -@@ -149,26 +149,26 @@ void nss_dtls_cmn_log_tx_msg(struct nss_ - void nss_dtls_cmn_log_rx_msg(struct nss_dtls_cmn_msg *ndm) - { - if (ndm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ndm); -+ nss_warning("%px: Invalid response\n", ndm); - return; - } - - if (ndm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ndm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ndm, ndm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ndm, ndm->cm.type, - nss_dtls_cmn_log_message_types_str[ndm->cm.type], - ndm->cm.response, nss_cmn_response_str[ndm->cm.response]); - goto verbose; - } - - if (ndm->cm.error >= NSS_DTLS_CMN_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ndm, ndm->cm.type, nss_dtls_cmn_log_message_types_str[ndm->cm.type], - ndm->cm.response, nss_cmn_response_str[ndm->cm.response], - ndm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ndm, ndm->cm.type, nss_dtls_cmn_log_message_types_str[ndm->cm.type], - ndm->cm.response, nss_cmn_response_str[ndm->cm.response], - ndm->cm.error, nss_dtls_cmn_log_error_response_types_str[ndm->cm.error]); ---- a/nss_dtls_log.c -+++ b/nss_dtls_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -54,7 +54,7 @@ static int8_t *nss_dtls_log_error_respon - static void nss_dtls_session_config_msg(struct nss_dtls_msg *ndm) - { - struct nss_dtls_session_configure *ndscm __maybe_unused = &ndm->msg.cfg; -- nss_trace("%p: NSS DTLS Session Configure Message:\n" -+ nss_trace("%px: NSS DTLS Session Configure Message:\n" - "DTLS Version: %d\n" - "DTLS Flags: %x\n" - "DTLS crypto index encap: %d\n" -@@ -70,8 +70,8 @@ static void nss_dtls_session_config_msg( - "DTLS NSS interface: %x\n" - "DTLS source port: %d\n" - "DTLS destination port: %d\n" -- "DTLS source ip: %p\n" -- "DTLS destination ip: %p\n" -+ "DTLS source ip: %px\n" -+ "DTLS destination ip: %px\n" - "DTLS window size: %d\n" - "DTLS epoch: %d\n" - "DTLS outer IP TTL: %d\n" -@@ -98,7 +98,7 @@ static void nss_dtls_session_config_msg( - static void nss_dtls_session_cipher_update_msg(struct nss_dtls_msg *ndm) - { - struct nss_dtls_session_cipher_update *ndscum __maybe_unused = &ndm->msg.cipher_update; -- nss_trace("%p: NSS DTLS Session Cipher Update message\n" -+ nss_trace("%px: NSS DTLS Session Cipher Update message\n" - "DTLS crypto index: %d\n" - "DTLS hash length: %d\n" - "DTLS crypto IV length for encapsulation: %d\n" -@@ -129,7 +129,7 @@ static void nss_dtls_log_verbose(struct - break; - - default: -- nss_warning("%p: Invalid message type\n", ndm); -+ nss_warning("%px: Invalid message type\n", ndm); - break; - } - } -@@ -141,11 +141,11 @@ static void nss_dtls_log_verbose(struct - void nss_dtls_log_tx_msg(struct nss_dtls_msg *ndm) - { - if (ndm->cm.type >= NSS_DTLS_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", ndm); -+ nss_warning("%px: Invalid message type\n", ndm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ndm, ndm->cm.type, nss_dtls_log_message_types_str[ndm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ndm, ndm->cm.type, nss_dtls_log_message_types_str[ndm->cm.type]); - nss_dtls_log_verbose(ndm); - } - -@@ -156,26 +156,26 @@ void nss_dtls_log_tx_msg(struct nss_dtls - void nss_dtls_log_rx_msg(struct nss_dtls_msg *ndm) - { - if (ndm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ndm); -+ nss_warning("%px: Invalid response\n", ndm); - return; - } - - if (ndm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ndm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ndm, ndm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ndm, ndm->cm.type, - nss_dtls_log_message_types_str[ndm->cm.type], - ndm->cm.response, nss_cmn_response_str[ndm->cm.response]); - goto verbose; - } - - if (ndm->cm.error >= NSS_DTLS_ERR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ndm, ndm->cm.type, nss_dtls_log_message_types_str[ndm->cm.type], - ndm->cm.response, nss_cmn_response_str[ndm->cm.response], - ndm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ndm, ndm->cm.type, nss_dtls_log_message_types_str[ndm->cm.type], - ndm->cm.response, nss_cmn_response_str[ndm->cm.response], - ndm->cm.error, nss_dtls_log_error_response_types_str[ndm->cm.error]); ---- a/nss_dynamic_interface.c -+++ b/nss_dynamic_interface.c -@@ -54,12 +54,12 @@ static void nss_dynamic_interface_handle - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_DYNAMIC_INTERFACE_MAX) { -- nss_warning("%p: received invalid message %d for dynamic interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for dynamic interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_dynamic_interface_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -79,12 +79,12 @@ static void nss_dynamic_interface_handle - switch (ndim->cm.type) { - case NSS_DYNAMIC_INTERFACE_ALLOC_NODE: - if (ncm->response == NSS_CMN_RESPONSE_ACK) { -- nss_info("%p alloc_node response ack if_num %d\n", nss_ctx, ndim->msg.alloc_node.if_num); -+ nss_info("%px alloc_node response ack if_num %d\n", nss_ctx, ndim->msg.alloc_node.if_num); - if_num = ndim->msg.alloc_node.if_num; - if (if_num > 0) { - nss_dynamic_interface_assigned_types[nss_ctx->id][if_num - NSS_DYNAMIC_IF_START] = ndim->msg.alloc_node.type; - } else { -- nss_warning("%p: if_num < 0\n", nss_ctx); -+ nss_warning("%px: if_num < 0\n", nss_ctx); - } - } - -@@ -92,7 +92,7 @@ static void nss_dynamic_interface_handle - - case NSS_DYNAMIC_INTERFACE_DEALLOC_NODE: - if (ncm->response == NSS_CMN_RESPONSE_ACK) { -- nss_info("%p dealloc_node response ack if_num %d\n", nss_ctx, ndim->msg.dealloc_node.if_num); -+ nss_info("%px dealloc_node response ack if_num %d\n", nss_ctx, ndim->msg.dealloc_node.if_num); - if_num = ndim->msg.dealloc_node.if_num; - nss_dynamic_interface_assigned_types[nss_ctx->id][if_num - NSS_DYNAMIC_IF_START] = NSS_DYNAMIC_INTERFACE_TYPE_NONE; - /* -@@ -104,7 +104,7 @@ static void nss_dynamic_interface_handle - break; - - default: -- nss_warning("%p: Received response %d for type %d, interface %d", -+ nss_warning("%px: Received response %d for type %d, interface %d", - nss_ctx, ncm->response, ncm->type, ncm->interface); - return; - } -@@ -113,7 +113,7 @@ static void nss_dynamic_interface_handle - * Do we have a callback? - */ - if (!ncm->cb) { -- nss_warning("%p: nss_dynamic_interface_handler cb is NULL\n", nss_ctx); -+ nss_warning("%px: nss_dynamic_interface_handler cb is NULL\n", nss_ctx); - return; - } - -@@ -154,12 +154,12 @@ nss_tx_status_t nss_dynamic_interface_tx - * Sanity check the message - */ - if (ncm->interface != NSS_DYNAMIC_INTERFACE) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_DYNAMIC_INTERFACE_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -183,7 +183,7 @@ static nss_tx_status_t nss_dynamic_inter - - status = nss_dynamic_interface_tx(nss_ctx, ndim); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: not able to transmit msg successfully\n", nss_ctx); -+ nss_warning("%px: not able to transmit msg successfully\n", nss_ctx); - return status; - } - -@@ -192,7 +192,7 @@ static nss_tx_status_t nss_dynamic_inter - */ - ret = wait_for_completion_timeout(&di_data->complete, msecs_to_jiffies(NSS_DYNAMIC_INTERFACE_COMP_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: Waiting for ack timed out\n", nss_ctx); -+ nss_warning("%px: Waiting for ack timed out\n", nss_ctx); - return NSS_TX_FAILURE; - } - -@@ -243,7 +243,7 @@ int nss_dynamic_interface_alloc_node(enu - */ - status = nss_dynamic_interface_tx_sync(nss_ctx, &di_data, &ndim); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p not able to transmit alloc node msg\n", nss_ctx); -+ nss_warning("%px not able to transmit alloc node msg\n", nss_ctx); - return -1; - } - -@@ -251,7 +251,7 @@ int nss_dynamic_interface_alloc_node(enu - * Check response and return -1 if its a NACK else proceed. - */ - if (di_data.response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p Received NACK from NSS - Response:%d\n", nss_ctx, di_data.response); -+ nss_warning("%px Received NACK from NSS - Response:%d\n", nss_ctx, di_data.response); - return -1; - } - -@@ -286,7 +286,7 @@ nss_tx_status_t nss_dynamic_interface_de - init_completion(&di_data.complete); - - if (nss_is_dynamic_interface(if_num) == false) { -- nss_warning("%p: nss_dynamic_interface if_num is not in range %d\n", nss_ctx, if_num); -+ nss_warning("%px: nss_dynamic_interface if_num is not in range %d\n", nss_ctx, if_num); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -302,12 +302,12 @@ nss_tx_status_t nss_dynamic_interface_de - */ - status = nss_dynamic_interface_tx_sync(nss_ctx, &di_data, &ndim); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p not able to transmit alloc node msg\n", nss_ctx); -+ nss_warning("%px not able to transmit alloc node msg\n", nss_ctx); - return status; - } - - if (di_data.response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p Received NACK from NSS\n", nss_ctx); -+ nss_warning("%px Received NACK from NSS\n", nss_ctx); - return -1; - } - ---- a/nss_dynamic_interface_log.c -+++ b/nss_dynamic_interface_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -52,7 +52,7 @@ static int8_t *nss_dynamic_interface_log - static void nss_dynamic_interface_alloc_node_log_msg(struct nss_dynamic_interface_msg *ndm) - { - struct nss_dynamic_interface_alloc_node_msg *ndanm __maybe_unused = &ndm->msg.alloc_node; -- nss_trace("%p: NSS Dynamic Interface Alloc Node Message:\n" -+ nss_trace("%px: NSS Dynamic Interface Alloc Node Message:\n" - "Dynamic Interface Type: %d\n" - "Dynamic Interface Number: %d\n", - ndanm, ndanm->type, -@@ -66,7 +66,7 @@ static void nss_dynamic_interface_alloc_ - static void nss_dynamic_interface_dealloc_node_log_msg(struct nss_dynamic_interface_msg *ndm) - { - struct nss_dynamic_interface_dealloc_node_msg *nddnm __maybe_unused = &ndm->msg.dealloc_node; -- nss_trace("%p: NSS Dynamic Interface Alloc Node Message:\n" -+ nss_trace("%px: NSS Dynamic Interface Alloc Node Message:\n" - "Dynamic Interface Type: %d\n" - "Dynamic Interface Number: %d\n", - nddnm, nddnm->type, -@@ -89,7 +89,7 @@ static void nss_dynamic_interface_log_ve - break; - - default: -- nss_warning("%p: Invalid message type\n", ndm); -+ nss_warning("%px: Invalid message type\n", ndm); - break; - } - } -@@ -101,11 +101,11 @@ static void nss_dynamic_interface_log_ve - void nss_dynamic_interface_log_tx_msg(struct nss_dynamic_interface_msg *ndm) - { - if (ndm->cm.type >= NSS_DYNAMIC_INTERFACE_MAX) { -- nss_warning("%p: Invalid message type\n", ndm); -+ nss_warning("%px: Invalid message type\n", ndm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ndm, ndm->cm.type, nss_dynamic_interface_log_message_types_str[ndm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ndm, ndm->cm.type, nss_dynamic_interface_log_message_types_str[ndm->cm.type]); - nss_dynamic_interface_log_verbose(ndm); - } - -@@ -116,26 +116,26 @@ void nss_dynamic_interface_log_tx_msg(st - void nss_dynamic_interface_log_rx_msg(struct nss_dynamic_interface_msg *ndm) - { - if (ndm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ndm); -+ nss_warning("%px: Invalid response\n", ndm); - return; - } - - if (ndm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ndm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ndm, ndm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ndm, ndm->cm.type, - nss_dynamic_interface_log_message_types_str[ndm->cm.type], - ndm->cm.response, nss_cmn_response_str[ndm->cm.response]); - goto verbose; - } - - if (ndm->cm.error >= NSS_DYNAMIC_INTERFACE_ERR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ndm, ndm->cm.type, nss_dynamic_interface_log_message_types_str[ndm->cm.type], - ndm->cm.response, nss_cmn_response_str[ndm->cm.response], - ndm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n, error[%d]:%s\n", - ndm, ndm->cm.type, nss_dynamic_interface_log_message_types_str[ndm->cm.type], - ndm->cm.response, nss_cmn_response_str[ndm->cm.response], - ndm->cm.error, nss_dynamic_interface_log_error_response_types_str[ndm->cm.error]); ---- a/nss_edma.c -+++ b/nss_edma.c -@@ -40,7 +40,7 @@ static void nss_edma_interface_handler(s - * Is this a valid request/response packet? - */ - if (nem->cm.type >= NSS_METADATA_TYPE_EDMA_MAX) { -- nss_warning("%p: received invalid message %d for edma interface", nss_ctx, nem->cm.type); -+ nss_warning("%px: received invalid message %d for edma interface", nss_ctx, nem->cm.type); - return; - } - -@@ -67,7 +67,7 @@ static void nss_edma_interface_handler(s - /* - * Check response - */ -- nss_info("%p: Received response %d for type %d, interface %d", -+ nss_info("%px: Received response %d for type %d, interface %d", - nss_ctx, ncm->response, ncm->type, ncm->interface); - } - } ---- a/nss_eth_rx.c -+++ b/nss_eth_rx.c -@@ -41,7 +41,7 @@ static void nss_eth_rx_interface_handler - * Is this a valid request/response packet? - */ - if (nem->cm.type >= NSS_METADATA_TYPE_ETH_RX_MAX) { -- nss_warning("%p: received invalid message %d for eth_rx interface", nss_ctx, nem->cm.type); -+ nss_warning("%px: received invalid message %d for eth_rx interface", nss_ctx, nem->cm.type); - return; - } - -@@ -59,7 +59,7 @@ static void nss_eth_rx_interface_handler - /* - * Check response - */ -- nss_info("%p: Received response %d for type %d, interface %d", -+ nss_info("%px: Received response %d for type %d, interface %d", - nss_ctx, ncm->response, ncm->type, ncm->interface); - } - } ---- a/nss_freq.c -+++ b/nss_freq.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2013, 2015-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013, 2015-2020 The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -66,7 +66,7 @@ static void nss_freq_handle_ack(struct n - /* - * NSS finished start noficiation - HW change clocks and send end notification - */ -- nss_info("%p: NSS ACK Received: %d - Change HW CLK/Send Finish to NSS\n", nss_ctx, nfa->ack); -+ nss_info("%px: NSS ACK Received: %d - Change HW CLK/Send Finish to NSS\n", nss_ctx, nfa->ack); - - return; - } -@@ -75,12 +75,12 @@ static void nss_freq_handle_ack(struct n - /* - * NSS finished end notification - Done - */ -- nss_info("%p: NSS ACK Received: %d - End Notification ACK - Running: %dmhz\n", nss_ctx, nfa->ack, nfa->freq_current); -+ nss_info("%px: NSS ACK Received: %d - End Notification ACK - Running: %dmhz\n", nss_ctx, nfa->ack, nfa->freq_current); - nss_runtime_samples.freq_scale_ready = 1; - return; - } - -- nss_info("%p: NSS had an error - Running: %dmhz\n", nss_ctx, nfa->freq_current); -+ nss_info("%px: NSS had an error - Running: %dmhz\n", nss_ctx, nfa->freq_current); - } - - /* -@@ -185,7 +185,7 @@ static void nss_freq_compute_cpu_usage(s - nss_freq_cpu_status.min = nss_freq_cpu_status.used; - } - -- nss_trace("%p: max_instructions:%d cpu_usage:%d max_usage:%d min_usage:%d\n", nss_ctx, -+ nss_trace("%px: max_instructions:%d cpu_usage:%d max_usage:%d min_usage:%d\n", nss_ctx, - nss_freq_cpu_status.max_ins, nss_freq_cpu_status.used, nss_freq_cpu_status.max, nss_freq_cpu_status.min); - - nss_freq_cpu_status.total = 0; -@@ -249,10 +249,10 @@ void nss_freq_scale_frequency(struct nss - * Print out statistics every 10 samples - */ - if (nss_runtime_samples.message_rate_limit++ >= NSS_MESSAGE_RATE_LIMIT) { -- nss_trace("%p: Running AVG:%x Sample:%x Divider:%d\n", nss_ctx, nss_runtime_samples.average, inst_cnt, nss_runtime_samples.sample_count); -- nss_trace("%p: Current Frequency Index:%d\n", nss_ctx, index); -- nss_trace("%p: Auto Scale Ready:%d Auto Scale:%d\n", nss_ctx, nss_runtime_samples.freq_scale_ready, nss_cmd_buf.auto_scale); -- nss_trace("%p: Current Rate:%x\n", nss_ctx, nss_runtime_samples.average); -+ nss_trace("%px: Running AVG:%x Sample:%x Divider:%d\n", nss_ctx, nss_runtime_samples.average, inst_cnt, nss_runtime_samples.sample_count); -+ nss_trace("%px: Current Frequency Index:%d\n", nss_ctx, index); -+ nss_trace("%px: Auto Scale Ready:%d Auto Scale:%d\n", nss_ctx, nss_runtime_samples.freq_scale_ready, nss_cmd_buf.auto_scale); -+ nss_trace("%px: Current Rate:%x\n", nss_ctx, nss_runtime_samples.average); - - nss_runtime_samples.message_rate_limit = 0; - } -@@ -361,7 +361,7 @@ static void nss_freq_interface_handler(s - /* - * Check response - */ -- nss_info("%p: Received response %d for type %d, interface %d", nss_ctx, ncm->response, ncm->type, ncm->interface); -+ nss_info("%px: Received response %d for type %d, interface %d", nss_ctx, ncm->response, ncm->type, ncm->interface); - } - } - } -@@ -375,7 +375,7 @@ nss_tx_status_t nss_freq_change(struct n - struct nss_corefreq_msg ncm; - struct nss_freq_msg *nfc; - -- nss_info("%p: frequency changing to: %d\n", nss_ctx, eng); -+ nss_info("%px: frequency changing to: %d\n", nss_ctx, eng); - - /* - * Update the max instruction count for a frequency during down scaling. -@@ -459,4 +459,4 @@ void nss_freq_init_cpu_usage(void) - nss_freq_cpu_status.avg_ctr = 0; - - nss_freq_stats_dentry_create(); --} -\ No newline at end of file -+} ---- a/nss_freq_log.c -+++ b/nss_freq_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -39,7 +39,7 @@ static int8_t *nss_freq_log_message_type - static void nss_freq_log_msg(struct nss_corefreq_msg *ncm) - { - struct nss_freq_msg *nfm __maybe_unused = &ncm->msg.nfc; -- nss_trace("%p: NSS Freq Message:\n" -+ nss_trace("%px: NSS Freq Message:\n" - "Frequency request: %d\n" - "Frequency start/end: %d\n" - "Frequency stats enable: %d\n" -@@ -69,7 +69,7 @@ static void nss_freq_log_verbose(struct - break; - - default: -- nss_warning("%p: Invalid message type\n", ncm); -+ nss_warning("%px: Invalid message type\n", ncm); - break; - } - } -@@ -81,17 +81,17 @@ static void nss_freq_log_verbose(struct - void nss_freq_log_rx_msg(struct nss_corefreq_msg *ncm) - { - if (ncm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ncm); -+ nss_warning("%px: Invalid response\n", ncm); - return; - } - - if (ncm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ncm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d], response[%d]:%s\n", ncm, ncm->cm.type, -+ nss_info("%px: type[%d], response[%d]:%s\n", ncm, ncm->cm.type, - ncm->cm.response, nss_cmn_response_str[ncm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - ncm, ncm->cm.type, nss_freq_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response]); - ---- a/nss_gre.c -+++ b/nss_gre.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -101,12 +101,12 @@ static void nss_gre_msg_handler(struct n - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_GRE_MSG_MAX) { -- nss_warning("%p: received invalid message %d for GRE STD interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for GRE STD interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_gre_msg)) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return; - } - -@@ -151,7 +151,7 @@ static void nss_gre_msg_handler(struct n - * call gre-std callback - */ - if (!cb) { -- nss_warning("%p: No callback for gre-std interface %d", -+ nss_warning("%px: No callback for gre-std interface %d", - nss_ctx, ncm->interface); - return; - } -@@ -217,12 +217,12 @@ nss_tx_status_t nss_gre_tx_msg(struct ns - * Sanity check the message - */ - if (!nss_is_dynamic_interface(ncm->interface)) { -- nss_warning("%p: tx request for non dynamic interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for non dynamic interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_GRE_MSG_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -253,14 +253,14 @@ nss_tx_status_t nss_gre_tx_msg_sync(stru - - status = nss_gre_tx_msg(nss_ctx, msg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: gre_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: gre_tx_msg failed\n", nss_ctx); - up(&nss_gre_pvt.sem); - return status; - } - ret = wait_for_completion_timeout(&nss_gre_pvt.complete, msecs_to_jiffies(NSS_GRE_TX_TIMEOUT)); - - if (!ret) { -- nss_warning("%p: GRE STD tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: GRE STD tx sync failed due to timeout\n", nss_ctx); - nss_gre_pvt.response = NSS_TX_FAILURE; - } - -@@ -310,7 +310,7 @@ struct nss_ctx_instance *nss_gre_registe - break; - - default: -- nss_warning("%p: Unable to register. Wrong interface type %d\n", nss_ctx, type); -+ nss_warning("%px: Unable to register. Wrong interface type %d\n", nss_ctx, type); - return NULL; - } - -@@ -340,7 +340,7 @@ void nss_gre_unregister_if(uint32_t if_n - - dev = nss_cmn_get_interface_dev(nss_ctx, if_num); - if (!dev) { -- nss_warning("%p: Unable to find net device for the interface %d\n", nss_ctx, if_num); -+ nss_warning("%px: Unable to find net device for the interface %d\n", nss_ctx, if_num); - return; - } - -@@ -373,7 +373,7 @@ int nss_gre_ifnum_with_core_id(int if_nu - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (!nss_is_dynamic_interface(if_num)) { -- nss_warning("%p: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); -+ nss_warning("%px: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); - return 0; - } - ---- a/nss_gre_log.c -+++ b/nss_gre_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -41,7 +41,7 @@ static int8_t *nss_gre_log_message_types - static void nss_gre_log_config_msg(struct nss_gre_msg *ngm) - { - struct nss_gre_config_msg *ngcm __maybe_unused = &ngm->msg.cmsg; -- nss_trace("%p: NSS GRE Config message\n" -+ nss_trace("%px: NSS GRE Config message\n" - "GRE flags: %d\n" - "GRE ikey: %d\n" - "GRE okey: %d\n" -@@ -78,7 +78,7 @@ static void nss_gre_log_config_msg(struc - static void nss_gre_log_deconfig_msg(struct nss_gre_msg *ngm) - { - struct nss_gre_deconfig_msg *ngdm __maybe_unused = &ngm->msg.dmsg; -- nss_trace("%p: NSS GRE deconfig message\n" -+ nss_trace("%px: NSS GRE deconfig message\n" - "GRE interface number: %d\n", - ngdm, ngdm->if_number); - } -@@ -90,7 +90,7 @@ static void nss_gre_log_deconfig_msg(str - static void nss_gre_log_linkup_msg(struct nss_gre_msg *ngm) - { - struct nss_gre_linkup_msg *nglm __maybe_unused = &ngm->msg.linkup; -- nss_trace("%p: NSS GRE linkup message\n" -+ nss_trace("%px: NSS GRE linkup message\n" - "GRE interface number: %d\n", - nglm, nglm->if_number); - } -@@ -102,7 +102,7 @@ static void nss_gre_log_linkup_msg(struc - static void nss_gre_log_linkdown_msg(struct nss_gre_msg *ngm) - { - struct nss_gre_linkdown_msg *ngdm __maybe_unused = &ngm->msg.linkdown; -- nss_trace("%p: NSS GRE linkdown message\n" -+ nss_trace("%px: NSS GRE linkdown message\n" - "GRE interface number: %d\n", - ngdm, ngdm->if_number); - } -@@ -140,7 +140,7 @@ static void nss_gre_log_verbose(struct n - break; - - default: -- nss_trace("%p: Invalid message type\n", ngm); -+ nss_trace("%px: Invalid message type\n", ngm); - break; - } - } -@@ -152,11 +152,11 @@ static void nss_gre_log_verbose(struct n - void nss_gre_log_tx_msg(struct nss_gre_msg *ngm) - { - if (ngm->cm.type >= NSS_GRE_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", ngm); -+ nss_warning("%px: Invalid message type\n", ngm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_log_message_types_str[NSS_GRE_LOG_MESSAGE_TYPE_INDEX(ngm->cm.type)]); -+ nss_info("%px: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_log_message_types_str[NSS_GRE_LOG_MESSAGE_TYPE_INDEX(ngm->cm.type)]); - nss_gre_log_verbose(ngm); - } - -@@ -167,18 +167,18 @@ void nss_gre_log_tx_msg(struct nss_gre_m - void nss_gre_log_rx_msg(struct nss_gre_msg *ngm) - { - if (ngm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ngm); -+ nss_warning("%px: Invalid response\n", ngm); - return; - } - - if (ngm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ngm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type, - nss_gre_log_message_types_str[NSS_GRE_LOG_MESSAGE_TYPE_INDEX(ngm->cm.type)], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - ngm, ngm->cm.type, nss_gre_log_message_types_str[NSS_GRE_LOG_MESSAGE_TYPE_INDEX(ngm->cm.type)], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response]); - ---- a/nss_gre_redir.c -+++ b/nss_gre_redir.c -@@ -85,12 +85,12 @@ static void nss_gre_redir_tunnel_update_ - type = nss_dynamic_interface_get_type(nss_ctx, if_num); - dev = nss_cmn_get_interface_dev(nss_ctx, if_num); - if (!dev) { -- nss_warning("%p: Unable to find net device for the interface %d\n", nss_ctx, if_num); -+ nss_warning("%px: Unable to find net device for the interface %d\n", nss_ctx, if_num); - return; - } - - if (!nss_gre_redir_verify_ifnum(if_num)) { -- nss_warning("%p: Unknown type for interface %d\n", nss_ctx, if_num); -+ nss_warning("%px: Unknown type for interface %d\n", nss_ctx, if_num); - return; - } - -@@ -102,7 +102,7 @@ static void nss_gre_redir_tunnel_update_ - } - - if (i == NSS_GRE_REDIR_MAX_INTERFACES) { -- nss_warning("%p: Unable to find tunnel stats instance for interface %d\n", nss_ctx, if_num); -+ nss_warning("%px: Unable to find tunnel stats instance for interface %d\n", nss_ctx, if_num); - return; - } - -@@ -184,12 +184,12 @@ static void nss_gre_redir_msg_handler(st - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_GRE_REDIR_MAX_MSG_TYPES) { -- nss_warning("%p: Received invalid message %d for gre interface", nss_ctx, ncm->type); -+ nss_warning("%px: Received invalid message %d for gre interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_gre_redir_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -198,7 +198,7 @@ static void nss_gre_redir_msg_handler(st - * to the same callback/app_data. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->nss_rx_interface_handlers[nss_ctx->id][ncm->interface].app_data; - } - -@@ -261,7 +261,7 @@ static struct nss_ctx_instance *nss_gre_ - - if (idx == -1) { - spin_unlock_bh(&nss_gre_redir_stats_lock); -- nss_warning("%p: Maximum number of gre_redir tunnel_stats instances are already allocated\n", nss_ctx); -+ nss_warning("%px: Maximum number of gre_redir tunnel_stats instances are already allocated\n", nss_ctx); - return NULL; - } - -@@ -284,13 +284,29 @@ static struct nss_ctx_instance *nss_gre_ - } - spin_unlock_bh(&nss_gre_redir_stats_lock); - -- nss_warning("%p: Not able to register handler for gre_redir interface %d with NSS core\n", nss_ctx, if_num); -+ nss_warning("%px: Not able to register handler for gre_redir interface %d with NSS core\n", nss_ctx, if_num); -+ return NULL; -+ } -+ -+ /* -+ * Registering handler for sending tunnel interface msgs to NSS. -+ */ -+ status = nss_core_register_msg_handler(nss_ctx, if_num, cb_func_msg); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, if_num); -+ spin_lock_bh(&nss_gre_redir_stats_lock); -+ tun_stats[idx].ref_count--; -+ if (!tun_stats[idx].ref_count) { -+ tun_stats[idx].dev = NULL; -+ } -+ spin_unlock_bh(&nss_gre_redir_stats_lock); -+ -+ nss_warning("%px: Not able to register handler for gre_redir interface %d with NSS core\n", nss_ctx, if_num); - return NULL; - } - - nss_core_register_subsys_dp(nss_ctx, if_num, cb_func_data, NULL, NULL, netdev, features); - nss_core_set_subsys_dp_type(nss_ctx, netdev, if_num, type); -- nss_top_main.if_rx_msg_callback[if_num] = cb_func_msg; - return nss_ctx; - } - -@@ -324,13 +340,13 @@ int nss_gre_redir_alloc_and_register_nod - (type != NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_US) && - (type != NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_DS)) { - -- nss_warning("%p: Unknown type %u\n", dev, type); -+ nss_warning("%px: Unknown type %u\n", dev, type); - return -1; - } - - ifnum = nss_dynamic_interface_alloc_node(type); - if (ifnum == -1) { -- nss_warning("%p: Unable to allocate GRE_REDIR node of type = %u\n", dev, type); -+ nss_warning("%px: Unable to allocate GRE_REDIR node of type = %u\n", dev, type); - return -1; - } - -@@ -369,12 +385,12 @@ nss_tx_status_t nss_gre_redir_configure_ - - if (ngrcm->ip_hdr_type != NSS_GRE_REDIR_IP_HDR_TYPE_IPV4 && - ngrcm->ip_hdr_type != NSS_GRE_REDIR_IP_HDR_TYPE_IPV6) { -- nss_warning("%p: Unknown IP header type %u\n", nss_ctx, ngrcm->ip_hdr_type); -+ nss_warning("%px: Unknown IP header type %u\n", nss_ctx, ngrcm->ip_hdr_type); - return NSS_TX_FAILURE_BAD_PARAM; - } - - if (ngrcm->gre_version != NSS_GRE_REDIR_HEADER_VERSION) { -- nss_warning("%p: Incorrect header version %u\n", nss_ctx, ngrcm->gre_version); -+ nss_warning("%px: Incorrect header version %u\n", nss_ctx, ngrcm->gre_version); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -383,13 +399,13 @@ nss_tx_status_t nss_gre_redir_configure_ - (iftype == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_WIFI_OFFL_INNER) || - (iftype == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_SJACK_INNER))) { - -- nss_warning("%p: Incorrect interface type %u\n", nss_ctx, iftype); -+ nss_warning("%px: Incorrect interface type %u\n", nss_ctx, iftype); - return NSS_TX_FAILURE_BAD_PARAM; - } - - outerif_type = nss_dynamic_interface_get_type(nss_ctx, ngrcm->except_outerif); - if (outerif_type != NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_OUTER) { -- nss_warning("%p: Incorrect type for exception interface %u\n", nss_ctx, outerif_type); -+ nss_warning("%px: Incorrect type for exception interface %u\n", nss_ctx, outerif_type); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -409,7 +425,7 @@ nss_tx_status_t nss_gre_redir_configure_ - - status = nss_gre_redir_tx_msg_sync(nss_ctx, &config); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to configure inner node %d.\n", nss_ctx, ifnum); -+ nss_warning("%px: Unable to configure inner node %d.\n", nss_ctx, ifnum); - } - - return status; -@@ -436,13 +452,13 @@ nss_tx_status_t nss_gre_redir_exception_ - - iftype = nss_dynamic_interface_get_type(nss_ctx, ifnum); - if (iftype != NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_DS) { -- nss_warning("%p: Incorrect interface type %u\n", nss_ctx, iftype); -+ nss_warning("%px: Incorrect interface type %u\n", nss_ctx, iftype); - return NSS_TX_FAILURE_BAD_PARAM; - } - - vap_type = nss_dynamic_interface_get_type(nss_ctx, ngrcm->dst_vap_nssif); - if ((vap_type != NSS_DYNAMIC_INTERFACE_TYPE_VAP)) { -- nss_warning("%p: Incorrect type for vap interface type = %u", nss_ctx, vap_type); -+ nss_warning("%px: Incorrect type for vap interface type = %u", nss_ctx, vap_type); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -454,7 +470,7 @@ nss_tx_status_t nss_gre_redir_exception_ - - status = nss_gre_redir_tx_msg_sync(nss_ctx, &config); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to register callback from gre redir exception ds %d\n", nss_ctx, ifnum); -+ nss_warning("%px: Unable to register callback from gre redir exception ds %d\n", nss_ctx, ifnum); - } - - return status; -@@ -481,13 +497,13 @@ nss_tx_status_t nss_gre_redir_configure_ - - if (ngrcm->ip_hdr_type != NSS_GRE_REDIR_IP_HDR_TYPE_IPV4 && - ngrcm->ip_hdr_type != NSS_GRE_REDIR_IP_HDR_TYPE_IPV6) { -- nss_warning("%p: Unknown IP header type %u\n", nss_ctx, ngrcm->ip_hdr_type); -+ nss_warning("%px: Unknown IP header type %u\n", nss_ctx, ngrcm->ip_hdr_type); - return NSS_TX_FAILURE_BAD_PARAM; - } - - iftype = nss_dynamic_interface_get_type(nss_ctx, ifnum); - if (iftype != NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_OUTER) { -- nss_warning("%p: Incorrect interface type %u\n", nss_ctx, iftype); -+ nss_warning("%px: Incorrect interface type %u\n", nss_ctx, iftype); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -499,7 +515,7 @@ nss_tx_status_t nss_gre_redir_configure_ - (ngrcm->except_sjackif - && sjackif_type != NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_SJACK_INNER)) { - -- nss_warning("%p: Incorrect type for exception interface hostif_type = %u" -+ nss_warning("%px: Incorrect type for exception interface hostif_type = %u" - "offlif_type = %u sjackif_type = %u\n", nss_ctx, hostif_type, - offlif_type, sjackif_type); - return NSS_TX_FAILURE_BAD_PARAM; -@@ -517,7 +533,7 @@ nss_tx_status_t nss_gre_redir_configure_ - - status = nss_gre_redir_tx_msg_sync(nss_ctx, &config); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to configure outer node %d\n", nss_ctx, ifnum); -+ nss_warning("%px: Unable to configure outer node %d\n", nss_ctx, ifnum); - } - - return status; -@@ -565,12 +581,12 @@ nss_tx_status_t nss_gre_redir_tx_msg(str - */ - if (((ncm->interface < NSS_DYNAMIC_IF_START) || (ncm->interface >= (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES))) && - ncm->interface != NSS_GRE_REDIR_INTERFACE) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_GRE_REDIR_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -592,14 +608,14 @@ nss_tx_status_t nss_gre_redir_tx_msg_syn - ngrm->cm.app_data = (nss_ptr_t)NULL; - status = nss_gre_redir_tx_msg(nss_ctx, ngrm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: gre_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: gre_tx_msg failed\n", nss_ctx); - up(&nss_gre_redir_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&nss_gre_redir_pvt.complete, msecs_to_jiffies(NSS_GRE_REDIR_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: GRE tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: GRE tx sync failed due to timeout\n", nss_ctx); - nss_gre_redir_pvt.response = NSS_TX_FAILURE; - } - -@@ -617,7 +633,7 @@ nss_tx_status_t nss_gre_redir_tx_buf(str - { - uint32_t type; - -- nss_trace("%p: gre_redir If Tx packet, id:%d, data=%p", nss_ctx, if_num, os_buf->data); -+ nss_trace("%px: gre_redir If Tx packet, id:%d, data=%px", nss_ctx, if_num, os_buf->data); - - /* - * We expect Tx packets to the tunnel only from an interface of -@@ -626,7 +642,7 @@ nss_tx_status_t nss_gre_redir_tx_buf(str - type = nss_dynamic_interface_get_type(nss_ctx, if_num); - if (!((type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_WIFI_HOST_INNER) - || (type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_DS))) { -- nss_warning("%p: Unknown type for interface %u\n", nss_ctx, type); -+ nss_warning("%px: Unknown type for interface %u\n", nss_ctx, type); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -642,7 +658,7 @@ nss_tx_status_t nss_gre_redir_tx_buf_nor - { - uint32_t type; - -- nss_trace("%p: gre_redir If Tx packet, id:%d, data=%p", nss_ctx, if_num, os_buf->data); -+ nss_trace("%px: gre_redir If Tx packet, id:%d, data=%px", nss_ctx, if_num, os_buf->data); - - /* - * We expect Tx packets to the tunnel only from an interface of -@@ -651,7 +667,7 @@ nss_tx_status_t nss_gre_redir_tx_buf_nor - type = nss_dynamic_interface_get_type(nss_ctx, if_num); - if (!((type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_WIFI_HOST_INNER) - || (type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_DS))) { -- nss_warning("%p: Unknown type for interface %u\n", nss_ctx, type); -+ nss_warning("%px: Unknown type for interface %u\n", nss_ctx, type); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -675,19 +691,24 @@ bool nss_gre_redir_unregister_if(uint32_ - - dev = nss_cmn_get_interface_dev(nss_ctx, if_num); - if (!dev) { -- nss_warning("%p: Unable to find net device for the interface %d\n", nss_ctx, if_num); -+ nss_warning("%px: Unable to find net device for the interface %d\n", nss_ctx, if_num); -+ return false; -+ } -+ -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to unregister handler for gre_redir interface %d with NSS core\n", nss_ctx, if_num); - return false; - } - - status = nss_core_unregister_handler(nss_ctx, if_num); - if (status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Not able to unregister handler for gre_redir interface %d with NSS core\n", nss_ctx, if_num); -+ nss_warning("%px: Not able to unregister handler for gre_redir interface %d with NSS core\n", nss_ctx, if_num); - return false; - } - - nss_core_set_subsys_dp_type(nss_ctx, dev, if_num, NSS_DYNAMIC_INTERFACE_TYPE_NONE); - nss_core_unregister_subsys_dp(nss_ctx, if_num); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; - spin_lock_bh(&nss_gre_redir_stats_lock); - - /* -@@ -740,7 +761,7 @@ void nss_gre_redir_register_handler(void - - gre_redir_dentry = nss_gre_redir_stats_dentry_create(); - if (!gre_redir_dentry) { -- nss_warning("%p: Not able to create debugfs entry\n", nss_ctx); -+ nss_warning("%px: Not able to create debugfs entry\n", nss_ctx); - return; - } - -@@ -751,7 +772,7 @@ void nss_gre_redir_register_handler(void - if (status != NSS_CORE_STATUS_SUCCESS) { - debugfs_remove_recursive(gre_redir_dentry); - gre_redir_dentry = NULL; -- nss_warning("%p: Not able to register handler for gre_redir base interface with NSS core\n", nss_ctx); -+ nss_warning("%px: Not able to register handler for gre_redir base interface with NSS core\n", nss_ctx); - return; - } - } ---- a/nss_gre_redir_lag_ds.c -+++ b/nss_gre_redir_lag_ds.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -88,7 +88,7 @@ static void nss_gre_redir_lag_ds_update_ - spin_lock_bh(&nss_gre_redir_lag_ds_stats_lock); - if (!nss_gre_redir_lag_ds_get_node_idx(ifnum, &idx)) { - spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock); -- nss_warning("%p: Unable to update hash stats msg. Stats context not found.\n", nss_ctx); -+ nss_warning("%px: Unable to update hash stats msg. Stats context not found.\n", nss_ctx); - return; - } - -@@ -132,12 +132,12 @@ static void nss_gre_redir_lag_ds_msg_han - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_GRE_REDIR_LAG_DS_MAX_MSG_TYPES) { -- nss_warning("%p: received invalid message %d for gre interface\n", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for gre interface\n", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_gre_redir_lag_ds_msg)) { -- nss_warning("%p: Length of message is greater than required: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -146,7 +146,7 @@ static void nss_gre_redir_lag_ds_msg_han - * to the same callback/app_data. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->nss_rx_interface_handlers[nss_ctx->id][ncm->interface].app_data; - } - -@@ -197,18 +197,23 @@ static enum nss_gre_redir_lag_err_types - nss_assert(nss_ctx); - nss_assert(!nss_gre_redir_lag_ds_verify_ifnum(if_num)); - -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to unregister handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); -+ return NSS_GRE_REDIR_LAG_ERR_CORE_UNREGISTER_FAILED; -+ } -+ - status = nss_core_unregister_handler(nss_ctx, if_num); - if (status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Not able to unregister handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); -+ nss_warning("%px: Not able to unregister handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); - return NSS_GRE_REDIR_LAG_ERR_CORE_UNREGISTER_FAILED; - } - - nss_core_unregister_subsys_dp(nss_ctx, if_num); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; - spin_lock_bh(&nss_gre_redir_lag_ds_stats_lock); - if (!nss_gre_redir_lag_ds_get_node_idx(if_num, &idx)) { - spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock); -- nss_warning("%p: Stats context not found.\n", nss_ctx); -+ nss_warning("%px: Stats context not found.\n", nss_ctx); - return NSS_GRE_REDIR_LAG_ERR_STATS_INDEX_NOT_FOUND; - } - -@@ -235,13 +240,22 @@ static struct nss_ctx_instance *nss_gre_ - */ - status = nss_core_register_handler(nss_ctx, if_num, nss_gre_redir_lag_ds_msg_handler, app_ctx); - if (status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Not able to register handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); -+ nss_warning("%px: Not able to register handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); -+ return NULL; -+ } -+ -+ /* -+ * Registering handler for sending tunnel interface msgs to NSS. -+ */ -+ status = nss_core_register_msg_handler(nss_ctx, if_num, cb_func_msg); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, if_num); -+ nss_warning("%px: Not able to register handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); - return NULL; - } - - nss_core_register_subsys_dp(nss_ctx, if_num, cb_func_data, NULL, NULL, netdev, features); - nss_core_set_subsys_dp_type(nss_ctx, netdev, if_num, type); -- nss_top_main.if_rx_msg_callback[if_num] = cb_func_msg; - spin_lock_bh(&nss_gre_redir_lag_ds_stats_lock); - for (i = 0; i < NSS_GRE_REDIR_LAG_MAX_NODE; i++) { - if (!tun_stats[i].valid) { -@@ -304,12 +318,12 @@ nss_tx_status_t nss_gre_redir_lag_ds_tx_ - * of type NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS. - */ - if (!nss_gre_redir_lag_ds_verify_ifnum(ncm->interface)) { -- nss_warning("%p: tx request for another interface: %d\n", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d\n", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_GRE_REDIR_LAG_DS_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d\n", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d\n", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -334,14 +348,14 @@ nss_tx_status_t nss_gre_redir_lag_ds_tx_ - - status = nss_gre_redir_lag_ds_tx_msg(nss_ctx, ngrm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: GRE LAG DS msg tx failed\n", nss_ctx); -+ nss_warning("%px: GRE LAG DS msg tx failed\n", nss_ctx); - up(&nss_gre_redir_lag_ds_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&nss_gre_redir_lag_ds_pvt.complete, msecs_to_jiffies(NSS_GRE_REDIR_LAG_DS_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: GRE LAG DS tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: GRE LAG DS tx sync failed due to timeout\n", nss_ctx); - nss_gre_redir_lag_ds_pvt.response = NSS_TX_FAILURE; - } - -@@ -362,19 +376,19 @@ enum nss_gre_redir_lag_err_types nss_gre - nss_tx_status_t status; - - if (!nss_gre_redir_lag_ds_verify_ifnum(ifnum)) { -- nss_warning("%p: Unknown interface type %u.\n", nss_ctx, ifnum); -+ nss_warning("%px: Unknown interface type %u.\n", nss_ctx, ifnum); - return NSS_GRE_REDIR_LAG_ERR_INCORRECT_IFNUM; - } - - ret = nss_gre_redir_lag_ds_unregister_if(ifnum); - if (ret) { -- nss_warning("%p: Unable to unregister interface %u.\n", nss_ctx, ifnum); -+ nss_warning("%px: Unable to unregister interface %u.\n", nss_ctx, ifnum); - return ret; - } - - status = nss_dynamic_interface_dealloc_node(ifnum, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to deallocate node %u\n", nss_ctx, ifnum); -+ nss_warning("%px: Unable to deallocate node %u\n", nss_ctx, ifnum); - return NSS_GRE_REDIR_LAG_ERR_DEALLOC_FAILED; - } - -@@ -396,17 +410,17 @@ int nss_gre_redir_lag_ds_alloc_and_regis - - ifnum = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS); - if (ifnum == -1) { -- nss_warning("%p: Unable to allocate GRE_LAG node of type = %u\n", dev, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS); -+ nss_warning("%px: Unable to allocate GRE_LAG node of type = %u\n", dev, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS); - return -1; - } - - nss_ctx = nss_gre_redir_lag_ds_register_if(ifnum, dev, cb_func_data, - cb_func_msg, 0, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS, app_ctx); - if (!nss_ctx) { -- nss_warning("%p: Unable to register GRE_LAG node of type = %u\n", dev, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS); -+ nss_warning("%px: Unable to register GRE_LAG node of type = %u\n", dev, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS); - status = nss_dynamic_interface_dealloc_node(ifnum, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to deallocate node of type = %u.\n", dev, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS); -+ nss_warning("%px: Unable to deallocate node of type = %u.\n", dev, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS); - } - - return -1; ---- a/nss_gre_redir_lag_ds_log.c -+++ b/nss_gre_redir_lag_ds_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -51,8 +51,8 @@ static int8_t *nss_gre_redir_lag_ds_log_ - static void nss_gre_redir_lag_ds_log_add_sta_msg(struct nss_gre_redir_lag_ds_msg *ngm) - { - struct nss_gre_redir_lag_ds_add_sta_msg *ngasm __maybe_unused = &ngm->msg.add_sta; -- nss_trace("%p: NSS GRE REDIR LAG DS Add STA Message:\n" -- "GRE REDIR LAG DS Station MAC Address: %p\n" -+ nss_trace("%px: NSS GRE REDIR LAG DS Add STA Message:\n" -+ "GRE REDIR LAG DS Station MAC Address: %px\n" - "GRE REDIR LAG DS Reorder Type: %d\n", - ngasm, ngasm->mac, ngasm->reorder_type); - } -@@ -64,8 +64,8 @@ static void nss_gre_redir_lag_ds_log_add - static void nss_gre_redir_lag_ds_log_del_sta_msg(struct nss_gre_redir_lag_ds_msg *ngm) - { - struct nss_gre_redir_lag_ds_delete_sta_msg *ngdsm __maybe_unused = &ngm->msg.del_sta; -- nss_trace("%p: NSS GRE REDIR LAG DS Del STA Message:\n" -- "GRE REDIR LAG DS Station MAC Address: %p\n", -+ nss_trace("%px: NSS GRE REDIR LAG DS Del STA Message:\n" -+ "GRE REDIR LAG DS Station MAC Address: %px\n", - ngdsm, ngdsm->mac); - } - -@@ -76,8 +76,8 @@ static void nss_gre_redir_lag_ds_log_del - static void nss_gre_redir_lag_ds_log_update_sta_msg(struct nss_gre_redir_lag_ds_msg *ngm) - { - struct nss_gre_redir_lag_ds_update_sta_msg *ngusm __maybe_unused = &ngm->msg.update_sta; -- nss_trace("%p: NSS GRE REDIR LAG DS Update STA Message:\n" -- "GRE REDIR LAG DS Station MAC Address: %p\n" -+ nss_trace("%px: NSS GRE REDIR LAG DS Update STA Message:\n" -+ "GRE REDIR LAG DS Station MAC Address: %px\n" - "GRE REDIR LAG DS Reorder Type: %d\n", - ngusm, ngusm->mac, ngusm->reorder_type); - } -@@ -108,7 +108,7 @@ static void nss_gre_redir_lag_ds_log_ver - break; - - default: -- nss_warning("%p: Invalid message type\n", ngm); -+ nss_warning("%px: Invalid message type\n", ngm); - break; - } - } -@@ -120,11 +120,11 @@ static void nss_gre_redir_lag_ds_log_ver - void nss_gre_redir_lag_ds_log_tx_msg(struct nss_gre_redir_lag_ds_msg *ngm) - { - if (ngm->cm.type >= NSS_GRE_REDIR_LAG_DS_MAX_MSG_TYPES) { -- nss_warning("%p: Invalid message type\n", ngm); -+ nss_warning("%px: Invalid message type\n", ngm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_lag_ds_log_message_types_str[ngm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_lag_ds_log_message_types_str[ngm->cm.type]); - nss_gre_redir_lag_ds_log_verbose(ngm); - } - -@@ -135,26 +135,26 @@ void nss_gre_redir_lag_ds_log_tx_msg(str - void nss_gre_redir_lag_ds_log_rx_msg(struct nss_gre_redir_lag_ds_msg *ngm) - { - if (ngm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ngm); -+ nss_warning("%px: Invalid response\n", ngm); - return; - } - - if (ngm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ngm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type, - nss_gre_redir_lag_ds_log_message_types_str[ngm->cm.type], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response]); - goto verbose; - } - - if (ngm->cm.error >= NSS_GRE_REDIR_LAG_ERR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ngm, ngm->cm.type, nss_gre_redir_lag_ds_log_message_types_str[ngm->cm.type], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response], - ngm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ngm, ngm->cm.type, nss_gre_redir_lag_ds_log_message_types_str[ngm->cm.type], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response], - ngm->cm.error, nss_gre_redir_lag_ds_log_error_response_types_str[ngm->cm.error]); ---- a/nss_gre_redir_lag_us.c -+++ b/nss_gre_redir_lag_us.c -@@ -111,7 +111,7 @@ static void nss_gre_redir_lag_us_update_ - spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); - if (!nss_gre_redir_lag_us_get_node_idx(ifnum, &idx)) { - spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); -- nss_warning("%p: Unable to update hash stats msg. Stats context not found.\n", nss_ctx); -+ nss_warning("%px: Unable to update hash stats msg. Stats context not found.\n", nss_ctx); - return; - } - -@@ -150,7 +150,7 @@ static void nss_gre_redir_lag_us_hash_up - spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); - if (!nss_gre_redir_lag_us_get_node_idx(ifnum, &idx)) { - spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); -- nss_warning("%p: Unable to update hash stats msg. Stats context not found.\n", nss_ctx); -+ nss_warning("%px: Unable to update hash stats msg. Stats context not found.\n", nss_ctx); - return; - } - -@@ -209,12 +209,12 @@ static void nss_gre_redir_lag_us_msg_han - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_GRE_REDIR_LAG_US_MAX_MSG_TYPES) { -- nss_warning("%p: received invalid message %d for gre interface\n", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for gre interface\n", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_gre_redir_lag_us_msg)) { -- nss_warning("%p: Length of message is greater than required: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -223,7 +223,7 @@ static void nss_gre_redir_lag_us_msg_han - * to the same callback/app_data. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->nss_rx_interface_handlers[nss_ctx->id][ncm->interface].app_data; - } - -@@ -274,12 +274,12 @@ static nss_tx_status_t nss_gre_redir_lag - * interface of type NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US. - */ - if (!nss_gre_redir_lag_us_verify_ifnum(ncm->interface)) { -- nss_warning("%p: tx request for another interface: %d\n", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d\n", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_GRE_REDIR_LAG_US_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d\n", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d\n", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -311,14 +311,14 @@ static nss_tx_status_t nss_gre_redir_lag - - status = nss_gre_redir_lag_us_tx_msg_with_size(nss_ctx, ngrm, size); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: gre_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: gre_tx_msg failed\n", nss_ctx); - up(&nss_gre_redir_lag_us_sync_ctx.sem); - return status; - } - - ret = wait_for_completion_timeout(&nss_gre_redir_lag_us_sync_ctx.complete, msecs_to_jiffies(NSS_GRE_REDIR_LAG_US_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: GRE LAG US tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: GRE LAG US tx sync failed due to timeout\n", nss_ctx); - nss_gre_redir_lag_us_sync_ctx.response = NSS_TX_FAILURE; - } - -@@ -358,7 +358,7 @@ static void nss_gre_redir_lag_us_stats_s - } - - retry--; -- nss_warning("%p: TX_NOT_OKAY, try again later\n", nss_ctx); -+ nss_warning("%px: TX_NOT_OKAY, try again later\n", nss_ctx); - usleep_range(100, 200); - } - -@@ -383,7 +383,7 @@ static bool nss_gre_redir_lag_us_sync_wo - spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); - if (!nss_gre_redir_lag_us_get_node_idx(ifnum, &idx)) { - spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); -- nss_warning("%p: Unable to init work. Stats context not found.\n", nss_ctx); -+ nss_warning("%px: Unable to init work. Stats context not found.\n", nss_ctx); - return false; - } - -@@ -394,7 +394,7 @@ static bool nss_gre_redir_lag_us_sync_wo - &(cmn_ctx.stats_ctx[idx].nss_gre_redir_lag_us_work), NSS_GRE_REDIR_LAG_US_STATS_SYNC_PERIOD); - if (!ret) { - spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); -- nss_warning("%p: Unable to queue work function to work queue\n", nss_ctx); -+ nss_warning("%px: Unable to queue work function to work queue\n", nss_ctx); - return false; - } - -@@ -415,14 +415,19 @@ static enum nss_gre_redir_lag_err_types - nss_assert(nss_ctx); - nss_assert(!nss_gre_redir_lag_us_verify_ifnum(if_num)); - -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to unregister handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); -+ return NSS_GRE_REDIR_LAG_ERR_CORE_UNREGISTER_FAILED; -+ } -+ - status = nss_core_unregister_handler(nss_ctx, if_num); - if (status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Not able to unregister handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); -+ nss_warning("%px: Not able to unregister handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); - return NSS_GRE_REDIR_LAG_ERR_CORE_UNREGISTER_FAILED; - } - - nss_core_unregister_subsys_dp(nss_ctx, if_num); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; - - spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); - if (!nss_gre_redir_lag_us_get_node_idx(if_num, &idx)) { -@@ -479,7 +484,22 @@ static struct nss_ctx_instance *nss_gre_ - */ - status = nss_core_register_handler(nss_ctx, if_num, nss_gre_redir_lag_us_msg_handler, app_ctx); - if (status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Not able to register handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); -+ nss_warning("%px: Not able to register handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); -+ spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); -+ cmn_ctx.stats_ctx[i].valid = false; -+ cmn_ctx.stats_ctx[i].cb = NULL; -+ cmn_ctx.stats_ctx[i].app_data = NULL; -+ spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); -+ return NULL; -+ } -+ -+ /* -+ * Registering handler for sending tunnel interface msgs to NSS. -+ */ -+ status = nss_core_register_msg_handler(nss_ctx, if_num, cb_func_msg); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, if_num); -+ nss_warning("%px: Not able to register handler for gre_lag interface %d with NSS core\n", nss_ctx, if_num); - spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); - cmn_ctx.stats_ctx[i].valid = false; - cmn_ctx.stats_ctx[i].cb = NULL; -@@ -490,7 +510,6 @@ static struct nss_ctx_instance *nss_gre_ - - nss_core_register_subsys_dp(nss_ctx, if_num, cb_func_data, NULL, NULL, netdev, features); - nss_core_set_subsys_dp_type(nss_ctx, netdev, if_num, type); -- nss_top_main.if_rx_msg_callback[if_num] = cb_func_msg; - return nss_ctx; - } - -@@ -524,32 +543,32 @@ bool nss_gre_redir_lag_us_configure_node - - config = (struct nss_gre_redir_lag_us_msg *) kzalloc(sizeof(struct nss_gre_redir_lag_us_msg), GFP_KERNEL); - if (!config) { -- nss_warning("%p: Unable to allocate memory to send configure message.\n", nss_ctx); -+ nss_warning("%px: Unable to allocate memory to send configure message.\n", nss_ctx); - return false; - } - - iftype = nss_dynamic_interface_get_type(nss_ctx, ifnum); - if (iftype != NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US) { -- nss_warning("%p: Incorrect interface type %u\n", nss_ctx, iftype); -+ nss_warning("%px: Incorrect interface type %u\n", nss_ctx, iftype); - kfree(config); - return false; - } - - if (!ngluc) { -- nss_warning("%p: Pointer to GRE redir LAG US message is NULL.\n", nss_ctx); -+ nss_warning("%px: Pointer to GRE redir LAG US message is NULL.\n", nss_ctx); - kfree(config); - return false; - } - - if ((ngluc->num_slaves < NSS_GRE_REDIR_LAG_MIN_SLAVE) || (ngluc->num_slaves > NSS_GRE_REDIR_LAG_MAX_SLAVE)) { -- nss_warning("%p: Number of slaves is not in reange\n", nss_ctx); -+ nss_warning("%px: Number of slaves is not in reange\n", nss_ctx); - kfree(config); - return false; - } - - ret = nss_gre_redir_lag_us_sync_work_init(ifnum); - if (!ret) { -- nss_warning("%p: Unable to initialize work queue\n", nss_ctx); -+ nss_warning("%px: Unable to initialize work queue\n", nss_ctx); - kfree(config); - return false; - } -@@ -571,7 +590,7 @@ bool nss_gre_redir_lag_us_configure_node - spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); - if (nss_gre_redir_lag_us_get_node_idx(ifnum, &idx)) { - spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock); -- nss_warning("%p: Stats context not found.\n", nss_ctx); -+ nss_warning("%px: Stats context not found.\n", nss_ctx); - return false; - } - -@@ -581,7 +600,7 @@ bool nss_gre_redir_lag_us_configure_node - * Work is per LAG US node. Cancel work as configuration failed. - */ - cancel_delayed_work_sync(&(cmn_ctx.stats_ctx[idx].nss_gre_redir_lag_us_work)); -- nss_warning("%p: Unable to configure upstream lag node %d.\n", nss_ctx, ifnum); -+ nss_warning("%px: Unable to configure upstream lag node %d.\n", nss_ctx, ifnum); - return false; - } - EXPORT_SYMBOL(nss_gre_redir_lag_us_configure_node); -@@ -645,19 +664,19 @@ enum nss_gre_redir_lag_err_types nss_gre - nss_tx_status_t status; - - if (!nss_gre_redir_lag_us_verify_ifnum(ifnum)) { -- nss_warning("%p: Unknown interface type %u.\n", nss_ctx, ifnum); -+ nss_warning("%px: Unknown interface type %u.\n", nss_ctx, ifnum); - return NSS_GRE_REDIR_LAG_ERR_INCORRECT_IFNUM; - } - - ret = nss_gre_redir_lag_us_unregister_if(ifnum); - if (ret) { -- nss_warning("%p: Unable to unregister interface %u.\n", nss_ctx, ifnum); -+ nss_warning("%px: Unable to unregister interface %u.\n", nss_ctx, ifnum); - return ret; - } - - status = nss_dynamic_interface_dealloc_node(ifnum, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to deallocate node %u\n", nss_ctx, ifnum); -+ nss_warning("%px: Unable to deallocate node %u\n", nss_ctx, ifnum); - return NSS_GRE_REDIR_LAG_ERR_DEALLOC_FAILED; - } - -@@ -679,17 +698,17 @@ int nss_gre_redir_lag_us_alloc_and_regis - - ifnum = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US); - if (ifnum == -1) { -- nss_warning("%p: Unable to allocate GRE_LAG node of type = %u\n", dev, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US); -+ nss_warning("%px: Unable to allocate GRE_LAG node of type = %u\n", dev, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US); - return -1; - } - - nss_ctx = nss_gre_redir_lag_us_register_if(ifnum, dev, cb_func_data, - cb_func_msg, 0, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US, app_ctx); - if (!nss_ctx) { -- nss_warning("%p: Unable to register GRE_LAG node of type = %u\n", dev, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US); -+ nss_warning("%px: Unable to register GRE_LAG node of type = %u\n", dev, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US); - status = nss_dynamic_interface_dealloc_node(ifnum, NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to deallocate node.\n", dev); -+ nss_warning("%px: Unable to deallocate node.\n", dev); - } - - return -1; ---- a/nss_gre_redir_lag_us_log.c -+++ b/nss_gre_redir_lag_us_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -53,10 +53,10 @@ static int8_t *nss_gre_redir_lag_us_log_ - static void nss_gre_redir_lag_us_log_config_msg(struct nss_gre_redir_lag_us_msg *ngm) - { - struct nss_gre_redir_lag_us_config_msg *ngcm __maybe_unused = &ngm->msg.config_us; -- nss_trace("%p: NSS GRE REDIR LAG Config Message:\n" -+ nss_trace("%px: NSS GRE REDIR LAG Config Message:\n" - "GRE REDIR LAG US Hash Mode: %d\n" - "GRE REDIR LAG US Number of Slaves: %d\n" -- "GRE REDIR LAG US Interface Number: %p\n", -+ "GRE REDIR LAG US Interface Number: %px\n", - ngcm, ngcm->hash_mode, ngcm->num_slaves, - ngcm->if_num); - } -@@ -68,10 +68,10 @@ static void nss_gre_redir_lag_us_log_con - static void nss_gre_redir_lag_us_log_add_hash_node_msg(struct nss_gre_redir_lag_us_msg *ngm) - { - struct nss_gre_redir_lag_us_add_hash_node_msg *ngam __maybe_unused = &ngm->msg.add_hash; -- nss_trace("%p: NSS GRE REDIR LAG Add Hash Node Message:\n" -+ nss_trace("%px: NSS GRE REDIR LAG Add Hash Node Message:\n" - "GRE REDIR LAG US Interface Number: %d\n" -- "GRE REDIR LAG US Source MAC: %p\n" -- "GRE REDIR LAG US Destination MAC: %p\n", -+ "GRE REDIR LAG US Source MAC: %px\n" -+ "GRE REDIR LAG US Destination MAC: %px\n", - ngam, ngam->if_num, ngam->src_mac, - ngam->dest_mac); - } -@@ -83,9 +83,9 @@ static void nss_gre_redir_lag_us_log_add - static void nss_gre_redir_lag_us_log_del_hash_node_msg(struct nss_gre_redir_lag_us_msg *ngm) - { - struct nss_gre_redir_lag_us_del_hash_node_msg *ngdm __maybe_unused = &ngm->msg.del_hash; -- nss_trace("%p: NSS GRE REDIR LAG Del Hash Node Message:\n" -- "GRE REDIR LAG US Source MAC: %p\n" -- "GRE REDIR LAG US Destination MAC: %p\n", -+ nss_trace("%px: NSS GRE REDIR LAG Del Hash Node Message:\n" -+ "GRE REDIR LAG US Source MAC: %px\n" -+ "GRE REDIR LAG US Destination MAC: %px\n", - ngdm, ngdm->src_mac,ngdm->dest_mac); - } - -@@ -96,9 +96,9 @@ static void nss_gre_redir_lag_us_log_del - static void nss_gre_redir_lag_us_log_query_hash_node_msg(struct nss_gre_redir_lag_us_msg *ngm) - { - struct nss_gre_redir_lag_us_query_hash_node_msg *ngqm __maybe_unused = &ngm->msg.query_hash; -- nss_trace("%p: NSS GRE REDIR LAG Query Hash Node Message:\n" -- "GRE REDIR LAG US Source MAC: %p\n" -- "GRE REDIR LAG US Destination MAC: %p\n" -+ nss_trace("%px: NSS GRE REDIR LAG Query Hash Node Message:\n" -+ "GRE REDIR LAG US Source MAC: %px\n" -+ "GRE REDIR LAG US Destination MAC: %px\n" - "GRE REDIR LAG US Interface Number: %d\n", - ngqm, ngqm->src_mac, ngqm->dest_mac, - ngqm->ifnum); -@@ -135,7 +135,7 @@ static void nss_gre_redir_lag_us_log_ver - break; - - default: -- nss_warning("%p: Invalid message type\n", ngm); -+ nss_warning("%px: Invalid message type\n", ngm); - break; - } - } -@@ -147,11 +147,11 @@ static void nss_gre_redir_lag_us_log_ver - void nss_gre_redir_lag_us_log_tx_msg(struct nss_gre_redir_lag_us_msg *ngm) - { - if (ngm->cm.type >= NSS_GRE_REDIR_LAG_US_MAX_MSG_TYPES) { -- nss_warning("%p: Invalid message type\n", ngm); -+ nss_warning("%px: Invalid message type\n", ngm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_lag_us_log_message_types_str[ngm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_lag_us_log_message_types_str[ngm->cm.type]); - nss_gre_redir_lag_us_log_verbose(ngm); - } - -@@ -162,26 +162,26 @@ void nss_gre_redir_lag_us_log_tx_msg(str - void nss_gre_redir_lag_us_log_rx_msg(struct nss_gre_redir_lag_us_msg *ngm) - { - if (ngm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ngm); -+ nss_warning("%px: Invalid response\n", ngm); - return; - } - - if (ngm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ngm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type, - nss_gre_redir_lag_us_log_message_types_str[ngm->cm.type], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response]); - goto verbose; - } - - if (ngm->cm.error >= NSS_GRE_REDIR_LAG_ERR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ngm, ngm->cm.type, nss_gre_redir_lag_us_log_message_types_str[ngm->cm.type], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response], - ngm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ngm, ngm->cm.type, nss_gre_redir_lag_us_log_message_types_str[ngm->cm.type], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response], - ngm->cm.error, nss_gre_redir_lag_us_log_error_response_types_str[ngm->cm.error]); ---- a/nss_gre_redir_log.c -+++ b/nss_gre_redir_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -43,10 +43,10 @@ static int8_t *nss_gre_redir_log_message - static void nss_gre_redir_log_inner_configure_msg(struct nss_gre_redir_msg *ngm) - { - struct nss_gre_redir_inner_configure_msg *ngicm __maybe_unused = &ngm->msg.inner_configure; -- nss_trace("%p: NSS GRE Redir Inner Configure message" -+ nss_trace("%px: NSS GRE Redir Inner Configure message" - "GRE REDIR IP Header Type: %d\n" -- "GRE REDIR Source IP: %p\n" -- "GRE REDIR Destination IP: %p\n" -+ "GRE REDIR Source IP: %px\n" -+ "GRE REDIR Destination IP: %px\n" - "GRE REDIR Outer Interface: %d\n" - "GRE REDIR Do not Fragment: %d\n" - "GRE REDIR IP TTL: %d\n" -@@ -64,7 +64,7 @@ static void nss_gre_redir_log_inner_conf - static void nss_gre_redir_log_interface_map_msg(struct nss_gre_redir_msg *ngm) - { - struct nss_gre_redir_interface_map_msg *ngicm __maybe_unused = &ngm->msg.interface_map; -- nss_trace("%p: NSS GRE Redir Interface Map message" -+ nss_trace("%px: NSS GRE Redir Interface Map message" - "GRE REDIR NSS VAP Interface: %d\n" - "GRE REDIR Next Hop NSS Interface: %d\n" - "GRE REDIR Radio ID: %d\n" -@@ -85,7 +85,7 @@ static void nss_gre_redir_log_interface_ - static void nss_gre_redir_log_interface_unmap_msg(struct nss_gre_redir_msg *ngm) - { - struct nss_gre_redir_interface_unmap_msg *ngicm __maybe_unused = &ngm->msg.interface_unmap; -- nss_trace("%p: NSS GRE Redir Interface Map message" -+ nss_trace("%px: NSS GRE Redir Interface Map message" - "GRE REDIR NSS VAP Interface: %d\n" - "GRE REDIR Radio ID: %d\n" - "GRE REDIR VAP ID: %d\n", -@@ -100,7 +100,7 @@ static void nss_gre_redir_log_interface_ - static void nss_gre_redir_log_sjack_map_msg(struct nss_gre_redir_msg *ngm) - { - struct nss_gre_redir_sjack_map_msg *ngscm __maybe_unused = &ngm->msg.sjack_map; -- nss_trace("%p: NSS GRE Redir SJACK Map message" -+ nss_trace("%px: NSS GRE Redir SJACK Map message" - "GRE REDIR Eth NSS Interface: %d\n" - "GRE REDIR Eth Interface ID: %d\n" - "GRE REDIR IPSec pattern: %x\n", -@@ -115,7 +115,7 @@ static void nss_gre_redir_log_sjack_map_ - static void nss_gre_redir_log_sjack_unmap_msg(struct nss_gre_redir_msg *ngm) - { - struct nss_gre_redir_sjack_unmap_msg *ngscm __maybe_unused = &ngm->msg.sjack_unmap; -- nss_trace("%p: NSS GRE Redir SJACK Map message" -+ nss_trace("%px: NSS GRE Redir SJACK Map message" - "GRE REDIR Eth NSS Interface: %d\n" - "GRE REDIR Eth Interface ID: %d\n", - ngscm, ngscm->eth_nssif, -@@ -129,7 +129,7 @@ static void nss_gre_redir_log_sjack_unma - static void nss_gre_redir_log_outer_configure_msg(struct nss_gre_redir_msg *ngm) - { - struct nss_gre_redir_outer_configure_msg *ngocm __maybe_unused = &ngm->msg.outer_configure; -- nss_trace("%p: NSS GRE Redir Outer Configure message" -+ nss_trace("%px: NSS GRE Redir Outer Configure message" - "GRE REDIR IP Header Type: %d\n" - "GRE REDIR Host Inner Interface: %d\n" - "GRE REDIR NSS Inner Interface: %d\n" -@@ -149,7 +149,7 @@ static void nss_gre_redir_log_outer_conf - static void nss_gre_redir_log_exception_ds_reg_cb_msg(struct nss_gre_redir_msg *ngm) - { - struct nss_gre_redir_exception_ds_reg_cb_msg *exception_ds_configure __maybe_unused = &ngm->msg.exception_ds_configure; -- nss_trace("%p: NSS GRE redir exception completion callback registration message\n" -+ nss_trace("%px: NSS GRE redir exception completion callback registration message\n" - "vap_if_num: %d\n", ngm, exception_ds_configure->dst_vap_nssif); - } - -@@ -195,7 +195,7 @@ static void nss_gre_redir_log_verbose(st - break; - - default: -- nss_warning("%p: Invalid message type\n", ngm); -+ nss_warning("%px: Invalid message type\n", ngm); - break; - } - } -@@ -207,11 +207,11 @@ static void nss_gre_redir_log_verbose(st - void nss_gre_redir_log_tx_msg(struct nss_gre_redir_msg *ngm) - { - if (ngm->cm.type >= NSS_GRE_REDIR_MAX_MSG_TYPES) { -- nss_warning("%p: Invalid message type\n", ngm); -+ nss_warning("%px: Invalid message type\n", ngm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_log_message_types_str[ngm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_log_message_types_str[ngm->cm.type]); - nss_gre_redir_log_verbose(ngm); - } - -@@ -222,18 +222,18 @@ void nss_gre_redir_log_tx_msg(struct nss - void nss_gre_redir_log_rx_msg(struct nss_gre_redir_msg *ngm) - { - if (ngm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ngm); -+ nss_warning("%px: Invalid response\n", ngm); - return; - } - - if (ngm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ngm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type, - nss_gre_redir_log_message_types_str[ngm->cm.type], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - ngm, ngm->cm.type, nss_gre_redir_log_message_types_str[ngm->cm.type], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response]); - ---- a/nss_gre_redir_mark.c -+++ b/nss_gre_redir_mark.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -62,12 +62,12 @@ static void nss_gre_redir_mark_stats_syn - struct net_device *dev; - dev = nss_cmn_get_interface_dev(nss_ctx, if_num); - if (!dev) { -- nss_warning("%p: Unable to find net device for the interface %d\n", nss_ctx, if_num); -+ nss_warning("%px: Unable to find net device for the interface %d\n", nss_ctx, if_num); - return; - } - - if (if_num != NSS_GRE_REDIR_MARK_INTERFACE) { -- nss_warning("%p: Unknown type for interface %d\n", nss_ctx, if_num); -+ nss_warning("%px: Unknown type for interface %d\n", nss_ctx, if_num); - return; - } - -@@ -116,12 +116,12 @@ static void nss_gre_redir_mark_handler(s - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_GRE_REDIR_MARK_MSG_MAX) { -- nss_warning("%p: received invalid message %d for GRE redir mark interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for GRE redir mark interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_gre_redir_mark_msg)) { -- nss_warning("%p: length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -145,7 +145,7 @@ static void nss_gre_redir_mark_handler(s - * interface. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_top_main.if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev; - } - -@@ -202,7 +202,7 @@ nss_tx_status_t nss_gre_redir_mark_reg_c - - vap_type = nss_dynamic_interface_get_type(nss_ctx, ngrcm->nss_if_num); - if ((vap_type != NSS_DYNAMIC_INTERFACE_TYPE_VAP)) { -- nss_warning("%p: Incorrect type for vap interface type = %u", nss_ctx, vap_type); -+ nss_warning("%px: Incorrect type for vap interface type = %u", nss_ctx, vap_type); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -214,7 +214,7 @@ nss_tx_status_t nss_gre_redir_mark_reg_c - - status = nss_gre_redir_mark_tx_msg_sync(nss_ctx, &config); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to register callback from GRE redir mark interface %d\n", nss_ctx, ifnum); -+ nss_warning("%px: Unable to register callback from GRE redir mark interface %d\n", nss_ctx, ifnum); - } - - return status; -@@ -238,12 +238,12 @@ nss_tx_status_t nss_gre_redir_mark_tx_ms - * interface should be of type of redir mark - */ - if (ncm->interface != NSS_GRE_REDIR_MARK_INTERFACE) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_GRE_REDIR_MARK_MSG_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -268,14 +268,14 @@ nss_tx_status_t nss_gre_redir_mark_tx_ms - ngrm->cm.app_data = (nss_ptr_t)NULL; - status = nss_gre_redir_mark_tx_msg(nss_ctx, ngrm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: GRE redir mark tx_msg failed\n", nss_ctx); -+ nss_warning("%px: GRE redir mark tx_msg failed\n", nss_ctx); - up(&nss_gre_redir_mark_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&nss_gre_redir_mark_pvt.complete, msecs_to_jiffies(NSS_GRE_REDIR_MARK_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: GRE redir mark message tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: GRE redir mark message tx sync failed due to timeout\n", nss_ctx); - nss_gre_redir_mark_pvt.response = NSS_TX_FAILURE; - } - -@@ -291,13 +291,13 @@ EXPORT_SYMBOL(nss_gre_redir_mark_tx_msg_ - */ - nss_tx_status_t nss_gre_redir_mark_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, uint32_t if_num) - { -- nss_trace("%p: GRE redir mark If Tx packet, interface id:%d, data=%p", nss_ctx, if_num, os_buf->data); -+ nss_trace("%px: GRE redir mark If Tx packet, interface id:%d, data=%px", nss_ctx, if_num, os_buf->data); - - /* - * We expect Tx packets to the GRE redir mark interface only. - */ - if (if_num != NSS_GRE_REDIR_MARK_INTERFACE) { -- nss_warning("%p: Invalid interface:%d for GRE redir mark packets\n", nss_ctx, if_num); -+ nss_warning("%px: Invalid interface:%d for GRE redir mark packets\n", nss_ctx, if_num); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -323,6 +323,7 @@ bool nss_gre_redir_mark_unregister_if(ui - { - struct nss_ctx_instance *nss_ctx __maybe_unused = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.gre_redir_handler_id]; - struct net_device *dev; -+ uint32_t status; - - nss_assert(nss_ctx); - nss_assert(if_num == NSS_GRE_REDIR_MARK_INTERFACE); -@@ -332,7 +333,14 @@ bool nss_gre_redir_mark_unregister_if(ui - BUG_ON(!dev); - - nss_core_unregister_subsys_dp(nss_ctx, if_num); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to unregister handler for gre_redir_mark interface %d with NSS core\n", -+ nss_ctx, if_num); -+ return false; -+ } -+ -+ nss_ctx->nss_rx_interface_handlers[nss_ctx->id][if_num].msg_cb = NULL; - return true; - } - EXPORT_SYMBOL(nss_gre_redir_mark_unregister_if); -@@ -346,6 +354,7 @@ struct nss_ctx_instance *nss_gre_redir_m - uint32_t features) - { - struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.gre_redir_handler_id]; -+ uint32_t status; - - nss_assert(nss_ctx); - nss_assert(if_num == NSS_GRE_REDIR_MARK_INTERFACE); -@@ -354,7 +363,13 @@ struct nss_ctx_instance *nss_gre_redir_m - * Registering the interface with network data path. - */ - nss_core_register_subsys_dp(nss_ctx, if_num, cb_func_data, NULL, NULL, netdev, features); -- nss_top_main.if_rx_msg_callback[if_num] = cb_func_msg; -+ status = nss_core_register_msg_handler(nss_ctx, NSS_GRE_REDIR_MARK_INTERFACE, cb_func_msg); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to register handler for gre_redir_mark interface %d with NSS core\n", -+ nss_ctx, if_num); -+ return NULL; -+ } -+ - return nss_ctx; - } - EXPORT_SYMBOL(nss_gre_redir_mark_register_if); -@@ -385,7 +400,7 @@ void nss_gre_redir_mark_register_handler - */ - gre_redir_mark_dentry = nss_gre_redir_mark_stats_dentry_create(); - if (!gre_redir_mark_dentry) { -- nss_warning("%p: Not able to create debugfs entry\n", nss_ctx); -+ nss_warning("%px: Not able to create debugfs entry\n", nss_ctx); - return; - } - -@@ -397,7 +412,7 @@ void nss_gre_redir_mark_register_handler - if (status != NSS_CORE_STATUS_SUCCESS) { - debugfs_remove_recursive(gre_redir_mark_dentry); - gre_redir_mark_dentry = NULL; -- nss_warning("%p: Not able to register handler for GRE redir mark with NSS core\n", nss_ctx); -+ nss_warning("%px: Not able to register handler for GRE redir mark with NSS core\n", nss_ctx); - return; - } - } ---- a/nss_gre_redir_mark_log.c -+++ b/nss_gre_redir_mark_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -14,7 +14,6 @@ - ************************************************************************** - */ - -- - #include "nss_core.h" - - /* -@@ -43,7 +42,7 @@ static int8_t *nss_gre_redir_mark_log_er - static void nss_gre_redir_mark_log_reg_cb_msg(struct nss_gre_redir_mark_msg *ncm) - { - struct nss_gre_redir_mark_register_cb_msg *reg_cb_msg __maybe_unused = &ncm->msg.reg_cb_msg; -- nss_trace("%p: NSS GRE redir mark callback registration message \n" -+ nss_trace("%px: NSS GRE redir mark callback registration message \n" - "nss_if_num: %d\n", ncm, reg_cb_msg->nss_if_num); - } - -@@ -65,7 +64,7 @@ static void nss_gre_redir_mark_log_verbo - break; - - default: -- nss_trace("%p: Invalid message type\n", ncm); -+ nss_trace("%px: Invalid message type\n", ncm); - break; - } - } -@@ -77,11 +76,11 @@ static void nss_gre_redir_mark_log_verbo - void nss_gre_redir_mark_log_tx_msg(struct nss_gre_redir_mark_msg *ngm) - { - if (ngm->cm.type >= NSS_GRE_REDIR_MARK_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", ngm); -+ nss_warning("%px: Invalid message type\n", ngm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_mark_log_message_types_str[ngm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_mark_log_message_types_str[ngm->cm.type]); - nss_gre_redir_mark_log_verbose(ngm); - } - /* -@@ -91,26 +90,26 @@ void nss_gre_redir_mark_log_tx_msg(struc - void nss_gre_redir_mark_log_rx_msg(struct nss_gre_redir_mark_msg *ncm) - { - if (ncm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ncm); -+ nss_warning("%px: Invalid response\n", ncm); - return; - } - - if (ncm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ncm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, - nss_gre_redir_mark_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response]); - goto verbose; - } - - if (ncm->cm.error >= NSS_GRE_REDIR_MARK_ERROR_TYPE_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ncm, ncm->cm.type, nss_gre_redir_mark_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ncm, ncm->cm.type, nss_gre_redir_mark_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error, nss_gre_redir_mark_log_error_response_types_str[ncm->cm.error]); -@@ -118,4 +117,3 @@ void nss_gre_redir_mark_log_rx_msg(struc - verbose: - nss_gre_redir_mark_log_verbose(ncm); - } -- ---- a/nss_gre_tunnel.c -+++ b/nss_gre_tunnel.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -74,12 +74,12 @@ static void nss_gre_tunnel_handler(struc - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_GRE_TUNNEL_MSG_MAX) { -- nss_warning("%p: received invalid message %d for GRE_TUNNEL interface %d", nss_ctx, ncm->type, ncm->interface); -+ nss_warning("%px: received invalid message %d for GRE_TUNNEL interface %d", nss_ctx, ncm->type, ncm->interface); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_gre_tunnel_msg)) { -- nss_warning("%p: gre_tunnel message length is invalid: %d", nss_ctx, ncm->len); -+ nss_warning("%px: gre_tunnel message length is invalid: %d", nss_ctx, ncm->len); - return; - } - -@@ -153,7 +153,7 @@ nss_tx_status_t nss_gre_tunnel_inquiry( - nim.msg.configure = *inquiry_info; - nss_tx_status = nss_gre_tunnel_tx_msg(nss_ctx, &nim); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: Send GT inquiry message failed\n", inquiry_info); -+ nss_warning("%px: Send GT inquiry message failed\n", inquiry_info); - } - - return nss_tx_status; -@@ -181,7 +181,7 @@ int nss_gre_tunnel_ifnum_with_core_id(in - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (nss_is_dynamic_interface(if_num) == false) { -- nss_info("%p: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); -+ nss_info("%px: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); - return 0; - } - -@@ -219,7 +219,7 @@ nss_tx_status_t nss_gre_tunnel_tx_msg(st - * Sanity check message - */ - if (ncm->type >= NSS_GRE_TUNNEL_MSG_MAX) { -- nss_warning("%p: gre_tunnel message type out of range: %d", -+ nss_warning("%px: gre_tunnel message type out of range: %d", - nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } -@@ -272,7 +272,7 @@ nss_tx_status_t nss_gre_tunnel_tx_msg_sy - - status = nss_gre_tunnel_tx_msg(nss_ctx, ngtm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: gre_tunnel_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: gre_tunnel_tx_msg failed\n", nss_ctx); - up(&gre_tunnel_pvt.sem); - return status; - } -@@ -280,7 +280,7 @@ nss_tx_status_t nss_gre_tunnel_tx_msg_sy - ret = wait_for_completion_timeout(&gre_tunnel_pvt.complete, msecs_to_jiffies(NSS_GRE_TUNNEL_TX_TIMEOUT)); - - if (!ret) { -- nss_warning("%p: GRE Tunnel msg tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: GRE Tunnel msg tx failed due to timeout\n", nss_ctx); - gre_tunnel_pvt.response = NSS_TX_FAILURE; - } - -@@ -330,12 +330,12 @@ struct nss_ctx_instance *nss_gre_tunnel_ - spin_unlock_bh(&nss_gre_tunnel_stats_session_debug_lock); - - if (i == NSS_MAX_GRE_TUNNEL_SESSIONS) { -- nss_warning("%p: Cannot find free slot for GRE Tunnel session stats, I/F:%u\n", nss_ctx, if_num); -+ nss_warning("%px: Cannot find free slot for GRE Tunnel session stats, I/F:%u\n", nss_ctx, if_num); - return NULL; - } - - if (nss_ctx->subsys_dp_register[if_num].ndev) { -- nss_warning("%p: Cannot find free slot for GRE Tunnel NSS I/F:%u\n", nss_ctx, if_num); -+ nss_warning("%px: Cannot find free slot for GRE Tunnel NSS I/F:%u\n", nss_ctx, if_num); - nss_gre_tunnel_session_debug_stats[i].valid = false; - nss_gre_tunnel_session_debug_stats[i].if_num = 0; - nss_gre_tunnel_session_debug_stats[i].if_index = 0; -@@ -374,12 +374,12 @@ void nss_gre_tunnel_unregister_if(uint32 - spin_unlock_bh(&nss_gre_tunnel_stats_session_debug_lock); - - if (i == NSS_MAX_GRE_TUNNEL_SESSIONS) { -- nss_warning("%p: Cannot find debug stats for GRE Tunnel session: %d\n", nss_ctx, if_num); -+ nss_warning("%px: Cannot find debug stats for GRE Tunnel session: %d\n", nss_ctx, if_num); - return; - } - - if (!nss_ctx->subsys_dp_register[if_num].ndev) { -- nss_warning("%p: Cannot find registered netdev for GRE Tunnel NSS I/F: %d\n", nss_ctx, if_num); -+ nss_warning("%px: Cannot find registered netdev for GRE Tunnel NSS I/F: %d\n", nss_ctx, if_num); - - return; - } ---- a/nss_gre_tunnel_log.c -+++ b/nss_gre_tunnel_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -40,7 +40,7 @@ static int8_t *nss_gre_tunnel_log_messag - static void nss_gre_tunnel_log_configure_msg(struct nss_gre_tunnel_msg *ngm) - { - struct nss_gre_tunnel_configure *ngcm __maybe_unused = &ngm->msg.configure; -- nss_trace("%p: NSS GRE Tunnel configure message \n" -+ nss_trace("%px: NSS GRE Tunnel configure message \n" - "Meta Header Version: %d\n" - "GRE Mode: %x\n" - "IP Type: %x\n" -@@ -51,7 +51,7 @@ static void nss_gre_tunnel_log_configure - "Encryption Crypto Index: %d\n" - "Decryption Crypto Index: %d\n" - "Word0 header: %d\n" -- "Initialization Vector: %p\n" -+ "Initialization Vector: %px\n" - "Sibling Interface Number: %d\n" - "TTL: %d\n" - "RPS: %d\n" -@@ -90,7 +90,7 @@ static void nss_gre_tunnel_log_configure - static void nss_gre_tunnel_log_di_to_wlan_id_msg(struct nss_gre_tunnel_msg *ngm) - { - struct nss_gre_tunnel_di_to_wlan_id *ngdm __maybe_unused = &ngm->msg.dtwi; -- nss_trace("%p: NSS GRE Dynamic Interface to WLAN ID message: \n" -+ nss_trace("%px: NSS GRE Dynamic Interface to WLAN ID message: \n" - "Dynamic Interface Number: %d\n" - "WLAN ID: %x\n", - ngdm, ngdm->dynamic_interface_num, -@@ -121,7 +121,7 @@ static void nss_gre_tunnel_log_verbose(s - break; - - default: -- nss_trace("%p: Invalid message type\n", ngm); -+ nss_trace("%px: Invalid message type\n", ngm); - break; - } - } -@@ -133,11 +133,11 @@ static void nss_gre_tunnel_log_verbose(s - void nss_gre_tunnel_log_tx_msg(struct nss_gre_tunnel_msg *ngm) - { - if (ngm->cm.type >= NSS_GRE_TUNNEL_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", ngm); -+ nss_warning("%px: Invalid message type\n", ngm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_tunnel_log_message_types_str[ngm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_tunnel_log_message_types_str[ngm->cm.type]); - nss_gre_tunnel_log_verbose(ngm); - } - -@@ -148,18 +148,18 @@ void nss_gre_tunnel_log_tx_msg(struct ns - void nss_gre_tunnel_log_rx_msg(struct nss_gre_tunnel_msg *ngm) - { - if (ngm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ngm); -+ nss_warning("%px: Invalid response\n", ngm); - return; - } - - if (ngm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ngm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type, - nss_gre_tunnel_log_message_types_str[ngm->cm.type], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - ngm, ngm->cm.type, nss_gre_tunnel_log_message_types_str[ngm->cm.type], - ngm->cm.response, nss_cmn_response_str[ngm->cm.response]); - ---- a/nss_gre_tunnel_stats.c -+++ b/nss_gre_tunnel_stats.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2017, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2017, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -76,7 +76,7 @@ void nss_gre_tunnel_stats_session_sync(s - - if (!s) { - spin_unlock_bh(&nss_gre_tunnel_stats_session_debug_lock); -- nss_warning("%p: Session not found: %u", nss_ctx, if_num); -+ nss_warning("%px: Session not found: %u", nss_ctx, if_num); - return; - } - -@@ -247,4 +247,3 @@ void nss_gre_tunnel_stats_dentry_create( - { - nss_stats_create_dentry("gre_tunnel", &nss_gre_tunnel_stats_ops); - } -- ---- a/nss_hal/fsm9010/nss_hal_pvt.c -+++ b/nss_hal/fsm9010/nss_hal_pvt.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -130,12 +130,12 @@ static struct nss_platform_data *__nss_h - nss_ctx->id = npd->id; - - if (of_address_to_resource(np, 0, &res_nphys) != 0) { -- nss_info_always("%p: nss%d: of_address_to_resource() fail for nphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: of_address_to_resource() fail for nphys\n", nss_ctx, nss_ctx->id); - goto out; - } - - if (of_address_to_resource(np, 1, &res_vphys) != 0) { -- nss_info_always("%p: nss%d: of_address_to_resource() fail for vphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: of_address_to_resource() fail for vphys\n", nss_ctx, nss_ctx->id); - goto out; - } - -@@ -147,13 +147,13 @@ static struct nss_platform_data *__nss_h - - npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); - if (!npd->nmap) { -- nss_info_always("%p: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); - goto out; - } - - npd->vmap = ioremap_cache(npd->vphys, resource_size(&res_vphys)); - if (!npd->vmap) { -- nss_info_always("%p: nss%d: ioremap() fail for vphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: ioremap() fail for vphys\n", nss_ctx, nss_ctx->id); - goto out; - } - -@@ -163,7 +163,7 @@ static struct nss_platform_data *__nss_h - for (i = 0 ; i < npd->num_irq; i++) { - npd->irq[i] = irq_of_parse_and_map(np, i); - if (!npd->irq[i]) { -- nss_info_always("%p: nss%d: irq_of_parse_and_map() fail for irq %d\n", nss_ctx, nss_ctx->id, i); -+ nss_info_always("%px: nss%d: irq_of_parse_and_map() fail for irq %d\n", nss_ctx, nss_ctx->id, i); - goto out; - } - } -@@ -285,7 +285,7 @@ static int __nss_hal_request_irq(struct - err = request_irq(npd->irq[irq_num], nss_hal_handle_irq, 0, "nss", int_ctx); - } - if (err) { -- nss_warning("%p: IRQ%d request failed", nss_ctx, npd->irq[irq_num]); -+ nss_warning("%px: IRQ%d request failed", nss_ctx, npd->irq[irq_num]); - return err; - } - -@@ -305,7 +305,7 @@ void __nss_hal_init_imem(struct nss_ctx_ - mem_ctx->imem_end = mem_ctx->imem_head + NSS_IMEM_SIZE; - mem_ctx->imem_tail = mem_ctx->imem_head; - -- nss_info("%p: IMEM init: head: 0x%x end: 0x%x tail: 0x%x\n", nss_ctx, -+ nss_info("%px: IMEM init: head: 0x%x end: 0x%x tail: 0x%x\n", nss_ctx, - mem_ctx->imem_head, mem_ctx->imem_end, mem_ctx->imem_tail); - } - ---- a/nss_hal/ipq60xx/nss_hal_pvt.c -+++ b/nss_hal/ipq60xx/nss_hal_pvt.c -@@ -192,12 +192,12 @@ static struct nss_platform_data *__nss_h - nss_ctx->id = npd->id; - - if (of_address_to_resource(np, 0, &res_nphys) != 0) { -- nss_info_always("%p: nss%d: of_address_to_resource() fail for nphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: of_address_to_resource() fail for nphys\n", nss_ctx, nss_ctx->id); - goto out; - } - - if (of_address_to_resource(np, 1, &res_qgic_phys) != 0) { -- nss_info_always("%p: nss%d: of_address_to_resource() fail for qgic_phys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: of_address_to_resource() fail for qgic_phys\n", nss_ctx, nss_ctx->id); - goto out; - } - -@@ -209,13 +209,13 @@ static struct nss_platform_data *__nss_h - - npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); - if (!npd->nmap) { -- nss_info_always("%p: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); - goto out; - } - - npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys)); - if (!npd->qgic_map) { -- nss_info_always("%p: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); - goto out; - } - -@@ -227,7 +227,7 @@ static struct nss_platform_data *__nss_h - for (i = 0 ; i < npd->num_irq; i++) { - npd->irq[i] = irq_of_parse_and_map(np, i); - if (!npd->irq[i]) { -- nss_info_always("%p: nss%d: irq_of_parse_and_map() fail for irq %d\n", nss_ctx, nss_ctx->id, i); -+ nss_info_always("%px: nss%d: irq_of_parse_and_map() fail for irq %d\n", nss_ctx, nss_ctx->id, i); - goto out; - } - } -@@ -261,21 +261,21 @@ static int nss_hal_clock_set_and_enable( - - nss_clk = devm_clk_get(dev, id); - if (IS_ERR(nss_clk)) { -- pr_err("%p: cannot get clock: %s\n", dev, id); -+ pr_err("%px: cannot get clock: %s\n", dev, id); - return -EFAULT; - } - - if (rate) { - err = clk_set_rate(nss_clk, rate); - if (err) { -- pr_err("%p: cannot set %s freq\n", dev, id); -+ pr_err("%px: cannot set %s freq\n", dev, id); - return -EFAULT; - } - } - - err = clk_prepare_enable(nss_clk); - if (err) { -- pr_err("%p: cannot enable clock: %s\n", dev, id); -+ pr_err("%px: cannot enable clock: %s\n", dev, id); - return -EFAULT; - } - -@@ -313,7 +313,6 @@ static int __nss_hal_core_reset(struct p - value &= ~NSS_CORE_GCC_RESET_2; - nss_write_32(nss_misc_reset, 0x0, value); - -- - /* - * Program address configuration - */ -@@ -416,18 +415,18 @@ static int __nss_hal_common_reset(struct - */ - cmn = of_find_node_by_name(NULL, "nss-common"); - if (!cmn) { -- pr_err("%p: Unable to find nss-common node\n", nss_dev); -+ pr_err("%px: Unable to find nss-common node\n", nss_dev); - return -EFAULT; - } - - if (of_address_to_resource(cmn, 0, &res_nss_misc_reset) != 0) { -- pr_err("%p: of_address_to_resource() return error for nss_misc_reset\n", nss_dev); -+ pr_err("%px: of_address_to_resource() return error for nss_misc_reset\n", nss_dev); - of_node_put(cmn); - return -EFAULT; - } - - if (of_address_to_resource(cmn, 1, &res_nss_misc_reset_flag) != 0) { -- pr_err("%p: of_address_to_resource() return error for nss_misc_reset_flag\n", nss_dev); -+ pr_err("%px: of_address_to_resource() return error for nss_misc_reset_flag\n", nss_dev); - of_node_put(cmn); - return -EFAULT; - } -@@ -436,13 +435,13 @@ static int __nss_hal_common_reset(struct - - nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); - if (!nss_misc_reset) { -- pr_err("%p: ioremap fail for nss_misc_reset\n", nss_dev); -+ pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev); - return -EFAULT; - } - - nss_misc_reset_flag = ioremap(res_nss_misc_reset_flag.start, resource_size(&res_nss_misc_reset_flag)); - if (!nss_misc_reset_flag) { -- pr_err("%p: ioremap fail for nss_misc_reset_flag\n", nss_dev); -+ pr_err("%px: ioremap fail for nss_misc_reset_flag\n", nss_dev); - return -EFAULT; - } - -@@ -706,7 +705,7 @@ bool __nss_hal_init_utcm_shared(struct n - * Check meminfo utcm_shared map magic - */ - if ((uint16_t)utcm_shared_map_magic != NSS_MEMINFO_RESERVE_AREA_UTCM_SHARED_MAP_MAGIC) { -- nss_info_always("%p: failed to verify UTCM_SHARED map magic\n", nss_ctx); -+ nss_info_always("%px: failed to verify UTCM_SHARED map magic\n", nss_ctx); - return false; - } - -@@ -714,7 +713,7 @@ bool __nss_hal_init_utcm_shared(struct n - mem_ctx->utcm_shared_end = mem_ctx->utcm_shared_head + utcm_shared_size; - mem_ctx->utcm_shared_tail = mem_ctx->utcm_shared_head; - -- nss_info("%p: UTCM_SHARED init: head: 0x%x end: 0x%x tail: 0x%x\n", nss_ctx, -+ nss_info("%px: UTCM_SHARED init: head: 0x%x end: 0x%x tail: 0x%x\n", nss_ctx, - mem_ctx->utcm_shared_head, mem_ctx->utcm_shared_end, mem_ctx->utcm_shared_tail); - return true; - } ---- a/nss_hal/ipq806x/nss_hal_pvt.c -+++ b/nss_hal/ipq806x/nss_hal_pvt.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2013, 2015-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013, 2015-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -443,12 +443,12 @@ static struct nss_platform_data *__nss_h - nss_ctx->id = npd->id; - - if (of_address_to_resource(np, 0, &res_nphys) != 0) { -- nss_info_always("%p: nss%d: of_address_to_resource() fail for nphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: of_address_to_resource() fail for nphys\n", nss_ctx, nss_ctx->id); - goto out; - } - - if (of_address_to_resource(np, 1, &res_vphys) != 0) { -- nss_info_always("%p: nss%d: of_address_to_resource() fail for vphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: of_address_to_resource() fail for vphys\n", nss_ctx, nss_ctx->id); - goto out; - } - -@@ -460,13 +460,13 @@ static struct nss_platform_data *__nss_h - - npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); - if (!npd->nmap) { -- nss_info_always("%p: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); - goto out; - } - - npd->vmap = ioremap_cache(npd->vphys, resource_size(&res_vphys)); - if (!npd->vmap) { -- nss_info_always("%p: nss%d: ioremap() fail for vphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: ioremap() fail for vphys\n", nss_ctx, nss_ctx->id); - goto out; - } - -@@ -485,7 +485,7 @@ static struct nss_platform_data *__nss_h - for (i = 0 ; i < npd->num_irq; i++) { - npd->irq[i] = irq_of_parse_and_map(np, i); - if (!npd->irq[i]) { -- nss_info_always("%p: nss%d: irq_of_parse_and_map() fail for irq %d\n", nss_ctx, nss_ctx->id, i); -+ nss_info_always("%px: nss%d: irq_of_parse_and_map() fail for irq %d\n", nss_ctx, nss_ctx->id, i); - goto out; - } - } -@@ -523,7 +523,7 @@ static int __nss_hal_core_reset(struct p - */ - rstctl = devm_reset_control_get(&nss_dev->dev, "clkrst-clamp"); - if (IS_ERR(rstctl)) { -- nss_info_always("%p: Deassert UBI32 core%d reset clamp failed", nss_dev, nss_dev->id); -+ nss_info_always("%px: Deassert UBI32 core%d reset clamp failed", nss_dev, nss_dev->id); - return -EFAULT; - } - reset_control_deassert(rstctl); -@@ -533,7 +533,7 @@ static int __nss_hal_core_reset(struct p - */ - rstctl = devm_reset_control_get(&nss_dev->dev, "clamp"); - if (IS_ERR(rstctl)) { -- nss_info_always("%p: Deassert UBI32 core%d clamp failed", nss_dev, nss_dev->id); -+ nss_info_always("%px: Deassert UBI32 core%d clamp failed", nss_dev, nss_dev->id); - return -EFAULT; - } - reset_control_deassert(rstctl); -@@ -543,7 +543,7 @@ static int __nss_hal_core_reset(struct p - */ - rstctl = devm_reset_control_get(&nss_dev->dev, "ahb"); - if (IS_ERR(rstctl)) { -- nss_info_always("%p: Deassert AHB core%d reset failed", nss_dev, nss_dev->id); -+ nss_info_always("%px: Deassert AHB core%d reset failed", nss_dev, nss_dev->id); - return -EFAULT; - } - reset_control_deassert(rstctl); -@@ -553,7 +553,7 @@ static int __nss_hal_core_reset(struct p - */ - rstctl = devm_reset_control_get(&nss_dev->dev, "axi"); - if (IS_ERR(rstctl)) { -- nss_info_always("%p: Deassert core%d AXI reset failed", nss_dev, nss_dev->id); -+ nss_info_always("%px: Deassert core%d AXI reset failed", nss_dev, nss_dev->id); - return -EFAULT; - } - reset_control_deassert(rstctl); -@@ -699,12 +699,12 @@ static int __nss_hal_common_reset(struct - */ - cmn = of_find_node_by_name(NULL, "nss-common"); - if (!cmn) { -- pr_err("%p: Unable to find nss-common node\n", nss_dev); -+ pr_err("%px: Unable to find nss-common node\n", nss_dev); - return -EFAULT; - } - - if (of_address_to_resource(cmn, 0, &res_nss_fpb_base) != 0) { -- pr_err("%p: of_address_to_resource() return error for nss_fpb_base\n", nss_dev); -+ pr_err("%px: of_address_to_resource() return error for nss_fpb_base\n", nss_dev); - of_node_put(cmn); - return -EFAULT; - } -@@ -712,7 +712,7 @@ static int __nss_hal_common_reset(struct - - fpb_base = ioremap(res_nss_fpb_base.start, resource_size(&res_nss_fpb_base)); - if (!fpb_base) { -- pr_err("%p: ioremap fail for nss_fpb_base\n", nss_dev); -+ pr_err("%px: ioremap fail for nss_fpb_base\n", nss_dev); - return -EFAULT; - } - -@@ -726,31 +726,31 @@ static int __nss_hal_common_reset(struct - */ - nss_tcm_src = clk_get(&nss_dev->dev, NSS_TCM_SRC_CLK); - if (IS_ERR(nss_tcm_src)) { -- pr_err("%p: cannot get clock: %s\n", nss_dev, NSS_TCM_SRC_CLK); -+ pr_err("%px: cannot get clock: %s\n", nss_dev, NSS_TCM_SRC_CLK); - return -EFAULT; - } - - err = clk_set_rate(nss_tcm_src, NSSTCM_FREQ); - if (err) { -- pr_err("%p: cannot set NSSTCM freq\n", nss_dev); -+ pr_err("%px: cannot set NSSTCM freq\n", nss_dev); - return -EFAULT; - } - - err = clk_prepare_enable(nss_tcm_src); - if (err) { -- pr_err("%p: cannot enable NSSTCM clock source\n", nss_dev); -+ pr_err("%px: cannot enable NSSTCM clock source\n", nss_dev); - return -EFAULT; - } - - nss_tcm_clk = clk_get(&nss_dev->dev, NSS_TCM_CLK); - if (IS_ERR(nss_tcm_clk)) { -- pr_err("%p: cannot get clock: %s\n", nss_dev, NSS_TCM_CLK); -+ pr_err("%px: cannot get clock: %s\n", nss_dev, NSS_TCM_CLK); - return -EFAULT; - } - - err = clk_prepare_enable(nss_tcm_clk); - if (err) { -- pr_err("%p: cannot enable NSSTCM clock\n", nss_dev); -+ pr_err("%px: cannot enable NSSTCM clock\n", nss_dev); - return -EFAULT; - } - -@@ -759,24 +759,24 @@ static int __nss_hal_common_reset(struct - */ - nss_fab0_clk = clk_get(&nss_dev->dev, NSS_FABRIC0_CLK); - if (IS_ERR(nss_fab0_clk)) { -- pr_err("%p: cannot get clock: %s\n", nss_dev, NSS_FABRIC0_CLK); -+ pr_err("%px: cannot get clock: %s\n", nss_dev, NSS_FABRIC0_CLK); - nss_fab0_clk = NULL; - } else { - err = clk_prepare_enable(nss_fab0_clk); - if (err) { -- pr_err("%p: cannot enable clock: %s\n", nss_dev, NSS_FABRIC0_CLK); -+ pr_err("%px: cannot enable clock: %s\n", nss_dev, NSS_FABRIC0_CLK); - return -EFAULT; - } - } - - nss_fab1_clk = clk_get(&nss_dev->dev, NSS_FABRIC1_CLK); - if (IS_ERR(nss_fab1_clk)) { -- pr_err("%p: cannot get clock: %s\n", nss_dev, NSS_FABRIC1_CLK); -+ pr_err("%px: cannot get clock: %s\n", nss_dev, NSS_FABRIC1_CLK); - nss_fab1_clk = NULL; - } else { - err = clk_prepare_enable(nss_fab1_clk); - if (err) { -- pr_err("%p: cannot enable clock: %s\n", nss_dev, NSS_FABRIC1_CLK); -+ pr_err("%px: cannot enable clock: %s\n", nss_dev, NSS_FABRIC1_CLK); - return -EFAULT; - } - } -@@ -969,7 +969,7 @@ static int __nss_hal_clock_configure(str - nss_core0_clk = clk_get(&nss_dev->dev, NSS_CORE_CLK); - if (IS_ERR(nss_core0_clk)) { - err = PTR_ERR(nss_core0_clk); -- nss_info_always("%p: Regulator %s get failed, err=%d\n", nss_ctx, dev_name(&nss_dev->dev), err); -+ nss_info_always("%px: Regulator %s get failed, err=%d\n", nss_ctx, dev_name(&nss_dev->dev), err); - return err; - } - -@@ -1107,13 +1107,13 @@ clk_complete: - */ - err = clk_set_rate(nss_core0_clk, nss_runtime_samples.freq_scale[NSS_FREQ_MID_SCALE].frequency); - if (err) { -- nss_info_always("%p: cannot set nss core0 clock\n", nss_ctx); -+ nss_info_always("%px: cannot set nss core0 clock\n", nss_ctx); - return -EFAULT; - } - - err = clk_prepare_enable(nss_core0_clk); - if (err) { -- nss_info_always("%p: cannot enable nss core0 clock\n", nss_ctx); -+ nss_info_always("%px: cannot enable nss core0 clock\n", nss_ctx); - return -EFAULT; - } - -@@ -1177,7 +1177,7 @@ static int __nss_hal_request_irq(struct - err = request_irq(npd->irq[irq_num], nss_hal_handle_irq, 0, "nss", int_ctx); - } - if (err) { -- nss_info_always("%p: IRQ%d request failed", nss_ctx, npd->irq[irq_num]); -+ nss_info_always("%px: IRQ%d request failed", nss_ctx, npd->irq[irq_num]); - return err; - } - -@@ -1198,7 +1198,7 @@ void __nss_hal_init_imem(struct nss_ctx_ - mem_ctx->imem_end = mem_ctx->imem_head + NSS_IMEM_SIZE; - mem_ctx->imem_tail = mem_ctx->imem_head; - -- nss_info("%p: IMEM init: head: 0x%x end: 0x%x tail: 0x%x\n", nss_ctx, -+ nss_info("%px: IMEM init: head: 0x%x end: 0x%x tail: 0x%x\n", nss_ctx, - mem_ctx->imem_head, mem_ctx->imem_end, mem_ctx->imem_tail); - } - ---- a/nss_hal/ipq807x/nss_hal_pvt.c -+++ b/nss_hal/ipq807x/nss_hal_pvt.c -@@ -213,17 +213,17 @@ static struct nss_platform_data *__nss_h - nss_ctx->id = npd->id; - - if (of_address_to_resource(np, 0, &res_nphys) != 0) { -- nss_info_always("%p: nss%d: of_address_to_resource() fail for nphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: of_address_to_resource() fail for nphys\n", nss_ctx, nss_ctx->id); - goto out; - } - - if (of_address_to_resource(np, 1, &res_vphys) != 0) { -- nss_info_always("%p: nss%d: of_address_to_resource() fail for vphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: of_address_to_resource() fail for vphys\n", nss_ctx, nss_ctx->id); - goto out; - } - - if (of_address_to_resource(np, 2, &res_qgic_phys) != 0) { -- nss_info_always("%p: nss%d: of_address_to_resource() fail for qgic_phys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: of_address_to_resource() fail for qgic_phys\n", nss_ctx, nss_ctx->id); - goto out; - } - -@@ -236,19 +236,19 @@ static struct nss_platform_data *__nss_h - - npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); - if (!npd->nmap) { -- nss_info_always("%p: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); - goto out; - } - - npd->vmap = ioremap_cache(npd->vphys, resource_size(&res_vphys)); - if (!npd->vmap) { -- nss_info_always("%p: nss%d: ioremap() fail for vphys\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: ioremap() fail for vphys\n", nss_ctx, nss_ctx->id); - goto out; - } - - npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys)); - if (!npd->qgic_map) { -- nss_info_always("%p: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); -+ nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); - goto out; - } - -@@ -267,7 +267,7 @@ static struct nss_platform_data *__nss_h - for (i = 0 ; i < npd->num_irq; i++) { - npd->irq[i] = irq_of_parse_and_map(np, i); - if (!npd->irq[i]) { -- nss_info_always("%p: nss%d: irq_of_parse_and_map() fail for irq %d\n", nss_ctx, nss_ctx->id, i); -+ nss_info_always("%px: nss%d: irq_of_parse_and_map() fail for irq %d\n", nss_ctx, nss_ctx->id, i); - goto out; - } - } -@@ -368,21 +368,21 @@ static int nss_hal_clock_set_and_enable( - - nss_clk = devm_clk_get(dev, id); - if (IS_ERR(nss_clk)) { -- pr_err("%p: cannot get clock: %s\n", dev, id); -+ pr_err("%px: cannot get clock: %s\n", dev, id); - return -EFAULT; - } - - if (rate) { - err = clk_set_rate(nss_clk, rate); - if (err) { -- pr_err("%p: cannot set %s freq\n", dev, id); -+ pr_err("%px: cannot set %s freq\n", dev, id); - return -EFAULT; - } - } - - err = clk_prepare_enable(nss_clk); - if (err) { -- pr_err("%p: cannot enable clock: %s\n", dev, id); -+ pr_err("%px: cannot enable clock: %s\n", dev, id); - return -EFAULT; - } - -@@ -455,12 +455,12 @@ static int __nss_hal_common_reset(struct - */ - cmn = of_find_node_by_name(NULL, "nss-common"); - if (!cmn) { -- pr_err("%p: Unable to find nss-common node\n", nss_dev); -+ pr_err("%px: Unable to find nss-common node\n", nss_dev); - return -EFAULT; - } - - if (of_address_to_resource(cmn, 0, &res_nss_misc_reset) != 0) { -- pr_err("%p: of_address_to_resource() return error for nss_misc_reset\n", nss_dev); -+ pr_err("%px: of_address_to_resource() return error for nss_misc_reset\n", nss_dev); - of_node_put(cmn); - return -EFAULT; - } -@@ -468,7 +468,7 @@ static int __nss_hal_common_reset(struct - - nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); - if (!nss_misc_reset) { -- pr_err("%p: ioremap fail for nss_misc_reset\n", nss_dev); -+ pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev); - return -EFAULT; - } - -@@ -504,7 +504,6 @@ static int __nss_hal_clock_configure(str - return -EFAULT; - } - -- - /* - * For IPQ807x, any rate above 1497 is Turbo Voltage - * Temporary set the voltage to turbo till we start scaling frequenices. -@@ -735,7 +734,7 @@ void __nss_hal_init_imem(struct nss_ctx_ - mem_ctx->imem_end = mem_ctx->imem_head + NSS_IMEM_SIZE; - mem_ctx->imem_tail = mem_ctx->imem_head; - -- nss_info("%p: IMEM init: head: 0x%x end: 0x%x tail: 0x%x\n", nss_ctx, -+ nss_info("%px: IMEM init: head: 0x%x end: 0x%x tail: 0x%x\n", nss_ctx, - mem_ctx->imem_head, mem_ctx->imem_end, mem_ctx->imem_tail); - } - ---- a/nss_hal/nss_hal.c -+++ b/nss_hal/nss_hal.c -@@ -61,7 +61,7 @@ int nss_hal_firmware_load(struct nss_ctx - } else if (nss_ctx->id == 1) { - rc = request_firmware(&nss_fw, NSS_AP1_IMAGE, &(nss_dev->dev)); - } else { -- nss_warning("%p: Invalid nss dev: %d\n", nss_ctx, nss_ctx->id); -+ nss_warning("%px: Invalid nss dev: %d\n", nss_ctx, nss_ctx->id); - return -EINVAL; - } - -@@ -69,18 +69,18 @@ int nss_hal_firmware_load(struct nss_ctx - * Check if the file read is successful - */ - if (rc) { -- nss_info_always("%p: request_firmware failed with err code: %d", nss_ctx, rc); -+ nss_info_always("%px: request_firmware failed with err code: %d", nss_ctx, rc); - return rc; - } - - if (nss_fw->size < MIN_IMG_SIZE) { -- nss_info_always("%p: nss firmware is truncated, size:%d", nss_ctx, (int)nss_fw->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) { -- nss_info_always("%p: ioremap failed: %x", nss_ctx, npd->load_addr); -+ nss_info_always("%px: ioremap failed: %x", nss_ctx, npd->load_addr); - release_firmware(nss_fw); - return rc; - } -@@ -180,7 +180,7 @@ static int nss_hal_register_irq(struct n - int_ctx->nss_ctx = nss_ctx; - err = nss_top->hal_ops->request_irq(nss_ctx, npd, irq_num); - if (err) { -- nss_warning("%p: IRQ request for queue %d failed", nss_ctx, irq_num); -+ nss_warning("%px: IRQ request for queue %d failed", nss_ctx, irq_num); - return err; - } - -@@ -240,27 +240,27 @@ int nss_hal_probe(struct platform_device - */ - nss_ctx->dev = &nss_dev->dev; - -- nss_info("%p: NSS_DEV_ID %s\n", nss_ctx, dev_name(&nss_dev->dev)); -+ nss_info("%px: NSS_DEV_ID %s\n", nss_ctx, dev_name(&nss_dev->dev)); - - /* - * Do firmware load from nss-drv if required - */ - err = nss_top->hal_ops->firmware_load(nss_ctx, nss_dev, npd); - if (err) { -- nss_info_always("%p: firmware load from driver failed\n", nss_ctx); -+ nss_info_always("%px: firmware load from driver failed\n", nss_ctx); - goto err_init; - } - - err = nss_top->hal_ops->clock_configure(nss_ctx, nss_dev, npd); - if (err) { -- nss_info_always("%p: clock configure failed\n", nss_ctx); -+ nss_info_always("%px: clock configure failed\n", nss_ctx); - goto err_init; - } - - /* - * Get load address of NSS firmware - */ -- nss_info("%p: Setting NSS%d Firmware load address to %x\n", nss_ctx, nss_ctx->id, npd->load_addr); -+ nss_info("%px: Setting NSS%d Firmware load address to %x\n", nss_ctx, nss_ctx->id, npd->load_addr); - nss_top->nss[nss_ctx->id].load = npd->load_addr; - - /* -@@ -293,11 +293,11 @@ int nss_hal_probe(struct platform_device - */ - nss_ctx->vphys = npd->vphys; - nss_assert(nss_ctx->vphys); -- nss_info("%d:ctx=%p, vphys=%x, vmap=%p, nphys=%x, nmap=%p", nss_ctx->id, -+ nss_info("%d:ctx=%px, vphys=%x, vmap=%px, nphys=%x, nmap=%px", nss_ctx->id, - nss_ctx, nss_ctx->vphys, nss_ctx->vmap, nss_ctx->nphys, nss_ctx->nmap); - - if (!nss_meminfo_init(nss_ctx)) { -- nss_info_always("%p: meminfo init failed\n", nss_ctx); -+ nss_info_always("%px: meminfo init failed\n", nss_ctx); - err = -EFAULT; - goto err_init; - } -@@ -321,7 +321,7 @@ int nss_hal_probe(struct platform_device - if (npd->tstamp_enabled == NSS_FEATURE_ENABLED) { - tstamp_ndev = nss_tstamp_register_netdev(); - if (!tstamp_ndev) { -- nss_warning("%p: Unable to register the TSTAMP net_device", nss_ctx); -+ nss_warning("%px: Unable to register the TSTAMP net_device", nss_ctx); - npd->tstamp_enabled = NSS_FEATURE_NOT_ENABLED; - } - nss_top->tstamp_handler_id = nss_dev->id; -@@ -415,6 +415,11 @@ int nss_hal_probe(struct platform_device - nss_top->crypto_enabled = 1; - nss_crypto_register_handler(); - #endif -+ -+#if defined(NSS_HAL_IPQ807x_SUPPORT) || defined(NSS_HAL_IPQ60XX_SUPPORT) -+ nss_top->dma_handler_id = nss_dev->id; -+ nss_dma_register_handler(); -+#endif - } - #endif - -@@ -563,7 +568,6 @@ int nss_hal_probe(struct platform_device - nss_wifi_mac_db_register_handler(); - } - -- - #ifdef NSS_DRV_OAM_ENABLE - if (npd->oam_enabled == NSS_FEATURE_ENABLED) { - nss_top->oam_handler_id = nss_dev->id; -@@ -685,7 +689,7 @@ int nss_hal_probe(struct platform_device - spin_lock_init(&(nss_ctx->decongest_cb_lock)); - nss_ctx->magic = NSS_CTX_MAGIC; - -- nss_info("%p: Reseting NSS core %d now", nss_ctx, nss_ctx->id); -+ nss_info("%px: Reseting NSS core %d now", nss_ctx, nss_ctx->id); - - /* - * Enable clocks and bring NSS core out of reset -@@ -716,7 +720,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("%p: 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: -@@ -787,6 +791,6 @@ int nss_hal_remove(struct platform_devic - } - } - -- nss_info("%p: All resources freed for nss core%d", nss_ctx, nss_dev->id); -+ nss_info("%px: All resources freed for nss core%d", nss_ctx, nss_dev->id); - return 0; - } ---- a/nss_if.c -+++ b/nss_if.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014-2016, 2018-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2016, 2018-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -20,6 +20,74 @@ - */ - - #include "nss_tx_rx_common.h" -+#include "nss_if_log.h" -+ -+/* -+ * nss_if_pvt -+ * NSS private structure to handle the completion of NSS -> HLOS messages. -+ */ -+static struct nss_if_pvt { -+ struct semaphore sem; -+ struct completion complete; -+ int response; -+} nss_if; -+ -+static bool nss_if_sem_init_done; -+ -+/* -+ * nss_if_callback -+ * Callback to handle the completion of NSS ->HLOS messages. -+ */ -+static void nss_if_callback(void *app_data, struct nss_if_msg *nim) -+{ -+ if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { -+ nss_warning("nss_if Error response %d\n", nim->cm.response); -+ nss_if.response = NSS_TX_FAILURE; -+ complete(&nss_if.complete); -+ return; -+ } -+ -+ nss_if.response = NSS_TX_SUCCESS; -+ complete(&nss_if.complete); -+} -+ -+/* -+ * nss_if_msg_sync() -+ * Send a message to an interface and wait for the response. -+ */ -+nss_tx_status_t nss_if_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim) -+{ -+ nss_tx_status_t status; -+ int ret = 0; -+ -+ if (!nss_if_sem_init_done) { -+ sema_init(&nss_if.sem, 1); -+ init_completion(&nss_if.complete); -+ nss_if_sem_init_done = 1; -+ } -+ -+ down(&nss_if.sem); -+ -+ status = nss_if_tx_msg(nss_ctx, nim); -+ if (status != NSS_TX_SUCCESS) { -+ nss_warning("%px: nss_if_msg failed\n", nss_ctx); -+ up(&nss_if.sem); -+ return status; -+ } -+ -+ ret = wait_for_completion_timeout(&nss_if.complete, msecs_to_jiffies(NSS_IF_TX_TIMEOUT)); -+ -+ if (!ret) { -+ nss_warning("%px: nss_if tx failed due to timeout\n", nss_ctx); -+ nss_if.response = NSS_TX_FAILURE; -+ } -+ -+ status = nss_if.response; -+ up(&nss_if.sem); -+ -+ return status; -+} -+EXPORT_SYMBOL(nss_if_msg_sync); - - /* - * nss_if_msg_handler() -@@ -35,18 +103,18 @@ void nss_if_msg_handler(struct nss_ctx_i - * We only support base class messages with this interface - */ - if (ncm->type > NSS_IF_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return; - } - - if (!nss_is_dynamic_interface(ncm->interface) && - !((ncm->interface >= NSS_PHYSICAL_IF_START) && (ncm->interface < NSS_VIRTUAL_IF_START))) { -- nss_warning("%p: interface %d not in physical or dynamic if range\n", nss_ctx, ncm->interface); -+ nss_warning("%px: interface %d not in physical or dynamic if range\n", nss_ctx, ncm->interface); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_if_msg)) { -- nss_warning("%p: message length too big: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: message length too big: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -56,6 +124,11 @@ void nss_if_msg_handler(struct nss_ctx_i - nss_core_log_msg_failures(nss_ctx, ncm); - - /* -+ * Trace messages. -+ */ -+ nss_if_log_rx_msg(nim); -+ -+ /* - * Do we have a callback? - */ - if (!ncm->cb) { -@@ -75,11 +148,11 @@ void nss_if_msg_handler(struct nss_ctx_i - */ - nss_tx_status_t nss_if_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, uint32_t if_num) - { -- nss_trace("%p: If Tx packet, id:%d, data=%p", nss_ctx, if_num, os_buf->data); -+ nss_trace("%px: If Tx packet, id:%d, data=%px", nss_ctx, if_num, os_buf->data); - - if (!nss_is_dynamic_interface(if_num) && - !((if_num >= NSS_PHYSICAL_IF_START) && (if_num < NSS_VIRTUAL_IF_START))) { -- nss_warning("%p: interface %d not in physical or dynamic if range\n", nss_ctx, if_num); -+ nss_warning("%px: interface %d not in physical or dynamic if range\n", nss_ctx, if_num); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -100,14 +173,28 @@ nss_tx_status_t nss_if_tx_msg(struct nss - /* - * Sanity check the message - */ -- if (ncm->type > NSS_IF_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ if (ncm->type >= NSS_IF_MAX_MSG_TYPES) { -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -+ /* -+ * Sanity check the message for valid interfaces. -+ */ -+ if (ncm->interface < NSS_PHYSICAL_IF_START || -+ ncm->interface >= NSS_MAX_NET_INTERFACES ) { -+ nss_warning("%px: Tx request for invalid interface: %d", nss_ctx, ncm->interface); -+ return NSS_TX_FAILURE_BAD_PARAM; -+ } -+ -+ /* -+ * Trace messages. -+ */ -+ nss_if_log_tx_msg(nim); -+ - dev = nss_ctx->subsys_dp_register[ncm->interface].ndev; - if (!dev) { -- nss_warning("%p: Unregister interface %d: no context", nss_ctx, ncm->interface); -+ nss_warning("%px: Unregister interface %d: no context", nss_ctx, ncm->interface); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -134,6 +221,50 @@ void nss_if_unregister(uint32_t if_num) - { - } - -+/* -+ * nss_if_reset_nexthop() -+ * De-configures the nexthop for an interface -+ */ -+nss_tx_status_t nss_if_reset_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num) -+{ -+ struct nss_if_msg nim; -+ -+ NSS_VERIFY_CTX_MAGIC(nss_ctx); -+ -+ nss_trace("Resetting Nexthop. nss_ctx: %px ifnum: %u", nss_ctx, if_num); -+ -+ nss_cmn_msg_init(&nim.cm, if_num, NSS_IF_RESET_NEXTHOP, 0, nss_if_callback, NULL); -+ -+ return nss_if_msg_sync(nss_ctx, &nim); -+} -+EXPORT_SYMBOL(nss_if_reset_nexthop); -+ -+/* -+ * nss_if_set_nexthop() -+ * Configures the nexthop for an interface -+ */ -+nss_tx_status_t nss_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num, uint32_t nexthop) -+{ -+ struct nss_if_msg nim; -+ -+ NSS_VERIFY_CTX_MAGIC(nss_ctx); -+ -+ if (nexthop >= NSS_MAX_NET_INTERFACES) { -+ nss_warning("%px: Invalid nexthop interface number: %d", nss_ctx, nexthop); -+ return NSS_TX_FAILURE_BAD_PARAM; -+ } -+ -+ nss_trace("%px: NSS If nexthop will be set to %d, id:%d\n", nss_ctx, nexthop, if_num); -+ -+ nss_cmn_msg_init(&nim.cm, if_num, NSS_IF_SET_NEXTHOP, -+ sizeof(struct nss_if_set_nexthop), nss_if_callback, NULL); -+ -+ nim.msg.set_nexthop.nexthop = nexthop; -+ -+ return nss_if_msg_sync(nss_ctx, &nim); -+} -+EXPORT_SYMBOL(nss_if_set_nexthop); -+ - EXPORT_SYMBOL(nss_if_tx_msg); - EXPORT_SYMBOL(nss_if_register); - EXPORT_SYMBOL(nss_if_unregister); ---- /dev/null -+++ b/nss_if_log.c -@@ -0,0 +1,429 @@ -+/* -+ ************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ -+ * Permission to use, copy, modify, and/or distribute this software for any -+ * purpose with or without fee is hereby granted, provided that the above -+ * copyright notice and this permission notice appear in all copies. -+ -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ ************************************************************************** -+ */ -+ -+/* -+ * nss_if_log.c -+ * NSS Interface logger file. -+ */ -+ -+#include "nss_core.h" -+ -+/* -+ * nss_if_log_message_types_str -+ * NSS interface rule message strings -+ */ -+static int8_t *nss_if_log_message_types_str[NSS_IF_MAX_MSG_TYPES] __maybe_unused = { -+ "NSS interface Open message", -+ "NSS interface close message", -+ "NSS interface link state notify message", -+ "NSS interface MTU change message", -+ "NSS interface MAC address set message", -+ "NSS interface stats message", -+ "NSS interface ishaper assign message", -+ "NSS interface bshaper assign message", -+ "NSS interface ishaper unassign message", -+ "NSS interface bshaper unassign message", -+ "NSS interface ishaper config message", -+ "NSS interface bshaper config message", -+ "NSS interface pause on off message", -+ "NSS interface VSI assign message", -+ "NSS interface VSI unassign message", -+ "NSS interface set next hop message", -+ "NSS interface set IGS node message", -+ "NSS interface clear IGS node message", -+ "NSS interface reset next hop message", -+}; -+ -+/* -+ * nss_if_log_error_response_types_str -+ * Strings for error types for NSS interface messages -+ */ -+static int8_t *nss_if_log_error_response_types_str[NSS_IF_ERROR_TYPE_MAX] __maybe_unused = { -+ "No Ishapers", -+ "No Bshapers", -+ "No Ishaper", -+ "No Bshaper", -+ "No Old Ishaper", -+ "No Old Bshaper", -+ "Ishaper config failed", -+ "Bshaper config failed", -+ "Unknown error", -+ "Interface open error", -+ "Interface invalid MTU error", -+ "Invalid MAC address error", -+ "VSI no match error", -+ "VSI reassign error", -+ "Invalid VSI error", -+ "Max error", -+}; -+ -+/* -+ * nss_if_log_rule_open() -+ * Log NSS open interface message. -+ */ -+static void nss_if_log_rule_open(struct nss_if_msg *nim) -+{ -+ struct nss_if_open *niom __maybe_unused = &nim->msg.open; -+ nss_trace("%px: NSS open interface message \n" -+ "tx_desc_ring: %X\n" -+ "rx_desc_ring: %X\n" -+ "rx_forward_if: %u\n" -+ "alignment_mode: %u\n", -+ nim, -+ niom->tx_desc_ring, -+ niom->rx_desc_ring, -+ niom->rx_forward_if, -+ niom->alignment_mode); -+} -+ -+/* -+ * nss_if_log_rule_close() -+ * Log NSS close interface message. -+ */ -+static void nss_if_log_rule_close(struct nss_if_msg *nim) -+{ -+ nss_trace("%px: NSS close interface message \n", nim); -+} -+ -+/* -+ * nss_if_log_rule_link_state_notify() -+ * Log NSS interface link state notify message. -+ */ -+static void nss_if_log_rule_link_state_notify(struct nss_if_msg *nim) -+{ -+ struct nss_if_link_state_notify *nilstm __maybe_unused = &nim->msg.link_state_notify; -+ nss_trace("%px: NSS interface link state notify interface message \n" -+ "state: %u\n", -+ nim, -+ nilstm->state); -+} -+ -+/* -+ * nss_if_log_rule_mtu_change() -+ * Log NSS interface MTU change message. -+ */ -+static void nss_if_log_rule_mtu_change(struct nss_if_msg *nim) -+{ -+ struct nss_if_mtu_change *nimcm __maybe_unused = &nim->msg.mtu_change; -+ nss_trace("%px: NSS interface MTU change message \n" -+ "min_buf_size: %u\n", -+ nim, -+ nimcm->min_buf_size); -+} -+ -+/* -+ * nss_if_log_rule_mac_addr_set() -+ * Log NSS interface MAC address set message. -+ */ -+static void nss_if_log_rule_mac_addr_set(struct nss_if_msg *nim) -+{ -+ struct nss_if_mac_address_set *nimasm __maybe_unused = &nim->msg.mac_address_set; -+ nss_trace("%px: NSS interface MAC address set message \n" -+ "MAC address: %X:%X:%X:%X:%X:%X\n", -+ nim, -+ nimasm->mac_addr[0], nimasm->mac_addr[1], nimasm->mac_addr[2], -+ nimasm->mac_addr[3], nimasm->mac_addr[4], nimasm->mac_addr[5]); -+} -+ -+/* -+ * nss_if_log_rule_stats() -+ * Log NSS interface stats message. -+ */ -+static void nss_if_log_rule_stats(struct nss_if_msg *nim) -+{ -+ uint16_t i; -+ struct nss_cmn_node_stats *nism __maybe_unused = &nim->msg.stats; -+ -+ nss_trace("%px: NSS interface stats message \n" -+ "rx_packets: %u\n" -+ "rx_bytes: %u\n" -+ "tx_packets: %u\n" -+ "tx_bytes: %u\n", -+ nim, -+ nism->rx_packets, -+ nism->rx_bytes, -+ nism->tx_packets, -+ nism->tx_bytes); -+ -+ for(i=0; i < NSS_MAX_NUM_PRI; i++) -+ { -+ nss_trace("rx_dropped[%u]: %u\n", i, nism->rx_dropped[i]); -+ } -+} -+ -+/* -+ * nss_if_log_rule_shaper_assign() -+ * Log NSS interface shaper assignment message. -+ */ -+static void nss_if_log_rule_shaper_assign(struct nss_if_msg *nim) -+{ -+ struct nss_if_shaper_assign *shaper_assign_msg __maybe_unused = &nim->msg.shaper_assign; -+ nss_trace("%px: NSS interface shaper assign message \n" -+ "shaper_id: %u\n" -+ "new_shaper_id: %u\n", -+ nim, -+ shaper_assign_msg->shaper_id, -+ shaper_assign_msg->new_shaper_id); -+} -+ -+/* -+ * nss_if_log_rule_shaper_unassign() -+ * Log NSS interface shaper unassignment message. -+ */ -+static void nss_if_log_rule_shaper_unassign(struct nss_if_msg *nim) -+{ -+ struct nss_if_shaper_unassign *shaper_unassign_msg __maybe_unused = &nim->msg.shaper_unassign; -+ nss_trace("%px: NSS interface shaper unassign message \n" -+ "shaper_id: %u\n", -+ nim, -+ shaper_unassign_msg->shaper_id); -+} -+ -+/* -+ * nss_if_log_rule_shaper_config() -+ * Log NSS interface shaper configuration message. -+ */ -+static void nss_if_log_rule_shaper_config(struct nss_if_msg *nim) -+{ -+ struct nss_if_shaper_configure *shaper_configure_msg __maybe_unused = &nim->msg.shaper_configure; -+ nss_trace("%px: NSS interface shaper configuration message \n" -+ "request_type: %u\n" -+ "response_type: %u\n", -+ nim, -+ shaper_configure_msg->config.request_type, -+ shaper_configure_msg->config.response_type); -+} -+ -+/* -+ * nss_if_log_rule_pause_on_off() -+ * Log NSS interface pause on off message. -+ */ -+static void nss_if_log_rule_pause_on_off(struct nss_if_msg *nim) -+{ -+ struct nss_if_pause_on_off *pause_on_off_msg __maybe_unused = &nim->msg.pause_on_off; -+ nss_trace("%px: NSS interface pause ON/OFF message \n" -+ "pause_on: %u\n", -+ nim, -+ pause_on_off_msg->pause_on); -+} -+ -+/* -+ * nss_if_log_rule_vsi_assign() -+ * Log NSS interface VSI assignment message. -+ */ -+static void nss_if_log_rule_vsi_assign(struct nss_if_msg *nim) -+{ -+ struct nss_if_vsi_assign *vsi_assign_msg __maybe_unused = &nim->msg.vsi_assign; -+ nss_trace("%px: NSS interface VSI assignment message \n" -+ "VSI: %u\n", -+ nim, -+ vsi_assign_msg->vsi); -+} -+ -+/* -+ * nss_if_log_rule_vsi_unassign() -+ * Log NSS interface VSI unassignment message. -+ */ -+static void nss_if_log_rule_vsi_unassign(struct nss_if_msg *nim) -+{ -+ struct nss_if_vsi_unassign *vsi_unassign_msg __maybe_unused = &nim->msg.vsi_unassign; -+ nss_trace("%px: NSS interface VSI unassignment message \n" -+ "VSI: %u\n", -+ nim, -+ vsi_unassign_msg->vsi); -+} -+ -+/* -+ * nss_if_log_rule_set_nexthop() -+ * Log NSS interface set nexthop message. -+ */ -+static void nss_if_log_rule_set_nexthop(struct nss_if_msg *nim) -+{ -+ struct nss_if_set_nexthop *nisn __maybe_unused = &nim->msg.set_nexthop; -+ nss_trace("%px: NSS interface set nethop message \n" -+ "Nexthop: %u\n", -+ nim, -+ nisn->nexthop); -+} -+ -+/* -+ * nss_if_log_rule_set_igs_node() -+ * Log NSS interface set IGS node message. -+ */ -+static void nss_if_log_rule_set_igs_node(struct nss_if_msg *nim) -+{ -+ struct nss_if_igs_config *igs_config_msg __maybe_unused = &nim->msg.config_igs; -+ nss_trace("%px: NSS interface set IGS node message \n" -+ "igs_num: %d\n", -+ nim, -+ igs_config_msg->igs_num); -+} -+ -+/* -+ * nss_if_log_rule_clear_igs_node() -+ * Log NSS interface clear IGS node message. -+ */ -+static void nss_if_log_rule_clear_igs_node(struct nss_if_msg *nim) -+{ -+ struct nss_if_igs_config *igs_config_msg __maybe_unused = &nim->msg.config_igs; -+ nss_trace("%px: NSS interface clear IGS node message \n" -+ "igs_num: %d\n", -+ nim, -+ igs_config_msg->igs_num); -+} -+ -+/* -+ * nss_if_log_rule_reset_nexthop() -+ * Log NSS interface reset nexthop message. -+ */ -+static void nss_if_log_rule_reset_nexthop(struct nss_if_msg *nim) -+{ -+ nss_trace("%px: NSS interface reset nexthop message \n", nim); -+} -+ -+/* -+ * nss_if_log_verbose() -+ * Log message contents. -+ */ -+static void nss_if_log_verbose(struct nss_if_msg *nim) -+{ -+ nss_trace("NSS interface number: %u\n", nim->cm.interface); -+ -+ switch (nim->cm.type) { -+ case NSS_IF_OPEN: -+ nss_if_log_rule_open(nim); -+ break; -+ -+ case NSS_IF_CLOSE: -+ nss_if_log_rule_close(nim); -+ break; -+ -+ case NSS_IF_LINK_STATE_NOTIFY: -+ nss_if_log_rule_link_state_notify(nim); -+ break; -+ -+ case NSS_IF_MTU_CHANGE: -+ nss_if_log_rule_mtu_change(nim); -+ break; -+ -+ case NSS_IF_MAC_ADDR_SET: -+ nss_if_log_rule_mac_addr_set(nim); -+ break; -+ -+ case NSS_IF_STATS: -+ nss_if_log_rule_stats(nim); -+ break; -+ -+ case NSS_IF_ISHAPER_ASSIGN: -+ case NSS_IF_BSHAPER_ASSIGN: -+ nss_if_log_rule_shaper_assign(nim); -+ break; -+ -+ case NSS_IF_ISHAPER_UNASSIGN: -+ case NSS_IF_BSHAPER_UNASSIGN: -+ nss_if_log_rule_shaper_unassign(nim); -+ break; -+ -+ case NSS_IF_ISHAPER_CONFIG: -+ case NSS_IF_BSHAPER_CONFIG: -+ nss_if_log_rule_shaper_config(nim); -+ break; -+ -+ case NSS_IF_PAUSE_ON_OFF: -+ nss_if_log_rule_pause_on_off(nim); -+ break; -+ -+ case NSS_IF_VSI_ASSIGN: -+ nss_if_log_rule_vsi_assign(nim); -+ break; -+ -+ case NSS_IF_VSI_UNASSIGN: -+ nss_if_log_rule_vsi_unassign(nim); -+ break; -+ -+ case NSS_IF_SET_NEXTHOP: -+ nss_if_log_rule_set_nexthop(nim); -+ break; -+ -+ case NSS_IF_SET_IGS_NODE: -+ nss_if_log_rule_set_igs_node(nim); -+ break; -+ -+ case NSS_IF_CLEAR_IGS_NODE: -+ nss_if_log_rule_clear_igs_node(nim); -+ break; -+ -+ case NSS_IF_RESET_NEXTHOP: -+ nss_if_log_rule_reset_nexthop(nim); -+ break; -+ -+ default: -+ nss_trace("%px: Invalid message type\n", nim); -+ break; -+ } -+} -+ -+/* -+ * nss_if_log_rx_msg() -+ * Log messages received from FW. -+ */ -+void nss_if_log_rx_msg(struct nss_if_msg *nim) -+{ -+ if (nim->cm.response >= NSS_CMN_RESPONSE_LAST) { -+ nss_info("%px: Invalid response\n", nim); -+ return; -+ } -+ -+ if (nim->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nim->cm.response == NSS_CMN_RESPONSE_ACK)) { -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nim, nim->cm.type, -+ nss_if_log_message_types_str[nim->cm.type], -+ nim->cm.response, nss_cmn_response_str[nim->cm.response]); -+ goto verbose; -+ } -+ -+ if (nim->cm.error >= NSS_IF_ERROR_TYPE_MAX) { -+ nss_info("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nim, nim->cm.type, nss_if_log_message_types_str[nim->cm.type], -+ nim->cm.response, nss_cmn_response_str[nim->cm.response], -+ nim->cm.error); -+ goto verbose; -+ } -+ -+ nss_info("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nim, nim->cm.type, nss_if_log_message_types_str[nim->cm.type], -+ nim->cm.response, nss_cmn_response_str[nim->cm.response], -+ nim->cm.error, nss_if_log_error_response_types_str[nim->cm.error]); -+ -+verbose: -+ nss_if_log_verbose(nim); -+} -+ -+/* -+ * nss_if_log_tx_msg() -+ * Log messages transmitted to FW. -+ */ -+void nss_if_log_tx_msg(struct nss_if_msg *nim) -+{ -+ if (nim->cm.type >= NSS_IF_MAX_MSG_TYPES) { -+ nss_info("%px: Invalid message type\n", nim); -+ return; -+ } -+ -+ nss_info("%px: type[%d]:%s\n", nim, nim->cm.type, nss_if_log_message_types_str[nim->cm.type]); -+ nss_if_log_verbose(nim); -+} ---- /dev/null -+++ b/nss_if_log.h -@@ -0,0 +1,40 @@ -+/* -+ ************************************************************************** -+ * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ -+ * Permission to use, copy, modify, and/or distribute this software for any -+ * purpose with or without fee is hereby granted, provided that the above -+ * copyright notice and this permission notice appear in all copies. -+ -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ ************************************************************************** -+ */ -+ -+#ifndef __NSS_IF_LOG_H -+#define __NSS_IF_LOG_H -+ -+/* -+ * nss_if_log.h -+ * NSS Interface header file. -+ */ -+ -+/* -+ * nss_if_log_tx_msg -+ * Logs an NSS interface message that is sent to the NSS firmware. -+ */ -+void nss_if_log_tx_msg(struct nss_if_msg *nim); -+ -+/* -+ * nss_if_log_rx_msg -+ * Logs an NSS interface message that is received from the NSS firmware. -+ */ -+void nss_if_log_rx_msg(struct nss_if_msg *nim); -+ -+ -+#endif /* __NSS_IF_LOG_H */ ---- a/nss_igs.c -+++ b/nss_igs.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -57,12 +57,12 @@ static void nss_igs_handler(struct nss_c - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_IGS_MSG_MAX) { -- nss_warning("%p: received invalid message %d for IGS interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for IGS interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_igs_msg)) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return; - } - -@@ -79,7 +79,7 @@ static void nss_igs_handler(struct nss_c - * Update the callback and app_data for NOTIFY messages - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_top_main.if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)app_data; - } - -@@ -93,7 +93,7 @@ static void nss_igs_handler(struct nss_c - * call igs callback - */ - if (!cb) { -- nss_warning("%p: No callback for igs interface %d", -+ nss_warning("%px: No callback for igs interface %d", - nss_ctx, ncm->interface); - return; - } -@@ -108,15 +108,18 @@ static void nss_igs_handler(struct nss_c - void nss_igs_unregister_if(uint32_t if_num) - { - struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.igs_handler_id]; -+ uint32_t status; - - nss_assert(nss_ctx); - nss_assert(nss_igs_verify_if_num(if_num)); - - nss_core_unregister_subsys_dp(nss_ctx, if_num); - -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -- - nss_core_unregister_handler(nss_ctx, if_num); -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to unregister handler for interface %d with NSS core\n", nss_ctx, if_num); -+ } - - nss_igs_stats_reset(if_num); - } -@@ -131,18 +134,23 @@ struct nss_ctx_instance *nss_igs_registe - uint32_t features) - { - struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.igs_handler_id]; -+ uint32_t status; - - nss_assert(nss_ctx); - nss_assert(nss_igs_verify_if_num(if_num)); - -+ nss_core_register_handler(nss_ctx, if_num, nss_igs_handler, netdev); -+ status = nss_core_register_msg_handler(nss_ctx, if_num, event_callback); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, if_num); -+ nss_warning("%px: Not able to register handler for interface %d with NSS core\n", nss_ctx, if_num); -+ return NULL; -+ } -+ - nss_core_register_subsys_dp(nss_ctx, if_num, NULL, 0, netdev, netdev, features); - nss_core_set_subsys_dp_type(nss_ctx, netdev, if_num, type); - -- nss_top_main.if_rx_msg_callback[if_num] = event_callback; -- -- nss_core_register_handler(nss_ctx, if_num, nss_igs_handler, netdev); - nss_igs_stats_dentry_create(); -- - nss_igs_stats_init(if_num, netdev); - - return nss_ctx; ---- a/nss_init.c -+++ b/nss_init.c -@@ -660,7 +660,7 @@ static int __init nss_init(void) - #if defined(NSS_HAL_IPQ807x_SUPPORT) - if (of_machine_is_compatible("qcom,ipq807x") || of_machine_is_compatible("qcom,ipq8074")) { - nss_top_main.hal_ops = &nss_hal_ipq807x_ops; -- nss_top_main.data_plane_ops = &nss_data_plane_edma_ops; -+ nss_top_main.data_plane_ops = &nss_data_plane_ops; - #if defined(NSS_MEM_PROFILE_LOW) - nss_top_main.num_nss = 1; - #else -@@ -671,14 +671,14 @@ static int __init nss_init(void) - #if defined(NSS_HAL_IPQ60XX_SUPPORT) - if (of_machine_is_compatible("qcom,ipq6018")) { - nss_top_main.hal_ops = &nss_hal_ipq60xx_ops; -- nss_top_main.data_plane_ops = &nss_data_plane_edma_ops; -+ nss_top_main.data_plane_ops = &nss_data_plane_ops; - nss_top_main.num_nss = 1; - } - #endif - #if defined(NSS_HAL_IPQ50XX_SUPPORT) - if (of_machine_is_compatible("qcom,ipq5018")) { - nss_top_main.hal_ops = &nss_hal_ipq50xx_ops; -- nss_top_main.data_plane_ops = &nss_data_plane_edma_ops; -+ nss_top_main.data_plane_ops = &nss_data_plane_ops; - nss_top_main.num_nss = 1; - } - #endif -@@ -864,6 +864,10 @@ static int __init nss_init(void) - nss_ppe_init(); - } - -+#ifdef NSS_DRV_DMA_ENABLE -+ nss_dma_init(); -+#endif -+ - /* - * Register platform_driver - */ ---- a/nss_ipsec.c -+++ b/nss_ipsec.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -136,19 +136,19 @@ static void nss_ipsec_msg_handler(struct - * Sanity check the message type - */ - if (ncm->type > NSS_IPSEC_MSG_TYPE_MAX) { -- nss_warning("%p: rx message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: rx message type out of range: %d", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_ipsec_msg)) { -- nss_warning("%p: rx message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: rx message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - - BUG_ON((if_num != NSS_IPSEC_ENCAP_INTERFACE_NUM) && (if_num != NSS_IPSEC_DECAP_INTERFACE_NUM)); - - if (ncm->response == NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: rx message response for if %d, type %d, is invalid: %d", nss_ctx, ncm->interface, -+ nss_warning("%px: rx message response for if %d, type %d, is invalid: %d", nss_ctx, ncm->interface, - ncm->type, ncm->response); - return; - } -@@ -169,7 +169,7 @@ static void nss_ipsec_msg_handler(struct - */ - cb = (nss_ipsec_msg_callback_t)ncm->cb; - if (unlikely(!cb)) { -- nss_trace("%p: rx handler has been unregistered for i/f: %d", nss_ctx, ncm->interface); -+ nss_trace("%px: rx handler has been unregistered for i/f: %d", nss_ctx, ncm->interface); - return; - } - -@@ -215,7 +215,7 @@ nss_tx_status_t nss_ipsec_tx_msg(struct - { - struct nss_cmn_msg *ncm = &msg->cm; - -- nss_info("%p: message %d for if %d\n", nss_ctx, ncm->type, ncm->interface); -+ nss_info("%px: message %d for if %d\n", nss_ctx, ncm->type, ncm->interface); - - BUILD_BUG_ON(NSS_NBUF_PAYLOAD_SIZE < sizeof(struct nss_ipsec_msg)); - -@@ -225,16 +225,16 @@ nss_tx_status_t nss_ipsec_tx_msg(struct - nss_ipsec_log_tx_msg(msg); - - if ((ncm->interface != NSS_IPSEC_ENCAP_INTERFACE_NUM) && (ncm->interface != NSS_IPSEC_DECAP_INTERFACE_NUM)) { -- nss_warning("%p: tx message request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx message request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_IPSEC_MSG_TYPE_MAX) { -- nss_warning("%p: tx message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: tx message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -- nss_info("msg params version:%d, interface:%d, type:%d, cb:%p, app_data:%p, len:%d\n", -+ nss_info("msg params version:%d, interface:%d, type:%d, cb:%px, app_data:%px, len:%d\n", - ncm->version, ncm->interface, ncm->type, (void *)ncm->cb, (void *)ncm->app_data, ncm->len); - - return nss_core_send_cmd(nss_ctx, msg, sizeof(*msg), NSS_NBUF_PAYLOAD_SIZE); -@@ -257,7 +257,7 @@ nss_tx_status_t nss_ipsec_tx_msg_sync(st - * Length of the message should be the based on type - */ - if (len > sizeof(nim_local.msg)) { -- nss_warning("%p: (%u)Bad message length(%u) for type (%d)", nss_ctx, if_num, len, type); -+ nss_warning("%px: (%u)Bad message length(%u) for type (%d)", nss_ctx, if_num, len, type); - return NSS_TX_FAILURE_TOO_LARGE; - } - -@@ -265,7 +265,7 @@ nss_tx_status_t nss_ipsec_tx_msg_sync(st - * Response buffer is a required for copying the response for message - */ - if (!resp) { -- nss_warning("%p: (%u)Response buffer is empty, type(%d)", nss_ctx, if_num, type); -+ nss_warning("%px: (%u)Response buffer is empty, type(%d)", nss_ctx, if_num, type); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -297,13 +297,13 @@ nss_tx_status_t nss_ipsec_tx_msg_sync(st - - status = nss_ipsec_tx_msg(nss_ctx, &nim_local); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: ipsec_tx_msg failed", nss_ctx); -+ nss_warning("%px: ipsec_tx_msg failed", nss_ctx); - goto done; - } - - ret = wait_for_completion_timeout(&nss_ipsec.complete, NSS_IPSEC_TX_TIMEO_TICKS); - if (!ret) { -- nss_warning("%p: IPsec msg tx failed due to timeout", nss_ctx); -+ nss_warning("%px: IPsec msg tx failed due to timeout", nss_ctx); - status = NSS_TX_FAILURE_NOT_ENABLED; - goto done; - } -@@ -339,7 +339,7 @@ nss_tx_status_t nss_ipsec_tx_buf(struct - { - struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[nss_top_main.ipsec_handler_id]; - -- nss_trace("%p: IPsec If Tx packet, id:%d, data=%p", nss_ctx, if_num, skb->data); -+ nss_trace("%px: IPsec If Tx packet, id:%d, data=%px", nss_ctx, if_num, skb->data); - - return nss_core_send_packet(nss_ctx, skb, if_num, H2N_BIT_FLAG_BUFFER_REUSABLE); - } -@@ -362,7 +362,7 @@ struct nss_ctx_instance *nss_ipsec_notif - struct nss_ctx_instance *nss_ctx = &nss_top->nss[core_id]; - - if (if_num >= NSS_MAX_NET_INTERFACES) { -- nss_warning("%p: notfiy register received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: notfiy register received for invalid interface %d", nss_ctx, if_num); - return NULL; - } - -@@ -390,7 +390,7 @@ void nss_ipsec_notify_unregister(struct - struct nss_top_instance *nss_top = nss_ctx->nss_top; - - if (if_num >= NSS_MAX_NET_INTERFACES) { -- nss_warning("%p: notify unregister received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: notify unregister received for invalid interface %d", nss_ctx, if_num); - return; - } - -@@ -419,7 +419,7 @@ struct nss_ctx_instance *nss_ipsec_data_ - nss_ctx = &nss_top_main.nss[nss_top_main.ipsec_handler_id]; - - if ((if_num >= NSS_MAX_NET_INTERFACES) && (if_num < NSS_MAX_PHYSICAL_INTERFACES)){ -- nss_warning("%p: data register received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: data register received for invalid interface %d", nss_ctx, if_num); - return NULL; - } - -@@ -451,7 +451,7 @@ void nss_ipsec_data_unregister(struct ns - struct nss_ctx_instance *nss_ctx0; - - if ((if_num >= NSS_MAX_NET_INTERFACES) && (if_num < NSS_MAX_PHYSICAL_INTERFACES)){ -- nss_warning("%p: data unregister received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: data unregister received for invalid interface %d", nss_ctx, if_num); - return; - } - -@@ -529,7 +529,7 @@ bool nss_ipsec_ppe_port_config(struct ns - if_num = NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num); - - if (nss_ppe_tx_ipsec_config_msg(if_num, vsi_num, netdev->mtu, netdev->mtu) != NSS_TX_SUCCESS) { -- nss_warning("%p: Failed to configure PPE IPsec port", nss_ctx); -+ nss_warning("%px: Failed to configure PPE IPsec port", nss_ctx); - return false; - } - -@@ -550,7 +550,7 @@ bool nss_ipsec_ppe_mtu_update(struct nss - if_num = NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num); - - if (nss_ppe_tx_ipsec_mtu_msg(if_num, mtu, mru) != NSS_TX_SUCCESS) { -- nss_warning("%p: Failed to update PPE MTU for IPsec port", nss_ctx); -+ nss_warning("%px: Failed to update PPE MTU for IPsec port", nss_ctx); - return false; - } - ---- a/nss_ipsec_cmn.c -+++ b/nss_ipsec_cmn.c -@@ -180,12 +180,12 @@ static void nss_ipsec_cmn_msg_handler(st - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_IPSEC_CMN_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type(%u) for interface(%u)\n", nss_ctx, ncm->type, ncm->interface); -+ nss_warning("%px: Invalid message type(%u) for interface(%u)\n", nss_ctx, ncm->type, ncm->interface); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_ipsec_cmn_msg)) { -- nss_warning("%p: Invalid message length(%d)\n", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Invalid message length(%d)\n", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -216,11 +216,11 @@ static void nss_ipsec_cmn_msg_handler(st - * Call IPsec message callback - */ - if (!cb) { -- nss_warning("%p: No callback for IPsec interface %d\n", nss_ctx, ncm->interface); -+ nss_warning("%px: No callback for IPsec interface %d\n", nss_ctx, ncm->interface); - return; - } - -- nss_trace("%p: calling ipsecsmgr message handler(%u)\n", nss_ctx, ncm->interface); -+ nss_trace("%px: calling ipsecsmgr message handler(%u)\n", nss_ctx, ncm->interface); - cb(app_data, ncm); - } - -@@ -297,17 +297,17 @@ nss_tx_status_t nss_ipsec_cmn_tx_msg(str - * Sanity check the message - */ - if (ncm->type >= NSS_IPSEC_CMN_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type(%u)\n", nss_ctx, ncm->type); -+ nss_warning("%px: Invalid message type(%u)\n", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - - if (!nss_ipsec_cmn_verify_ifnum(nss_ctx, ncm->interface)) { -- nss_warning("%p: Invalid message interface(%u)\n", nss_ctx, ncm->interface); -+ nss_warning("%px: Invalid message interface(%u)\n", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_ipsec_cmn_msg)) { -- nss_warning("%p: Invalid message length(%u)\n", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Invalid message length(%u)\n", nss_ctx, nss_cmn_get_msg_len(ncm)); - return NSS_TX_FAILURE; - } - -@@ -331,7 +331,7 @@ nss_tx_status_t nss_ipsec_cmn_tx_msg_syn - * Length of the message should be the based on type - */ - if (len > sizeof(struct nss_ipsec_cmn_msg)) { -- nss_warning("%p: Invalid message length(%u), type (%d), I/F(%u)\n", nss_ctx, len, type, if_num); -+ nss_warning("%px: Invalid message length(%u), type (%d), I/F(%u)\n", nss_ctx, len, type, if_num); - return NSS_TX_FAILURE; - } - -@@ -348,13 +348,13 @@ nss_tx_status_t nss_ipsec_cmn_tx_msg_syn - - status = nss_ipsec_cmn_tx_msg(nss_ctx, local_nicm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Failed to send message\n", nss_ctx); -+ nss_warning("%px: Failed to send message\n", nss_ctx); - goto done; - } - - ret = wait_for_completion_timeout(&ipsec_cmn_pvt.complete, msecs_to_jiffies(NSS_IPSEC_CMN_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: Failed to receive response, timeout(%d)\n", nss_ctx, ret); -+ nss_warning("%px: Failed to receive response, timeout(%d)\n", nss_ctx, ret); - status = NSS_TX_FAILURE_NOT_READY; - goto done; - } -@@ -388,11 +388,11 @@ EXPORT_SYMBOL(nss_ipsec_cmn_tx_msg_sync) - */ - nss_tx_status_t nss_ipsec_cmn_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, uint32_t if_num) - { -- nss_trace("%p: Send to IPsec I/F(%u), skb(%p)\n", nss_ctx, if_num, os_buf); -+ nss_trace("%px: Send to IPsec I/F(%u), skb(%px)\n", nss_ctx, if_num, os_buf); - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (!nss_ipsec_cmn_verify_ifnum(nss_ctx, if_num)) { -- nss_warning("%p: Interface number(%d) is not IPSec type\n", nss_ctx, if_num); -+ nss_warning("%px: Interface number(%d) is not IPSec type\n", nss_ctx, if_num); - return NSS_TX_FAILURE; - } - -@@ -413,12 +413,12 @@ struct nss_ctx_instance *nss_ipsec_cmn_r - uint32_t status; - - if (!nss_ipsec_cmn_verify_ifnum(nss_ctx, if_num)) { -- nss_warning("%p: Invalid IPsec interface(%u)\n", nss_ctx, if_num); -+ nss_warning("%px: Invalid IPsec interface(%u)\n", nss_ctx, if_num); - return NULL; - } - - if (nss_ctx->subsys_dp_register[if_num].ndev) { -- nss_warning("%p: Failed find free slot for IPsec NSS I/F:%u\n", nss_ctx, if_num); -+ nss_warning("%px: Failed find free slot for IPsec NSS I/F:%u\n", nss_ctx, if_num); - return NULL; - } - -@@ -430,14 +430,14 @@ struct nss_ctx_instance *nss_ipsec_cmn_r - */ - status = nss_core_register_handler(nss_ctx, if_num, nss_ipsec_cmn_msg_handler, app_ctx); - if (status != NSS_CORE_STATUS_SUCCESS){ -- nss_warning("%p: Failed to register message handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); -+ nss_warning("%px: Failed to register message handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); - return NULL; - } - - status = nss_core_register_msg_handler(nss_ctx, if_num, cb_msg); - if (status != NSS_CORE_STATUS_SUCCESS) { - nss_core_unregister_handler(nss_ctx, if_num); -- nss_warning("%p: Failed to register message handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); -+ nss_warning("%px: Failed to register message handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); - return NULL; - } - -@@ -466,13 +466,13 @@ bool nss_ipsec_cmn_unregister_if(uint32_ - nss_assert(nss_ctx); - - if (!nss_ipsec_cmn_verify_ifnum(nss_ctx, if_num)) { -- nss_warning("%p: Invalid IPsec interface(%u)\n", nss_ctx, if_num); -+ nss_warning("%px: Invalid IPsec interface(%u)\n", nss_ctx, if_num); - return false; - } - - dev = nss_cmn_get_interface_dev(nss_ctx, if_num); - if (!dev) { -- nss_warning("%p: Failed to find registered netdev for IPsec NSS I/F:%u\n", nss_ctx, if_num); -+ nss_warning("%px: Failed to find registered netdev for IPsec NSS I/F:%u\n", nss_ctx, if_num); - return false; - } - -@@ -485,13 +485,13 @@ bool nss_ipsec_cmn_unregister_if(uint32_ - - status = nss_core_unregister_msg_handler(nss_ctx, if_num); - if (status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Failed to unregister handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); -+ nss_warning("%px: Failed to unregister handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); - return false; - } - - status = nss_core_unregister_handler(nss_ctx, if_num); - if (status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Failed to unregister handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); -+ nss_warning("%px: Failed to unregister handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); - return false; - } - -@@ -512,14 +512,14 @@ struct nss_ctx_instance *nss_ipsec_cmn_n - - ret = nss_core_register_handler(nss_ctx, if_num, nss_ipsec_cmn_msg_handler, app_data); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: unable to register event handler for interface(%u)\n", nss_ctx, if_num); -+ nss_warning("%px: unable to register event handler for interface(%u)\n", nss_ctx, if_num); - return NULL; - } - - ret = nss_core_register_msg_handler(nss_ctx, if_num, cb); - if (ret != NSS_CORE_STATUS_SUCCESS) { - nss_core_unregister_handler(nss_ctx, if_num); -- nss_warning("%p: Failed to register message handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); -+ nss_warning("%px: Failed to register message handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); - return NULL; - } - -@@ -536,19 +536,19 @@ void nss_ipsec_cmn_notify_unregister(str - uint32_t ret; - - if (if_num >= NSS_MAX_NET_INTERFACES) { -- nss_warning("%p: notify unregister received for invalid interface %d\n", nss_ctx, if_num); -+ nss_warning("%px: notify unregister received for invalid interface %d\n", nss_ctx, if_num); - return; - } - - ret = nss_core_unregister_msg_handler(nss_ctx, if_num); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: unable to unregister event handler for interface(%u)\n", nss_ctx, if_num); -+ nss_warning("%px: unable to unregister event handler for interface(%u)\n", nss_ctx, if_num); - return; - } - - ret = nss_core_unregister_handler(nss_ctx, if_num); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: unable to unregister event handler for interface(%u)\n", nss_ctx, if_num); -+ nss_warning("%px: unable to unregister event handler for interface(%u)\n", nss_ctx, if_num); - return; - } - } -@@ -565,7 +565,7 @@ bool nss_ipsec_cmn_ppe_port_config(struc - if_num = NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num); - - if (nss_ppe_tx_ipsec_config_msg(if_num, vsi_num, netdev->mtu, netdev->mtu) != NSS_TX_SUCCESS) { -- nss_warning("%p: Failed to configure PPE IPsec port\n", nss_ctx); -+ nss_warning("%px: Failed to configure PPE IPsec port\n", nss_ctx); - return false; - } - -@@ -586,7 +586,7 @@ bool nss_ipsec_cmn_ppe_mtu_update(struct - if_num = NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num); - - if (nss_ppe_tx_ipsec_mtu_msg(if_num, mtu, mru) != NSS_TX_SUCCESS) { -- nss_warning("%p: Failed to update PPE MTU for IPsec port\n", nss_ctx); -+ nss_warning("%px: Failed to update PPE MTU for IPsec port\n", nss_ctx); - return false; - } - ---- a/nss_ipsec_cmn_log.c -+++ b/nss_ipsec_cmn_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -145,7 +145,7 @@ static void nss_ipsec_cmn_log_node_msg(s - { - struct nss_ipsec_cmn_node *node_msg __maybe_unused = &nim->msg.node; - -- nss_trace("%p: NSS IPSEC Node Message:\n" -+ nss_trace("%px: NSS IPSEC Node Message:\n" - "%s: %d\n" - "%s: %d\n" - "%s: %d\n", nim, -@@ -162,7 +162,7 @@ static void nss_ipsec_cmn_log_ctx_msg(st - { - struct nss_ipsec_cmn_ctx *ctx_msg __maybe_unused = &nim->msg.ctx; - -- nss_trace("%p: NSS IPSEC CTX Message:\n" -+ nss_trace("%px: NSS IPSEC CTX Message:\n" - "%s: %s\n" - "%s: %d\n", nim, - nss_ipsec_cmn_log_ctx_str[0], nss_ipsec_cmn_ctx_types_str[ctx_msg->type], -@@ -179,7 +179,7 @@ static void nss_ipsec_cmn_log_sa_msg(str - struct nss_ipsec_cmn_sa_tuple *tuple = &sa_msg->sa_tuple; - struct nss_ipsec_cmn_sa_data *data __maybe_unused = &sa_msg->sa_data; - -- nss_trace("%p: NSS IPSEC SA Message:\n", nim); -+ nss_trace("%px: NSS IPSEC SA Message:\n", nim); - - if (tuple->ip_ver == 4) { - nss_trace("%s: %pI4\n%s: %pI4\n", -@@ -224,7 +224,7 @@ static void nss_ipsec_cmn_log_flow_msg(s - struct nss_ipsec_cmn_flow_tuple *flow = &flow_msg->flow_tuple; - struct nss_ipsec_cmn_sa_tuple *sa = &flow_msg->sa_tuple; - -- nss_trace("%p: NSS IPSEC Flow Message:\n", nim); -+ nss_trace("%px: NSS IPSEC Flow Message:\n", nim); - - if (sa->ip_ver == 4) { - nss_trace("%s: %pI4\n%s: %pI4\n", -@@ -298,7 +298,7 @@ static void nss_ipsec_cmn_log_verbose(st - break; - - default: -- nss_warning("%p: Invalid message type\n", nim); -+ nss_warning("%px: Invalid message type\n", nim); - break; - } - } -@@ -310,11 +310,11 @@ static void nss_ipsec_cmn_log_verbose(st - void nss_ipsec_cmn_log_tx_msg(struct nss_ipsec_cmn_msg *nim) - { - if (nim->cm.type >= NSS_IPSEC_CMN_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", nim); -+ nss_warning("%px: Invalid message type\n", nim); - return; - } - -- nss_info("%p: type[%d]:%s\n", nim, nim->cm.type, nss_ipsec_cmn_log_msg_types_str[nim->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nim, nim->cm.type, nss_ipsec_cmn_log_msg_types_str[nim->cm.type]); - nss_ipsec_cmn_log_verbose(nim); - } - -@@ -325,26 +325,26 @@ void nss_ipsec_cmn_log_tx_msg(struct nss - void nss_ipsec_cmn_log_rx_msg(struct nss_ipsec_cmn_msg *nim) - { - if (nim->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nim); -+ nss_warning("%px: Invalid response\n", nim); - return; - } - - if (nim->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nim->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nim, nim->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nim, nim->cm.type, - nss_ipsec_cmn_log_msg_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response]); - goto verbose; - } - - if (nim->cm.error >= NSS_IPSEC_CMN_MSG_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nim, nim->cm.type, nss_ipsec_cmn_log_msg_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response], - nim->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nim, nim->cm.type, nss_ipsec_cmn_log_msg_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response], - nim->cm.error, nss_ipsec_cmn_log_error_str[nim->cm.error]); ---- a/nss_ipsec_log.c -+++ b/nss_ipsec_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -63,7 +63,7 @@ static void nss_ipsec_log_rule_msg(struc - { - struct nss_ipsec_rule *nir __maybe_unused = &nim->msg.rule; - -- nss_trace("%p: NSS IPSEC Rule Message:\n" -+ nss_trace("%px: NSS IPSEC Rule Message:\n" - "IPSEC ESP SPI Index: %dn" - "IPSEC TTL Hop Limit: %dn" - "IPSEC IP Version: %x\n" -@@ -115,7 +115,7 @@ static void nss_ipsec_log_rule_msg(struc - static void nss_ipsec_log_configure_node_msg(struct nss_ipsec_msg *nim) - { - struct nss_ipsec_configure_node *nicn __maybe_unused = &nim->msg.node; -- nss_trace("%p: NSS IPSEC Configure Node\n" -+ nss_trace("%px: NSS IPSEC Configure Node\n" - "IPSEC DMA Redirect: %d\n" - "IPSEC DMA Lookaside: %d\n", - nicn, nicn->dma_redirect, -@@ -149,7 +149,7 @@ static void nss_ipsec_log_verbose(struct - break; - - default: -- nss_warning("%p: Invalid message type\n", nim); -+ nss_warning("%px: Invalid message type\n", nim); - break; - } - } -@@ -161,11 +161,11 @@ static void nss_ipsec_log_verbose(struct - void nss_ipsec_log_tx_msg(struct nss_ipsec_msg *nim) - { - if (nim->cm.type >= NSS_IPSEC_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", nim); -+ nss_warning("%px: Invalid message type\n", nim); - return; - } - -- nss_info("%p: type[%d]:%s\n", nim, nim->cm.type, nss_ipsec_log_message_types_str[nim->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nim, nim->cm.type, nss_ipsec_log_message_types_str[nim->cm.type]); - nss_ipsec_log_verbose(nim); - } - -@@ -176,26 +176,26 @@ void nss_ipsec_log_tx_msg(struct nss_ips - void nss_ipsec_log_rx_msg(struct nss_ipsec_msg *nim) - { - if (nim->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nim); -+ nss_warning("%px: Invalid response\n", nim); - return; - } - - if (nim->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nim->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nim, nim->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nim, nim->cm.type, - nss_ipsec_log_message_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response]); - goto verbose; - } - - if (nim->cm.error >= NSS_IPSEC_ERROR_TYPE_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nim, nim->cm.type, nss_ipsec_log_message_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response], - nim->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nim, nim->cm.type, nss_ipsec_log_message_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response], - nim->cm.error, nss_ipsec_log_error_response_types_str[nim->cm.error]); ---- a/nss_ipv4.c -+++ b/nss_ipv4.c -@@ -84,12 +84,12 @@ static void nss_ipv4_rx_msg_handler(stru - * Sanity check the message type - */ - if (ncm->type >= NSS_IPV4_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_ipv4_msg)) { -- nss_warning("%p: message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -221,7 +221,7 @@ nss_tx_status_t nss_ipv4_conn_inquiry(st - nim.msg.inquiry.rr.tuple = *ipv4_5t_p; - nss_tx_status = nss_ipv4_tx(nss_ctx, &nim); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: Send inquiry message failed\n", ipv4_5t_p); -+ nss_warning("%px: Send inquiry message failed\n", ipv4_5t_p); - } - - return nss_tx_status; -@@ -240,12 +240,12 @@ nss_tx_status_t nss_ipv4_tx_with_size(st - * Sanity check the message - */ - if (ncm->interface != NSS_IPV4_RX_INTERFACE) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_IPV4_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -286,14 +286,14 @@ nss_tx_status_t nss_ipv4_tx_sync(struct - - status = nss_ipv4_tx(nss_ctx, nim); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss ipv4 msg tx failed\n", nss_ctx); -+ nss_warning("%px: nss ipv4 msg tx failed\n", nss_ctx); - up(&nss_ipv4_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&nss_ipv4_pvt.complete, msecs_to_jiffies(NSS_IPV4_TX_MSG_TIMEOUT)); - if (!ret) { -- nss_warning("%p: IPv4 tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: IPv4 tx sync failed due to timeout\n", nss_ctx); - nss_ipv4_pvt.response = NSS_TX_FAILURE; - } - -@@ -396,14 +396,14 @@ static void nss_ipv4_conn_cfg_process_ca - struct nss_ctx_instance *nss_ctx __maybe_unused = nss_ipv4_get_mgr(); - - if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: IPv4 connection configuration failed with error: %d\n", nss_ctx, nim->cm.error); -+ nss_warning("%px: IPv4 connection configuration failed with error: %d\n", nss_ctx, nim->cm.error); - nss_core_update_max_ipv4_conn(NSS_FW_DEFAULT_NUM_CONN); - nss_ipv4_free_conn_tables(); - return; - } - - nss_ipv4_conn_cfg = ntohl(nirccm->num_conn); -- nss_info("%p: IPv4 connection configuration success: %d\n", nss_ctx, nim->cm.error); -+ nss_info("%px: IPv4 connection configuration success: %d\n", nss_ctx, nim->cm.error); - } - - /* -@@ -417,17 +417,17 @@ static int nss_ipv4_conn_cfg_process(str - nss_tx_status_t nss_tx_status; - - if ((!nss_ipv4_ct_info.ce_table_size) || (!nss_ipv4_ct_info.cme_table_size)) { -- nss_warning("%p: connection entry or connection match entry table size not available\n", -+ nss_warning("%px: connection entry or connection match entry table size not available\n", - nss_ctx); - return -EINVAL; - } - -- nss_info("%p: IPv4 supported connections: %d\n", nss_ctx, conn); -+ nss_info("%px: IPv4 supported connections: %d\n", nss_ctx, conn); - - nss_ipv4_ct_info.ce_mem = __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, - get_order(nss_ipv4_ct_info.ce_table_size)); - if (!nss_ipv4_ct_info.ce_mem) { -- nss_warning("%p: Memory allocation failed for IPv4 Connections: %d\n", -+ nss_warning("%px: Memory allocation failed for IPv4 Connections: %d\n", - nss_ctx, - conn); - goto fail; -@@ -436,7 +436,7 @@ static int nss_ipv4_conn_cfg_process(str - nss_ipv4_ct_info.cme_mem = __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, - get_order(nss_ipv4_ct_info.cme_table_size)); - if (!nss_ipv4_ct_info.ce_mem) { -- nss_warning("%p: Memory allocation failed for IPv4 Connections: %d\n", -+ nss_warning("%px: Memory allocation failed for IPv4 Connections: %d\n", - nss_ctx, - conn); - goto fail; -@@ -450,19 +450,19 @@ static int nss_ipv4_conn_cfg_process(str - nirccm->num_conn = htonl(conn); - nirccm->ce_mem = dma_map_single(nss_ctx->dev, (void *)nss_ipv4_ct_info.ce_mem, nss_ipv4_ct_info.ce_table_size, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(nss_ctx->dev, nirccm->ce_mem))) { -- nss_warning("%p: DMA mapping failed for virtual address = %p", nss_ctx, (void *)nss_ipv4_ct_info.ce_mem); -+ nss_warning("%px: DMA mapping failed for virtual address = %px", nss_ctx, (void *)nss_ipv4_ct_info.ce_mem); - goto fail; - } - - nirccm->cme_mem = dma_map_single(nss_ctx->dev, (void *)nss_ipv4_ct_info.cme_mem, nss_ipv4_ct_info.cme_table_size, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(nss_ctx->dev, nirccm->cme_mem))) { -- nss_warning("%p: DMA mapping failed for virtual address = %p", nss_ctx, (void *)nss_ipv4_ct_info.cme_mem); -+ nss_warning("%px: DMA mapping failed for virtual address = %px", nss_ctx, (void *)nss_ipv4_ct_info.cme_mem); - goto fail; - } - - nss_tx_status = nss_ipv4_tx(nss_ctx, &nim); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_tx error setting IPv4 Connections: %d\n", -+ nss_warning("%px: nss_tx error setting IPv4 Connections: %d\n", - nss_ctx, - conn); - goto fail; -@@ -485,7 +485,7 @@ static void nss_ipv4_update_conn_count_c - struct nss_ctx_instance *nss_ctx = nss_ipv4_get_mgr(); - - if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: IPv4 fetch connection info failed with error: %d\n", nss_ctx, nim->cm.error); -+ nss_warning("%px: IPv4 fetch connection info failed with error: %d\n", nss_ctx, nim->cm.error); - nss_core_update_max_ipv4_conn(NSS_FW_DEFAULT_NUM_CONN); - return; - } -@@ -496,7 +496,7 @@ static void nss_ipv4_update_conn_count_c - nss_ipv4_ct_info.cme_table_size = ntohl(nircgts->cme_table_size); - - if (nss_ipv4_conn_cfg_process(nss_ctx, ntohl(nircgts->num_conn)) != 0) { -- nss_warning("%p: IPv4 connection entry or connection match entry table size\ -+ nss_warning("%px: IPv4 connection entry or connection match entry table size\ - not available\n", nss_ctx); - } - -@@ -522,7 +522,7 @@ int nss_ipv4_update_conn_count(int ipv4_ - * By default, NSS FW is configured with default number of connections. - */ - if (ipv4_num_conn == NSS_FW_DEFAULT_NUM_CONN) { -- nss_info("%p: Default number of connections (%d) already configured\n", nss_ctx, ipv4_num_conn); -+ nss_info("%px: Default number of connections (%d) already configured\n", nss_ctx, ipv4_num_conn); - return 0; - } - -@@ -536,7 +536,7 @@ int nss_ipv4_update_conn_count(int ipv4_ - if ((ipv4_num_conn & NSS_NUM_CONN_QUANTA_MASK) || - (sum_of_conn > NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6) || - (ipv4_num_conn < NSS_MIN_NUM_CONN)) { -- nss_warning("%p: input supported connections (%d) does not adhere\ -+ nss_warning("%px: input supported connections (%d) does not adhere\ - specifications\n1) not multiple of 1024,\n2) is less than \ - min val: %d, OR\n IPv4/6 total exceeds %d\n", - nss_ctx, -@@ -555,7 +555,7 @@ int nss_ipv4_update_conn_count(int ipv4_ - nss_tx_status = nss_ipv4_tx(nss_ctx, &nim); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: Send fetch connection info message failed\n", nss_ctx); -+ nss_warning("%px: Send fetch connection info message failed\n", nss_ctx); - return -EINVAL; - } - -@@ -616,7 +616,7 @@ static int nss_ipv4_accel_mode_cfg_handl - - nss_tx_status = nss_ipv4_tx_sync(nss_ctx, &nim); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: Send acceleration mode message failed\n", nss_ctx); -+ nss_warning("%px: Send acceleration mode message failed\n", nss_ctx); - nss_ipv4_accel_mode_cfg = current_value; - return -EIO; - } -@@ -665,7 +665,7 @@ static int nss_ipv4_dscp_map_cfg_handler - - status = nss_ipv4_tx_sync(nss_ctx, &nim); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: ipv4 dscp2pri config message failed\n", nss_ctx); -+ nss_warning("%px: ipv4 dscp2pri config message failed\n", nss_ctx); - return -EFAULT; - } - ---- a/nss_ipv4_log.c -+++ b/nss_ipv4_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016, 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016, 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -63,7 +63,7 @@ static int8_t *nss_ipv4_log_error_respon - static void nss_ipv4_log_rule_create_msg(struct nss_ipv4_msg *nim) - { - struct nss_ipv4_rule_create_msg *nircm __maybe_unused = &nim->msg.rule_create; -- nss_trace("%p: IPv4 create rule message \n" -+ nss_trace("%px: IPv4 create rule message \n" - "Protocol: %d\n" - "from_mtu: %u\n" - "to_mtu: %u\n" -@@ -124,7 +124,7 @@ static void nss_ipv4_log_rule_create_msg - static void nss_ipv4_log_destroy_rule_msg(struct nss_ipv4_msg *nim) - { - struct nss_ipv4_rule_destroy_msg *nirdm __maybe_unused = &nim->msg.rule_destroy; -- nss_trace("%p: IPv4 destroy rule message: \n" -+ nss_trace("%px: IPv4 destroy rule message: \n" - "flow_ip: %pI4h:%d\n" - "return_ip: %pI4h:%d\n" - "protocol: %d\n", -@@ -142,7 +142,7 @@ static void nss_ipv4_log_conn_sync(struc - { - struct nss_ipv4_conn_sync *sync = &nim->msg.conn_stats; - if (sync->flow_tx_packet_count || sync->return_tx_packet_count) { -- nss_trace("%p: IPv4 connection stats sync message: \n" -+ nss_trace("%px: IPv4 connection stats sync message: \n" - "Protocol: %d\n" - "src_addr: %pI4h:%d\n" - "dest_addr: %pI4h:%d\n" -@@ -176,7 +176,7 @@ static void nss_ipv4_log_conn_sync(struc - static void nss_ipv4_log_conn_cfg_msg(struct nss_ipv4_msg *nim) - { - struct nss_ipv4_rule_conn_cfg_msg *nirccm __maybe_unused = &nim->msg.rule_conn_cfg; -- nss_trace("%p: IPv4 number of connections supported rule message: \n" -+ nss_trace("%px: IPv4 number of connections supported rule message: \n" - "num_conn: %d\n", - nim, - nirccm->num_conn); -@@ -191,7 +191,7 @@ static void nss_ipv4_log_mc_rule_create_ - uint16_t vif; - struct nss_ipv4_mc_rule_create_msg *nimrcm = &nim->msg.mc_rule_create; - for (vif = 0; vif < nimrcm->if_count ; vif++) { -- nss_trace("%p: IPv4 multicast create rule message \n" -+ nss_trace("%px: IPv4 multicast create rule message \n" - "Rule flag: %x\n" - "Vif: %d\n" - "Protocol: %d\n" -@@ -227,7 +227,7 @@ static void nss_ipv4_log_conn_sync_many_ - for (i = 0; i < nicsm->count; i++) { - struct nss_ipv4_conn_sync *sync = &nicsm->conn_sync[i]; - if (sync->flow_tx_packet_count || sync->return_tx_packet_count) { -- nss_trace("%p: IPv4 many conn sync message \n" -+ nss_trace("%px: IPv4 many conn sync message \n" - "count: %d\n" - "i: %d\n" - "Protocol: %d\n" -@@ -295,7 +295,7 @@ static void nss_ipv4_log_verbose(struct - break; - - default: -- nss_trace("%p: Invalid message type\n", nim); -+ nss_trace("%px: Invalid message type\n", nim); - break; - } - } -@@ -307,11 +307,11 @@ static void nss_ipv4_log_verbose(struct - void nss_ipv4_log_tx_msg(struct nss_ipv4_msg *nim) - { - if (nim->cm.type >= NSS_IPV4_MAX_MSG_TYPES) { -- nss_info("%p: Invalid message type\n", nim); -+ nss_info("%px: Invalid message type\n", nim); - return; - } - -- nss_info("%p: type[%d]:%s\n", nim, nim->cm.type, nss_ipv4_log_message_types_str[nim->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nim, nim->cm.type, nss_ipv4_log_message_types_str[nim->cm.type]); - nss_ipv4_log_verbose(nim); - } - -@@ -322,26 +322,26 @@ void nss_ipv4_log_tx_msg(struct nss_ipv4 - void nss_ipv4_log_rx_msg(struct nss_ipv4_msg *nim) - { - if (nim->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_info("%p: Invalid response\n", nim); -+ nss_info("%px: Invalid response\n", nim); - return; - } - - if (nim->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nim->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nim, nim->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nim, nim->cm.type, - nss_ipv4_log_message_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response]); - goto verbose; - } - - if (nim->cm.error >= NSS_IPV4_LAST) { -- nss_info("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_info("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nim, nim->cm.type, nss_ipv4_log_message_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response], - nim->cm.error); - goto verbose; - } - -- nss_info("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nim, nim->cm.type, nss_ipv4_log_message_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response], - nim->cm.error, nss_ipv4_log_error_response_types_str[nim->cm.error]); ---- a/nss_ipv4_stats.c -+++ b/nss_ipv4_stats.c -@@ -130,7 +130,7 @@ void nss_ipv4_stats_conn_sync_many(struc - * Sanity check for the stats count - */ - if (nicsm->count * sizeof(struct nss_ipv4_conn_sync) >= nicsm->size) { -- nss_warning("%p: stats sync count %u exceeds the size of this msg %u", nss_ctx, nicsm->count, nicsm->size); -+ nss_warning("%px: stats sync count %u exceeds the size of this msg %u", nss_ctx, nicsm->count, nicsm->size); - return; - } - ---- a/nss_ipv6.c -+++ b/nss_ipv6.c -@@ -84,12 +84,12 @@ static void nss_ipv6_rx_msg_handler(stru - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_IPV6_MAX_MSG_TYPES) { -- nss_warning("%p: received invalid message %d for IPv6 interface", nss_ctx, nim->cm.type); -+ nss_warning("%px: received invalid message %d for IPv6 interface", nss_ctx, nim->cm.type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_ipv6_msg)) { -- nss_warning("%p: message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -224,7 +224,7 @@ nss_tx_status_t nss_ipv6_conn_inquiry(st - nim.msg.inquiry.rr.tuple = *ipv6_5t_p; - nss_tx_status = nss_ipv6_tx(nss_ctx, &nim); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: Send inquiry message failed\n", ipv6_5t_p); -+ nss_warning("%px: Send inquiry message failed\n", ipv6_5t_p); - } - - return nss_tx_status; -@@ -243,12 +243,12 @@ nss_tx_status_t nss_ipv6_tx_with_size(st - * Sanity check the message - */ - if (ncm->interface != NSS_IPV6_RX_INTERFACE) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_IPV6_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -289,14 +289,14 @@ nss_tx_status_t nss_ipv6_tx_sync(struct - - status = nss_ipv6_tx(nss_ctx, nim); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss ipv6 msg tx failed\n", nss_ctx); -+ nss_warning("%px: nss ipv6 msg tx failed\n", nss_ctx); - up(&nss_ipv6_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&nss_ipv6_pvt.complete, msecs_to_jiffies(NSS_IPV6_TX_MSG_TIMEOUT)); - if (!ret) { -- nss_warning("%p: IPv6 tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: IPv6 tx sync failed due to timeout\n", nss_ctx); - nss_ipv6_pvt.response = NSS_TX_FAILURE; - } - -@@ -399,7 +399,7 @@ static void nss_ipv6_conn_cfg_process_ca - struct nss_ctx_instance *nss_ctx __maybe_unused = nss_ipv6_get_mgr(); - - if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: IPv6 connection configuration failed with error: %d\n", nss_ctx, nim->cm.error); -+ nss_warning("%px: IPv6 connection configuration failed with error: %d\n", nss_ctx, nim->cm.error); - nss_core_update_max_ipv6_conn(NSS_FW_DEFAULT_NUM_CONN); - nss_ipv6_free_conn_tables(); - return; -@@ -407,7 +407,7 @@ static void nss_ipv6_conn_cfg_process_ca - - nss_ipv6_conn_cfg = ntohl(nirccm->num_conn); - -- nss_info("%p: IPv6 connection configuration success: %d\n", nss_ctx, nim->cm.error); -+ nss_info("%px: IPv6 connection configuration success: %d\n", nss_ctx, nim->cm.error); - } - - /* -@@ -421,34 +421,34 @@ static int nss_ipv6_conn_cfg_process(str - nss_tx_status_t nss_tx_status; - - if ((!nss_ipv6_ct_info.ce_table_size) || (!nss_ipv6_ct_info.cme_table_size)) { -- nss_warning("%p: connection entry or connection match entry table size not available\n", -+ nss_warning("%px: connection entry or connection match entry table size not available\n", - nss_ctx); - return -EINVAL; - } - -- nss_info("%p: IPv6 supported connections: %d\n", nss_ctx, conn); -+ nss_info("%px: IPv6 supported connections: %d\n", nss_ctx, conn); - - nss_ipv6_ct_info.ce_mem = __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, - get_order(nss_ipv6_ct_info.ce_table_size)); - if (!nss_ipv6_ct_info.ce_mem) { -- nss_warning("%p: Memory allocation failed for IPv6 Connections: %d\n", -+ nss_warning("%px: Memory allocation failed for IPv6 Connections: %d\n", - nss_ctx, - conn); - goto fail; - } -- nss_info("%p: CE Memory allocated for IPv6 Connections: %d\n", -+ nss_info("%px: CE Memory allocated for IPv6 Connections: %d\n", - nss_ctx, - conn); - - nss_ipv6_ct_info.cme_mem = __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, - get_order(nss_ipv6_ct_info.cme_table_size)); - if (!nss_ipv6_ct_info.cme_mem) { -- nss_warning("%p: Memory allocation failed for IPv6 Connections: %d\n", -+ nss_warning("%px: Memory allocation failed for IPv6 Connections: %d\n", - nss_ctx, - conn); - goto fail; - } -- nss_info("%p: CME Memory allocated for IPv6 Connections: %d\n", -+ nss_info("%px: CME Memory allocated for IPv6 Connections: %d\n", - nss_ctx, - conn); - -@@ -460,19 +460,19 @@ static int nss_ipv6_conn_cfg_process(str - nirccm->num_conn = htonl(conn); - nirccm->ce_mem = dma_map_single(nss_ctx->dev, (void *)nss_ipv6_ct_info.ce_mem, nss_ipv6_ct_info.ce_table_size, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(nss_ctx->dev, nirccm->ce_mem))) { -- nss_warning("%p: DMA mapping failed for virtual address = %p", nss_ctx, (void *)nss_ipv6_ct_info.ce_mem); -+ nss_warning("%px: DMA mapping failed for virtual address = %px", nss_ctx, (void *)nss_ipv6_ct_info.ce_mem); - goto fail; - } - - nirccm->cme_mem = dma_map_single(nss_ctx->dev, (void *)nss_ipv6_ct_info.cme_mem, nss_ipv6_ct_info.cme_table_size, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(nss_ctx->dev, nirccm->cme_mem))) { -- nss_warning("%p: DMA mapping failed for virtual address = %p", nss_ctx, (void *)nss_ipv6_ct_info.cme_mem); -+ nss_warning("%px: DMA mapping failed for virtual address = %px", nss_ctx, (void *)nss_ipv6_ct_info.cme_mem); - goto fail; - } - - nss_tx_status = nss_ipv6_tx(nss_ctx, &nim); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_tx error setting IPv6 Connections: %d\n", -+ nss_warning("%px: nss_tx error setting IPv6 Connections: %d\n", - nss_ctx, - conn); - goto fail; -@@ -495,7 +495,7 @@ static void nss_ipv6_update_conn_count_c - struct nss_ctx_instance *nss_ctx = nss_ipv6_get_mgr(); - - if (nim->cm.response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: IPv6 fetch connection info failed with error: %d\n", nss_ctx, nim->cm.error); -+ nss_warning("%px: IPv6 fetch connection info failed with error: %d\n", nss_ctx, nim->cm.error); - nss_core_update_max_ipv6_conn(NSS_FW_DEFAULT_NUM_CONN); - return; - } -@@ -506,7 +506,7 @@ static void nss_ipv6_update_conn_count_c - nss_ipv6_ct_info.cme_table_size = ntohl(nircgts->cme_table_size); - - if (nss_ipv6_conn_cfg_process(nss_ctx, ntohl(nircgts->num_conn)) != 0) { -- nss_warning("%p: IPv6 connection entry or connection match entry table size\ -+ nss_warning("%px: IPv6 connection entry or connection match entry table size\ - not available\n", nss_ctx); - } - -@@ -532,7 +532,7 @@ int nss_ipv6_update_conn_count(int ipv6_ - * By default, NSS FW is configured with default number of connections. - */ - if (ipv6_num_conn == NSS_FW_DEFAULT_NUM_CONN) { -- nss_info("%p: Default number of connections (%d) already configured\n", nss_ctx, ipv6_num_conn); -+ nss_info("%px: Default number of connections (%d) already configured\n", nss_ctx, ipv6_num_conn); - return 0; - } - -@@ -547,7 +547,7 @@ int nss_ipv6_update_conn_count(int ipv6_ - if ((ipv6_num_conn & NSS_NUM_CONN_QUANTA_MASK) || - (sum_of_conn > NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6) || - (ipv6_num_conn < NSS_MIN_NUM_CONN)) { -- nss_warning("%p: input supported connections (%d) does not adhere\ -+ nss_warning("%px: input supported connections (%d) does not adhere\ - specifications\n1) not power of 2,\n2) is less than \ - min val: %d, OR\n IPv4/6 total exceeds %d\n", - nss_ctx, -@@ -565,7 +565,7 @@ int nss_ipv6_update_conn_count(int ipv6_ - nircgts->num_conn = htonl(ipv6_num_conn); - nss_tx_status = nss_ipv6_tx(nss_ctx, &nim); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: Send acceleration mode message failed\n", nss_ctx); -+ nss_warning("%px: Send acceleration mode message failed\n", nss_ctx); - return -EINVAL; - } - -@@ -626,7 +626,7 @@ static int nss_ipv6_accel_mode_cfg_handl - - nss_tx_status = nss_ipv6_tx_sync(nss_ctx, &nim); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: Send acceleration mode message failed\n", nss_ctx); -+ nss_warning("%px: Send acceleration mode message failed\n", nss_ctx); - nss_ipv6_accel_mode_cfg = current_value; - return -EIO; - } -@@ -674,7 +674,7 @@ static int nss_ipv6_dscp_map_cfg_handler - - status = nss_ipv6_tx_sync(nss_ctx, &nim); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: ipv6 dscp2pri config message failed\n", nss_ctx); -+ nss_warning("%px: ipv6 dscp2pri config message failed\n", nss_ctx); - return -EFAULT; - } - ---- a/nss_ipv6_log.c -+++ b/nss_ipv6_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016, 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016, 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -80,7 +80,7 @@ static void nss_ipv6_log_rule_create_msg - NSS_IPV6_ADDR_TO_NW(nircm->tuple.flow_ip, src_ip); - NSS_IPV6_ADDR_TO_NW(nircm->tuple.return_ip, dest_ip); - -- nss_trace("%p: IPv6 create rule message \n" -+ nss_trace("%px: IPv6 create rule message \n" - "Protocol: %d\n" - "from_mtu: %u\n" - "to_mtu: %u\n" -@@ -143,7 +143,7 @@ static void nss_ipv6_log_destroy_rule_ms - NSS_IPV6_ADDR_TO_NW(nirdm->tuple.flow_ip, src_ip); - NSS_IPV6_ADDR_TO_NW(nirdm->tuple.return_ip, dest_ip); - -- nss_trace("%p: IPv6 destroy rule message: \n" -+ nss_trace("%px: IPv6 destroy rule message: \n" - "flow_ip: %pI6:%d\n" - "return_ip: %pI6:%d\n" - "protocol: %d\n", -@@ -167,7 +167,7 @@ static void nss_ipv6_log_conn_sync(struc - NSS_IPV6_ADDR_TO_NW(sync->flow_ip, src_ip); - NSS_IPV6_ADDR_TO_NW(sync->return_ip, dest_ip); - -- nss_trace("%p: IPv6 connection stats sync message: \n" -+ nss_trace("%px: IPv6 connection stats sync message: \n" - "Protocol: %d\n" - "src_addr: %pI6:%d\n" - "dest_addr: %pI6:%d\n" -@@ -201,7 +201,7 @@ static void nss_ipv6_log_conn_sync(struc - static void nss_ipv6_log_conn_cfg_msg(struct nss_ipv6_msg *nim) - { - struct nss_ipv6_rule_conn_cfg_msg *nirccm __maybe_unused = &nim->msg.rule_conn_cfg; -- nss_trace("%p: IPv6 number of connections supported rule message: \n" -+ nss_trace("%px: IPv6 number of connections supported rule message: \n" - "num_conn: %d\n", - nim, - nirccm->num_conn); -@@ -222,7 +222,7 @@ static void nss_ipv6_log_mc_rule_create_ - NSS_IPV6_ADDR_TO_NW(nimrcm->tuple.return_ip, dest_ip); - - for (vif = 0; vif < nimrcm->if_count ; vif++) { -- nss_trace("%p: IPv6 multicast create rule message \n" -+ nss_trace("%px: IPv6 multicast create rule message \n" - "Rule flag: %x\n" - "Vif: %d\n" - "Protocol: %d\n" -@@ -264,7 +264,7 @@ static void nss_ipv6_log_conn_sync_many_ - NSS_IPV6_ADDR_TO_NW(sync->flow_ip, src_ip); - NSS_IPV6_ADDR_TO_NW(sync->return_ip, dest_ip); - -- nss_trace("%p: IPv6 many conn sync message \n" -+ nss_trace("%px: IPv6 many conn sync message \n" - "count: %d\n" - "i: %d\n" - "Protocol: %d\n" -@@ -332,7 +332,7 @@ static void nss_ipv6_log_verbose(struct - break; - - default: -- nss_trace("%p: Invalid message type\n", nim); -+ nss_trace("%px: Invalid message type\n", nim); - break; - } - } -@@ -343,7 +343,7 @@ static void nss_ipv6_log_verbose(struct - */ - void nss_ipv6_log_tx_msg(struct nss_ipv6_msg *nim) - { -- nss_info("%p: type[%d]: %s\n", nim, nim->cm.type, nss_ipv6_log_message_types_str[nim->cm.type]); -+ nss_info("%px: type[%d]: %s\n", nim, nim->cm.type, nss_ipv6_log_message_types_str[nim->cm.type]); - nss_ipv6_log_verbose(nim); - } - -@@ -354,26 +354,26 @@ void nss_ipv6_log_tx_msg(struct nss_ipv6 - void nss_ipv6_log_rx_msg(struct nss_ipv6_msg *nim) - { - if (nim->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_info("%p: Invalid response\n", nim); -+ nss_info("%px: Invalid response\n", nim); - return; - } - - if (nim->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nim->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]: %s, response[%d]: %s\n", nim, nim->cm.type, -+ nss_info("%px: type[%d]: %s, response[%d]: %s\n", nim, nim->cm.type, - nss_ipv6_log_message_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response]); - goto verbose; - } - - if (nim->cm.error > NSS_IPV6_CR_MULTICAST_UPDATE_INVALID_IF) { -- nss_info("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_info("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nim, nim->cm.type, nss_ipv6_log_message_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response], - nim->cm.error); - goto verbose; - } - -- nss_info("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nim, nim->cm.type, nss_ipv6_log_message_types_str[nim->cm.type], - nim->cm.response, nss_cmn_response_str[nim->cm.response], - nim->cm.error, nss_ipv6_log_error_response_types_str[nim->cm.error]); ---- a/nss_ipv6_stats.c -+++ b/nss_ipv6_stats.c -@@ -132,7 +132,7 @@ void nss_ipv6_stats_conn_sync_many(struc - * Sanity check for the stats count - */ - if (nicsm->count * sizeof(struct nss_ipv6_conn_sync) >= nicsm->size) { -- nss_warning("%p: stats sync count %u exceeds the size of this msg %u", nss_ctx, nicsm->count, nicsm->size); -+ nss_warning("%px: stats sync count %u exceeds the size of this msg %u", nss_ctx, nicsm->count, nicsm->size); - return; - } - ---- a/nss_l2tpv2.c -+++ b/nss_l2tpv2.c -@@ -95,12 +95,12 @@ static void nss_l2tpv2_handler(struct ns - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_L2TPV2_MSG_MAX) { -- nss_warning("%p: received invalid message %d for L2TP interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for L2TP interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_l2tpv2_msg)) { -- nss_warning("%p: message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: message length is invalid: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -145,7 +145,7 @@ static void nss_l2tpv2_handler(struct ns - * call l2tpv2 tunnel callback - */ - if (!ctx) { -- nss_warning("%p: Event received for l2tpv2 tunnel interface %d before registration", nss_ctx, ncm->interface); -+ nss_warning("%px: Event received for l2tpv2 tunnel interface %d before registration", nss_ctx, ncm->interface); - return; - } - -@@ -169,12 +169,12 @@ nss_tx_status_t nss_l2tpv2_tx(struct nss - * Sanity check the message - */ - if (!nss_is_dynamic_interface(ncm->interface)) { -- nss_warning("%p: tx request for non dynamic interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for non dynamic interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_L2TPV2_MSG_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - ---- a/nss_l2tpv2_log.c -+++ b/nss_l2tpv2_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -38,7 +38,7 @@ static int8_t *nss_l2tpv2_log_message_ty - static void nss_l2tpv2_log_session_create_msg(struct nss_l2tpv2_msg *nlm) - { - struct nss_l2tpv2_session_create_msg *nlcm __maybe_unused = &nlm->msg.session_create_msg; -- nss_trace("%p: NSS L2TPV2 Session Create message \n" -+ nss_trace("%px: NSS L2TPV2 Session Create message \n" - "L2TPV2 Local Tunnel ID: %x\n" - "L2TPV2 Local Session ID: %x\n" - "L2TPV2 Peer Tunnel ID: %x\n" -@@ -67,7 +67,7 @@ static void nss_l2tpv2_log_session_creat - static void nss_l2tpv2_log_session_destroy_msg(struct nss_l2tpv2_msg *nlm) - { - struct nss_l2tpv2_session_destroy_msg *nldm __maybe_unused = &nlm->msg.session_destroy_msg; -- nss_trace("%p: NSS L2TPV2 Session Destroy message \n" -+ nss_trace("%px: NSS L2TPV2 Session Destroy message \n" - "L2TPV2 Local Tunnel ID: %x\n" - "L2TPV2 Local Session ID: %x\n", - nldm, nldm->local_tunnel_id, -@@ -96,7 +96,7 @@ static void nss_l2tpv2_log_verbose(struc - break; - - default: -- nss_trace("%p: Invalid message type\n", nlm); -+ nss_trace("%px: Invalid message type\n", nlm); - break; - } - } -@@ -108,11 +108,11 @@ static void nss_l2tpv2_log_verbose(struc - void nss_l2tpv2_log_tx_msg(struct nss_l2tpv2_msg *nlm) - { - if (nlm->cm.type >= NSS_L2TPV2_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", nlm); -+ nss_warning("%px: Invalid message type\n", nlm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nlm, nlm->cm.type, nss_l2tpv2_log_message_types_str[nlm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nlm, nlm->cm.type, nss_l2tpv2_log_message_types_str[nlm->cm.type]); - nss_l2tpv2_log_verbose(nlm); - } - -@@ -123,18 +123,18 @@ void nss_l2tpv2_log_tx_msg(struct nss_l2 - void nss_l2tpv2_log_rx_msg(struct nss_l2tpv2_msg *nlm) - { - if (nlm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nlm); -+ nss_warning("%px: Invalid response\n", nlm); - return; - } - - if (nlm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nlm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nlm, nlm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nlm, nlm->cm.type, - nss_l2tpv2_log_message_types_str[nlm->cm.type], - nlm->cm.response, nss_cmn_response_str[nlm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - nlm, nlm->cm.type, nss_l2tpv2_log_message_types_str[nlm->cm.type], - nlm->cm.response, nss_cmn_response_str[nlm->cm.response]); - ---- a/nss_lag.c -+++ b/nss_lag.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -90,7 +90,7 @@ nss_tx_status_t nss_lag_tx(struct nss_ct - nss_lag_verify_ifnum(ncm->interface); - - if (ncm->type > NSS_TX_METADATA_LAG_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -123,7 +123,6 @@ void *nss_register_lag_if(uint32_t if_nu - } - EXPORT_SYMBOL(nss_register_lag_if); - -- - /** - * nss_unregister_lag_if() - */ -@@ -140,7 +139,6 @@ void nss_unregister_lag_if(uint32_t if_n - } - EXPORT_SYMBOL(nss_unregister_lag_if); - -- - /** - * nss_lag_handler() - */ -@@ -163,12 +161,12 @@ void nss_lag_handler(struct nss_ctx_inst - nss_lag_log_rx_msg(lm); - - if (ncm->type >= NSS_TX_METADATA_LAG_MAX) { -- nss_warning("%p: received invalid message %d for LAG interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for LAG interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_lag_msg)) { -- nss_warning("%p: invalid length for LAG message: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: invalid length for LAG message: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -201,7 +199,6 @@ void nss_lag_handler(struct nss_ctx_inst - cb(ctx, lm); - } - -- - /** - * nss_lag_register_handler() - */ -@@ -256,7 +253,7 @@ nss_tx_status_t nss_lag_tx_slave_state(u - - status = nss_lag_tx(nss_ctx, &nm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Send LAG update failed, status: %d\n", nss_ctx, -+ nss_warning("%px: Send LAG update failed, status: %d\n", nss_ctx, - status); - return NSS_TX_FAILURE; - } -@@ -267,7 +264,7 @@ nss_tx_status_t nss_lag_tx_slave_state(u - ret = wait_for_completion_timeout(&lag_msg_state.complete, - msecs_to_jiffies(NSS_LAG_RESP_TIMEOUT)); - if (!ret) { -- nss_warning("%p: Waiting for ack timed out\n", nss_ctx); -+ nss_warning("%px: Waiting for ack timed out\n", nss_ctx); - return NSS_TX_FAILURE; - } - ---- a/nss_lag_log.c -+++ b/nss_lag_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -36,7 +36,7 @@ static int8_t *nss_lag_log_message_types - static void nss_lag_log_state_change_msg(struct nss_lag_msg *nlm) - { - struct nss_lag_state_change *nlcm __maybe_unused = &nlm->msg.state; -- nss_trace("%p: NSS LAG State Change message \n" -+ nss_trace("%px: NSS LAG State Change message \n" - "LAG ID: %x\n" - "LAG Interface: %x\n" - "LAG Event: %d\n", -@@ -54,9 +54,9 @@ static void nss_lag_log_verbose(struct n - case NSS_TX_METADATA_LAG_STATE_CHANGE: - nss_lag_log_state_change_msg(nlm); - break; -- -+ - default: -- nss_trace("%p: Invalid message type\n", nlm); -+ nss_trace("%px: Invalid message type\n", nlm); - break; - } - } -@@ -68,11 +68,11 @@ static void nss_lag_log_verbose(struct n - void nss_lag_log_tx_msg(struct nss_lag_msg *nlm) - { - if (nlm->cm.type >= NSS_TX_METADATA_LAG_MAX) { -- nss_warning("%p: Invalid message type\n", nlm); -+ nss_warning("%px: Invalid message type\n", nlm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nlm, nlm->cm.type, nss_lag_log_message_types_str[nlm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nlm, nlm->cm.type, nss_lag_log_message_types_str[nlm->cm.type]); - nss_lag_log_verbose(nlm); - } - -@@ -83,18 +83,18 @@ void nss_lag_log_tx_msg(struct nss_lag_m - void nss_lag_log_rx_msg(struct nss_lag_msg *nlm) - { - if (nlm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nlm); -+ nss_warning("%px: Invalid response\n", nlm); - return; - } - - if (nlm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nlm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nlm, nlm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nlm, nlm->cm.type, - nss_lag_log_message_types_str[nlm->cm.type], - nlm->cm.response, nss_cmn_response_str[nlm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - nlm, nlm->cm.type, nss_lag_log_message_types_str[nlm->cm.type], - nlm->cm.response, nss_cmn_response_str[nlm->cm.response]); - ---- a/nss_log.c -+++ b/nss_log.c -@@ -108,7 +108,7 @@ static int nss_log_open(struct inode *in - - data = kzalloc(sizeof(struct nss_log_data), GFP_KERNEL); - if (!data) { -- nss_warning("%p: Failed to allocate memory for log_data", nss_ctx); -+ nss_warning("%px: Failed to allocate memory for log_data", nss_ctx); - return -ENOMEM; - } - -@@ -116,7 +116,7 @@ static int nss_log_open(struct inode *in - if (!nss_rbe[nss_id].addr) { - mutex_unlock(&nss_log_mutex); - kfree(data); -- nss_warning("%p: Ring buffer not configured yet for nss_id:%d", nss_ctx, nss_id); -+ nss_warning("%px: Ring buffer not configured yet for nss_id:%d", nss_ctx, nss_id); - return -EIO; - } - -@@ -196,7 +196,7 @@ static ssize_t nss_log_read(struct file - - desc = data->load_mem; - if (!desc) { -- nss_warning("%p: load_mem is NULL", data); -+ nss_warning("%px: load_mem is NULL", data); - return -EINVAL; - } - -@@ -333,12 +333,12 @@ static void nss_debug_interface_handler( - * Is this a valid request/response packet? - */ - if (ncm->type > NSS_DEBUG_INTERFACE_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for CAPWAP interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for CAPWAP interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_log_debug_interface_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -356,7 +356,7 @@ static void nss_debug_interface_handler( - * Do we have a callback - */ - if (!ncm->cb) { -- nss_trace("%p: cb is null for interface %d", nss_ctx, ncm->interface); -+ nss_trace("%px: cb is null for interface %d", nss_ctx, ncm->interface); - return; - } - -@@ -376,12 +376,12 @@ static nss_tx_status_t nss_debug_interfa - * Sanity check the message - */ - if (ncm->interface != NSS_DEBUG_INTERFACE) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_DEBUG_INTERFACE_TYPE_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -411,21 +411,21 @@ bool nss_debug_log_buffer_alloc(uint8_t - nss_ctx = &nss_top->nss[nss_id]; - - if (nss_ctx->state != NSS_CORE_STATE_INITIALIZED) { -- nss_warning("%p: NSS Core:%d is not initialized yet\n", nss_ctx, nss_id); -+ nss_warning("%px: NSS Core:%d is not initialized yet\n", nss_ctx, nss_id); - return false; - } - - size = sizeof(struct nss_log_descriptor) + (sizeof(struct nss_log_entry) * nentry); - addr = kmalloc(size, GFP_ATOMIC); - if (!addr) { -- nss_warning("%p: Failed to allocate memory for logging (size:%d)\n", nss_ctx, size); -+ nss_warning("%px: Failed to allocate memory for logging (size:%d)\n", nss_ctx, size); - return false; - } - - memset(addr, 0, size); - dma_addr = (uint32_t)dma_map_single(nss_ctx->dev, addr, size, DMA_FROM_DEVICE); - if (unlikely(dma_mapping_error(nss_ctx->dev, dma_addr))) { -- nss_warning("%p: Failed to map address in DMA", nss_ctx); -+ nss_warning("%px: Failed to map address in DMA", nss_ctx); - kfree(addr); - return false; - } -@@ -444,7 +444,7 @@ bool nss_debug_log_buffer_alloc(uint8_t - * release the reference. - */ - if (!wait_event_timeout(nss_log_wq, !nss_rbe[nss_id].ref_cnt, 5 * HZ)) { -- nss_warning("%p: Timeout waiting for refcnt to become 0\n", nss_ctx); -+ nss_warning("%px: Timeout waiting for refcnt to become 0\n", nss_ctx); - goto fail; - } - -@@ -455,7 +455,7 @@ bool nss_debug_log_buffer_alloc(uint8_t - } - if (nss_rbe[nss_id].ref_cnt > 0) { - mutex_unlock(&nss_log_mutex); -- nss_warning("%p: Some other thread is contending..opting out\n", nss_ctx); -+ nss_warning("%px: Some other thread is contending..opting out\n", nss_ctx); - goto fail; - } - } -@@ -473,7 +473,7 @@ bool nss_debug_log_buffer_alloc(uint8_t - status = nss_debug_interface_tx(nss_ctx, &msg); - if (status != NSS_TX_SUCCESS) { - mutex_unlock(&nss_log_mutex); -- nss_warning("%p: Failed to send message to debug interface:%d\n", nss_ctx, status); -+ nss_warning("%px: Failed to send message to debug interface:%d\n", nss_ctx, status); - goto fail; - } - -@@ -484,13 +484,13 @@ bool nss_debug_log_buffer_alloc(uint8_t - */ - if (!wait_event_timeout(msg_wq, msg_event, 5 * HZ)) { - mutex_unlock(&nss_log_mutex); -- nss_warning("%p: Timeout send message to debug interface\n", nss_ctx); -+ nss_warning("%px: Timeout send message to debug interface\n", nss_ctx); - goto fail; - } - - if (msg_response != NSS_CMN_RESPONSE_ACK) { - mutex_unlock(&nss_log_mutex); -- nss_warning("%p: Response error for send message to debug interface:%d\n", nss_ctx, msg_response); -+ nss_warning("%px: Response error for send message to debug interface:%d\n", nss_ctx, msg_response); - goto fail; - } - ---- a/nss_lso_rx.c -+++ b/nss_lso_rx.c -@@ -45,7 +45,7 @@ static void nss_rx_lso_rx_interface_hand - /* - * Check response - */ -- nss_info("%p: Received response %d for type %d, interface %d", nss_ctx, ncm->response, ncm->type, ncm->interface); -+ nss_info("%px: Received response %d for type %d, interface %d", nss_ctx, ncm->response, ncm->type, ncm->interface); - } - } - } ---- a/nss_map_t.c -+++ b/nss_map_t.c -@@ -165,12 +165,12 @@ static void nss_map_t_handler(struct nss - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_MAP_T_MSG_MAX) { -- nss_warning("%p: received invalid message %d for MAP-T interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for MAP-T interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_map_t_msg)) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return; - } - -@@ -208,7 +208,7 @@ static void nss_map_t_handler(struct nss - * call map-t callback - */ - if (!cb) { -- nss_warning("%p: No callback for map-t interface %d", -+ nss_warning("%px: No callback for map-t interface %d", - nss_ctx, ncm->interface); - return; - } -@@ -259,12 +259,12 @@ nss_tx_status_t nss_map_t_tx(struct nss_ - * Sanity check the message - */ - if (!nss_map_t_verify_if_num(ncm->interface)) { -- nss_warning("%p: tx request is not for a MAP-T dynamic interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request is not for a MAP-T dynamic interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_MAP_T_MSG_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -290,14 +290,14 @@ nss_tx_status_t nss_map_t_tx_sync(struct - - status = nss_map_t_tx(nss_ctx, msg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: map_t_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: map_t_tx_msg failed\n", nss_ctx); - up(&nss_map_t_pvt.sem); - return status; - } - ret = wait_for_completion_timeout(&nss_map_t_pvt.complete, msecs_to_jiffies(NSS_MAP_T_TX_TIMEOUT)); - - if (!ret) { -- nss_warning("%p: MAP-T tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: MAP-T tx sync failed due to timeout\n", nss_ctx); - nss_map_t_pvt.response = NSS_TX_FAILURE; - } - ---- a/nss_map_t_log.c -+++ b/nss_map_t_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -38,7 +38,7 @@ static int8_t *nss_map_t_log_message_typ - static void nss_map_t_log_rule_configure_msg(struct nss_map_t_msg *ntm) - { - struct nss_map_t_instance_rule_config_msg *ntcm __maybe_unused = &ntm->msg.create_msg; -- nss_trace("%p: NSS MAP_T Rule Configure message \n" -+ nss_trace("%px: NSS MAP_T Rule Configure message \n" - "MAP_T Rule Seq Number: %d\n" - "MAP_T Total Number of Rules: %d\n" - "MAP_T Local IPv6 Prefix Length: %d\n" -@@ -54,9 +54,9 @@ static void nss_map_t_log_rule_configure - "MAP_T Remote PSID Offset: %d\n" - "MAP_T Local MAP Style: %d\n" - "MAP_T Remote Map Style: %d\n" -- "MAP_T Local IPv6 Prefix: %p\n" -- "MAP_T Reserved B: %p\n" -- "MAP_T Remote IPv6 Prefix: %p\n" -+ "MAP_T Local IPv6 Prefix: %px\n" -+ "MAP_T Reserved B: %px\n" -+ "MAP_T Remote IPv6 Prefix: %px\n" - "MAP_T Valid Rule: %d\n", - ntcm, ntcm->rule_num, ntcm->total_rules, - ntcm->local_ipv6_prefix_len, ntcm->local_ipv4_prefix, -@@ -77,7 +77,7 @@ static void nss_map_t_log_rule_configure - static void nss_map_t_log_rule_deconfig_msg(struct nss_map_t_msg *ntm) - { - struct nss_map_t_instance_rule_deconfig_msg *ntdm __maybe_unused = &ntm->msg.destroy_msg; -- nss_trace("%p: NSS MAP_T Rule Deconfigure message \n" -+ nss_trace("%px: NSS MAP_T Rule Deconfigure message \n" - "MAP_T Interface Number: %d\n", - ntdm, ntdm->if_number); - } -@@ -104,7 +104,7 @@ static void nss_map_t_log_verbose(struct - break; - - default: -- nss_trace("%p: Invalid message type\n", ntm); -+ nss_trace("%px: Invalid message type\n", ntm); - break; - } - } -@@ -116,11 +116,11 @@ static void nss_map_t_log_verbose(struct - void nss_map_t_log_tx_msg(struct nss_map_t_msg *ntm) - { - if (ntm->cm.type >= NSS_MAP_T_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", ntm); -+ nss_warning("%px: Invalid message type\n", ntm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ntm, ntm->cm.type, nss_map_t_log_message_types_str[ntm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ntm, ntm->cm.type, nss_map_t_log_message_types_str[ntm->cm.type]); - nss_map_t_log_verbose(ntm); - } - -@@ -131,18 +131,18 @@ void nss_map_t_log_tx_msg(struct nss_map - void nss_map_t_log_rx_msg(struct nss_map_t_msg *ntm) - { - if (ntm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ntm); -+ nss_warning("%px: Invalid response\n", ntm); - return; - } - - if (ntm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ntm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type, - nss_map_t_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - ntm, ntm->cm.type, nss_map_t_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response]); - ---- a/nss_match.c -+++ b/nss_match.c -@@ -96,12 +96,12 @@ static nss_tx_status_t nss_match_msg_tx( - * Sanity check the message - */ - if (!nss_match_verify_if_num(ncm->interface)) { -- nss_warning("%p: Tx request for non dynamic interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: Tx request for non dynamic interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_MATCH_MSG_MAX) { -- nss_warning("%p: Message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: Message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -131,12 +131,12 @@ static void nss_match_handler(struct nss - * Is this a valid request/response packet? - */ - if (nem->cm.type >= NSS_MATCH_MSG_MAX) { -- nss_warning("%p: Received invalid message %d for MATCH interface", nss_ctx, nem->cm.type); -+ nss_warning("%px: Received invalid message %d for MATCH interface", nss_ctx, nem->cm.type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_match_msg)) { -- nss_warning("%p: Unexpected message length: %d, on interface: %d", -+ nss_warning("%px: Unexpected message length: %d, on interface: %d", - nss_ctx, nss_cmn_get_msg_len(ncm), ncm->interface); - return; - } -@@ -151,7 +151,7 @@ static void nss_match_handler(struct nss - } - - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - } - - /* -@@ -190,14 +190,14 @@ nss_tx_status_t nss_match_msg_tx_sync(st - - status = nss_match_msg_tx(nss_ctx, matchm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_match_msg_tx failed\n", nss_ctx); -+ nss_warning("%px: nss_match_msg_tx failed\n", nss_ctx); - up(&match_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&match_pvt.complete, msecs_to_jiffies(NSS_MATCH_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: MATCH tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: MATCH tx failed due to timeout\n", nss_ctx); - match_pvt.response = NSS_TX_FAILURE; - } - -@@ -215,22 +215,27 @@ EXPORT_SYMBOL(nss_match_msg_tx_sync); - struct nss_ctx_instance *nss_match_register_instance(int if_num, nss_match_msg_sync_callback_t notify_cb) - { - struct nss_ctx_instance *nss_ctx; -+ uint32_t status; - - nss_ctx = nss_match_get_context(); - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (!nss_match_verify_if_num(if_num)) { -- nss_warning("%p: Incorrect interface number: %d", nss_ctx, if_num); -+ nss_warning("%px: Incorrect interface number: %d", nss_ctx, if_num); - return NULL; - } - - nss_core_register_handler(nss_ctx, if_num, nss_match_handler, NULL); -- nss_top_main.if_rx_msg_callback[if_num] = (nss_if_rx_msg_callback_t)notify_cb; -+ status = nss_core_register_msg_handler(nss_ctx, if_num, (nss_if_rx_msg_callback_t)notify_cb); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to register handler for interface %d with NSS core\n", nss_ctx, if_num); -+ return NULL; -+ } - - if (!nss_match_ifnum_add(if_num)) { -- nss_warning("Unable to add match inteface : %u\n", if_num); -+ nss_warning("%px: Unable to add match inteface : %u\n", nss_ctx, if_num); - nss_core_unregister_handler(nss_ctx, if_num); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ nss_core_unregister_msg_handler(nss_ctx, if_num); - return NULL; - } - -@@ -245,17 +250,23 @@ EXPORT_SYMBOL(nss_match_register_instanc - bool nss_match_unregister_instance(int if_num) - { - struct nss_ctx_instance *nss_ctx; -+ uint32_t status; - - nss_ctx = nss_match_get_context(); - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (!nss_match_verify_if_num(if_num)) { -- nss_warning("%p: Incorrect interface number: %d", nss_ctx, if_num); -+ nss_warning("%px: Incorrect interface number: %d", nss_ctx, if_num); - return false; - } - - nss_core_unregister_handler(nss_ctx, if_num); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to unregister handler for interface %d with NSS core\n", nss_ctx, if_num); -+ return false; -+ } -+ - nss_match_ifnum_delete(if_num); - - return true; ---- a/nss_match_log.c -+++ b/nss_match_log.c -@@ -72,7 +72,7 @@ static void nss_match_log_profile_config - struct nss_match_profile_configure_msg *nmcm __maybe_unused = &nmm->msg.configure_msg; - int mask_num, mask_word; - -- nss_trace("%p: NSS match configuration message \n" -+ nss_trace("%px: NSS match configuration message \n" - "Match profile type: %u \n" - "Match mask flag: %u \n", - nmcm, -@@ -94,7 +94,7 @@ static void nss_match_log_profile_config - static void nss_match_log_vow_rule_msg(struct nss_match_msg *nmm) - { - struct nss_match_rule_vow_msg *nmvrm __maybe_unused = &nmm->msg.vow_rule; -- nss_trace("%p: NSS match VoW rule message \n" -+ nss_trace("%px: NSS match VoW rule message \n" - "Match rule id: %hu \n" - "Match mask id: %hu \n" - "Match action: action flag = %u, next node = %u, priority = %hu \n" -@@ -119,7 +119,7 @@ static void nss_match_log_vow_rule_msg(s - static void nss_match_log_l2_rule_msg(struct nss_match_msg *nmm) - { - struct nss_match_rule_l2_msg *nmlrm __maybe_unused = &nmm->msg.l2_rule; -- nss_trace("%p: NSS match L2 rule message \n" -+ nss_trace("%px: NSS match L2 rule message \n" - "Match rule id: %hu \n" - "Match mask id: %hu \n" - "Match action: action flag = %u, next node = %u, priority = %hu \n" -@@ -169,7 +169,7 @@ static void nss_match_log_verbose(struct - break; - - default: -- nss_trace("%p: Invalid message type\n", nmm); -+ nss_trace("%px: Invalid message type\n", nmm); - break; - } - } -@@ -181,11 +181,11 @@ static void nss_match_log_verbose(struct - void nss_match_log_tx_msg(struct nss_match_msg *nmm) - { - if (nmm->cm.type >= NSS_MATCH_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", nmm); -+ nss_warning("%px: Invalid message type\n", nmm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nmm, nmm->cm.type, nss_match_log_message_types_str[nmm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nmm, nmm->cm.type, nss_match_log_message_types_str[nmm->cm.type]); - nss_match_log_verbose(nmm); - } - -@@ -196,26 +196,26 @@ void nss_match_log_tx_msg(struct nss_mat - void nss_match_log_rx_msg(struct nss_match_msg *nmm) - { - if (nmm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nmm); -+ nss_warning("%px: Invalid response\n", nmm); - return; - } - - if (nmm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nmm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nmm, nmm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nmm, nmm->cm.type, - nss_match_log_message_types_str[nmm->cm.type], - nmm->cm.response, nss_cmn_response_str[nmm->cm.response]); - goto verbose; - } - - if (nmm->cm.error >= NSS_MATCH_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nmm, nmm->cm.type, nss_match_log_message_types_str[nmm->cm.type], - nmm->cm.response, nss_cmn_response_str[nmm->cm.response], - nmm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nmm, nmm->cm.type, nss_match_log_message_types_str[nmm->cm.type], - nmm->cm.response, nss_cmn_response_str[nmm->cm.response], - nmm->cm.error, nss_match_log_error_types_str[nmm->cm.error]); ---- a/nss_meminfo.c -+++ b/nss_meminfo.c -@@ -53,7 +53,7 @@ static void *nss_meminfo_alloc_sdram(str - */ - addr = kmalloc(size, GFP_KERNEL | __GFP_ZERO); - if (!addr) -- nss_info_always("%p: failed to alloc a sdram block of size %u\n", nss_ctx, size); -+ nss_info_always("%px: failed to alloc a sdram block of size %u\n", nss_ctx, size); - - kmemleak_not_leak((void *)addr); - return addr; -@@ -100,7 +100,7 @@ static uint32_t nss_meminfo_alloc_imem(s - new_tail = (new_tail + mask) & ~mask; - - if (size > (mem_ctx->imem_end - new_tail)) { -- nss_info_always("%p: failed to alloc an IMEM block of size %u\n", nss_ctx, size); -+ nss_info_always("%px: failed to alloc an IMEM block of size %u\n", nss_ctx, size); - return addr; - } - -@@ -147,7 +147,7 @@ static uint32_t nss_meminfo_alloc_utcm_s - new_tail = (new_tail + mask) & ~mask; - - if (size > (mem_ctx->utcm_shared_end - new_tail)) { -- nss_info_always("%p: failed to alloc an UTCM_SHARED block of size %u\n", nss_ctx, size); -+ nss_info_always("%px: failed to alloc an UTCM_SHARED block of size %u\n", nss_ctx, size); - return addr; - } - -@@ -292,7 +292,7 @@ static bool nss_meminfo_init_block_lists - struct nss_meminfo_block *b = (struct nss_meminfo_block *) - kmalloc(sizeof(struct nss_meminfo_block), GFP_KERNEL); - if (!b) { -- nss_info_always("%p: failed to allocate meminfo block\n", nss_ctx); -+ nss_info_always("%px: failed to allocate meminfo block\n", nss_ctx); - goto cleanup; - } - -@@ -315,7 +315,7 @@ static bool nss_meminfo_init_block_lists - */ - dma_addr = nss_meminfo_alloc_imem(nss_ctx, r->size, r->alignment); - if (!dma_addr) { -- nss_info_always("%p: failed to alloc IMEM block\n", nss_ctx); -+ nss_info_always("%px: failed to alloc IMEM block\n", nss_ctx); - goto cleanup; - } - -@@ -328,13 +328,13 @@ static bool nss_meminfo_init_block_lists - case NSS_MEMINFO_MEMTYPE_SDRAM: - kern_addr = nss_meminfo_alloc_sdram(nss_ctx, r->size); - if (!kern_addr) { -- nss_info_always("%p: failed to alloc SDRAM block\n", nss_ctx); -+ nss_info_always("%px: failed to alloc SDRAM block\n", nss_ctx); - goto cleanup; - } - - dma_addr = dma_map_single(nss_ctx->dev, kern_addr, r->size, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(nss_ctx->dev, dma_addr))) { -- nss_info_always("%p: failed to map SDRAM block\n", nss_ctx); -+ nss_info_always("%px: failed to map SDRAM block\n", nss_ctx); - goto cleanup; - } - break; -@@ -344,7 +344,7 @@ static bool nss_meminfo_init_block_lists - */ - dma_addr = nss_meminfo_alloc_utcm_shared(nss_ctx, r->size, r->alignment); - if (!dma_addr) { -- nss_info_always("%p: failed to alloc UTCM_SHARED block\n", nss_ctx); -+ nss_info_always("%px: failed to alloc UTCM_SHARED block\n", nss_ctx); - goto cleanup; - } - break; -@@ -361,12 +361,12 @@ static bool nss_meminfo_init_block_lists - */ - r->size /= coreinfo.num_active_cores; - dma_addr = coreinfo.start_address + nss_ctx->id * r->size; -- nss_info_always("%p: NSS core %d DDR from %x to %x\n", nss_ctx, -+ nss_info_always("%px: NSS core %d DDR from %x to %x\n", nss_ctx, - nss_ctx->id, dma_addr, dma_addr + r->size); - } - break; - default: -- nss_info_always("%p: %d unsupported memory type\n", nss_ctx, mtype); -+ nss_info_always("%px: %d unsupported memory type\n", nss_ctx, mtype); - goto cleanup; - } - -@@ -399,7 +399,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("%p: set sdma %p\n", nss_ctx, kern_addr); -+ nss_info_always("%px: set sdma %px\n", nss_ctx, kern_addr); - } - - /* -@@ -504,7 +504,7 @@ static bool nss_meminfo_configure_n2h_h2 - * N2H ring allocations - */ - if (!(nss_meminfo_allocate_n2h_h2n_rings(nss_ctx, n2h_info))) { -- nss_info_always("%p: failed to allocate/map n2h rings\n", nss_ctx); -+ nss_info_always("%px: failed to allocate/map n2h rings\n", nss_ctx); - return false; - } - -@@ -512,7 +512,7 @@ static bool nss_meminfo_configure_n2h_h2 - * H2N ring allocations - */ - if (!(nss_meminfo_allocate_n2h_h2n_rings(nss_ctx, h2n_info))) { -- nss_info_always("%p: failed to allocate/map h2n_rings\n", nss_ctx); -+ nss_info_always("%px: failed to allocate/map h2n_rings\n", nss_ctx); - goto cleanup; - } - -@@ -537,7 +537,7 @@ static bool nss_meminfo_configure_n2h_h2 - - if_map->n2h_desc_if[i].size = NSS_RING_SIZE; - if_map->n2h_desc_if[i].desc_addr = n2h_info->dma_addr + i * sizeof(struct n2h_descriptor) * (NSS_RING_SIZE + 2); -- nss_info("%p: N2H ring %d, size %d, addr = %x\n", nss_ctx, i, if_map->n2h_desc_if[i].size, if_map->n2h_desc_if[i].desc_addr); -+ nss_info("%px: N2H ring %d, size %d, addr = %x\n", nss_ctx, i, if_map->n2h_desc_if[i].size, if_map->n2h_desc_if[i].desc_addr); - } - - /* -@@ -552,7 +552,7 @@ static bool nss_meminfo_configure_n2h_h2 - - if_map->h2n_desc_if[i].size = NSS_RING_SIZE; - if_map->h2n_desc_if[i].desc_addr = h2n_info->dma_addr + i * sizeof(struct h2n_descriptor) * (NSS_RING_SIZE + 2); -- nss_info("%p: H2N ring %d, size %d, addr = %x\n", nss_ctx, i, if_map->h2n_desc_if[i].size, if_map->h2n_desc_if[i].desc_addr); -+ nss_info("%px: H2N ring %d, size %d, addr = %x\n", nss_ctx, i, if_map->h2n_desc_if[i].size, if_map->h2n_desc_if[i].desc_addr); - } - - /* -@@ -714,7 +714,7 @@ bool nss_meminfo_init(struct nss_ctx_ins - meminfo_start = (uint32_t *)ioremap(nss_ctx->load + NSS_MEMINFO_MAP_START_OFFSET, - NSS_MEMINFO_RESERVE_AREA_SIZE); - if (!meminfo_start) { -- nss_info_always("%p: cannot remap meminfo start\n", nss_ctx); -+ nss_info_always("%px: cannot remap meminfo start\n", nss_ctx); - return false; - } - -@@ -722,14 +722,14 @@ bool nss_meminfo_init(struct nss_ctx_ins - * Check meminfo start magic - */ - if ((uint16_t)meminfo_start[0] != NSS_MEMINFO_RESERVE_AREA_MAGIC) { -- nss_info_always("%p: failed to verify meminfo start magic\n", nss_ctx); -+ nss_info_always("%px: failed to verify meminfo start magic\n", nss_ctx); - return false; - } - - map = &mem_ctx->meminfo_map; - map->start = (uint32_t *)ioremap_cache(meminfo_start[1], NSS_MEMINFO_MAP_SIZE); - if (!map->start) { -- nss_info_always("%p: failed to remap meminfo map\n", nss_ctx); -+ nss_info_always("%px: failed to remap meminfo map\n", nss_ctx); - return false; - } - -@@ -737,7 +737,7 @@ bool nss_meminfo_init(struct nss_ctx_ins - * Check meminfo map magic - */ - if ((uint16_t)map->start[0] != NSS_MEMINFO_MAP_START_MAGIC) { -- nss_info_always("%p: failed to verify meminfo map magic\n", nss_ctx); -+ nss_info_always("%px: failed to verify meminfo map magic\n", nss_ctx); - return false; - } - -@@ -756,7 +756,7 @@ bool nss_meminfo_init(struct nss_ctx_ins - * Init UTCM_SHARED if supported - */ - if (!nss_top->hal_ops->init_utcm_shared(nss_ctx, meminfo_start)) { -- nss_info_always("%p: failed to initialize UTCM_SHARED meminfo\n", nss_ctx); -+ nss_info_always("%px: failed to initialize UTCM_SHARED meminfo\n", nss_ctx); - return false; - } - -@@ -764,7 +764,7 @@ bool nss_meminfo_init(struct nss_ctx_ins - * Init meminfo block lists - */ - if (!nss_meminfo_init_block_lists(nss_ctx)) { -- nss_info_always("%p: failed to initialize meminfo block lists\n", nss_ctx); -+ nss_info_always("%px: failed to initialize meminfo block lists\n", nss_ctx); - return false; - } - -@@ -776,6 +776,6 @@ bool nss_meminfo_init(struct nss_ctx_ins - - nss_meminfo_init_debugfs(nss_ctx); - -- nss_info_always("%p: meminfo init succeed\n", nss_ctx); -+ nss_info_always("%px: meminfo init succeed\n", nss_ctx); - return true; - } ---- a/nss_mirror.c -+++ b/nss_mirror.c -@@ -68,12 +68,12 @@ static void nss_mirror_handler(struct ns - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_MIRROR_MSG_MAX) { -- nss_warning("%p: received invalid message %d for mirror interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for mirror interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_mirror_msg)) { -- nss_warning("%p: Length of message is greater than expected.", nss_ctx); -+ nss_warning("%px: Length of message is greater than expected.", nss_ctx); - return; - } - -@@ -96,7 +96,7 @@ static void nss_mirror_handler(struct ns - * Update the callback and app_data for NOTIFY messages. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_top_main.if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)app_data; - } - -@@ -110,7 +110,7 @@ static void nss_mirror_handler(struct ns - * Call mirror interface callback. - */ - if (!cb) { -- nss_warning("%p: No callback for mirror interface %d", -+ nss_warning("%px: No callback for mirror interface %d", - nss_ctx, ncm->interface); - return; - } -@@ -150,12 +150,12 @@ nss_tx_status_t nss_mirror_tx_msg(struct - * Sanity check the message. - */ - if (!nss_mirror_verify_if_num(ncm->interface)) { -- nss_warning("%p: tx request for non mirror interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for non mirror interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_MIRROR_MSG_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -183,14 +183,14 @@ nss_tx_status_t nss_mirror_tx_msg_sync(s - - status = nss_mirror_tx_msg(nss_ctx, msg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: mirror_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: mirror_tx_msg failed\n", nss_ctx); - up(&nss_mirror_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&nss_mirror_pvt.complete, msecs_to_jiffies(NSS_MIRROR_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: Mirror interface tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: Mirror interface tx sync failed due to timeout\n", nss_ctx); - nss_mirror_pvt.response = NSS_TX_FAILURE; - } - -@@ -207,16 +207,20 @@ EXPORT_SYMBOL(nss_mirror_tx_msg_sync); - void nss_mirror_unregister_if(uint32_t if_num) - { - struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.mirror_handler_id]; -+ uint32_t status; - - nss_assert(nss_ctx); - nss_assert(nss_mirror_verify_if_num(if_num)); - - nss_core_unregister_subsys_dp(nss_ctx, if_num); - -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -- - nss_core_unregister_handler(nss_ctx, if_num); - -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to unregister handler for interface %d with NSS core\n", nss_ctx, if_num); -+ } -+ - atomic_dec(&nss_mirror_num_instances); - nss_mirror_stats_reset(if_num); - } -@@ -239,23 +243,27 @@ struct nss_ctx_instance *nss_mirror_regi - nss_assert(nss_mirror_verify_if_num(if_num)); - - if (atomic_read(&nss_mirror_num_instances) == NSS_MAX_MIRROR_DYNAMIC_INTERFACES) { -- nss_warning("%p: Maximum number of mirror interfaces are already allocated\n", nss_ctx); -+ nss_warning("%px: Maximum number of mirror interfaces are already allocated\n", nss_ctx); - return NULL; - } - - ret = nss_mirror_stats_init(if_num, netdev); - if (ret < 0) { -- nss_warning("%p: Error in initializaing mirror stats.\n", nss_ctx); -+ nss_warning("%px: Error in initializaing mirror stats.\n", nss_ctx); -+ return NULL; -+ } -+ -+ nss_core_register_handler(nss_ctx, if_num, nss_mirror_handler, netdev); -+ ret = nss_core_register_msg_handler(nss_ctx, if_num, event_callback); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, if_num); -+ nss_warning("%px: Not able to register handler for mirror interface %d with NSS core\n", nss_ctx, if_num); - return NULL; - } - - nss_core_register_subsys_dp(nss_ctx, if_num, data_callback, NULL, NULL, netdev, features); - nss_core_set_subsys_dp_type(nss_ctx, netdev, if_num, NSS_DYNAMIC_INTERFACE_TYPE_MIRROR); - -- nss_top_main.if_rx_msg_callback[if_num] = event_callback; -- -- nss_core_register_handler(nss_ctx, if_num, nss_mirror_handler, netdev); -- - atomic_inc(&nss_mirror_num_instances); - return nss_ctx; - } ---- a/nss_mirror_log.c -+++ b/nss_mirror_log.c -@@ -62,7 +62,7 @@ static void nss_mirror_log_configure_msg - { - struct nss_mirror_configure_msg *config_msg __maybe_unused = &nmm->msg.config; - -- nss_trace("%p: NSS Mirror Config message \n" -+ nss_trace("%px: NSS Mirror Config message \n" - "Packet clone size: %u\n" - "Packet clone point: %hu\n", - config_msg, -@@ -78,7 +78,7 @@ static void nss_mirror_log_set_nexthop_m - { - struct nss_mirror_set_nexthop_msg *nexthop_msg __maybe_unused = &nmm->msg.nexthop; - -- nss_trace("%p: NSS Mirror Nexthop message \n" -+ nss_trace("%px: NSS Mirror Nexthop message \n" - "Nexthop interface number: %u\n", - nexthop_msg, - nexthop_msg->if_num); -@@ -90,7 +90,7 @@ static void nss_mirror_log_set_nexthop_m - */ - static void nss_mirror_log_enable_msg(struct nss_mirror_msg *nmm) - { -- nss_trace("%p: NSS Mirror message: Enable \n", nmm); -+ nss_trace("%px: NSS Mirror message: Enable \n", nmm); - } - - /* -@@ -99,7 +99,7 @@ static void nss_mirror_log_enable_msg(st - */ - static void nss_mirror_log_disable_msg(struct nss_mirror_msg *nmm) - { -- nss_trace("%p: NSS Mirror message: Disable \n", nmm); -+ nss_trace("%px: NSS Mirror message: Disable \n", nmm); - } - - /* -@@ -108,7 +108,7 @@ static void nss_mirror_log_disable_msg(s - */ - static void nss_mirror_log_reset_nexthop_msg(struct nss_mirror_msg *nmm) - { -- nss_trace("%p: NSS Mirror message: Reset Nexthop \n", nmm); -+ nss_trace("%px: NSS Mirror message: Reset Nexthop \n", nmm); - } - - /* -@@ -142,7 +142,7 @@ static void nss_mirror_log_verbose(struc - break; - - default: -- nss_trace("%p: Invalid message type\n", nmm); -+ nss_trace("%px: Invalid message type\n", nmm); - break; - } - } -@@ -154,11 +154,11 @@ static void nss_mirror_log_verbose(struc - void nss_mirror_log_tx_msg(struct nss_mirror_msg *nmm) - { - if (nmm->cm.type >= NSS_MIRROR_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", nmm); -+ nss_warning("%px: Invalid message type\n", nmm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nmm, nmm->cm.type, nss_mirror_log_message_types_str[nmm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nmm, nmm->cm.type, nss_mirror_log_message_types_str[nmm->cm.type]); - nss_mirror_log_verbose(nmm); - } - -@@ -169,26 +169,26 @@ void nss_mirror_log_tx_msg(struct nss_mi - void nss_mirror_log_rx_msg(struct nss_mirror_msg *nmm) - { - if (nmm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nmm); -+ nss_warning("%px: Invalid response\n", nmm); - return; - } - - if (nmm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nmm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nmm, nmm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nmm, nmm->cm.type, - nss_mirror_log_message_types_str[nmm->cm.type], - nmm->cm.response, nss_cmn_response_str[nmm->cm.response]); - goto verbose; - } - - if (nmm->cm.error >= NSS_MIRROR_ERROR_TYPE_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nmm, nmm->cm.type, nss_mirror_log_message_types_str[nmm->cm.type], - nmm->cm.response, nss_cmn_response_str[nmm->cm.response], - nmm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nmm, nmm->cm.type, nss_mirror_log_message_types_str[nmm->cm.type], - nmm->cm.response, nss_cmn_response_str[nmm->cm.response], - nmm->cm.error, nss_mirror_log_error_response_types_str[nmm->cm.error]); ---- a/nss_n2h.c -+++ b/nss_n2h.c -@@ -74,7 +74,7 @@ static void nss_n2h_interface_handler(st - * Is this a valid request/response packet? - */ - if (nnm->cm.type >= NSS_METADATA_TYPE_N2H_MAX) { -- nss_warning("%p: received invalid message %d for Offload stats interface", nss_ctx, nnm->cm.type); -+ nss_warning("%px: received invalid message %d for Offload stats interface", nss_ctx, nnm->cm.type); - return; - } - -@@ -88,11 +88,11 @@ static void nss_n2h_interface_handler(st - break; - - case NSS_TX_METADATA_TYPE_N2H_EMPTY_POOL_BUF_CFG: -- nss_info("%p: empty pool buf cfg response from FW", nss_ctx); -+ nss_info("%px: empty pool buf cfg response from FW", nss_ctx); - break; - - case NSS_TX_METADATA_TYPE_N2H_FLUSH_PAYLOADS: -- nss_info("%p: flush payloads cmd response from FW", nss_ctx); -+ nss_info("%px: flush payloads cmd response from FW", nss_ctx); - break; - - case NSS_RX_METADATA_TYPE_N2H_STATS_SYNC: -@@ -108,7 +108,7 @@ static void nss_n2h_interface_handler(st - /* - * Check response - */ -- nss_info("%p: Received response %d for type %d, interface %d", -+ nss_info("%px: Received response %d for type %d, interface %d", - nss_ctx, ncm->response, ncm->type, ncm->interface); - } - } -@@ -252,12 +252,12 @@ static void nss_n2h_set_wifi_payloads_ca - - nss_n2h_wp.response = NSS_FAILURE; - complete(&nss_n2h_wp.complete); -- nss_warning("%p: wifi pool configuration failed : %d\n", nss_ctx, -+ nss_warning("%px: wifi pool configuration failed : %d\n", nss_ctx, - nnm->cm.error); - return; - } - -- nss_info("%p: wifi payload configuration succeeded: %d\n", nss_ctx, -+ nss_info("%px: wifi payload configuration succeeded: %d\n", nss_ctx, - nnm->cm.error); - nss_n2h_wp.response = NSS_SUCCESS; - nss_n2h_wp.wifi_pool = ntohl(nnm->msg.wp.payloads); -@@ -282,7 +282,7 @@ static int nss_n2h_get_payload_info(nss_ - nss_tx_status = nss_n2h_tx_msg(nss_ctx, nnm); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: core %d nss_tx error errorn", nss_ctx, (int)core_num); -+ nss_warning("%px: core %d nss_tx error errorn", nss_ctx, (int)core_num); - return NSS_FAILURE; - } - -@@ -292,12 +292,12 @@ static int nss_n2h_get_payload_info(nss_ - ret = wait_for_completion_timeout(&nss_n2h_nepbcfgp[core_num].complete, - msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: core %d waiting for ack timed out\n", nss_ctx, (int)core_num); -+ nss_warning("%px: core %d waiting for ack timed out\n", nss_ctx, (int)core_num); - return NSS_FAILURE; - } - - if (NSS_FAILURE == nss_n2h_nepbcfgp[core_num].response) { -- nss_warning("%p: core %d response returned failure\n", nss_ctx, (int)core_num); -+ nss_warning("%px: core %d response returned failure\n", nss_ctx, (int)core_num); - return NSS_FAILURE; - } - -@@ -387,12 +387,12 @@ static int nss_n2h_set_empty_buf_pool(st - } - - if ((*new_val < NSS_N2H_MIN_EMPTY_POOL_BUF_SZ)) { -- nss_warning("%p: core %d setting %d < min number of buffer", -+ nss_warning("%px: core %d setting %d < min number of buffer", - nss_ctx, (int)core_num, *new_val); - goto failure; - } - -- nss_info("%p: core %d number of empty pool buffer is : %d\n", -+ nss_info("%px: core %d number of empty pool buffer is : %d\n", - nss_ctx, (int)core_num, *new_val); - - nss_n2h_msg_init(&nnm, NSS_N2H_INTERFACE, -@@ -406,7 +406,7 @@ static int nss_n2h_set_empty_buf_pool(st - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: core %d nss_tx error empty pool buffer: %d\n", -+ nss_warning("%px: core %d nss_tx error empty pool buffer: %d\n", - nss_ctx, (int)core_num, *new_val); - goto failure; - } -@@ -417,7 +417,7 @@ static int nss_n2h_set_empty_buf_pool(st - ret = wait_for_completion_timeout(&nss_n2h_nepbcfgp[core_num].complete, - msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: core %d Waiting for ack timed out\n", nss_ctx, (int)core_num); -+ nss_warning("%px: core %d Waiting for ack timed out\n", nss_ctx, (int)core_num); - goto failure; - } - -@@ -489,12 +489,12 @@ static int nss_n2h_set_empty_paged_pool_ - } - - if ((*new_val < NSS_N2H_MIN_EMPTY_POOL_BUF_SZ)) { -- nss_warning("%p: core %d setting %d < min number of buffer", -+ nss_warning("%px: core %d setting %d < min number of buffer", - nss_ctx, (int)core_num, *new_val); - goto failure; - } - -- nss_info("%p: core %d number of empty paged pool buffer is : %d\n", -+ nss_info("%px: core %d number of empty paged pool buffer is : %d\n", - nss_ctx, (int)core_num, *new_val); - - nss_n2h_msg_init(&nnm, NSS_N2H_INTERFACE, -@@ -508,7 +508,7 @@ static int nss_n2h_set_empty_paged_pool_ - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: core %d nss_tx error empty paged pool buffer: %d\n", -+ nss_warning("%px: core %d nss_tx error empty paged pool buffer: %d\n", - nss_ctx, (int)core_num, *new_val); - goto failure; - } -@@ -519,7 +519,7 @@ static int nss_n2h_set_empty_paged_pool_ - ret = wait_for_completion_timeout(&nss_n2h_nepbcfgp[core_num].complete, - msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: core %d Waiting for ack timed out\n", nss_ctx, (int)core_num); -+ nss_warning("%px: core %d Waiting for ack timed out\n", nss_ctx, (int)core_num); - goto failure; - } - -@@ -590,25 +590,25 @@ static int nss_n2h_set_water_mark(struct - - if ((*low < NSS_N2H_MIN_EMPTY_POOL_BUF_SZ) || - (*high < NSS_N2H_MIN_EMPTY_POOL_BUF_SZ)) { -- nss_warning("%p: core %d setting %d, %d < min number of buffer", -+ nss_warning("%px: core %d setting %d, %d < min number of buffer", - nss_ctx, core_num, *low, *high); - goto failure; - } - - if ((*low > NSS_N2H_MAX_EMPTY_POOL_BUF_SZ) || - (*high > NSS_N2H_MAX_EMPTY_POOL_BUF_SZ)) { -- nss_warning("%p: core %d setting %d, %d is > upper limit", -+ nss_warning("%px: core %d setting %d, %d is > upper limit", - nss_ctx, core_num, *low, *high); - goto failure; - } - - if (*low > *high) { -- nss_warning("%p: core %d setting low %d is more than high %d", -+ nss_warning("%px: core %d setting low %d is more than high %d", - nss_ctx, core_num, *low, *high); - goto failure; - } - -- nss_info("%p: core %d number of low : %d and high : %d\n", -+ nss_info("%px: core %d number of low : %d and high : %d\n", - nss_ctx, core_num, *low, *high); - - nss_n2h_msg_init(&nnm, NSS_N2H_INTERFACE, -@@ -623,7 +623,7 @@ static int nss_n2h_set_water_mark(struct - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: core %d nss_tx error setting : %d, %d\n", -+ nss_warning("%px: core %d nss_tx error setting : %d, %d\n", - nss_ctx, core_num, *low, *high); - goto failure; - } -@@ -634,7 +634,7 @@ static int nss_n2h_set_water_mark(struct - ret = wait_for_completion_timeout(&nss_n2h_nepbcfgp[core_num].complete, - msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: core %d Waiting for ack timed out\n", nss_ctx, -+ nss_warning("%px: core %d Waiting for ack timed out\n", nss_ctx, - core_num); - goto failure; - } -@@ -704,25 +704,25 @@ static int nss_n2h_set_paged_water_mark( - - if ((*low < NSS_N2H_MIN_EMPTY_POOL_BUF_SZ) || - (*high < NSS_N2H_MIN_EMPTY_POOL_BUF_SZ)) { -- nss_warning("%p: core %d setting %d, %d < min number of buffer", -+ nss_warning("%px: core %d setting %d, %d < min number of buffer", - nss_ctx, core_num, *low, *high); - goto failure; - } - - if ((*low > NSS_N2H_MAX_EMPTY_POOL_BUF_SZ) || - (*high > NSS_N2H_MAX_EMPTY_POOL_BUF_SZ)) { -- nss_warning("%p: core %d setting %d, %d is > upper limit", -+ nss_warning("%px: core %d setting %d, %d is > upper limit", - nss_ctx, core_num, *low, *high); - goto failure; - } - - if (*low > *high) { -- nss_warning("%p: core %d setting low %d is more than high %d", -+ nss_warning("%px: core %d setting low %d is more than high %d", - nss_ctx, core_num, *low, *high); - goto failure; - } - -- nss_info("%p: core %d number of low : %d and high : %d\n", -+ nss_info("%px: core %d number of low : %d and high : %d\n", - nss_ctx, core_num, *low, *high); - - nss_n2h_msg_init(&nnm, NSS_N2H_INTERFACE, -@@ -737,7 +737,7 @@ static int nss_n2h_set_paged_water_mark( - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: core %d nss_tx error setting : %d, %d\n", -+ nss_warning("%px: core %d nss_tx error setting : %d, %d\n", - nss_ctx, core_num, *low, *high); - goto failure; - } -@@ -748,7 +748,7 @@ static int nss_n2h_set_paged_water_mark( - ret = wait_for_completion_timeout(&nss_n2h_nepbcfgp[core_num].complete, - msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: core %d Waiting for ack timed out\n", nss_ctx, -+ nss_warning("%px: core %d Waiting for ack timed out\n", nss_ctx, - core_num); - goto failure; - } -@@ -815,18 +815,18 @@ static int nss_n2h_cfg_wifi_pool(struct - goto failure; - - if ((*payloads < NSS_N2H_MIN_EMPTY_POOL_BUF_SZ)) { -- nss_warning("%p: wifi setting %d < min number of buffer", -+ nss_warning("%px: wifi setting %d < min number of buffer", - nss_ctx, *payloads); - goto failure; - } - - if ((*payloads > NSS_N2H_MAX_EMPTY_POOL_BUF_SZ)) { -- nss_warning("%p: wifi setting %d > max number of buffer", -+ nss_warning("%px: wifi setting %d > max number of buffer", - nss_ctx, *payloads); - goto failure; - } - -- nss_info("%p: wifi payloads : %d\n", -+ nss_info("%px: wifi payloads : %d\n", - nss_ctx, *payloads); - - nss_n2h_msg_init(&nnm, NSS_N2H_INTERFACE, -@@ -840,7 +840,7 @@ static int nss_n2h_cfg_wifi_pool(struct - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: wifi setting %d nss_tx error", -+ nss_warning("%px: wifi setting %d nss_tx error", - nss_ctx, *payloads); - goto failure; - } -@@ -851,7 +851,7 @@ static int nss_n2h_cfg_wifi_pool(struct - ret = wait_for_completion_timeout(&nss_n2h_wp.complete, - msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: Waiting for ack timed out\n", nss_ctx); -+ nss_warning("%px: Waiting for ack timed out\n", nss_ctx); - goto failure; - } - -@@ -1039,7 +1039,7 @@ nss_tx_status_t nss_n2h_update_queue_con - - status = nss_n2h_tx_msg(nss_ctx, &nnm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_tx error to send pnode queue config\n", nss_ctx); -+ nss_warning("%px: nss_tx error to send pnode queue config\n", nss_ctx); - return status; - } - -@@ -1092,14 +1092,14 @@ nss_tx_status_t nss_n2h_update_queue_con - status = nss_n2h_tx_msg(nss_ctx, &nnm); - - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: n2h_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: n2h_tx_msg failed\n", nss_ctx); - up(&nss_n2h_q_cfg_pvt.sem); - return status; - } - ret = wait_for_completion_timeout(&nss_n2h_q_cfg_pvt.complete, msecs_to_jiffies(NSS_N2H_TX_TIMEOUT)); - - if (!ret) { -- nss_warning("%p: Timeout expired for pnode queue config sync message\n", nss_ctx); -+ nss_warning("%px: Timeout expired for pnode queue config sync message\n", nss_ctx); - nss_n2h_q_cfg_pvt.response = NSS_TX_FAILURE; - } - -@@ -1134,7 +1134,7 @@ static nss_tx_status_t nss_n2h_mitigatio - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_tx error setting mitigation\n", nss_ctx); -+ nss_warning("%px: nss_tx error setting mitigation\n", nss_ctx); - goto failure; - } - -@@ -1143,7 +1143,7 @@ static nss_tx_status_t nss_n2h_mitigatio - */ - ret = wait_for_completion_timeout(&nss_n2h_mitigationcp[core_num].complete, msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: Waiting for ack timed out\n", nss_ctx); -+ nss_warning("%px: Waiting for ack timed out\n", nss_ctx); - goto failure; - } - -@@ -1215,7 +1215,7 @@ static nss_tx_status_t nss_n2h_buf_pool_ - if (nss_tx_status != NSS_TX_SUCCESS) { - - nss_n2h_buf_pool_free(buf_pool); -- nss_warning("%p: nss_tx error setting pbuf\n", nss_ctx); -+ nss_warning("%px: nss_tx error setting pbuf\n", nss_ctx); - goto failure; - } - -@@ -1224,7 +1224,7 @@ static nss_tx_status_t nss_n2h_buf_pool_ - */ - ret = wait_for_completion_timeout(&nss_n2h_bufcp[core_num].complete, msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: Waiting for ack timed out\n", nss_ctx); -+ nss_warning("%px: Waiting for ack timed out\n", nss_ctx); - goto failure; - } - -@@ -1246,7 +1246,6 @@ failure: - return NSS_FAILURE; - } - -- - /* - * nss_mitigation_handler() - * Enable NSS MITIGATION -@@ -1432,7 +1431,7 @@ static int nss_n2h_set_queue_limit_sync( - * We dont allow shortening of the queue size at run-time - */ - if (nss_n2h_queue_limit[core_id] < current_val) { -- nss_warning("%p: New queue limit %d less than previous value %d. Cant allow shortening\n", -+ nss_warning("%px: New queue limit %d less than previous value %d. Cant allow shortening\n", - nss_ctx, nss_n2h_queue_limit[core_id], current_val); - nss_n2h_queue_limit[core_id] = current_val; - return NSS_TX_FAILURE; -@@ -1453,7 +1452,7 @@ static int nss_n2h_set_queue_limit_sync( - - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nim); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: n2h queue limit message send failed\n", nss_ctx); -+ nss_warning("%px: n2h queue limit message send failed\n", nss_ctx); - nss_n2h_queue_limit[core_id] = current_val; - up(&nss_n2h_q_lim_pvt.sem); - return nss_tx_status; -@@ -1461,7 +1460,7 @@ static int nss_n2h_set_queue_limit_sync( - - ret = wait_for_completion_timeout(&nss_n2h_q_lim_pvt.complete, msecs_to_jiffies(NSS_N2H_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: Timeout expired for queue limit sync message\n", nss_ctx); -+ nss_warning("%px: Timeout expired for queue limit sync message\n", nss_ctx); - nss_n2h_queue_limit[core_id] = current_val; - up(&nss_n2h_q_lim_pvt.sem); - return NSS_TX_FAILURE; -@@ -1512,11 +1511,11 @@ static void nss_n2h_host_bp_cfg_callback - if (nnm->cm.response != NSS_CMN_RESPONSE_ACK) { - nss_n2h_host_bp_cfg_pvt.response = NSS_FAILURE; - complete(&nss_n2h_host_bp_cfg_pvt.complete); -- nss_warning("%p: n2h back pressure configuration failed : %d\n", nss_ctx, nnm->cm.error); -+ nss_warning("%px: n2h back pressure configuration failed : %d\n", nss_ctx, nnm->cm.error); - return; - } - -- nss_info("%p: n2h back pressure configuration succeeded: %d\n", nss_ctx, nnm->cm.error); -+ nss_info("%px: n2h back pressure configuration succeeded: %d\n", nss_ctx, nnm->cm.error); - nss_n2h_host_bp_cfg_pvt.response = NSS_SUCCESS; - complete(&nss_n2h_host_bp_cfg_pvt.complete); - } -@@ -1541,7 +1540,7 @@ static nss_tx_status_t nss_n2h_host_bp_c - - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_tx error setting back pressure\n", nss_ctx); -+ nss_warning("%px: nss_tx error setting back pressure\n", nss_ctx); - up(&nss_n2h_host_bp_cfg_pvt.sem); - return NSS_FAILURE; - } -@@ -1551,7 +1550,7 @@ static nss_tx_status_t nss_n2h_host_bp_c - */ - ret = wait_for_completion_timeout(&nss_n2h_host_bp_cfg_pvt.complete, msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: Waiting for ack timed out\n", nss_ctx); -+ nss_warning("%px: Waiting for ack timed out\n", nss_ctx); - up(&nss_n2h_host_bp_cfg_pvt.sem); - return NSS_FAILURE; - } -@@ -1599,7 +1598,7 @@ static int nss_n2h_host_bp_cfg_handler(s - ret_bp = nss_n2h_host_bp_cfg_sync(nss_ctx, nss_n2h_host_bp_config[core_id]); - - if (ret_bp != NSS_SUCCESS) { -- nss_warning("%p: n2h back pressure config failed\n", nss_ctx); -+ nss_warning("%px: n2h back pressure config failed\n", nss_ctx); - nss_n2h_host_bp_config[core_id] = current_state; - } - -@@ -1903,18 +1902,18 @@ nss_tx_status_t nss_n2h_cfg_empty_pool_s - nss_tx_status_t nss_tx_status; - - if (pool_sz < NSS_N2H_MIN_EMPTY_POOL_BUF_SZ) { -- nss_warning("%p: setting pool size %d < min number of buffer", -+ nss_warning("%px: setting pool size %d < min number of buffer", - nss_ctx, pool_sz); - return NSS_TX_FAILURE; - } - - if (pool_sz > NSS_N2H_MAX_EMPTY_POOL_BUF_SZ) { -- nss_warning("%p: setting pool size %d > max number of buffer", -+ nss_warning("%px: setting pool size %d > max number of buffer", - nss_ctx, pool_sz); - return NSS_TX_FAILURE; - } - -- nss_info("%p: update number of empty buffer pool size: %d\n", -+ nss_info("%px: update number of empty buffer pool size: %d\n", - nss_ctx, pool_sz); - - nss_n2h_msg_init(&nnm, NSS_N2H_INTERFACE, -@@ -1926,7 +1925,7 @@ nss_tx_status_t nss_n2h_cfg_empty_pool_s - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_tx error empty buffer pool: %d\n", nss_ctx, pool_sz); -+ nss_warning("%px: nss_tx error empty buffer pool: %d\n", nss_ctx, pool_sz); - return nss_tx_status; - } - -@@ -1953,7 +1952,7 @@ nss_tx_status_t nss_n2h_paged_buf_pool_i - - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: failed to send paged buf configuration init command to NSS\n", -+ nss_warning("%px: failed to send paged buf configuration init command to NSS\n", - nss_ctx); - return NSS_TX_FAILURE; - } -@@ -1986,7 +1985,7 @@ nss_tx_status_t nss_n2h_flush_payloads(s - - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: failed to send flush payloads command to NSS\n", -+ nss_warning("%px: failed to send flush payloads command to NSS\n", - nss_ctx); - - return NSS_TX_FAILURE; -@@ -2017,12 +2016,12 @@ nss_tx_status_t nss_n2h_tx_msg(struct ns - * Sanity check the message - */ - if (ncm->interface != NSS_N2H_INTERFACE) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_METADATA_TYPE_N2H_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - ---- a/nss_oam.c -+++ b/nss_oam.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2018, 2020 The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -45,12 +45,12 @@ static void nss_oam_rx_msg_handler(struc - * Sanity check the message type - */ - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_oam_msg)) { -- nss_warning("%p: recevied with invalid msg size: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: recevied with invalid msg size: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - - if (ncm->type > NSS_OAM_MSG_TYPE_MAX) { -- nss_warning("%p: received with invalid resp type: %d", nss_ctx, ncm->type); -+ nss_warning("%px: received with invalid resp type: %d", nss_ctx, ncm->type); - return; - } - -@@ -66,7 +66,7 @@ static void nss_oam_rx_msg_handler(struc - - cb = (nss_oam_msg_callback_t)ncm->cb; - if (unlikely(!cb)) { -- nss_trace("%p: rx handler has been unregistered for i/f: %d", nss_ctx, ncm->interface); -+ nss_trace("%px: rx handler has been unregistered for i/f: %d", nss_ctx, ncm->interface); - return; - } - cb((void *)ncm->app_data, nom); -@@ -86,12 +86,12 @@ nss_tx_status_t nss_oam_tx_msg(struct ns - nss_oam_log_tx_msg(nom); - - if (ncm->type > NSS_OAM_MSG_TYPE_MAX) { -- nss_warning("%p: CMD type for oam module is invalid - %d", nss_ctx, ncm->type); -+ nss_warning("%px: CMD type for oam module is invalid - %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE_BAD_PARAM; - } - - if (ncm->interface != NSS_OAM_INTERFACE) { -- nss_warning("%p: tx message request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx message request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - ---- a/nss_oam_log.c -+++ b/nss_oam_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -37,8 +37,8 @@ static int8_t *nss_oam_log_message_types - static void nss_oam_log_get_fw_version_msg(struct nss_oam_msg *nom) - { - struct nss_oam_fw_ver *nofm __maybe_unused = &nom->msg.fw_ver; -- nss_trace("%p: NSS OAM Get FW Version message \n" -- "OAM FW Version: %p\n", -+ nss_trace("%px: NSS OAM Get FW Version message \n" -+ "OAM FW Version: %px\n", - nofm, nofm->string); - } - -@@ -54,7 +54,7 @@ static void nss_oam_log_verbose(struct n - break; - - default: -- nss_trace("%p: Invalid message type\n", nom); -+ nss_trace("%px: Invalid message type\n", nom); - break; - } - } -@@ -66,11 +66,11 @@ static void nss_oam_log_verbose(struct n - void nss_oam_log_tx_msg(struct nss_oam_msg *nom) - { - if (nom->cm.type >= NSS_OAM_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", nom); -+ nss_warning("%px: Invalid message type\n", nom); - return; - } - -- nss_info("%p: type[%d]:%s\n", nom, nom->cm.type, nss_oam_log_message_types_str[nom->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nom, nom->cm.type, nss_oam_log_message_types_str[nom->cm.type]); - nss_oam_log_verbose(nom); - } - -@@ -81,18 +81,18 @@ void nss_oam_log_tx_msg(struct nss_oam_m - void nss_oam_log_rx_msg(struct nss_oam_msg *nom) - { - if (nom->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nom); -+ nss_warning("%px: Invalid response\n", nom); - return; - } - - if (nom->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nom->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nom, nom->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nom, nom->cm.type, - nss_oam_log_message_types_str[nom->cm.type], - nom->cm.response, nss_cmn_response_str[nom->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - nom, nom->cm.type, nss_oam_log_message_types_str[nom->cm.type], - nom->cm.response, nss_cmn_response_str[nom->cm.response]); - ---- a/nss_phys_if.c -+++ b/nss_phys_if.c -@@ -77,17 +77,17 @@ static void nss_phys_if_msg_handler(stru - * Sanity check the message type - */ - if (ncm->type > NSS_PHYS_IF_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return; - } - - if (!NSS_IS_IF_TYPE(PHYSICAL, ncm->interface)) { -- nss_warning("%p: response for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: response for another interface: %d", nss_ctx, ncm->interface); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_phys_if_msg)) { -- nss_warning("%p: message length too big: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: message length too big: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -162,7 +162,7 @@ static void nss_phys_if_callback(void *a - */ - nss_tx_status_t nss_phys_if_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, uint32_t if_num) - { -- nss_trace("%p: Phys If Tx packet, id:%d, data=%p", nss_ctx, if_num, os_buf->data); -+ nss_trace("%px: Phys If Tx packet, id:%d, data=%px", nss_ctx, if_num, os_buf->data); - - #ifdef NSS_DRV_TSTAMP_ENABLE - /* -@@ -196,18 +196,18 @@ nss_tx_status_t nss_phys_if_msg(struct n - * Sanity check the message - */ - if (!NSS_IS_IF_TYPE(PHYSICAL, ncm->interface)) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_PHYS_IF_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - - dev = nss_ctx->subsys_dp_register[ncm->interface].ndev; - if (!dev) { -- nss_warning("%p: Unregister physical interface %d: no context", nss_ctx, ncm->interface); -+ nss_warning("%px: Unregister physical interface %d: no context", nss_ctx, ncm->interface); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -228,7 +228,7 @@ nss_tx_status_t nss_phys_if_msg_sync(str - status = nss_phys_if_msg(nss_ctx, nim); - if(status != NSS_TX_SUCCESS) - { -- nss_warning("%p: nss_phys_if_msg failed\n", nss_ctx); -+ nss_warning("%px: nss_phys_if_msg failed\n", nss_ctx); - up(&phif.sem); - return status; - } -@@ -237,7 +237,7 @@ nss_tx_status_t nss_phys_if_msg_sync(str - - if(!ret) - { -- nss_warning("%p: phys_if tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: phys_if tx failed due to timeout\n", nss_ctx); - phif.response = NSS_TX_FAILURE; - } - -@@ -326,7 +326,7 @@ nss_tx_status_t nss_phys_if_open(struct - struct nss_if_open *nio; - - NSS_VERIFY_CTX_MAGIC(nss_ctx); -- nss_info("%p: Phys If Open, id:%d, TxDesc: %x, RxDesc: %x\n", nss_ctx, if_num, tx_desc_ring, rx_desc_ring); -+ nss_info("%px: Phys If Open, id:%d, TxDesc: %x, RxDesc: %x\n", nss_ctx, if_num, tx_desc_ring, rx_desc_ring); - - nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_OPEN, - sizeof(struct nss_if_open), nss_phys_if_callback, NULL); -@@ -345,7 +345,7 @@ nss_tx_status_t nss_phys_if_open(struct - nio->rx_forward_if = NSS_PORTID_INTERFACE; - nio->alignment_mode = NSS_IF_DATA_ALIGN_2BYTE; - } else { -- nss_info("%p: Phys If Open, unknown mode %d\n", nss_ctx, mode); -+ nss_info("%px: Phys If Open, unknown mode %d\n", nss_ctx, mode); - return NSS_TX_FAILURE; - } - -@@ -370,7 +370,7 @@ nss_tx_status_t nss_phys_if_close(struct - struct nss_phys_if_msg nim; - - NSS_VERIFY_CTX_MAGIC(nss_ctx); -- nss_info("%p: Phys If Close, id:%d \n", nss_ctx, if_num); -+ nss_info("%px: Phys If Close, id:%d \n", nss_ctx, if_num); - - nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_CLOSE, - sizeof(struct nss_if_close), nss_phys_if_callback, NULL); -@@ -388,7 +388,7 @@ nss_tx_status_t nss_phys_if_link_state(s - struct nss_if_link_state_notify *nils; - - NSS_VERIFY_CTX_MAGIC(nss_ctx); -- nss_info("%p: Phys If Link State, id:%d, State: %x\n", nss_ctx, if_num, link_state); -+ nss_info("%px: Phys If Link State, id:%d, State: %x\n", nss_ctx, if_num, link_state); - - nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_LINK_STATE_NOTIFY, - sizeof(struct nss_if_link_state_notify), nss_phys_if_callback, NULL); -@@ -408,7 +408,7 @@ nss_tx_status_t nss_phys_if_mac_addr(str - struct nss_if_mac_address_set *nmas; - - NSS_VERIFY_CTX_MAGIC(nss_ctx); -- nss_info("%p: Phys If MAC Address, id:%d\n", nss_ctx, if_num); -+ nss_info("%px: Phys If MAC Address, id:%d\n", nss_ctx, if_num); - nss_assert(addr != 0); - - nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_MAC_ADDR_SET, -@@ -441,7 +441,7 @@ nss_tx_status_t nss_phys_if_change_mtu(s - } - #endif - NSS_VERIFY_CTX_MAGIC(nss_ctx); -- nss_info("%p: Phys If Change MTU, id:%d, mtu=%d\n", nss_ctx, if_num, mtu); -+ nss_info("%px: Phys If Change MTU, id:%d, mtu=%d\n", nss_ctx, if_num, mtu); - - nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_MTU_CHANGE, - sizeof(struct nss_if_mtu_change), nss_phys_if_callback, NULL); -@@ -491,7 +491,6 @@ nss_tx_status_t nss_phys_if_change_mtu(s - nss_ctx->max_buf_size = NSS_EMPTY_BUFFER_SIZE; - #endif - -- - #if (NSS_SKB_REUSE_SUPPORT == 1) - if (nss_ctx->max_buf_size > nss_core_get_max_reuse()) - nss_core_set_max_reuse(ALIGN(nss_ctx->max_buf_size * 2, PAGE_SIZE)); -@@ -524,7 +523,7 @@ nss_tx_status_t nss_phys_if_vsi_assign(s - struct nss_phys_if_msg nim; - - NSS_VERIFY_CTX_MAGIC(nss_ctx); -- nss_info("%p: Phys If VSI Assign, id:%d\n", nss_ctx, if_num); -+ nss_info("%px: Phys If VSI Assign, id:%d\n", nss_ctx, if_num); - - memset(&nim, 0, sizeof(struct nss_phys_if_msg)); - -@@ -544,7 +543,7 @@ nss_tx_status_t nss_phys_if_vsi_unassign - struct nss_phys_if_msg nim; - - NSS_VERIFY_CTX_MAGIC(nss_ctx); -- nss_info("%p: Phys If VSI Unassign, id:%d\n", nss_ctx, if_num); -+ nss_info("%px: Phys If VSI Unassign, id:%d\n", nss_ctx, if_num); - - memset(&nim, 0, sizeof(struct nss_phys_if_msg)); - -@@ -565,7 +564,7 @@ nss_tx_status_t nss_phys_if_pause_on_off - struct nss_if_pause_on_off *nipe; - - NSS_VERIFY_CTX_MAGIC(nss_ctx); -- nss_info("%p: phys if pause is set to %d, id:%d\n", nss_ctx, pause_on, if_num); -+ nss_info("%px: phys if pause is set to %d, id:%d\n", nss_ctx, pause_on, if_num); - - nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_PAUSE_ON_OFF, - sizeof(struct nss_if_pause_on_off), nss_phys_if_callback, NULL); -@@ -577,6 +576,23 @@ nss_tx_status_t nss_phys_if_pause_on_off - } - - /* -+ * nss_phys_if_reset_nexthop() -+ * De-configures nexthop for an interface -+ */ -+nss_tx_status_t nss_phys_if_reset_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num) -+{ -+ struct nss_phys_if_msg nim; -+ -+ NSS_VERIFY_CTX_MAGIC(nss_ctx); -+ -+ nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_RESET_NEXTHOP, -+ 0, nss_phys_if_callback, NULL); -+ -+ return nss_phys_if_msg_sync(nss_ctx, &nim); -+} -+EXPORT_SYMBOL(nss_phys_if_reset_nexthop); -+ -+/* - * nss_phys_if_set_nexthop() - * Configures nexthop for an interface - */ -@@ -587,11 +603,11 @@ nss_tx_status_t nss_phys_if_set_nexthop( - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (nexthop >= NSS_MAX_NET_INTERFACES) { -- nss_warning("%p: Invalid nexthop interface number: %d", nss_ctx, nexthop); -+ nss_warning("%px: Invalid nexthop interface number: %d", nss_ctx, nexthop); - return NSS_TX_FAILURE_BAD_PARAM; - } - -- nss_info("%p: Phys If nexthop will be set to %d, id:%d\n", nss_ctx, nexthop, if_num); -+ nss_info("%px: Phys If nexthop will be set to %d, id:%d\n", nss_ctx, nexthop, if_num); - - nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_SET_NEXTHOP, - sizeof(struct nss_if_set_nexthop), nss_phys_if_callback, NULL); ---- a/nss_phys_if.h -+++ b/nss_phys_if.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -124,6 +124,7 @@ enum nss_phys_if_msg_types { - NSS_PHYS_IF_VSI_ASSIGN = NSS_IF_VSI_ASSIGN, - NSS_PHYS_IF_VSI_UNASSIGN = NSS_IF_VSI_UNASSIGN, - NSS_PHYS_IF_SET_NEXTHOP = NSS_IF_SET_NEXTHOP, -+ NSS_PHYS_IF_RESET_NEXTHOP = NSS_IF_RESET_NEXTHOP, - NSS_PHYS_IF_EXTENDED_STATS_SYNC = NSS_IF_MAX_MSG_TYPES + 1, - NSS_PHYS_IF_MAX_MSG_TYPES - }; ---- a/nss_portid.c -+++ b/nss_portid.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2015-2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -60,12 +60,12 @@ static void nss_portid_handler(struct ns - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_PORTID_MAX_MSG_TYPE) { -- nss_warning("%p: received invalid message %d for portid interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for portid interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_portid_msg)) { -- nss_warning("%p: message size incorrect: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: message size incorrect: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -88,7 +88,7 @@ static void nss_portid_handler(struct ns - * to the same callback/app_data. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev; - } - -@@ -184,12 +184,12 @@ nss_tx_status_t nss_portid_tx_msg(struct - * Sanity check the message - */ - if (ncm->interface != NSS_PORTID_INTERFACE) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_PORTID_MAX_MSG_TYPE) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -228,7 +228,7 @@ nss_tx_status_t nss_portid_tx_msg_sync(s - status = nss_portid_tx_msg(nss_ctx, msg); - if(status != NSS_TX_SUCCESS) - { -- nss_warning("%p: nss_phys_if_msg failed\n", nss_ctx); -+ nss_warning("%px: nss_phys_if_msg failed\n", nss_ctx); - up(&pid.sem); - return status; - } -@@ -237,7 +237,7 @@ nss_tx_status_t nss_portid_tx_msg_sync(s - - if(!ret) - { -- nss_warning("%p: portid tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: portid tx failed due to timeout\n", nss_ctx); - pid.response = NSS_TX_FAILURE; - } - -@@ -377,7 +377,7 @@ bool nss_portid_unregister_port_if(uint3 - - nss_ctx = nss_portid_get_ctx(); - if (nss_portid_verify_if_num(if_num) == false) { -- nss_warning("%p: unregister received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: unregister received for invalid interface %d", nss_ctx, if_num); - return false; - } - ---- a/nss_portid_log.c -+++ b/nss_portid_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -38,7 +38,7 @@ static int8_t *nss_portid_log_message_ty - static void nss_portid_log_configure_msg(struct nss_portid_msg *npm) - { - struct nss_portid_configure_msg *npcm __maybe_unused = &npm->msg.configure; -- nss_trace("%p: NSS PORTID Configure message \n" -+ nss_trace("%px: NSS PORTID Configure message \n" - "PORTID Interface Number: %d\n" - "PORTID Interface ID: %d\n" - "PORTID GMAC ID: %d\n", -@@ -53,7 +53,7 @@ static void nss_portid_log_configure_msg - static void nss_portid_log_unconfigure_msg(struct nss_portid_msg *npm) - { - struct nss_portid_unconfigure_msg *npum __maybe_unused = &npm->msg.unconfigure; -- nss_trace("%p: NSS PORTID Configure message \n" -+ nss_trace("%px: NSS PORTID Configure message \n" - "PORTID Interface Number: %d\n" - "PORTID Interface ID: %d\n", - npum, npum->port_if_num, -@@ -82,7 +82,7 @@ static void nss_portid_log_verbose(struc - break; - - default: -- nss_trace("%p: Invalid message type\n", npm); -+ nss_trace("%px: Invalid message type\n", npm); - break; - } - } -@@ -94,11 +94,11 @@ static void nss_portid_log_verbose(struc - void nss_portid_log_tx_msg(struct nss_portid_msg *npm) - { - if (npm->cm.type >= NSS_PORTID_MAX_MSG_TYPE) { -- nss_warning("%p: Invalid message type\n", npm); -+ nss_warning("%px: Invalid message type\n", npm); - return; - } - -- nss_info("%p: type[%d]:%s\n", npm, npm->cm.type, nss_portid_log_message_types_str[npm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", npm, npm->cm.type, nss_portid_log_message_types_str[npm->cm.type]); - nss_portid_log_verbose(npm); - } - -@@ -109,18 +109,18 @@ void nss_portid_log_tx_msg(struct nss_po - void nss_portid_log_rx_msg(struct nss_portid_msg *npm) - { - if (npm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", npm); -+ nss_warning("%px: Invalid response\n", npm); - return; - } - - if (npm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (npm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", npm, npm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", npm, npm->cm.type, - nss_portid_log_message_types_str[npm->cm.type], - npm->cm.response, nss_cmn_response_str[npm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - npm, npm->cm.type, nss_portid_log_message_types_str[npm->cm.type], - npm->cm.response, nss_cmn_response_str[npm->cm.response]); - ---- a/nss_portid_stats.c -+++ b/nss_portid_stats.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016-2017, 2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2017, 2019-2020 The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -140,7 +140,7 @@ void nss_portid_stats_sync(struct nss_ct - spin_lock_bh(&nss_portid_spinlock); - hdl = &nss_portid_hdl[npsm->port_id]; - if (hdl->if_num == 0) { -- nss_warning("%p: nss_portid recv'd stats with unconfigured port %d", nss_ctx, npsm->port_id); -+ nss_warning("%px: nss_portid recv'd stats with unconfigured port %d", nss_ctx, npsm->port_id); - spin_unlock_bh(&nss_portid_spinlock); - return; - } ---- a/nss_ppe.c -+++ b/nss_ppe.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -72,12 +72,12 @@ nss_tx_status_t nss_ppe_tx_msg(struct ns - * Sanity check the message - */ - if (ncm->type >= NSS_PPE_MSG_MAX) { -- nss_warning("%p: message type out of range: %d\n", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d\n", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - - if (!nss_ppe_verify_ifnum(ncm->interface)) { -- nss_warning("%p: invalid interface %d\n", nss_ctx, ncm->interface); -+ nss_warning("%px: invalid interface %d\n", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - -@@ -102,14 +102,14 @@ nss_tx_status_t nss_ppe_tx_msg_sync(stru - - status = nss_ppe_tx_msg(nss_ctx, npm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: ppe_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: ppe_tx_msg failed\n", nss_ctx); - up(&ppe_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&ppe_pvt.complete, msecs_to_jiffies(NSS_PPE_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: ppe msg tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: ppe msg tx failed due to timeout\n", nss_ctx); - ppe_pvt.response = NSS_TX_FAILURE; - } - -@@ -244,7 +244,7 @@ static void nss_ppe_handler(struct nss_c - - nss_ppe_msg_callback_t cb; - -- nss_trace("nss_ctx: %p ppe msg: %p\n", nss_ctx, msg); -+ nss_trace("nss_ctx: %px ppe msg: %px\n", nss_ctx, msg); - BUG_ON(!nss_ppe_verify_ifnum(ncm->interface)); - - /* -@@ -256,12 +256,12 @@ static void nss_ppe_handler(struct nss_c - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_PPE_MSG_MAX) { -- nss_warning("%p: received invalid message %d for PPE interface\n", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for PPE interface\n", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_ppe_msg)) { -- nss_warning("%p: Length of message is greater than required: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - ---- a/nss_ppe_log.c -+++ b/nss_ppe_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -57,7 +57,7 @@ static int8_t *nss_ppe_log_error_respons - static void nss_ppe_log_port_config_msg(struct nss_ppe_msg *npm) - { - struct nss_ppe_ipsec_port_config_msg *npcm __maybe_unused = &npm->msg.ipsec_config; -- nss_trace("%p: NSS PPE Port Configure Message:\n" -+ nss_trace("%px: NSS PPE Port Configure Message:\n" - "PPE NSS Interface Number: %d\n" - "PPE MTU: %d\n" - "PPE VSI Number: %d\n", -@@ -72,7 +72,7 @@ static void nss_ppe_log_port_config_msg( - static void nss_ppe_log_port_mtu_msg(struct nss_ppe_msg *npm) - { - struct nss_ppe_ipsec_port_mtu_msg *npmm __maybe_unused = &npm->msg.ipsec_mtu; -- nss_trace("%p: NSS PPE Port Configure Message:\n" -+ nss_trace("%px: NSS PPE Port Configure Message:\n" - "PPE NSS Interface Number: %d\n" - "PPE MTU: %d\n", - npmm, npmm->nss_ifnum, -@@ -86,7 +86,7 @@ static void nss_ppe_log_port_mtu_msg(str - static void nss_ppe_log_add_intf_msg(struct nss_ppe_msg *npm) - { - struct nss_ppe_ipsec_add_intf_msg *npam __maybe_unused = &npm->msg.ipsec_addif; -- nss_trace("%p: NSS PPE IPSEC add Interface Message:\n" -+ nss_trace("%px: NSS PPE IPSEC add Interface Message:\n" - "PPE NSS Interface Number: %d\n", - npam, npam->nss_ifnum); - } -@@ -98,7 +98,7 @@ static void nss_ppe_log_add_intf_msg(str - static void nss_ppe_log_del_intf_msg(struct nss_ppe_msg *npm) - { - struct nss_ppe_ipsec_del_intf_msg *npdm __maybe_unused = &npm->msg.ipsec_delif; -- nss_trace("%p: NSS PPE IPSEC Delete Interface Message:\n" -+ nss_trace("%px: NSS PPE IPSEC Delete Interface Message:\n" - "PPE NSS Interface Number: %d\n", - npdm, npdm->nss_ifnum); - } -@@ -133,7 +133,7 @@ static void nss_ppe_log_verbose(struct n - break; - - default: -- nss_warning("%p: Invalid message type\n", npm); -+ nss_warning("%px: Invalid message type\n", npm); - break; - } - } -@@ -145,11 +145,11 @@ static void nss_ppe_log_verbose(struct n - void nss_ppe_log_tx_msg(struct nss_ppe_msg *npm) - { - if (npm->cm.type >= NSS_PPE_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", npm); -+ nss_warning("%px: Invalid message type\n", npm); - return; - } - -- nss_info("%p: type[%d]:%s\n", npm, npm->cm.type, nss_ppe_log_message_types_str[npm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", npm, npm->cm.type, nss_ppe_log_message_types_str[npm->cm.type]); - nss_ppe_log_verbose(npm); - } - -@@ -160,26 +160,26 @@ void nss_ppe_log_tx_msg(struct nss_ppe_m - void nss_ppe_log_rx_msg(struct nss_ppe_msg *npm) - { - if (npm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", npm); -+ nss_warning("%px: Invalid response\n", npm); - return; - } - - if (npm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (npm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", npm, npm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", npm, npm->cm.type, - nss_ppe_log_message_types_str[npm->cm.type], - npm->cm.response, nss_cmn_response_str[npm->cm.response]); - goto verbose; - } - - if (npm->cm.error >= PPE_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - npm, npm->cm.type, nss_ppe_log_message_types_str[npm->cm.type], - npm->cm.response, nss_cmn_response_str[npm->cm.response], - npm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - npm, npm->cm.type, nss_ppe_log_message_types_str[npm->cm.type], - npm->cm.response, nss_cmn_response_str[npm->cm.response], - npm->cm.error, nss_ppe_log_error_response_types_str[npm->cm.error]); ---- a/nss_ppe_vp.c -+++ b/nss_ppe_vp.c -@@ -90,12 +90,12 @@ nss_tx_status_t nss_ppe_vp_tx_msg(struct - * Sanity check the message - */ - if (ncm->type >= NSS_PPE_VP_MSG_MAX) { -- nss_warning("%p: message type out of range: %d\n", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d\n", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - - if (!nss_ppe_vp_verify_ifnum(ncm->interface)) { -- nss_warning("%p: invalid interface %d\n", nss_ctx, ncm->interface); -+ nss_warning("%px: invalid interface %d\n", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - -@@ -117,14 +117,14 @@ nss_tx_status_t nss_ppe_vp_tx_msg_sync(s - - status = nss_ppe_vp_tx_msg(nss_ctx, npvm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: ppe_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: ppe_tx_msg failed\n", nss_ctx); - up(&ppe_vp_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&ppe_vp_pvt.complete, msecs_to_jiffies(NSS_PPE_VP_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: ppe_vp msg tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: ppe_vp msg tx failed due to timeout\n", nss_ctx); - ppe_vp_pvt.response = NSS_TX_FAILURE; - } - -@@ -145,13 +145,13 @@ nss_tx_status_t nss_ppe_vp_tx_config_msg - nss_tx_status_t status; - - if (type >= NSS_DYNAMIC_INTERFACE_TYPE_MAX) { -- nss_warning("%p: Dynamic if msg drooped as type is wrong:%d\n", nss_ctx, type); -+ nss_warning("%px: Dynamic if msg drooped as type is wrong:%d\n", nss_ctx, type); - return -1; - } - - npvm = kzalloc(sizeof(struct nss_ppe_vp_msg), GFP_KERNEL); - if (!npvm) { -- nss_warning("%p: Unable to allocate message\n", nss_ctx); -+ nss_warning("%px: Unable to allocate message\n", nss_ctx); - return -1; - } - -@@ -164,7 +164,7 @@ nss_tx_status_t nss_ppe_vp_tx_config_msg - - status = nss_ppe_vp_tx_msg_sync(nss_ctx, npvm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to send ppe_vp config message for type:%d\n", nss_ctx, type); -+ nss_warning("%px: Unable to send ppe_vp config message for type:%d\n", nss_ctx, type); - } - - kfree(npvm); -@@ -181,7 +181,7 @@ static void nss_ppe_vp_handler(struct ns - nss_ppe_vp_msg_callback_t cb; - void *ctx; - -- nss_trace("nss_ctx: %p ppe_vp msg: %p\n", nss_ctx, msg); -+ nss_trace("nss_ctx: %px ppe_vp msg: %px\n", nss_ctx, msg); - BUG_ON(!nss_ppe_vp_verify_ifnum(ncm->interface)); - - /* -@@ -193,12 +193,12 @@ static void nss_ppe_vp_handler(struct ns - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_PPE_VP_MSG_MAX) { -- nss_warning("%p: received invalid message %d for PPE_VP interface\n", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for PPE_VP interface\n", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_ppe_vp_msg)) { -- nss_warning("%p: Length of message is greater than required: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -389,7 +389,7 @@ void nss_ppe_vp_register_handler(void) - - nss_ppe_vp_dentry = nss_ppe_vp_stats_dentry_create(); - if (nss_ppe_vp_dentry == NULL) { -- nss_warning("%p: Not able to create debugfs entry\n", nss_ctx); -+ nss_warning("%px: Not able to create debugfs entry\n", nss_ctx); - return; - } - ---- a/nss_ppe_vp_log.c -+++ b/nss_ppe_vp_log.c -@@ -49,7 +49,7 @@ static int8_t *nss_ppe_vp_log_error_resp - static void nss_ppe_vp_log_config_msg(struct nss_ppe_vp_msg *npvm) - { - struct nss_ppe_vp_config_msg *npcm __maybe_unused = &npvm->msg.vp_config; -- nss_trace("%p: NSS PPE VP configuration message:\n" -+ nss_trace("%px: NSS PPE VP configuration message:\n" - "Dynamic interface type: %d is_vp_support_enable: %d\n", - npcm, npcm->type, npcm->vp_enable); - } -@@ -72,7 +72,7 @@ static void nss_ppe_vp_log_verbose(struc - break; - - default: -- nss_warning("%p: Invalid message type\n", npvm); -+ nss_warning("%px: Invalid message type\n", npvm); - break; - } - } -@@ -84,11 +84,11 @@ static void nss_ppe_vp_log_verbose(struc - void nss_ppe_vp_log_tx_msg(struct nss_ppe_vp_msg *npvm) - { - if (npvm->cm.type >= NSS_PPE_VP_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", npvm); -+ nss_warning("%px: Invalid message type\n", npvm); - return; - } - -- nss_info("%p: type[%d]:%s\n", npvm, npvm->cm.type, nss_ppe_vp_log_message_types_str[npvm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", npvm, npvm->cm.type, nss_ppe_vp_log_message_types_str[npvm->cm.type]); - nss_ppe_vp_log_verbose(npvm); - } - -@@ -99,26 +99,26 @@ void nss_ppe_vp_log_tx_msg(struct nss_pp - void nss_ppe_vp_log_rx_msg(struct nss_ppe_vp_msg *npvm) - { - if (npvm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", npvm); -+ nss_warning("%px: Invalid response\n", npvm); - return; - } - - if (npvm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (npvm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", npvm, npvm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", npvm, npvm->cm.type, - nss_ppe_vp_log_message_types_str[npvm->cm.type], - npvm->cm.response, nss_cmn_response_str[npvm->cm.response]); - goto verbose; - } - - if (npvm->cm.error >= NSS_PPE_VP_MSG_ERROR_TYPE_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - npvm, npvm->cm.type, nss_ppe_vp_log_message_types_str[npvm->cm.type], - npvm->cm.response, nss_cmn_response_str[npvm->cm.response], - npvm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - npvm, npvm->cm.type, nss_ppe_vp_log_message_types_str[npvm->cm.type], - npvm->cm.response, nss_cmn_response_str[npvm->cm.response], - npvm->cm.error, nss_ppe_vp_log_error_response_types_str[npvm->cm.error]); ---- a/nss_pppoe.c -+++ b/nss_pppoe.c -@@ -80,13 +80,13 @@ static nss_tx_status_t nss_pppoe_tx_msg( - */ - type = nss_dynamic_interface_get_type(nss_pppoe_get_context(), ncm->interface); - if ((ncm->interface != NSS_PPPOE_INTERFACE) && (type != NSS_DYNAMIC_INTERFACE_TYPE_PPPOE)) { -- nss_warning("%p: tx request for not PPPoE interface: %d type: %d\n", -+ nss_warning("%px: tx request for not PPPoE interface: %d type: %d\n", - nss_ctx, ncm->interface, type); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_PPPOE_MSG_MAX) { -- nss_warning("%p: message type out of range: %d\n", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d\n", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -139,12 +139,12 @@ static void nss_pppoe_handler(struct nss - * Sanity check the message type - */ - if (ncm->type >= NSS_PPPOE_MSG_MAX) { -- nss_warning("%p: message type out of range: %d\n", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d\n", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_pppoe_msg)) { -- nss_warning("%p: message length is invalid: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: message length is invalid: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -165,7 +165,7 @@ static void nss_pppoe_handler(struct nss - nss_pppoe_stats_notify(nss_ctx, ncm->interface); - break; - default: -- nss_warning("%p: Received response %d for type %d, interface %d\n", -+ nss_warning("%px: Received response %d for type %d, interface %d\n", - nss_ctx, ncm->response, ncm->type, ncm->interface); - } - -@@ -227,7 +227,7 @@ int nss_pppoe_br_accel_mode_handler(stru - - new_val = nss_pppoe_br_accel_mode; - if ((new_val < NSS_PPPOE_BR_ACCEL_MODE_DIS) || (new_val >= NSS_PPPOE_BR_ACCEL_MODE_MAX)) { -- nss_warning("%p: value out of range: %d\n", nss_ctx, new_val); -+ nss_warning("%px: value out of range: %d\n", nss_ctx, new_val); - nss_pppoe_br_accel_mode = current_value; - nss_pppoe_br_help(new_val); - return -EINVAL; -@@ -242,7 +242,7 @@ int nss_pppoe_br_accel_mode_handler(stru - - status = nss_pppoe_tx_msg_sync(nss_ctx, &npm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Send acceleration mode message failed\n", nss_ctx); -+ nss_warning("%px: Send acceleration mode message failed\n", nss_ctx); - nss_pppoe_br_accel_mode = current_value; - return -EIO; - } -@@ -278,14 +278,14 @@ nss_tx_status_t nss_pppoe_tx_msg_sync(st - - status = nss_pppoe_tx_msg(nss_ctx, msg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_pppoe_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: nss_pppoe_tx_msg failed\n", nss_ctx); - up(&pppoe_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&pppoe_pvt.complete, msecs_to_jiffies(NSS_PPPOE_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: PPPoE msg tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: PPPoE msg tx failed due to timeout\n", nss_ctx); - pppoe_pvt.response = NSS_TX_FAILURE; - } - ---- a/nss_pppoe_log.c -+++ b/nss_pppoe_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -38,7 +38,7 @@ static int8_t *nss_pppoe_log_message_typ - static void nss_pppoe_log_session_create_msg(struct nss_pppoe_msg *npm) - { - struct nss_pppoe_create_msg *npcm __maybe_unused = &npm->msg.create; -- nss_trace("%p: NSS PPPOE Session Create message \n" -+ nss_trace("%px: NSS PPPOE Session Create message \n" - "PPPOE Base Interface Number: %d\n" - "PPPOE MTU: %d\n" - "PPPOE Server MAC: %pM\n" -@@ -56,7 +56,7 @@ static void nss_pppoe_log_session_create - static void nss_pppoe_log_session_destroy_msg(struct nss_pppoe_msg *npm) - { - struct nss_pppoe_destroy_msg *npdm __maybe_unused = &npm->msg.destroy; -- nss_trace("%p: NSS PPPOE Session Destroy message \n" -+ nss_trace("%px: NSS PPPOE Session Destroy message \n" - "PPPOE Session ID: %d\n" - "PPPOE Server MAC: %pM\n" - "PPPOE Local MAC: %pM\n", -@@ -86,7 +86,7 @@ static void nss_pppoe_log_verbose(struct - break; - - default: -- nss_trace("%p: Invalid message type\n", npm); -+ nss_trace("%px: Invalid message type\n", npm); - break; - } - } -@@ -98,11 +98,11 @@ static void nss_pppoe_log_verbose(struct - void nss_pppoe_log_tx_msg(struct nss_pppoe_msg *npm) - { - if (npm->cm.type >= NSS_PPPOE_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", npm); -+ nss_warning("%px: Invalid message type\n", npm); - return; - } - -- nss_info("%p: type[%d]:%s\n", npm, npm->cm.type, nss_pppoe_log_message_types_str[npm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", npm, npm->cm.type, nss_pppoe_log_message_types_str[npm->cm.type]); - nss_pppoe_log_verbose(npm); - } - -@@ -113,18 +113,18 @@ void nss_pppoe_log_tx_msg(struct nss_ppp - void nss_pppoe_log_rx_msg(struct nss_pppoe_msg *npm) - { - if (npm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", npm); -+ nss_warning("%px: Invalid response\n", npm); - return; - } - - if (npm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (npm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", npm, npm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", npm, npm->cm.type, - nss_pppoe_log_message_types_str[npm->cm.type], - npm->cm.response, nss_cmn_response_str[npm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - npm, npm->cm.type, nss_pppoe_log_message_types_str[npm->cm.type], - npm->cm.response, nss_cmn_response_str[npm->cm.response]); - ---- a/nss_pptp.c -+++ b/nss_pptp.c -@@ -184,12 +184,12 @@ static void nss_pptp_handler(struct nss_ - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_PPTP_MSG_MAX) { -- nss_warning("%p: received invalid message %d for PPTP interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for PPTP interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_pptp_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -235,7 +235,7 @@ static void nss_pptp_handler(struct nss_ - * call pptp tunnel callback - */ - if (!cb) { -- nss_warning("%p: Event received for pptp tunnel interface %d before registration", nss_ctx, ncm->interface); -+ nss_warning("%px: Event received for pptp tunnel interface %d before registration", nss_ctx, ncm->interface); - return; - } - -@@ -259,12 +259,12 @@ static nss_tx_status_t nss_pptp_tx_msg(s - * Sanity check the message - */ - if (!nss_is_dynamic_interface(ncm->interface)) { -- nss_warning("%p: tx request for non dynamic interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for non dynamic interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_PPTP_MSG_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -322,7 +322,7 @@ nss_tx_status_t nss_pptp_tx_msg_sync(str - - status = nss_pptp_tx_msg(nss_ctx, msg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: pptp_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: pptp_tx_msg failed\n", nss_ctx); - up(&pptp_pvt.sem); - return status; - } -@@ -330,7 +330,7 @@ nss_tx_status_t nss_pptp_tx_msg_sync(str - ret = wait_for_completion_timeout(&pptp_pvt.complete, msecs_to_jiffies(NSS_PPTP_TX_TIMEOUT)); - - if (!ret) { -- nss_warning("%p: PPTP msg tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: PPTP msg tx failed due to timeout\n", nss_ctx); - pptp_pvt.response = NSS_TX_FAILURE; - } - -@@ -345,7 +345,7 @@ nss_tx_status_t nss_pptp_tx_msg_sync(str - */ - nss_tx_status_t nss_pptp_tx_buf(struct nss_ctx_instance *nss_ctx, uint32_t if_num, struct sk_buff *skb) - { -- nss_trace("%p: pptp If Tx packet, id:%d, data=%p", nss_ctx, if_num, skb->data); -+ nss_trace("%px: pptp If Tx packet, id:%d, data=%px", nss_ctx, if_num, skb->data); - - return nss_core_send_packet(nss_ctx, skb, if_num, H2N_BIT_FLAG_BUFFER_REUSABLE); - } ---- a/nss_pptp_log.c -+++ b/nss_pptp_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -38,7 +38,7 @@ static int8_t *nss_pptp_log_message_type - static void nss_pptp_log_configure_msg(struct nss_pptp_msg *npm) - { - struct nss_pptp_session_configure_msg *npcm __maybe_unused = &npm->msg.session_configure_msg; -- nss_trace("%p: NSS PPTP Session Configure message\n" -+ nss_trace("%px: NSS PPTP Session Configure message\n" - "PPTP Source Call ID: %x\n" - "PPTP Destination Call ID: %x\n" - "PPTP Source IP: %pI4\n" -@@ -55,7 +55,7 @@ static void nss_pptp_log_configure_msg(s - static void nss_pptp_log_deconfigure_msg(struct nss_pptp_msg *npm) - { - struct nss_pptp_session_deconfigure_msg *npdm __maybe_unused = &npm->msg.session_deconfigure_msg; -- nss_trace("%p: NSS PPTP Session Configure message \n" -+ nss_trace("%px: NSS PPTP Session Configure message \n" - "PPTP Source Call ID: %x\n", - npdm, npdm->src_call_id); - } -@@ -82,7 +82,7 @@ static void nss_pptp_log_verbose(struct - break; - - default: -- nss_trace("%p: Invalid message type\n", npm); -+ nss_trace("%px: Invalid message type\n", npm); - break; - } - } -@@ -94,11 +94,11 @@ static void nss_pptp_log_verbose(struct - void nss_pptp_log_tx_msg(struct nss_pptp_msg *npm) - { - if (npm->cm.type >= NSS_PPTP_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", npm); -+ nss_warning("%px: Invalid message type\n", npm); - return; - } - -- nss_info("%p: type[%d]:%s\n", npm, npm->cm.type, nss_pptp_log_message_types_str[npm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", npm, npm->cm.type, nss_pptp_log_message_types_str[npm->cm.type]); - nss_pptp_log_verbose(npm); - } - -@@ -109,18 +109,18 @@ void nss_pptp_log_tx_msg(struct nss_pptp - void nss_pptp_log_rx_msg(struct nss_pptp_msg *npm) - { - if (npm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", npm); -+ nss_warning("%px: Invalid response\n", npm); - return; - } - - if (npm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (npm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", npm, npm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", npm, npm->cm.type, - nss_pptp_log_message_types_str[npm->cm.type], - npm->cm.response, nss_cmn_response_str[npm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - npm, npm->cm.type, nss_pptp_log_message_types_str[npm->cm.type], - npm->cm.response, nss_cmn_response_str[npm->cm.response]); - ---- a/nss_profiler.c -+++ b/nss_profiler.c -@@ -32,23 +32,23 @@ static void nss_profiler_rx_msg_handler( - nss_profiler_callback_t cb = nss_ctx->nss_top->profiler_callback[nss_ctx->id]; - - if (ncm->type >= NSS_PROFILER_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return; - } - - if (ncm->type <= NSS_PROFILER_FLOWCTRL_MSG) { - if (ncm->len > sizeof(pm->payload.pcmdp)) { -- nss_warning("%p: reply for cmd %d size is wrong %d : %d\n", nss_ctx, ncm->type, ncm->len, ncm->interface); -+ nss_warning("%px: reply for cmd %d size is wrong %d : %d\n", nss_ctx, ncm->type, ncm->len, ncm->interface); - return; - } - } else if (ncm->type <= NSS_PROFILER_DEBUG_REPLY_MSG) { - if (ncm->len > sizeof(pm->payload.pdm)) { -- nss_warning("%p: reply for debug %d is too big %d\n", nss_ctx, ncm->type, ncm->len); -+ nss_warning("%px: reply for debug %d is too big %d\n", nss_ctx, ncm->type, ncm->len); - return; - } - } else if (ncm->type <= NSS_PROFILER_COUNTERS_MSG) { - if (ncm->len < (sizeof(pm->payload.pcmdp) - (PROFILE_MAX_APP_COUNTERS - pm->payload.pcmdp.num_counters) * sizeof(pm->payload.pcmdp.counters[0])) || ncm->len > sizeof(pm->payload.pcmdp)) { -- nss_warning("%p: %d params data is too big %d : %d\n", nss_ctx, ncm->type, ncm->len, ncm->interface); -+ nss_warning("%px: %d params data is too big %d : %d\n", nss_ctx, ncm->type, ncm->len, ncm->interface); - return; - } - } -@@ -57,7 +57,7 @@ static void nss_profiler_rx_msg_handler( - * status per request callback - */ - if (ncm->response != NSS_CMN_RESPONSE_NOTIFY && ncm->cb) { -- nss_info("%p: reply CB %p for %d %d\n", nss_ctx, (void *)ncm->cb, ncm->type, ncm->response); -+ nss_info("%px: reply CB %px for %d %d\n", nss_ctx, (void *)ncm->cb, ncm->type, ncm->response); - cb = (nss_profiler_callback_t)ncm->cb; - } - -@@ -65,7 +65,7 @@ static void nss_profiler_rx_msg_handler( - * sample related callback - */ - if (!cb || !ctx) { -- nss_warning("%p: Event received for profiler interface before registration", nss_ctx); -+ nss_warning("%px: Event received for profiler interface before registration", nss_ctx); - return; - } - -@@ -84,22 +84,22 @@ nss_tx_status_t nss_profiler_if_tx_buf(v - struct nss_profiler_data_msg *pdm = (struct nss_profiler_data_msg *)buf; - nss_tx_status_t ret; - -- nss_trace("%p: Profiler If Tx, buf=%p", nss_ctx, buf); -+ nss_trace("%px: Profiler If Tx, buf=%px", nss_ctx, buf); - - if (sizeof(npm->payload) < len) { -- nss_warning("%p: (%u)Bad message length(%u)", nss_ctx, NSS_PROFILER_INTERFACE, len); -+ nss_warning("%px: (%u)Bad message length(%u)", nss_ctx, NSS_PROFILER_INTERFACE, len); - return NSS_TX_FAILURE_TOO_LARGE; - } - - if (NSS_NBUF_PAYLOAD_SIZE < (len + sizeof(npm->cm))) { -- nss_warning("%p: (%u)Message length(%u) is larger than payload size (%u)", -+ nss_warning("%px: (%u)Message length(%u) is larger than payload size (%u)", - nss_ctx, NSS_PROFILER_INTERFACE, (uint32_t)(len + sizeof(npm->cm)), NSS_NBUF_PAYLOAD_SIZE); - return NSS_TX_FAILURE_TOO_LARGE; - } - - npm = kzalloc(sizeof(*npm), GFP_KERNEL); - if (!npm) { -- nss_warning("%p: Failed to allocate memory for message\n", nss_ctx); -+ nss_warning("%px: Failed to allocate memory for message\n", nss_ctx); - return NSS_TX_FAILURE; - } - -@@ -166,7 +166,7 @@ bool nss_profile_dma_register_cb(struct - void (*cb)(void*), void *arg) - { - struct nss_profile_sdma_ctrl *ctrl = (struct nss_profile_sdma_ctrl *)nss_ctx->meminfo_ctx.sdma_ctrl; -- nss_info("%p dma_register_cb %d: %p %p\n", ctrl, id, cb, arg); -+ nss_info("%px dma_register_cb %d: %px %px\n", ctrl, id, cb, arg); - if (!ctrl) - return false; - ---- a/nss_project.c -+++ b/nss_project.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2017-2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -81,7 +81,7 @@ static void nss_project_wt_stats_enable_ - return; - } - -- nss_info("%p: Received response ACK for worker thread stats enable msg.\n", nss_ctx); -+ nss_info("%px: Received response ACK for worker thread stats enable msg.\n", nss_ctx); - - /* - * If statistics have already been allocated, nothing else to do. -@@ -93,7 +93,7 @@ static void nss_project_wt_stats_enable_ - stats_temp = nss_project_alloc_wt_stats(stats_enable->worker_thread_count, - stats_enable->irq_count); - if (unlikely(!stats_temp)) { -- nss_warning("%p: Unable to allocate worker thread statistics.\n", nss_ctx); -+ nss_warning("%px: Unable to allocate worker thread statistics.\n", nss_ctx); - return; - } - -@@ -116,7 +116,7 @@ static nss_tx_status_t nss_project_wt_st - - npm = kzalloc(sizeof(*npm), GFP_KERNEL); - if (!npm) { -- nss_warning("%p: Failed to allocate buffer for message\n", nss_ctx); -+ nss_warning("%px: Failed to allocate buffer for message\n", nss_ctx); - return NSS_TX_FAILURE; - } - -@@ -147,17 +147,17 @@ static void nss_project_wt_stats_update( - int i; - - if (unlikely(!nss_ctx->wt_stats)) { -- nss_warning("%p: Worker thread statistics not yet allocated.\n", nss_ctx); -+ nss_warning("%px: Worker thread statistics not yet allocated.\n", nss_ctx); - return; - } - - if (unlikely(stats_notify->threadno >= nss_ctx->worker_thread_count)) { -- nss_warning("%p: Invalid WT number %d\n", nss_ctx, stats_notify->threadno); -+ nss_warning("%px: Invalid WT number %d\n", nss_ctx, stats_notify->threadno); - return; - } - - if (unlikely(stats_notify->stats_written > NSS_PROJECT_IRQS_PER_MESSAGE)) { -- nss_warning("%p: Invalid worker thread stats written count %d\n", -+ nss_warning("%px: Invalid worker thread stats written count %d\n", - nss_ctx, stats_notify->stats_written); - return; - } -@@ -165,7 +165,7 @@ static void nss_project_wt_stats_update( - wt_stats = &(nss_ctx->wt_stats[stats_notify->threadno]); - - if (unlikely(!wt_stats->irq_stats)) { -- nss_warning("%p: Worker thread statistics not allocated for thread %d\n", -+ nss_warning("%px: Worker thread statistics not allocated for thread %d\n", - nss_ctx, stats_notify->threadno); - return; - } -@@ -174,7 +174,7 @@ static void nss_project_wt_stats_update( - for (i = 0; i < stats_notify->stats_written; ++i) { - int irq = stats_notify->stats[i].irq; - if (unlikely(irq >= nss_ctx->irq_count)) { -- nss_warning("%p: Invalid IRQ number %d\n", nss_ctx, irq); -+ nss_warning("%px: Invalid IRQ number %d\n", nss_ctx, irq); - continue; - } - -@@ -197,12 +197,12 @@ static void nss_project_msg_handler(stru - * Sanity checks on message - */ - if (npm->cm.type >= NSS_PROJECT_MSG_MAX) { -- nss_warning("%p: message type out of range: %d\n", nss_ctx, npm->cm.type); -+ nss_warning("%px: message type out of range: %d\n", nss_ctx, npm->cm.type); - return; - } - - if (nss_cmn_get_msg_len(&(npm->cm)) > sizeof(struct nss_project_msg)) { -- nss_warning("%p: message length is invalid: %d\n", nss_ctx, nss_cmn_get_msg_len(&(npm->cm))); -+ nss_warning("%px: message length is invalid: %d\n", nss_ctx, nss_cmn_get_msg_len(&(npm->cm))); - return; - } - ---- a/nss_pvxlan.c -+++ b/nss_pvxlan.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -84,13 +84,13 @@ static bool nss_pvxlan_hdl_instance_free - h = nss_pvxlan_hdl[if_num - NSS_DYNAMIC_IF_START]; - if (!h) { - spin_unlock(&nss_pvxlan_spinlock); -- nss_warning("%p: Instance does not exist: %d", nss_ctx, if_num); -+ nss_warning("%px: Instance does not exist: %d", nss_ctx, if_num); - return false; - } - - if (h->if_num != if_num) { - spin_unlock(&nss_pvxlan_spinlock); -- nss_warning("%p: Not correct if_num: %d", nss_ctx, if_num); -+ nss_warning("%px: Not correct if_num: %d", nss_ctx, if_num); - return false; - } - -@@ -114,7 +114,7 @@ static bool nss_pvxlan_hdl_instance_allo - */ - h = kzalloc(sizeof(struct nss_pvxlan_handle), GFP_ATOMIC); - if (!h) { -- nss_warning("%p: no memory for allocating PVxLAN handle instance for interface : %d", nss_ctx, if_num); -+ nss_warning("%px: no memory for allocating PVxLAN handle instance for interface : %d", nss_ctx, if_num); - return false; - } - h->if_num = if_num; -@@ -123,7 +123,7 @@ static bool nss_pvxlan_hdl_instance_allo - if (nss_pvxlan_hdl[if_num - NSS_DYNAMIC_IF_START] != NULL) { - spin_unlock(&nss_pvxlan_spinlock); - kfree(h); -- nss_warning("%p: The handle has been taken by another thread :%d", nss_ctx, if_num); -+ nss_warning("%px: The handle has been taken by another thread :%d", nss_ctx, if_num); - return false; - } - -@@ -175,12 +175,12 @@ static void nss_pvxlan_msg_handler(struc - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_PVXLAN_MSG_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for PVXLAN interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for PVXLAN interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_pvxlan_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -196,7 +196,6 @@ static void nss_pvxlan_msg_handler(struc - break; - } - -- - /* - * Update the callback and app_data for NOTIFY messages. - */ -@@ -218,7 +217,7 @@ static void nss_pvxlan_msg_handler(struc - * Do we have a callback - */ - if (!cb) { -- nss_trace("%p: cb is null for interface %d", nss_ctx, ncm->interface); -+ nss_trace("%px: cb is null for interface %d", nss_ctx, ncm->interface); - return; - } - -@@ -265,14 +264,14 @@ nss_tx_status_t nss_pvxlan_tx_msg_sync(s - - status = nss_pvxlan_tx_msg(nss_ctx, nvxm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: pvxlan_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: pvxlan_tx_msg failed\n", nss_ctx); - up(&pvxlan_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&pvxlan_pvt.complete, msecs_to_jiffies(NSS_PVXLAN_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: pvxlan tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: pvxlan tx sync failed due to timeout\n", nss_ctx); - pvxlan_pvt.response = NSS_TX_FAILURE; - } - -@@ -311,7 +310,7 @@ bool nss_pvxlan_unregister(uint32_t if_n - - nss_ctx = nss_pvxlan_get_ctx(); - if (!nss_pvxlan_verify_if_num(if_num)) { -- nss_warning("%p: data unregister received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: data unregister received for invalid interface %d", nss_ctx, if_num); - return false; - } - -@@ -350,19 +349,19 @@ struct nss_ctx_instance *nss_pvxlan_regi - - nss_ctx = nss_pvxlan_get_ctx(); - if (!nss_pvxlan_verify_if_num(if_num)) { -- nss_warning("%p: data register received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: data register received for invalid interface %d", nss_ctx, if_num); - return NULL; - } - - core_status = nss_core_register_handler(nss_ctx, if_num, nss_pvxlan_msg_handler, NULL); - if (core_status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: nss core register handler failed for if_num:%d with error :%d", nss_ctx, if_num, core_status); -+ nss_warning("%px: nss core register handler failed for if_num:%d with error :%d", nss_ctx, if_num, core_status); - return NULL; - } - - if (!nss_pvxlan_hdl_instance_alloc(nss_ctx, if_num, notify_cb, (void *)netdev)) { - nss_core_unregister_handler(nss_ctx, if_num); -- nss_warning("%p: couldn't allocate handle instance for if_num:%d", nss_ctx, if_num); -+ nss_warning("%px: couldn't allocate handle instance for if_num:%d", nss_ctx, if_num); - return NULL; - } - -@@ -380,7 +379,7 @@ struct nss_ctx_instance *nss_pvxlan_regi - spin_unlock_bh(&nss_pvxlan_tunnel_stats_debug_lock); - - if (i == NSS_PVXLAN_MAX_INTERFACES) { -- nss_warning("%p: No available debug stats instance :%d", nss_ctx, if_num); -+ nss_warning("%px: No available debug stats instance :%d", nss_ctx, if_num); - nss_pvxlan_hdl_instance_free(nss_ctx, if_num); - nss_core_unregister_handler(nss_ctx, if_num); - return NULL; -@@ -402,7 +401,7 @@ int nss_pvxlan_ifnum_with_core_id(int if - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (!nss_is_dynamic_interface(if_num)) { -- nss_warning("%p: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); -+ nss_warning("%px: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); - return 0; - } - return NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num); ---- a/nss_pvxlan_log.c -+++ b/nss_pvxlan_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -58,10 +58,10 @@ static int8_t *nss_pvxlan_log_error_resp - */ - static void nss_pvxlan_log_rule_msg(struct nss_pvxlan_rule_msg *npvrm) - { -- nss_trace("%p: NSS PVXLAN Rule message \n" -- "Encap Rule Src IP: %p\n" -+ nss_trace("%px: NSS PVXLAN Rule message \n" -+ "Encap Rule Src IP: %px\n" - "Encap Rule Src Port: %d\n" -- "Encap Rule Dst Ip: %p\n" -+ "Encap Rule Dst Ip: %px\n" - "Encap Rule Dst Port: %d\n" - "RPS: %d\n" - "Flags: %x\n" -@@ -81,7 +81,7 @@ static void nss_pvxlan_log_rule_msg(stru - */ - static void nss_pvxlan_log_mac_msg(struct nss_pvxlan_mac_msg *npvcm) - { -- nss_trace("%p: NSS PVXLAN MAC message \n" -+ nss_trace("%px: NSS PVXLAN MAC message \n" - "PVxLAN Mac Addr: %x : %x : %x" - "PVxLAN Flags: %u\n" - "PVxLAN VNet ID: %u\n" -@@ -121,7 +121,7 @@ static void nss_pvxlan_log_rule_uncfg_ms - static void nss_pvxlan_log_enable_msg(struct nss_pvxlan_msg *npvm) - { - struct nss_pvxlan_tunnel_state_msg *npvrm __maybe_unused = &npvm->msg.enable; -- nss_trace("%p: NSS PVXLAN Tunnel state message: Enable \n", npvrm); -+ nss_trace("%px: NSS PVXLAN Tunnel state message: Enable \n", npvrm); - } - - /* -@@ -130,7 +130,7 @@ static void nss_pvxlan_log_enable_msg(st - */ - static void nss_pvxlan_log_disable_msg(struct nss_pvxlan_msg *npvm) - { -- nss_trace("%p: NSS PVXLAN Tunnel state message: Disable \n", npvm); -+ nss_trace("%px: NSS PVXLAN Tunnel state message: Disable \n", npvm); - } - - /* -@@ -188,7 +188,7 @@ static void nss_pvxlan_log_verbose(struc - break; - - default: -- nss_trace("%p: Invalid message type\n", npvm); -+ nss_trace("%px: Invalid message type\n", npvm); - break; - } - } -@@ -200,11 +200,11 @@ static void nss_pvxlan_log_verbose(struc - void nss_pvxlan_log_tx_msg(struct nss_pvxlan_msg *npvm) - { - if (npvm->cm.type >= NSS_PVXLAN_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", npvm); -+ nss_warning("%px: Invalid message type\n", npvm); - return; - } - -- nss_info("%p: type[%d]:%s\n", npvm, npvm->cm.type, nss_pvxlan_log_message_types_str[npvm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", npvm, npvm->cm.type, nss_pvxlan_log_message_types_str[npvm->cm.type]); - nss_pvxlan_log_verbose(npvm); - } - -@@ -215,26 +215,26 @@ void nss_pvxlan_log_tx_msg(struct nss_pv - void nss_pvxlan_log_rx_msg(struct nss_pvxlan_msg *npvm) - { - if (npvm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", npvm); -+ nss_warning("%px: Invalid response\n", npvm); - return; - } - - if (npvm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (npvm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", npvm, npvm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", npvm, npvm->cm.type, - nss_pvxlan_log_message_types_str[npvm->cm.type], - npvm->cm.response, nss_cmn_response_str[npvm->cm.response]); - goto verbose; - } - - if (npvm->cm.error >= NSS_PVXLAN_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - npvm, npvm->cm.type, nss_pvxlan_log_message_types_str[npvm->cm.type], - npvm->cm.response, nss_cmn_response_str[npvm->cm.response], - npvm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - npvm, npvm->cm.type, nss_pvxlan_log_message_types_str[npvm->cm.type], - npvm->cm.response, nss_cmn_response_str[npvm->cm.response], - npvm->cm.error, nss_pvxlan_log_error_response_types_str[npvm->cm.error]); ---- a/nss_pvxlan_stats.c -+++ b/nss_pvxlan_stats.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -166,7 +166,7 @@ void nss_pvxlan_stats_sync(struct nss_ct - - if (!s) { - spin_unlock_bh(&nss_pvxlan_tunnel_stats_debug_lock); -- nss_warning("%p: Tunnel not found: %u", nss_ctx, if_num); -+ nss_warning("%px: Tunnel not found: %u", nss_ctx, if_num); - return; - } - ---- a/nss_qrfs.c -+++ b/nss_qrfs.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -52,7 +52,7 @@ static void nss_qrfs_msg_handler(struct - nss_qrfs_log_rx_msg(nqm); - - if (!nss_qrfs_verify_if_num(ncm->interface)) { -- nss_warning("%p: invalid interface %d for QRFS\n", nss_ctx, ncm->interface); -+ nss_warning("%px: invalid interface %d for QRFS\n", nss_ctx, ncm->interface); - return; - } - -@@ -60,12 +60,12 @@ static void nss_qrfs_msg_handler(struct - * Is this a valid request/response? - */ - if (ncm->type >= NSS_QRFS_MSG_MAX) { -- nss_warning("%p: invalid message %d for QRFS\n", nss_ctx, ncm->type); -+ nss_warning("%px: invalid message %d for QRFS\n", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_qrfs_msg)) { -- nss_warning("%p: message length is greater than required: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: message length is greater than required: %d\n", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -128,7 +128,7 @@ static bool nss_qrfs_get_flow_keys(struc - - res = skb_flow_dissect(skb, &keys); - if (!res) { -- nss_warning("%p: failed to get flow keys\n", nss_ctx); -+ nss_warning("%px: failed to get flow keys\n", nss_ctx); - return res; - } - -@@ -146,7 +146,7 @@ static bool nss_qrfs_get_flow_keys(struc - nqfrm->ip_version = 6; - ip6hdr = (struct ipv6hdr *)skb_network_header(skb); - if (!ip6hdr) { -- nss_warning("%p: failed to get IPv6 address\n", nss_ctx); -+ nss_warning("%px: failed to get IPv6 address\n", nss_ctx); - return false; - } - -@@ -164,7 +164,7 @@ static bool nss_qrfs_get_flow_keys(struc - - res = skb_flow_dissect_flow_keys(skb, &keys, 0); - if (!res) { -- nss_warning("%p: failed to get flow keys\n", nss_ctx); -+ nss_warning("%px: failed to get flow keys\n", nss_ctx); - return res; - } - -@@ -197,19 +197,19 @@ static void nss_qrfs_flow_add_msg_callba - struct nss_qrfs_flow_rule_msg *nqfrm; - - if (nqm->cm.type != NSS_QRFS_MSG_FLOW_ADD) { -- nss_warning("%p: invalid flow response message %d\n", nss_ctx, nqm->cm.type); -+ nss_warning("%px: invalid flow response message %d\n", nss_ctx, nqm->cm.type); - return; - } - - nqfrm = &nqm->msg.flow_add; - - if ((nqfrm->ip_version != 4) && (nqfrm->ip_version != 6)) { -- nss_warning("%p: invalid IP version %d\n", nss_ctx, nqfrm->ip_version); -+ nss_warning("%px: invalid IP version %d\n", nss_ctx, nqfrm->ip_version); - return; - } - - if (nqm->cm.response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: flow add configuration error: %d for NSS core %d\n", -+ nss_warning("%px: flow add configuration error: %d for NSS core %d\n", - nss_ctx, nqm->cm.error, nss_ctx->id); - } - } -@@ -224,19 +224,19 @@ static void nss_qrfs_flow_delete_msg_cal - struct nss_qrfs_flow_rule_msg *nqfrm; - - if (nqm->cm.type != NSS_QRFS_MSG_FLOW_DELETE) { -- nss_warning("%p: invalid flow response message %d\n", nss_ctx, nqm->cm.type); -+ nss_warning("%px: invalid flow response message %d\n", nss_ctx, nqm->cm.type); - return; - } - - nqfrm = &nqm->msg.flow_delete; - - if ((nqfrm->ip_version != 4) && (nqfrm->ip_version != 6)) { -- nss_warning("%p: invalid IP version %d\n", nss_ctx, nqfrm->ip_version); -+ nss_warning("%px: invalid IP version %d\n", nss_ctx, nqfrm->ip_version); - return; - } - - if (nqm->cm.response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: flow delete configuration error: %d for NSS core %d\n", -+ nss_warning("%px: flow delete configuration error: %d for NSS core %d\n", - nss_ctx, nqm->cm.error, nss_ctx->id); - } - } -@@ -267,12 +267,12 @@ static nss_tx_status_t nss_qrfs_tx_msg(s - * Sanity check the message - */ - if (!nss_qrfs_verify_if_num(ncm->interface)) { -- nss_warning("%p: interface is not QRFS interface: %d\n", nss_ctx, ncm->interface); -+ nss_warning("%px: interface is not QRFS interface: %d\n", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_QRFS_MSG_MAX) { -- nss_warning("%p: message type is out of range: %d\n", nss_ctx, ncm->type); -+ nss_warning("%px: message type is out of range: %d\n", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -405,7 +405,7 @@ nss_tx_status_t nss_qrfs_set_flow_rule(s - } - - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: failed to send flow rule to NSS core %d\n", nss_ctx, i); -+ nss_warning("%px: failed to send flow rule to NSS core %d\n", nss_ctx, i); - return NSS_TX_FAILURE; - } - } ---- a/nss_qrfs_log.c -+++ b/nss_qrfs_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -54,7 +54,7 @@ static int8_t *nss_qrfs_log_error_respon - */ - static void nss_qrfs_log_flow_rule_msg(struct nss_qrfs_flow_rule_msg *nqfm) - { -- nss_trace("%p: NSS QRFS Flow Rule Message:\n" -+ nss_trace("%px: NSS QRFS Flow Rule Message:\n" - "QRFS Source Port: %d\n" - "QRFS Destination Port: %d\n" - "QRFS IP Version: %d\n" -@@ -86,7 +86,7 @@ static void nss_qrfs_log_flow_rule_msg(s - */ - static void nss_qrfs_log_mac_rule_msg(struct nss_qrfs_mac_rule_msg *nqmm) - { -- nss_trace("%p: NSS QRFS MAC Rule Message:\n" -+ nss_trace("%px: NSS QRFS MAC Rule Message:\n" - "QRFS MAC: %pM\n" - "QRFS CPU ID: %d\n" - "QRFS Physical Interface Number: %d\n", -@@ -118,7 +118,7 @@ static void nss_qrfs_log_verbose(struct - break; - - default: -- nss_warning("%p: Invalid message type\n", nqm); -+ nss_warning("%px: Invalid message type\n", nqm); - break; - } - } -@@ -130,11 +130,11 @@ static void nss_qrfs_log_verbose(struct - void nss_qrfs_log_tx_msg(struct nss_qrfs_msg *nqm) - { - if (nqm->cm.type >= NSS_QRFS_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", nqm); -+ nss_warning("%px: Invalid message type\n", nqm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nqm, nqm->cm.type, nss_qrfs_log_message_types_str[nqm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nqm, nqm->cm.type, nss_qrfs_log_message_types_str[nqm->cm.type]); - nss_qrfs_log_verbose(nqm); - } - -@@ -145,26 +145,26 @@ void nss_qrfs_log_tx_msg(struct nss_qrfs - void nss_qrfs_log_rx_msg(struct nss_qrfs_msg *nqm) - { - if (nqm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nqm); -+ nss_warning("%px: Invalid response\n", nqm); - return; - } - - if (nqm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nqm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nqm, nqm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nqm, nqm->cm.type, - nss_qrfs_log_message_types_str[nqm->cm.type], - nqm->cm.response, nss_cmn_response_str[nqm->cm.response]); - goto verbose; - } - - if (nqm->cm.error >= NSS_QRFS_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nqm, nqm->cm.type, nss_qrfs_log_message_types_str[nqm->cm.type], - nqm->cm.response, nss_cmn_response_str[nqm->cm.response], - nqm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nqm, nqm->cm.type, nss_qrfs_log_message_types_str[nqm->cm.type], - nqm->cm.response, nss_cmn_response_str[nqm->cm.response], - nqm->cm.error, nss_qrfs_log_error_response_types_str[nqm->cm.error]); ---- a/nss_qvpn.c -+++ b/nss_qvpn.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -41,7 +41,7 @@ static bool nss_qvpn_verify_if_num(uint3 - if_type = nss_dynamic_interface_get_type(nss_qvpn_get_context(), if_num); - if ((if_type != NSS_DYNAMIC_INTERFACE_TYPE_QVPN_INNER) && - (if_type != NSS_DYNAMIC_INTERFACE_TYPE_QVPN_OUTER)) { -- nss_warning("%p: if_num = %u interface type returned is %d\n", nss_qvpn_get_context(), if_num, if_type); -+ nss_warning("%px: if_num = %u interface type returned is %d\n", nss_qvpn_get_context(), if_num, if_type); - return false; - } - -@@ -94,12 +94,12 @@ static void nss_qvpn_handler(struct nss_ - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_QVPN_MSG_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for qvpn interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for qvpn interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_qvpn_msg)) { -- nss_warning("%p: length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -122,7 +122,7 @@ static void nss_qvpn_handler(struct nss_ - * to the same callback/app_data. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_top_main.if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->nss_rx_interface_handlers[nss_ctx->id][ncm->interface].app_data; - } - -@@ -131,7 +131,7 @@ static void nss_qvpn_handler(struct nss_ - */ - cb = (nss_qvpn_msg_callback_t)ncm->cb; - if (unlikely(!cb)) { -- nss_trace("%p: rx handler unregistered for i/f: %u\n", nss_ctx, ncm->interface); -+ nss_trace("%px: rx handler unregistered for i/f: %u\n", nss_ctx, ncm->interface); - return; - } - -@@ -187,12 +187,12 @@ nss_tx_status_t nss_qvpn_tx_msg(struct n - * Sanity check the message - */ - if (!nss_qvpn_verify_if_num(ncm->interface)) { -- nss_warning("%p: tx request for interface that is not a qvpn: %u\n", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for interface that is not a qvpn: %u\n", nss_ctx, ncm->interface); - return NSS_TX_FAILURE_BAD_PARAM; - } - - if (ncm->type >= NSS_QVPN_MSG_TYPE_MAX) { -- nss_warning("%p: message type out of range: %d\n", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d\n", nss_ctx, ncm->type); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -219,12 +219,12 @@ nss_tx_status_t nss_qvpn_tx_msg_sync(str - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (len > sizeof(nqm.msg)) { -- nss_warning("%p: Incorrect message length=%u for type %d and if_num=%u\n", nss_ctx, len, type, if_num); -+ nss_warning("%px: Incorrect message length=%u for type %d and if_num=%u\n", nss_ctx, len, type, if_num); - return NSS_TX_FAILURE_TOO_LARGE; - } - - if (!resp) { -- nss_warning("%p: Invalid input, resp=NULL\n", nss_ctx); -+ nss_warning("%px: Invalid input, resp=NULL\n", nss_ctx); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -235,13 +235,13 @@ nss_tx_status_t nss_qvpn_tx_msg_sync(str - - status = nss_qvpn_tx_msg(nss_ctx, &nqm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: qvpn_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: qvpn_tx_msg failed\n", nss_ctx); - goto done; - } - - ret = wait_for_completion_timeout(&qvpn_pvt.complete, msecs_to_jiffies(NSS_QVPN_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: qvpn msg tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: qvpn msg tx failed due to timeout\n", nss_ctx); - status = NSS_TX_FAILURE_SYNC_TIMEOUT; - goto done; - } -@@ -267,7 +267,7 @@ EXPORT_SYMBOL(nss_qvpn_tx_msg_sync); - nss_tx_status_t nss_qvpn_tx_buf(struct nss_ctx_instance *nss_ctx, uint32_t if_num, struct sk_buff *skb) - { - if (!nss_qvpn_verify_if_num(if_num)) { -- nss_warning("%p: tx request for interface that is not a qvpn: %u\n", nss_ctx, if_num); -+ nss_warning("%px: tx request for interface that is not a qvpn: %u\n", nss_ctx, if_num); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -294,13 +294,18 @@ struct nss_ctx_instance *nss_qvpn_regist - struct net_device *netdev, uint32_t features, void *app_ctx) - { - struct nss_ctx_instance *nss_ctx = nss_qvpn_get_context(); -+ uint32_t status; - - nss_assert(nss_ctx); - nss_assert(nss_qvpn_verify_if_num(if_num)); - - nss_core_register_subsys_dp(nss_ctx, if_num, qvpn_data_callback, NULL, app_ctx, netdev, features); - nss_core_register_handler(nss_ctx, if_num, nss_qvpn_handler, app_ctx); -- nss_top_main.if_rx_msg_callback[if_num] = qvpn_event_callback; -+ status = nss_core_register_msg_handler(nss_ctx, if_num, qvpn_event_callback); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to register handler for interface %d with NSS core\n", nss_ctx, if_num); -+ return NULL; -+ } - - set_bit(if_num, qvpn_pvt.if_map); - return nss_ctx; -@@ -314,15 +319,24 @@ EXPORT_SYMBOL(nss_qvpn_register_if); - void nss_qvpn_unregister_if(uint32_t if_num) - { - struct nss_ctx_instance *nss_ctx = nss_qvpn_get_context(); -+ uint32_t status; - - nss_assert(nss_qvpn_verify_if_num(if_num)); - - clear_bit(if_num, qvpn_pvt.if_map); - - nss_core_unregister_subsys_dp(nss_ctx, if_num); -- nss_core_unregister_handler(nss_ctx, if_num); -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Failed to unregister handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); -+ return; -+ } - -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ status = nss_core_unregister_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Failed to unregister handler for IPsec NSS I/F:%u\n", nss_ctx, if_num); -+ return; -+ } - } - EXPORT_SYMBOL(nss_qvpn_unregister_if); - -@@ -336,7 +350,7 @@ int nss_qvpn_ifnum_with_core_id(int if_n - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (nss_qvpn_verify_if_num(if_num) == false) { -- nss_info("%p: if_num: %u is not QVPN interface\n", nss_ctx, if_num); -+ nss_info("%px: if_num: %u is not QVPN interface\n", nss_ctx, if_num); - return 0; - } - return NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num); ---- a/nss_qvpn_log.c -+++ b/nss_qvpn_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -69,10 +69,10 @@ static int8_t *nss_qvpn_log_error_respon - static void nss_qvpn_log_tun_config_msg(struct nss_qvpn_msg *ncm) - { - struct nss_qvpn_tunnel_config_msg *nqtcm __maybe_unused = &ncm->msg.tunnel_config; -- nss_trace("%p: NSS QVPN tunnel config message \n" -+ nss_trace("%px: NSS QVPN tunnel config message \n" - "Sibling interface: %d" - "Total number of commands: %d" -- "Commands: %p" -+ "Commands: %px" - "Source IP: %x:%x:%x:%x\n" - "Source Port: %d\n" - "Destination IP: %x:%x:%x:%x\n" -@@ -86,8 +86,8 @@ static void nss_qvpn_log_tun_config_msg( - "VPN header head size: %d\n" - "VPN header head offset: %d\n" - "VPN header tail size: %d\n" -- "VPN header head: %p\n" -- "VPN header tail: %p\n", -+ "VPN header head: %px\n" -+ "VPN header tail: %px\n", - nqtcm, - nqtcm->sibling_if, - nqtcm->total_cmds, -@@ -115,7 +115,7 @@ static void nss_qvpn_log_tun_config_msg( - */ - static void nss_qvpn_log_tun_deconfig_msg(struct nss_qvpn_msg *ncm) - { -- nss_trace("%p: NSS QVPN deconfigure message \n", ncm); -+ nss_trace("%px: NSS QVPN deconfigure message \n", ncm); - } - - /* -@@ -125,9 +125,9 @@ static void nss_qvpn_log_tun_deconfig_ms - static void nss_qvpn_log_crypto_key_add_msg(struct nss_qvpn_msg *ncm) - { - struct nss_qvpn_crypto_key_add_msg *nqckam __maybe_unused = &ncm->msg.key_add; -- nss_trace("%p: NSS QVPN crypto key add message \n" -+ nss_trace("%px: NSS QVPN crypto key add message \n" - "Crypto index: %d\n" -- "Crypto session ID: %p", -+ "Crypto session ID: %px", - nqckam, - nqckam->crypto_idx, - nqckam->session_id); -@@ -140,9 +140,9 @@ static void nss_qvpn_log_crypto_key_add_ - static void nss_qvpn_log_crypto_key_activate_msg(struct nss_qvpn_msg *ncm) - { - struct nss_qvpn_crypto_key_activate_msg *nqckam __maybe_unused = &ncm->msg.key_activate; -- nss_trace("%p: NSS QVPN crypto key activate message \n" -+ nss_trace("%px: NSS QVPN crypto key activate message \n" - "Crypto index: %d\n" -- "Crypto VPN header head: %p", -+ "Crypto VPN header head: %px", - nqckam, - nqckam->crypto_idx, - nqckam->vpn_hdr_head); -@@ -155,7 +155,7 @@ static void nss_qvpn_log_crypto_key_acti - static void nss_qvpn_log_crypto_key_del_msg(struct nss_qvpn_msg *ncm) - { - struct nss_qvpn_crypto_key_del_msg *nqckdm __maybe_unused = &ncm->msg.key_del; -- nss_trace("%p: NSS QVPN crypto key delete message \n" -+ nss_trace("%px: NSS QVPN crypto key delete message \n" - "Crypto index: %d\n", - nqckdm, - nqckdm->crypto_idx); -@@ -168,7 +168,7 @@ static void nss_qvpn_log_crypto_key_del_ - static void nss_qvpn_log_crypto_key_deactivate_msg(struct nss_qvpn_msg *ncm) - { - struct nss_qvpn_crypto_key_del_msg *nqckdm __maybe_unused = &ncm->msg.key_del; -- nss_trace("%p: NSS QVPN crypto key deactivate message \n" -+ nss_trace("%px: NSS QVPN crypto key deactivate message \n" - "Crypto index: %d\n", - nqckdm, - nqckdm->crypto_idx); -@@ -206,7 +206,7 @@ static void nss_qvpn_log_verbose(struct - break; - - default: -- nss_trace("%p: Invalid message type\n", ncm); -+ nss_trace("%px: Invalid message type\n", ncm); - break; - } - } -@@ -218,11 +218,11 @@ static void nss_qvpn_log_verbose(struct - void nss_qvpn_log_tx_msg(struct nss_qvpn_msg *ncm) - { - if (ncm->cm.type >= NSS_QVPN_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", ncm); -+ nss_warning("%px: Invalid message type\n", ncm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ncm, ncm->cm.type, nss_qvpn_log_message_types_str[ncm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ncm, ncm->cm.type, nss_qvpn_log_message_types_str[ncm->cm.type]); - nss_qvpn_log_verbose(ncm); - } - -@@ -233,26 +233,26 @@ void nss_qvpn_log_tx_msg(struct nss_qvpn - void nss_qvpn_log_rx_msg(struct nss_qvpn_msg *ncm) - { - if (ncm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ncm); -+ nss_warning("%px: Invalid response\n", ncm); - return; - } - - if (ncm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ncm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, - nss_qvpn_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response]); - goto verbose; - } - - if (ncm->cm.error >= NSS_QVPN_ERROR_TYPE_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ncm, ncm->cm.type, nss_qvpn_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ncm, ncm->cm.type, nss_qvpn_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error, nss_qvpn_log_error_response_types_str[ncm->cm.error]); ---- a/nss_rmnet_rx.c -+++ b/nss_rmnet_rx.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above -@@ -70,7 +70,7 @@ static void nss_rmnet_rx_msg_handler(str - * Sanity check the message type - */ - if (ncm->type > NSS_RMNET_RX_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return; - } - -@@ -82,7 +82,7 @@ static void nss_rmnet_rx_msg_handler(str - } - - if (!nss_rmnet_rx_verify_if_num(ncm->interface)) { -- nss_warning("%p: response for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: response for another interface: %d", nss_ctx, ncm->interface); - return; - } - -@@ -91,7 +91,7 @@ static void nss_rmnet_rx_msg_handler(str - spin_lock_bh(&nss_rmnet_rx_lock); - if (!rmnet_rx_handle[if_num]) { - spin_unlock_bh(&nss_rmnet_rx_lock); -- nss_warning("%p: rmnet_rx handle is NULL\n", nss_ctx); -+ nss_warning("%px: rmnet_rx handle is NULL\n", nss_ctx); - return; - } - -@@ -148,7 +148,7 @@ static void nss_rmnet_rx_callback(void * - struct nss_rmnet_rx_pvt *nvip = handle->pvt; - - if (ncm->response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: rmnet_rx Error response %d\n", handle->nss_ctx, ncm->response); -+ nss_warning("%px: rmnet_rx Error response %d\n", handle->nss_ctx, ncm->response); - nvip->response = NSS_TX_FAILURE; - complete(&nvip->complete); - return; -@@ -174,7 +174,7 @@ static nss_tx_status_t nss_rmnet_rx_tx_m - - status = nss_rmnet_rx_tx_msg(nss_ctx, nvim); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_rmnet_rx_msg failed\n", nss_ctx); -+ nss_warning("%px: nss_rmnet_rx_msg failed\n", nss_ctx); - up(&nwip->sem); - return status; - } -@@ -182,7 +182,7 @@ static nss_tx_status_t nss_rmnet_rx_tx_m - ret = wait_for_completion_timeout(&nwip->complete, - msecs_to_jiffies(NSS_RMNET_RX_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: rmnet_rx tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: rmnet_rx tx failed due to timeout\n", nss_ctx); - nwip->response = NSS_TX_FAILURE; - } - -@@ -219,7 +219,7 @@ static int nss_rmnet_rx_handle_destroy_s - int32_t index_h2n; - - if (!nss_rmnet_rx_verify_if_num(if_num_n2h) || !nss_rmnet_rx_verify_if_num(if_num_h2n)) { -- nss_warning("%p: bad interface numbers %d %d\n", handle->nss_ctx, if_num_n2h, if_num_h2n); -+ nss_warning("%px: bad interface numbers %d %d\n", handle->nss_ctx, if_num_n2h, if_num_h2n); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -228,13 +228,13 @@ static int nss_rmnet_rx_handle_destroy_s - - status = nss_dynamic_interface_dealloc_node(if_num_n2h, NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_N2H); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Dynamic interface destroy failed status %d\n", handle->nss_ctx, status); -+ nss_warning("%px: Dynamic interface destroy failed status %d\n", handle->nss_ctx, status); - return status; - } - - status = nss_dynamic_interface_dealloc_node(if_num_h2n, NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Dynamic interface destroy failed status %d\n", handle->nss_ctx, status); -+ nss_warning("%px: Dynamic interface destroy failed status %d\n", handle->nss_ctx, status); - return status; - } - -@@ -260,7 +260,7 @@ static struct nss_rmnet_rx_handle *nss_r - struct nss_rmnet_rx_handle *handle; - - if (!nss_rmnet_rx_verify_if_num(if_num_n2h) || !nss_rmnet_rx_verify_if_num(if_num_h2n)) { -- nss_warning("%p: bad interface numbers %d %d\n", nss_ctx, if_num_n2h, if_num_h2n); -+ nss_warning("%px: bad interface numbers %d %d\n", nss_ctx, if_num_n2h, if_num_h2n); - return NULL; - } - -@@ -270,7 +270,7 @@ static struct nss_rmnet_rx_handle *nss_r - handle = (struct nss_rmnet_rx_handle *)kzalloc(sizeof(struct nss_rmnet_rx_handle), - GFP_KERNEL); - if (!handle) { -- nss_warning("%p: handle memory alloc failed\n", nss_ctx); -+ nss_warning("%px: handle memory alloc failed\n", nss_ctx); - *cmd_rsp = NSS_RMNET_RX_ALLOC_FAILURE; - goto error1; - } -@@ -281,7 +281,7 @@ static struct nss_rmnet_rx_handle *nss_r - handle->pvt = (struct nss_rmnet_rx_pvt *)kzalloc(sizeof(struct nss_rmnet_rx_pvt), - GFP_KERNEL); - if (!handle->pvt) { -- nss_warning("%p: failure allocating memory for nss_rmnet_rx_pvt\n", nss_ctx); -+ nss_warning("%px: failure allocating memory for nss_rmnet_rx_pvt\n", nss_ctx); - *cmd_rsp = NSS_RMNET_RX_ALLOC_FAILURE; - goto error2; - } -@@ -289,7 +289,7 @@ static struct nss_rmnet_rx_handle *nss_r - handle->stats_n2h = (uint64_t *)kzalloc(sizeof(uint64_t) * NSS_RMNET_RX_STATS_MAX, - GFP_KERNEL); - if (!handle->stats_n2h) { -- nss_warning("%p: failure allocating memory for N2H stats\n", nss_ctx); -+ nss_warning("%px: failure allocating memory for N2H stats\n", nss_ctx); - *cmd_rsp = NSS_RMNET_RX_ALLOC_FAILURE; - goto error3; - } -@@ -297,7 +297,7 @@ static struct nss_rmnet_rx_handle *nss_r - handle->stats_h2n = (uint64_t *)kzalloc(sizeof(uint64_t) * NSS_RMNET_RX_STATS_MAX, - GFP_KERNEL); - if (!handle->stats_h2n) { -- nss_warning("%p: failure allocating memory for H2N stats\n", nss_ctx); -+ nss_warning("%px: failure allocating memory for H2N stats\n", nss_ctx); - *cmd_rsp = NSS_RMNET_RX_ALLOC_FAILURE; - goto error4; - } -@@ -337,14 +337,14 @@ static uint32_t nss_rmnet_rx_register_ha - - ret = nss_core_register_handler(nss_ctx, if_num_n2h, nss_rmnet_rx_msg_handler, NULL); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Failed to register message handler for redir_n2h interface %d\n", nss_ctx, if_num_n2h); -+ nss_warning("%px: Failed to register message handler for redir_n2h interface %d\n", nss_ctx, if_num_n2h); - return NSS_RMNET_RX_REG_FAILURE; - } - - ret = nss_core_register_handler(nss_ctx, if_num_h2n, nss_rmnet_rx_msg_handler, NULL); - if (ret != NSS_CORE_STATUS_SUCCESS) { - nss_core_unregister_handler(nss_ctx, if_num_n2h); -- nss_warning("%p: Failed to register message handler for redir_h2n interface %d\n", nss_ctx, if_num_h2n); -+ nss_warning("%px: Failed to register message handler for redir_h2n interface %d\n", nss_ctx, if_num_h2n); - return NSS_RMNET_RX_REG_FAILURE; - } - -@@ -382,14 +382,14 @@ nss_tx_status_t nss_rmnet_rx_destroy_syn - nss_ctx = handle->nss_ctx; - - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: Interface could not be destroyed as core not ready\n", nss_ctx); -+ nss_warning("%px: Interface could not be destroyed as core not ready\n", nss_ctx); - return NSS_TX_FAILURE_NOT_READY; - } - - spin_lock_bh(&nss_top_main.lock); - if (!nss_ctx->subsys_dp_register[if_num_n2h].ndev || !nss_ctx->subsys_dp_register[if_num_h2n].ndev) { - spin_unlock_bh(&nss_top_main.lock); -- nss_warning("%p: Unregister virt interface %d %d: no context\n", nss_ctx, if_num_n2h, if_num_h2n); -+ nss_warning("%px: Unregister virt interface %d %d: no context\n", nss_ctx, if_num_n2h, if_num_h2n); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -402,19 +402,19 @@ nss_tx_status_t nss_rmnet_rx_destroy_syn - - status = nss_rmnet_rx_handle_destroy_sync(handle); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: handle destroy failed for if_num_n2h %d and if_num_h2n %d\n", nss_ctx, if_num_n2h, if_num_h2n); -+ nss_warning("%px: handle destroy failed for if_num_n2h %d and if_num_h2n %d\n", nss_ctx, if_num_n2h, if_num_h2n); - return NSS_TX_FAILURE; - } - - ret = nss_core_unregister_handler(nss_ctx, if_num_n2h); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Not able to unregister handler for redir_n2h interface %d with NSS core\n", nss_ctx, if_num_n2h); -+ nss_warning("%px: Not able to unregister handler for redir_n2h interface %d with NSS core\n", nss_ctx, if_num_n2h); - return NSS_TX_FAILURE_BAD_PARAM; - } - - ret = nss_core_unregister_handler(nss_ctx, if_num_h2n); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Not able to unregister handler for redir_h2n interface %d with NSS core\n", nss_ctx, if_num_h2n); -+ nss_warning("%px: Not able to unregister handler for redir_h2n interface %d with NSS core\n", nss_ctx, if_num_h2n); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -436,26 +436,26 @@ struct nss_rmnet_rx_handle *nss_rmnet_rx - int32_t if_num_n2h, if_num_h2n; - - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: Interface could not be created as core not ready\n", nss_ctx); -+ nss_warning("%px: Interface could not be created as core not ready\n", nss_ctx); - return NULL; - } - - if_num_n2h = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_N2H); - if (if_num_n2h < 0) { -- nss_warning("%p: failure allocating redir_n2h\n", nss_ctx); -+ nss_warning("%px: failure allocating redir_n2h\n", nss_ctx); - return NULL; - } - - if_num_h2n = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N); - if (if_num_h2n < 0) { -- nss_warning("%p: failure allocating redir_h2n\n", nss_ctx); -+ nss_warning("%px: failure allocating redir_h2n\n", nss_ctx); - nss_dynamic_interface_dealloc_node(if_num_n2h, NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_N2H); - return NULL; - } - - handle = nss_rmnet_rx_handle_create_sync(nss_ctx, if_num_n2h, if_num_h2n, &ret); - if (!handle) { -- nss_warning("%p: rmnet_rx handle creation failed ret %d\n", nss_ctx, ret); -+ nss_warning("%px: rmnet_rx handle creation failed ret %d\n", nss_ctx, ret); - nss_dynamic_interface_dealloc_node(if_num_n2h, NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_N2H); - nss_dynamic_interface_dealloc_node(if_num_h2n, NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N); - return NULL; -@@ -466,7 +466,7 @@ struct nss_rmnet_rx_handle *nss_rmnet_rx - */ - ret = nss_rmnet_rx_register_handler_sync(nss_ctx, handle); - if (ret != NSS_RMNET_RX_SUCCESS) { -- nss_warning("%p: Registration handler failed reason: %d\n", nss_ctx, ret); -+ nss_warning("%px: Registration handler failed reason: %d\n", nss_ctx, ret); - goto error1; - } - -@@ -481,7 +481,7 @@ struct nss_rmnet_rx_handle *nss_rmnet_rx - - ret = nss_rmnet_rx_tx_msg_sync(handle, &nvim); - if (ret != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_rmnet_rx_tx_msg_sync failed %u\n", nss_ctx, ret); -+ nss_warning("%px: nss_rmnet_rx_tx_msg_sync failed %u\n", nss_ctx, ret); - goto error2; - } - -@@ -492,7 +492,7 @@ struct nss_rmnet_rx_handle *nss_rmnet_rx - - ret = nss_rmnet_rx_tx_msg_sync(handle, &nvim); - if (ret != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_rmnet_rx_tx_msg_sync failed %u\n", nss_ctx, ret); -+ nss_warning("%px: nss_rmnet_rx_tx_msg_sync failed %u\n", nss_ctx, ret); - goto error2; - } - -@@ -544,17 +544,17 @@ nss_tx_status_t nss_rmnet_rx_tx_buf(stru - } - - if (!nss_rmnet_rx_verify_if_num(if_num)) { -- nss_warning("%p: bad interface number %d\n", nss_ctx, if_num); -+ nss_warning("%px: bad interface number %d\n", nss_ctx, if_num); - return NSS_TX_FAILURE_BAD_PARAM; - } - -- nss_trace("%p: RmnetRx packet, if_num:%d, skb:%p", nss_ctx, if_num, skb); -+ nss_trace("%px: RmnetRx packet, if_num:%d, skb:%px", nss_ctx, if_num, skb); - - /* - * Sanity check the SKB to ensure that it's suitable for us - */ - if (unlikely(skb->len <= ETH_HLEN)) { -- nss_warning("%p: Rmnet Rx packet: %p too short", nss_ctx, skb); -+ nss_warning("%px: Rmnet Rx packet: %px too short", nss_ctx, skb); - return NSS_TX_FAILURE_TOO_SHORT; - } - -@@ -580,12 +580,12 @@ nss_tx_status_t nss_rmnet_rx_tx_msg(stru - * Sanity check the message - */ - if (!nss_rmnet_rx_verify_if_num(ncm->interface)) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_RMNET_RX_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -714,7 +714,7 @@ int32_t nss_rmnet_rx_get_ifnum_with_core - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - if (nss_rmnet_rx_verify_if_num(if_num) == false) { -- nss_info("%p: if_num: %u is not RMNET interface\n", nss_ctx, if_num); -+ nss_info("%px: if_num: %u is not RMNET interface\n", nss_ctx, if_num); - return -1; - } - return NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num); ---- a/nss_rmnet_rx_stats.c -+++ b/nss_rmnet_rx_stats.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above -@@ -113,13 +113,13 @@ static ssize_t nss_rmnet_rx_stats_read(s - uint64_t *stats_shadow; - char *lbuf = kzalloc(size_al, GFP_KERNEL); - if (unlikely(!lbuf)) { -- nss_warning("%p: Could not allocate memory for local statistics buffer", data); -+ nss_warning("%px: Could not allocate memory for local statistics buffer", data); - return 0; - } - - stats_shadow = kzalloc(NSS_RMNET_RX_STATS_MAX * sizeof(uint64_t), GFP_KERNEL); - if (unlikely(!stats_shadow)) { -- nss_warning("%p: Could not allocate memory for local shadow buffer", data); -+ nss_warning("%px: Could not allocate memory for local shadow buffer", data); - kfree(lbuf); - return 0; - } -@@ -143,7 +143,6 @@ static ssize_t nss_rmnet_rx_stats_read(s - continue; - } - -- - size_wr += nss_stats_print("rmnet_rx", "interface", if_num, - nss_rmnet_rx_stats_str, stats_shadow, NSS_RMNET_RX_STATS_MAX, - lbuf, size_wr, size_al); ---- a/nss_rps.c -+++ b/nss_rps.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2013-2017, 2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013-2017, 2019-2020 The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -188,12 +188,12 @@ static void nss_rps_cfg_callback(void *a - */ - nss_rps_cfg_pvt.response = NSS_FAILURE; - complete(&nss_rps_cfg_pvt.complete); -- nss_warning("%p: RPS configuration failed : %d\n", nss_ctx, -+ nss_warning("%px: RPS configuration failed : %d\n", nss_ctx, - nnm->cm.error); - return; - } - -- nss_info("%p: RPS configuration succeeded: %d\n", nss_ctx, -+ nss_info("%px: RPS configuration succeeded: %d\n", nss_ctx, - nnm->cm.error); - nss_ctx->rps_en = nnm->msg.rps_cfg.enable; - nss_rps_cfg_pvt.response = NSS_SUCCESS; -@@ -215,12 +215,12 @@ static void nss_rps_pri_map_cfg_callback - */ - nss_rps_cfg_pvt.response = NSS_FAILURE; - complete(&nss_rps_cfg_pvt.complete); -- nss_warning("%p: RPS pri_map configuration failed : %d\n", -+ nss_warning("%px: RPS pri_map configuration failed : %d\n", - app_data, nnm->cm.error); - return; - } - -- nss_info("%p: RPS pri_map configuration succeeded: %d\n", -+ nss_info("%px: RPS pri_map configuration succeeded: %d\n", - app_data, nnm->cm.error); - - nss_rps_cfg_pvt.response = NSS_SUCCESS; -@@ -248,7 +248,7 @@ static nss_tx_status_t nss_rps_cfg(struc - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_tx error setting rps\n", nss_ctx); -+ nss_warning("%px: nss_tx error setting rps\n", nss_ctx); - - up(&nss_rps_cfg_pvt.sem); - return NSS_FAILURE; -@@ -259,7 +259,7 @@ static nss_tx_status_t nss_rps_cfg(struc - */ - ret = wait_for_completion_timeout(&nss_rps_cfg_pvt.complete, msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: Waiting for ack timed out\n", nss_ctx); -+ nss_warning("%px: Waiting for ack timed out\n", nss_ctx); - up(&nss_rps_cfg_pvt.sem); - return NSS_FAILURE; - } -@@ -297,7 +297,7 @@ static nss_tx_status_t nss_rps_ipv4_hash - nss_tx_status = nss_ipv4_tx_sync(nss_ctx, &nim); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_tx error setting rps\n", nss_ctx); -+ nss_warning("%px: nss_tx error setting rps\n", nss_ctx); - - up(&nss_rps_cfg_pvt.sem); - return NSS_FAILURE; -@@ -326,7 +326,7 @@ static nss_tx_status_t nss_rps_ipv6_hash - nss_tx_status = nss_ipv6_tx_sync(nss_ctx, &nim); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_tx error setting rps\n", nss_ctx); -+ nss_warning("%px: nss_tx error setting rps\n", nss_ctx); - - up(&nss_rps_cfg_pvt.sem); - return NSS_FAILURE; -@@ -365,7 +365,7 @@ static nss_tx_status_t nss_rps_pri_map_c - nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm); - - if (nss_tx_status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_tx error setting rps\n", nss_ctx); -+ nss_warning("%px: nss_tx error setting rps\n", nss_ctx); - - up(&nss_rps_cfg_pvt.sem); - return NSS_FAILURE; -@@ -376,7 +376,7 @@ static nss_tx_status_t nss_rps_pri_map_c - */ - ret = wait_for_completion_timeout(&nss_rps_cfg_pvt.complete, msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT)); - if (ret == 0) { -- nss_warning("%p: Waiting for ack timed out\n", nss_ctx); -+ nss_warning("%px: Waiting for ack timed out\n", nss_ctx); - up(&nss_rps_cfg_pvt.sem); - return NSS_FAILURE; - } -@@ -438,7 +438,7 @@ static int nss_rps_cfg_handler(struct ct - * TODO: Flush queues in NSS FW. - */ - if (ret_rps != NSS_SUCCESS) { -- nss_warning("%p: rps enabling failed\n", nss_ctx); -+ nss_warning("%px: rps enabling failed\n", nss_ctx); - nss_rps_config = current_state; - return ret_rps; - } -@@ -474,7 +474,7 @@ static int nss_rps_hash_bitmap_cfg_handl - ret_ipv4 = nss_rps_ipv4_hash_bitmap_cfg(nss_ctx, nss_rps_hash_bitmap); - - if (ret_ipv4 != NSS_SUCCESS) { -- nss_warning("%p: ipv4 hash_bitmap config message failed\n", nss_ctx); -+ nss_warning("%px: ipv4 hash_bitmap config message failed\n", nss_ctx); - nss_rps_hash_bitmap = current_state; - return ret_ipv4; - } -@@ -482,10 +482,10 @@ static int nss_rps_hash_bitmap_cfg_handl - ret_ipv6 = nss_rps_ipv6_hash_bitmap_cfg(nss_ctx, nss_rps_hash_bitmap); - - if (ret_ipv6 != NSS_SUCCESS) { -- nss_warning("%p: ipv6 hash_bitmap config message failed\n", nss_ctx); -+ nss_warning("%px: ipv6 hash_bitmap config message failed\n", nss_ctx); - nss_rps_hash_bitmap = current_state; - if (nss_rps_ipv4_hash_bitmap_cfg(nss_ctx, nss_rps_hash_bitmap != NSS_SUCCESS)) { -- nss_warning("%p: ipv4 and ipv6 have different hash_bitmaps.\n", nss_ctx); -+ nss_warning("%px: ipv4 and ipv6 have different hash_bitmaps.\n", nss_ctx); - } - return ret_ipv6; - } -@@ -526,7 +526,7 @@ static int nss_rps_pri_map_cfg_handler(s - ret_pri_map = nss_rps_pri_map_cfg(nss_ctx, nss_rps_pri_map); - if (ret_pri_map != NSS_SUCCESS) { - nss_rps_pri_map[current_state.pri] = current_state.core; -- nss_warning("%p: pri_map config message failed\n", nss_ctx); -+ nss_warning("%px: pri_map config message failed\n", nss_ctx); - } - - return ret_pri_map; ---- a/nss_shaper.c -+++ b/nss_shaper.c -@@ -23,7 +23,7 @@ - void *nss_shaper_register_shaping(void) - { - if (nss_top_main.shaping_handler_id == (uint8_t)-1) { -- nss_warning("%p: SHAPING IS NOT ENABLED", __func__); -+ nss_warning("%px: SHAPING IS NOT ENABLED", __func__); - return NULL; - } - return (void *)&nss_top_main.nss[nss_top_main.shaping_handler_id]; -@@ -46,7 +46,7 @@ void *nss_shaper_register_shaper_bounce_ - struct nss_top_instance *nss_top = &nss_top_main; - struct nss_shaper_bounce_registrant *reg; - -- nss_info("Shaper bounce interface register: %u, cb: %p, app_data: %p, owner: %p", -+ nss_info("Shaper bounce interface register: %u, cb: %px, app_data: %px, owner: %px", - if_num, cb, app_data, owner); - - /* -@@ -61,7 +61,7 @@ void *nss_shaper_register_shaper_bounce_ - * Shaping enabled? - */ - if (nss_top_main.shaping_handler_id == (uint8_t)-1) { -- nss_warning("%p: SHAPING IS NOT ENABLED", __func__); -+ nss_warning("%px: SHAPING IS NOT ENABLED", __func__); - return NULL; - } - -@@ -69,7 +69,7 @@ void *nss_shaper_register_shaper_bounce_ - * Can we hold the module? - */ - if (!try_module_get(owner)) { -- nss_warning("%p: Unable to hold owner", __func__); -+ nss_warning("%px: Unable to hold owner", __func__); - return NULL; - } - -@@ -151,7 +151,7 @@ void *nss_shaper_register_shaper_bounce_ - struct nss_ctx_instance *nss_ctx; - struct nss_shaper_bounce_registrant *reg; - -- nss_info("Shaper bounce bridge register: %u, cb: %p, app_data: %p, owner: %p", -+ nss_info("Shaper bounce bridge register: %u, cb: %px, app_data: %px, owner: %px", - if_num, cb, app_data, owner); - - /* -@@ -166,7 +166,7 @@ void *nss_shaper_register_shaper_bounce_ - * Shaping enabled? - */ - if (nss_top_main.shaping_handler_id == (uint8_t)-1) { -- nss_warning("%p: SHAPING IS NOT ENABLED", __func__); -+ nss_warning("%px: SHAPING IS NOT ENABLED", __func__); - return NULL; - } - -@@ -174,7 +174,7 @@ void *nss_shaper_register_shaper_bounce_ - * Can we hold the module? - */ - if (!try_module_get(owner)) { -- nss_warning("%p: Unable to hold owner", __func__); -+ nss_warning("%px: Unable to hold owner", __func__); - return NULL; - } - -@@ -277,7 +277,6 @@ nss_tx_status_t nss_shaper_bounce_interf - BUG_ON(false); - } - -- - /* - * Must have existing registrant - */ -@@ -334,7 +333,7 @@ nss_tx_status_t nss_shaper_bounce_bridge - } - spin_unlock_bh(&nss_top->lock); - -- nss_info("%s: Bridge bounce skb: %p, if_num: %u, ctx: %p", __func__, skb, if_num, nss_ctx); -+ nss_info("%s: Bridge bounce skb: %px, if_num: %u, ctx: %px", __func__, skb, if_num, nss_ctx); - status = nss_core_send_buffer(nss_ctx, if_num, skb, NSS_IF_H2N_DATA_QUEUE, - H2N_BUFFER_SHAPER_BOUNCE_BRIDGE, 0); - if (status != NSS_CORE_STATUS_SUCCESS) { ---- a/nss_sjack.c -+++ b/nss_sjack.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -40,12 +40,12 @@ static void nss_sjack_handler(struct nss - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_SJACK_MAX_MSG_TYPE) { -- nss_warning("%p: received invalid message %d for sjack interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for sjack interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_sjack_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -54,7 +54,7 @@ static void nss_sjack_handler(struct nss - * to the same callback/app_data. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - } - - /* -@@ -104,12 +104,12 @@ nss_tx_status_t nss_sjack_tx_msg(struct - * Sanity check the message - */ - if (ncm->interface != NSS_SJACK_INTERFACE) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_SJACK_MAX_MSG_TYPE) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -123,13 +123,18 @@ struct nss_ctx_instance *nss_sjack_regis - nss_sjack_msg_callback_t event_callback) - { - struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.sjack_handler_id]; -+ uint32_t status; - - nss_assert(nss_ctx); - nss_assert(if_num == NSS_SJACK_INTERFACE); - - nss_core_register_subsys_dp(nss_ctx, if_num, NULL, NULL, NULL, netdev, 0); - -- nss_top_main.if_rx_msg_callback[if_num] = event_callback; -+ status = nss_core_register_msg_handler(nss_ctx, NSS_SJACK_INTERFACE, event_callback); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to register handler for interface %d with NSS core\n", nss_ctx, if_num); -+ return NULL; -+ } - - return nss_ctx; - } -@@ -140,12 +145,18 @@ struct nss_ctx_instance *nss_sjack_regis - void nss_sjack_unregister_if(uint32_t if_num) - { - struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.sjack_handler_id]; -+ uint32_t status; - - nss_assert(nss_ctx); - nss_assert(if_num == NSS_SJACK_INTERFACE); - - nss_core_unregister_subsys_dp(nss_ctx, if_num); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: Not able to unregister handler for interface %d with NSS core\n", nss_ctx, if_num); -+ return; -+ } - - return; - } ---- a/nss_sjack_log.c -+++ b/nss_sjack_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -38,7 +38,7 @@ static int8_t *nss_sjack_log_message_typ - static void nss_sjack_log_configure_msg(struct nss_sjack_msg *nsm) - { - struct nss_sjack_configure_msg *nscm __maybe_unused = &nsm->msg.configure; -- nss_trace("%p: NSS SJACK Configure message \n" -+ nss_trace("%px: NSS SJACK Configure message \n" - "SJACK Ingress Interface Number: %d\n" - "SJACK Engress Interface Number: %d\n" - "SJACK Tunnel ID: %d\n" -@@ -59,7 +59,7 @@ static void nss_sjack_log_configure_msg( - static void nss_sjack_log_unconfigure_msg(struct nss_sjack_msg *nsm) - { - struct nss_sjack_unconfigure_msg *nsum __maybe_unused = &nsm->msg.unconfigure; -- nss_trace("%p: NSS SJACK UnConfigure message \n" -+ nss_trace("%px: NSS SJACK UnConfigure message \n" - "SJACK Ingress Interface Number: %d\n", - nsum, nsum->ingress_if_num); - } -@@ -86,7 +86,7 @@ static void nss_sjack_log_verbose(struct - break; - - default: -- nss_trace("%p: Invalid message type\n", nsm); -+ nss_trace("%px: Invalid message type\n", nsm); - break; - } - } -@@ -98,11 +98,11 @@ static void nss_sjack_log_verbose(struct - void nss_sjack_log_tx_msg(struct nss_sjack_msg *nsm) - { - if (nsm->cm.type >= NSS_SJACK_MAX_MSG_TYPE) { -- nss_warning("%p: Invalid message type\n", nsm); -+ nss_warning("%px: Invalid message type\n", nsm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nsm, nsm->cm.type, nss_sjack_log_message_types_str[nsm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nsm, nsm->cm.type, nss_sjack_log_message_types_str[nsm->cm.type]); - nss_sjack_log_verbose(nsm); - } - -@@ -113,18 +113,18 @@ void nss_sjack_log_tx_msg(struct nss_sja - void nss_sjack_log_rx_msg(struct nss_sjack_msg *nsm) - { - if (nsm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nsm); -+ nss_warning("%px: Invalid response\n", nsm); - return; - } - - if (nsm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nsm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nsm, nsm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nsm, nsm->cm.type, - nss_sjack_log_message_types_str[nsm->cm.type], - nsm->cm.response, nss_cmn_response_str[nsm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - nsm, nsm->cm.type, nss_sjack_log_message_types_str[nsm->cm.type], - nsm->cm.response, nss_cmn_response_str[nsm->cm.response]); - ---- a/nss_tls.c -+++ b/nss_tls.c -@@ -152,18 +152,18 @@ static void nss_tls_handler(struct nss_c - - NSS_VERIFY_CTX_MAGIC(nss_ctx); - -- nss_trace("%p: handle event for interface num :%u", nss_ctx, ncm->interface); -+ nss_trace("%px: handle event for interface num :%u", nss_ctx, ncm->interface); - - /* - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_TLS_MSG_MAX) { -- nss_warning("%p:Bad message type(%d) for TLS interface %d", nss_ctx, ncm->type, ncm->interface); -+ nss_warning("%px:Bad message type(%d) for TLS interface %d", nss_ctx, ncm->type, ncm->interface); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_tls_msg)) { -- nss_warning("%p:Bad message length(%d)", nss_ctx, ncm->len); -+ nss_warning("%px:Bad message length(%d)", nss_ctx, ncm->len); - return; - } - -@@ -174,7 +174,7 @@ static void nss_tls_handler(struct nss_c - * Update the callback and app_data for NOTIFY messages - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_top_main.if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->nss_rx_interface_handlers[nss_ctx->id][ncm->interface].app_data; - } - -@@ -198,11 +198,11 @@ static void nss_tls_handler(struct nss_c - * Call TLS session callback - */ - if (!cb) { -- nss_warning("%p: No callback for tls session interface %d", nss_ctx, ncm->interface); -+ nss_warning("%px: No callback for tls session interface %d", nss_ctx, ncm->interface); - return; - } - -- nss_trace("%p: calling tlsmgr event handler(%u)", nss_ctx, ncm->interface); -+ nss_trace("%px: calling tlsmgr event handler(%u)", nss_ctx, ncm->interface); - cb(app_data, ncm); - } - -@@ -242,7 +242,7 @@ nss_tx_status_t nss_tls_tx_buf(struct sk - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: tx_data packet dropped as core not ready", nss_ctx); -+ nss_warning("%px: tx_data packet dropped as core not ready", nss_ctx); - return NSS_TX_FAILURE_NOT_READY; - } - -@@ -252,11 +252,11 @@ nss_tx_status_t nss_tls_tx_buf(struct sk - break; - - case NSS_CORE_STATUS_FAILURE_QUEUE: /* queue full condition */ -- nss_warning("%p: H2N queue full for tx_buf", nss_ctx); -+ nss_warning("%px: H2N queue full for tx_buf", nss_ctx); - return NSS_TX_FAILURE_QUEUE; - - default: -- nss_warning("%p: general failure for tx_buf", nss_ctx); -+ nss_warning("%px: general failure for tx_buf", nss_ctx); - return NSS_TX_FAILURE; - } - -@@ -278,12 +278,12 @@ nss_tx_status_t nss_tls_tx_msg(struct ns - struct nss_cmn_msg *ncm = &msg->cm; - - if (ncm->type >= NSS_TLS_MSG_MAX) { -- nss_warning("%p: tls message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: tls message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - - if (!nss_tls_verify_ifnum(nss_ctx, ncm->interface)) { -- nss_warning("%p: tls message interface is bad: %u", nss_ctx, ncm->interface); -+ nss_warning("%px: tls message interface is bad: %u", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - -@@ -312,7 +312,7 @@ nss_tx_status_t nss_tls_tx_msg_sync(stru - * Length of the message should be the based on type - */ - if (len > sizeof(struct nss_tls_msg)) { -- nss_warning("%p: Invalid message length(%u), type (%d), I/F(%u)\n", nss_ctx, len, type, if_num); -+ nss_warning("%px: Invalid message length(%u), type (%d), I/F(%u)\n", nss_ctx, len, type, if_num); - return NSS_TX_FAILURE; - } - -@@ -329,13 +329,13 @@ nss_tx_status_t nss_tls_tx_msg_sync(stru - - status = nss_tls_tx_msg(nss_ctx, local_ntcm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Failed to send message\n", nss_ctx); -+ nss_warning("%px: Failed to send message\n", nss_ctx); - goto done; - } - - ret = wait_for_completion_timeout(&tls_pvt.complete, msecs_to_jiffies(NSS_TLS_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: Failed to receive response, timeout(%d)\n", nss_ctx, ret); -+ nss_warning("%px: Failed to receive response, timeout(%d)\n", nss_ctx, ret); - status = NSS_TX_FAILURE_NOT_READY; - goto done; - } -@@ -363,7 +363,6 @@ done: - } - EXPORT_SYMBOL(nss_tls_tx_msg_sync); - -- - /* - * nss_tls_notify_register() - * Register a handler for notification from NSS firmware. -@@ -377,11 +376,16 @@ struct nss_ctx_instance *nss_tls_notify_ - - ret = nss_core_register_handler(nss_ctx, if_num, nss_tls_handler, app_data); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: unable to register event handler for interface(%u)", nss_ctx, if_num); -+ nss_warning("%px: unable to register event handler for interface(%u)", nss_ctx, if_num); - return NULL; - } - -- nss_top_main.if_rx_msg_callback[if_num] = ev_cb; -+ ret = nss_core_register_msg_handler(nss_ctx, if_num, ev_cb); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, if_num); -+ nss_warning("%px: unable to register event handler for interface(%u)", nss_ctx, if_num); -+ return NULL; -+ } - - return nss_ctx; - } -@@ -398,13 +402,17 @@ void nss_tls_notify_unregister(uint32_t - - BUG_ON(!nss_ctx); - -- ret = nss_core_unregister_handler(nss_ctx, if_num); -+ ret = nss_core_unregister_msg_handler(nss_ctx, if_num); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: unable to un register event handler for interface(%u)", nss_ctx, if_num); -+ nss_warning("%px: unable to un register event handler for interface(%u)", nss_ctx, if_num); - return; - } - -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ ret = nss_core_unregister_handler(nss_ctx, if_num); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to un register event handler for interface(%u)", nss_ctx, if_num); -+ return; -+ } - - return; - } -@@ -426,12 +434,12 @@ struct nss_ctx_instance *nss_tls_registe - uint32_t ret; - - if (!nss_tls_verify_ifnum(nss_ctx, if_num)) { -- nss_warning("%p: TLS Interface is not dynamic:%u", nss_ctx, if_num); -+ nss_warning("%px: TLS Interface is not dynamic:%u", nss_ctx, if_num); - return NULL; - } - - if (nss_ctx->subsys_dp_register[if_num].ndev) { -- nss_warning("%p: Cannot find free slot for TLS NSS I/F:%u", nss_ctx, if_num); -+ nss_warning("%px: Cannot find free slot for TLS NSS I/F:%u", nss_ctx, if_num); - return NULL; - } - -@@ -440,11 +448,16 @@ struct nss_ctx_instance *nss_tls_registe - - ret = nss_core_register_handler(nss_ctx, if_num, nss_tls_handler, app_data); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: unable to register event handler for interface(%u)", nss_ctx, if_num); -+ nss_warning("%px: unable to register event handler for interface(%u)", nss_ctx, if_num); - return NULL; - } - -- nss_top_main.if_rx_msg_callback[if_num] = ev_cb; -+ ret = nss_core_register_msg_handler(nss_ctx, if_num, ev_cb); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, if_num); -+ nss_warning("%px: unable to register event handler for interface(%u)", nss_ctx, if_num); -+ return NULL; -+ } - - /* - * Atomically set the bitmap for the interface number -@@ -461,9 +474,10 @@ EXPORT_SYMBOL(nss_tls_register_if); - void nss_tls_unregister_if(uint32_t if_num) - { - struct nss_ctx_instance *nss_ctx = nss_tls_get_context(); -+ uint32_t ret; - - if (!nss_ctx->subsys_dp_register[if_num].ndev) { -- nss_warning("%p: Cannot find registered netdev for TLS NSS I/F:%u", nss_ctx, if_num); -+ nss_warning("%px: Cannot find registered netdev for TLS NSS I/F:%u", nss_ctx, if_num); - return; - } - -@@ -472,8 +486,13 @@ void nss_tls_unregister_if(uint32_t if_n - */ - clear_bit(if_num, tls_pvt.if_map); - -+ ret = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (ret != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to un register event handler for interface(%u)", nss_ctx, if_num); -+ return; -+ } -+ - nss_core_unregister_handler(nss_ctx, if_num); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; - - nss_core_unregister_subsys_dp(nss_ctx, if_num); - } ---- a/nss_tls_log.c -+++ b/nss_tls_log.c -@@ -63,7 +63,7 @@ static int8_t *nss_tls_log_error_respons - */ - static void nss_tls_node_config_msg(struct nss_tls_msg *ntm) - { -- nss_trace("%p: NSS TLS Node Configure Message:\n" -+ nss_trace("%px: NSS TLS Node Configure Message:\n" - "TLS Interface: %d\n", ntm, ntm->cm.interface); - } - -@@ -74,7 +74,7 @@ static void nss_tls_node_config_msg(stru - static void nss_tls_ctx_config_msg(struct nss_tls_msg *ntm) - { - struct nss_tls_ctx_config *ntccm __maybe_unused = &ntm->msg.ctx_cfg; -- nss_trace("%p: NSS TLS Context Configure Message:\n" -+ nss_trace("%px: NSS TLS Context Configure Message:\n" - "TLS Except if_num: %d\n", - ntccm, ntccm->except_ifnum); - } -@@ -86,7 +86,7 @@ static void nss_tls_ctx_config_msg(struc - static void nss_tls_cipher_update_msg(struct nss_tls_msg *ntm) - { - struct nss_tls_cipher_update *ntcum __maybe_unused = &ntm->msg.cipher_update; -- nss_trace("%p: NSS TLS Cipher Update message\n" -+ nss_trace("%px: NSS TLS Cipher Update message\n" - "TLS crypto index: %d\n", - ntcum, ntcum->crypto_idx); - } -@@ -111,7 +111,7 @@ static void nss_tls_log_verbose(struct n - break; - - default: -- nss_warning("%p: Invalid message type\n", ntm); -+ nss_warning("%px: Invalid message type\n", ntm); - break; - } - } -@@ -123,11 +123,11 @@ static void nss_tls_log_verbose(struct n - void nss_tls_log_tx_msg(struct nss_tls_msg *ntm) - { - if (ntm->cm.type >= NSS_TLS_MSG_MAX) { -- nss_warning("%p: Invalid message type\n", ntm); -+ nss_warning("%px: Invalid message type\n", ntm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ntm, ntm->cm.type, nss_tls_log_message_types_str[ntm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ntm, ntm->cm.type, nss_tls_log_message_types_str[ntm->cm.type]); - nss_tls_log_verbose(ntm); - } - -@@ -138,26 +138,26 @@ void nss_tls_log_tx_msg(struct nss_tls_m - void nss_tls_log_rx_msg(struct nss_tls_msg *ntm) - { - if (ntm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ntm); -+ nss_warning("%px: Invalid response\n", ntm); - return; - } - - if (ntm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ntm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type, - nss_tls_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response]); - goto verbose; - } - - if (ntm->cm.error >= NSS_TLS_ERROR_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ntm, ntm->cm.type, nss_tls_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response], - ntm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ntm, ntm->cm.type, nss_tls_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response], - ntm->cm.error, nss_tls_log_error_response_types_str[ntm->cm.error]); ---- a/nss_trustsec_tx.c -+++ b/nss_trustsec_tx.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2018, 2020 The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -31,7 +31,7 @@ static struct nss_trustsec_tx_pvt { - - /* - * nss_trustsec_tx_handler() -- * Handle NSS -> HLOS messages for trustsec_tx -+ * Handle NSS -> HLOS messages for trustsec_tx - */ - static void nss_trustsec_tx_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm, - __attribute__((unused))void *app_data) -@@ -49,13 +49,13 @@ static void nss_trustsec_tx_handler(stru - /* - * Is this a valid request/response packet? - */ -- if (ncm->type >= NSS_TRUSTSEC_TX_MAX_MSG_TYPE) { -- nss_warning("%p: received invalid message %d for trustsec_tx interface", nss_ctx, ncm->type); -+ if (ncm->type >= NSS_TRUSTSEC_TX_MSG_MAX) { -+ nss_warning("%px: received invalid message %d for trustsec_tx interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_trustsec_tx_msg)) { -- nss_warning("%p: message size incorrect: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: message size incorrect: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -65,7 +65,7 @@ static void nss_trustsec_tx_handler(stru - nss_core_log_msg_failures(nss_ctx, ncm); - - switch (ncm->type) { -- case NSS_TRUSTSEC_TX_STATS_SYNC_MSG: -+ case NSS_TRUSTSEC_TX_MSG_STATS_SYNC: - /* - * Update trustsec_tx statistics. - */ -@@ -78,7 +78,7 @@ static void nss_trustsec_tx_handler(stru - * to the same callback/app_data. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev; - } - -@@ -99,7 +99,7 @@ static void nss_trustsec_tx_handler(stru - - /* - * nss_trustsec_tx_msg() -- * Transmit a trustsec_tx message to NSSFW -+ * Transmit a trustsec_tx message to NSSFW - */ - nss_tx_status_t nss_trustsec_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_trustsec_tx_msg *msg) - { -@@ -114,12 +114,12 @@ nss_tx_status_t nss_trustsec_tx_msg(stru - * Sanity check the message - */ - if (ncm->interface != NSS_TRUSTSEC_TX_INTERFACE) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - -- if (ncm->type > NSS_TRUSTSEC_TX_MAX_MSG_TYPE) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ if (ncm->type > NSS_TRUSTSEC_TX_MSG_MAX) { -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -160,14 +160,14 @@ nss_tx_status_t nss_trustsec_tx_msg_sync - - status = nss_trustsec_tx_msg(nss_ctx, msg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_trustsec_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: nss_trustsec_tx_msg failed\n", nss_ctx); - up(&ttx.sem); - return status; - } - - ret = wait_for_completion_timeout(&ttx.complete, msecs_to_jiffies(NSS_TRUSTSEC_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: trustsec_tx tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: trustsec_tx tx failed due to timeout\n", nss_ctx); - ttx.response = NSS_TX_FAILURE; - } - -@@ -200,28 +200,55 @@ void nss_trustsec_tx_msg_init(struct nss - EXPORT_SYMBOL(nss_trustsec_tx_msg_init); - - /* -+ * nss_trustsec_tx_update_nexthop() -+ */ -+nss_tx_status_t nss_trustsec_tx_update_nexthop(uint32_t src, uint32_t dest, uint16_t sgt) -+{ -+ struct nss_ctx_instance *ctx = nss_trustsec_tx_get_ctx(); -+ struct nss_trustsec_tx_msg ttx_msg = {{0}}; -+ struct nss_trustsec_tx_update_nexthop_msg *ttxunh; -+ nss_tx_status_t status; -+ -+ ttxunh = &ttx_msg.msg.upd_nexthop; -+ ttxunh->src = src; -+ ttxunh->dest = dest; -+ ttxunh->sgt = sgt; -+ -+ nss_trustsec_tx_msg_init(&ttx_msg, NSS_TRUSTSEC_TX_INTERFACE, NSS_TRUSTSEC_TX_MSG_UPDATE_NEXTHOP, -+ sizeof(*ttxunh), NULL, NULL); -+ -+ BUG_ON(in_atomic()); -+ status = nss_trustsec_tx_msg_sync(ctx, &ttx_msg); -+ if (status != NSS_TX_SUCCESS) { -+ nss_warning("%px: configure trustsec_tx failed: %d\n", ctx, status); -+ } -+ -+ return status; -+} -+EXPORT_SYMBOL(nss_trustsec_tx_update_nexthop); -+ -+/* - * nss_trustsec_tx_configure_sgt() - */ - nss_tx_status_t nss_trustsec_tx_configure_sgt(uint32_t src, uint32_t dest, uint16_t sgt) - { - struct nss_ctx_instance *ctx = nss_trustsec_tx_get_ctx(); -- struct nss_trustsec_tx_msg ttx_msg; -+ struct nss_trustsec_tx_msg ttx_msg = {{0}}; - struct nss_trustsec_tx_configure_msg *ttxcfg; - nss_tx_status_t status; - -- memset(&ttx_msg, 0, sizeof(struct nss_trustsec_tx_msg)); - ttxcfg = &ttx_msg.msg.configure; - ttxcfg->src = src; - ttxcfg->dest = dest; - ttxcfg->sgt = sgt; - -- nss_trustsec_tx_msg_init(&ttx_msg, NSS_TRUSTSEC_TX_INTERFACE, NSS_TRUSTSEC_TX_CONFIGURE_MSG, -- sizeof(struct nss_trustsec_tx_configure_msg), -- NULL, NULL); -+ nss_trustsec_tx_msg_init(&ttx_msg, NSS_TRUSTSEC_TX_INTERFACE, NSS_TRUSTSEC_TX_MSG_CONFIGURE, -+ sizeof(*ttxcfg), NULL, NULL); - -+ BUG_ON(in_atomic()); - status = nss_trustsec_tx_msg_sync(ctx, &ttx_msg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: configure trustsec_tx failed: %d\n", ctx, status); -+ nss_warning("%px: configure trustsec_tx failed: %d\n", ctx, status); - } - - return status; -@@ -234,22 +261,21 @@ EXPORT_SYMBOL(nss_trustsec_tx_configure_ - nss_tx_status_t nss_trustsec_tx_unconfigure_sgt(uint32_t src, uint16_t sgt) - { - struct nss_ctx_instance *ctx = nss_trustsec_tx_get_ctx(); -- struct nss_trustsec_tx_msg ttx_msg; -+ struct nss_trustsec_tx_msg ttx_msg = {{0}}; - struct nss_trustsec_tx_unconfigure_msg *ttxucfg; - nss_tx_status_t status; - -- memset(&ttx_msg, 0, sizeof(struct nss_trustsec_tx_msg)); - ttxucfg = &ttx_msg.msg.unconfigure; - ttxucfg->src = src; - ttxucfg->sgt = sgt; - -- nss_trustsec_tx_msg_init(&ttx_msg, NSS_TRUSTSEC_TX_INTERFACE, NSS_TRUSTSEC_TX_UNCONFIGURE_MSG, -- sizeof(struct nss_trustsec_tx_unconfigure_msg), -- NULL, NULL); -+ nss_trustsec_tx_msg_init(&ttx_msg, NSS_TRUSTSEC_TX_INTERFACE, NSS_TRUSTSEC_TX_MSG_UNCONFIGURE, -+ sizeof(*ttxucfg), NULL, NULL); - -+ BUG_ON(in_atomic()); - status = nss_trustsec_tx_msg_sync(ctx, &ttx_msg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: unconfigure trustsec_tx failed: %d\n", ctx, status); -+ nss_warning("%px: unconfigure trustsec_tx failed: %d\n", ctx, status); - } - - return status; ---- a/nss_trustsec_tx_log.c -+++ b/nss_trustsec_tx_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020 The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -25,10 +25,11 @@ - * nss_trustsec_tx_log_message_types_str - * TRUSTSEC_TX message strings - */ --static int8_t *nss_trustsec_tx_log_message_types_str[NSS_TRUSTSEC_TX_MAX_MSG_TYPE] __maybe_unused = { -+static int8_t *nss_trustsec_tx_log_message_types_str[NSS_TRUSTSEC_TX_MSG_MAX] __maybe_unused = { - "TRUSTSEC_TX Configure Message", - "TRUSTSEC_TX Unconfigure Message", - "TRUSTSEC_TX Stats Sync", -+ "TRUSTSEC_TX Update next Hop", - }; - - /* -@@ -40,6 +41,7 @@ static int8_t *nss_trustsec_tx_log_error - "TRUSTSEC_TX Reconfigure Source Interface" - "TRUSTSEC_TX Destination Interface Not Found", - "TRUSTSEC_TX Not Configured", -+ "TRUSTSEC_TX SGT Mismatch", - "TRUSTSEC_TX Unknown Error", - }; - -@@ -50,7 +52,7 @@ static int8_t *nss_trustsec_tx_log_error - static void nss_trustsec_tx_log_configure_msg(struct nss_trustsec_tx_msg *ntm) - { - struct nss_trustsec_tx_configure_msg *ntcm __maybe_unused = &ntm->msg.configure; -- nss_trace("%p: NSS TRUSTSEC_TX Configure Message:\n" -+ nss_trace("%px: NSS TRUSTSEC_TX Configure Message:\n" - "TRUSTSEC_TX Source: %d\n" - "TRUSTSEC_TX Destination: %d\n" - "TRUSTSEC_TX Security Group Tag: %d\n", -@@ -65,35 +67,54 @@ static void nss_trustsec_tx_log_configur - static void nss_trustsec_tx_log_unconfigure_msg(struct nss_trustsec_tx_msg *ntm) - { - struct nss_trustsec_tx_unconfigure_msg *ntcm __maybe_unused = &ntm->msg.unconfigure; -- nss_trace("%p: NSS TRUSTSEC_TX Unconfigure Message:\n" -+ nss_trace("%px: NSS TRUSTSEC_TX Unconfigure Message:\n" - "TRUSTSEC_TX Source: %d\n" - "TRUSTSEC_TX Security Group Tag: %d\n", - ntcm, ntcm->src, ntcm->sgt); - } - - /* -+ * nss_trustsec_tx_log_update_nexthop_msg() -+ * Log NSS TRUSTSEC_TX update nexthop message. -+ */ -+static void nss_trustsec_tx_log_update_nexthop_msg(struct nss_trustsec_tx_msg *ntm) -+{ -+ struct nss_trustsec_tx_update_nexthop_msg *ntunm __maybe_unused = &ntm->msg.upd_nexthop; -+ nss_trace("%px: NSS TRUSTSEC_TX Update Next Hop Message:\n" -+ "TRUSTSEC_TX Source: %d\n" -+ "TRUSTSEC_TX Destination: %d\n" -+ "TRUSTSEC_TX Security Group Tag: %d\n", -+ ntunm, ntunm->src, -+ ntunm->dest, ntunm->sgt); -+} -+ -+/* - * nss_trustsec_tx_log_verbose() - * Log message contents. - */ - static void nss_trustsec_tx_log_verbose(struct nss_trustsec_tx_msg *ntm) - { - switch (ntm->cm.type) { -- case NSS_TRUSTSEC_TX_CONFIGURE_MSG: -+ case NSS_TRUSTSEC_TX_MSG_CONFIGURE: - nss_trustsec_tx_log_configure_msg(ntm); - break; - -- case NSS_TRUSTSEC_TX_UNCONFIGURE_MSG: -+ case NSS_TRUSTSEC_TX_MSG_UNCONFIGURE: - nss_trustsec_tx_log_unconfigure_msg(ntm); - break; - -- case NSS_TRUSTSEC_TX_STATS_SYNC_MSG: -+ case NSS_TRUSTSEC_TX_MSG_UPDATE_NEXTHOP: -+ nss_trustsec_tx_log_update_nexthop_msg(ntm); -+ break; -+ -+ case NSS_TRUSTSEC_TX_MSG_STATS_SYNC: - /* - * No log for valid stats message. - */ - break; - - default: -- nss_warning("%p: Invalid message type\n", ntm); -+ nss_warning("%px: Invalid message type\n", ntm); - break; - } - } -@@ -104,12 +125,12 @@ static void nss_trustsec_tx_log_verbose( - */ - void nss_trustsec_tx_log_tx_msg(struct nss_trustsec_tx_msg *ntm) - { -- if (ntm->cm.type >= NSS_TRUSTSEC_TX_MAX_MSG_TYPE) { -- nss_warning("%p: Invalid message type\n", ntm); -+ if (ntm->cm.type >= NSS_TRUSTSEC_TX_MSG_MAX) { -+ nss_warning("%px: Invalid message type\n", ntm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ntm, ntm->cm.type, nss_trustsec_tx_log_message_types_str[ntm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ntm, ntm->cm.type, nss_trustsec_tx_log_message_types_str[ntm->cm.type]); - nss_trustsec_tx_log_verbose(ntm); - } - -@@ -120,26 +141,26 @@ void nss_trustsec_tx_log_tx_msg(struct n - void nss_trustsec_tx_log_rx_msg(struct nss_trustsec_tx_msg *ntm) - { - if (ntm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ntm); -+ nss_warning("%px: Invalid response\n", ntm); - return; - } - - if (ntm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ntm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type, - nss_trustsec_tx_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response]); - goto verbose; - } - - if (ntm->cm.error >= NSS_TRUSTSEC_TX_ERR_UNKNOWN) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ntm, ntm->cm.type, nss_trustsec_tx_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response], - ntm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ntm, ntm->cm.type, nss_trustsec_tx_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response], - ntm->cm.error, nss_trustsec_tx_log_error_response_types_str[ntm->cm.error]); ---- a/nss_tstamp.c -+++ b/nss_tstamp.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -80,7 +80,6 @@ static bool nss_tstamp_verify_if_num(uin - return (if_num == NSS_TSTAMP_TX_INTERFACE) || (if_num == NSS_TSTAMP_RX_INTERFACE); - } - -- - /* - * nss_tstamp_interface_handler() - * Handle NSS -> HLOS messages for TSTAMP Statistics -@@ -92,7 +91,7 @@ static void nss_tstamp_interface_handler - nss_tstamp_msg_callback_t cb; - - if (!nss_tstamp_verify_if_num(ncm->interface)) { -- nss_warning("%p: invalid interface %d for tstamp_tx", nss_ctx, ncm->interface); -+ nss_warning("%px: invalid interface %d for tstamp_tx", nss_ctx, ncm->interface); - return; - } - -@@ -100,12 +99,12 @@ static void nss_tstamp_interface_handler - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_TSTAMP_MSG_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for tstamp", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for tstamp", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_tstamp_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -119,7 +118,7 @@ static void nss_tstamp_interface_handler - nss_tstamp_stats_sync(nss_ctx, &ntm->msg.stats, ncm->interface); - break; - default: -- nss_warning("%p: Unknown message type %d", -+ nss_warning("%px: Unknown message type %d", - nss_ctx, ncm->type); - return; - } -@@ -208,7 +207,7 @@ static struct net_device *nss_tstamp_get - break; - - default: -- nss_warning("%p:could not get dev for the skb\n", skb); -+ nss_warning("%px:could not get dev for the skb\n", skb); - return NULL; - } - -@@ -322,7 +321,7 @@ nss_tx_status_t nss_tstamp_tx_buf(struct - char *align_data; - uint32_t hdr_sz; - -- nss_trace("%p: Tstamp If Tx packet, id:%d, data=%p", nss_ctx, NSS_TSTAMP_RX_INTERFACE, skb->data); -+ nss_trace("%px: Tstamp If Tx packet, id:%d, data=%px", nss_ctx, NSS_TSTAMP_RX_INTERFACE, skb->data); - - /* - * header size + alignment size -@@ -340,7 +339,7 @@ nss_tx_status_t nss_tstamp_tx_buf(struct - if (skb->end - skb->tail >= extra_head) - extra_tail = -extra_head; - if (pskb_expand_head(skb, extra_head, extra_tail, GFP_KERNEL)) { -- nss_trace("%p: expand head room failed", nss_ctx); -+ nss_trace("%px: expand head room failed", nss_ctx); - return NSS_TX_FAILURE; - } - } -@@ -356,7 +355,6 @@ nss_tx_status_t nss_tstamp_tx_buf(struct - } - EXPORT_SYMBOL(nss_tstamp_tx_buf); - -- - /* - * nss_tstamp_register_netdev() - * register dummy netdevice for tstamp interface ---- a/nss_tun6rd.c -+++ b/nss_tun6rd.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -39,12 +39,12 @@ static void nss_tun6rd_handler(struct ns - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_TUN6RD_MAX) { -- nss_warning("%p: received invalid message %d for Tun6RD interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for Tun6RD interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_tun6rd_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -78,7 +78,7 @@ static void nss_tun6rd_handler(struct ns - * call 6rd tunnel callback - */ - if (!ctx) { -- nss_warning("%p: Event received for 6rd tunnel interface %d before registration", nss_ctx, ncm->interface); -+ nss_warning("%px: Event received for 6rd tunnel interface %d before registration", nss_ctx, ncm->interface); - return; - } - -@@ -102,12 +102,12 @@ nss_tx_status_t nss_tun6rd_tx(struct nss - * Sanity check the message - */ - if (!nss_is_dynamic_interface(ncm->interface)) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_TUN6RD_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - ---- a/nss_tun6rd_log.c -+++ b/nss_tun6rd_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -38,7 +38,7 @@ static int8_t *nss_tun6rd_log_message_ty - static void nss_tun6rd_log_attach_pnode_msg(struct nss_tun6rd_msg *ntm) - { - struct nss_tun6rd_attach_tunnel_msg *ntam __maybe_unused = &ntm->msg.tunnel; -- nss_trace("%p: NSS TUN6RD Attach Tunnel message \n" -+ nss_trace("%px: NSS TUN6RD Attach Tunnel message \n" - "TUN6RD Source Address: %pI4\n" - "TUN6RD Destination Address: %pI4\n" - "TUN6RD Type of Service: %d\n" -@@ -56,7 +56,7 @@ static void nss_tun6rd_log_attach_pnode_ - static void nss_tun6rd_log_set_peer_msg(struct nss_tun6rd_msg *ntm) - { - struct nss_tun6rd_set_peer_msg *ntspm __maybe_unused = &ntm->msg.peer; -- nss_trace("%p: NSS TUN6RD Set Peer message \n" -+ nss_trace("%px: NSS TUN6RD Set Peer message \n" - "TUN6RD IPv6 Address: %pI6\n" - "TUN6RD Destination: %pI4\n", - ntspm, ntspm->ipv6_address, -@@ -85,7 +85,7 @@ static void nss_tun6rd_log_verbose(struc - break; - - default: -- nss_trace("%p: Invalid message type\n", ntm); -+ nss_trace("%px: Invalid message type\n", ntm); - break; - } - } -@@ -97,11 +97,11 @@ static void nss_tun6rd_log_verbose(struc - void nss_tun6rd_log_tx_msg(struct nss_tun6rd_msg *ntm) - { - if (ntm->cm.type >= NSS_TUN6RD_MAX) { -- nss_warning("%p: Invalid message type\n", ntm); -+ nss_warning("%px: Invalid message type\n", ntm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ntm, ntm->cm.type, nss_tun6rd_log_message_types_str[ntm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ntm, ntm->cm.type, nss_tun6rd_log_message_types_str[ntm->cm.type]); - nss_tun6rd_log_verbose(ntm); - } - -@@ -112,18 +112,18 @@ void nss_tun6rd_log_tx_msg(struct nss_tu - void nss_tun6rd_log_rx_msg(struct nss_tun6rd_msg *ntm) - { - if (ntm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ntm); -+ nss_warning("%px: Invalid response\n", ntm); - return; - } - - if (ntm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ntm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type, - nss_tun6rd_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - ntm, ntm->cm.type, nss_tun6rd_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response]); - ---- a/nss_tunipip6.c -+++ b/nss_tunipip6.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -17,6 +17,19 @@ - #include "nss_tx_rx_common.h" - #include "nss_tunipip6_log.h" - -+#define NSS_TUNIPIP6_TX_TIMEOUT 3000 -+ -+/* -+ * Data structure used to handle sync message. -+ */ -+static struct nss_tunipip6_pvt { -+ struct semaphore sem; /* Semaphore structure. */ -+ struct completion complete; /* Completion structure. */ -+ int response; /* Response from FW. */ -+ void *cb; /* Original cb for msgs. */ -+ void *app_data; /* Original app_data for msgs. */ -+} tunipip6_pvt; -+ - /* - * nss_tunipip6_verify_if_num - * Verify the interface is a valid interface -@@ -57,12 +70,12 @@ static void nss_tunipip6_handler(struct - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_TUNIPIP6_MAX) { -- nss_warning("%p: received invalid message %d for DS-Lite interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for DS-Lite interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_tunipip6_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -96,7 +109,7 @@ static void nss_tunipip6_handler(struct - * call ipip6 tunnel callback - */ - if (!ctx) { -- nss_warning("%p: Event received for DS-Lite tunnel interface %d before registration", nss_ctx, ncm->interface); -+ nss_warning("%px: Event received for DS-Lite tunnel interface %d before registration", nss_ctx, ncm->interface); - return; - } - -@@ -120,12 +133,12 @@ nss_tx_status_t nss_tunipip6_tx(struct n - * Sanity check the message - */ - if (!nss_tunipip6_verify_if_num(ncm->interface)) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_TUNIPIP6_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -134,6 +147,60 @@ nss_tx_status_t nss_tunipip6_tx(struct n - EXPORT_SYMBOL(nss_tunipip6_tx); - - /* -+ * nss_tunipip6_callback() -+ * Callback to handle the completion of NSS->HLOS messages. -+ */ -+static void nss_tunipip6_callback(void *app_data, struct nss_tunipip6_msg *nclm) -+{ -+ tunipip6_pvt.response = NSS_TX_SUCCESS; -+ tunipip6_pvt.cb = NULL; -+ tunipip6_pvt.app_data = NULL; -+ -+ if (nclm->cm.response != NSS_CMN_RESPONSE_ACK) { -+ nss_warning("%px: tunipip6 Error response %d Error: %d\n", app_data, nclm->cm.response, nclm->cm.error); -+ tunipip6_pvt.response = nclm->cm.response; -+ } -+ -+ /* -+ * Write memory barrier. -+ */ -+ smp_wmb(); -+ complete(&tunipip6_pvt.complete); -+} -+ -+/* -+ * nss_tunipip6_tx_sync() -+ * Transmit a tunipip6 message to NSSFW synchronously. -+ */ -+nss_tx_status_t nss_tunipip6_tx_sync(struct nss_ctx_instance *nss_ctx, struct nss_tunipip6_msg *msg) -+{ -+ nss_tx_status_t status; -+ int ret; -+ -+ down(&tunipip6_pvt.sem); -+ msg->cm.cb = (nss_ptr_t)nss_tunipip6_callback; -+ msg->cm.app_data = (nss_ptr_t)NULL; -+ -+ status = nss_tunipip6_tx(nss_ctx, msg); -+ if (status != NSS_TX_SUCCESS) { -+ nss_warning("%px: tunipip6_tx_msg failed\n", nss_ctx); -+ up(&tunipip6_pvt.sem); -+ return status; -+ } -+ -+ ret = wait_for_completion_timeout(&tunipip6_pvt.complete, msecs_to_jiffies(NSS_TUNIPIP6_TX_TIMEOUT)); -+ if (!ret) { -+ nss_warning("%px: tunipip6 tx sync failed due to timeout\n", nss_ctx); -+ tunipip6_pvt.response = NSS_TX_FAILURE; -+ } -+ -+ status = tunipip6_pvt.response; -+ up(&tunipip6_pvt.sem); -+ return status; -+} -+EXPORT_SYMBOL(nss_tunipip6_tx_sync); -+ -+/* - * ********************************** - * Register/Unregister/Miscellaneous APIs - * ********************************** -@@ -197,6 +264,8 @@ void nss_tunipip6_register_handler() - struct nss_ctx_instance *nss_ctx = nss_tunipip6_get_context(); - - nss_core_register_handler(nss_ctx, NSS_TUNIPIP6_INTERFACE, nss_tunipip6_handler, NULL); -+ sema_init(&tunipip6_pvt.sem, 1); -+ init_completion(&tunipip6_pvt.complete); - } - - /* ---- a/nss_tunipip6_log.c -+++ b/nss_tunipip6_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -26,47 +26,63 @@ - * NSS TUNIPIP6 message strings - */ - static int8_t *nss_tunipip6_log_message_types_str[NSS_TUNIPIP6_MAX] __maybe_unused = { -- "TUNIPIP6 Interface Create", -+ "TUNIPIP6 Encap Interface Create", -+ "TUNIPIP6 Decap Interface Create", - "TUNIPIP6 Stats", -+ "TUNIPIP6 FMR add", -+ "TUNIPIP6 FMR delete", -+ "TUNIPIP6 FMR flush", -+ "TUNIPIP6 BMR add", -+ "TUNIPIP6 BMR delete", - }; - - /* -+ * nss_tunipip6_log_map_rule() -+ * Log NSS TUNIPIP6 map rule. -+ */ -+static void nss_tunipip6_log_map_rule(struct nss_tunipip6_msg *ntm) -+{ -+ struct nss_tunipip6_map_rule *nmr __maybe_unused = &ntm->msg.map_rule; -+ nss_trace("%px: NSS TUNIPIP6 Interface Create message \n" -+ "TUNIPIP6 Map Rule IPv6 prefix: %pI6\n" -+ "TUNIPIP6 Map Rule IPv6 prefix length: %d\n" -+ "TUNIPIP6 Map Rule IPv4 prefix: %pI4\n" -+ "TUNIPIP6 Map Rule IPv4 prefix length: %d\n" -+ "TUNIPIP6 Map Rule IPv6 suffix: %pI6\n" -+ "TUNIPIP6 Map Rule IPv6 suffix length: %d\n" -+ "TUNIPIP6 Map Rule EA length: %d\n" -+ "TUNIPIP6 Map Rule PSID offset: %d\n", -+ nmr, nmr->ip6_prefix, -+ nmr->ip6_prefix_len,&nmr->ip4_prefix, -+ nmr->ip4_prefix_len, nmr->ip6_suffix, -+ nmr->ip6_suffix_len, nmr->ea_len, -+ nmr->psid_offset); -+} -+ -+/* - * nss_tunipip6_log_if_create_msg() - * Log NSS TUNIPIP6 Interface Create - */ - static void nss_tunipip6_log_if_create_msg(struct nss_tunipip6_msg *ntm) - { - struct nss_tunipip6_create_msg *ntcm __maybe_unused = &ntm->msg.tunipip6_create; -- int32_t i; -- nss_trace("%p: NSS TUNIPIP6 Interface Create message \n" -+ nss_trace("%px: NSS TUNIPIP6 Interface Create message \n" - "TUNIPIP6 Source Address: %pI6\n" - "TUNIPIP6 Destination Address: %pI6\n" - "TUNIPIP6 Flow Label: %d\n" - "TUNIPIP6 Flags: %d\n" - "TUNIPIP6 Hop Limit: %d\n" - "TUNIPIP6 Draft03 Specification: %d\n" -- "TUNIPIP6 FMR Number: %d\n", -+ "TUNIPIP6 TTL inherit: %s\n" -+ "TUNIPIP6 TOS inherit: %s\n" -+ "TUNIPIP6 Frag ID Update: %s\n", - ntcm, ntcm->saddr, - ntcm->daddr, ntcm->flowlabel, - ntcm->flags, ntcm->hop_limit, -- ntcm->draft03, ntcm->fmr_number); -- /* -- * Continuation of the log. -- */ -- for (i = 0; i < NSS_TUNIPIP6_MAX_FMR_NUMBER; i++) { -- nss_trace("TUNIPIP6 FMR[%d] IPv6 Prefix: %pI6\n" -- "TUNIPIP6 FMR[%d] IPv4 Prefix: %pI4\n" -- "TUNIPIP6 FMR[%d] IPv6 Prefix Length: %d\n" -- "TUNIPIP6 FMR[%d] IPv4 Prefix Length: %d\n" -- "TUNIPIP6 FMR[%d] Embedded Address Length: %d\n" -- "TUNIPIP6 FMR[%d] offset: %d", -- i, ntcm->fmr[i].ip6_prefix, -- i, &ntcm->fmr[i].ip4_prefix, -- i, ntcm->fmr[i].ip6_prefix_len, -- i, ntcm->fmr[i].ip4_prefix_len, -- i, ntcm->fmr[i].ea_len, -- i, ntcm->fmr[i].offset); -- } -+ ntcm->draft03, -+ ntcm->ttl_inherit ? "true":"false", -+ ntcm->tos_inherit ? "true":"false", -+ ntcm->frag_id_update ? "true":"false"); - } - - /* -@@ -87,8 +103,17 @@ static void nss_tunipip6_log_verbose(str - */ - break; - -+ case NSS_TUNIPIP6_BMR_RULE_ADD: -+ case NSS_TUNIPIP6_BMR_RULE_DEL: -+ case NSS_TUNIPIP6_FMR_RULE_ADD: -+ case NSS_TUNIPIP6_FMR_RULE_DEL: -+ nss_tunipip6_log_map_rule(ntm); -+ break; -+ case NSS_TUNIPIP6_FMR_RULE_FLUSH: -+ nss_trace("%px: FMR rule flush.\n", ntm); -+ break; - default: -- nss_trace("%p: Invalid message type\n", ntm); -+ nss_trace("%px: Invalid message type\n", ntm); - break; - } - } -@@ -100,11 +125,11 @@ static void nss_tunipip6_log_verbose(str - void nss_tunipip6_log_tx_msg(struct nss_tunipip6_msg *ntm) - { - if (ntm->cm.type >= NSS_TUNIPIP6_MAX) { -- nss_warning("%p: Invalid message type\n", ntm); -+ nss_warning("%px: Invalid message type\n", ntm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ntm, ntm->cm.type, nss_tunipip6_log_message_types_str[ntm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ntm, ntm->cm.type, nss_tunipip6_log_message_types_str[ntm->cm.type]); - nss_tunipip6_log_verbose(ntm); - } - -@@ -115,18 +140,18 @@ void nss_tunipip6_log_tx_msg(struct nss_ - void nss_tunipip6_log_rx_msg(struct nss_tunipip6_msg *ntm) - { - if (ntm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ntm); -+ nss_warning("%px: Invalid response\n", ntm); - return; - } - - if (ntm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ntm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type, - nss_tunipip6_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - ntm, ntm->cm.type, nss_tunipip6_log_message_types_str[ntm->cm.type], - ntm->cm.response, nss_cmn_response_str[ntm->cm.response]); - ---- a/nss_tx_msg_sync.c -+++ b/nss_tx_msg_sync.c -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above -@@ -101,7 +101,7 @@ static nss_tx_status_t nss_tx_msg_sync_i - status = tx_msg_async_with_size(nss_ctx, ncm, msg_buf_size); - - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Tx msg async failed\n", nss_ctx); -+ nss_warning("%px: Tx msg async failed\n", nss_ctx); - return status; - } - -@@ -110,7 +110,7 @@ static nss_tx_status_t nss_tx_msg_sync_i - */ - ret = wait_for_completion_timeout(&sync_data->complete, msecs_to_jiffies(timeout)); - if (!ret) { -- nss_warning("%p: Tx msg sync timeout\n", nss_ctx); -+ nss_warning("%px: Tx msg sync timeout\n", nss_ctx); - return NSS_TX_FAILURE_SYNC_TIMEOUT; - } - -@@ -144,7 +144,7 @@ nss_tx_status_t nss_tx_msg_sync(struct n - * Check Tx msg async API - */ - if (!unlikely(tx_msg_async)) { -- nss_warning("%p: missing Tx msg async API\n", nss_ctx); -+ nss_warning("%px: missing Tx msg async API\n", nss_ctx); - return NSS_TX_FAILURE_SYNC_BAD_PARAM; - } - -@@ -178,7 +178,7 @@ nss_tx_status_t nss_tx_msg_sync_with_siz - * Check Tx msg async API - */ - if (!unlikely(tx_msg_async_with_size)) { -- nss_warning("%p: missing Tx msg async API\n", nss_ctx); -+ nss_warning("%px: missing Tx msg async API\n", nss_ctx); - return NSS_TX_FAILURE_SYNC_BAD_PARAM; - } - ---- a/nss_unaligned.c -+++ b/nss_unaligned.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -57,12 +57,12 @@ static void nss_unaligned_msg_handler(st - * Sanity checks on message - */ - if (um->cm.type >= NSS_UNALIGNED_MSG_MAX) { -- nss_warning("%p: message type out of range: %d\n", nss_ctx, um->cm.type); -+ nss_warning("%px: message type out of range: %d\n", nss_ctx, um->cm.type); - return; - } - - if (nss_cmn_get_msg_len(&(um->cm)) > sizeof(struct nss_unaligned_msg)) { -- nss_warning("%p: message length is invalid: %d\n", nss_ctx, nss_cmn_get_msg_len(&(um->cm))); -+ nss_warning("%px: message length is invalid: %d\n", nss_ctx, nss_cmn_get_msg_len(&(um->cm))); - return; - } - ---- a/nss_unaligned_log.c -+++ b/nss_unaligned_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -43,7 +43,7 @@ static void nss_unaligned_log_verbose(st - break; - - default: -- nss_trace("%p: Invalid message type\n", um); -+ nss_trace("%px: Invalid message type\n", um); - break; - } - } -@@ -55,18 +55,18 @@ static void nss_unaligned_log_verbose(st - void nss_unaligned_log_rx_msg(struct nss_unaligned_msg *um) - { - if (um->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", um); -+ nss_warning("%px: Invalid response\n", um); - return; - } - - if (um->cm.response == NSS_CMN_RESPONSE_NOTIFY || (um->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", um, um->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", um, um->cm.type, - nss_unaligned_log_message_types_str[um->cm.type], - um->cm.response, nss_cmn_response_str[um->cm.response]); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", - um, um->cm.type, nss_unaligned_log_message_types_str[um->cm.type], - um->cm.response, nss_cmn_response_str[um->cm.response]); - ---- a/nss_virt_if.c -+++ b/nss_virt_if.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -77,7 +77,7 @@ static void nss_virt_if_msg_handler(stru - * Sanity check the message type - */ - if (ncm->type > NSS_VIRT_IF_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return; - } - -@@ -89,7 +89,7 @@ static void nss_virt_if_msg_handler(stru - } - - if (!nss_virt_if_verify_if_num(ncm->interface)) { -- nss_warning("%p: response for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: response for another interface: %d", nss_ctx, ncm->interface); - return; - } - -@@ -98,7 +98,7 @@ static void nss_virt_if_msg_handler(stru - spin_lock_bh(&nss_virt_if_lock); - if (!nss_virt_if_handle_t[if_num]) { - spin_unlock_bh(&nss_virt_if_lock); -- nss_warning("%p: virt_if handle is NULL\n", nss_ctx); -+ nss_warning("%px: virt_if handle is NULL\n", nss_ctx); - return; - } - -@@ -121,7 +121,7 @@ static void nss_virt_if_msg_handler(stru - * to the same callback/app_data. - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev; - } - -@@ -149,7 +149,7 @@ static void nss_virt_if_callback(void *a - struct nss_virt_if_pvt *nvip = handle->pvt; - - if (ncm->response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: virt_if Error response %d\n", handle->nss_ctx, ncm->response); -+ nss_warning("%px: virt_if Error response %d\n", handle->nss_ctx, ncm->response); - nvip->response = NSS_TX_FAILURE; - complete(&nvip->complete); - return; -@@ -175,7 +175,7 @@ static nss_tx_status_t nss_virt_if_tx_ms - - status = nss_virt_if_tx_msg(nss_ctx, nvim); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_virt_if_msg failed\n", nss_ctx); -+ nss_warning("%px: nss_virt_if_msg failed\n", nss_ctx); - up(&nwip->sem); - return status; - } -@@ -183,7 +183,7 @@ static nss_tx_status_t nss_virt_if_tx_ms - ret = wait_for_completion_timeout(&nwip->complete, - msecs_to_jiffies(NSS_VIRT_IF_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: virt_if tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: virt_if tx failed due to timeout\n", nss_ctx); - nwip->response = NSS_TX_FAILURE; - } - -@@ -220,7 +220,7 @@ static int nss_virt_if_handle_destroy_sy - int32_t index_h2n; - - if (!nss_virt_if_verify_if_num(if_num_n2h) || !nss_virt_if_verify_if_num(if_num_h2n)) { -- nss_warning("%p: bad interface numbers %d %d\n", handle->nss_ctx, if_num_n2h, if_num_h2n); -+ nss_warning("%px: bad interface numbers %d %d\n", handle->nss_ctx, if_num_n2h, if_num_h2n); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -229,13 +229,13 @@ static int nss_virt_if_handle_destroy_sy - - status = nss_dynamic_interface_dealloc_node(if_num_n2h, NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_N2H); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Dynamic interface destroy failed status %d\n", handle->nss_ctx, status); -+ nss_warning("%px: Dynamic interface destroy failed status %d\n", handle->nss_ctx, status); - return status; - } - - status = nss_dynamic_interface_dealloc_node(if_num_h2n, NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_H2N); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Dynamic interface destroy failed status %d\n", handle->nss_ctx, status); -+ nss_warning("%px: Dynamic interface destroy failed status %d\n", handle->nss_ctx, status); - return status; - } - -@@ -261,7 +261,7 @@ static struct nss_virt_if_handle *nss_vi - struct nss_virt_if_handle *handle; - - if (!nss_virt_if_verify_if_num(if_num_n2h) || !nss_virt_if_verify_if_num(if_num_h2n)) { -- nss_warning("%p: bad interface numbers %d %d\n", nss_ctx, if_num_n2h, if_num_h2n); -+ nss_warning("%px: bad interface numbers %d %d\n", nss_ctx, if_num_n2h, if_num_h2n); - return NULL; - } - -@@ -271,7 +271,7 @@ static struct nss_virt_if_handle *nss_vi - handle = (struct nss_virt_if_handle *)kzalloc(sizeof(struct nss_virt_if_handle), - GFP_KERNEL); - if (!handle) { -- nss_warning("%p: handle memory alloc failed\n", nss_ctx); -+ nss_warning("%px: handle memory alloc failed\n", nss_ctx); - *cmd_rsp = NSS_VIRT_IF_ALLOC_FAILURE; - goto error1; - } -@@ -282,7 +282,7 @@ static struct nss_virt_if_handle *nss_vi - handle->pvt = (struct nss_virt_if_pvt *)kzalloc(sizeof(struct nss_virt_if_pvt), - GFP_KERNEL); - if (!handle->pvt) { -- nss_warning("%p: failure allocating memory for nss_virt_if_pvt\n", nss_ctx); -+ nss_warning("%px: failure allocating memory for nss_virt_if_pvt\n", nss_ctx); - *cmd_rsp = NSS_VIRT_IF_ALLOC_FAILURE; - goto error2; - } -@@ -318,14 +318,14 @@ static uint32_t nss_virt_if_register_han - - ret = nss_core_register_handler(nss_ctx, if_num_n2h, nss_virt_if_msg_handler, NULL); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Failed to register message handler for redir_n2h interface %d\n", nss_ctx, if_num_n2h); -+ nss_warning("%px: Failed to register message handler for redir_n2h interface %d\n", nss_ctx, if_num_n2h); - return NSS_VIRT_IF_CORE_FAILURE; - } - - ret = nss_core_register_handler(nss_ctx, if_num_h2n, nss_virt_if_msg_handler, NULL); - if (ret != NSS_CORE_STATUS_SUCCESS) { - nss_core_unregister_handler(nss_ctx, if_num_n2h); -- nss_warning("%p: Failed to register message handler for redir_h2n interface %d\n", nss_ctx, if_num_h2n); -+ nss_warning("%px: Failed to register message handler for redir_h2n interface %d\n", nss_ctx, if_num_h2n); - return NSS_VIRT_IF_CORE_FAILURE; - } - -@@ -354,26 +354,26 @@ struct nss_virt_if_handle *nss_virt_if_c - int32_t if_num_n2h, if_num_h2n; - - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: Interface could not be created as core not ready\n", nss_ctx); -+ nss_warning("%px: Interface could not be created as core not ready\n", nss_ctx); - return NULL; - } - - if_num_n2h = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_N2H); - if (if_num_n2h < 0) { -- nss_warning("%p: failure allocating redir_n2h\n", nss_ctx); -+ nss_warning("%px: failure allocating redir_n2h\n", nss_ctx); - return NULL; - } - - if_num_h2n = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_H2N); - if (if_num_h2n < 0) { -- nss_warning("%p: failure allocating redir_h2n\n", nss_ctx); -+ nss_warning("%px: failure allocating redir_h2n\n", nss_ctx); - nss_dynamic_interface_dealloc_node(if_num_n2h, NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_N2H); - return NULL; - } - - handle = nss_virt_if_handle_create_sync(nss_ctx, if_num_n2h, if_num_h2n, &ret); - if (!handle) { -- nss_warning("%p: virt_if handle creation failed ret %d\n", nss_ctx, ret); -+ nss_warning("%px: virt_if handle creation failed ret %d\n", nss_ctx, ret); - nss_dynamic_interface_dealloc_node(if_num_n2h, NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_N2H); - nss_dynamic_interface_dealloc_node(if_num_h2n, NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_H2N); - return NULL; -@@ -384,7 +384,7 @@ struct nss_virt_if_handle *nss_virt_if_c - */ - ret = nss_virt_if_register_handler_sync(nss_ctx, handle); - if (ret != NSS_VIRT_IF_SUCCESS) { -- nss_warning("%p: Registration handler failed reason: %d\n", nss_ctx, ret); -+ nss_warning("%px: Registration handler failed reason: %d\n", nss_ctx, ret); - goto error1; - } - -@@ -399,7 +399,7 @@ struct nss_virt_if_handle *nss_virt_if_c - - ret = nss_virt_if_tx_msg_sync(handle, &nvim); - if (ret != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_virt_if_tx_msg_sync failed %u\n", nss_ctx, ret); -+ nss_warning("%px: nss_virt_if_tx_msg_sync failed %u\n", nss_ctx, ret); - goto error2; - } - -@@ -409,7 +409,7 @@ struct nss_virt_if_handle *nss_virt_if_c - - ret = nss_virt_if_tx_msg_sync(handle, &nvim); - if (ret != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_virt_if_tx_msg_sync failed %u\n", nss_ctx, ret); -+ nss_warning("%px: nss_virt_if_tx_msg_sync failed %u\n", nss_ctx, ret); - goto error2; - } - -@@ -483,14 +483,14 @@ nss_tx_status_t nss_virt_if_destroy_sync - nss_ctx = handle->nss_ctx; - - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: Interface could not be destroyed as core not ready\n", nss_ctx); -+ nss_warning("%px: Interface could not be destroyed as core not ready\n", nss_ctx); - return NSS_TX_FAILURE_NOT_READY; - } - - spin_lock_bh(&nss_top_main.lock); - if (!nss_ctx->subsys_dp_register[if_num_n2h].ndev || !nss_ctx->subsys_dp_register[if_num_h2n].ndev) { - spin_unlock_bh(&nss_top_main.lock); -- nss_warning("%p: Unregister virt interface %d %d: no context\n", nss_ctx, if_num_n2h, if_num_h2n); -+ nss_warning("%px: Unregister virt interface %d %d: no context\n", nss_ctx, if_num_n2h, if_num_h2n); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -503,19 +503,19 @@ nss_tx_status_t nss_virt_if_destroy_sync - - status = nss_virt_if_handle_destroy_sync(handle); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: handle destroy failed for if_num_n2h %d and if_num_h2n %d\n", nss_ctx, if_num_n2h, if_num_h2n); -+ nss_warning("%px: handle destroy failed for if_num_n2h %d and if_num_h2n %d\n", nss_ctx, if_num_n2h, if_num_h2n); - return NSS_TX_FAILURE; - } - - ret = nss_core_unregister_handler(nss_ctx, if_num_n2h); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Not able to unregister handler for redir_n2h interface %d with NSS core\n", nss_ctx, if_num_n2h); -+ nss_warning("%px: Not able to unregister handler for redir_n2h interface %d with NSS core\n", nss_ctx, if_num_n2h); - return NSS_TX_FAILURE_BAD_PARAM; - } - - ret = nss_core_unregister_handler(nss_ctx, if_num_h2n); - if (ret != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Not able to unregister handler for redir_h2n interface %d with NSS core\n", nss_ctx, if_num_h2n); -+ nss_warning("%px: Not able to unregister handler for redir_h2n interface %d with NSS core\n", nss_ctx, if_num_h2n); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -543,17 +543,17 @@ nss_tx_status_t nss_virt_if_tx_buf(struc - } - - if (!nss_virt_if_verify_if_num(if_num)) { -- nss_warning("%p: bad interface number %d\n", nss_ctx, if_num); -+ nss_warning("%px: bad interface number %d\n", nss_ctx, if_num); - return NSS_TX_FAILURE_BAD_PARAM; - } - -- nss_trace("%p: Virtual Rx packet, if_num:%d, skb:%p", nss_ctx, if_num, skb); -+ nss_trace("%px: Virtual Rx packet, if_num:%d, skb:%px", nss_ctx, if_num, skb); - - /* - * Sanity check the SKB to ensure that it's suitable for us - */ - if (unlikely(skb->len <= ETH_HLEN)) { -- nss_warning("%p: Virtual Rx packet: %p too short", nss_ctx, skb); -+ nss_warning("%px: Virtual Rx packet: %px too short", nss_ctx, skb); - return NSS_TX_FAILURE_TOO_SHORT; - } - -@@ -564,7 +564,8 @@ nss_tx_status_t nss_virt_if_tx_buf(struc - put_cpu(); - skb_set_queue_mapping(skb, cpu); - -- return nss_core_send_packet(nss_ctx, skb, if_num, H2N_BIT_FLAG_VIRTUAL_BUFFER); -+ return nss_core_send_packet(nss_ctx, skb, if_num, H2N_BIT_FLAG_VIRTUAL_BUFFER | -+ H2N_BIT_FLAG_BUFFER_REUSABLE); - } - EXPORT_SYMBOL(nss_virt_if_tx_buf); - -@@ -579,12 +580,12 @@ nss_tx_status_t nss_virt_if_tx_msg(struc - * Sanity check the message - */ - if (!nss_virt_if_verify_if_num(ncm->interface)) { -- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type > NSS_VIRT_IF_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -656,6 +657,7 @@ void nss_virt_if_register(struct nss_vir - { - struct nss_ctx_instance *nss_ctx; - int32_t if_num; -+ uint32_t status; - - if (!handle) { - nss_warning("handle is NULL\n"); -@@ -673,7 +675,11 @@ void nss_virt_if_register(struct nss_vir - if_num = handle->if_num_n2h; - - nss_core_register_subsys_dp(nss_ctx, if_num, data_callback, NULL, NULL, netdev, (uint32_t)netdev->features); -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to unregister event handler for interface(%u)", nss_ctx, if_num); -+ return; -+ } - } - EXPORT_SYMBOL(nss_virt_if_register); - -@@ -684,6 +690,7 @@ void nss_virt_if_unregister(struct nss_v - { - struct nss_ctx_instance *nss_ctx; - int32_t if_num; -+ uint32_t status; - - if (!handle) { - nss_warning("handle is NULL\n"); -@@ -702,7 +709,11 @@ void nss_virt_if_unregister(struct nss_v - - nss_core_unregister_subsys_dp(nss_ctx, if_num); - -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to unregister event handler for interface(%u)", nss_ctx, if_num); -+ return; -+ } - } - EXPORT_SYMBOL(nss_virt_if_unregister); - ---- a/nss_vlan.c -+++ b/nss_vlan.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2017-2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -76,12 +76,12 @@ static void nss_vlan_handler(struct nss_ - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_VLAN_MSG_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for vlan interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for vlan interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_vlan_msg)) { -- nss_warning("%p: length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -154,12 +154,12 @@ nss_tx_status_t nss_vlan_tx_msg(struct n - * Sanity check the message - */ - if (!nss_vlan_verify_if_num(ncm->interface)) { -- nss_warning("%p: tx request for interface that is not a vlan: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for interface that is not a vlan: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_VLAN_MSG_TYPE_MAX) { -- nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -185,14 +185,14 @@ nss_tx_status_t nss_vlan_tx_msg_sync(str - - status = nss_vlan_tx_msg(nss_ctx, nvm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: vlan_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: vlan_tx_msg failed\n", nss_ctx); - up(&vlan_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&vlan_pvt.complete, msecs_to_jiffies(NSS_VLAN_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: vlan msg tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: vlan msg tx failed due to timeout\n", nss_ctx); - vlan_pvt.response = NSS_TX_FAILURE; - } - -@@ -228,7 +228,7 @@ nss_tx_status_t nss_vlan_tx_set_mtu_msg( - } - - if (nss_vlan_verify_if_num(vlan_if_num) == false) { -- nss_warning("%p: received invalid interface %d", nss_ctx, vlan_if_num); -+ nss_warning("%px: received invalid interface %d", nss_ctx, vlan_if_num); - return NSS_TX_FAILURE; - } - -@@ -258,7 +258,7 @@ nss_tx_status_t nss_vlan_tx_set_mac_addr - } - - if (nss_vlan_verify_if_num(vlan_if_num) == false) { -- nss_warning("%p: received invalid interface %d", nss_ctx, vlan_if_num); -+ nss_warning("%px: received invalid interface %d", nss_ctx, vlan_if_num); - return NSS_TX_FAILURE; - } - -@@ -286,7 +286,7 @@ nss_tx_status_t nss_vlan_tx_vsi_attach_m - } - - if (nss_vlan_verify_if_num(vlan_if_num) == false) { -- nss_warning("%p: received invalid interface %d\n", nss_ctx, vlan_if_num); -+ nss_warning("%px: received invalid interface %d\n", nss_ctx, vlan_if_num); - return NSS_TX_FAILURE; - } - -@@ -313,7 +313,7 @@ nss_tx_status_t nss_vlan_tx_vsi_detach_m - } - - if (nss_vlan_verify_if_num(vlan_if_num) == false) { -- nss_warning("%p: received invalid interface %d\n", nss_ctx, vlan_if_num); -+ nss_warning("%px: received invalid interface %d\n", nss_ctx, vlan_if_num); - return NSS_TX_FAILURE; - } - -@@ -340,7 +340,7 @@ nss_tx_status_t nss_vlan_tx_add_tag_msg( - } - - if (nss_vlan_verify_if_num(vlan_if_num) == false) { -- nss_warning("%p: received invalid interface %d\n", nss_ctx, vlan_if_num); -+ nss_warning("%px: received invalid interface %d\n", nss_ctx, vlan_if_num); - return NSS_TX_FAILURE; - } - ---- a/nss_vlan_log.c -+++ b/nss_vlan_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -44,7 +44,7 @@ static int8_t *nss_vlan_log_error_respon - static void nss_vlan_log_add_tag_msg(struct nss_vlan_msg *nvm) - { - struct nss_vlan_msg_add_tag *nvtm __maybe_unused = &nvm->msg.add_tag; -- nss_trace("%p: NSS VLAN Add Tag Message:\n" -+ nss_trace("%px: NSS VLAN Add Tag Message:\n" - "VLAN Tag: %d\n" - "VLAN Next Hop: %d\n" - "VLAN Interface Number: %d\n", -@@ -64,7 +64,7 @@ static void nss_vlan_log_verbose(struct - break; - - default: -- nss_warning("%p: Invalid message type\n", nvm); -+ nss_warning("%px: Invalid message type\n", nvm); - break; - } - } -@@ -76,11 +76,11 @@ static void nss_vlan_log_verbose(struct - void nss_vlan_log_tx_msg(struct nss_vlan_msg *nvm) - { - if (nvm->cm.type >= NSS_VLAN_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", nvm); -+ nss_warning("%px: Invalid message type\n", nvm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nvm, nvm->cm.type, nss_vlan_log_message_types_str[nvm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nvm, nvm->cm.type, nss_vlan_log_message_types_str[nvm->cm.type]); - nss_vlan_log_verbose(nvm); - } - -@@ -91,26 +91,26 @@ void nss_vlan_log_tx_msg(struct nss_vlan - void nss_vlan_log_rx_msg(struct nss_vlan_msg *nvm) - { - if (nvm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nvm); -+ nss_warning("%px: Invalid response\n", nvm); - return; - } - - if (nvm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nvm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nvm, nvm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nvm, nvm->cm.type, - nss_vlan_log_message_types_str[nvm->cm.type], - nvm->cm.response, nss_cmn_response_str[nvm->cm.response]); - goto verbose; - } - - if (nvm->cm.error >= NSS_VLAN_ERROR_TYPE_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nvm, nvm->cm.type, nss_vlan_log_message_types_str[nvm->cm.type], - nvm->cm.response, nss_cmn_response_str[nvm->cm.response], - nvm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nvm, nvm->cm.type, nss_vlan_log_message_types_str[nvm->cm.type], - nvm->cm.response, nss_cmn_response_str[nvm->cm.response], - nvm->cm.error, nss_vlan_log_error_response_types_str[nvm->cm.error]); ---- a/nss_vxlan.c -+++ b/nss_vxlan.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -95,12 +95,12 @@ static void nss_vxlan_msg_handler(struct - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_VXLAN_MSG_TYPE_MAX) { -- nss_warning("%p: received invalid message %d for vxlan interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for vxlan interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_vxlan_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -122,7 +122,7 @@ static void nss_vxlan_msg_handler(struct - * Update the callback for NOTIFY messages - */ - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - } - - cb = (nss_vxlan_msg_callback_t)ncm->cb; -@@ -131,7 +131,7 @@ static void nss_vxlan_msg_handler(struct - * Do we have a callback? - */ - if (!cb) { -- nss_trace("%p: cb is null for interface %d\n", nss_ctx, ncm->interface); -+ nss_trace("%px: cb is null for interface %d\n", nss_ctx, ncm->interface); - return; - } - -@@ -147,12 +147,12 @@ nss_tx_status_t nss_vxlan_tx_msg(struct - struct nss_cmn_msg *ncm = &nvm->cm; - - if (!nss_vxlan_verify_if_num(ncm->interface)) { -- nss_warning("%p: wrong interface number %u\n", nss_ctx, nvm->cm.interface); -+ nss_warning("%px: wrong interface number %u\n", nss_ctx, nvm->cm.interface); - return NSS_TX_FAILURE_BAD_PARAM; - } - - if (ncm->type >= NSS_VXLAN_MSG_TYPE_MAX) { -- nss_warning("%p: wrong message type %u\n", nss_ctx, ncm->type); -+ nss_warning("%px: wrong message type %u\n", nss_ctx, ncm->type); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -183,14 +183,14 @@ nss_tx_status_t nss_vxlan_tx_msg_sync(st - - status = nss_vxlan_tx_msg(nss_ctx, nvm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: vxlan_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: vxlan_tx_msg failed\n", nss_ctx); - up(&nss_vxlan_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&nss_vxlan_pvt.complete, msecs_to_jiffies(NSS_VXLAN_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: vxlan tx sync failed due to timeout\n", nss_ctx); -+ nss_warning("%px: vxlan tx sync failed due to timeout\n", nss_ctx); - nss_vxlan_pvt.response = NSS_TX_FAILURE; - } - -@@ -221,7 +221,7 @@ bool nss_vxlan_unregister_if(uint32_t if - - nss_ctx = nss_vxlan_get_ctx(); - if (!nss_vxlan_verify_if_num(if_num)) { -- nss_warning("%p: data unregister received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: data unregister received for invalid interface %d", nss_ctx, if_num); - return false; - } - -@@ -247,19 +247,25 @@ struct nss_ctx_instance *nss_vxlan_regis - - nss_ctx = nss_vxlan_get_ctx(); - if (!nss_vxlan_verify_if_num(if_num)) { -- nss_warning("%p: data register received for invalid interface %d", nss_ctx, if_num); -+ nss_warning("%px: data register received for invalid interface %d", nss_ctx, if_num); - return NULL; - } - - core_status = nss_core_register_handler(nss_ctx, if_num, nss_vxlan_msg_handler, NULL); - if (core_status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: nss core register handler failed for if_num:%d with error :%d", nss_ctx, if_num, core_status); -+ nss_warning("%px: nss core register handler failed for if_num:%d with error :%d", nss_ctx, if_num, core_status); -+ return NULL; -+ } -+ -+ core_status = nss_core_register_msg_handler(nss_ctx, if_num, notify_cb); -+ if (core_status != NSS_CORE_STATUS_SUCCESS) { -+ nss_core_unregister_handler(nss_ctx, if_num); -+ nss_warning("%px: nss core register handler failed for if_num:%d with error :%d", nss_ctx, if_num, core_status); - return NULL; - } - - nss_core_register_subsys_dp(nss_ctx, if_num, data_cb, NULL, NULL, netdev, features); - nss_core_set_subsys_dp_type(nss_ctx, netdev, if_num, type); -- nss_top_main.if_rx_msg_callback[if_num] = (nss_if_rx_msg_callback_t)notify_cb; - return nss_ctx; - } - EXPORT_SYMBOL(nss_vxlan_register_if); -@@ -275,7 +281,7 @@ int nss_vxlan_ifnum_with_core_id(int if_ - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (!nss_vxlan_verify_if_num(if_num)) { -- nss_warning("%p: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); -+ nss_warning("%px: Invalid if_num: %d, must be a dynamic interface\n", nss_ctx, if_num); - return 0; - } - return NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num); -@@ -304,7 +310,7 @@ void nss_vxlan_init() - uint32_t core_status; - struct nss_ctx_instance *nss_ctx = nss_vxlan_get_ctx(); - if (!nss_ctx) { -- nss_warning("%p: VxLAN is not registered", nss_ctx); -+ nss_warning("%px: VxLAN is not registered", nss_ctx); - return; - } - -@@ -314,7 +320,7 @@ void nss_vxlan_init() - core_status = nss_core_register_handler(nss_ctx, NSS_VXLAN_INTERFACE, nss_vxlan_msg_handler, NULL); - - if (core_status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: nss core register handler failed for if_num:%d with error :%d", nss_ctx, NSS_VXLAN_INTERFACE, core_status); -+ nss_warning("%px: nss core register handler failed for if_num:%d with error :%d", nss_ctx, NSS_VXLAN_INTERFACE, core_status); - } - - } ---- a/nss_vxlan_log.c -+++ b/nss_vxlan_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -70,7 +70,7 @@ static int8_t *nss_vxlan_log_error_respo - */ - static void nss_vxlan_log_rule_msg(struct nss_vxlan_rule_msg *nvrm) - { -- nss_trace("%p: NSS VXLAN Rule message \n" -+ nss_trace("%px: NSS VXLAN Rule message \n" - "VxLAN Tunnel Flags: %x\n" - "VNET ID: %u\n" - "Flowlabel: %u\n" -@@ -95,9 +95,9 @@ static void nss_vxlan_log_rule_msg(struc - */ - static void nss_vxlan_log_mac_msg(struct nss_vxlan_mac_msg *nvmm) - { -- nss_trace("%p: NSS VXLAN MAC message \n" -- "Encap Rule Src IP: %p\n" -- "Encap Rule Dst Ip: %p\n" -+ nss_trace("%px: NSS VXLAN MAC message \n" -+ "Encap Rule Src IP: %px\n" -+ "Encap Rule Dst Ip: %px\n" - "Vxlan VNet ID: %u\n" - "Vxlan Mac Addr: %pM", - nvmm, -@@ -133,7 +133,7 @@ static void nss_vxlan_log_rule_destroy_m - */ - static void nss_vxlan_log_enable_msg(struct nss_vxlan_msg *nvm) - { -- nss_trace("%p: NSS VXLAN Tunnel state message: Enable \n", nvm); -+ nss_trace("%px: NSS VXLAN Tunnel state message: Enable \n", nvm); - } - - /* -@@ -142,7 +142,7 @@ static void nss_vxlan_log_enable_msg(str - */ - static void nss_vxlan_log_disable_msg(struct nss_vxlan_msg *nvm) - { -- nss_trace("%p: NSS VXLAN Tunnel state message: Disable \n", nvm); -+ nss_trace("%px: NSS VXLAN Tunnel state message: Disable \n", nvm); - } - - /* -@@ -201,7 +201,7 @@ static void nss_vxlan_log_verbose(struct - break; - - default: -- nss_trace("%p: Invalid message type\n", nvm); -+ nss_trace("%px: Invalid message type\n", nvm); - break; - } - } -@@ -213,11 +213,11 @@ static void nss_vxlan_log_verbose(struct - void nss_vxlan_log_tx_msg(struct nss_vxlan_msg *nvm) - { - if (nvm->cm.type >= NSS_VXLAN_MSG_TYPE_MAX) { -- nss_warning("%p: Invalid message type\n", nvm); -+ nss_warning("%px: Invalid message type\n", nvm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nvm, nvm->cm.type, nss_vxlan_log_message_types_str[nvm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nvm, nvm->cm.type, nss_vxlan_log_message_types_str[nvm->cm.type]); - nss_vxlan_log_verbose(nvm); - } - -@@ -228,26 +228,26 @@ void nss_vxlan_log_tx_msg(struct nss_vxl - void nss_vxlan_log_rx_msg(struct nss_vxlan_msg *nvm) - { - if (nvm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nvm); -+ nss_warning("%px: Invalid response\n", nvm); - return; - } - - if (nvm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nvm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nvm, nvm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nvm, nvm->cm.type, - nss_vxlan_log_message_types_str[nvm->cm.type], - nvm->cm.response, nss_cmn_response_str[nvm->cm.response]); - goto verbose; - } - - if (nvm->cm.error >= NSS_VXLAN_ERROR_TYPE_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nvm, nvm->cm.type, nss_vxlan_log_message_types_str[nvm->cm.type], - nvm->cm.response, nss_cmn_response_str[nvm->cm.response], - nvm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nvm, nvm->cm.type, nss_vxlan_log_message_types_str[nvm->cm.type], - nvm->cm.response, nss_cmn_response_str[nvm->cm.response], - nvm->cm.error, nss_vxlan_log_error_response_types_str[nvm->cm.error]); ---- a/nss_wifi.c -+++ b/nss_wifi.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2015-2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -37,7 +37,7 @@ static void nss_wifi_handler(struct nss_ - void *ctx; - nss_wifi_msg_callback_t cb; - -- nss_info("%p: NSS ->HLOS message for wifi\n", nss_ctx); -+ nss_info("%px: NSS ->HLOS message for wifi\n", nss_ctx); - - BUG_ON(((ncm->interface < NSS_WIFI_INTERFACE0) || (ncm->interface > NSS_WIFI_INTERFACE2))); - -@@ -50,12 +50,12 @@ static void nss_wifi_handler(struct nss_ - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_WIFI_MAX_MSG) { -- nss_warning("%p: received invalid message %d for wifi interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for wifi interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_wifi_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -88,7 +88,7 @@ static void nss_wifi_handler(struct nss_ - * Do we have a call back - */ - if (!ncm->cb) { -- nss_info("%p: cb null for wifi interface %d", nss_ctx, ncm->interface); -+ nss_info("%px: cb null for wifi interface %d", nss_ctx, ncm->interface); - return; - } - -@@ -102,7 +102,7 @@ static void nss_wifi_handler(struct nss_ - * call wifi msg callback - */ - if (!ctx) { -- nss_warning("%p: Event received for wifi interface %d before registration", nss_ctx, ncm->interface); -+ nss_warning("%px: Event received for wifi interface %d before registration", nss_ctx, ncm->interface); - return; - } - -@@ -123,7 +123,7 @@ nss_tx_status_t nss_wifi_tx_msg(struct n - nss_wifi_log_tx_msg(msg); - - if (ncm->type > NSS_WIFI_MAX_MSG) { -- nss_warning("%p: wifi message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: wifi message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -149,7 +149,7 @@ struct nss_ctx_instance *nss_register_wi - nss_assert(nss_ctx); - nss_assert((if_num >= NSS_MAX_VIRTUAL_INTERFACES) && (if_num < NSS_MAX_NET_INTERFACES)); - -- nss_info("%p: nss_register_wifi_if if_num %d wifictx %p", nss_ctx, if_num, netdev); -+ nss_info("%px: nss_register_wifi_if if_num %d wifictx %px", nss_ctx, if_num, netdev); - - nss_core_register_subsys_dp(nss_ctx, if_num, wifi_callback, wifi_ext_callback, NULL, netdev, features); - ---- a/nss_wifi_if.c -+++ b/nss_wifi_if.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -56,18 +56,18 @@ static void nss_wifi_if_msg_handler(stru - * Sanity check the message type - */ - if (ncm->type >= NSS_WIFI_IF_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d", -+ nss_warning("%px: message type out of range: %d", - nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_wifi_if_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - - if (!NSS_IS_IF_TYPE(DYNAMIC, ncm->interface)) { -- nss_warning("%p: response for another interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: response for another interface: %d", nss_ctx, ncm->interface); - return; - } - -@@ -81,7 +81,7 @@ static void nss_wifi_if_msg_handler(stru - spin_lock_bh(&wifi_if_lock); - if (!wifi_handle[if_num]) { - spin_unlock_bh(&wifi_if_lock); -- nss_warning("%p: wifi_if handle is NULL\n", nss_ctx); -+ nss_warning("%px: wifi_if handle is NULL\n", nss_ctx); - return; - } - -@@ -156,7 +156,7 @@ static void nss_wifi_if_callback(void *a - struct nss_wifi_if_pvt *nwip = handle->pvt; - - if (ncm->response != NSS_CMN_RESPONSE_ACK) { -- nss_warning("%p: wifi_if Error response %d\n", -+ nss_warning("%px: wifi_if Error response %d\n", - handle->nss_ctx, ncm->response); - nwip->response = NSS_TX_FAILURE; - complete(&nwip->complete); -@@ -176,7 +176,7 @@ nss_tx_status_t nss_wifi_if_tx_msg(struc - struct nss_cmn_msg *ncm = &nwim->cm; - - if (ncm->type > NSS_WIFI_IF_MAX_MSG_TYPES) { -- nss_warning("%p: message type out of range: %d\n", nss_ctx, ncm->type); -+ nss_warning("%px: message type out of range: %d\n", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -199,7 +199,7 @@ static nss_tx_status_t nss_wifi_if_tx_ms - - status = nss_wifi_if_tx_msg(nss_ctx, nwim); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_wifi_if_msg failed\n", nss_ctx); -+ nss_warning("%px: nss_wifi_if_msg failed\n", nss_ctx); - up(&nwip->sem); - return status; - } -@@ -207,7 +207,7 @@ static nss_tx_status_t nss_wifi_if_tx_ms - ret = wait_for_completion_timeout(&nwip->complete, - msecs_to_jiffies(NSS_WIFI_IF_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: wifi_if tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: wifi_if tx failed due to timeout\n", nss_ctx); - nwip->response = NSS_TX_FAILURE; - } - -@@ -243,7 +243,7 @@ static int nss_wifi_if_handle_destroy(st - - status = nss_dynamic_interface_dealloc_node(if_num, NSS_DYNAMIC_INTERFACE_TYPE_WIFI); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Dynamic interface destroy failed status %d\n", nss_ctx, status); -+ nss_warning("%px: Dynamic interface destroy failed status %d\n", nss_ctx, status); - return status; - } - -@@ -266,7 +266,7 @@ static struct nss_wifi_if_handle *nss_wi - - if_num = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_WIFI); - if (if_num < 0) { -- nss_warning("%p:failure allocating wifi if\n", nss_ctx); -+ nss_warning("%px:failure allocating wifi if\n", nss_ctx); - *cmd_rsp = NSS_WIFI_IF_DYNAMIC_IF_FAILURE; - return NULL; - } -@@ -276,7 +276,7 @@ static struct nss_wifi_if_handle *nss_wi - handle = (struct nss_wifi_if_handle *)kzalloc(sizeof(struct nss_wifi_if_handle), - GFP_KERNEL); - if (!handle) { -- nss_warning("%p: handle memory alloc failed\n", nss_ctx); -+ nss_warning("%px: handle memory alloc failed\n", nss_ctx); - *cmd_rsp = NSS_WIFI_IF_ALLOC_FAILURE; - goto error1; - } -@@ -286,7 +286,7 @@ static struct nss_wifi_if_handle *nss_wi - handle->pvt = (struct nss_wifi_if_pvt *)kzalloc(sizeof(struct nss_wifi_if_pvt), - GFP_KERNEL); - if (!handle->pvt) { -- nss_warning("%p: failure allocating memory for nss_wifi_if_pvt\n", nss_ctx); -+ nss_warning("%px: failure allocating memory for nss_wifi_if_pvt\n", nss_ctx); - *cmd_rsp = NSS_WIFI_IF_ALLOC_FAILURE; - goto error2; - } -@@ -335,20 +335,20 @@ struct nss_wifi_if_handle *nss_wifi_if_c - struct nss_wifi_if_handle *handle = NULL; - - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: Interface could not be created as core not ready\n", nss_ctx); -+ nss_warning("%px: Interface could not be created as core not ready\n", nss_ctx); - return NULL; - } - - handle = nss_wifi_if_handle_create(nss_ctx, &ret); - if (!handle) { -- nss_warning("%p:wifi_if handle creation failed ret %d\n", nss_ctx, ret); -+ nss_warning("%px:wifi_if handle creation failed ret %d\n", nss_ctx, ret); - return NULL; - } - - /* Initializes the semaphore and also sets the msg handler for if_num */ - ret = nss_wifi_if_register_handler(handle); - if (ret != NSS_WIFI_IF_SUCCESS) { -- nss_warning("%p: Registration handler failed reason: %d\n", nss_ctx, ret); -+ nss_warning("%px: Registration handler failed reason: %d\n", nss_ctx, ret); - goto error; - } - -@@ -361,7 +361,7 @@ struct nss_wifi_if_handle *nss_wifi_if_c - - ret = nss_wifi_if_tx_msg_sync(handle, &nwim); - if (ret != NSS_TX_SUCCESS) { -- nss_warning("%p: nss_wifi_if_tx_msg_sync failed %u\n", nss_ctx, ret); -+ nss_warning("%px: nss_wifi_if_tx_msg_sync failed %u\n", nss_ctx, ret); - goto error; - } - -@@ -397,14 +397,14 @@ nss_tx_status_t nss_wifi_if_destroy_sync - struct nss_ctx_instance *nss_ctx = handle->nss_ctx; - - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: Interface could not be destroyed as core not ready\n", nss_ctx); -+ nss_warning("%px: Interface could not be destroyed as core not ready\n", nss_ctx); - return NSS_TX_FAILURE_NOT_READY; - } - - spin_lock_bh(&nss_top_main.lock); - if (!nss_ctx->subsys_dp_register[if_num].ndev) { - spin_unlock_bh(&nss_top_main.lock); -- nss_warning("%p: Unregister wifi interface %d: no context\n", nss_ctx, if_num); -+ nss_warning("%px: Unregister wifi interface %d: no context\n", nss_ctx, if_num); - return NSS_TX_FAILURE_BAD_PARAM; - } - -@@ -500,7 +500,7 @@ nss_tx_status_t nss_wifi_if_tx_buf(struc - * Sanity check the SKB to ensure that it's suitable for us - */ - if (unlikely(skb->len <= ETH_HLEN)) { -- nss_warning("%p: Rx packet: %p too short", nss_ctx, skb); -+ nss_warning("%px: Rx packet: %px too short", nss_ctx, skb); - return NSS_TX_FAILURE_TOO_SHORT; - } - -@@ -514,4 +514,3 @@ nss_tx_status_t nss_wifi_if_tx_buf(struc - return nss_core_send_packet(nss_ctx, skb, if_num, H2N_BIT_FLAG_VIRTUAL_BUFFER); - } - EXPORT_SYMBOL(nss_wifi_if_tx_buf); -- ---- a/nss_wifi_log.c -+++ b/nss_wifi_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -110,7 +110,7 @@ static void nss_wifi_log_init_msg(struct - { - struct nss_wifi_init_msg *nwim __maybe_unused = &ncm->msg.initmsg; - -- nss_trace("%p: NSS WIFI Init Message:\n" -+ nss_trace("%px: NSS WIFI Init Message:\n" - "WIFI Radio ID: %d\n" - "WIFI PCI Memory Address: %x\n" - "WIFI Target Type: %d\n" -@@ -177,7 +177,7 @@ static void nss_wifi_log_init_msg(struct - static void nss_wifi_log_stop_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_stop_msg *nwsm __maybe_unused = &ncm->msg.stopmsg; -- nss_trace("%p: NSS WIFI Init Message:\n" -+ nss_trace("%px: NSS WIFI Init Message:\n" - "WIFI Radio ID: %d\n", - nwsm, nwsm->radio_id); - } -@@ -189,7 +189,7 @@ static void nss_wifi_log_stop_msg(struct - static void nss_wifi_log_reset_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_reset_msg *nwrm __maybe_unused = &ncm->msg.resetmsg; -- nss_trace("%p: NSS WIFI Init Message:\n" -+ nss_trace("%px: NSS WIFI Init Message:\n" - "WIFI Radio ID: %d\n", - nwrm, nwrm->radio_id); - } -@@ -201,7 +201,7 @@ static void nss_wifi_log_reset_msg(struc - static void nss_wifi_log_htt_init_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_htt_init_msg *nwim __maybe_unused = &ncm->msg.httinitmsg; -- nss_trace("%p: NSS WIFI HTT Init Message:\n" -+ nss_trace("%px: NSS WIFI HTT Init Message:\n" - "WIFI Radio ID: %d\n" - "WIFI Ring Size: %d\n" - "WIFI Fill Level: %d\n" -@@ -222,7 +222,7 @@ static void nss_wifi_log_htt_init_msg(st - static void nss_wifi_log_tx_init_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_tx_init_msg *nwim __maybe_unused = &ncm->msg.pdevtxinitmsg; -- nss_trace("%p: NSS WIFI HTT Init Message:\n" -+ nss_trace("%px: NSS WIFI HTT Init Message:\n" - "WIFI Radio ID: %d\n" - "WIFI Number of Descriptor Pools Allocated: %d\n" - "WIFI TX Descriptor Array: %x\n" -@@ -246,10 +246,10 @@ static void nss_wifi_log_tx_init_msg(str - static void nss_wifi_log_rawsend_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_rawsend_msg *nwrm __maybe_unused = &ncm->msg.rawmsg; -- nss_trace("%p: NSS WIFI RAW Send Message:\n" -+ nss_trace("%px: NSS WIFI RAW Send Message:\n" - "WIFI Radio ID: %d\n" - "WIFI Size of Raw Data: %d\n" -- "WIFI Raw Data: %p", -+ "WIFI Raw Data: %px", - nwrm, nwrm->radio_id, - nwrm->len, nwrm->array); - } -@@ -261,10 +261,10 @@ static void nss_wifi_log_rawsend_msg(str - static void nss_wifi_log_mgmtsend_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_mgmtsend_msg *nwmm __maybe_unused = &ncm->msg.mgmtmsg; -- nss_trace("%p: NSS WIFI Management Send Message:\n" -+ nss_trace("%px: NSS WIFI Management Send Message:\n" - "WIFI Descriptor ID: %d\n" - "WIFI Size of Management Data: %d\n" -- "WIFI Management Data: %p", -+ "WIFI Management Data: %px", - nwmm, nwmm->desc_id, - nwmm->len, nwmm->array); - } -@@ -276,7 +276,7 @@ static void nss_wifi_log_mgmtsend_msg(st - static void nss_wifi_log_wds_peer_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_wds_peer_msg *nwmm __maybe_unused = &ncm->msg.pdevwdspeermsg; -- nss_trace("%p: NSS WIFI WDS Peer Message:\n" -+ nss_trace("%px: NSS WIFI WDS Peer Message:\n" - "WIFI Dest MAC: %pM\n" - "WIFI Peer MAC: %pM\n", - nwmm, nwmm->dest_mac, -@@ -290,7 +290,7 @@ static void nss_wifi_log_wds_peer_msg(st - static void nss_wifi_log_peer_freelist_append_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_peer_freelist_append_msg *nwpm __maybe_unused = &ncm->msg.peer_freelist_append; -- nss_trace("%p: NSS WIFI Create/Append Freelist Message:\n" -+ nss_trace("%px: NSS WIFI Create/Append Freelist Message:\n" - "WIFI Starting Address of Peer Freelist Pool: %x\n" - "WIFI Length of freelist pool: %d\n" - "WIFI Number of Peers supported in freelist pool: %d\n", -@@ -305,7 +305,7 @@ static void nss_wifi_log_peer_freelist_a - static void nss_wifi_log_rx_reorder_array_freelist_append_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_rx_reorder_array_freelist_append_msg *nwpm __maybe_unused = &ncm->msg.rx_reorder_array_freelist_append; -- nss_trace("%p: NSS WIFI RX Reorder Array Freelist Message:\n" -+ nss_trace("%px: NSS WIFI RX Reorder Array Freelist Message:\n" - "WIFI Starting Address of TIDQ Freelist Pool: %x\n" - "WIFI Length of TIDQ freelist pool: %d\n" - "WIFI Number of Rx reorder array entries supported in freelist pool: %d\n", -@@ -320,7 +320,7 @@ static void nss_wifi_log_rx_reorder_arra - static void nss_wifi_log_set_filter_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_monitor_set_filter_msg *nwfm __maybe_unused = &ncm->msg.monitor_filter_msg; -- nss_trace("%p: NSS WIFI Set Filter Message:\n" -+ nss_trace("%px: NSS WIFI Set Filter Message:\n" - "WIFI Filter Type: %dn", - nwfm, nwfm->filter_type); - } -@@ -332,7 +332,7 @@ static void nss_wifi_log_set_filter_msg( - static void nss_wifi_log_peer_activity_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_bs_peer_activity *nwpm __maybe_unused = &ncm->msg.peer_activity; -- nss_trace("%p: NSS WIFI Get Active Peer Message:\n" -+ nss_trace("%px: NSS WIFI Get Active Peer Message:\n" - "WIFI Number of Entries in Peer ID Array: %d\n" - "WIFI PEER ID: %d\n", - nwpm, nwpm->nentries, -@@ -346,7 +346,7 @@ static void nss_wifi_log_peer_activity_m - static void nss_wifi_log_rx_vow_extstats_set_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_rx_vow_extstats_set_msg *nwpm __maybe_unused = &ncm->msg.vow_extstats_msg; -- nss_trace("%p: NSS WIFI VoW Extended Statistics Set Message:\n" -+ nss_trace("%px: NSS WIFI VoW Extended Statistics Set Message:\n" - "WIFI VoW Extended Statistics Enable:: %d\n", - nwpm, nwpm->vow_extstats_en); - } -@@ -358,7 +358,7 @@ static void nss_wifi_log_rx_vow_extstats - static void nss_wifi_log_pktlog_cfg_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_pktlog_cfg_msg *nwpm __maybe_unused = &ncm->msg.pcm_msg; -- nss_trace("%p: NSS WIFI Packet Log Configuration Message:\n" -+ nss_trace("%px: NSS WIFI Packet Log Configuration Message:\n" - "WIFI Packet Log Enable: %d\n" - "WIFI PAcket Log buffer Size: %d\n" - "WIFI Size of packet log header: %d\n" -@@ -375,7 +375,7 @@ static void nss_wifi_log_pktlog_cfg_msg( - static void nss_wifi_log_enable_perpkt_txstats_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_enable_perpkt_txstats_msg *nwpm __maybe_unused = &ncm->msg.ept_msg; -- nss_trace("%p: NSS WIFI Enable TX Stats Message:\n" -+ nss_trace("%px: NSS WIFI Enable TX Stats Message:\n" - "WIFI TX Stats Enable Flag: %d\n", - nwpm, nwpm->perpkt_txstats_flag); - } -@@ -387,7 +387,7 @@ static void nss_wifi_log_enable_perpkt_t - static void nss_wifi_log_override_tos_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_igmp_mld_override_tos_msg *nwpm __maybe_unused = &ncm->msg.wigmpmldtm_msg; -- nss_trace("%p: NSS WIFI Override TOS Message:\n" -+ nss_trace("%px: NSS WIFI Override TOS Message:\n" - "WIFI enable TID override Flag: %d\n" - "WIFI Value of TID to be overriden: %d\n", - nwpm, nwpm->igmp_mld_ovride_tid_en, -@@ -401,7 +401,7 @@ static void nss_wifi_log_override_tos_ms - static void nss_wifi_log_ol_stats_cfg_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_ol_stats_cfg_msg *nwpm __maybe_unused = &ncm->msg.scm_msg; -- nss_trace("%p: NSS WIFI Enable/Disable Offload Stats Message:\n" -+ nss_trace("%px: NSS WIFI Enable/Disable Offload Stats Message:\n" - "WIFI enable/disable offload stats config: %d\n", - nwpm, nwpm->stats_cfg); - } -@@ -413,7 +413,7 @@ static void nss_wifi_log_ol_stats_cfg_ms - static void nss_wifi_log_tx_queue_cfg_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_tx_queue_cfg_msg *nwpm __maybe_unused = &ncm->msg.wtxqcm; -- nss_trace("%p: NSS WIFI TX Queue Config Message:\n" -+ nss_trace("%px: NSS WIFI TX Queue Config Message:\n" - "WIFI TX Queue Size: %d\n" - "WIFI TX Queue Range: %d\n", - nwpm, nwpm->size, nwpm->range); -@@ -426,7 +426,7 @@ static void nss_wifi_log_tx_queue_cfg_ms - static void nss_wifi_log_tx_min_threshold_cfg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_tx_min_threshold_cfg_msg *nwpm __maybe_unused = &ncm->msg.wtx_min_threshold_cm; -- nss_trace("%p: NSS WIFI TX Queue Min Threshold Config Message:\n" -+ nss_trace("%px: NSS WIFI TX Queue Min Threshold Config Message:\n" - "WIFI TX Queue Min Threshold Value: %d\n", - nwpm, nwpm->min_threshold); - } -@@ -438,7 +438,7 @@ static void nss_wifi_log_tx_min_threshol - static void nss_wifi_log_dbdc_process_enable_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_dbdc_process_enable_msg *nwpm __maybe_unused = &ncm->msg.dbdcpe_msg; -- nss_trace("%p: NSS WIFI DBDC repeater process configuration:\n" -+ nss_trace("%px: NSS WIFI DBDC repeater process configuration:\n" - "WIFI DBDC Process Enable Flag: %d\n", - nwpm, nwpm->dbdc_process_enable); - } -@@ -450,7 +450,7 @@ static void nss_wifi_log_dbdc_process_en - static void nss_wifi_log_primary_radio_set_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_primary_radio_set_msg *nwpm __maybe_unused = &ncm->msg.wprs_msg; -- nss_trace("%p: NSS WIFI Primary Radio Set Message:\n" -+ nss_trace("%px: NSS WIFI Primary Radio Set Message:\n" - "WIFI Current Radio as Primary Radio Enable/Disable Flag: %d\n", - nwpm, nwpm->flag); - } -@@ -462,7 +462,7 @@ static void nss_wifi_log_primary_radio_s - static void nss_wifi_log_force_client_mcast_traffic_set_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_force_client_mcast_traffic_set_msg *nwpm __maybe_unused = &ncm->msg.wfcmts_msg; -- nss_trace("%p: NSS WIFI Force Multicat Traffic for Radio Message:\n" -+ nss_trace("%px: NSS WIFI Force Multicat Traffic for Radio Message:\n" - "WIFI Radio Multicast Traffic Flag: %d\n", - nwpm, nwpm->flag); - } -@@ -474,7 +474,7 @@ static void nss_wifi_log_force_client_mc - static void nss_wifi_log_store_other_pdev_stavap_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_store_other_pdev_stavap_msg *nwpm __maybe_unused = &ncm->msg.wsops_msg; -- nss_trace("%p: NSS WIFI Store Other Radio Station VAP Message:\n" -+ nss_trace("%px: NSS WIFI Store Other Radio Station VAP Message:\n" - "WIFI Station VAP Interface Number: %d\n", - nwpm, nwpm->stavap_ifnum); - } -@@ -486,7 +486,7 @@ static void nss_wifi_log_store_other_pde - static void nss_wifi_log_sta_kickout_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_sta_kickout_msg *nwpm __maybe_unused = &ncm->msg.sta_kickout_msg; -- nss_trace("%p: NSS WIFI Station Kickout Message:\n" -+ nss_trace("%px: NSS WIFI Station Kickout Message:\n" - "WIFI PEER ID: %d\n", - nwpm, nwpm->peer_id); - } -@@ -498,8 +498,8 @@ static void nss_wifi_log_sta_kickout_msg - static void nss_wifi_log_wnm_peer_rx_activity(struct nss_wifi_msg *ncm) - { - struct nss_wifi_wnm_peer_rx_activity_msg *nwpm __maybe_unused = &ncm->msg.wprm; -- nss_trace("%p: NSS WIFI RX Active State Information of Peer:\n" -- "WIFI Peer ID: %p\n" -+ nss_trace("%px: NSS WIFI RX Active State Information of Peer:\n" -+ "WIFI Peer ID: %px\n" - "WIFI Number of Entries: %d\n", - nwpm, nwpm->peer_id, nwpm->nentries); - } -@@ -511,7 +511,7 @@ static void nss_wifi_log_wnm_peer_rx_act - static void nss_wifi_log_wds_extn_peer_cfg_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_wds_extn_peer_cfg_msg *nwpm __maybe_unused = &ncm->msg.wpeercfg; -- nss_trace("%p: NSS WIFI Extension Enabled Configuraion Message:\n" -+ nss_trace("%px: NSS WIFI Extension Enabled Configuraion Message:\n" - "WIFI Peer MAC Address: %pM\n" - "WIFI WDS Flags: %d\n" - "WIFI Peer ID: %d\n", -@@ -526,7 +526,7 @@ static void nss_wifi_log_wds_extn_peer_c - static void nss_wifi_log_tx_capture_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_tx_capture_msg *nwpm __maybe_unused = &ncm->msg.tx_capture_msg; -- nss_trace("%p: NSS WIFI Enable TX Capture Message:\n" -+ nss_trace("%px: NSS WIFI Enable TX Capture Message:\n" - "WIFI TX Capture Enable Flag: %d\n", - nwpm, nwpm->tx_capture_enable); - } -@@ -538,7 +538,7 @@ static void nss_wifi_log_tx_capture_msg( - static void nss_wifi_log_always_primary_set_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_always_primary_set_msg *nwpm __maybe_unused = &ncm->msg.waps_msg; -- nss_trace("%p: NSS WIFI Always Set Current Radio Primary Message:\n" -+ nss_trace("%px: NSS WIFI Always Set Current Radio Primary Message:\n" - "WIFI Always Set Flag: %d\n", - nwpm, nwpm->flag); - } -@@ -550,7 +550,7 @@ static void nss_wifi_log_always_primary_ - static void nss_wifi_log_cmd_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_cmd_msg *nwpm __maybe_unused = &ncm->msg.wcmdm; -- nss_trace("%p: NSS WIFI PDEV Command Message:\n" -+ nss_trace("%px: NSS WIFI PDEV Command Message:\n" - "WIFI Type of Command: %d\n" - "WIFI Value of Command: %d\n", - nwpm, nwpm->cmd, nwpm->value); -@@ -563,7 +563,7 @@ static void nss_wifi_log_cmd_msg(struct - static void nss_wifi_log_enable_ol_statsv2_msg(struct nss_wifi_msg *ncm) - { - struct nss_wifi_enable_ol_statsv2 *nwpm __maybe_unused = &ncm->msg.wesh_msg; -- nss_trace("%p: NSS WIFI Enable Version 2 of TX/RX Stats:\n" -+ nss_trace("%px: NSS WIFI Enable Version 2 of TX/RX Stats:\n" - "WIFI Enable Version 2 Stats: %d\n", - nwpm, nwpm->enable_ol_statsv2); - } -@@ -577,7 +577,7 @@ static void nss_wifi_log_enable_ol_peer_ - struct nss_wifi_ol_peer_time_msg *nwpm __maybe_unused = &ncm->msg.wopt_msg; - int32_t i; - -- nss_trace("%p: NSS WIFI Enable Per PEer Stats to Host:\n" -+ nss_trace("%px: NSS WIFI Enable Per PEer Stats to Host:\n" - "WIFI Number of Peers: %d\n" - "WIFI Peed ID: %d\n", - nwpm, nwpm->npeers, -@@ -750,7 +750,7 @@ static void nss_wifi_log_verbose(struct - break; - - default: -- nss_warning("%p: Invalid message type\n", ncm); -+ nss_warning("%px: Invalid message type\n", ncm); - break; - } - } -@@ -762,11 +762,11 @@ static void nss_wifi_log_verbose(struct - void nss_wifi_log_tx_msg(struct nss_wifi_msg *ncm) - { - if (ncm->cm.type >= NSS_WIFI_MAX_MSG) { -- nss_warning("%p: Invalid message type\n", ncm); -+ nss_warning("%px: Invalid message type\n", ncm); - return; - } - -- nss_info("%p: type[%d]:%s\n", ncm, ncm->cm.type, nss_wifi_log_message_types_str[ncm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", ncm, ncm->cm.type, nss_wifi_log_message_types_str[ncm->cm.type]); - nss_wifi_log_verbose(ncm); - } - -@@ -777,26 +777,26 @@ void nss_wifi_log_tx_msg(struct nss_wifi - void nss_wifi_log_rx_msg(struct nss_wifi_msg *ncm) - { - if (ncm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", ncm); -+ nss_warning("%px: Invalid response\n", ncm); - return; - } - - if (ncm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ncm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type, - nss_wifi_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response]); - goto verbose; - } - - if (ncm->cm.error >= NSS_WIFI_EMSG_MAX) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - ncm, ncm->cm.type, nss_wifi_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - ncm, ncm->cm.type, nss_wifi_log_message_types_str[ncm->cm.type], - ncm->cm.response, nss_cmn_response_str[ncm->cm.response], - ncm->cm.error, nss_wifi_log_error_response_types_str[ncm->cm.error]); ---- a/nss_wifi_mac_db.c -+++ b/nss_wifi_mac_db.c -@@ -52,7 +52,7 @@ static void nss_wifi_mac_db_handler(stru - void *ctx; - nss_wifi_mac_db_msg_callback_t cb; - -- nss_info("%p: NSS->HLOS message for wifi_mac_db\n", nss_ctx); -+ nss_info("%px: NSS->HLOS message for wifi_mac_db\n", nss_ctx); - - /* - * The interface number shall be wifi_mac_db soc interface or wifi_mac_db radio interface -@@ -63,12 +63,12 @@ static void nss_wifi_mac_db_handler(stru - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_WIFI_MAC_DB_MAX_MSG) { -- nss_warning("%p: Received invalid message %d for wifi_mac_db interface", nss_ctx, ncm->type); -+ nss_warning("%px: Received invalid message %d for wifi_mac_db interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_wifi_mac_db_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -89,7 +89,7 @@ static void nss_wifi_mac_db_handler(stru - * Do we have a call back - */ - if (!ncm->cb) { -- nss_info("%p: cb null for wifi_mac_db interface %d", nss_ctx, ncm->interface); -+ nss_info("%px: cb null for wifi_mac_db interface %d", nss_ctx, ncm->interface); - return; - } - -@@ -103,7 +103,7 @@ static void nss_wifi_mac_db_handler(stru - * call wifi_mac_db msg callback - */ - if (!ctx) { -- nss_warning("%p: Event received for wifi_mac_db interface %d before registration", nss_ctx, ncm->interface); -+ nss_warning("%px: Event received for wifi_mac_db interface %d before registration", nss_ctx, ncm->interface); - return; - } - -@@ -122,7 +122,7 @@ nss_tx_status_t nss_wifi_mac_db_tx_msg(s - struct nss_cmn_msg *ncm = &msg->cm; - - if (ncm->type >= NSS_WIFI_MAC_DB_MAX_MSG) { -- nss_warning("%p: wifi_mac_db message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: wifi_mac_db message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -130,7 +130,7 @@ nss_tx_status_t nss_wifi_mac_db_tx_msg(s - * The interface number shall be one of the wifi_mac_db soc interfaces - */ - if ((ncm->interface != NSS_WIFI_MAC_DB_INTERFACE)) { -- nss_warning("%p: tx request for interface that is not a wifi_mac_db: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for interface that is not a wifi_mac_db: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - -@@ -159,7 +159,7 @@ struct nss_ctx_instance *nss_register_wi - */ - nss_assert(if_num == NSS_WIFI_MAC_DB_INTERFACE); - -- nss_info("%p: nss_register_wifi_mac_db_if if_num:%d wifi_mac_db_dev:%p", nss_ctx, if_num, netdev); -+ nss_info("%px: nss_register_wifi_mac_db_if if_num:%d wifi_mac_db_dev:%px", nss_ctx, if_num, netdev); - - nss_core_register_subsys_dp(nss_ctx, if_num, wifi_mac_db_callback, NULL, NULL, netdev, features); - ---- a/nss_wifi_stats.c -+++ b/nss_wifi_stats.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2016-2017, 2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2016-2017, 2019-2020 The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -167,7 +167,7 @@ void nss_wifi_stats_sync(struct nss_ctx_ - uint8_t i = 0; - - if (radio_id >= NSS_MAX_WIFI_RADIO_INTERFACES) { -- nss_warning("%p: invalid interface: %d", nss_ctx, interface); -+ nss_warning("%px: invalid interface: %d", nss_ctx, interface); - return; - } - ---- a/nss_wifi_vdev.c -+++ b/nss_wifi_vdev.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -24,7 +24,7 @@ static void nss_wifi_vdev_handler(struct - { - nss_wifi_vdev_msg_callback_t cb; - -- nss_info("%p: NSS->HLOS message for wifi vdev on interface:%d", nss_ctx, ncm->interface); -+ nss_info("%px: NSS->HLOS message for wifi vdev on interface:%d", nss_ctx, ncm->interface); - - BUG_ON(((ncm->interface < NSS_DYNAMIC_IF_START) || (ncm->interface >= (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES)))); - -@@ -32,12 +32,12 @@ static void nss_wifi_vdev_handler(struct - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_WIFI_VDEV_MAX_MSG) { -- nss_warning("%p: received invalid message %d for wifi vdev interface", nss_ctx, ncm->type); -+ nss_warning("%px: received invalid message %d for wifi vdev interface", nss_ctx, ncm->type); - return; - } - - if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_wifi_vdev_msg)) { -- nss_warning("%p: Length of message %d is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm), (int)sizeof(struct nss_wifi_vdev_msg)); -+ nss_warning("%px: Length of message %d is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm), (int)sizeof(struct nss_wifi_vdev_msg)); - return; - } - -@@ -50,13 +50,13 @@ static void nss_wifi_vdev_handler(struct - * callback - */ - if (!nss_ctx->subsys_dp_register[ncm->interface].ndev) { -- nss_warning("%p: Event received wifi vdev interface %d before registration", nss_ctx, ncm->interface); -+ nss_warning("%px: Event received wifi vdev interface %d before registration", nss_ctx, ncm->interface); - return; - - } - - if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { -- ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface]; -+ ncm->cb = (nss_ptr_t)nss_core_get_msg_handler(nss_ctx, ncm->interface); - ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev; - } - -@@ -90,7 +90,7 @@ nss_tx_status_t nss_wifi_vdev_base_tx_ms - { - struct nss_cmn_msg *ncm = &msg->cm; - -- nss_trace("%p: Sending wifi vdev message on interface :%d", nss_ctx, ncm->interface); -+ nss_trace("%px: Sending wifi vdev message on interface :%d", nss_ctx, ncm->interface); - - /* - * Sanity checks on the message -@@ -100,12 +100,12 @@ nss_tx_status_t nss_wifi_vdev_base_tx_ms - * The interface number shall be wifi vdev base vap - */ - if (ncm->interface != NSS_VAP_INTERFACE) { -- nss_warning("%p: wifi vdev base tx request not on wifi vdev vap: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: wifi vdev base tx request not on wifi vdev vap: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_WIFI_VDEV_MAX_MSG) { -- nss_warning("%p: wifi vdev base message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: wifi vdev base message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -121,7 +121,7 @@ nss_tx_status_t nss_wifi_vdev_tx_msg(str - { - struct nss_cmn_msg *ncm = &msg->cm; - -- nss_trace("%p: Sending wifi vdev message on interface :%d", nss_ctx, ncm->interface); -+ nss_trace("%px: Sending wifi vdev message on interface :%d", nss_ctx, ncm->interface); - - /* - * Sanity checks on the message -@@ -131,12 +131,12 @@ nss_tx_status_t nss_wifi_vdev_tx_msg(str - * Interface shall be of dynamic interface type - */ - if ((ncm->interface < NSS_DYNAMIC_IF_START) || (ncm->interface >= (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES))) { -- nss_warning("%p: wifi vdev tx request for invalid interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: wifi vdev tx request for invalid interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_WIFI_VDEV_MAX_MSG) { -- nss_warning("%p: wifi vdev message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: wifi vdev message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -157,31 +157,31 @@ nss_tx_status_t nss_wifi_vdev_tx_msg_ext - NSS_VERIFY_CTX_MAGIC(nss_ctx); - - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: wifi vdev message dropped as core not ready", nss_ctx); -+ nss_warning("%px: wifi vdev message dropped as core not ready", nss_ctx); - return NSS_TX_FAILURE_NOT_READY; - } - - nm = (struct nss_wifi_vdev_msg *) os_buf->data; - ncm = &nm->cm; - -- nss_trace("%p: Sending wifi vdev message on interface :%d", nss_ctx, ncm->interface); -+ nss_trace("%px: Sending wifi vdev message on interface :%d", nss_ctx, ncm->interface); - - /* - * Interface shall be of dynamic interface type - */ - if ((ncm->interface < NSS_DYNAMIC_IF_START) || (ncm->interface >= (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES))) { -- nss_warning("%p: wifi vdev tx request for invalid interface: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: wifi vdev tx request for invalid interface: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - - if (ncm->type >= NSS_WIFI_VDEV_MAX_MSG) { -- nss_warning("%p: wifi vdev message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: wifi vdev message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - - status = nss_core_send_buffer(nss_ctx, 0, os_buf, NSS_IF_H2N_CMD_QUEUE, H2N_BUFFER_CTRL, H2N_BIT_FLAG_BUFFER_REUSABLE); - if (status != NSS_CORE_STATUS_SUCCESS) { -- nss_warning("%p: Unable to enqueue 'wifi vdev message'", nss_ctx); -+ nss_warning("%px: Unable to enqueue 'wifi vdev message'", nss_ctx); - return NSS_TX_FAILURE; - } - -@@ -215,7 +215,7 @@ nss_tx_status_t nss_wifi_vdev_set_next_h - struct nss_wifi_vdev_set_next_hop_msg *next_hop_msg = NULL; - - if (!wifivdevmsg) { -- nss_warning("%p: Unable to allocate next hop message", ctx); -+ nss_warning("%px: Unable to allocate next hop message", ctx); - return NSS_TX_FAILURE; - } - -@@ -226,7 +226,7 @@ nss_tx_status_t nss_wifi_vdev_set_next_h - - status = nss_wifi_vdev_tx_msg(ctx, wifivdevmsg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to send next hop message", ctx); -+ nss_warning("%px: Unable to send next hop message", ctx); - } - - kfree(wifivdevmsg); -@@ -244,7 +244,7 @@ nss_tx_status_t nss_wifi_vdev_base_set_n - struct nss_wifi_vdev_set_next_hop_msg *next_hop_msg = NULL; - - if (!wifivdevmsg) { -- nss_warning("%p: Unable to allocate next hop message", ctx); -+ nss_warning("%px: Unable to allocate next hop message", ctx); - return NSS_TX_FAILURE; - } - -@@ -255,7 +255,7 @@ nss_tx_status_t nss_wifi_vdev_base_set_n - - status = nss_wifi_vdev_base_tx_msg(ctx, wifivdevmsg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to send next hop message", ctx); -+ nss_warning("%px: Unable to send next hop message", ctx); - } - - kfree(wifivdevmsg); -@@ -273,7 +273,7 @@ nss_tx_status_t nss_wifi_vdev_set_peer_n - struct nss_wifi_vdev_set_peer_next_hop_msg *peer_next_hop_msg = NULL; - - if (!wifivdevmsg) { -- nss_warning("%p: Unable to allocate next hop message", ctx); -+ nss_warning("%px: Unable to allocate next hop message", ctx); - return NSS_TX_FAILURE; - } - -@@ -286,7 +286,7 @@ nss_tx_status_t nss_wifi_vdev_set_peer_n - - status = nss_wifi_vdev_tx_msg(ctx, wifivdevmsg); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: Unable to send peer next hop message", ctx); -+ nss_warning("%px: Unable to send peer next hop message", ctx); - } - - kfree(wifivdevmsg); -@@ -307,7 +307,7 @@ bool nss_wifi_vdev_set_dp_type(struct ns - nss_assert((if_num >= NSS_DYNAMIC_IF_START) && (if_num < (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES))); - - if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) { -- nss_warning("%p: Vap interface dp type could not be set as core is not initialized\n", nss_ctx); -+ nss_warning("%px: Vap interface dp type could not be set as core is not initialized\n", nss_ctx); - return false; - } - -@@ -337,11 +337,17 @@ uint32_t nss_register_wifi_vdev_if(struc - struct net_device *netdev, - uint32_t features) - { -+ uint32_t status; -+ - nss_assert((if_num >= NSS_DYNAMIC_IF_START) && (if_num < (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES))); - - nss_core_register_subsys_dp(nss_ctx, if_num, vdev_data_callback, vdev_ext_data_callback, NULL, netdev, features); - -- nss_top_main.if_rx_msg_callback[if_num] = vdev_event_callback; -+ status = nss_core_register_msg_handler(nss_ctx, if_num, vdev_event_callback); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to register event handler for interface(%u)", nss_ctx, if_num); -+ return status; -+ } - - nss_core_register_handler(nss_ctx, if_num, nss_wifi_vdev_handler, NULL); - -@@ -355,13 +361,18 @@ EXPORT_SYMBOL(nss_register_wifi_vdev_if) - void nss_unregister_wifi_vdev_if(uint32_t if_num) - { - struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.wifi_handler_id]; -+ uint32_t status; - - nss_assert(nss_ctx); - nss_assert((if_num >= NSS_DYNAMIC_IF_START) && (if_num < (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES))); - - nss_core_unregister_subsys_dp(nss_ctx, if_num); - -- nss_top_main.if_rx_msg_callback[if_num] = NULL; -+ status = nss_core_unregister_msg_handler(nss_ctx, if_num); -+ if (status != NSS_CORE_STATUS_SUCCESS) { -+ nss_warning("%px: unable to unregister event handler for interface(%u)", nss_ctx, if_num); -+ return; -+ } - - nss_core_unregister_handler(nss_ctx, if_num); - } ---- a/nss_wifili.c -+++ b/nss_wifili.c -@@ -43,7 +43,7 @@ static void nss_wifili_handler(struct ns - void *ctx; - nss_wifili_msg_callback_t cb; - -- nss_info("%p: NSS->HLOS message for wifili\n", nss_ctx); -+ nss_info("%px: NSS->HLOS message for wifili\n", nss_ctx); - - /* - * The interface number shall be wifili soc interface or wifili radio interface -@@ -62,12 +62,13 @@ static void nss_wifili_handler(struct ns - * Is this a valid request/response packet? - */ - if (ncm->type >= NSS_WIFILI_MAX_MSG) { -- nss_warning("%p: Received invalid message %d for wifili interface", nss_ctx, ncm->type); -+ nss_warning("%px: Received invalid message %d for wifili interface", nss_ctx, ncm->type); - return; - } - -- if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_wifili_msg)) { -- nss_warning("%p: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); -+ if ((nss_cmn_get_msg_len(ncm) > sizeof(struct nss_wifili_msg)) && -+ ntm->cm.type != NSS_WIFILI_PEER_EXT_STATS_MSG) { -+ nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); - return; - } - -@@ -101,7 +102,7 @@ static void nss_wifili_handler(struct ns - * Do we have a call back - */ - if (!ncm->cb) { -- nss_info("%p: cb null for wifili interface %d", nss_ctx, ncm->interface); -+ nss_info("%px: cb null for wifili interface %d", nss_ctx, ncm->interface); - return; - } - -@@ -115,7 +116,7 @@ static void nss_wifili_handler(struct ns - * call wifili msg callback - */ - if (!ctx) { -- nss_warning("%p: Event received for wifili interface %d before registration", nss_ctx, ncm->interface); -+ nss_warning("%px: Event received for wifili interface %d before registration", nss_ctx, ncm->interface); - return; - } - -@@ -163,7 +164,7 @@ nss_tx_status_t nss_wifili_tx_msg(struct - nss_wifili_log_tx_msg(msg); - - if (ncm->type >= NSS_WIFILI_MAX_MSG) { -- nss_warning("%p: wifili message type out of range: %d", nss_ctx, ncm->type); -+ nss_warning("%px: wifili message type out of range: %d", nss_ctx, ncm->type); - return NSS_TX_FAILURE; - } - -@@ -173,7 +174,7 @@ nss_tx_status_t nss_wifili_tx_msg(struct - if ((ncm->interface != NSS_WIFILI_INTERNAL_INTERFACE) - && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE0) - && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE1)) { -- nss_warning("%p: tx request for interface that is not a wifili: %d", nss_ctx, ncm->interface); -+ nss_warning("%px: tx request for interface that is not a wifili: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } - -@@ -199,14 +200,14 @@ nss_tx_status_t nss_wifili_tx_msg_sync(s - - status = nss_wifili_tx_msg(nss_ctx, nvm); - if (status != NSS_TX_SUCCESS) { -- nss_warning("%p: wifili_tx_msg failed\n", nss_ctx); -+ nss_warning("%px: wifili_tx_msg failed\n", nss_ctx); - up(&wifili_pvt.sem); - return status; - } - - ret = wait_for_completion_timeout(&wifili_pvt.complete, msecs_to_jiffies(NSS_WIFILI_TX_TIMEOUT)); - if (!ret) { -- nss_warning("%p: wifili msg tx failed due to timeout\n", nss_ctx); -+ nss_warning("%px: wifili msg tx failed due to timeout\n", nss_ctx); - wifili_pvt.response = NSS_TX_FAILURE; - } - -@@ -244,7 +245,7 @@ uint32_t nss_get_available_wifili_extern - return NSS_WIFILI_EXTERNAL_INTERFACE1; - } - -- nss_warning("%p: No available external intefaces\n", nss_ctx); -+ nss_warning("%px: No available external intefaces\n", nss_ctx); - - return NSS_MAX_NET_INTERFACES; - } -@@ -283,7 +284,7 @@ struct nss_ctx_instance *nss_register_wi - || (if_num == NSS_WIFILI_EXTERNAL_INTERFACE0) - || (if_num == NSS_WIFILI_EXTERNAL_INTERFACE1)); - -- nss_info("nss_register_wifili_if if_num %d wifictx %p", if_num, netdev); -+ nss_info("nss_register_wifili_if if_num %d wifictx %px", if_num, netdev); - - nss_core_register_subsys_dp(nss_ctx, if_num, wifili_callback, wifili_ext_callback, NULL, netdev, features); - -@@ -326,7 +327,7 @@ struct nss_ctx_instance *nss_register_wi - * The interface number shall be wifili radio dynamic interface - */ - nss_assert(nss_is_dynamic_interface(if_num)); -- nss_info("nss_register_wifili_if if_num %d wifictx %p", if_num, netdev); -+ nss_info("nss_register_wifili_if if_num %d wifictx %px", if_num, netdev); - - nss_core_register_subsys_dp(nss_ctx, if_num, wifili_callback, wifili_ext_callback, NULL, netdev, features); - ---- a/nss_wifili_log.c -+++ b/nss_wifili_log.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2018, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -157,7 +157,7 @@ static void nss_wifili_log_init_msg(stru - { - struct nss_wifili_init_msg *nwim __maybe_unused = &nwm->msg.init; - int32_t i; -- nss_trace("%p: NSS WIFILI Init Message:\n" -+ nss_trace("%px: NSS WIFILI Init Message:\n" - "WIFILI HAL Source Ring Base Address: %x\n" - "WIFILI HAL Source Ring Shadow Read Pointer Address: %x\n" - "WIFILI HAL Source Ring Shadow Write Pointer Address: %x\n" -@@ -210,7 +210,7 @@ static void nss_wifili_log_init_msg(stru - static void nss_wifili_log_pdev_init_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_pdev_init_msg *nwim __maybe_unused = &nwm->msg.pdevmsg; -- nss_trace("%p: NSS WIFILI PDEV Init Message:\n" -+ nss_trace("%px: NSS WIFILI PDEV Init Message:\n" - "WIFILI Radio ID: %x\n" - "WIFILI MAC Hardware Mode: %d\n" - "WIFILI Lower MAC ID: %x\n", -@@ -230,7 +230,7 @@ static void nss_wifili_log_pdev_init_msg - static void nss_wifili_log_pdev_deinit_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_pdev_deinit_msg *nwim __maybe_unused = &nwm->msg.pdevdeinit; -- nss_trace("%p: NSS WIFILI PDEV Deinit Message:\n" -+ nss_trace("%px: NSS WIFILI PDEV Deinit Message:\n" - "WIFILI Interface Number: %d\n", - nwim, nwim->ifnum); - } -@@ -242,7 +242,7 @@ static void nss_wifili_log_pdev_deinit_m - static void nss_wifili_log_peer_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_peer_msg *nwim __maybe_unused = &nwm->msg.peermsg; -- nss_trace("%p: NSS WIFILI Peer Message:\n" -+ nss_trace("%px: NSS WIFILI Peer Message:\n" - "WIFILI Peer MAC Address: %pM\n" - "WIFILI VAP ID: %d\n" - "WIFILI Peed ID: %d\n" -@@ -262,7 +262,7 @@ static void nss_wifili_log_peer_msg(stru - static void nss_wifili_log_peer_freelist_append_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_peer_freelist_append_msg *nwim __maybe_unused = &nwm->msg.peer_freelist_append; -- nss_trace("%p: NSS WIFILI Peer Memory Request Message:\n" -+ nss_trace("%px: NSS WIFILI Peer Memory Request Message:\n" - "WIFILI Starting Address of Freelist: %x\n" - "WIFILI Length: %d\n" - "WIFILI Maximum number of peer entries supported in pool: %d\n", -@@ -277,7 +277,7 @@ static void nss_wifili_log_peer_freelist - static void nss_wifili_log_wds_peer_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_wds_peer_msg *nwim __maybe_unused = &nwm->msg.wdspeermsg; -- nss_trace("%p: NSS WIFILI WDS Peer Message:\n" -+ nss_trace("%px: NSS WIFILI WDS Peer Message:\n" - "WIFILI Destination MAC: %pM\n" - "WIFILI Peer MAC: %pM\n", - nwim, nwim->dest_mac, nwim->peer_mac); -@@ -290,7 +290,7 @@ static void nss_wifili_log_wds_peer_msg( - static void nss_wifili_log_wds_active_info_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_wds_active_info_msg *nwim __maybe_unused = &nwm->msg.wdsinfomsg; -- nss_trace("%p: NSS WIFILI WDS Active Info Message:\n" -+ nss_trace("%px: NSS WIFILI WDS Active Info Message:\n" - "WIFILI Number OF Entries: %d\n" - "WIFILI Hardware AST Index: %d\n", - nwim, nwim->nentries, nwim->info[0].ast_idx); -@@ -303,7 +303,7 @@ static void nss_wifili_log_wds_active_in - static void nss_wifili_log_stats_cfg_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_stats_cfg_msg *nwim __maybe_unused = &nwm->msg.scm; -- nss_trace("%p: NSS WIFILI Stats Config Message:\n" -+ nss_trace("%px: NSS WIFILI Stats Config Message:\n" - "WIFILI Enable/Disable Config: %d\n", - nwim, nwim->cfg); - } -@@ -315,7 +315,7 @@ static void nss_wifili_log_stats_cfg_msg - static void nss_wifili_log_reo_tidq_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_reo_tidq_msg *nwim __maybe_unused = &nwm->msg.reotidqmsg; -- nss_trace("%p: NSS WIFILI reo tidq setup Message:\n" -+ nss_trace("%px: NSS WIFILI reo tidq setup Message:\n" - "WIFILI Traffic Identification Value: %d\n" - "WIFILI Peer ID: %d\n", - nwim, nwim->tid, nwim->peer_id); -@@ -328,7 +328,7 @@ static void nss_wifili_log_reo_tidq_msg( - static void nss_wifili_log_radio_cfg_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_radio_cfg_msg *nwim __maybe_unused = &nwm->msg.radiocfgmsg; -- nss_trace("%p: NSS WIFILI Radio Command Message:\n" -+ nss_trace("%px: NSS WIFILI Radio Command Message:\n" - "WIFILI Radio Interface Number %d\n", - nwim, nwim->radio_if_num); - } -@@ -340,7 +340,7 @@ static void nss_wifili_log_radio_cfg_msg - static void nss_wifili_log_wds_extn_peer_cfg_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_wds_extn_peer_cfg_msg *nwim __maybe_unused = &nwm->msg.wpeercfg; -- nss_trace("%p: NSS WIFILI WDS vendor extension configuration message:\n" -+ nss_trace("%px: NSS WIFILI WDS vendor extension configuration message:\n" - "WIFILI Peer MAC Addr: %pM\n" - "WIFILI WDS Flags: %d\n" - "WIFILI Peer ID: %d\n", -@@ -355,7 +355,7 @@ static void nss_wifili_log_wds_extn_peer - static void nss_wifili_log_soc_linkdesc_buf_info_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_soc_linkdesc_buf_info_msg *nwim __maybe_unused = &nwm->msg.linkdescinfomsg; -- nss_trace("%p: NSS WIFILI Link descriptor buffer address information:\n" -+ nss_trace("%px: NSS WIFILI Link descriptor buffer address information:\n" - "WIFILI Link Descriptor Low Address: %x\n" - "WIFILI Link Descriptor High Address: %x\n", - nwim, nwim->buffer_addr_low, -@@ -370,7 +370,7 @@ static void nss_wifili_log_peer_security - { - struct nss_wifili_peer_security_type_msg *nwim __maybe_unused = &nwm->msg.securitymsg; - int32_t i; -- nss_trace("%p: NSS WIFILI Peer Security Message:\n" -+ nss_trace("%px: NSS WIFILI Peer Security Message:\n" - "WIFILI Peer ID: %d\n" - "WIFILI Packet Type: %d\n" - "WIFILI Security Type: %d\n", -@@ -392,7 +392,7 @@ static void nss_wifili_log_peer_security - static void nss_wifili_log_peer_nawds_enable_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_peer_nawds_enable_msg *nwim __maybe_unused = &nwm->msg.nawdsmsg; -- nss_trace("%p: NSS WIFILI NAWDS enable for peer:\n" -+ nss_trace("%px: NSS WIFILI NAWDS enable for peer:\n" - "WIFILI Peer ID: %d\n" - "WIFILI Enable NAWDS: %d\n", - nwim, nwim->peer_id, nwim->is_nawds); -@@ -405,7 +405,7 @@ static void nss_wifili_log_peer_nawds_en - static void nss_wifili_log_dbdc_repeater_set_msg(struct nss_wifili_msg *nwm) - { - struct nss_wifili_dbdc_repeater_set_msg *nwim __maybe_unused = &nwm->msg.dbdcrptrmsg; -- nss_trace("%p: NSS WIFILI DBDC Repeater Enable Message:\n" -+ nss_trace("%px: NSS WIFILI DBDC Repeater Enable Message:\n" - "WIFILI DBDC Enable Flag: %d\n", - nwim, nwim->is_dbdc_en); - } -@@ -497,7 +497,7 @@ static void nss_wifili_log_verbose(struc - break; - - default: -- nss_warning("%p: Invalid message type\n", nwm); -+ nss_warning("%px: Invalid message type\n", nwm); - break; - } - } -@@ -509,11 +509,11 @@ static void nss_wifili_log_verbose(struc - void nss_wifili_log_tx_msg(struct nss_wifili_msg *nwm) - { - if (nwm->cm.type >= NSS_WIFILI_MAX_MSG) { -- nss_warning("%p: Invalid message type\n", nwm); -+ nss_warning("%px: Invalid message type\n", nwm); - return; - } - -- nss_info("%p: type[%d]:%s\n", nwm, nwm->cm.type, nss_wifili_log_message_types_str[nwm->cm.type]); -+ nss_info("%px: type[%d]:%s\n", nwm, nwm->cm.type, nss_wifili_log_message_types_str[nwm->cm.type]); - nss_wifili_log_verbose(nwm); - } - -@@ -524,26 +524,26 @@ void nss_wifili_log_tx_msg(struct nss_wi - void nss_wifili_log_rx_msg(struct nss_wifili_msg *nwm) - { - if (nwm->cm.response >= NSS_CMN_RESPONSE_LAST) { -- nss_warning("%p: Invalid response\n", nwm); -+ nss_warning("%px: Invalid response\n", nwm); - return; - } - - if (nwm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nwm->cm.response == NSS_CMN_RESPONSE_ACK)) { -- nss_info("%p: type[%d]:%s, response[%d]:%s\n", nwm, nwm->cm.type, -+ nss_info("%px: type[%d]:%s, response[%d]:%s\n", nwm, nwm->cm.type, - nss_wifili_log_message_types_str[nwm->cm.type], - nwm->cm.response, nss_cmn_response_str[nwm->cm.response]); - goto verbose; - } - - if (nwm->cm.error >= NSS_WIFILI_EMSG_UNKNOWN) { -- nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", -+ nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", - nwm, nwm->cm.type, nss_wifili_log_message_types_str[nwm->cm.type], - nwm->cm.response, nss_cmn_response_str[nwm->cm.response], - nwm->cm.error); - goto verbose; - } - -- nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", -+ nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", - nwm, nwm->cm.type, nss_wifili_log_message_types_str[nwm->cm.type], - nwm->cm.response, nss_cmn_response_str[nwm->cm.response], - nwm->cm.error, nss_wifili_log_error_response_types_str[nwm->cm.error]); ---- a/nss_wifili_stats.c -+++ b/nss_wifili_stats.c -@@ -259,7 +259,7 @@ void nss_wifili_stats_sync(struct nss_ct - break; - - default: -- nss_warning("%p: Invalid wifili interface\n", nss_ctx); -+ nss_warning("%px: Invalid wifili interface\n", nss_ctx); - return; - } - -@@ -436,6 +436,7 @@ void nss_wifili_stats_sync(struct nss_ct - /* - * update wbm ring stats - */ -+ stats->stats_wbm[NSS_WIFILI_STATS_WBM_IE_LOCAL_ALLOC_FAIL] += devstats->rxwbm_stats.invalid_buf_mgr; - stats->stats_wbm[NSS_WIFILI_STATS_WBM_SRC_DMA] += devstats->rxwbm_stats.err_src_rxdma; - stats->stats_wbm[NSS_WIFILI_STATS_WBM_SRC_DMA_CODE_INV] += devstats->rxwbm_stats.err_src_rxdma_code_inv; - stats->stats_wbm[NSS_WIFILI_STATS_WBM_SRC_REO] += devstats->rxwbm_stats.err_src_reo; -@@ -459,7 +460,7 @@ void nss_wifili_stats_notify(struct nss_ - - wifili_stats = kzalloc(sizeof(struct nss_wifili_stats_notification), GFP_KERNEL); - if (!wifili_stats) { -- nss_warning("%p: Failed to allocate memory for wifili stats\n", nss_ctx); -+ nss_warning("%px: Failed to allocate memory for wifili stats\n", nss_ctx); - return; - } - -@@ -478,7 +479,7 @@ void nss_wifili_stats_notify(struct nss_ - break; - - default: -- nss_warning("%p: Invalid wifili interface\n", nss_ctx); -+ nss_warning("%px: Invalid wifili interface\n", nss_ctx); - goto done; - } - wifili_stats->if_num = if_num; ---- a/nss_wifili_strings.c -+++ b/nss_wifili_strings.c -@@ -138,6 +138,7 @@ struct nss_stats_info nss_wifili_strings - * wifili wbm ring stats - */ - struct nss_stats_info nss_wifili_strings_stats_wbm[NSS_WIFILI_STATS_WBM_MAX] = { -+ {"wbm_ie_local_alloc_fail" , NSS_STATS_TYPE_ERROR}, - {"wbm_src_dma" , NSS_STATS_TYPE_SPECIAL}, - {"wbm_src_dma_code_inv" , NSS_STATS_TYPE_SPECIAL}, - {"wbm_src_reo" , NSS_STATS_TYPE_SPECIAL}, ---- a/exports/nss_cmn.h -+++ b/exports/nss_cmn.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2014, 2016-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2014, 2016-2020, The Linux Foundation. All rights reserved. - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all copies. -@@ -27,6 +27,11 @@ - * @{ - */ - -+/* -+ * Interface Number 1 Valid 7 Core 8 Type 16 Index -+ */ -+typedef int32_t nss_if_num_t; -+ - /** - * @struct nss_ctx_instance - * Forward declaration for structure that contains instance data for each diff --git a/qca-nss-drv/patches/0009-kernel-5.15-support.patch b/qca-nss-drv/patches/0009-kernel-5.15-support.patch index 9d822f8..43f0de5 100644 --- a/qca-nss-drv/patches/0009-kernel-5.15-support.patch +++ b/qca-nss-drv/patches/0009-kernel-5.15-support.patch @@ -16,7 +16,7 @@ Signed-off-by: Ansuel Smith --- a/nss_core.c +++ b/nss_core.c -@@ -53,7 +53,8 @@ +@@ -47,7 +47,8 @@ (((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)))) || \ @@ -26,7 +26,7 @@ Signed-off-by: Ansuel Smith #error "Check skb recycle code in this file to match Linux version" #endif -@@ -2562,7 +2563,11 @@ static inline bool nss_core_skb_can_reus +@@ -2454,7 +2455,11 @@ static inline bool nss_skb_can_reuse(str if (unlikely(irqs_disabled())) return false; diff --git a/qca-nss-drv/patches/0011-treewide-hack-support-for-mismatched-firmware.patch b/qca-nss-drv/patches/0011-treewide-hack-support-for-mismatched-firmware.patch index 1144db9..84b39ae 100644 --- a/qca-nss-drv/patches/0011-treewide-hack-support-for-mismatched-firmware.patch +++ b/qca-nss-drv/patches/0011-treewide-hack-support-for-mismatched-firmware.patch @@ -9,82 +9,14 @@ /** * @addtogroup nss_dynamic_interface_subsystem * @{ -@@ -101,9 +103,11 @@ enum nss_dynamic_interface_type { - NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N, - NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0, - NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1, -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1)) - NSS_DYNAMIC_INTERFACE_TYPE_TLS_INNER, - NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER, - NSS_DYNAMIC_INTERFACE_TYPE_MIRROR, -+#endif - NSS_DYNAMIC_INTERFACE_TYPE_MAX - }; - ---- a/nss_hal/nss_hal.c -+++ b/nss_hal/nss_hal.c -@@ -381,13 +381,14 @@ int nss_hal_probe(struct platform_device - nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_H2N] = nss_dev->id; - } - -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) - #ifdef NSS_DRV_CAPWAP_ENABLE - if (npd->capwap_enabled == NSS_FEATURE_ENABLED) { - nss_top->capwap_handler_id = nss_dev->id; - nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP] = nss_dev->id; - } - #endif -- -+#endif - if (npd->ipv4_reasm_enabled == NSS_FEATURE_ENABLED) { - nss_top->ipv4_reasm_handler_id = nss_dev->id; - nss_ipv4_reasm_register_handler(); -@@ -646,6 +647,7 @@ int nss_hal_probe(struct platform_device - nss_match_init(); - } - -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1)) - #ifdef NSS_DRV_TLS_ENABLE - #if defined(NSS_HAL_IPQ807x_SUPPORT) || defined(NSS_HAL_IPQ60XX_SUPPORT) - if (npd->tls_enabled == NSS_FEATURE_ENABLED) { -@@ -656,12 +658,15 @@ int nss_hal_probe(struct platform_device - } - #endif - #endif -+#ifdef NSS_DRV_MIRROR_ENABLE - if (npd->mirror_enabled == NSS_FEATURE_ENABLED) { - nss_top->mirror_handler_id = nss_dev->id; - nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_MIRROR] = nss_dev->id; - nss_mirror_register_handler(); - nss_info("%d: NSS mirror is enabled", nss_dev->id); - } -+#endif -+#endif - - if (nss_ctx->id == 0) { - #if (NSS_FREQ_SCALE_SUPPORT == 1) --- a/exports/nss_ipv4.h +++ b/exports/nss_ipv4.h -@@ -26,6 +26,8 @@ - #include "nss_stats_public.h" - #endif +@@ -27,6 +27,8 @@ + * @{ + */ +#include "nss_fw_version.h" + /** - * @addtogroup nss_ipv4_subsystem - * @{ ---- /dev/null -+++ b/exports/nss_fw_version.h -@@ -0,0 +1,11 @@ -+#ifndef __NSS_FW_VERSION_H -+#define __NSS_FW_VERSION_H -+ -+#define NSS_FW_VERSION_MAJOR 11 -+#define NSS_FW_VERSION_MINOR 0 -+ -+#define NSS_FW_VERSION(a,b) (((a) << 8) + (b)) -+ -+#define NSS_FW_VERSION_CODE NSS_FW_VERSION(NSS_FW_VERSION_MAJOR, NSS_FW_VERSION_MINOR) -+ -+#endif /* __NSS_FW_VERSION_H */ + * nss_ipv4_message_types + * IPv4 bridge and routing rule message types. diff --git a/qca-nss-drv/patches/0012-Makefile-modularize-driver.patch b/qca-nss-drv/patches/0012-Makefile-modularize-driver.patch index 5789912..e3c67bc 100644 --- a/qca-nss-drv/patches/0012-Makefile-modularize-driver.patch +++ b/qca-nss-drv/patches/0012-Makefile-modularize-driver.patch @@ -1,179 +1,22 @@ ---- a/Makefile -+++ b/Makefile -@@ -46,13 +46,7 @@ qca-nss-drv-objs := \ - nss_lso_rx.o \ - nss_lso_rx_stats.o \ - nss_lso_rx_strings.o \ -- nss_match.o \ -- nss_match_log.o \ -- nss_match_stats.o \ - nss_meminfo.o \ -- nss_mirror.o \ -- nss_mirror_log.o \ -- nss_mirror_stats.o \ - nss_n2h.o \ - nss_n2h_stats.o \ - nss_n2h_strings.o \ -@@ -60,28 +54,44 @@ qca-nss-drv-objs := \ - nss_pm.o \ - nss_profiler.o \ - nss_project.o \ -- nss_ppe.o \ -- nss_ppe_log.o \ -- nss_ppe_stats.o \ -- nss_ppe_vp.o \ -- nss_ppe_vp_log.o \ -- nss_ppe_vp_stats.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 data plane/HAL support -+qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o -+qca-nss-drv-objs += nss_hal/nss_hal.o -+ -+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_VIRT_IF_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_VIRT_IF_ENABLE -+qca-nss-drv-objs += \ - nss_virt_if.o \ -- nss_virt_if_stats.o \ -+ nss_virt_if_stats.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 \ -- nss_wifi.o \ -+ nss_vlan_log.o -+endif -+ -+ifneq "$(NSS_DRV_WIFI_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_WIFI_ENABLE -+qca-nss-drv-objs += nss_wifi.o \ - nss_wifi_log.o \ - nss_wifi_stats.o \ - nss_wifi_vdev.o \ -@@ -92,10 +102,7 @@ qca-nss-drv-objs := \ - nss_wifili_stats.o \ - nss_wifili_strings.o \ - nss_wifi_mac_db.o -- --# Base NSS data plane/HAL 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_L2TP_ENABLE)" "n" - ccflags-y += -DNSS_DRV_L2TP_ENABLE -@@ -121,6 +128,22 @@ qca-nss-drv-objs += \ - nss_pvxlan_stats.o - endif - -+ifneq "$(NSS_DRV_MATCH_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_MATCH_ENABLE -+qca-nss-drv-objs += \ -+ nss_match.o \ -+ nss_match_log.o \ -+ nss_match_stats.o -+endif -+ -+ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_MIRROR_ENABLE -+qca-nss-drv-objs += \ -+ nss_mirror.o \ -+ nss_mirror_log.o \ -+ nss_mirror_stats.o -+endif -+ - ifneq "$(NSS_DRV_TSTAMP_ENABLE)" "n" - ccflags-y += -DNSS_DRV_TSTAMP_ENABLE - qca-nss-drv-objs += \ -@@ -292,6 +315,7 @@ endif - ifeq ($(SoC),$(filter $(SoC),ipq806x ipq40xx)) - qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \ - nss_hal/ipq806x/nss_hal_pvt.o -+ - ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" - ccflags-y += -DNSS_DRV_IPSEC_ENABLE - qca-nss-drv-objs += \ -@@ -317,7 +341,16 @@ ccflags-y += -I$(obj)/nss_hal/ipq806x -D - endif - - ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64 ipq807x ipq807x_64)) --qca-nss-drv-objs += nss_data_plane/nss_data_plane.o -+qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \ -+ nss_ppe.o \ -+ nss_ppe_log.o \ -+ nss_ppe_stats.o \ -+ nss_ppe_vp.o \ -+ nss_ppe_vp_log.o \ -+ nss_ppe_vp_stats.o -+ -+ccflags-y += -DNSS_DRV_PPE_ENABLE -+ccflags-y += -DNSS_DRV_EDMA_ENABLE - - ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" - ccflags-y += -DNSS_DRV_IPSEC_ENABLE --- a/nss_hal/nss_hal.c +++ b/nss_hal/nss_hal.c -@@ -458,16 +458,20 @@ int nss_hal_probe(struct platform_device +@@ -489,6 +489,7 @@ int nss_hal_probe(struct platform_device + nss_portid_register_handler(); } - #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) { - nss_top->ppe_handler_id = nss_dev->id; - nss_ppe_register_handler(); - nss_ppe_vp_register_handler(); - } -+#endif - - #ifdef NSS_DRV_L2TP_ENABLE - if (npd->l2tpv2_enabled == NSS_FEATURE_ENABLED) { -@@ -554,6 +558,7 @@ int nss_hal_probe(struct platform_device - } - #endif +#ifdef NSS_DRV_WIFI_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; -@@ -569,6 +574,7 @@ int nss_hal_probe(struct platform_device - nss_top->wmdb_handler_id = nss_dev->id; - nss_wifi_mac_db_register_handler(); +@@ -506,6 +507,7 @@ int nss_hal_probe(struct platform_device + nss_top->oam_handler_id = nss_dev->id; + nss_oam_register_handler(); } +#endif - #ifdef NSS_DRV_OAM_ENABLE - if (npd->oam_enabled == NSS_FEATURE_ENABLED) { -@@ -583,11 +589,13 @@ int nss_hal_probe(struct platform_device + if (npd->bridge_enabled == NSS_FEATURE_ENABLED) { + nss_top->bridge_handler_id = nss_dev->id; +@@ -513,11 +515,13 @@ int nss_hal_probe(struct platform_device nss_bridge_init(); } @@ -185,25 +28,11 @@ } +#endif - #ifdef NSS_DRV_QVPN_ENABLE #if defined(NSS_HAL_IPQ807x_SUPPORT) || defined(NSS_HAL_IPQ60XX_SUPPORT) -@@ -641,11 +649,13 @@ int nss_hal_probe(struct platform_device - } - #endif - -+#ifdef NSS_DRV_MATCH_ENABLE - if (npd->match_enabled == NSS_FEATURE_ENABLED) { - nss_top->match_handler_id = nss_dev->id; - nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_MATCH] = nss_dev->id; - nss_match_init(); - } -+#endif - - #if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1)) - #ifdef NSS_DRV_TLS_ENABLE + if (npd->qvpn_enabled == NSS_FEATURE_ENABLED) { --- a/nss_init.c +++ b/nss_init.c -@@ -771,11 +771,12 @@ static int __init nss_init(void) +@@ -751,11 +751,12 @@ static int __init nss_init(void) */ nss_project_register_sysctl(); @@ -217,22 +46,9 @@ /* * Setup Runtime Sample values */ -@@ -860,9 +861,9 @@ static int __init nss_init(void) - /* - * INIT ppe on supported platform +@@ -866,10 +867,12 @@ static void __exit nss_cleanup(void) */ -- if (of_machine_is_compatible("qcom,ipq807x") || of_machine_is_compatible("qcom,ipq8074")|| of_machine_is_compatible("qcom,ipq6018")) { -- nss_ppe_init(); -- } -+#ifdef NSS_DRV_PPE_ENABLE -+ nss_ppe_init(); -+#endif - - #ifdef NSS_DRV_DMA_ENABLE - nss_dma_init(); -@@ -902,10 +903,12 @@ static void __exit nss_cleanup(void) nss_c2c_tx_unregister_sysctl(); - #endif +#ifdef NSS_DRV_PPPOE_ENABLE /* @@ -243,7 +59,7 @@ /* * Unregister ipv4/6 specific sysctl -@@ -925,9 +928,9 @@ static void __exit nss_cleanup(void) +@@ -889,9 +892,9 @@ static void __exit nss_cleanup(void) /* * cleanup ppe on supported platform */ diff --git a/qca-nss-drv/patches/0013-backport-12.1.patch b/qca-nss-drv/patches/0013-backport-12.1.patch deleted file mode 100644 index 57b875f..0000000 --- a/qca-nss-drv/patches/0013-backport-12.1.patch +++ /dev/null @@ -1,716 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -8,8 +8,6 @@ obj-m += qca-nss-drv.o - # List the files that belong to the driver in alphabetical order. - # - qca-nss-drv-objs := \ -- nss_bridge.o \ -- nss_bridge_log.o \ - nss_cmn.o \ - nss_core.o \ - nss_coredump.o \ -@@ -18,9 +16,6 @@ qca-nss-drv-objs := \ - nss_dynamic_interface.o \ - nss_dynamic_interface_log.o \ - nss_dynamic_interface_stats.o \ -- nss_edma.o \ -- nss_edma_stats.o \ -- nss_edma_strings.o \ - nss_eth_rx.o \ - nss_eth_rx_stats.o \ - nss_eth_rx_strings.o \ -@@ -32,16 +27,6 @@ qca-nss-drv-objs := \ - nss_ipv4_stats.o \ - nss_ipv4_strings.o \ - nss_ipv4_log.o \ -- nss_ipv4_reasm.o \ -- nss_ipv4_reasm_stats.o \ -- nss_ipv4_reasm_strings.o \ -- nss_ipv6.o \ -- nss_ipv6_stats.o \ -- nss_ipv6_strings.o \ -- nss_ipv6_log.o \ -- nss_ipv6_reasm.o \ -- nss_ipv6_reasm_stats.o \ -- nss_ipv6_reasm_strings.o \ - nss_log.o \ - nss_lso_rx.o \ - nss_lso_rx_stats.o \ -@@ -104,6 +89,21 @@ qca-nss-drv-objs += nss_wifi.o \ - nss_wifi_mac_db.o - endif - -+ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_BRIDGE_ENABLE -+qca-nss-drv-objs += \ -+ nss_bridge.o \ -+ nss_bridge_log.o -+endif -+ -+ifneq "$(NSS_DRV_IPV4_REASM_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_IPV4_REASM_ENABLE -+qca-nss-drv-objs += \ -+ nss_ipv4_reasm.o \ -+ nss_ipv4_reasm_stats.o \ -+ nss_ipv4_reasm_strings.o -+endif -+ - ifneq "$(NSS_DRV_L2TP_ENABLE)" "n" - ccflags-y += -DNSS_DRV_L2TP_ENABLE - qca-nss-drv-objs += \ -@@ -128,20 +128,20 @@ qca-nss-drv-objs += \ - nss_pvxlan_stats.o - endif - --ifneq "$(NSS_DRV_MATCH_ENABLE)" "n" --ccflags-y += -DNSS_DRV_MATCH_ENABLE -+ifneq "$(NSS_DRV_IPV6_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_IPV6_ENABLE - qca-nss-drv-objs += \ -- nss_match.o \ -- nss_match_log.o \ -- nss_match_stats.o -+ nss_ipv6.o \ -+ nss_ipv6_stats.o \ -+ nss_ipv6_strings.o \ -+ nss_ipv6_log.o -+ifneq "$(NSS_DRV_IPV6_REASM_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_IPV6_REASM_ENABLE -+qca-nss-drv-objs += \ -+ nss_ipv6_reasm.o \ -+ nss_ipv6_reasm_stats.o \ -+ nss_ipv6_reasm_strings.o - endif -- --ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n" --ccflags-y += -DNSS_DRV_MIRROR_ENABLE --qca-nss-drv-objs += \ -- nss_mirror.o \ -- nss_mirror_log.o \ -- nss_mirror_stats.o - endif - - ifneq "$(NSS_DRV_TSTAMP_ENABLE)" "n" -@@ -292,17 +292,6 @@ qca-nss-drv-objs += \ - nss_clmap_stats.o - endif - --ifneq "$(NSS_DRV_C2C_ENABLE)" "n" --ccflags-y += -DNSS_DRV_C2C_ENABLE --qca-nss-drv-objs += \ -- nss_c2c_tx.o \ -- nss_c2c_tx_log.o \ -- nss_c2c_tx_stats.o \ -- nss_c2c_tx_strings.o \ -- nss_c2c_rx.o \ -- nss_c2c_rx_stats.o \ -- nss_c2c_rx_strings.o --endif - - ifneq "$(NSS_DRV_VXLAN_ENABLE)" "n" - ccflags-y += -DNSS_DRV_VXLAN_ENABLE -@@ -312,10 +301,37 @@ qca-nss-drv-objs += \ - nss_vxlan_stats.o - endif - --ifeq ($(SoC),$(filter $(SoC),ipq806x ipq40xx)) -+ifneq "$(NSS_DRV_MATCH_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_MATCH_ENABLE -+qca-nss-drv-objs += \ -+ nss_match.o \ -+ nss_match_log.o \ -+ nss_match_stats.o -+endif -+ -+ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_MIRROR_ENABLE -+qca-nss-drv-objs += \ -+ nss_mirror.o \ -+ nss_mirror_log.o \ -+ nss_mirror_stats.o -+endif -+ -+ifeq ($(SoC),$(filter $(SoC),ipq806x)) - qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \ - nss_hal/ipq806x/nss_hal_pvt.o - -+ifneq "$(NSS_DRV_C2C_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_C2C_ENABLE -+qca-nss-drv-objs += \ -+ nss_c2c_tx.o \ -+ nss_c2c_tx_log.o \ -+ nss_c2c_tx_stats.o \ -+ nss_c2c_tx_strings.o \ -+ nss_c2c_rx.o \ -+ nss_c2c_rx_stats.o \ -+ nss_c2c_rx_strings.o -+endif - ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" - ccflags-y += -DNSS_DRV_IPSEC_ENABLE - qca-nss-drv-objs += \ -@@ -342,6 +358,9 @@ endif - - ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64 ipq807x ipq807x_64)) - qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \ -+ nss_edma.o \ -+ nss_edma_stats.o \ -+ nss_edma_strings.o \ - nss_ppe.o \ - nss_ppe_log.o \ - nss_ppe_stats.o \ -@@ -382,9 +401,9 @@ endif - ifneq "$(NSS_DRV_QVPN_ENABLE)" "n" - ccflags-y += -DNSS_DRV_QVPN_ENABLE - qca-nss-drv-objs += \ -- nss_qvpn.o \ -- nss_qvpn_stats.o \ -- nss_qvpn_log.o -+ nss_qvpn.o \ -+ nss_qvpn_log.o \ -+ nss_qvpn_stats.o - endif - ifneq "$(NSS_DRV_TLS_ENABLE)" "n" - ccflags-y += -DNSS_DRV_TLS_ENABLE -@@ -397,6 +416,17 @@ endif - 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 -+ifneq "$(NSS_DRV_C2C_ENABLE)" "n" -+ccflags-y += -DNSS_DRV_C2C_ENABLE -+qca-nss-drv-objs += \ -+ nss_c2c_tx.o \ -+ nss_c2c_tx_log.o \ -+ nss_c2c_tx_stats.o \ -+ nss_c2c_tx_strings.o \ -+ nss_c2c_rx.o \ -+ nss_c2c_rx_stats.o \ -+ nss_c2c_rx_strings.o -+endif - ccflags-y += -I$(obj)/nss_hal/ipq807x -DNSS_HAL_IPQ807x_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT - endif - -@@ -437,7 +467,7 @@ 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 += -Werror -+ccflags-y += -Wall -Werror - - KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION))) - ---- a/nss_core.c -+++ b/nss_core.c -@@ -895,7 +895,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; -@@ -953,11 +953,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; - } -@@ -1067,6 +1067,21 @@ static inline void nss_core_rx_pbuf(stru - } - - /* -+ * nss_core_set_skb_classify() -+ * Set skb field to avoid ingress shaping. -+ */ -+static inline void nss_core_set_skb_classify(struct sk_buff *nbuf) -+{ -+#ifdef CONFIG_NET_CLS_ACT -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)) -+ nbuf->tc_verd = SET_TC_NCLS_NSS(nbuf->tc_verd); -+#else -+ skb_skip_tc_classify(nbuf); -+#endif -+#endif -+} -+ -+/* - * nss_core_handle_nrfrag_skb() - * Handled the processing of fragmented skb's - */ -@@ -1119,9 +1134,10 @@ static inline bool nss_core_handle_nr_fr - * ingress shaped flag set. - */ - if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { -- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss); -+ nss_core_set_skb_classify(nbuf); - } - #endif -+ - goto pull; - } - -@@ -1159,7 +1175,7 @@ static inline bool nss_core_handle_nr_fr - * ingress shaped flag set. - */ - if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { -- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss); -+ nss_core_set_skb_classify(nbuf); - } - #endif - -@@ -1274,7 +1290,7 @@ static inline bool nss_core_handle_linea - * ingress shaped flag set. - */ - if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { -- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss); -+ nss_core_set_skb_classify(nbuf); - } - #endif - -@@ -1332,7 +1348,7 @@ static inline bool nss_core_handle_linea - * ingress shaped flag set. - */ - if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { -- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss); -+ nss_core_set_skb_classify(nbuf); - } - #endif - -@@ -1702,7 +1718,7 @@ static void nss_core_init_nss(struct nss - if (nss_ctx->id) { - ret = nss_n2h_update_queue_config_async(nss_ctx, pn_mq_en, pn_qlimits); - if (ret != NSS_TX_SUCCESS) { -- nss_warning("Failed to send pnode queue config to core 1\n"); -+ nss_warning("%px: Failed to send pnode queue config to core 1\n", nss_ctx); - } - return; - } -@@ -1717,9 +1733,14 @@ static void nss_core_init_nss(struct nss - * connections supported by the accelerator. - */ - nss_ipv4_conn_cfg = max_ipv4_conn; -+ -+#ifdef NSS_DRV_IPV6_ENABLE - nss_ipv6_conn_cfg = max_ipv6_conn; - nss_ipv4_update_conn_count(max_ipv4_conn); - nss_ipv6_update_conn_count(max_ipv6_conn); -+#else -+ nss_ipv4_update_conn_count(max_ipv4_conn); -+#endif - - #ifdef NSS_MEM_PROFILE_LOW - /* ---- a/nss_core.h -+++ b/nss_core.h -@@ -232,6 +232,8 @@ static inline void nss_core_dma_cache_ma - * INFO: The LOW and MAX value together describe the "performance" band that we should operate the frequency at. - * - */ -+#define NSS_FREQ_SCALE_NA 0xFAADFAAD /* Frequency scale not supported */ -+ - #define NSS_FREQ_110 110000000 /* Frequency in hz */ - #define NSS_FREQ_110_MIN 0x03000 /* Instructions Per ms Min */ - #define NSS_FREQ_110_MAX 0x07000 /* Instructions Per ms Max */ ---- 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_dma.c -+++ b/nss_dma.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the -@@ -120,7 +120,7 @@ static void nss_dma_msg_handler(struct n - */ - if (ndm->cm.type == NSS_DMA_MSG_TYPE_SYNC_STATS) { - nss_dma_stats_sync(nss_ctx, &ndm->msg.stats); -- -+ nss_dma_stats_notify(nss_ctx); - } - - /* ---- a/nss_dma_stats.c -+++ b/nss_dma_stats.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2020, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the -@@ -17,10 +17,16 @@ - */ - - #include "nss_core.h" -+#include "nss_dma.h" - #include "nss_dma_stats.h" - #include "nss_dma_strings.h" - - /* -+ * Declare atomic notifier data structure for statistics. -+ */ -+ATOMIC_NOTIFIER_HEAD(nss_dma_stats_notifier); -+ -+/* - * Spinlock to protect DMA statistics update/read - */ - DEFINE_SPINLOCK(nss_dma_stats_lock); -@@ -117,3 +123,41 @@ void nss_dma_stats_sync(struct nss_ctx_i - - spin_unlock_bh(&nss_dma_stats_lock); - } -+ -+/* -+ * nss_dma_stats_notify() -+ * Sends notifications to all the registered modules. -+ * -+ * Leverage NSS-FW statistics timing to update Netlink. -+ */ -+void nss_dma_stats_notify(struct nss_ctx_instance *nss_ctx) -+{ -+ struct nss_dma_stats_notification dma_stats; -+ -+ spin_lock_bh(&nss_dma_stats_lock); -+ dma_stats.core_id = nss_ctx->id; -+ memcpy(dma_stats.stats_ctx, nss_dma_stats, sizeof(dma_stats.stats_ctx)); -+ spin_unlock_bh(&nss_dma_stats_lock); -+ -+ atomic_notifier_call_chain(&nss_dma_stats_notifier, NSS_STATS_EVENT_NOTIFY, &dma_stats); -+} -+ -+/* -+ * nss_dma_stats_unregister_notifier() -+ * Deregisters statistics notifier. -+ */ -+int nss_dma_stats_unregister_notifier(struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_unregister(&nss_dma_stats_notifier, nb); -+} -+EXPORT_SYMBOL(nss_dma_stats_unregister_notifier); -+ -+/* -+ * nss_dma_stats_register_notifier() -+ * Registers statistics notifier. -+ */ -+int nss_dma_stats_register_notifier(struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_register(&nss_dma_stats_notifier, nb); -+} -+EXPORT_SYMBOL(nss_dma_stats_register_notifier); ---- a/nss_hal/ipq806x/nss_hal_pvt.c -+++ b/nss_hal/ipq806x/nss_hal_pvt.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2013, 2015-2020, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013, 2015-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. -@@ -464,6 +464,7 @@ static struct nss_platform_data *__nss_h - goto out; - } - -+ nss_assert(npd->vphys); - npd->vmap = ioremap_cache(npd->vphys, resource_size(&res_vphys)); - if (!npd->vmap) { - nss_info_always("%px: nss%d: ioremap() fail for vphys\n", nss_ctx, nss_ctx->id); ---- a/nss_hal/nss_hal.c -+++ b/nss_hal/nss_hal.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. -@@ -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) { -@@ -293,7 +288,6 @@ int nss_hal_probe(struct platform_device - * Physical address of logical registers space - */ - nss_ctx->vphys = npd->vphys; -- nss_assert(nss_ctx->vphys); - nss_info("%d:ctx=%px, vphys=%x, vmap=%px, nphys=%x, nmap=%px", nss_ctx->id, - nss_ctx, nss_ctx->vphys, nss_ctx->vmap, nss_ctx->nphys, nss_ctx->nmap); - -@@ -364,8 +358,10 @@ int nss_hal_probe(struct platform_device - nss_top->ipv4_handler_id = nss_dev->id; - nss_ipv4_register_handler(); - -+#ifdef NSS_DRV_EDMA_ENABLE - nss_top->edma_handler_id = nss_dev->id; - nss_edma_register_handler(); -+#endif - nss_eth_rx_register_handler(nss_ctx); - #ifdef NSS_DRV_LAG_ENABLE - nss_lag_register_handler(); -@@ -389,20 +385,27 @@ int nss_hal_probe(struct platform_device - } - #endif - #endif -+ -+#ifdef NSS_DRV_IPV4_REASM_ENABLE - if (npd->ipv4_reasm_enabled == NSS_FEATURE_ENABLED) { - nss_top->ipv4_reasm_handler_id = nss_dev->id; - nss_ipv4_reasm_register_handler(); - } -+#endif - -+#ifdef NSS_DRV_IPV6_ENABLE - if (npd->ipv6_enabled == NSS_FEATURE_ENABLED) { - nss_top->ipv6_handler_id = nss_dev->id; - nss_ipv6_register_handler(); - } - -+#ifdef NSS_DRV_IPV6_REASM_ENABLE - if (npd->ipv6_reasm_enabled == NSS_FEATURE_ENABLED) { - nss_top->ipv6_reasm_handler_id = nss_dev->id; - nss_ipv6_reasm_register_handler(); - } -+#endif -+#endif - - #ifdef NSS_DRV_CRYPTO_ENABLE - /* -@@ -583,11 +586,13 @@ int nss_hal_probe(struct platform_device - } - #endif - -+#ifdef NSS_DRV_BRIDGE_ENABLE - if (npd->bridge_enabled == NSS_FEATURE_ENABLED) { - nss_top->bridge_handler_id = nss_dev->id; - nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE] = nss_dev->id; - nss_bridge_init(); - } -+#endif - - #ifdef NSS_DRV_VLAN_ENABLE - if (npd->vlan_enabled == NSS_FEATURE_ENABLED) { ---- a/nss_hlos_if.h -+++ b/nss_hlos_if.h -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013-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. -@@ -33,7 +33,11 @@ - */ - #if defined (NSS_MEM_PROFILE_LOW) - #define NSS_DEFAULT_NUM_CONN 512 /* Default number of connections for IPv4 and IPv6 each, for low memory profile */ -+#if defined (NSS_DRV_IPV6_ENABLE) - #define NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6 1024 /* MAX Connection shared between IPv4 and IPv6 for low memory profile */ -+#else -+#define NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6 512 /* MAX Connection for IPv4 for low memory profile */ -+#endif - #define NSS_LOW_MEM_EMPTY_POOL_BUF_SZ 4096 /* Default empty buffer pool size for low profile */ - #elif defined (NSS_MEM_PROFILE_MEDIUM) - #define NSS_DEFAULT_NUM_CONN 2048 /* Default number of connections for IPv4 and IPv6 each, for medium memory profile */ ---- a/nss_init.c -+++ b/nss_init.c -@@ -1,6 +1,6 @@ - /* - ************************************************************************** -- * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. -+ * Copyright (c) 2013-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. -@@ -307,7 +307,9 @@ static int nss_get_freq_table_handler(st - - i = 0; - while (i < NSS_FREQ_MAX_SCALE) { -- printk("%d Hz ", nss_runtime_samples.freq_scale[i].frequency); -+ if (nss_runtime_samples.freq_scale[i].frequency != NSS_FREQ_SCALE_NA) { -+ printk("%d Hz ", nss_runtime_samples.freq_scale[i].frequency); -+ } - i++; - } - printk("\n"); -@@ -738,7 +740,9 @@ static int __init nss_init(void) - * Registering sysctl for ipv4/6 specific config. - */ - nss_ipv4_register_sysctl(); -+#ifdef NSS_DRV_IPV6_ENABLE - nss_ipv6_register_sysctl(); -+#endif - - /* - * Registering sysctl for n2h specific config. -@@ -911,16 +915,15 @@ static void __exit nss_cleanup(void) - #endif - - /* -- * Unregister ipv4/6 specific sysctl -+ * Unregister ipv4/6 specific sysctl and free allocated to connection tables - */ - nss_ipv4_unregister_sysctl(); -- nss_ipv6_unregister_sysctl(); -- -- /* -- * Free Memory allocated for connection tables -- */ - nss_ipv4_free_conn_tables(); -+ -+#ifdef NSS_DRV_IPV6_ENABLE -+ nss_ipv6_unregister_sysctl(); - nss_ipv6_free_conn_tables(); -+#endif - - nss_project_unregister_sysctl(); - nss_data_plane_destroy_delay_work(); ---- a/nss_meminfo.c -+++ b/nss_meminfo.c -@@ -1,5 +1,5 @@ - /* -- * 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 -@@ -311,6 +311,15 @@ static bool nss_meminfo_init_block_lists - switch (mtype) { - case NSS_MEMINFO_MEMTYPE_IMEM: - /* -+ * For SOC's where TCM is not present -+ */ -+ if (!nss_ctx->vphys) { -+ nss_info_always("%px:IMEM requested but TCM not defined " -+ "for this SOC\n", nss_ctx); -+ goto cleanup; -+ } -+ -+ /* - * Return SoC real address for IMEM as DMA address. - */ - dma_addr = nss_meminfo_alloc_imem(nss_ctx, r->size, r->alignment); -@@ -453,6 +462,15 @@ static bool nss_meminfo_allocate_n2h_h2n - } - break; - case NSS_MEMINFO_MEMTYPE_IMEM: -+ /* -+ * For SOC's where TCM is not present -+ */ -+ if (!nss_ctx->vphys) { -+ nss_info_always("%px:IMEM requested but TCM not defined " -+ "for this SOC\n", nss_ctx); -+ return false; -+ } -+ - info->dma_addr = nss_meminfo_alloc_imem(nss_ctx, info->total_size, L1_CACHE_BYTES); - if (!info->dma_addr) - return false; -@@ -517,6 +535,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; -@@ -705,7 +730,6 @@ bool nss_meminfo_init(struct nss_ctx_ins - struct nss_meminfo_map *map; - struct nss_top_instance *nss_top = &nss_top_main; - -- NSS_VERIFY_CTX_MAGIC(nss_ctx); - mem_ctx = &nss_ctx->meminfo_ctx; - - /* ---- a/nss_profiler.c -+++ b/nss_profiler.c -@@ -153,8 +153,10 @@ void nss_profiler_release_dma(struct nss - - ctrl = nss_ctx->meminfo_ctx.sdma_ctrl; - -- if (ctrl && ctrl->consumer[0].ring.kp) -+ if (ctrl && ctrl->consumer[0].ring.kp) { - kfree(ctrl->consumer[0].ring.kp); -+ ctrl->consumer[0].ring.kp = NULL; -+ } - } - EXPORT_SYMBOL(nss_profiler_release_dma); - -@@ -198,10 +200,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; -- if (ctrl) { -- dmac_inv_range(ctrl, &ctrl->cidx); -- dsb(sy); -+ if (!ctrl) { -+ return ctrl; - } -+ -+ dmac_inv_range(ctrl, &ctrl->cidx); -+ dsb(sy); - return ctrl; - } - EXPORT_SYMBOL(nss_profile_dma_get_ctrl); -@@ -233,7 +237,7 @@ void nss_profiler_notify_unregister(nss_ - { - nss_assert(core_id < NSS_CORE_MAX); - -- nss_core_register_handler(&nss_top_main.nss[core_id], NSS_PROFILER_INTERFACE, NULL, NULL); -+ nss_core_unregister_handler(&nss_top_main.nss[core_id], NSS_PROFILER_INTERFACE); - nss_top_main.profiler_callback[core_id] = NULL; - nss_top_main.profiler_ctx[core_id] = NULL; - } diff --git a/qca-nss-drv/patches/999-fix-mismatched-stats-for-nss-11.0-fw.patch b/qca-nss-drv/patches/999-fix-mismatched-stats-for-nss-11.0-fw.patch deleted file mode 100644 index 5dc6eab..0000000 --- a/qca-nss-drv/patches/999-fix-mismatched-stats-for-nss-11.0-fw.patch +++ /dev/null @@ -1,372 +0,0 @@ ---- a/exports/nss_api_if.h -+++ b/exports/nss_api_if.h -@@ -119,7 +119,11 @@ - #define NSS_MAX_PHYSICAL_INTERFACES 8 /**< Maximum number of physical interfaces. */ - #define NSS_MAX_VIRTUAL_INTERFACES 16 /**< Maximum number of virtual interfaces. */ - #define NSS_MAX_TUNNEL_INTERFACES 4 /**< Maximum number of tunnel interfaces. */ -+#if (NSS_FW_VERSION_CODE < NSS_FW_VERSION(11,1)) -+#define NSS_MAX_SPECIAL_INTERFACES 55 /**< Maximum number of special interfaces. */ -+#else - #define NSS_MAX_SPECIAL_INTERFACES 67 /**< Maximum number of special interfaces. */ -+#endif - #define NSS_MAX_WIFI_RADIO_INTERFACES 3 /**< Maximum number of radio interfaces. */ - - /* -@@ -253,6 +257,10 @@ - /**< Special interface number for timestamp receive. */ - #define NSS_GRE_REDIR_MARK_INTERFACE (NSS_SPECIAL_IF_START + 56) - /**< Special interface number for GRE redirect mark. */ -+#if (NSS_FW_VERSION_CODE < NSS_FW_VERSION(11,1)) -+#define NSS_RMNET_RX_INTERFACE (NSS_SPECIAL_IF_START + 57) -+ /**< Special interface number for RMNET receive handler. */ -+#else - #define NSS_VXLAN_INTERFACE (NSS_SPECIAL_IF_START + 57) - /**< Special interface number for VxLAN handler. */ - #define NSS_RMNET_RX_INTERFACE (NSS_SPECIAL_IF_START + 58) -@@ -269,7 +277,7 @@ - /**< Special interface number for the Wi-Fi MAC database. */ - #define NSS_DMA_INTERFACE (NSS_SPECIAL_IF_START + 66) - /**< Special interface number for the DMA interface. */ -- -+#endif - - #ifdef __KERNEL__ /* only kernel will use. */ - ---- a/exports/nss_dynamic_interface.h -+++ b/exports/nss_dynamic_interface.h -@@ -59,7 +59,11 @@ enum nss_dynamic_interface_type { - NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE, - NSS_DYNAMIC_INTERFACE_TYPE_VLAN, - NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_3, -+#if (NSS_FW_VERSION_CODE <= NSS_FW_VERSION(11,0)) -+ NSS_DYNAMIC_INTERFACE_TYPE_WIFILI, -+#else - NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_INTERNAL, -+#endif - NSS_DYNAMIC_INTERFACE_TYPE_MAP_T_INNER, - NSS_DYNAMIC_INTERFACE_TYPE_MAP_T_OUTER, - NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER, -@@ -96,14 +100,16 @@ enum nss_dynamic_interface_type { - NSS_DYNAMIC_INTERFACE_TYPE_IGS, - NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_US, - NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_DS, -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - NSS_DYNAMIC_INTERFACE_TYPE_VXLAN_INNER, - NSS_DYNAMIC_INTERFACE_TYPE_VXLAN_OUTER, - NSS_DYNAMIC_INTERFACE_TYPE_MATCH, -+#endif - NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_N2H, - NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N, -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0, - NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1, --#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1)) - NSS_DYNAMIC_INTERFACE_TYPE_TLS_INNER, - NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER, - NSS_DYNAMIC_INTERFACE_TYPE_MIRROR, ---- a/nss_core.c -+++ b/nss_core.c -@@ -924,6 +924,7 @@ static inline void nss_core_handle_buffe - dev_put(ndev); - } - -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - /* - * nss_core_handle_ext_buffer_pkt() - * Handle Extended data plane packet received on physical or virtual interface. -@@ -968,6 +969,7 @@ static inline void nss_core_handle_ext_b - dev_kfree_skb_any(nbuf); - } - } -+#endif - - /* - * nss_core_rx_pbuf() -@@ -984,7 +986,9 @@ static inline void nss_core_rx_pbuf(stru - NSS_PKT_STATS_DEC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_NSS_SKB_COUNT]); - - if (interface_num >= NSS_MAX_NET_INTERFACES) { -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_INVALID_INTERFACE]); -+#endif - nss_warning("%px: Invalid interface_num: %d", nss_ctx, interface_num); - dev_kfree_skb_any(nbuf); - return; -@@ -994,7 +998,9 @@ static inline void nss_core_rx_pbuf(stru - * Check if core_id value is valid. - */ - if (core_id > nss_top_main.num_nss) { -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_INVALID_CORE_ID]); -+#endif - nss_warning("%px: Invalid core id: %d", nss_ctx, core_id); - dev_kfree_skb_any(nbuf); - return; -@@ -1026,9 +1032,11 @@ static inline void nss_core_rx_pbuf(stru - nss_core_handle_bounced_pkt(nss_ctx, reg, nbuf); - break; - -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - case N2H_BUFFER_PACKET_EXT: - nss_core_handle_ext_buffer_pkt(nss_ctx, interface_num, nbuf, napi, desc->bit_flags); - break; -+#endif - - case N2H_BUFFER_STATUS: - NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_STATUS]); -@@ -1060,7 +1068,9 @@ static inline void nss_core_rx_pbuf(stru - break; - - default: -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_INVALID_BUFFER_TYPE]); -+#endif - nss_warning("%px: Invalid buffer type %d received from NSS", nss_ctx, buffer_type); - dev_kfree_skb_any(nbuf); - } ---- a/nss_dynamic_interface_stats.c -+++ b/nss_dynamic_interface_stats.c -@@ -43,7 +43,11 @@ const char *nss_dynamic_interface_type_n - "NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE", - "NSS_DYNAMIC_INTERFACE_TYPE_VLAN", - "NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_3", -+#if (NSS_FW_VERSION_CODE <= NSS_FW_VERSION(11,0)) -+ "NSS_DYNAMIC_INTERFACE_TYPE_WIFILI", -+#else - "NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_INTERNAL", -+#endif - "NSS_DYNAMIC_INTERFACE_TYPE_MAP_T_INNER", - "NSS_DYNAMIC_INTERFACE_TYPE_MAP_T_OUTER", - "NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER", -@@ -80,13 +84,22 @@ const char *nss_dynamic_interface_type_n - "NSS_DYNAMIC_INTERFACE_TYPE_IGS", - "NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_US", - "NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_DS", -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - "NSS_DYNAMIC_INTERFACE_TYPE_VXLAN_INNER", - "NSS_DYNAMIC_INTERFACE_TYPE_VXLAN_OUTER", - "NSS_DYNAMIC_INTERFACE_TYPE_MATCH", -+#endif - "NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_N2H", - "NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N", -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - "NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0", - "NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1", -+#endif -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1)) -+ "NSS_DYNAMIC_INTERFACE_TYPE_TLS_INNER", -+ "NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER", -+ "NSS_DYNAMIC_INTERFACE_TYPE_MIRROR", -+#endif - }; - - /* ---- a/nss_n2h_strings.c -+++ b/nss_n2h_strings.c -@@ -38,14 +38,14 @@ struct nss_stats_info nss_n2h_strings_st - {"ticks" , NSS_STATS_TYPE_SPECIAL}, - {"worst_ticks" , NSS_STATS_TYPE_SPECIAL}, - {"iterations" , NSS_STATS_TYPE_SPECIAL}, -- {"pbuf_ocm_total_count" , NSS_STATS_TYPE_SPECIAL}, -- {"pbuf_ocm_free_count" , NSS_STATS_TYPE_SPECIAL}, - {"pbuf_ocm_alloc_fail_payload" , NSS_STATS_TYPE_SPECIAL}, -+ {"pbuf_ocm_free_count" , NSS_STATS_TYPE_SPECIAL}, -+ {"pbuf_ocm_total_count" , NSS_STATS_TYPE_SPECIAL}, - {"pbuf_ocm_alloc_fail_nopayload", NSS_STATS_TYPE_SPECIAL}, -- {"pbuf_def_total_count" , NSS_STATS_TYPE_SPECIAL}, -- {"pbuf_def_free_count" , NSS_STATS_TYPE_SPECIAL}, - {"pbuf_def_alloc_fail_payload" , NSS_STATS_TYPE_SPECIAL}, -+ {"pbuf_def_free_count" , NSS_STATS_TYPE_SPECIAL}, - {"pbuf_def_alloc_fail_nopayload", NSS_STATS_TYPE_SPECIAL}, -+ {"pbuf_def_total_count" , NSS_STATS_TYPE_SPECIAL}, - {"payload_alloc_fails" , NSS_STATS_TYPE_SPECIAL}, - {"payload_free_count" , NSS_STATS_TYPE_SPECIAL}, - {"h2n_control_pkts" , NSS_STATS_TYPE_SPECIAL}, ---- a/nss_hal/nss_hal.c -+++ b/nss_hal/nss_hal.c -@@ -88,6 +88,7 @@ int nss_hal_firmware_load(struct nss_ctx - return 0; - } - -+ - /* - * nss_hal_dt_parse_features() - */ -@@ -98,14 +99,12 @@ void nss_hal_dt_parse_features(struct de - */ - npd->bridge_enabled = of_property_read_bool(np, "qcom,bridge-enabled"); - npd->capwap_enabled = of_property_read_bool(np, "qcom,capwap-enabled"); -- npd->clmap_enabled = of_property_read_bool(np, "qcom,clmap-enabled"); - npd->crypto_enabled = of_property_read_bool(np, "qcom,crypto-enabled"); - npd->dtls_enabled = of_property_read_bool(np, "qcom,dtls-enabled"); - npd->gre_enabled = of_property_read_bool(np, "qcom,gre-enabled"); - npd->gre_redir_enabled = of_property_read_bool(np, "qcom,gre-redir-enabled"); - npd->gre_tunnel_enabled = of_property_read_bool(np, "qcom,gre_tunnel_enabled"); - npd->gre_redir_mark_enabled = of_property_read_bool(np, "qcom,gre-redir-mark-enabled"); -- npd->igs_enabled = of_property_read_bool(np, "qcom,igs-enabled"); - npd->ipsec_enabled = of_property_read_bool(np, "qcom,ipsec-enabled"); - npd->ipv4_enabled = of_property_read_bool(np, "qcom,ipv4-enabled"); - npd->ipv4_reasm_enabled = of_property_read_bool(np, "qcom,ipv4-reasm-enabled"); -@@ -119,20 +118,18 @@ void nss_hal_dt_parse_features(struct de - npd->pptp_enabled = of_property_read_bool(np, "qcom,pptp-enabled"); - npd->portid_enabled = of_property_read_bool(np, "qcom,portid-enabled"); - npd->pvxlan_enabled = of_property_read_bool(np, "qcom,pvxlan-enabled"); -+ npd->clmap_enabled = of_property_read_bool(np, "qcom,clmap-enabled"); - npd->qvpn_enabled = of_property_read_bool(np, "qcom,qvpn-enabled"); - npd->rmnet_rx_enabled = of_property_read_bool(np, "qcom,rmnet_rx-enabled"); - npd->shaping_enabled = of_property_read_bool(np, "qcom,shaping-enabled"); -- npd->tls_enabled = of_property_read_bool(np, "qcom,tls-enabled"); - npd->tstamp_enabled = of_property_read_bool(np, "qcom,tstamp-enabled"); - npd->turbo_frequency = of_property_read_bool(np, "qcom,turbo-frequency"); - npd->tun6rd_enabled = of_property_read_bool(np, "qcom,tun6rd-enabled"); - npd->tunipip6_enabled = of_property_read_bool(np, "qcom,tunipip6-enabled"); - npd->vlan_enabled = of_property_read_bool(np, "qcom,vlan-enabled"); -- npd->vxlan_enabled = of_property_read_bool(np, "qcom,vxlan-enabled"); - npd->wlanredirect_enabled = of_property_read_bool(np, "qcom,wlanredirect-enabled"); - npd->wifioffload_enabled = of_property_read_bool(np, "qcom,wlan-dataplane-offload-enabled"); -- npd->match_enabled = of_property_read_bool(np, "qcom,match-enabled"); -- npd->mirror_enabled = of_property_read_bool(np, "qcom,mirror-enabled"); -+ npd->igs_enabled = of_property_read_bool(np, "qcom,igs-enabled"); - } - /* - * nss_hal_clean_up_irq() -@@ -567,15 +564,18 @@ int nss_hal_probe(struct platform_device - nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_VAP] = nss_dev->id; - nss_wifi_register_handler(); - nss_wifili_register_handler(); -+#if (NSS_FW_VERSION_CODE <= NSS_FW_VERSION(11,0)) -+ nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_WIFILI] = nss_dev->id; -+#else - nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_INTERNAL] = nss_dev->id; - nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0] = nss_dev->id; - nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1] = nss_dev->id; -- - /* - * Register wifi mac database when offload enabled - */ - nss_top->wmdb_handler_id = nss_dev->id; - nss_wifi_mac_db_register_handler(); -+#endif - } - #endif - ---- a/nss_wifili.c -+++ b/nss_wifili.c -@@ -50,8 +50,11 @@ static void nss_wifili_handler(struct ns - */ - BUG_ON((nss_is_dynamic_interface(ncm->interface)) - || ((ncm->interface != NSS_WIFILI_INTERNAL_INTERFACE) -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE0) -- && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE1))); -+ && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE1) -+#endif -+ )); - - /* - * Trace messages. -@@ -172,8 +175,13 @@ nss_tx_status_t nss_wifili_tx_msg(struct - * The interface number shall be one of the wifili soc interfaces - */ - if ((ncm->interface != NSS_WIFILI_INTERNAL_INTERFACE) -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE0) -- && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE1)) { -+ && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE1)) -+#else -+ ) -+#endif -+ { - nss_warning("%px: tx request for interface that is not a wifili: %d", nss_ctx, ncm->interface); - return NSS_TX_FAILURE; - } -@@ -230,6 +238,7 @@ EXPORT_SYMBOL(nss_wifili_get_context); - * nss_get_available_wifili_external_if() - * Check and return the available external interface - */ -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - uint32_t nss_get_available_wifili_external_if(void) - { - struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.wifi_handler_id]; -@@ -250,7 +259,7 @@ uint32_t nss_get_available_wifili_extern - return NSS_MAX_NET_INTERFACES; - } - EXPORT_SYMBOL(nss_get_available_wifili_external_if); -- -+#endif - /* - * nss_wifili_msg_init() - * Initialize nss_wifili_msg. -@@ -362,9 +371,10 @@ void nss_wifili_register_handler(void) - - nss_info("nss_wifili_register_handler"); - nss_core_register_handler(nss_ctx, NSS_WIFILI_INTERNAL_INTERFACE, nss_wifili_handler, NULL); -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - nss_core_register_handler(nss_ctx, NSS_WIFILI_EXTERNAL_INTERFACE0, nss_wifili_handler, NULL); - nss_core_register_handler(nss_ctx, NSS_WIFILI_EXTERNAL_INTERFACE1, nss_wifili_handler, NULL); -- -+#endif - nss_wifili_stats_dentry_create(); - nss_wifili_strings_dentry_create(); - ---- a/nss_wifili_stats.c -+++ b/nss_wifili_stats.c -@@ -248,6 +248,7 @@ void nss_wifili_stats_sync(struct nss_ct - nwss->soc_maxpdev = NSS_WIFILI_MAX_PDEV_NUM_MSG; - break; - -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - case NSS_WIFILI_EXTERNAL_INTERFACE0: - nwss = &soc_stats[1]; - nwss->soc_maxpdev = NSS_WIFILI_SOC_ATTACHED_MAX_PDEV_NUM; -@@ -257,6 +258,7 @@ void nss_wifili_stats_sync(struct nss_ct - nwss = &soc_stats[2]; - nwss->soc_maxpdev = NSS_WIFILI_SOC_ATTACHED_MAX_PDEV_NUM; - break; -+#endif - - default: - nss_warning("%px: Invalid wifili interface\n", nss_ctx); -@@ -470,6 +472,7 @@ void nss_wifili_stats_notify(struct nss_ - index = 0; - break; - -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - case NSS_WIFILI_EXTERNAL_INTERFACE0: - index = 1; - break; -@@ -477,6 +480,7 @@ void nss_wifili_stats_notify(struct nss_ - case NSS_WIFILI_EXTERNAL_INTERFACE1: - index = 2; - break; -+#endif - - default: - nss_warning("%px: Invalid wifili interface\n", nss_ctx); ---- a/Makefile -+++ b/Makefile -@@ -85,8 +85,10 @@ qca-nss-drv-objs += nss_wifi.o \ - nss_wifili.o \ - nss_wifili_log.o \ - nss_wifili_stats.o \ -- nss_wifili_strings.o \ -- nss_wifi_mac_db.o -+ nss_wifili_strings.o -+ifeq ($(shell test $(TARGET_NSS_MINOR_VERSION) -gt 0; echo $$?),0) -+qca-nss-drv-objs += nss_wifi_mac_db.o -+endif - endif - - ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n" ---- a/nss_tx_rx_common.h -+++ b/nss_tx_rx_common.h -@@ -96,7 +96,9 @@ extern void nss_wifili_register_handler( - extern void nss_ppe_register_handler(void); - extern void nss_gre_redir_mark_register_handler(void); - extern void nss_ppe_vp_register_handler(void); -+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0)) - extern void nss_wifi_mac_db_register_handler(void); -+#endif - - /* - * nss_if_msg_handler()