diff --git a/Makefile b/Makefile
index c9bacb6..08ce191 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 ##########################################################################
-# Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+# Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
 # above copyright notice and this permission notice appear in all copies.
@@ -48,7 +48,6 @@
 			nss_eth_rx.o \
 			nss_n2h.o \
 			nss_data_plane.o \
-			nss_freq.o \
 			nss_log.o
 
 #
@@ -57,31 +56,30 @@
 qca-nss-drv-objs += \
 			nss_tx_rx_virt_if.o
 
-obj-m += qca-nss-tunipip6.o
-obj-m += qca-nss-ipsecmgr.o
+PM_SUPPORT := 0
 
-ifeq "$(CONFIG_IPV6_SIT_6RD)" "y"
-obj-m += qca-nss-tun6rd.o
-qca-nss-tun6rd-objs := nss_connmgr_tun6rd.o
-ccflags-y += -DNSS_TUN6RD_DEBUG_LEVEL=0
+ccflags-y += -I$(obj)/nss_hal/include -I$(obj)/exports -DNSS_DEBUG_LEVEL=0 -DNSS_EMPTY_BUFFER_SIZE=1792 -DNSS_PKT_STATS_ENABLED=1
+ccflags-y += -DNSS_PM_DEBUG_LEVEL=0
+
+ifneq ($(findstring 3.4, $(KERNELVERSION)),)
+NSS_CCFLAGS = -DNSS_DT_SUPPORT=0 -DNSS_PPP_SUPPORT=1 -DNSS_FW_DBG_SUPPORT=1 -DNSS_PM_SUPPORT=1
+PM_SUPPORT = 1
+else
+NSS_CCFLAGS = -DNSS_DT_SUPPORT=1 -DNSS_PPP_SUPPORT=0 -DNSS_FW_DBG_SUPPORT=0 -DNSS_PM_SUPPORT=0
+ccflags-y += -I$(obj)
 endif
 
-qca-nss-tunipip6-objs := nss_connmgr_tunipip6.o
-qca-nss-ipsecmgr-objs := nss_ipsecmgr.o
+ccflags-y += $(NSS_CCFLAGS)
 
-ccflags-y += -I$(obj)/nss_hal/include -I$(obj)/exports -DNSS_DEBUG_LEVEL=0 -DNSS_EMPTY_BUFFER_SIZE=1792 -DNSS_PKT_STATS_ENABLED=0
-ccflags-y += -DNSS_TUNIPIP6_DEBUG_LEVEL=0
-ccflags-y += -DNSS_PM_DEBUG_LEVEL=0
-ccflags-y += -DNSS_IPSECMGR_DEBUG_LEVEL=3
+export NSS_CCFLAGS
 
 qca-nss-drv-objs += nss_profiler.o
-obj-y+= profiler/
-obj-y+= nss_qdisc/
-obj-y+= capwapmgr/
+
+ifeq ($(PM_SUPPORT), 1)
+qca-nss-drv-objs += nss_freq.o
+endif
 
 obj ?= .
 
-ifeq "$(CONFIG_ARCH_IPQ806X)" "y"
 qca-nss-drv-objs += nss_hal/ipq806x/nss_hal_pvt.o
 ccflags-y += -I$(obj)/nss_hal/ipq806x
-endif
diff --git a/capwapmgr/Makefile b/capwapmgr/Makefile
deleted file mode 100755
index 1850282..0000000
--- a/capwapmgr/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-##########################################################################
-# Copyright (c) 2014, 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.
-##########################################################################
-
-ccflags-y := -I$(obj)/../exports -I$(obj)/..  -I$(obj)/nss_hal/include
-
-#
-# If you want only one netdev for all the CAPWAP tunnels, then
-# set NSS_CAPWAPMGR_ONE_NETDEV.
-#     ccflags-y += -DNSS_CAPWAPMGR_ONE_NETDEV
-#
-# If you want one netdevice per-CAPWAP tunnel, then don't set
-# NSS_CAPWAPMGR_ONE_NETDEV.
-#
-obj-m += qca-nss-capwapmgr.o
-qca-nss-capwapmgr-objs := nss_capwapmgr.o
-ccflags-y += -DNSS_CAPWAPMGR_ONE_NETDEV -DNSS_CAPWAPMGR_TESTING_NETLINK -DNSS_CAPWAPMGR_DEBUG_LEVEL=6 -DNSS_DEBUG_LEVEL=0 -DNSS_PKT_STATS_ENABLED=0
diff --git a/capwapmgr/nss_capwapmgr.c b/capwapmgr/nss_capwapmgr.c
deleted file mode 100644
index 67a7523..0000000
--- a/capwapmgr/nss_capwapmgr.c
+++ /dev/null
@@ -1,1310 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_capwapmgr.c
- *	NSS to HLOS CAPWAP manager
- */
-#include <linux/types.h>
-#include <linux/ip.h>
-#include <linux/tcp.h>
-#include <linux/module.h>
-#include <linux/skbuff.h>
-#include <net/ipv6.h>
-#include <net/ipip.h>
-#include <linux/if_arp.h>
-#include <linux/etherdevice.h>
-#include <nss_api_if.h>
-#include <linux/in.h>
-#include <nss_api_if.h>
-#include "nss_core.h"
-#include <nss_cmn.h>
-#include <nss_capwap.h>
-#include <nss_capwapmgr.h>
-
-/*
- * This file is responsible for interacting with qca-nss-drv's
- * CAPWAP API to manage CAPWAP tunnels.
- *
- * This driver also exposes few APIs which can be used by
- * another module to perform operations on CAPWAP tunnels. However, we create
- * one netdevice for all the CAPWAP tunnels which is done at the module's
- * init time if NSS_CAPWAPMGR_ONE_NETDEV is set in the Makefile.
- *
- * If your requirement is to create one netdevice per-CAPWAP tunnel, then
- * netdevice needs to be created before CAPWAP tunnel create. Netdevice are
- * created using nss_capwapmgr_netdev_create() API.
- *
- */
-
-/*
- * NSS capwap mgr debug macros
- */
-#if (NSS_CAPWAPMGR_DEBUG_LEVEL < 1)
-#define nss_capwapmgr_assert(fmt, args...)
-#else
-#define nss_capwapmgr_assert(c) if (!(c)) { BUG_ON(!(c)); }
-#endif /* NSS_CAPWAPMGR_DEBUG_LEVEL */
-
-/*
- * Compile messages for dynamic enable/disable
- */
-#if defined(CONFIG_DYNAMIC_DEBUG)
-#define nss_capwapmgr_warn(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define nss_capwapmgr_info(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define nss_capwapmgr_trace(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#else /* CONFIG_DYNAMIC_DEBUG */
-/*
- * Statically compile messages at different levels
- */
-#if (NSS_CAPWAPMGR_DEBUG_LEVEL < 2)
-#define nss_capwapmgr_warn(s, ...)
-#else
-#define nss_capwapmgr_warn(s, ...) pr_warn("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#endif
-
-#if (NSS_CAPWAPMGR_DEBUG_LEVEL < 3)
-#define nss_capwapmgr_info(s, ...)
-#else
-#define nss_capwapmgr_info(s, ...)   pr_notice("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#endif
-
-#if (NSS_CAPWAPMGR_DEBUG_LEVEL < 4)
-#define nss_capwapmgr_trace(s, ...)
-#else
-#define nss_capwapmgr_trace(s, ...)  pr_info("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#endif
-#endif /* CONFIG_DYNAMIC_DEBUG */
-
-/*
- * Stats of tunnels which don't exists anymore.
- */
-static struct nss_capwap_tunnel_stats tunneld;
-
-static void nss_capwapmgr_receive_pkt(struct net_device *dev, struct sk_buff *skb, struct napi_struct *napi);
-
-#if defined(NSS_CAPWAPMGR_ONE_NETDEV)
-/*
- * If you want only one netdev for all the tunnels. If you don't want
- * to create one netdev for all the tunnels, then netdev must be
- * created using nss_capwapmgr_netdev_create() before every tunnel create
- * operation.
- */
-static struct net_device *nss_capwapmgr_ndev = NULL;
-#endif
-
-/*
- * nss_capwapmgr_open()
- *	Netdev's open call.
- */
-static int nss_capwapmgr_open(struct net_device *dev)
-{
-	netif_start_queue(dev);
-	return 0;
-}
-
-/*
- * nss_capwapmgr_close()
- *	Netdev's close call.
- */
-static int nss_capwapmgr_close(struct net_device *dev)
-{
-	netif_stop_queue(dev);
-	return 0;
-}
-
-/*
- * nss_capwapmgr_decongestion_callback()
- *	Wakeup netif queue if we were stopped by start_xmit
- */
-static void nss_capwapmgr_decongestion_callback(void *arg)
-{
-	struct net_device *dev = arg;
-
-	if (netif_queue_stopped(dev)) {
-		netif_wake_queue(dev);
-	}
-}
-
-/*
- * nss_capwapmgr_start_xmit()
- *	Transmit's skb to NSS FW over CAPWAP if_num.
- *
- * Please make sure to leave headroom of NSS_CAPWAP_HEADROOM with every
- * packet so that NSS can encap eth,vlan,ip,udp,capwap headers.
- * Also, skb->len must include size of metaheader. Essentially skb->len is
- * size of CAPWAP Payload (including wireless info sections) and metaheader.
- */
-static netdev_tx_t nss_capwapmgr_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	struct net_device_stats *stats = &dev->stats;
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwap_metaheader *pre;
-	uint32_t if_num;
-	nss_tx_status_t status;
-
-	priv = netdev_priv(dev);
-	pre = (struct nss_capwap_metaheader *)skb->data;
-
-	if (pre->tunnel_id > NSS_CAPWAPMGR_MAX_TUNNELS) {
-		nss_capwapmgr_warn("%p: (CAPWAP packet) tunnel-id invalid: %d\n", dev, pre->tunnel_id);
-		kfree_skb(skb);
-		stats->tx_dropped++;
-		return NETDEV_TX_OK;
-	}
-
-	if_num = priv->tunnel[pre->tunnel_id].if_num;
-	if (if_num == 0) {
-		nss_capwapmgr_warn("%p: (CAPWAP packet) if_num in the tunnel not set\n", dev);
-		kfree_skb(skb);
-		stats->tx_dropped++;
-		return NETDEV_TX_OK;
-	}
-
-	status = nss_capwap_tx_data(priv->nss_ctx, skb, if_num);
-	if (status != NSS_TX_SUCCESS) {
-		if (status == NSS_TX_FAILURE_QUEUE) {
-			nss_capwapmgr_warn("%p: netdev :%p queue is full", dev, dev);
-			if (!netif_queue_stopped(dev)) {
-				netif_stop_queue(dev);
-			}
-		}
-
-		kfree_skb(skb);
-		nss_capwapmgr_warn("%p: (CAPWAP packet) Failed to xmit the packet : %d\n", dev, status);
-		stats->tx_dropped++;
-		return NETDEV_TX_BUSY;
-	}
-
-	return NETDEV_TX_OK;
-}
-
-/*
- * nss_capwapmgr_fill_up_stats()
- *	Fills up stats in netdev's stats.
- */
-static void nss_capwapmgr_fill_up_stats(struct rtnl_link_stats64 *stats, struct nss_capwap_tunnel_stats *tstats)
-{
-	stats->rx_packets += tstats->pnode_stats.rx_packets;
-	stats->rx_dropped += tstats->pnode_stats.rx_dropped;
-	/* rx_fifo_errors will appear as rx overruns in ifconfig */
-	stats->rx_fifo_errors += (tstats->rx_queue_full_drops + tstats->rx_n2h_queue_full_drops);
-	stats->rx_errors += (tstats->rx_mem_failure_drops + tstats->oversize_drops + tstats->frag_timeout_drops);
-	stats->rx_bytes += tstats->pnode_stats.rx_bytes;
-
-	stats->tx_packets += tstats->pnode_stats.tx_packets;
-	/* tx_fifo_errors  will appear as tx overruns in ifconfig */
-	stats->tx_fifo_errors += tstats->tx_queue_full_drops;
-	stats->tx_errors += tstats->tx_mem_failure_drops;
-	stats->tx_bytes += tstats->pnode_stats.tx_bytes;
-}
-
-/*
- * nss_capwapmgr_get_tunnel_stats()
- *	Netdev get stats function to get tunnel stats
- */
-static struct rtnl_link_stats64 *nss_capwapmgr_get_tunnel_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
-{
-	struct nss_capwap_tunnel_stats tstats;
-	int i;
-
-	if (!stats) {
-		return stats;
-	}
-
-	/*
-	 * Netdev seems to be incrementing rx_dropped because we don't give IP header.
-	 * So reset it as it's of no use for us.
-	 */
-	atomic_long_set(&dev->rx_dropped, 0);
-
-	memset(stats, 0, sizeof (struct rtnl_link_stats64));
-	nss_capwapmgr_fill_up_stats(stats, &tunneld);
-
-	for (i = NSS_DYNAMIC_IF_START; i <= (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES); i++) {
-		if (nss_capwap_get_stats(i, &tstats) == false) {
-			continue;
-		}
-
-		nss_capwapmgr_fill_up_stats(stats, &tstats);
-	}
-
-	return stats;
-}
-
-/*
- * nss_capwapmgr_netdev_ops
- *	Netdev operations.
- */
-static const struct net_device_ops nss_capwapmgr_netdev_ops = {
-	.ndo_open		= nss_capwapmgr_open,
-	.ndo_stop		= nss_capwapmgr_close,
-	.ndo_start_xmit		= nss_capwapmgr_start_xmit,
-	.ndo_set_mac_address	= eth_mac_addr,
-	.ndo_change_mtu		= eth_change_mtu,
-	.ndo_get_stats64	= nss_capwapmgr_get_tunnel_stats,
-};
-
-/*
- * nss_capwapmgr_dummpy_netdev_setup()
- *	Netdev setup function.
- */
-static void nss_capwapmgr_dummpy_netdev_setup(struct net_device *dev)
-{
-	dev->addr_len = ETH_ALEN;
-	dev->mtu = ETH_DATA_LEN;
-	dev->needed_headroom = NSS_CAPWAP_HEADROOM;
-	dev->needed_tailroom = 4;
-	dev->type = ARPHRD_VOID;
-	dev->ethtool_ops = NULL;
-	dev->header_ops = NULL;
-	dev->netdev_ops = &nss_capwapmgr_netdev_ops;
-	dev->destructor = NULL;
-	memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
-	memset(dev->broadcast, 0xff, dev->addr_len);
-	memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
-}
-
-/*
- * nss_capwapmgr_msg_event_receive()
- *	CAPWAP message callback for responses to commands sent to NSS FW
- *
- * This is command hanlder for all the messages since all we do is wake-up
- * the caller who is sending message to NSS FW.
- */
-static void nss_capwapmgr_msg_event_receive(void *app_data, struct nss_capwap_msg *nim)
-{
-	struct net_device *dev = app_data;
-	struct nss_cmn_msg *ncm = (struct nss_cmn_msg *)nim;
-	struct nss_capwapmgr_response *r;
-	struct nss_capwapmgr_priv *priv;
-	uint32_t if_num;
-
-	if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
-		return;
-	}
-
-	/*
-	 * Since all CAPWAP messages are sync in nature we need to wake-up caller.
-	 */
-	if_num = ncm->interface - NSS_DYNAMIC_IF_START;
-	dev_hold(dev);
-	priv = netdev_priv(dev);
-	r = &priv->resp[if_num];
-
-	/*
-	 * If somebody is waiting...
-	 */
-	if (atomic_read(&r->seq) != 0) {
-		if (ncm->response != NSS_CMN_RESPONSE_ACK) {
-			r->error = ncm->error;
-		}
-
-		r->response = ncm->response;
-		atomic_dec(&r->seq);
-		wake_up(&r->wq);
-	}
-
-	dev_put(dev);
-}
-
-/*
- * nss_capwap_remap_error()
- *	Remaps NSS FW response error to nss_capwapmgr_status_t
- */
-static nss_capwapmgr_status_t nss_capwap_remap_error(nss_capwap_msg_response_t error)
-{
-	nss_capwapmgr_status_t status;
-
-	switch (error) {
-	case NSS_CAPWAP_ERROR_MSG_INVALID_REASSEMBLY_TIMEOUT:
-		status = NSS_CAPWAPMGR_FAILURE_INVALID_REASSEMBLY_TIMEOUT;
-		break;
-	case NSS_CAPWAP_ERROR_MSG_INVALID_PATH_MTU:
-		status = NSS_CAPWAPMGR_FAILURE_INVALID_PATH_MTU;
-		break;
-	case NSS_CAPWAP_ERROR_MSG_INVALID_MAX_FRAGMENT:
-		status = NSS_CAPWAPMGR_FAILURE_INVALID_MAX_FRAGMENT;
-		break;
-	case NSS_CAPWAP_ERROR_MSG_INVALID_BUFFER_SIZE:
-		status = NSS_CAPWAPMGR_FAILURE_INVALID_BUFFER_SIZE;
-		break;
-	case NSS_CAPWAP_ERROR_MSG_INVALID_L3_PROTO:
-		status = NSS_CAPWAPMGR_FAILURE_INVALID_L3_PROTO;
-		break;
-	case NSS_CAPWAP_ERROR_MSG_INVALID_UDP_PROTO:
-		status = NSS_CAPWAPMGR_FAILURE_INVALID_UDP_PROTO;
-		break;
-	case NSS_CAPWAP_ERROR_MSG_INVALID_VERSION:
-		status = NSS_CAPWAPMGR_FAILURE_INVALID_VERSION;
-		break;
-	case NSS_CAPWAP_ERROR_MSG_TUNNEL_DISABLED:
-		status = NSS_CAPWAPMGR_FAILURE_TUNNEL_DISABLED;
-		break;
-	case NSS_CAPWAP_ERROR_MSG_TUNNEL_ENABLED:
-		status = NSS_CAPWAPMGR_FAILURE_TUNNEL_ENABLED;
-		break;
-	case NSS_CAPWAP_ERROR_MSG_TUNNEL_NOT_CFG:
-		status = NSS_CAPWAPMGR_FAILURE_TUNNEL_NOT_CFG;
-		break;
-	default:
-		status = NSS_CAPWAPMGR_FAILURE;
-	}
-
-	return status;
-}
-
-/*
- * nss_capwapmgr_verify_tunnel_param()
- *	Common function to verify tunnel_id and returns pointer to tunnel.
- */
-static struct nss_capwapmgr_tunnel *nss_capwapmgr_verify_tunnel_param(struct net_device *dev, uint8_t tunnel_id)
-{
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwapmgr_tunnel *t;
-
-	if (!dev) {
-		return NULL;
-	}
-
-	if (tunnel_id > NSS_CAPWAPMGR_MAX_TUNNELS) {
-		return NULL;
-	}
-
-	dev_hold(dev);
-	priv = netdev_priv(dev);
-	t = &priv->tunnel[tunnel_id];
-	if (t->if_num == 0) {
-		dev_put(dev);
-		return NULL;
-	}
-
-	dev_put(dev);
-	return t;
-}
-
-/*
- * nss_capwapmgr_netdev_create()
- *	API to create a CAPWAP netdev
- */
-struct net_device *nss_capwapmgr_netdev_create()
-{
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwapmgr_response *r;
-	struct net_device *ndev;
-	int i;
-	int err;
-
-	ndev = alloc_netdev(sizeof(struct netdev_priv_instance),
-                                        "nsscapwap%d", nss_capwapmgr_dummpy_netdev_setup);
-	if (!ndev) {
-		nss_capwapmgr_warn("Error allocating netdev\n");
-		return NULL;
-	}
-
-	err = register_netdev(ndev);
-	if (err) {
-		nss_capwapmgr_warn("register_netdev() fail with error :%d\n", err);
-		free_netdev(ndev);
-		return NULL;
-	}
-
-	priv = netdev_priv(ndev);
-	priv->nss_ctx = nss_capwap_get_ctx();
-	priv->tunnel = kmalloc(sizeof(struct nss_capwapmgr_tunnel) * NSS_CAPWAPMGR_MAX_TUNNELS, GFP_ATOMIC);
-	if (!priv->tunnel) {
-		nss_capwapmgr_warn("failed to allocate tunnel memory");
-		goto fail1;
-	}
-	memset(priv->tunnel, 0, sizeof(struct nss_capwapmgr_tunnel) * NSS_CAPWAPMGR_MAX_TUNNELS);
-
-	priv->resp = kmalloc(sizeof(struct nss_capwapmgr_response) * NSS_MAX_DYNAMIC_INTERFACES, GFP_ATOMIC);
-	if (!priv->resp) {
-		nss_capwapmgr_warn("failed to allocate tunnel response memory");
-		goto fail2;
-	}
-	for (i = 0; i < NSS_MAX_DYNAMIC_INTERFACES; i++) {
-		r = &priv->resp[i];
-		init_waitqueue_head(&r->wq);
-
-		/*
-		 * CAPWAP interface is limited to one command per-tunnel.
-		 */
-		sema_init(&r->sem, 1);
-	}
-
-	priv->if_num_to_tunnel_id = kmalloc(sizeof(uint8_t) * NSS_MAX_NET_INTERFACES, GFP_ATOMIC);
-	if (!priv->if_num_to_tunnel_id) {
-		nss_capwapmgr_warn("failed to allocate if_num to tunnel_id memory");
-		goto fail3;
-	}
-	memset(priv->if_num_to_tunnel_id, 0, sizeof(uint8_t) * NSS_MAX_NET_INTERFACES);
-
-	if (nss_cmn_register_queue_decongestion(priv->nss_ctx, nss_capwapmgr_decongestion_callback, ndev) != NSS_CB_REGISTER_SUCCESS) {
-		nss_capwapmgr_warn("failed to register decongestion callback");
-		goto fail4;
-	}
-
-	return ndev;
-fail4:
-	kfree(priv->if_num_to_tunnel_id);
-fail3:
-	kfree(priv->resp);
-fail2:
-	kfree(priv->tunnel);
-fail1:
-	unregister_netdev(ndev);
-	free_netdev(ndev);
-	return NULL;
-}
-EXPORT_SYMBOL(nss_capwapmgr_netdev_create);
-
-/*
- * nss_capwapmgr_netdev_destroy()
- *	API for destroying a netdevice.
- *
- * All the CAPWAP tunnels must be destroyed first before netdevice.
- */
-nss_capwapmgr_status_t nss_capwapmgr_netdev_destroy(struct net_device *dev)
-{
-	rtnl_is_locked() ? unregister_netdevice(dev) : unregister_netdev(dev);
-	return NSS_CAPWAPMGR_SUCCESS;
-}
-EXPORT_SYMBOL(nss_capwapmgr_netdev_destroy);
-
-/*
- * nss_capwapmgr_register_with_nss()
- *	Internal function to register with NSS FW.
- */
-static nss_capwapmgr_status_t nss_capwapmgr_register_with_nss(uint32_t interface_num, struct net_device *dev)
-{
-	struct nss_ctx_instance *ctx;
-
-	/* features denote the skb_types supported */
-	uint32_t features = 0;
-
-	ctx = nss_capwap_data_register(interface_num, nss_capwapmgr_receive_pkt, dev, features);
-	if (!ctx) {
-		nss_capwapmgr_warn("%p: %d: nss_capwapmgr_data_register failed\n", dev, interface_num);
-		return NSS_CAPWAPMGR_FAILURE;
-	}
-
-	return NSS_CAPWAPMGR_SUCCESS;
-}
-
-/*
- * nss_capwapmgr_unregister_with_nss()
- *	Internal function to unregister with NSS FW
- */
-static void nss_capwapmgr_unregister_with_nss(uint32_t if_num)
-{
-	nss_capwapmgr_trace("%d: unregister with NSS FW", if_num);
-	nss_capwap_data_unregister(if_num);
-}
-
-/*
- * nss_capwapmgr_destroy_ipv4_rule()
- *	Destroy a given connection in the NSS
- */
-static nss_tx_status_t nss_capwapmgr_destroy_ipv4_rule(void *ctx, struct nss_ipv4_destroy *unid)
-{
-	struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *) ctx;
-	struct nss_ipv4_msg nim;
-	struct nss_ipv4_rule_destroy_msg *nirdm;
-
-	nss_capwapmgr_info("%p: ctx: Destroy IPv4: %pI4h:%d, %pI4h:%d, p: %d\n", nss_ctx,
-		&unid->src_ip, ntohs(unid->src_port), &unid->dest_ip, ntohs(unid->dest_port), unid->protocol);
-
-	nss_ipv4_msg_init(&nim, NSS_IPV4_RX_INTERFACE, NSS_IPV4_TX_DESTROY_RULE_MSG,
-			sizeof(struct nss_ipv4_rule_destroy_msg), NULL, NULL);
-
-	nirdm = &nim.msg.rule_destroy;
-
-	nirdm->tuple.protocol = (uint8_t)unid->protocol;
-	nirdm->tuple.flow_ip = unid->src_ip;
-	nirdm->tuple.flow_ident = (uint32_t)unid->src_port;
-	nirdm->tuple.return_ip = unid->dest_ip;
-	nirdm->tuple.return_ident = (uint32_t)unid->dest_port;
-	return nss_ipv4_tx(nss_ctx, &nim);
-}
-
-/*
- * nss_capwapmgr_unconfigure_ipv4_rule()
- *	Internal function to unconfigure IPv4 rule.
- */
-static nss_tx_status_t nss_capwapmgr_unconfigure_ipv4_rule(struct nss_ipv4_destroy *destroy)
-{
-	void *ctx;
-
-	ctx = nss_ipv4_get_mgr();
-	if (!ctx) {
-		nss_capwapmgr_warn("%s: couldn't get IPv4 ctx\n", "CAPWAP");
-		return NSS_TX_FAILURE_NOT_READY;
-	}
-
-	return nss_capwapmgr_destroy_ipv4_rule(ctx, destroy);
-}
-
-/*
- * nss_capwapmgr_create_ipv4_rule()
- *	Create a nss entry to accelerate the given connection
- */
-static nss_tx_status_t nss_capwapmgr_create_ipv4_rule(void *ctx, struct nss_ipv4_create *unic)
-{
-	struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *) ctx;
-	struct nss_ipv4_msg nim;
-	struct nss_ipv4_rule_create_msg *nircm;
-
-	nss_capwapmgr_info("%p: ctx: Create IPv4: %pI4h:%d (%pI4h:%d), %pI4h:%d (%pI4h:%d), p: %d\n", nss_ctx,
-		&unic->src_ip, ntohs(unic->src_port), &unic->src_ip_xlate, ntohs(unic->src_port_xlate),
-		&unic->dest_ip, ntohs(unic->dest_port), &unic->dest_ip_xlate, ntohs(unic->dest_port_xlate),
-		unic->protocol);
-
-	nss_ipv4_msg_init(&nim, NSS_IPV4_RX_INTERFACE, NSS_IPV4_TX_CREATE_RULE_MSG,
-			sizeof(struct nss_ipv4_rule_create_msg), NULL, NULL);
-
-	nircm = &nim.msg.rule_create;
-	nircm->valid_flags = 0;
-	nircm->rule_flags = 0;
-
-	/*
-	 * Copy over the 5 tuple details.
-	 */
-	nircm->tuple.protocol = (uint8_t)unic->protocol;
-	nircm->tuple.flow_ip = unic->src_ip;
-	nircm->tuple.flow_ident = (uint32_t)unic->src_port;
-	nircm->tuple.return_ip = unic->dest_ip;
-	nircm->tuple.return_ident = (uint32_t)unic->dest_port;
-
-	/*
-	 * Copy over the connection rules and set the CONN_VALID flag
-	 */
-	nircm->conn_rule.flow_interface_num = unic->src_interface_num;
-	nircm->conn_rule.flow_mtu = unic->from_mtu;
-	nircm->conn_rule.flow_ip_xlate = unic->src_ip_xlate;
-	nircm->conn_rule.flow_ident_xlate = (uint32_t)unic->src_port_xlate;
-	memcpy(nircm->conn_rule.flow_mac, unic->src_mac, 6);
-	nircm->conn_rule.return_interface_num = unic->dest_interface_num;
-	nircm->conn_rule.return_mtu = unic->to_mtu;
-	nircm->conn_rule.return_ip_xlate = unic->dest_ip_xlate;
-	nircm->conn_rule.return_ident_xlate = (uint32_t)unic->dest_port_xlate;
-	if (nircm->tuple.return_ip != nircm->conn_rule.return_ip_xlate ||
-		nircm->tuple.return_ident != nircm->conn_rule.return_ident_xlate) {
-		memcpy(nircm->conn_rule.return_mac, unic->dest_mac_xlate, 6);
-	} else {
-		memcpy(nircm->conn_rule.return_mac, unic->dest_mac, 6);
-	}
-
-	/*
-	 * Copy over the DSCP rule parameters
-	 */
-	nircm->dscp_rule.flow_dscp = unic->flow_dscp;
-	nircm->dscp_rule.return_dscp = unic->return_dscp;
-	if (unic->flags & NSS_IPV4_CREATE_FLAG_DSCP_MARKING) {
-		nircm->rule_flags |= NSS_IPV4_RULE_CREATE_FLAG_DSCP_MARKING;
-		nircm->valid_flags |= NSS_IPV4_RULE_CREATE_DSCP_MARKING_VALID;
-	}
-
-	nircm->valid_flags |= NSS_IPV4_RULE_CREATE_CONN_VALID;
-
-	/*
-	 * Copy over the pppoe rules and set the PPPOE_VALID flag.
-	 */
-	nircm->pppoe_rule.flow_pppoe_session_id = unic->flow_pppoe_session_id;
-	memcpy(nircm->pppoe_rule.flow_pppoe_remote_mac, unic->flow_pppoe_remote_mac, ETH_ALEN);
-	nircm->pppoe_rule.return_pppoe_session_id = unic->return_pppoe_session_id;
-	memcpy(nircm->pppoe_rule.return_pppoe_remote_mac, unic->return_pppoe_remote_mac, ETH_ALEN);
-	nircm->valid_flags |= NSS_IPV4_RULE_CREATE_PPPOE_VALID;
-
-	/*
-	 * Copy over the vlan rules and set the VLAN_VALID flag
-	 */
-	nircm->vlan_primary_rule.ingress_vlan_tag = unic->in_vlan_tag[0];
-	nircm->vlan_primary_rule.egress_vlan_tag = unic->out_vlan_tag[0];
-	nircm->vlan_secondary_rule.ingress_vlan_tag = unic->in_vlan_tag[1];
-	nircm->vlan_secondary_rule.egress_vlan_tag = unic->out_vlan_tag[1];
-	nircm->valid_flags |= NSS_IPV4_RULE_CREATE_VLAN_VALID;
-
-	/*
-	 * Copy over the qos rules and set the QOS_VALID flag
-	 */
-	nircm->qos_rule.flow_qos_tag = unic->flow_qos_tag;
-	nircm->qos_rule.return_qos_tag = unic->return_qos_tag;
-
-	nircm->valid_flags |= NSS_IPV4_RULE_CREATE_QOS_VALID;
-
-	if (unic->flags & NSS_IPV4_CREATE_FLAG_NO_SEQ_CHECK) {
-		nircm->rule_flags |= NSS_IPV4_RULE_CREATE_FLAG_NO_SEQ_CHECK;
-	}
-
-	if (unic->flags & NSS_IPV4_CREATE_FLAG_BRIDGE_FLOW) {
-		nircm->rule_flags |= NSS_IPV4_RULE_CREATE_FLAG_BRIDGE_FLOW;
-	}
-
-	if (unic->flags & NSS_IPV4_CREATE_FLAG_ROUTED) {
-		nircm->rule_flags |= NSS_IPV4_RULE_CREATE_FLAG_ROUTED;
-	}
-
-	/*
-	 * Set the flag NSS_IPV4_RULE_CREATE_FLAG_ICMP_NO_CME_FLUSH so that
-	 * rule is not flushed when NSS FW receives ICMP errors/packets.
-	 */
-	nircm->rule_flags |= NSS_IPV4_RULE_CREATE_FLAG_ICMP_NO_CME_FLUSH;
-
-	return nss_ipv4_tx(nss_ctx, &nim);
-}
-
-/*
- * nss_capwapmgr_configure_ipv4()
- *	Internal function for configuring IPv4 connection
- */
-static nss_tx_status_t nss_capwapmgr_configure_ipv4(struct nss_ipv4_create *pcreate)
-{
-	nss_tx_status_t status;
-	void *ctx;
-
-	ctx = nss_ipv4_get_mgr();
-	if (!ctx) {
-		nss_capwapmgr_warn("%s couldn't get IPv4 ctx\n", "CAPWAP");
-		return -1;
-	}
-
-	status = nss_capwapmgr_create_ipv4_rule(ctx, pcreate);
-	if (status != NSS_TX_SUCCESS) {
-		nss_capwapmgr_warn("%p: ctx: nss_ipv4_tx() failed with %d\n", ctx, status);
-		return status;
-	}
-
-	return NSS_TX_SUCCESS;
-}
-
-/*
- * nss_capwapmgr_tx_msg_sync()
- *	Waits for message to return.
- */
-static nss_capwapmgr_status_t nss_capwapmgr_tx_msg_sync(struct nss_ctx_instance *ctx, struct net_device *dev, struct nss_capwap_msg *msg)
-{
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwapmgr_response *r;
-	uint32_t if_num;
-	nss_capwapmgr_status_t status;
-
-	if_num = msg->cm.interface - NSS_DYNAMIC_IF_START;
-	dev_hold(dev);
-	priv = netdev_priv(dev);
-	r = &priv->resp[if_num];
-	down(&r->sem);
-	r->response = NSS_CMN_RESPONSE_ACK;
-	atomic_set(&r->seq, 1);		/* Indicate that we are waiting */
-
-	/*
-	 * Call NSS driver
-	 */
-	status = nss_capwap_tx_msg(ctx, msg);
-	if (status != NSS_CAPWAPMGR_SUCCESS) {
-		up(&r->sem);
-		return status;
-	}
-
-	if (!wait_event_timeout(r->wq, atomic_read(&r->seq) == 0, 5 * HZ)) {
-		atomic_set(&r->seq, 0);		/* Indicate that we are no longer waiting */
-		up(&r->sem);
-		nss_capwapmgr_warn("%p: CAPWAP command msg response timeout\n", ctx);
-		return NSS_CAPWAPMGR_FAILURE_CMD_TIMEOUT;
-	}
-
-	/*
-	 * If NSS FW responded back with an error.
-	 */
-	if (r->response != NSS_CMN_RESPONSE_ACK) {
-		up(&r->sem);
-		nss_warning("%p: CAPWAP command msg response : %d, error:%d\n", ctx,
-				r->response, r->error);
-		return nss_capwap_remap_error(r->error);
-	}
-
-	up(&r->sem);
-	return status;
-}
-
-/*
- * nss_capwapmgr_create_capwap_rule()
- *	Internal function to create a CAPWAP rule
- */
-static nss_capwapmgr_status_t nss_capwapmgr_create_capwap_rule(struct net_device *dev, uint32_t if_num, struct nss_capwap_rule_msg *msg)
-{
-	struct nss_ctx_instance *ctx = nss_capwap_get_ctx();
-	struct nss_capwap_msg capwapmsg;
-	struct nss_capwap_rule_msg *capwapcfg;
-	nss_tx_status_t status;
-
-	nss_capwapmgr_info("%p: ctx: CAPWAP Rule src_port: 0x%d dest_port:0x%d\n", ctx,
-	    ntohl(msg->encap.src_port), ntohl(msg->encap.dest_port));
-
-	/*
-	 * Verify CAPWAP rule parameters.
-	 */
-	if (ntohl(msg->decap.reassembly_timeout) > NSS_CAPWAP_MAX_REASSEMBLY_TIMEOUT) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	if (msg->decap.reassembly_timeout == 0) {
-		msg->decap.reassembly_timeout = htonl(10);	/* 10 milli-seconds */
-	}
-
-	if (ntohl(msg->decap.max_fragments) > NSS_CAPWAP_MAX_FRAGMENTS) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	if (msg->decap.max_fragments == 0) {
-		msg->decap.max_fragments = htonl(NSS_CAPWAP_MAX_FRAGMENTS);
-	}
-
-	if (ntohl(msg->decap.max_buffer_size) > NSS_CAPWAP_MAX_BUFFER_SIZE) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	if (msg->decap.max_buffer_size == 0) {
-		msg->decap.max_buffer_size = htonl(ctx->max_buf_size);
-	}
-
-	if (ntohl(msg->encap.path_mtu) > NSS_CAPWAP_MAX_MTU) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	if (msg->encap.path_mtu == 0) {
-		msg->encap.path_mtu = htonl(NSS_GMAC_NORMAL_FRAME_MTU);
-	}
-
-	/*
-	 * Prepare the tunnel configuration parameter to send to NSS FW
-	 */
-	memset(&capwapmsg, 0, sizeof(struct nss_capwap_msg));
-	capwapcfg = &capwapmsg.msg.rule;
-	memcpy(capwapcfg, msg, sizeof(struct nss_capwap_rule_msg));
-
-	/*
-	 * Send CAPWAP tunnel create command to NSS
-	 */
-	nss_capwap_msg_init(&capwapmsg, if_num, NSS_CAPWAP_MSG_TYPE_CFG_RULE,
-			sizeof(struct nss_capwap_rule_msg),
-			(nss_capwap_msg_callback_t *)nss_capwapmgr_msg_event_receive, dev);
-
-	status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
-	if (status != NSS_TX_SUCCESS) {
-		nss_capwapmgr_warn("%p: ctx: create encap data tunnel error %d \n", ctx, status);
-		return status;
-	}
-
-	return NSS_CAPWAPMGR_SUCCESS;
-}
-
-/*
- * nss_capwapmgr_update_path_mtu()
- *	API for updating Path MTU
- */
-nss_capwapmgr_status_t nss_capwapmgr_update_path_mtu(struct net_device *dev, uint8_t tunnel_id, uint32_t mtu)
-{
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwap_msg capwapmsg;
-	struct nss_capwapmgr_tunnel *t;
-	nss_capwapmgr_status_t status;
-
-	if (mtu > NSS_CAPWAP_MAX_MTU) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	t = nss_capwapmgr_verify_tunnel_param(dev, tunnel_id);
-	if (!t) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	dev_hold(dev);
-	priv = netdev_priv(dev);
-	nss_capwapmgr_info("%p: %d: tunnel update MTU is being called\n", dev, t->if_num);
-
-	/*
-	 * Prepare the tunnel configuration parameter to send to NSS FW
-	 */
-	memset(&capwapmsg, 0, sizeof(struct nss_capwap_msg));
-
-	/*
-	 * Send CAPWAP data tunnel command to NSS
-	 */
-	nss_capwap_msg_init(&capwapmsg, t->if_num, NSS_CAPWAP_MSG_TYPE_UPDATE_PATH_MTU,
-		0, (nss_capwap_msg_callback_t *)nss_capwapmgr_msg_event_receive, dev);
-	capwapmsg.msg.mtu.path_mtu = mtu;
-	status = nss_capwapmgr_tx_msg_sync(priv->nss_ctx, dev, &capwapmsg);
-	if (status != NSS_CAPWAPMGR_SUCCESS) {
-		nss_capwapmgr_warn("%p: Update Path MTU Tunnel error : %d \n", dev, status);
-		dev_put(dev);
-		return status;
-	}
-
-	dev_put(dev);
-	return status;
-}
-EXPORT_SYMBOL(nss_capwapmgr_update_path_mtu);
-
-/*
- * nss_capwapmgr_change_version()
- *	Change CAPWAP version
- */
-
-nss_capwapmgr_status_t nss_capwapmgr_change_version(struct net_device *dev, uint8_t tunnel_id, uint8_t ver)
-{
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwap_msg capwapmsg;
-	struct nss_capwapmgr_tunnel *t;
-	nss_capwapmgr_status_t status;
-
-	t = nss_capwapmgr_verify_tunnel_param(dev, tunnel_id);
-	if (!t) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	if (ver > NSS_CAPWAP_VERSION_V2) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	dev_hold(dev);
-	priv = netdev_priv(dev);
-
-	/*
-	 * Prepare the tunnel configuration parameter to send to NSS FW
-	 */
-	memset(&capwapmsg, 0, sizeof(struct nss_capwap_msg));
-
-	/*
-	 * Send CAPWAP data tunnel command to NSS
-	 */
-	nss_capwap_msg_init(&capwapmsg, t->if_num, NSS_CAPWAP_MSG_TYPE_VERSION,
-		0, (nss_capwap_msg_callback_t *)nss_capwapmgr_msg_event_receive, dev);
-	capwapmsg.msg.version.version = ver;
-	status = nss_capwapmgr_tx_msg_sync(priv->nss_ctx, dev, &capwapmsg);
-	if (status != NSS_CAPWAPMGR_SUCCESS) {
-		nss_capwapmgr_warn("%p: Update Path MTU Tunnel error : %d \n", dev, status);
-		dev_put(dev);
-		return status;
-	}
-
-	dev_put(dev);
-	return status;
-}
-EXPORT_SYMBOL(nss_capwapmgr_change_version);
-
-/*
- * nss_capwapmgr_tunnel_action()
- *	Common function for CAPWAP tunnel operation messages without
- *	any message data structures.
- */
-static nss_tx_status_t nss_capwapmgr_tunnel_action(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, nss_capwap_msg_type_t cmd)
-{
-	struct nss_capwap_msg capwapmsg;
-	nss_tx_status_t status;
-
-	/*
-	 * Prepare the tunnel configuration parameter to send to NSS FW
-	 */
-	memset(&capwapmsg, 0, sizeof(struct nss_capwap_msg));
-
-	/*
-	 * Send CAPWAP data tunnel command to NSS
-	 */
-	nss_capwap_msg_init(&capwapmsg, if_num, cmd, 0, (nss_capwap_msg_callback_t *)nss_capwapmgr_msg_event_receive, dev);
-	status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
-	if (status != NSS_TX_SUCCESS) {
-		nss_capwapmgr_warn("%p: ctx: CMD: %d Tunnel error : %d \n", ctx, cmd, status);
-		return status;
-	}
-
-	return status;
-}
-
-/*
- * nss_capwapmgr_enable_tunnel()
- *	API for enabling a data tunnel
- */
-nss_capwapmgr_status_t nss_capwapmgr_enable_tunnel(struct net_device *dev, uint8_t tunnel_id)
-{
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwapmgr_tunnel *t;
-	nss_tx_status_t ret;
-
-	t = nss_capwapmgr_verify_tunnel_param(dev, tunnel_id);
-	if (!t) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	if (t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_ENABLED) {
-		return NSS_CAPWAPMGR_FAILURE_TUNNEL_ENABLED;
-	}
-
-	dev_hold(dev);
-	priv = netdev_priv(dev);
-	nss_capwapmgr_info("%p: %d: tunnel enable is being called\n", dev, t->if_num);
-	ret = nss_capwapmgr_tunnel_action(priv->nss_ctx, dev, t->if_num, NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL);
-	if (ret == NSS_TX_SUCCESS) {
-		t->tunnel_state |= NSS_CAPWAPMGR_TUNNEL_STATE_ENABLED;
-	}
-	dev_put(dev);
-	return ret;
-}
-EXPORT_SYMBOL(nss_capwapmgr_enable_tunnel);
-
-/*
- * nss_capwapmgr_disable_tunnel()
- *	API for disabling a data tunnel
- */
-nss_capwapmgr_status_t nss_capwapmgr_disable_tunnel(struct net_device *dev, uint8_t tunnel_id)
-{
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwapmgr_tunnel *t;
-	nss_tx_status_t ret;
-
-	t = nss_capwapmgr_verify_tunnel_param(dev, tunnel_id);
-	if (!t) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	if (!(t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_ENABLED)) {
-		return NSS_CAPWAPMGR_FAILURE_TUNNEL_DISABLED;
-	}
-
-	dev_hold(dev);
-	priv = netdev_priv(dev);
-	nss_capwapmgr_info("%p: %d: tunnel disable is being called\n", dev, t->if_num);
-	ret = nss_capwapmgr_tunnel_action(priv->nss_ctx, dev, t->if_num, NSS_CAPWAP_MSG_TYPE_DISABLE_TUNNEL);
-	if (ret == NSS_TX_SUCCESS) {
-		t->tunnel_state &= ~NSS_CAPWAPMGR_TUNNEL_STATE_ENABLED;
-	}
-	dev_put(dev);
-	return ret;
-}
-EXPORT_SYMBOL(nss_capwapmgr_disable_tunnel);
-
-/*
- * nss_capwapmgr_ipv4_tunnel_create()
- *	API for creating IPv4 and CAPWAP rule.
- */
-nss_capwapmgr_status_t nss_capwapmgr_ipv4_tunnel_create(struct net_device *dev, uint8_t tunnel_id,
-			struct nss_ipv4_create *ip_rule, struct nss_capwap_rule_msg *capwap_rule)
-{
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwapmgr_tunnel *t;
-	nss_capwapmgr_status_t status;
-	int32_t if_num;
-	nss_tx_status_t nss_status;
-
-	if (tunnel_id > NSS_CAPWAPMGR_MAX_TUNNELS) {
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	t = nss_capwapmgr_verify_tunnel_param(dev, tunnel_id);
-	if (t) {
-		return NSS_CAPWAPMGR_FAILURE_TUNNEL_EXISTS;
-	}
-
-	if_num = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP);
-	if (if_num < 0) {
-		nss_capwapmgr_warn("%p: di returned error : %d\n", dev, if_num);
-		return NSS_CAPWAPMGR_FAILURE_DI_ALLOC_FAILED;
-	}
-
-	if (nss_capwapmgr_register_with_nss(if_num, dev) != NSS_CAPWAPMGR_SUCCESS) {
-		nss_capwapmgr_warn("%d: NSS CAPWAP register with NSS failed", if_num);
-		(void)nss_dynamic_interface_dealloc_node(if_num, NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP);
-		return NSS_CAPWAPMGR_FAILURE_REGISTER_NSS;
-	}
-
-	status = nss_capwapmgr_create_capwap_rule(dev, if_num, capwap_rule);
-	nss_capwapmgr_info("%p: dynamic interface if_num is :%d and capwap tunnel status:%d\n", dev, if_num, status);
-	if (status != NSS_CAPWAPMGR_SUCCESS) {
-		nss_capwapmgr_warn("%p: %d: CAPWAP rule create failed with status: %d", dev, if_num, status);
-		nss_capwapmgr_unregister_with_nss(if_num);
-		(void)nss_dynamic_interface_dealloc_node(if_num, NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP);
-		return NSS_CAPWAPMGR_FAILURE_CAPWAP_RULE;
-	}
-
-	ip_rule->dest_interface_num = if_num;
-	nss_status = nss_capwapmgr_configure_ipv4(ip_rule);
-	if (nss_status != NSS_TX_SUCCESS) {
-		nss_capwapmgr_warn("%p: %d: IPv4/IPv6 rule create failed with status: %d", dev, if_num, nss_status);
-		nss_capwapmgr_unregister_with_nss(if_num);
-		(void)nss_dynamic_interface_dealloc_node(if_num, NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP);
-		return NSS_CAPWAPMGR_FAILURE_IP_RULE;
-	}
-
-	dev_hold(dev);
-	priv = netdev_priv(dev);
-	t = &priv->tunnel[tunnel_id];
-	nss_capwapmgr_info("%p: %d: CAPWAP TUNNEL CREATE DONE tunnel_id:%d (%p)\n", dev, if_num, tunnel_id, t);
-
-	/*
-	 * Keep a copy of rule information.
-	 */
-	memcpy(&t->ip_rule.v4, ip_rule, sizeof (struct nss_ipv4_create));
-	memcpy(&t->capwap_rule, capwap_rule, sizeof (struct nss_capwap_rule_msg));
-
-
-	/*
-	 * Make it globally visible inside the netdev.
-	 */
-	t->if_num = if_num;
-	priv->if_num_to_tunnel_id[if_num] = tunnel_id;
-	t->tunnel_state |= NSS_CAPWAPMGR_TUNNEL_STATE_CONFIGURED;
-
-	dev_put(dev);
-	return status;
-}
-EXPORT_SYMBOL(nss_capwapmgr_ipv4_tunnel_create);
-
-/*
- * nss_capwapmgr_tunnel_save_stats()
- *	Internal function to save tunnel stats when a tunnel is being
- *	destroyed.
- */
-static void nss_capwapmgr_tunnel_save_stats(struct nss_capwap_tunnel_stats *save, struct nss_capwap_tunnel_stats *fstats)
-{
-	save->rx_segments += fstats->rx_segments;
-	save->tx_segments += fstats->tx_segments;
-	save->dtls_pkts += fstats->dtls_pkts;
-	save->oversize_drops += fstats->oversize_drops;
-	save->frag_timeout_drops += fstats->frag_timeout_drops;
-	save->rx_queue_full_drops += fstats->rx_queue_full_drops;
-	save->rx_n2h_queue_full_drops += fstats->rx_n2h_queue_full_drops;
-	save->rx_mem_failure_drops += fstats->rx_mem_failure_drops;
-
-	save->tx_queue_full_drops += fstats->tx_queue_full_drops;
-	save->tx_mem_failure_drops += fstats->tx_mem_failure_drops;
-
-	/*
-	 * add pnode stats now.
-	 */
-	save->pnode_stats.rx_packets += fstats->pnode_stats.rx_packets;
-	save->pnode_stats.rx_bytes += fstats->pnode_stats.rx_bytes;
-	save->pnode_stats.rx_dropped += fstats->pnode_stats.rx_dropped;
-	save->pnode_stats.tx_packets += fstats->pnode_stats.tx_packets;
-	save->pnode_stats.tx_bytes += fstats->pnode_stats.tx_bytes;
-}
-
-/*
- * nss_capwapmgr_tunnel_destroy()
- *	API for destroying a tunnel. CAPWAP tunnel must be first disabled.
- */
-nss_capwapmgr_status_t nss_capwapmgr_tunnel_destroy(struct net_device *dev, uint8_t tunnel_id)
-{
-	struct nss_capwap_tunnel_stats stats;
-	struct nss_ipv4_destroy d;
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwapmgr_tunnel *t;
-	nss_tx_status_t nss_status;
-	uint32_t if_num;
-	nss_capwapmgr_status_t status;
-
-	t = nss_capwapmgr_verify_tunnel_param(dev, tunnel_id);
-	if (!t) {
-		nss_capwapmgr_warn("%p: tunnel %d: wrong argument for tunnel destroy\n", dev, tunnel_id);
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	if (!(t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_CONFIGURED)) {
-		return NSS_CAPWAPMGR_FAILURE_TUNNEL_NOT_CFG;
-	}
-
-	/*
-	 * We don't allow destroy operation on tunnel if it's still
-	 * enabled.
-	 */
-	if (t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_ENABLED) {
-		return NSS_CAPWAPMGR_FAILURE_TUNNEL_ENABLED;
-	}
-
-	dev_hold(dev);
-	priv = netdev_priv(dev);
-	nss_capwapmgr_info("%p: %d: tunnel destroy is being called\n", dev, t->if_num);
-	if_num = t->if_num;
-
-	if (priv->if_num_to_tunnel_id[if_num] != tunnel_id) {
-		nss_capwapmgr_warn("%p: %d: tunnel_id %d didn't match with tunnel_id :%d\n",
-			dev, if_num, tunnel_id, priv->if_num_to_tunnel_id[if_num]);
-		dev_put(dev);
-		return NSS_CAPWAPMGR_FAILURE_BAD_PARAM;
-	}
-
-	if (nss_capwap_get_stats(if_num, &stats) == true) {
-		nss_capwapmgr_tunnel_save_stats(&tunneld, &stats);
-	}
-
-	t->if_num = 0;
-	t->tunnel_state &= ~NSS_CAPWAPMGR_TUNNEL_STATE_CONFIGURED;
-	priv->if_num_to_tunnel_id[if_num] = 0;
-
-	/*
-	 * Destroy IP rule first. TODO: Add IPv6 support also
-	 */
-	memset(&d, 0, sizeof (struct nss_ipv4_destroy));
-	d.protocol = IPPROTO_UDP;	/* TODO: UDP Lite */
-	d.src_ip = t->ip_rule.v4.src_ip;
-	d.dest_ip = t->ip_rule.v4.dest_ip;
-	d.src_port = t->ip_rule.v4.src_port;
-	d.dest_port = t->ip_rule.v4.dest_port;
-	nss_status = nss_capwapmgr_unconfigure_ipv4_rule(&d);
-	if (nss_status != NSS_TX_SUCCESS) {
-		nss_capwapmgr_warn("%p: %d: Unconfigure IP rule failed for tunnel : %d\n",
-			dev, if_num, tunnel_id);
-	}
-
-	/*
-	 * Destroy CAPWAP rule now.
-	 */
-	status = nss_capwapmgr_tunnel_action(priv->nss_ctx, dev, if_num, NSS_CAPWAP_MSG_TYPE_UNCFG_RULE);
-	if (status != NSS_CAPWAPMGR_SUCCESS) {
-		nss_capwapmgr_warn("%p: %d: Unconfigure CAPWAP rule failed for tunnel : %d\n",
-			dev, if_num, tunnel_id);
-	}
-
-	nss_capwapmgr_unregister_with_nss(if_num);
-
-	/*
-	 * Deallocate dynamic interface
-	 */
-	nss_status = nss_dynamic_interface_dealloc_node(if_num, NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP);
-	if (nss_status != NSS_TX_SUCCESS) {
-		nss_capwapmgr_warn("%p: %d: Dealloc of dynamic interface failed for tunnel : %d\n",
-			dev, if_num, tunnel_id);
-	}
-
-	memset(t, 0, sizeof (struct nss_capwapmgr_tunnel));
-
-	nss_capwapmgr_info("%p: %d: Tunnel %d is completely destroyed\n", dev, if_num, tunnel_id);
-	dev_put(dev);
-	return nss_status;
-}
-EXPORT_SYMBOL(nss_capwapmgr_tunnel_destroy);
-
-/*
- * nss_capwapmgr_receive_pkt()
- *	Receives a pkt from NSS
- */
-static void nss_capwapmgr_receive_pkt(struct net_device *dev, struct sk_buff *skb, struct napi_struct *napi)
-{
-	struct nss_capwapmgr_priv *priv;
-	struct nss_capwap_metaheader *pre = (struct nss_capwap_metaheader *)skb->data;
-	int32_t if_num;
-
-	if (skb->len < sizeof(struct nss_capwap_metaheader)) {
-		nss_capwapmgr_warn("%p: skb len is short :%d", dev, skb->len);
-		dev_kfree_skb_any(skb);
-		return;
-	}
-
-	/* SKB NETIF START */
-	dev_hold(dev);
-	priv = netdev_priv(dev);
-	if (pre->version != NSS_CAPWAP_VERSION_V2) {
-		nss_capwapmgr_warn("%p: wrong version number %d expected:%d\n", dev,
-			pre->version, NSS_CAPWAP_VERSION_V2);
-	}
-
-	if_num = pre->tunnel_id;	/* NSS FW sends interface number */
-	if (if_num > NSS_MAX_NET_INTERFACES) {
-		nss_capwapmgr_warn("%p: if_num %d is wrong for skb\n", dev, if_num);
-		pre->tunnel_id = 0xFF;
-	} else {
-		/*
-		 * Remap interface number to tunnel_id.
-		 */
-		pre->tunnel_id = priv->if_num_to_tunnel_id[if_num];
-	}
-
-	skb->dev = dev;
-	skb->pkt_type = PACKET_HOST;
-	skb->skb_iif = dev->ifindex;
-	skb_reset_mac_header(skb);
-	skb_reset_transport_header(skb);
-	(void) netif_rx(skb);
-	/* SKB NETIF END */
-	dev_put(dev);
-}
-
-#if defined(NSS_CAPWAPMGR_ONE_NETDEV)
-/*
- * nss_capwapmgr_get_netdev()
- *	Returns net device used.
- */
-struct net_device *nss_capwapmgr_get_netdev(void)
-{
-	return nss_capwapmgr_ndev;
-}
-EXPORT_SYMBOL(nss_capwapmgr_get_netdev);
-#endif
-
-/*
- * nss_capwapmgr_init_module()
- *	Tunnel CAPWAP module init function
- */
-int __init nss_capwapmgr_init_module(void)
-{
-	nss_capwapmgr_info("module (platform - IPQ806x , Build - %s:%s) loaded\n",
-			__DATE__, __TIME__);
-
-#if defined(NSS_CAPWAPMGR_ONE_NETDEV)
-	/*
-	 * In this code, we create a single netdev for all the CAPWAP
-	 * tunnels.
-	 */
-	nss_capwapmgr_ndev = nss_capwapmgr_netdev_create();
-	if (!nss_capwapmgr_ndev) {
-		nss_capwapmgr_warn("Couldn't create capwap interface\n");
-		return -1;
-	}
-#endif
-
-
-	memset(&tunneld, 0, sizeof (struct nss_capwap_tunnel_stats));
-	return 0;
-}
-
-/*
- * nss_capwapmgr_exit_module()
- *	Tunnel CAPWAP module exit function
- */
-void __exit nss_capwapmgr_exit_module(void)
-{
-#if defined(NSS_CAPWAPMGR_ONE_NETDEV)
-	struct nss_capwapmgr_priv *priv;
-	uint8_t i;
-
-	priv = netdev_priv(nss_capwapmgr_ndev);
-	for (i = 0; i < NSS_CAPWAPMGR_MAX_TUNNELS; i++) {
-		(void) nss_capwapmgr_disable_tunnel(nss_capwapmgr_ndev, i);
-		(void) nss_capwapmgr_tunnel_destroy(nss_capwapmgr_ndev, i);
-	}
-	kfree(priv->if_num_to_tunnel_id);
-	kfree(priv->resp);
-	kfree(priv->tunnel);
-	unregister_netdev(nss_capwapmgr_ndev);
-	nss_capwapmgr_ndev = NULL;
-#endif
-	nss_capwapmgr_info("module unloaded\n");
-}
-
-module_init(nss_capwapmgr_init_module);
-module_exit(nss_capwapmgr_exit_module);
-
-MODULE_LICENSE("Dual BSD/GPL");
-MODULE_DESCRIPTION("NSS CAPWAP manager");
diff --git a/exports/nss_api_if.h b/exports/nss_api_if.h
index 82c9b08..fcbe4b2 100644
--- a/exports/nss_api_if.h
+++ b/exports/nss_api_if.h
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -52,6 +52,7 @@
 #include "nss_gre_redir.h"
 #include "nss_sjack.h"
 #include "nss_capwap.h"
+#include "nss_n2h.h"
 
 /*
  * Interface numbers are reserved in the
@@ -72,6 +73,10 @@
 /*
  * Maximum Number of interfaces
  */
+#define NSS_MAX_CORES 2
+#define NSS_MAX_DEVICE_INTERFACES (NSS_MAX_PHYSICAL_INTERFACES + NSS_MAX_VIRTUAL_INTERFACES + NSS_MAX_TUNNEL_INTERFACES + NSS_MAX_DYNAMIC_INTERFACES)
+#define NSS_MAX_NET_INTERFACES (NSS_MAX_DEVICE_INTERFACES + NSS_MAX_SPECIAL_INTERFACES)
+
 #define NSS_MAX_PHYSICAL_INTERFACES 4
 #define NSS_MAX_VIRTUAL_INTERFACES 16
 #define NSS_MAX_TUNNEL_INTERFACES 4
diff --git a/exports/nss_capwap.h b/exports/nss_capwap.h
index 528627a..b0fcc89 100644
--- a/exports/nss_capwap.h
+++ b/exports/nss_capwap.h
@@ -83,6 +83,15 @@
 				/**< UDPLite tunnel */
 
 /**
+ * CAPWAP tunnel create and type flags. These flags are used
+ * to determine packet header size during encapsulation.
+ */
+#define NSS_CAPWAPMGR_RULE_CREATE_VLAN_CONFIGURED	0x1
+				/**< VLAN Configured for CAPWAP tunnel */
+#define NSS_CAPWAPMGR_RULE_CREATE_PPPOE_CONFIGURED	0x2
+				/**< PPPoE configured for CAPWAP tunnel */
+
+/**
  * CAPWAP version
  */
 #define NSS_CAPWAP_VERSION_V1		0x1
@@ -161,6 +170,9 @@
 struct nss_capwap_rule_msg {
 	struct nss_capwap_encap_rule encap;	/**< Encap portion of the rule */
 	struct nss_capwap_decap_rule decap;	/**< Decap portion of the rule */
+	uint32_t stats_timer;			/**< Stats interval timer in mill-seconds */
+	int8_t rps;				/**< Core to choose for receiving packets. Set to -1 for NSS FW to decide */
+	uint8_t type_flags;			/**< VLAN and/or PPPOE configured */
 	uint8_t l3_proto;			/**< 0=IPv4 or 1=IPv6 */
 	uint8_t which_udp;			/**< 0=UDP or 1=UDPLite */
 };
@@ -342,6 +354,15 @@
 extern struct nss_ctx_instance *nss_capwap_get_ctx(void);
 
 /**
+ * @brief Gets NSS max_buf_size
+ *
+ * @param NSS context
+ *
+ * @return ctx->max_buf_size.
+ */
+extern uint32_t nss_capwap_get_max_buf_size(struct nss_ctx_instance *nss_ctx);
+
+/**
  * @brief Return per-tunnel statistics
  *
  * @param interface numbe
diff --git a/exports/nss_crypto.h b/exports/nss_crypto.h
index 5a16acf..665e21e 100644
--- a/exports/nss_crypto.h
+++ b/exports/nss_crypto.h
@@ -82,6 +82,15 @@
 };
 
 /**
+ * @brief session states
+ */
+enum nss_crypto_session_state {
+	NSS_CRYPTO_SESSION_STATE_NONE = 0,	/**< session state none */
+	NSS_CRYPTO_SESSION_STATE_ACTIVE = 1,	/**< session state is active */
+	NSS_CRYPTO_SESSION_STATE_FREE = 2	/**< session state is free */
+};
+
+/**
  * @brief crypto origin
  */
 enum nss_crypto_buf_origin {
@@ -116,7 +125,8 @@
  * @brief Reset session related state.
  */
 struct nss_crypto_config_session {
-	uint32_t idx;		/**< session idx on which will be reset */
+	uint32_t idx;				/**< session idx on which will be reset */
+	uint32_t state;				/**< session idx state */
 };
 
 /*
diff --git a/exports/nss_ipv4.h b/exports/nss_ipv4.h
index b4991eb..2532792 100644
--- a/exports/nss_ipv4.h
+++ b/exports/nss_ipv4.h
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -403,6 +403,8 @@
 	} msg;
 };
 
+extern int nss_ipv6_conn_cfg;
+
 /**
  * Callback to be called when IPv4 message is received
  */
diff --git a/exports/nss_ipv6.h b/exports/nss_ipv6.h
index 116098c..091b213 100644
--- a/exports/nss_ipv6.h
+++ b/exports/nss_ipv6.h
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -367,6 +367,8 @@
 	} msg;
 };
 
+extern int nss_ipv4_conn_cfg;
+
 /**
  * Callback to be called when IPv6 message is received
  */
diff --git a/exports/nss_n2h.h b/exports/nss_n2h.h
new file mode 100644
index 0000000..154a06c
--- /dev/null
+++ b/exports/nss_n2h.h
@@ -0,0 +1,149 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+/*
+ * nss_n2h.h
+ *	NSS to HLOS interface definitions.
+ */
+
+/*
+ * TODO: Since this is the now the public header file for writting an
+ * IPv4 message, we need to convert the entire file to doxygen.
+ */
+
+#ifndef __NSS_N2H_H
+#define __NSS_N2H_H
+
+/*
+ * Private data structure for configure general configs
+ */
+struct nss_n2h_cfg_pvt {
+	struct semaphore sem;			/* Semaphore structure */
+	struct completion complete;		/* completion structure */
+	int current_value;			/* valid entry */
+	int response;				/* Response from FW */
+};
+
+/*
+ * Request/Response types
+ */
+enum nss_n2h_metadata_types {
+	NSS_RX_METADATA_TYPE_N2H_STATS_SYNC=0,
+	NSS_TX_METADATA_TYPE_N2H_RPS_CFG,
+	NSS_TX_METADATA_TYPE_N2H_EMPTY_POOL_BUF_CFG,
+	NSS_METADATA_TYPE_N2H_MAX,
+};
+
+struct nss_n2h_rps {
+	uint32_t enable; /* Enable NSS RPS */
+};
+
+struct nss_n2h_empty_pool_buf {
+	uint32_t pool_size; /* Empty pool buf size */
+};
+
+/*
+ * NSS Pbuf mgr stats
+ */
+struct nss_n2h_pbuf_mgr_stats {
+	uint32_t pbuf_alloc_fails;		/* Pbuf ocm alloc fail */
+	uint32_t pbuf_free_count;		/* Pbuf ocm free count */
+	uint32_t pbuf_total_count;		/* Pbuf ocm total count */
+};
+
+/*
+ * The NSS N2H statistics sync structure.
+ */
+struct nss_n2h_stats_sync {
+	struct nss_cmn_node_stats node_stats;
+					/* Common node stats for N2H */
+	uint32_t queue_dropped;		/* Number of packets dropped because the PE queue is too full */
+	uint32_t total_ticks;		/* Total clock ticks spend inside the PE */
+	uint32_t worst_case_ticks;	/* Worst case iteration of the PE in ticks */
+	uint32_t iterations;		/* Number of iterations around the PE */
+
+	struct nss_n2h_pbuf_mgr_stats pbuf_ocm_stats;
+					/* Pbuf OCM Stats */
+	struct nss_n2h_pbuf_mgr_stats pbuf_default_stats;
+					/* Pbuf Default Stats */
+
+	uint32_t payload_alloc_fails;	/* Number of payload alloc failures */
+
+	uint32_t h2n_ctrl_pkts;		/* Control packets received from HLOS */
+	uint32_t h2n_ctrl_bytes;	/* Control bytes received from HLOS */
+	uint32_t n2h_ctrl_pkts;		/* Control packets sent to HLOS */
+	uint32_t n2h_ctrl_bytes;	/* Control bytes sent to HLOS */
+
+	uint32_t h2n_data_pkts;		/* Data packets received from HLOS */
+	uint32_t h2n_data_bytes;	/* Data bytes received from HLOS */
+	uint32_t n2h_data_pkts;		/* Data packets sent to HLOS */
+	uint32_t n2h_data_bytes;	/* Data bytes sent to HLOS */
+};
+
+/*
+ * Message structure to send/receive phys i/f commands
+ */
+struct nss_n2h_msg {
+	struct nss_cmn_msg cm;			/* Message Header */
+	union {
+		struct nss_n2h_stats_sync stats_sync;	/* Message: N2H stats sync */
+		struct nss_n2h_rps rps_cfg; 		/* Message: RPS configuration */
+		struct nss_n2h_empty_pool_buf empty_pool_buf_cfg;
+							/* Message: empty pool buf configuration */
+	} msg;
+};
+
+/**
+ * Callback to be called when IPv4 message is received
+ */
+typedef void (*nss_n2h_msg_callback_t)(void *app_data, struct nss_n2h_msg *msg);
+
+/*
+ * nss_n2h_tx_msg()
+ * 	API to send messaged to n2h package.
+ */
+extern nss_tx_status_t nss_n2h_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_n2h_msg *nnm);
+
+/*
+ * nss_n2h_tx()
+ * 	API to enable/disable Host RPS support in NSS
+ */
+extern nss_tx_status_t nss_n2h_tx(struct nss_ctx_instance *nss_ctx, uint32_t enable_rps);
+
+/*
+ * nss_n2h_empty_pool_buf_register_sysctl()
+ *	API to register sysctl for empty pool buffer in n2h.
+ */
+extern void nss_n2h_empty_pool_buf_register_sysctl(void);
+
+/*
+ * nss_n2h_empty_pool_buf_unregister_sysctl()
+ *	API to unregister sysctl for empty pool buffer in n2h.
+ */
+extern void nss_n2h_empty_pool_buf_unregister_sysctl(void);
+
+/*
+ * nss_n2h_msg_init()
+ *	API to initialize the message for N2H package from Host to NSS
+ */
+typedef void (*nss_n2h_msg_callback_t)(void *app_data, struct nss_n2h_msg *msg);
+extern void nss_n2h_msg_init(struct nss_n2h_msg *nim, uint16_t if_num, uint32_t type, uint32_t len,
+			nss_n2h_msg_callback_t *cb, void *app_data);
+
+extern struct nss_ctx_instance *nss_ipv4_notify_register(nss_ipv4_msg_callback_t cb, void *app_data);
+#endif // __NSS_N2H_H
+
+
diff --git a/exports/nss_profiler.h b/exports/nss_profiler.h
index ab30425..3da9d54 100644
--- a/exports/nss_profiler.h
+++ b/exports/nss_profiler.h
@@ -14,6 +14,9 @@
  **************************************************************************
  */
 
+#ifndef __NSS_PROFILER_H
+#define __NSS_PROFILER_H
+
 /**
  * nss_profiler.h
  *	NSS Profiler APIs
@@ -173,3 +176,4 @@
 extern void nss_profiler_msg_init(struct nss_profiler_msg *npm, uint16_t if_num, uint32_t type, uint32_t len,
 					nss_profiler_callback_t *cb, void *app_data);
 
+#endif
diff --git a/nss_capwap.c b/nss_capwap.c
index 9965ec6..8f27ed4 100644
--- a/nss_capwap.c
+++ b/nss_capwap.c
@@ -148,6 +148,8 @@
 	stats->rx_segments += fstats->rx_segments;
 	stats->tx_segments += fstats->tx_segments;
 	stats->dtls_pkts += fstats->dtls_pkts;
+
+	stats->rx_dup_frag += fstats->rx_dup_frag;
 	stats->oversize_drops += fstats->oversize_drops;
 	stats->frag_timeout_drops += fstats->frag_timeout_drops;
 	stats->rx_queue_full_drops += fstats->rx_queue_full_drops;
@@ -157,6 +159,8 @@
 	stats->tx_queue_full_drops += fstats->tx_queue_full_drops;
 	stats->tx_mem_failure_drops += fstats->tx_mem_failure_drops;
 
+	stats->tx_dropped += fstats->tx_dropped;
+
 	/*
 	 * add pnode stats now.
 	 */
@@ -548,6 +552,16 @@
 EXPORT_SYMBOL(nss_capwap_get_ctx);
 
 /*
+ * nss_capwap_get_max_buf_size()
+ *	Return a CAPWAP NSS max_buf_size.
+ */
+uint32_t nss_capwap_get_max_buf_size(struct nss_ctx_instance *nss_ctx)
+{
+	return nss_core_get_max_buf_size(nss_ctx);
+}
+EXPORT_SYMBOL(nss_capwap_get_max_buf_size);
+
+/*
  * nss_capwap_init()
  *	Initializes CAPWAP. Gets called from nss_init.c
  */
diff --git a/nss_connmgr_tun6rd.c b/nss_connmgr_tun6rd.c
deleted file mode 100644
index a6db78b..0000000
--- a/nss_connmgr_tun6rd.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_tun6rd.c
- *
- * This file is the NSS 6rd tunnel module
- * ------------------------REVISION HISTORY-----------------------------
- * Qualcomm Atheros         15/sep/2013              Created
- */
-
-#include <linux/types.h>
-#include <linux/ip.h>
-#include <linux/tcp.h>
-#include <linux/module.h>
-#include <linux/skbuff.h>
-#include <net/ipv6.h>
-#include <net/ipip.h>
-#include <linux/if_arp.h>
-#include <nss_api_if.h>
-#include <nss_dynamic_interface.h>
-
-/*
- * NSS tun6rd debug macros
- */
-#if (NSS_TUN6RD_DEBUG_LEVEL < 1)
-#define nss_tun6rd_assert(fmt, args...)
-#else
-#define nss_tun6rd_assert(c) if (!(c)) { BUG_ON(!(c)); }
-#endif
-
-#if defined(CONFIG_DYNAMIC_DEBUG)
-/*
- * Compile messages for dynamic enable/disable
- */
-#define nss_tun6rd_warning(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define nss_tun6rd_info(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define nss_tun6rd_trace(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#else
-
-/*
- * Statically compile messages at different levels
- */
-#if (NSS_TUN6RD_DEBUG_LEVEL < 2)
-#define nss_tun6rd_warning(s, ...)
-#else
-#define nss_tun6rd_warning(s, ...) pr_warn("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#endif
-
-#if (NSS_TUN6RD_DEBUG_LEVEL < 3)
-#define nss_tun6rd_info(s, ...)
-#else
-#define nss_tun6rd_info(s, ...)   pr_notice("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#endif
-
-#if (NSS_TUN6RD_DEBUG_LEVEL < 4)
-#define nss_tun6rd_trace(s, ...)
-#else
-#define nss_tun6rd_trace(s, ...)  pr_info("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#endif
-#endif
-
-/*
- * 6rd tunnel stats
- */
-struct nss_tun6rd_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 */
-};
-
-/*
- * nss_tun6rd_update_dev_stats
- *	Update the Dev stats received from NetAp
- */
-static void nss_tun6rd_update_dev_stats(struct net_device *dev,
-					struct nss_tun6rd_sync_stats_msg *sync_stats)
-{
-	struct nss_tun6rd_stats stats;
-
-	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;
-
-	ipip6_update_offload_stats(dev, (void *)&stats);
-}
-
-/*
- * nss_tun6rd_event_receive()
- *	Event Callback to receive events from NSS
- */
-static void nss_tun6rd_event_receive(void *if_ctx, struct nss_tun6rd_msg *tnlmsg)
-{
-	struct net_device *netdev = if_ctx;
-
-	switch (tnlmsg->cm.type) {
-	case NSS_TUN6RD_RX_STATS_SYNC:
-		nss_tun6rd_update_dev_stats(netdev, (struct nss_tun6rd_sync_stats_msg *)&tnlmsg->msg.stats);
-		break;
-
-	default:
-		nss_tun6rd_info("Unknown Event from NSS\n");
-		break;
-	}
-}
-
-/*
- * nss_tun6rd_exception()
- *	Exception handler registered to NSS driver
- */
-static void nss_tun6rd_exception(struct net_device *dev, struct sk_buff *skb, __attribute__((unused)) struct napi_struct *napi)
-{
-	const struct iphdr *iph;
-
-	skb->dev = dev;
-	nss_tun6rd_info("received - %d bytes name %s ver %x\n",
-			skb->len,dev->name,skb->data[0]);
-
-	iph = (const struct iphdr *)skb->data;
-
-	/*
-	 * Packet after Decap/Encap Did not find the Rule.
-	 */
-	if (iph->version != 4) {
-		skb->protocol = htons(ETH_P_IPV6);
-	} else {
-		if (iph->protocol == IPPROTO_IPV6) {
-			skb_pull(skb, sizeof(struct iphdr));
-			skb->protocol = htons(ETH_P_IPV6);
-			skb_reset_network_header(skb);
-			skb->pkt_type = PACKET_HOST;
-			skb->ip_summed = CHECKSUM_NONE;
-			dev_queue_xmit(skb);
-			return;
-		}
-		skb->protocol = htons(ETH_P_IP);
-	}
-
-	skb_reset_network_header(skb);
-	skb->pkt_type = PACKET_HOST;
-	skb->skb_iif = dev->ifindex;
-	skb->ip_summed = CHECKSUM_NONE;
-	netif_receive_skb(skb);
-}
-
-/*
- * nss_tun6rd_dev_up()
- *	6RD Tunnel device i/f up handler
- */
-static int nss_tun6rd_dev_up(struct net_device *netdev)
-{
-	struct ip_tunnel *tunnel;
-	struct ip_tunnel_6rd_parm *ip6rd;
-	const struct iphdr  *tiph;
-	struct nss_tun6rd_msg tun6rdmsg;
-	struct nss_tun6rd_attach_tunnel_msg *tun6rdcfg;
-	uint32_t if_number;
-	nss_tx_status_t status;
-	struct nss_ctx_instance *nss_ctx;
-	uint32_t features = 0; /* features denote the skb types supported by this interface */
-
-	/*
-	 * Validate netdev for ipv6-in-ipv4  Tunnel
-	 */
-	if (netdev->type != ARPHRD_SIT) {
-		return NOTIFY_DONE;
-	}
-
-	tunnel = (struct ip_tunnel *)netdev_priv(netdev);
-	ip6rd =  &tunnel->ip6rd;
-
-	/*
-	 * Valid 6rd Tunnel Check
-	 * 1. 6rd Prefix len should be non zero
-	 * 2. Relay prefix length should not be greater then 32
-	 * 3. To allow for stateless address auto-configuration on the CE LAN side,
-	 *    6rd delegated prefix SHOULD be /64 or shorter.
-	 */
-	if ((ip6rd->prefixlen == 0 )
-			|| (ip6rd->relay_prefixlen > 32)
-			|| (ip6rd->prefixlen
-				+ (32 - ip6rd->relay_prefixlen) > 64)) {
-
-		nss_tun6rd_warning("Invalid 6rd argument prefix len %d relayprefix len %d \n",
-				ip6rd->prefixlen,ip6rd->relay_prefixlen);
-		return NOTIFY_BAD;
-	}
-
-	nss_tun6rd_info("Valid 6rd Tunnel Prefix %x %x %x %x\n Prefix len %d relay_prefix %d relay_prefixlen %d \n",
-			ip6rd->prefix.s6_addr32[0],ip6rd->prefix.s6_addr32[1],
-			ip6rd->prefix.s6_addr32[2],ip6rd->prefix.s6_addr32[3],
-			ip6rd->prefixlen, ip6rd->relay_prefix,
-			ip6rd->relay_prefixlen);
-
-	/*
-	 * Find the Tunnel device IP header info
-	 */
-	tiph = &tunnel->parms.iph ;
-	nss_tun6rd_trace("Tunnel Param srcaddr %x daddr %x ttl %d tos %x\n",
-			tiph->saddr, tiph->daddr,tiph->ttl,tiph->tos);
-
-	if (tiph->saddr == 0) {
-		nss_tun6rd_warning("Tunnel src address not configured %x\n",
-				tiph->saddr);
-		return NOTIFY_BAD;
-	}
-
-	if_number = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_TUN6RD);
-	if (-1 == if_number) {
-		nss_tun6rd_warning("Request interface number failed\n");
-		return NOTIFY_BAD;
-	}
-
-	/*
-	 * Register 6rd tunnel with NSS
-	 */
-	nss_ctx = nss_register_tun6rd_if(if_number,
-				nss_tun6rd_exception,
-				nss_tun6rd_event_receive,
-				netdev,
-				features);
-	if (!nss_ctx) {
-		status = nss_dynamic_interface_dealloc_node(if_number, NSS_DYNAMIC_INTERFACE_TYPE_TUN6RD);
-		if (status != NSS_TX_SUCCESS) {
-			nss_tun6rd_warning("Unable to dealloc the node[%d] in the NSS fw!\n", if_number);
-		}
-		nss_tun6rd_trace("nss_register_tun6rd_if failed \n");
-		return NOTIFY_BAD;
-	}
-
-	/*
-	 * Prepare The Tunnel configuration parameter to send to nss
-	 */
-	memset(&tun6rdmsg, 0, sizeof(struct nss_tun6rd_msg));
-	tun6rdcfg = &tun6rdmsg.msg.tunnel;
-	tun6rdcfg->prefixlen = ip6rd->prefixlen;
-	tun6rdcfg->relay_prefix = ip6rd->relay_prefix;
-	tun6rdcfg->relay_prefixlen = ip6rd->relay_prefixlen;
-	tun6rdcfg->saddr = ntohl(tiph->saddr);
-	tun6rdcfg->daddr = ntohl(tiph->daddr);
-	tun6rdcfg->prefix[0] = ntohl(ip6rd->prefix.s6_addr32[0]);
-	tun6rdcfg->prefix[1] = ntohl(ip6rd->prefix.s6_addr32[1]);
-	tun6rdcfg->prefix[2] = ntohl(ip6rd->prefix.s6_addr32[2]);
-	tun6rdcfg->prefix[3] = ntohl(ip6rd->prefix.s6_addr32[3]);
-	tun6rdcfg->ttl = tiph->ttl;
-	tun6rdcfg->tos = tiph->tos;
-
-	nss_tun6rd_trace(" 6rd Tunnel info\n");
-	nss_tun6rd_trace(" saddr %x daddr %d ttl %x  tos %x\n",
-			tiph->saddr, tiph->daddr, tiph->ttl, tiph->tos);
-	nss_tun6rd_trace(" Prefix %x:%x:%x:%x  Prefix len %d\n",
-			ip6rd->prefix.s6_addr32[0], ip6rd->prefix.s6_addr32[1],
-			ip6rd->prefix.s6_addr32[2], ip6rd->prefix.s6_addr32[3],
-			ip6rd->prefixlen);
-	nss_tun6rd_trace("Relay Prefix %x Len %d\n",
-			ip6rd->relay_prefix, ip6rd->relay_prefixlen);
-
-	nss_tun6rd_trace("Sending 6rd tunnel i/f up command to NSS %x\n",
-			(int)nss_ctx);
-
-	/*
-	 * Send 6rd Tunnel UP command to NSS
-	 */
-	nss_tun6rd_msg_init(&tun6rdmsg, if_number, NSS_TUN6RD_ATTACH_PNODE,
-			sizeof(struct nss_tun6rd_attach_tunnel_msg), NULL, NULL);
-
-	status = nss_tun6rd_tx(nss_ctx, &tun6rdmsg);
-	if (status != NSS_TX_SUCCESS) {
-		nss_unregister_tun6rd_if(if_number);
-		status = nss_dynamic_interface_dealloc_node(if_number, NSS_DYNAMIC_INTERFACE_TYPE_TUN6RD);
-		if (status != NSS_TX_SUCCESS) {
-			nss_tun6rd_warning("Unable to dealloc the node[%d] in the NSS fw!\n", if_number);
-		}
-		nss_tun6rd_warning("Tunnel up command error %d\n", status);
-		return NOTIFY_BAD;
-	}
-
-	return NOTIFY_DONE;
-}
-
-/*
- * nss_tun6rd_dev_down()
- *	6RD Tunnel device i/f down handler
- */
-static int nss_tun6rd_dev_down(struct net_device *netdev)
-{
-	struct ip_tunnel *tunnel;
-	struct ip_tunnel_6rd_parm *ip6rd;
-	int32_t if_number;
-	nss_tx_status_t status;
-
-	/*
-	 * Validate netdev for ipv6-in-ipv4  Tunnel
-	 */
-	if (netdev->type != ARPHRD_SIT) {
-		return NOTIFY_DONE;
-	}
-
-	/*
-	 * Check if tunnel 6rd is registered ?
-	 */
-	if_number = nss_cmn_get_interface_number_by_dev(netdev);
-	if (if_number < 0) {
-		nss_tun6rd_warning("Net device:%p is not registered \n",netdev);
-		return NOTIFY_BAD;
-	}
-
-
-	tunnel = (struct ip_tunnel *)netdev_priv(netdev);
-	ip6rd =  &tunnel->ip6rd;
-
-	/*
-	 * Valid 6rd Tunnel Check
-	 */
-	if ((ip6rd->prefixlen == 0 )
-			|| (ip6rd->relay_prefixlen > 32 )
-			|| (ip6rd->prefixlen
-				+ (32 - ip6rd->relay_prefixlen) > 64)) {
-
-		nss_tun6rd_warning("Invalid 6rd argument prefix len %d relayprefix len %d \n",
-				ip6rd->prefixlen,ip6rd->relay_prefixlen);
-		return NOTIFY_BAD;
-	}
-
-	/*
-	 * Un-Register 6rd tunnel with NSS
-	 */
-	nss_unregister_tun6rd_if(if_number);
-	status = nss_dynamic_interface_dealloc_node(if_number, NSS_DYNAMIC_INTERFACE_TYPE_TUN6RD);
-	if (status != NSS_TX_SUCCESS) {
-		nss_tun6rd_warning("Dealloc node failure\n");
-		return NOTIFY_BAD;
-	}
-
-	return NOTIFY_DONE;
-}
-
-
-/*
- * nss_tun6rd_dev_event()
- *	Net device notifier for 6rd module
- */
-static int nss_tun6rd_dev_event(struct notifier_block  *nb,
-		unsigned long event, void  *dev)
-{
-	struct net_device *netdev = (struct net_device *)dev;
-
-	switch (event) {
-	case NETDEV_UP:
-		nss_tun6rd_trace("NETDEV_UP: event %lu name %s\n", event, netdev->name);
-		return nss_tun6rd_dev_up(netdev);
-
-	case NETDEV_DOWN:
-		nss_tun6rd_trace("NETDEV_DOWN: event %lu name %s\n", event, netdev->name);
-		return nss_tun6rd_dev_down(netdev);
-
-	default:
-		nss_tun6rd_trace("Unhandled notifier event %lu name %s\n",event, netdev->name);
-		break;
-	}
-
-	return NOTIFY_DONE;
-}
-
-/*
- * Linux Net device Notifier
- */
-struct notifier_block nss_tun6rd_notifier = {
-	.notifier_call = nss_tun6rd_dev_event,
-};
-
-
-/*
- * nss_tun6rd_init_module()
- *	Tunnel 6rd module init function
- */
-int __init nss_tun6rd_init_module(void)
-{
-	nss_tun6rd_info("module (platform - IPQ806x , Build - %s:%s) loaded\n",
-			__DATE__, __TIME__);
-
-	register_netdevice_notifier(&nss_tun6rd_notifier);
-	nss_tun6rd_trace("Netdev Notifier registerd \n");
-
-	return 0;
-}
-
-/*
- * nss_tun6rd_exit_module()
- *	Tunnel 6rd module exit function
- */
-void __exit nss_tun6rd_exit_module(void)
-{
-	unregister_netdevice_notifier(&nss_tun6rd_notifier);
-	nss_tun6rd_info("module unloaded\n");
-}
-
-module_init(nss_tun6rd_init_module);
-module_exit(nss_tun6rd_exit_module);
-
-MODULE_LICENSE("Dual BSD/GPL");
-MODULE_DESCRIPTION("NSS tun6rd offload manager");
diff --git a/nss_connmgr_tunipip6.c b/nss_connmgr_tunipip6.c
deleted file mode 100644
index 072ef80..0000000
--- a/nss_connmgr_tunipip6.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_tunipip6.c
- *
- * This file is the NSS DS-lit and IPP6  tunnel module
- * ------------------------REVISION HISTORY-----------------------------
- * Qualcomm Atheros	    15/sep/2013		     Created
- */
-
-#include <linux/types.h>
-#include <linux/ip.h>
-#include <linux/tcp.h>
-#include <linux/module.h>
-#include <linux/skbuff.h>
-#include <net/ipv6.h>
-#include <net/ipip.h>
-#include <net/ip6_tunnel.h>
-#include <linux/if_arp.h>
-#include <nss_api_if.h>
-
-/*
- * NSS tunipip6 debug macros
- */
-#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 (NSS_TUNIPIP6_DEBUG_LEVEL < 2)
-#define nss_tunipip6_error(fmt, args...)
-#else
-#define nss_tunipip6_error(fmt, args...) printk(KERN_WARNING "nss tunipip6:"fmt, ##args)
-#endif
-
-#if (NSS_TUNIPIP6_DEBUG_LEVEL < 3)
-#define nss_tunipip6_warning(fmt, args...)
-#else
-#define nss_tunipip6_warning(fmt, args...) printk(KERN_WARNING "nss tunipip6:"fmt, ##args)
-#endif
-
-#if (NSS_TUNIPIP6_DEBUG_LEVEL < 4)
-#define nss_tunipip6_info(fmt, args...)
-#else
-#define nss_tunipip6_info(fmt, args...) printk(KERN_INFO "nss tunipip6 :"fmt, ##args)
-#endif
-
-#if (NSS_TUNIPIP6_DEBUG_LEVEL < 5)
-#define nss_tunipip6_trace(fmt, args...)
-#else
-#define nss_tunipip6_trace(fmt, args...) printk(KERN_DEBUG "nss tunipip6 :"fmt, ##args)
-#endif
-
-void nss_tunipip6_exception(struct net_device *netdev, struct sk_buff *skb, __attribute__((unused)) struct napi_struct *napi);
-void nss_tunipip6_event_receive(void *ctx, struct nss_tunipip6_msg *msg);
-
-/*
- * nss_tunipip6_tunnel
- *	DS-lite and ipip 6tunnel host instance
- */
-struct nss_tunipip6_tunnel{
-	struct nss_ctx_instance *nss_ctx;
-	uint32_t if_num;
-	struct net_device *netdev;
-	uint32_t device_up;
-	uint32_t features;  /* The skb types supported by this interface */
-};
-
-/*
- *  tunipip6 stats structure
- */
-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 */
-};
-
-struct nss_tunipip6_tunnel g_tunipip6;
-
-/*
- * Internal function
- */
-static int
-nss_tunipip6_dev_event(struct notifier_block  *nb,
-			unsigned long event,
-			void  *dev);
-
-/*
- * Linux Net device Notifier
- */
-struct notifier_block nss_tunipip6_notifier = {
-	.notifier_call = nss_tunipip6_dev_event,
-};
-
-/*
- * nss_tunipip6_dev_up()
- *	IPIP6 Tunnel device i/f up handler
- */
-void nss_tunipip6_dev_up( struct net_device * netdev)
-{
-	struct ip6_tnl *tunnel;
-	struct nss_tunipip6_msg tnlmsg;
-	struct nss_tunipip6_create_msg *tnlcfg;
-	struct flowi6 *fl6;
-	nss_tx_status_t status;
-
-	/*
-	 * Validate netdev for ipv6-in-ipv4  Tunnel
-	 */
-	if (netdev->type != ARPHRD_TUNNEL6 ) {
-		return;
-	}
-
-	tunnel = (struct ip6_tnl *)netdev_priv(netdev);
-
-	/*
-	 * Find he Tunnel device flow information
-	 */
-
-	fl6  = &tunnel->fl.u.ip6;
-
-	nss_tunipip6_trace(" Tunnel Param srcaddr %x:%x:%x:%x  daddr %x:%x:%x:%x \n",
-			fl6->saddr.s6_addr32[0], fl6->saddr.s6_addr32[1],
-			fl6->saddr.s6_addr32[2], fl6->saddr.s6_addr32[3],
-			fl6->daddr.s6_addr32[0], fl6->daddr.s6_addr32[1],
-			fl6->daddr.s6_addr32[2], fl6->daddr.s6_addr32[3] );
-	nss_tunipip6_trace(" hop limit %d \n", tunnel->parms.hop_limit);
-	nss_tunipip6_trace(" tunnel param flag %x  fl6.flowlabel %x  \n", tunnel->parms.flags, fl6->flowlabel);
-
-	/*
-	 * Register ipip6 tunnel with NSS
-	 */
-	g_tunipip6.nss_ctx = nss_register_tunipip6_if(g_tunipip6.if_num,
-				nss_tunipip6_exception,
-				nss_tunipip6_event_receive,
-				netdev,
-				g_tunipip6.features);
-	if (g_tunipip6.nss_ctx == NULL) {
-		nss_tunipip6_trace("nss_register_tunipip6_if Failed \n");
-		return;
-	} else {
-		nss_tunipip6_trace("nss_register_tunipip6_if Success \n");
-	}
-
-	/*
-	 *Prepare The Tunnel configuration parameter to send to nss
-	 */
-	memset(&tnlmsg, 0, sizeof(struct nss_tunipip6_msg));
-	tnlcfg = &tnlmsg.msg.tunipip6_create;
-
-	tnlcfg->saddr[0] = ntohl(fl6->saddr.s6_addr32[0]);
-	tnlcfg->saddr[1] = ntohl(fl6->saddr.s6_addr32[1]);
-	tnlcfg->saddr[2] = ntohl(fl6->saddr.s6_addr32[2]);
-	tnlcfg->saddr[3] = ntohl(fl6->saddr.s6_addr32[3]);
-	tnlcfg->daddr[0] = ntohl(fl6->daddr.s6_addr32[0]);
-	tnlcfg->daddr[1] = ntohl(fl6->daddr.s6_addr32[1]);
-	tnlcfg->daddr[2] = ntohl(fl6->daddr.s6_addr32[2]);
-	tnlcfg->daddr[3] = ntohl(fl6->daddr.s6_addr32[3]);
-	tnlcfg->hop_limit = tunnel->parms.hop_limit;
-	tnlcfg->flags = ntohl(tunnel->parms.flags);
-	tnlcfg->flowlabel = fl6->flowlabel;  /*flow Label In kernel is stored in big endian format*/
-	nss_tunipip6_trace(" Tunnel Param srcaddr %x:%x:%x:%x  daddr %x:%x:%x:%x \n",
-			tnlcfg->saddr[0], tnlcfg->saddr[1],
-			tnlcfg->saddr[2], tnlcfg->saddr[3],
-			tnlcfg->daddr[0], tnlcfg->daddr[1],
-			tnlcfg->daddr[2], tnlcfg->daddr[3] );
-
-
-	nss_tunipip6_trace("Sending IPIP6 tunnel i/f up command to NSS	%x \n",
-			(int)g_tunipip6.nss_ctx);
-
-	/*
-	 * Send IPIP6 Tunnel UP command to NSS
-	 */
-	nss_tunipip6_msg_init(&tnlmsg, NSS_TUNIPIP6_INTERFACE, NSS_TUNIPIP6_TX_IF_CREATE,
-			sizeof(struct nss_tunipip6_create_msg), NULL, NULL);
-
-	status = nss_tunipip6_tx(g_tunipip6.nss_ctx, &tnlmsg);
-	if (status != NSS_TX_SUCCESS) {
-		nss_tunipip6_error("Tunnel up command error %d \n", status);
-		return;
-	}
-
-	g_tunipip6.device_up = 1;
-}
-
-/*
- * nss_tunipip6_dev_down()
- *	IPP6 Tunnel device i/f down handler
- */
-void nss_tunipip6_dev_down( struct net_device * netdev)
-{
-	struct nss_tunipip6_msg tnlmsg;
-	struct nss_tunipip6_destroy_msg *tnlcfg;
-	nss_tx_status_t status;
-
-	/*
-	 * Check if tunnel ipip6 is registered ?
-	 */
-	if(g_tunipip6.nss_ctx == NULL){
-		return;
-	}
-
-	/*
-	 * Validate netdev for ipv6-in-ipv4  Tunnel
-	 */
-	if (netdev->type != ARPHRD_TUNNEL6) {
-		return;
-	}
-
-	/*
-	 * TODO: Strick check required if its the same tunnel
-	 * registerd with us
-	 */
-
-	memset(&tnlmsg, 0, sizeof(struct nss_tunipip6_msg));
-	tnlcfg = &tnlmsg.msg.tunipip6_destroy;
-
-	nss_tunipip6_trace("Sending Tunnel ipip6 Down command %x \n",g_tunipip6.if_num);
-
-	/*
-	 * Send IPIP6 Tunnel DOWN command to NSS
-	 */
-	nss_tunipip6_msg_init(&tnlmsg, NSS_TUNIPIP6_INTERFACE, NSS_TUNIPIP6_TX_IF_DESTROY,
-			sizeof(struct nss_tunipip6_destroy_msg), NULL, NULL);
-
-	status = nss_tunipip6_tx(g_tunipip6.nss_ctx, &tnlmsg);
-	if (status != NSS_TX_SUCCESS) {
-		nss_tunipip6_error("Tunnel down command error %d \n", status);
-		return;
-	}
-
-	/*
-	 * Un-Register IPIP6 tunnel with NSS
-	 */
-	nss_unregister_tunipip6_if(g_tunipip6.if_num);
-	g_tunipip6.nss_ctx = NULL;
-	g_tunipip6.device_up = 0;
-}
-
-/*
- * nss_tun6rd_dev_event()
- *	Net device notifier for ipip6 module
- */
-static int nss_tunipip6_dev_event(struct notifier_block  *nb,
-		unsigned long event, void  *dev)
-{
-	struct net_device *netdev = (struct net_device *)dev;
-
-	nss_tunipip6_trace("%s\n",__FUNCTION__);
-	switch (event) {
-	case NETDEV_UP:
-		nss_tunipip6_trace(" NETDEV_UP :event %lu name %s \n",
-				event,netdev->name);
-		nss_tunipip6_dev_up(netdev);
-		break;
-
-	case NETDEV_DOWN:
-		nss_tunipip6_trace(" NETDEV_DOWN :event %lu name %s \n",
-				event,netdev->name);
-		nss_tunipip6_dev_down(netdev);
-		break;
-
-	default:
-		nss_tunipip6_trace("Unhandled notifier dev %s  event %x  \n",
-				netdev->name,(int)event);
-		break;
-	}
-
-	return NOTIFY_DONE;
-}
-
-/*
- * nss_tunipip6_exception()
- *	Exception handler registered to NSS driver
- */
-void nss_tunipip6_exception(struct net_device *dev, struct sk_buff *skb, __attribute__((unused)) struct napi_struct *napi)
-{
-	const struct iphdr *iph;
-
-	skb->dev = dev;
-	nss_tunipip6_info("received - %d bytes name %s ver %x \n",
-			skb->len,dev->name,skb->data[0]);
-
-	iph = (const struct iphdr *)skb->data;
-
-	/*
-	 *Packet after Decap/Encap Did not find the Rule.
-	 */
-	if (iph->version == 4) {
-		skb->protocol = htons(ETH_P_IP);
-	} else {
-		skb->protocol = htons(ETH_P_IPV6);
-	}
-
-	skb_reset_network_header(skb);
-	skb->pkt_type = PACKET_HOST;
-	skb->skb_iif = dev->ifindex;
-	skb->ip_summed = CHECKSUM_NONE;
-	netif_receive_skb(skb);
-}
-
-/*
- *  nss_tunipip6_update_dev_stats
- *	Update the Dev stats received from NetAp
- */
-static void nss_tunipip6_update_dev_stats(struct net_device *dev,
-					struct nss_tunipip6_stats_sync_msg *sync_stats)
-{
-	void *ptr;
-	struct nss_tunipip6_stats stats;
-
-	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;
-
-	ptr = (void *)&stats;
-	ip6_update_offload_stats(dev, ptr);
-
-}
-
-/**
- * @brief Event Callback to receive events from NSS
- * @param[in] pointer to net device context
- * @param[in] event type
- * @param[in] pointer to buffer
- * @param[in] length of buffer
- * @return Returns void
- */
-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 );
-		break;
-
-	default:
-		nss_tunipip6_info("%s: Unknown Event from NSS",
-			      __FUNCTION__);
-		break;
-	}
-}
-
-/*
- * nss_tunipip6_init_module()
- *	Tunnel ipip6 module init function
- */
-int __init nss_tunipip6_init_module(void)
-{
-	nss_tunipip6_info("module (platform - IPQ806x , Build - %s:%s) loaded\n",
-			__DATE__, __TIME__);
-
-	register_netdevice_notifier(&nss_tunipip6_notifier);
-	nss_tunipip6_trace("Netdev Notifier registerd \n");
-
-	g_tunipip6.if_num = NSS_TUNIPIP6_INTERFACE;
-	g_tunipip6.netdev = NULL;
-	g_tunipip6.device_up = 0;
-	g_tunipip6.nss_ctx = NULL;
-	g_tunipip6.features = 0;
-
-	return 0;
-}
-
-/*
- * nss_tunipip6_exit_module()
- *	Tunnel ipip6 module exit function
- */
-void __exit nss_tunipip6_exit_module(void)
-{
-
-	unregister_netdevice_notifier(&nss_tunipip6_notifier);
-	nss_tunipip6_info("module unloaded\n");
-}
-
-module_init(nss_tunipip6_init_module);
-module_exit(nss_tunipip6_exit_module);
-
-MODULE_LICENSE("Dual BSD/GPL");
-MODULE_DESCRIPTION("NSS tunipip6 offload manager");
diff --git a/nss_core.c b/nss_core.c
index a0aebaa..bafdcc4 100755
--- a/nss_core.c
+++ b/nss_core.c
@@ -49,6 +49,11 @@
 
 static struct nss_rx_cb_list nss_rx_interface_handlers[NSS_MAX_NET_INTERFACES];
 
+#ifdef CONFIG_DEBUG_KMEMLEAK
+struct sk_buff_head nss_skb_list;
+#endif
+
+
 /*
  * nss_core_set_jumbo_mru()
  *	Set the jumbo_mru to the specified value
@@ -301,6 +306,18 @@
 	nss_phys_if_rx_callback_t cb;
 	struct nss_subsystem_dataplane_register *subsys_dp_reg = &nss_top->subsys_dp_register[interface_num];
 
+
+#ifdef CONFIG_DEBUG_KMEMLEAK
+	/*
+	 * Tracking for kmemleak: Remove the skb from the nss_skb_list
+	 */
+	spin_lock_bh(&nss_skb_list.lock);
+	__skb_unlink(nbuf, &nss_skb_list);
+	spin_unlock_bh(&nss_skb_list.lock);
+#endif
+
+	NSS_PKT_STATS_DECREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NSS_SKB_COUNT]);
+
 	switch (buffer_type) {
 	case N2H_BUFFER_SHAPER_BOUNCED_INTERFACE:
 		{
@@ -685,7 +702,7 @@
  * nss_core_handle_linear_skb()
  *	Handler for processing linear skbs.
  */
-static inline bool nss_core_handle_linear_skb(struct sk_buff **nbuf_ptr, struct sk_buff **head_ptr,
+static inline bool nss_core_handle_linear_skb(struct nss_ctx_instance *nss_ctx, struct sk_buff **nbuf_ptr, struct sk_buff **head_ptr,
 						struct sk_buff **tail_ptr, struct n2h_descriptor *desc)
 {
 	uint16_t bit_flags = desc->bit_flags;
@@ -720,6 +737,7 @@
 		 * NSS should playaround with data area and should not
 		 * touch HEADROOM area
 		 */
+		NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_RX_SIMPLE]);
 		return true;
 	}
 
@@ -815,7 +833,7 @@
 	*nbuf_ptr = head;
 	*head_ptr = NULL;
 	*tail_ptr = NULL;
-
+	NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_RX_SKB_FRAGLIST]);
 	return true;
 }
 
@@ -878,9 +896,7 @@
 		opaque = desc->opaque;
 		bit_flags = desc->bit_flags;
 		if (unlikely((buffer_type == N2H_BUFFER_CRYPTO_RESP))) {
-			NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_top->stats_drv[NSS_STATS_DRV_RX_CRYPTO_RESP]);
-
-
+			NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_RX_CRYPTO_RESP]);
 			/*
 			 * This is a crypto buffer hence send it to crypto driver
 			 *
@@ -901,6 +917,7 @@
 			 * Invalid opaque pointer
 			 */
 			nss_dump_desc(nss_ctx, desc);
+			NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_RX_BAD_DESCRIPTOR]);
 			goto next;
 		}
 
@@ -949,6 +966,17 @@
 			if (unlikely(head)) {
 				nss_warning("%p: we should not have an incomplete paged skb while"
 								" constructing a linear skb %p", nbuf, head);
+
+#ifdef CONFIG_DEBUG_KMEMLEAK
+				/*
+				 * Tracking for kmemleak: Remove the skb from the nss_skb_list
+				 */
+				spin_lock_bh(&nss_skb_list.lock);
+				__skb_unlink(head, &nss_skb_list);
+				spin_unlock_bh(&nss_skb_list.lock);
+#endif
+
+				NSS_PKT_STATS_DECREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NSS_SKB_COUNT]);
 				dev_kfree_skb_any(head);
 				head = NULL;
 				goto next;
@@ -957,7 +985,7 @@
 			if (!nss_core_handle_nr_frag_skb(&nbuf, &jumbo_start, desc, buffer_type)) {
 				goto next;
 			}
-
+			NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_RX_NR_FRAGS]);
 			goto consume;
 		}
 
@@ -968,6 +996,17 @@
 		if (unlikely(jumbo_start)) {
 			nss_warning("%p: we should not have an incomplete linear skb while"
 							" constructing a paged skb %p", nbuf, jumbo_start);
+
+#ifdef CONFIG_DEBUG_KMEMLEAK
+			/*
+			 * Tracking for kmemleak: Remove the skb from the nss_skb_list
+			 */
+			spin_lock_bh(&nss_skb_list.lock);
+			__skb_unlink(jumbo_start, &nss_skb_list);
+			spin_unlock_bh(&nss_skb_list.lock);
+#endif
+
+			NSS_PKT_STATS_DECREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NSS_SKB_COUNT]);
 			dev_kfree_skb_any(jumbo_start);
 			jumbo_start = NULL;
 			goto next;
@@ -977,7 +1016,7 @@
 		 * This is a simple linear skb. Use the the linear skb
 		 * handler to process it.
 		 */
-		if (!nss_core_handle_linear_skb(&nbuf, &head, &tail, desc)) {
+		if (!nss_core_handle_linear_skb(nss_ctx, &nbuf, &head, &tail, desc)) {
 			goto next;
 		}
 
@@ -1241,6 +1280,16 @@
 				break;
 			}
 
+#ifdef CONFIG_DEBUG_KMEMLEAK
+			/*
+			 * Tracking for kmemleak because skbs dont have references.
+			 */
+			spin_lock_bh(&nss_skb_list.lock);
+			__skb_queue_head(&nss_skb_list, nbuf);
+			spin_unlock_bh(&nss_skb_list.lock);
+#endif
+
+			NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NSS_SKB_COUNT]);
 			desc->opaque = (uint32_t)nbuf;
 			desc->buffer = buffer;
 			desc->buffer_type = H2N_BUFFER_EMPTY;
@@ -1537,6 +1586,7 @@
 		(uint32_t)nbuf, (uint16_t)(nbuf->data - nbuf->head), nbuf->len,
 		(uint16_t)(nbuf->end - nbuf->head), (uint32_t)nbuf->priority, mss, bit_flags);
 
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,0))
 	if (unlikely(!NSS_IS_IF_TYPE(VIRTUAL, if_num))) {
 		if (likely(nbuf->destructor == NULL)) {
 			if (likely(skb_recycle_check(nbuf, nss_ctx->max_buf_size))) {
@@ -1546,10 +1596,13 @@
 			}
 		}
 	}
-
+#endif
+	NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_TX_SIMPLE]);
 	return 1;
 }
 
+//Note to Thomas:  Linux has support for atomic_inc() on a 64 bit value.  Hint, use iot
+
 /*
  * nss_core_send_buffer_nr_frags()
  *	Sends frags array (NETIF_F_SG) to NSS FW
@@ -1619,7 +1672,7 @@
 	desc->bit_flags |= H2N_BIT_FLAG_LAST_SEGMENT;
 	desc->bit_flags &= ~(H2N_BIT_FLAG_DISCARD);
 	desc->opaque = (uint32_t)nbuf;
-
+	NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_TX_NR_FRAGS]);
 	return i+1;
 }
 
@@ -1700,7 +1753,7 @@
 	desc->bit_flags |= H2N_BIT_FLAG_LAST_SEGMENT;
 	desc->bit_flags &= ~(H2N_BIT_FLAG_DISCARD);
 	desc->opaque = (uint32_t)nbuf;
-
+	NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_TX_FRAGLIST]);
 	return i+1;
 }
 
@@ -1889,6 +1942,16 @@
 	h2n_desc_ring->hlos_index = hlos_index;
 	if_map->h2n_hlos_index[qid] = hlos_index;
 
+#ifdef CONFIG_DEBUG_KMEMLEAK
+	/*
+	 * Tracking for kmemleak because skbs dont have references.
+	 */
+	spin_lock_bh(&nss_skb_list.lock);
+	__skb_queue_head(&nss_skb_list, nbuf);
+	spin_unlock_bh(&nss_skb_list.lock);
+#endif
+
+	NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NSS_SKB_COUNT]);
 	spin_unlock_bh(&h2n_desc_ring->lock);
 	return NSS_CORE_STATUS_SUCCESS;
 }
diff --git a/nss_core.h b/nss_core.h
index fe2ab82..d088084 100755
--- a/nss_core.h
+++ b/nss_core.h
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -23,6 +23,7 @@
 #define __NSS_CORE_H
 
 #include <linux/kernel.h>
+#include <linux/version.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/spinlock.h>
@@ -87,6 +88,7 @@
 
 #if (NSS_PKT_STATS_ENABLED == 1)
 #define NSS_PKT_STATS_INCREMENT(nss_ctx, x) nss_pkt_stats_increment((nss_ctx), (x))
+#define NSS_PKT_STATS_DECREMENT(nss_ctx, x) nss_pkt_stats_decrement((nss_ctx), (x))
 #else
 #define NSS_PKT_STATS_INCREMENT(nss_ctx, x)
 #endif
@@ -182,6 +184,20 @@
 #define NSS_FREQ_733_MIN	0x10000		/* Instructions Per ms Min */
 #define NSS_FREQ_733_MAX	0x50000		/* Instructions Per ms Max */
 
+#if (NSS_DT_SUPPORT == 1)
+#define NSSTCM_FREQ		400000000	/* NSS TCM Frequency in Hz */
+
+/* NSS Clock names */
+#define NSS_TCM_SRC_CLK		"nss_tcm_src"
+#define NSS_TCM_CLK		"nss_tcm_clk"
+
+/* NSS core reset/clamp names */
+#define NSS_CORE_CLK_RST_CLAMP	"clkrst_clamp"
+#define NSS_CORE_CLAMP		"clamp"
+#define NSS_CORE_AHB_RESET	"ahb"
+#define NSS_CORE_AXI_RESET	"axi"
+#endif
+
 /*
  * IPV4 node statistics
  *
@@ -280,18 +296,26 @@
  */
 enum nss_stats_drv {
 	NSS_STATS_DRV_NBUF_ALLOC_FAILS = 0,	/* NBUF allocation errors */
-	NSS_STATS_DRV_TX_QUEUE_FULL_0,	/* Tx queue full for Core 0*/
-	NSS_STATS_DRV_TX_QUEUE_FULL_1,	/* Tx queue full for Core 1*/
-	NSS_STATS_DRV_TX_EMPTY,		/* H2N Empty buffers */
-	NSS_STATS_DRV_TX_PACKET,	/* H2N Data packets */
-	NSS_STATS_DRV_TX_CMD_REQ,	/* H2N Control packets */
-	NSS_STATS_DRV_TX_CRYPTO_REQ,	/* H2N Crypto requests */
-	NSS_STATS_DRV_RX_EMPTY,		/* N2H Empty buffers */
-	NSS_STATS_DRV_RX_PACKET,	/* N2H Data packets */
-	NSS_STATS_DRV_RX_CMD_RESP,	/* N2H Command responses */
-	NSS_STATS_DRV_RX_STATUS,	/* N2H Status packets */
-	NSS_STATS_DRV_RX_CRYPTO_RESP,	/* N2H Crypto responses */
-	NSS_STATS_DRV_RX_VIRTUAL,	/* N2H Virtual packets */
+	NSS_STATS_DRV_TX_QUEUE_FULL_0,		/* Tx queue full for Core 0*/
+	NSS_STATS_DRV_TX_QUEUE_FULL_1,		/* Tx queue full for Core 1*/
+	NSS_STATS_DRV_TX_EMPTY,			/* H2N Empty buffers */
+	NSS_STATS_DRV_TX_PACKET,		/* H2N Data packets */
+	NSS_STATS_DRV_TX_CMD_REQ,		/* H2N Control packets */
+	NSS_STATS_DRV_TX_CRYPTO_REQ,		/* H2N Crypto requests */
+	NSS_STATS_DRV_RX_EMPTY,			/* N2H Empty buffers */
+	NSS_STATS_DRV_RX_PACKET,		/* N2H Data packets */
+	NSS_STATS_DRV_RX_CMD_RESP,		/* N2H Command responses */
+	NSS_STATS_DRV_RX_STATUS,		/* N2H Status packets */
+	NSS_STATS_DRV_RX_CRYPTO_RESP,		/* N2H Crypto responses */
+	NSS_STATS_DRV_RX_VIRTUAL,		/* N2H Virtual packets */
+	NSS_STATS_DRV_TX_SIMPLE,		/* H2N Simple SKB Packets */
+	NSS_STATS_DRV_TX_NR_FRAGS,		/* H2N NR Frags SKB Packets */
+	NSS_STATS_DRV_TX_FRAGLIST,		/* H2N Fraglist SKB Packets */
+	NSS_STATS_DRV_RX_SIMPLE,		/* N2H Simple SKB Packets */
+	NSS_STATS_DRV_RX_NR_FRAGS,		/* N2H NR Frags SKB Packets */
+	NSS_STATS_DRV_RX_SKB_FRAGLIST,		/* N2H Fraglist SKB Packets */
+	NSS_STATS_DRV_RX_BAD_DESCRIPTOR,	/* N2H Bad descriptor reads */
+	NSS_STATS_DRV_NSS_SKB_COUNT,
 	NSS_STATS_DRV_MAX,
 };
 
@@ -386,6 +410,17 @@
 
 	NSS_STATS_N2H_PAYLOAD_ALLOC_FAILS,
 					/* Number of pbuf allocations that have failed because there were no free payloads */
+
+	NSS_STATS_N2H_H2N_CONTROL_PACKETS,	/* Control packets received from HLOS */
+	NSS_STATS_N2H_H2N_CONTROL_BYTES,	/* Control bytes received from HLOS */
+	NSS_STATS_N2H_N2H_CONTROL_PACKETS,	/* Control packets sent to HLOS */
+	NSS_STATS_N2H_N2H_CONTROL_BYTES,	/* Control bytes sent to HLOS */
+
+	NSS_STATS_N2H_H2N_DATA_PACKETS,		/* Data packets received from HLOS */
+	NSS_STATS_N2H_H2N_DATA_BYTES,		/* Data bytes received from HLOS */
+	NSS_STATS_N2H_N2H_DATA_PACKETS,		/* Data packets sent to HLOS */
+	NSS_STATS_N2H_N2H_DATA_BYTES,		/* Data bytes sent to HLOS */
+
 	NSS_STATS_N2H_MAX,
 };
 
@@ -604,7 +639,7 @@
 	struct nss_shaper_bounce_registrant bounce_bridge_registrants[NSS_MAX_NET_INTERFACES];
 					/* Registrants for bridge shaper bounce operations */
 	nss_lag_event_callback_t lag_event_callback;
-
+					/* Registrants for lag operations */
 	uint32_t dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_MAX];
 
 	/*
@@ -648,6 +683,11 @@
 					/* IPv6 protocol exception events per interface */
 	uint64_t stats_if_exception_pppoe[NSS_MAX_PHYSICAL_INTERFACES][NSS_PPPOE_NUM_SESSION_PER_INTERFACE][NSS_PPPOE_EXCEPTION_EVENT_MAX];
 					/* PPPoE exception events for per session on per interface */
+#if (NSS_DT_SUPPORT == 1)
+	void *nss_fpb_base;			/* Virtual address of FPB base */
+	bool nss_hal_common_init_done;
+#endif
+
 	/*
 	 * TODO: Review and update following fields
 	 */
@@ -664,6 +704,17 @@
 	*stat = *stat + 1;
 	spin_unlock_bh(&nss_ctx->nss_top->stats_lock);
 }
+
+/*
+ * nss_pkt_stats_increment()
+ */
+static inline void nss_pkt_stats_decrement(struct nss_ctx_instance *nss_ctx, uint64_t *stat)
+{
+	spin_lock_bh(&nss_ctx->nss_top->stats_lock);
+	*stat = *stat - 1;
+	spin_unlock_bh(&nss_ctx->nss_top->stats_lock);
+}
+
 #endif
 
 /*
@@ -723,6 +774,46 @@
 	uint32_t initialized;					/* Flag to check for adequate initial samples */
 };
 
+
+#if (NSS_DT_SUPPORT == 1)
+/*
+ * nss_feature_enabled
+ */
+enum nss_feature_enabled {
+	NSS_FEATURE_NOT_ENABLED = 0,    /* Feature is not enabled on this core */
+	NSS_FEATURE_ENABLED,            /* Feature is enabled on this core */
+};
+
+/*
+ * nss_platform_data
+ *      Platform data per core
+ */
+struct nss_platform_data {
+	uint32_t id;		/* NSS core ID */
+	uint32_t num_irq;       /* No. of interrupts supported per core */
+	uint32_t irq[2];        /* IRQ numbers per interrupt */
+	uint32_t nmap;          /* Virtual address of NSS CSM space */
+	uint32_t vmap;          /* Virtual address of NSS virtual register map */
+	uint32_t nphys;         /* Physical address of NSS CSM space */
+	uint32_t vphys;         /* Physical address of NSS virtual register map */
+	uint32_t rst_addr;      /* Reset address of NSS core */
+	uint32_t load_addr;     /* Load address of NSS firmware */
+	enum nss_feature_enabled turbo_frequency;	/* Does this core support turbo frequencies */
+	enum nss_feature_enabled ipv4_enabled;		/* Does this core handle IPv4? */
+	enum nss_feature_enabled ipv4_reasm_enabled;    /* Does this core handle IPv4? */
+	enum nss_feature_enabled ipv6_enabled;		/* Does this core handle IPv6? */
+	enum nss_feature_enabled l2switch_enabled;	/* Does this core handle L2 switch? */
+	enum nss_feature_enabled crypto_enabled;	/* Does this core handle crypto? */
+	enum nss_feature_enabled ipsec_enabled;		/* Does this core handle IPsec? */
+	enum nss_feature_enabled wlan_enabled;		/* Does this core handle WLAN 11ac? */
+	enum nss_feature_enabled tun6rd_enabled;	/* Does this core handle 6rd Tunnel ? */
+	enum nss_feature_enabled tunipip6_enabled;	/* Does this core handle ipip6 Tunnel ? */
+	enum nss_feature_enabled gre_redir_enabled;     /* Does this core handle gre_redir Tunnel ? */
+	enum nss_feature_enabled shaping_enabled;	/* Does this core handle shaping ? */
+	enum nss_feature_enabled gmac_enabled[4];	/* Does this core handle GMACs? */
+};
+#endif
+
 /*
  * nss_core_log_msg_failures()
  *	Driver function for logging failed messages.
@@ -766,6 +857,12 @@
 extern uint32_t nss_core_register_handler(uint32_t interface, nss_core_rx_callback_t cb, void *app_data);
 extern uint32_t nss_core_unregister_handler(uint32_t interface);
 
+static inline uint32_t nss_core_get_max_buf_size(struct nss_ctx_instance *nss_ctx)
+{
+	return nss_ctx->max_buf_size;
+}
+
+
 /*
  * APIs provided by nss_tx_rx.c
  */
diff --git a/nss_data_plane.c b/nss_data_plane.c
index 093385a..52e39d4 100644
--- a/nss_data_plane.c
+++ b/nss_data_plane.c
@@ -26,7 +26,7 @@
  * nss_data_plane_open()
  *	Called by gmac to notify open to nss-fw
  */
-static nss_gmac_status_t nss_data_plane_open(void *arg, uint32_t tx_desc_ring, uint32_t rx_desc_ring, uint32_t mode)
+static int nss_data_plane_open(void *arg, uint32_t tx_desc_ring, uint32_t rx_desc_ring, uint32_t mode)
 {
 	struct nss_data_plane_param *dp = (struct nss_data_plane_param *)arg;
 
@@ -44,7 +44,7 @@
  * nss_data_plane_close()
  *	Called by gmac to notify close to nss-fw
  */
-static nss_gmac_status_t nss_data_plane_close(void *arg)
+static int nss_data_plane_close(void *arg)
 {
 	/*
 	 * We don't actually do synopsys gmac close in fw, just return success
@@ -56,7 +56,7 @@
  * nss_data_plane_link_state()
  *	Called by gmac to notify link state change to nss-fw
  */
-static nss_gmac_status_t nss_data_plane_link_state(void *arg, uint32_t link_state)
+static int nss_data_plane_link_state(void *arg, uint32_t link_state)
 {
 	struct nss_data_plane_param *dp = (struct nss_data_plane_param *)arg;
 
@@ -67,7 +67,7 @@
  * nss_data_plane_mac_addr()
  *	Called by gmac to set mac address
  */
-static nss_gmac_status_t nss_data_plane_mac_addr(void *arg, uint8_t *addr)
+static int nss_data_plane_mac_addr(void *arg, uint8_t *addr)
 {
 	struct nss_data_plane_param *dp = (struct nss_data_plane_param *)arg;
 
@@ -78,7 +78,7 @@
  * nss_data_plane_change_mtu()
  *	Called by gmac to change mtu of a gmac
  */
-static nss_gmac_status_t nss_data_plane_change_mtu(void *arg, uint32_t mtu)
+static int nss_data_plane_change_mtu(void *arg, uint32_t mtu)
 {
 	struct nss_data_plane_param *dp = (struct nss_data_plane_param *)arg;
 
@@ -89,7 +89,7 @@
  * nss_data_plane_buf()
  *	Called by gmac to pass a sk_buff for xmit
  */
-static nss_gmac_status_t nss_data_plane_buf(void *arg, struct sk_buff *os_buf)
+static int nss_data_plane_buf(void *arg, struct sk_buff *os_buf)
 {
 	struct nss_data_plane_param *dp = (struct nss_data_plane_param *)arg;
 
diff --git a/nss_hal/include/nss_hal.h b/nss_hal/include/nss_hal.h
index 50b4495..3d84d0e 100644
--- a/nss_hal/include/nss_hal.h
+++ b/nss_hal/include/nss_hal.h
@@ -22,8 +22,11 @@
 #ifndef __NSS_HAL_H
 #define __NSS_HAL_H
 
+#include <linux/platform_device.h>
+
 #include <nss_hal_pvt.h>
 
+#if (NSS_DT_SUPPORT != 1)
 /*
  * nss_hal_common_reset()
  */
@@ -31,14 +34,22 @@
 {
 	__nss_hal_common_reset(clk_src);
 }
+#endif
 
 /*
  * nss_hal_core_reset()
  */
+#if (NSS_DT_SUPPORT != 1)
 static inline void nss_hal_core_reset(uint32_t core_id, uint32_t map, uint32_t addr, uint32_t clk_src)
 {
 	__nss_hal_core_reset(core_id, map, addr, clk_src);
 }
+#else
+static inline void nss_hal_core_reset(uint32_t map_base, uint32_t reset_addr)
+{
+	__nss_hal_core_reset(map_base, reset_addr);
+}
+#endif
 
 /*
  * nss_hal_read_interrupt_cause()
diff --git a/nss_hal/ipq806x/nss_clocks.h b/nss_hal/ipq806x/nss_clocks.h
index ada706d..1e7af1a 100644
--- a/nss_hal/ipq806x/nss_clocks.h
+++ b/nss_hal/ipq806x/nss_clocks.h
@@ -20,6 +20,7 @@
 #ifndef __NSS_CLOCKS_H
 #define __NSS_CLOCKS_H
 
+#if (NSS_DT_SUPPORT != 1)
 #include <asm/io.h>
 #include <mach/msm_iomap.h>
 
@@ -126,4 +127,5 @@
 	PLL_LOCKED
 };
 
+#endif
 #endif /* __NSS_CLOCKS_H */
diff --git a/nss_hal/ipq806x/nss_hal_pvt.c b/nss_hal/ipq806x/nss_hal_pvt.c
index e78c22a..e721ce3 100644
--- a/nss_hal/ipq806x/nss_hal_pvt.c
+++ b/nss_hal/ipq806x/nss_hal_pvt.c
@@ -22,7 +22,12 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/gpio.h>
+#include <linux/version.h>
+
+#if (NSS_DT_SUPPORT != 1)
 #include <mach/gpiomux.h>
+#endif
+
 #include "nss_hal_pvt.h"
 #include "nss_clocks.h"
 #include "nss_core.h"
@@ -30,7 +35,9 @@
 /*
  * Global declarations
  */
+extern struct nss_top_instance nss_top_main;
 
+#if (NSS_FW_DBG_SUPPORT == 1)
 /*
  * NSS debug pins configuration
  */
@@ -148,6 +155,7 @@
 		},
 	},
 };
+#endif /* NSS_FW_DBG_SUPPORT */
 
 /*
  * clk_reg_write_32()
@@ -173,10 +181,13 @@
  */
 void __nss_hal_debug_enable(void)
 {
+#if (NSS_FW_DBG_SUPPORT == 1)
 	msm_gpiomux_install(nss_spi_gpiomux,
 				ARRAY_SIZE(nss_spi_gpiomux));
+#endif
 }
 
+#if (NSS_DT_SUPPORT != 1)
 /*
  * nss_hal_pvt_pll_change
  *	Change the Pll between 11(400mhz) or 18(1066 or 1466)
@@ -631,12 +642,18 @@
 
 	return;
 }
+#endif /* NSS_DT_SUPPORT */
 
 /*
  * __nss_hal_core_reset
  */
+#if (NSS_DT_SUPPORT == 1)
+void __nss_hal_core_reset(uint32_t map, uint32_t addr)
+#else
 void __nss_hal_core_reset(uint32_t core_id, uint32_t map, uint32_t addr, uint32_t clk_src)
+#endif
 {
+#if (NSS_DT_SUPPORT != 1)
 #if defined(NSS_ENABLE_CLOCK)
 	/*
 	 * Enable mpt clock
@@ -715,6 +732,7 @@
 	clk_reg_write_32(UBI32_COREn_RESET_CLAMP(core_id), 0x0);
 
 	mdelay(1);
+#endif /* NSS_DT_SUPPORT */
 
 	/*
 	* Apply ubi32 core reset
diff --git a/nss_hal/ipq806x/nss_hal_pvt.h b/nss_hal/ipq806x/nss_hal_pvt.h
index 16f86b4..53c90c4 100755
--- a/nss_hal/ipq806x/nss_hal_pvt.h
+++ b/nss_hal/ipq806x/nss_hal_pvt.h
@@ -24,6 +24,7 @@
 
 #include "nss_regs.h"
 #include <linux/types.h>
+#include <linux/platform_device.h>
 
 #define NSS_HAL_SUPPORTED_INTERRUPTS (NSS_REGS_N2H_INTR_STATUS_DATA_COMMAND_QUEUE | \
 					NSS_REGS_N2H_INTR_STATUS_EMPTY_BUFFER_QUEUE|  \
@@ -71,12 +72,15 @@
 	nss_write_32(map, NSS_REGS_C2C_INTR_SET_OFFSET, cause);
 }
 
+#if (NSS_DT_SUPPORT == 1)
+extern void __nss_hal_core_reset(uint32_t map, uint32_t reset);
+#else
 extern void __nss_hal_core_reset(uint32_t core_id, uint32_t map, uint32_t addr, uint32_t clk_src);
 extern void __nss_hal_common_reset(uint32_t *clk_src);
-extern void __nss_hal_debug_enable(void);
 extern uint32_t nss_hal_pvt_divide_pll18(uint32_t core_id, uint32_t divider);
 extern void nss_hal_pvt_pll_change(uint32_t pll);
 extern uint32_t nss_hal_pvt_enable_pll18(uint32_t speed);
 extern void nss_hal_pvt_register_dump(void);
-
+#endif
+extern void __nss_hal_debug_enable(void);
 #endif /* __NSS_HAL_PVT_H */
diff --git a/nss_hal/ipq806x/nss_regs.h b/nss_hal/ipq806x/nss_regs.h
index 0dc85d3..055072b 100755
--- a/nss_hal/ipq806x/nss_regs.h
+++ b/nss_hal/ipq806x/nss_regs.h
@@ -86,7 +86,7 @@
  */
 static inline uint32_t nss_read_32(uint32_t addr, uint32_t offs)
 {
-	return readl((addr + offs));
+	return readl((void *)(addr + offs));
 }
 
 /*
@@ -95,7 +95,7 @@
  */
 static inline void nss_write_32(uint32_t addr, uint32_t offs, uint32_t val)
 {
-	writel(val, (addr + offs));
+	writel(val, (void *)(addr + offs));
 }
 
 #endif /* __NSS_REGS_H */
diff --git a/nss_hlos_if.h b/nss_hlos_if.h
index 9ab0c58..cdd6120 100755
--- a/nss_hlos_if.h
+++ b/nss_hlos_if.h
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -28,15 +28,9 @@
 #define NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6	8196		/**< MAX Connection shared between IPv4 and IPv6 */
 #define NSS_CONN_CFG_TIMEOUT			6000		/**< 6 sec timeout for connection cfg message */
 
-/*
- * Variables used for sysctl updates.
- */
-extern int nss_ipv4_conn_cfg;
-extern int nss_ipv6_conn_cfg;
-
 enum {
-	SUCCESS = 0,
-	FAILURE = 1,
+	NSS_SUCCESS = 0,
+	NSS_FAILURE = 1,
 };
 
 /*
@@ -49,7 +43,6 @@
 	int response;				/* Response from FW */
 };
 
-
 /*
  * Request/Response types
  */
@@ -143,56 +136,6 @@
  */
 
 /*
- * Request/Response types
- */
-enum nss_n2h_metadata_types {
-	NSS_RX_METADATA_TYPE_N2H_STATS_SYNC=0,
-	NSS_TX_METADATA_TYPE_N2H_RPS_CFG,
-	NSS_METADATA_TYPE_N2H_MAX,
-};
-
-struct nss_n2h_rps {
-	uint32_t enable; /* Enable NSS RPS */
-};
-
-/*
- * NSS Pbuf mgr stats
- */
-struct nss_n2h_pbuf_mgr_stats {
-	uint32_t pbuf_alloc_fails;		/* Pbuf ocm alloc fail */
-	uint32_t pbuf_free_count;		/* Pbuf ocm free count */
-	uint32_t pbuf_total_count;		/* Pbuf ocm total count */
-};
-
-/*
- * The NSS N2H statistics sync structure.
- */
-struct nss_n2h_stats_sync {
-	struct nss_cmn_node_stats node_stats;
-					/* Common node stats for N2H */
-	uint32_t queue_dropped;		/* Number of packets dropped because the PE queue is too full */
-	uint32_t total_ticks;		/* Total clock ticks spend inside the PE */
-	uint32_t worst_case_ticks;	/* Worst case iteration of the PE in ticks */
-	uint32_t iterations;		/* Number of iterations around the PE */
-
-	struct nss_n2h_pbuf_mgr_stats pbuf_ocm_stats; 		/* Pbuf OCM Stats */
-	struct nss_n2h_pbuf_mgr_stats pbuf_default_stats; 	/* Pbuf Default Stats */
-
-	uint32_t payload_alloc_fails;
-};
-
-/*
- * Message structure to send/receive phys i/f commands
- */
-struct nss_n2h_msg {
-	struct nss_cmn_msg cm;			/* Message Header */
-	union {
-		struct nss_n2h_stats_sync stats_sync;	/* Message: N2H stats sync */
-		struct nss_n2h_rps rps_cfg; 		/* Message: RPS configuration */
-	} msg;
-};
-
-/*
  * IPv4 reasm node stats
  */
 struct nss_ipv4_reasm_stats_sync {
diff --git a/nss_init.c b/nss_init.c
index 6777274..f9ca687 100755
--- a/nss_init.c
+++ b/nss_init.c
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -20,7 +20,9 @@
  *
  */
 #include "nss_core.h"
+#if (NSS_PM_SUPPORT == 1)
 #include "nss_pm.h"
+#endif
 #include "nss_tx_rx_common.h"
 #include "nss_data_plane.h"
 
@@ -31,7 +33,16 @@
 #include <linux/platform_device.h>
 #include <linux/proc_fs.h>
 #include <linux/device.h>
+
+#if (NSS_DT_SUPPORT == 1)
+#include <linux/of.h>
+#include <linux/of_net.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+#include <linux/reset.h>
+#else
 #include <mach/msm_nss.h>
+#endif
 
 #include <linux/sysctl.h>
 #include <linux/regulator/consumer.h>
@@ -57,10 +68,16 @@
 int nss_jumbo_mru  __read_mostly = 0;
 int nss_paged_mode __read_mostly = 0;
 
+#ifdef CONFIG_DEBUG_KMEMLEAK
+extern struct sk_buff_head nss_skb_list;
+#endif
+
 /*
  * PM client handle
  */
+#if (NSS_PM_SUPPORT == 1)
 static void *pm_client;
+#endif
 
 /*
  * Handler to send NSS messages
@@ -119,33 +136,225 @@
 	return IRQ_HANDLED;
 }
 
+#if (NSS_DT_SUPPORT == 1)
+/*
+ * nss_drv_of_get_pdata()
+ *	Retrieve platform data from device node.
+ */
+static struct nss_platform_data *nss_drv_of_get_pdata(struct device_node *np,
+						      struct platform_device *pdev)
+{
+	struct nss_platform_data *npd = NULL;
+	struct nss_ctx_instance *nss_ctx = NULL;
+	struct nss_top_instance *nss_top = &nss_top_main;
+	uint32_t val;
+	struct resource res_nphys, res_vphys;
+	int32_t i;
+
+	npd = devm_kzalloc(&pdev->dev, sizeof(struct nss_platform_data), GFP_KERNEL);
+	if (!npd) {
+		return NULL;
+	}
+
+	if (of_property_read_u32(np, "qcom,id", &npd->id)
+	    || of_property_read_u32(np, "qcom,rst_addr", &npd->rst_addr)
+	    || of_property_read_u32(np, "qcom,load_addr", &npd->load_addr)
+	    || of_property_read_u32(np, "qcom,turbo_frequency", &npd->turbo_frequency)
+	    || of_property_read_u32(np, "qcom,gmac0_enabled", &npd->gmac_enabled[0])
+	    || of_property_read_u32(np, "qcom,gmac1_enabled", &npd->gmac_enabled[1])
+	    || of_property_read_u32(np, "qcom,gmac2_enabled", &npd->gmac_enabled[2])
+	    || of_property_read_u32(np, "qcom,gmac3_enabled", &npd->gmac_enabled[3])
+	    || of_property_read_u32(np, "qcom,num_irq", &npd->num_irq)) {
+		pr_err("%s: error reading critical device node properties\n", np->name);
+		goto out;
+	}
+
+	nss_ctx = &nss_top->nss[npd->id];
+	nss_ctx->id = npd->id;
+
+	if (of_address_to_resource(np, 0, &res_nphys) != 0) {
+		nss_info("%p: 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("%p: nss%d: of_address_to_resource() fail for vphys \n", nss_ctx, nss_ctx->id);
+		goto out;
+	}
+
+	/*
+	 * Save physical addresses
+	 */
+	npd->nphys = res_nphys.start;
+	npd->vphys = res_vphys.start;
+
+	npd->nmap = (uint32_t)ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+	if (!npd->nmap) {
+		nss_info("%p: nss%d: ioremap() fail for nphys \n", nss_ctx, nss_ctx->id);
+		goto out;
+	}
+
+	npd->vmap = (uint32_t)ioremap_nocache(npd->vphys, resource_size(&res_vphys));
+	if (!npd->vmap) {
+		nss_info("%p: nss%d: ioremap() fail for vphys \n", nss_ctx, nss_ctx->id);
+		goto out;
+	}
+
+	/*
+	 * Clear TCM memory used by this core
+	 */
+	for (i = 0; i < resource_size(&res_vphys) ; i += 4) {
+		nss_write_32((uint32_t)npd->vmap, i, 0);
+	}
+
+	/*
+	 * Get IRQ numbers
+	 */
+	for (val = 0 ; val < npd->num_irq ; val++) {
+		npd->irq[val] = irq_of_parse_and_map(np, val);
+		if (!npd->irq[val]) {
+			nss_info("%p: nss%d: irq_of_parse_and_map() fail for irq %d\n",
+				 nss_ctx, nss_ctx->id, val);
+			goto out;
+		}
+	}
+
+	if (of_property_read_u32(np, "qcom,ipv4_enabled", &npd->ipv4_enabled)
+	    || of_property_read_u32(np, "qcom,ipv6_enabled", &npd->ipv6_enabled)
+	    || of_property_read_u32(np, "qcom,l2switch_enabled", &npd->l2switch_enabled)
+	    || of_property_read_u32(np, "qcom,crypto_enabled", &npd->crypto_enabled)
+	    || of_property_read_u32(np, "qcom,ipsec_enabled", &npd->ipsec_enabled)
+	    || of_property_read_u32(np, "qcom,wlan_enabled", &npd->wlan_enabled)
+	    || of_property_read_u32(np, "qcom,tun6rd_enabled", &npd->tun6rd_enabled)
+	    || of_property_read_u32(np, "qcom,tunipip6_enabled", &npd->tunipip6_enabled)
+	    || of_property_read_u32(np, "qcom,shaping_enabled", &npd->shaping_enabled)) {
+		pr_warn("%s: error reading non-critical device node properties\n", np->name);
+	}
+
+	return npd;
+
+out:
+	if (npd->nmap) {
+		iounmap((void *)npd->nmap);
+	}
+
+	if (npd->vmap) {
+		iounmap((void *)npd->vmap);
+	}
+
+	devm_kfree(&pdev->dev, npd);
+
+	return NULL;
+}
+
+#endif
 /*
  * nss_probe()
  *	HLOS device probe callback
  */
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(3,7,0))
 static int __devinit nss_probe(struct platform_device *nss_dev)
+#else
+static int nss_probe(struct platform_device *nss_dev)
+#endif
 {
 	struct nss_top_instance *nss_top = &nss_top_main;
-	struct nss_ctx_instance *nss_ctx = &nss_top->nss[nss_dev->id];
-	struct nss_platform_data *npd = (struct nss_platform_data *) nss_dev->dev.platform_data;
+	struct nss_ctx_instance *nss_ctx = NULL;
+	struct nss_platform_data *npd = NULL;
 	struct netdev_priv_instance *ndev_priv;
+#if (NSS_DT_SUPPORT == 1)
+	struct reset_control *rstctl = NULL;
+#endif
 	int i, err = 0;
 
 	const struct firmware *nss_fw = NULL;
 	int rc = -ENODEV;
 	void __iomem *load_mem;
 
-	nss_ctx->nss_top = nss_top;
+#if (NSS_DT_SUPPORT == 1)
+	struct device_node *np = NULL;
+
+	if (nss_top_main.nss_hal_common_init_done == false) {
+		/*
+		 * Perform clock init common to all NSS cores
+		 */
+		struct clk *nss_tcm_src = NULL;
+		struct clk *nss_tcm_clk = NULL;
+
+		/*
+		 * Attach debug interface to TLMM
+		 */
+		nss_write_32((uint32_t)nss_top_main.nss_fpb_base, NSS_REGS_FPB_CSR_CFG_OFFSET, 0x360);
+
+		/*
+		 * NSS TCM CLOCK
+		 */
+		nss_tcm_src = clk_get(&nss_dev->dev, NSS_TCM_SRC_CLK);
+		if (IS_ERR(nss_tcm_src)) {
+			pr_err("nss-driver: cannot get clock: " NSS_TCM_SRC_CLK);
+			return -EFAULT;
+		}
+
+		clk_set_rate(nss_tcm_src, NSSTCM_FREQ);
+		clk_prepare(nss_tcm_src);
+		clk_enable(nss_tcm_src);
+
+		nss_tcm_clk = clk_get(&nss_dev->dev, NSS_TCM_CLK);
+		if (IS_ERR(nss_tcm_clk)) {
+			pr_err("nss-driver: cannot get clock: " NSS_TCM_CLK);
+			return -EFAULT;
+		}
+
+		clk_prepare(nss_tcm_clk);
+		clk_enable(nss_tcm_clk);
+
+		nss_top_main.nss_hal_common_init_done = true;
+		nss_info("nss_hal_common_reset Done.\n");
+	}
+
+	if (nss_dev->dev.of_node) {
+		/*
+		 * Device Tree based init
+		 */
+
+		np = of_node_get(nss_dev->dev.of_node);
+		npd = nss_drv_of_get_pdata(np, nss_dev);
+
+		of_node_put(np);
+
+		if (!npd) {
+			return -EFAULT;
+		}
+
+		nss_ctx = &nss_top->nss[npd->id];
+		nss_ctx->id = npd->id;
+		nss_dev->id = nss_ctx->id;
+
+	} else {
+		/*
+		 * Platform Device based init
+		 */
+
+		npd = (struct nss_platform_data *) nss_dev->dev.platform_data;
+		nss_ctx = &nss_top->nss[nss_dev->id];
+		nss_ctx->id = nss_dev->id;
+	}
+
+#else
+	npd = (struct nss_platform_data *) nss_dev->dev.platform_data;
+	nss_ctx = &nss_top->nss[nss_dev->id];
 	nss_ctx->id = nss_dev->id;
+#endif
+	nss_ctx->nss_top = nss_top;
 
 	nss_info("%p: NSS_DEV_ID %s \n", nss_ctx, dev_name(&nss_dev->dev));
 
 	/*
 	 * F/W load from NSS Driver
 	 */
-	if (nss_dev->id == 0) {
+	if (nss_ctx->id == 0) {
 		rc = request_firmware(&nss_fw, NETAP0_IMAGE, &(nss_dev->dev));
-	} else if (nss_dev->id == 1) {
+	} else if (nss_ctx->id == 1) {
 		rc = request_firmware(&nss_fw, NETAP1_IMAGE, &(nss_dev->dev));
 	} else {
 		nss_warning("%p: Invalid nss dev: %d \n", nss_ctx, nss_dev->id);
@@ -179,7 +388,7 @@
 	/*
 	 * Both NSS cores controlled by same regulator, Hook only Once
 	 */
-	if (!nss_dev->id) {
+	if (!nss_ctx->id) {
 		nss_core0_clk = clk_get(&nss_dev->dev, "nss_core_clk");
 		if (IS_ERR(nss_core0_clk)) {
 
@@ -192,6 +401,7 @@
 		clk_prepare(nss_core0_clk);
 		clk_enable(nss_core0_clk);
 
+#if (NSS_PM_SUPPORT == 1)
 		/*
 		 * Check if turbo is supported
 		 */
@@ -206,13 +416,16 @@
 			printk("nss_driver - Turbo No Support %d\n", npd->turbo_frequency);
 			nss_runtime_samples.freq_scale_sup_max = NSS_MAX_CPU_SCALES - 1;
 		}
+#else
+		printk("nss_driver - Turbo Not Supported\n");
+#endif
 	}
 
 	/*
 	 * Get load address of NSS firmware
 	 */
-	nss_info("%p: Setting NSS%d Firmware load address to %x\n", nss_ctx, nss_dev->id, npd->load_addr);
-	nss_top->nss[nss_dev->id].load = npd->load_addr;
+	nss_info("%p: 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;
 
 	/*
 	 * Get virtual and physical memory addresses for nss logical/hardware address maps
@@ -242,7 +455,7 @@
 	nss_ctx->vphys = npd->vphys;
 	nss_assert(nss_ctx->vphys);
 	nss_info("%d:ctx=%p, vphys=%x, vmap=%x, nphys=%x, nmap=%x",
-			nss_dev->id, nss_ctx, nss_ctx->vphys, nss_ctx->vmap, nss_ctx->nphys, nss_ctx->nmap);
+			nss_ctx->id, nss_ctx, nss_ctx->vphys, nss_ctx->vmap, nss_ctx->nphys, nss_ctx->nmap);
 
 	/*
 	 * Register netdevice handlers
@@ -408,8 +621,9 @@
 		}
 	}
 
+#if (NSS_PM_SUPPORT == 1)
 	nss_freq_register_handler();
-
+#endif
 	nss_lso_rx_register_handler();
 
 	nss_top->frequency_handler_id = nss_dev->id;
@@ -432,9 +646,64 @@
 	/*
 	 * Enable clocks and bring NSS core out of reset
 	 */
-	nss_hal_core_reset(nss_dev->id, nss_ctx->nmap, nss_ctx->load, nss_top->clk_src);
+#if (NSS_DT_SUPPORT == 1)
+	/*
+	 * Remove UBI32 reset clamp
+	 */
+	rstctl = devm_reset_control_get(&nss_dev->dev, NSS_CORE_CLK_RST_CLAMP);
+	if (IS_ERR(rstctl)) {
+		nss_info("%p: Deassert UBI32 reset clamp failed", nss_ctx, nss_ctx->id);
+		err = -EFAULT;
+		goto err_init_5;
+	}
+	reset_control_deassert(rstctl);
+	mdelay(1);
+	reset_control_put(rstctl);
 
 	/*
+	 * Remove UBI32 core clamp
+	 */
+	rstctl = devm_reset_control_get(&nss_dev->dev, NSS_CORE_CLAMP);
+	if (IS_ERR(rstctl)) {
+		nss_info("%p: Deassert UBI32 core clamp failed", nss_ctx, nss_ctx->id);
+		err = -EFAULT;
+		goto err_init_5;
+	}
+	reset_control_deassert(rstctl);
+	mdelay(1);
+	reset_control_put(rstctl);
+
+	/*
+	 * Remove UBI32 AHB reset
+	 */
+	rstctl = devm_reset_control_get(&nss_dev->dev, NSS_CORE_AHB_RESET);
+	if (IS_ERR(rstctl)) {
+		nss_info("%p: Deassert AHB reset failed", nss_ctx, nss_ctx->id);
+		err = -EFAULT;
+		goto err_init_5;
+	}
+	reset_control_deassert(rstctl);
+	mdelay(1);
+	reset_control_put(rstctl);
+
+	/*
+	 * Remove UBI32 AXI reset
+	 */
+	rstctl = devm_reset_control_get(&nss_dev->dev, NSS_CORE_AXI_RESET);
+	if (IS_ERR(rstctl)) {
+		nss_info("%p: Deassert AXI reset failed", nss_ctx, nss_ctx->id);
+		err = -EFAULT;
+		goto err_init_5;
+	}
+	reset_control_deassert(rstctl);
+	mdelay(1);
+	reset_control_put(rstctl);
+
+	nss_hal_core_reset(nss_ctx->nmap, nss_ctx->load);
+#else
+	nss_hal_core_reset(nss_dev->id, nss_ctx->nmap, nss_ctx->load, nss_top->clk_src);
+#endif
+	/*
 	 * Enable interrupts for NSS core
 	 */
 	nss_hal_enable_interrupt(nss_ctx->nmap, nss_ctx->int_ctx[0].irq,
@@ -462,7 +731,27 @@
 	unregister_netdev(nss_ctx->int_ctx[0].ndev);
 err_init_1:
 	free_netdev(nss_ctx->int_ctx[0].ndev);
+
+#if (NSS_DT_SUPPORT == 1)
+	if (nss_dev->dev.of_node) {
+		if (npd->nmap) {
+			iounmap((void *)npd->nmap);
+		}
+
+		if (npd->vmap) {
+			iounmap((void *)npd->vmap);
+		}
+	}
+#endif
+
 err_init_0:
+
+#if (NSS_DT_SUPPORT == 1)
+	if (nss_dev->dev.of_node) {
+		devm_kfree(&nss_dev->dev, npd);
+	}
+
+#endif
 	return err;
 }
 
@@ -470,7 +759,11 @@
  * nss_remove()
  *	HLOS device remove callback
  */
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(3,7,0))
 static int __devexit nss_remove(struct platform_device *nss_dev)
+#else
+static int nss_remove(struct platform_device *nss_dev)
+#endif
 {
 	struct nss_top_instance *nss_top = &nss_top_main;
 	struct nss_ctx_instance *nss_ctx = &nss_top->nss[nss_dev->id];
@@ -512,24 +805,54 @@
 			nss_data_plane_unregister_from_nss_gmac(i);
 		}
 	}
+#if (NSS_DT_SUPPORT == 1)
+	if (nss_dev->dev.of_node) {
+		if (nss_ctx->nmap) {
+			iounmap((void *)nss_ctx->nmap);
+			nss_ctx->nmap = 0;
+		}
+
+		if (nss_ctx->vmap) {
+			iounmap((void *)nss_ctx->vmap);
+			nss_ctx->vmap = 0;
+		}
+	}
+#endif
 
 	nss_info("%p: All resources freed for nss core%d", nss_ctx, nss_dev->id);
 	return 0;
 }
 
+#if (NSS_DT_SUPPORT == 1)
+static struct of_device_id nss_dt_ids[] = {
+	{ .compatible =  "qcom,nss0" },
+	{ .compatible =  "qcom,nss1" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, nss_dt_ids);
+#endif
+
 /*
  * nss_driver
  *	Platform driver structure for NSS
  */
 struct platform_driver nss_driver = {
 	.probe	= nss_probe,
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(3,7,0))
 	.remove	= __devexit_p(nss_remove),
+#else
+	.remove	= nss_remove,
+#endif
 	.driver	= {
 		.name	= "qca-nss",
 		.owner	= THIS_MODULE,
+#if (NSS_DT_SUPPORT == 1)
+		.of_match_table = of_match_ptr(nss_dt_ids),
+#endif
 	},
 };
 
+#if (NSS_PM_SUPPORT == 1)
 /*
  * nss_reset_frequency_stats_samples()
  *	Reset all frequency sampling state when auto scaling is turned off.
@@ -732,7 +1055,9 @@
 
 	return ret;
 }
+#endif /* NSS_PM_SUPPORT */
 
+#if (NSS_FW_DBG_SUPPORT == 1)
 /*
  * nss_debug_handler()
  *	Enable NSS debug output
@@ -751,6 +1076,7 @@
 
 	return ret;
 }
+#endif
 
 /*
  * nss_rps_handler()
@@ -846,6 +1172,7 @@
 	return ret;
 }
 
+#if (NSS_PM_SUPPORT == 1)
 /*
  * sysctl-tuning infrastructure.
  */
@@ -880,6 +1207,7 @@
 	},
 	{ }
 };
+#endif
 
 static ctl_table nss_general_table[] = {
 	{
@@ -889,6 +1217,7 @@
 		.mode                   = 0644,
 		.proc_handler   	= proc_dointvec,
 	},
+#if (NSS_FW_DBG_SUPPORT == 1)
 	{
 		.procname               = "debug",
 		.data                   = &nss_ctl_debug,
@@ -896,6 +1225,7 @@
 		.mode                   = 0644,
 		.proc_handler   	= &nss_debug_handler,
 	},
+#endif
 	{
 		.procname               = "coredump",
 		.data                   = &nss_cmd_buf.coredump,
@@ -935,11 +1265,13 @@
 };
 
 static ctl_table nss_clock_dir[] = {
+#if (NSS_PM_SUPPORT == 1)
 	{
 		.procname               = "clock",
 		.mode                   = 0555,
 		.child                  = nss_freq_table,
 	},
+#endif
 	{
 		.procname               = "general",
 		.mode                   = 0555,
@@ -974,15 +1306,58 @@
  */
 static int __init nss_init(void)
 {
+#if (NSS_DT_SUPPORT == 1)
+	struct device_node *cmn = NULL;
+	struct resource res_nss_fpb_base;
+#endif
+
 	nss_info("Init NSS driver");
 
+#if (NSS_PM_SUPPORT == 1)
 	nss_freq_change_context = nss_freq_get_mgr();
+#else
+	nss_freq_change_context = NULL;
+#endif
 
+#if (NSS_DT_SUPPORT == 1)
+	/*
+	 * Get reference to NSS common device node
+	 */
+	cmn = of_find_node_by_name(NULL, "nss-common");
+	if (!cmn) {
+		nss_info("cannot find nss-common node\n");
+		return -EFAULT;
+	}
+
+	if (of_address_to_resource(cmn, 0, &res_nss_fpb_base) != 0) {
+		nss_info("of_address_to_resource() return error for nss_fpb_base\n");
+		of_node_put(cmn);
+		return -EFAULT;
+	}
+
+	nss_top_main.nss_fpb_base = ioremap_nocache(res_nss_fpb_base.start,
+						    resource_size(&res_nss_fpb_base));
+	if (!nss_top_main.nss_fpb_base) {
+		nss_info("ioremap fail for nss_fpb_base\n");
+		of_node_put(cmn);
+		return -EFAULT;
+	}
+
+	nss_top_main.nss_hal_common_init_done = false;
+
+	/*
+	 * Release reference to NSS common device node
+	 */
+	of_node_put(cmn);
+	cmn = NULL;
+#else
 	/*
 	 * Perform clock init common to all NSS cores
 	 */
 	nss_hal_common_reset(&(nss_top_main.clk_src));
 
+#endif /* NSS_DT_SUPPORT */
+
 	/*
 	 * Enable spin locks
 	 */
@@ -1005,6 +1380,16 @@
 	nss_ipv4_register_sysctl();
 	nss_ipv6_register_sysctl();
 
+#ifdef CONFIG_DEBUG_KMEMLEAK
+	/*
+	 * If the system is under kmemleak debugging, track our
+	 * skbs by putting them in a list.
+	 */
+
+	skb_queue_head_init(&nss_skb_list);
+#endif
+
+#if (NSS_PM_SUPPORT == 1)
 	/*
 	 * Setup Runtime Sample values
 	 */
@@ -1047,6 +1432,7 @@
 	if (!pm_client) {
 		nss_warning("Error registering with PM driver");
 	}
+#endif
 
 	/*
 	 * Register platform_driver
@@ -1066,11 +1452,23 @@
 		unregister_sysctl_table(nss_dev_header);
 
 	/*
+	 * Unregister n2h specific sysctl
+	 */
+	nss_n2h_empty_pool_buf_unregister_sysctl();
+
+	/*
 	 * Unregister ipv4/6 specific sysctl
 	 */
 	nss_ipv4_unregister_sysctl();
 	nss_ipv6_unregister_sysctl();
 
+#if (NSS_DT_SUPPORT == 1)
+	if(nss_top_main.nss_fpb_base) {
+		iounmap(nss_top_main.nss_fpb_base);
+		nss_top_main.nss_fpb_base = 0;
+	}
+#endif
+
 	platform_driver_unregister(&nss_driver);
 }
 
diff --git a/nss_ipsecmgr.c b/nss_ipsecmgr.c
deleted file mode 100644
index 988807d..0000000
--- a/nss_ipsecmgr.c
+++ /dev/null
@@ -1,1262 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_ipsecmgr.c
- *	NSS to HLOS IPSec Manager
- */
-#include <linux/types.h>
-#include <linux/ip.h>
-#include <linux/skbuff.h>
-#include <linux/module.h>
-#include <linux/netdevice.h>
-#include <linux/rtnetlink.h>
-#include <asm/atomic.h>
-#include <nss_api_if.h>
-#include <nss_ipsec.h>
-#include "nss_ipsecmgr.h"
-
-#if defined(CONFIG_DYNAMIC_DEBUG)
-/*
- * Compile messages for dynamic enable/disable
- */
-#define nss_ipsecmgr_error(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define nss_ipsecmgr_warn(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define nss_ipsecmgr_info(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define nss_ipsecmgr_trace(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-
-#else
-/*
- * Statically compile messages at different levels
- */
-#define nss_ipsecmgr_error(s, ...) {	\
-	if (NSS_IPSECMGR_DEBUG_LEVEL < NSS_IPSECMGR_DEBUG_LVL_ERROR) {	\
-		pr_alert("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__);	\
-	}	\
-}
-#define nss_ipsecmgr_warn(s, ...) {	\
-	if (NSS_IPSECMGR_DEBUG_LEVEL < NSS_IPSECMGR_DEBUG_LVL_WARN) {	\
-		pr_warn("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__);	\
-	}	\
-}
-#define nss_ipsecmgr_info(s, ...) {	\
-	if (NSS_IPSECMGR_DEBUG_LEVEL < NSS_IPSECMGR_DEBUG_LVL_INFO) {	\
-		pr_notice("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__);	\
-	}	\
-}
-#define nss_ipsecmgr_trace(s, ...) {	\
-	if (NSS_IPSECMGR_DEBUG_LEVEL < NSS_IPSECMGR_DEBUG_LVL_TRACE) {	\
-		pr_info("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__);	\
-	}	\
-}
-
-#endif /* !CONFIG_DYNAMIC_DEBUG */
-
-/* NSS IPsec entry state */
-enum nss_ipsecmgr_entry_state {
-	NSS_IPSECMGR_ENTRY_STATE_INIT = 0,		/* init state of the entry */
-	NSS_IPSECMGR_ENTRY_STATE_VALID = 1,		/* entry is valid */
-	NSS_IPSECMGR_ENTRY_STATE_INVALID = 2,		/* entry is invalid */
-	NSS_IPSECMGR_ENTRY_STATE_MAX
-};
-
-/* IPsec table entry */
-struct nss_ipsecmgr_tbl_entry {
-	struct nss_ipsec_rule_sel sel;		/* rule selector */
-	uint32_t sa_idx;			/* index into SA table for this rule */
-	enum nss_ipsecmgr_entry_state state;	/* state */
-};
-
-/* NSS IPsec table type */
-struct nss_ipsecmgr_tbl {
-	uint32_t total_tx;					/* total packets tx'ed from ENCAP/DECAP */
-	uint32_t total_rx;					/* total packets rx'ed at ENCAP/DECAP */
-	uint32_t total_dropped;					/* total dropped packets at ENCAP/DECAP */
-	struct nss_ipsecmgr_tbl_entry entry[NSS_IPSEC_MAX_RULES];	/* table entry */
-	uint32_t count;						/* number of entries */
-	spinlock_t lock;
-};
-
-/* NSS IPsec SA */
-struct nss_ipsec_sa {
-	atomic_t user;						/* reference count */
-	uint32_t esp_spi;					/* ESP SPI */
-
-	enum nss_ipsecmgr_rule_type type;			/* IPsec rule type (ENCAP/DECAP) */
-
-	struct nss_ipsec_rule_data data;			/* IPsec rule data */
-	struct nss_ipsec_sa_stats stats;			/* SA statistics */
-};
-
-/* NSS IPsec manager private structure */
-struct nss_ipsecmgr_priv {
-	struct nss_ipsecmgr_tbl encap;				/* encap table */
-	struct nss_ipsecmgr_tbl decap;				/* decap table */
-	struct nss_ipsec_sa sa_tbl[NSS_IPSEC_MAX_SA];		/* global SA table */
-
-	void *cb_ctx;						/* callback context */
-	nss_ipsecmgr_data_cb_t data_cb;				/* data callback function */
-	nss_ipsecmgr_event_cb_t event_cb;			/* event callback function */
-	struct nss_ctx_instance *nss_ctx;			/* NSS context */
-	uint32_t nss_ifnum;					/* NSS if num for data */
-};
-
-typedef bool (*nss_ipsecmgr_op_t)(struct net_device *dev, struct nss_ipsecmgr_tbl *tbl, struct nss_ipsec_msg *nim);
-
-/* NSS IPsec manager operation (message types) complete routines */
-struct nss_ipsecmgr_ops {
-	nss_ipsecmgr_op_t verify_fn;	/* verify function for the op */
-	nss_ipsecmgr_op_t commit_fn;	/* commit function for the op */
-};
-
-/* driver global info */
-struct nss_ipsecmgr_drv {
-	atomic_t sa_count;	/* number of SA's available for */
-};
-
-/*
- **********************
- * globals
- **********************
- */
-
-static struct nss_ipsecmgr_drv gbl_drv_ctx;	/* global driver context */
-
-/*
- **********************
- * Helper Functions
- **********************
- */
-
-/*
- * nss_ipsecmgr_sa_init()
- * 	Initialize SA
- */
-static void nss_ipsecmgr_sa_init(struct nss_ipsec_sa *sa)
-{
-	memset(sa, 0, sizeof(struct nss_ipsec_sa));
-	atomic_set(&sa->user, 0);
-}
-
-/*
- * nss_ipsecmgr_sa_get()
- * 	Get reference to SA at given index
- */
-static struct nss_ipsec_sa *nss_ipsecmgr_sa_get(struct nss_ipsec_sa sa_tbl[], uint32_t sa_idx)
-{
-	struct nss_ipsec_sa *sa = &sa_tbl[sa_idx];
-
-	atomic_inc(&sa->user);
-
-	return sa;
-}
-
-/*
- * nss_ipsecmgr_sa_put()
- * 	Release reference to SA at given index
- */
-static void nss_ipsecmgr_sa_put(struct nss_ipsec_sa sa_tbl[], uint32_t sa_idx)
-{
-	struct nss_ipsec_sa *sa = &sa_tbl[sa_idx];
-
-	if (atomic_read(&sa->user) == 0) {
-		nss_ipsecmgr_error("SA already freed for (%d)\n", sa_idx);
-		return;
-	}
-
-	if (atomic_dec_and_test(&sa->user)) {
-		nss_ipsecmgr_sa_init(sa);
-	}
-}
-
-/*
- * nss_ipsecmgr_get_type()
- * 	Get IPsec manager rule type (encap/decap)
- */
-static enum nss_ipsecmgr_rule_type nss_ipsecmgr_get_type(uint16_t if_num)
-{
-	switch(if_num) {
-	case NSS_IPSEC_ENCAP_IF_NUMBER:
-		return NSS_IPSECMGR_RULE_TYPE_ENCAP;
-
-	case NSS_IPSEC_DECAP_IF_NUMBER:
-		return NSS_IPSECMGR_RULE_TYPE_DECAP;
-
-	default:
-		return NSS_IPSECMGR_RULE_TYPE_NONE;
-	}
-}
-
-/*
- * nss_ipsecmgr_get_tbl()
- * 	return the table associated with the interface number
- */
-static inline struct nss_ipsecmgr_tbl *nss_ipsecmgr_get_tbl(struct nss_ipsecmgr_priv *priv, uint16_t if_num)
-{
-	switch (if_num) {
-	case NSS_IPSEC_ENCAP_IF_NUMBER:
-		return &priv->encap;
-
-	case NSS_IPSEC_DECAP_IF_NUMBER:
-		return &priv->decap;
-
-	default:
-		return NULL;
-	}
-}
-
-/*
- * nss_ipsecmgr_copy_encap_add()
- * 	prepare the IPsec message for encap add operation
- */
-static void nss_ipsecmgr_copy_encap_add(struct net_device *dev, struct nss_ipsec_rule *msg, union nss_ipsecmgr_rule *rule)
-{
-	struct nss_ipsecmgr_encap_add *encap = &rule->encap_add;
-	struct nss_ipsec_rule_sel *sel = &msg->sel;
-	struct nss_ipsec_rule_oip *oip = &msg->oip;
-	struct nss_ipsec_rule_data *data = &msg->data;
-
-	/*
-	 * Populate the selectors for encap direction
-	 */
-	sel->ipv4_src = encap->inner_ipv4_src;
-	sel->ipv4_dst = encap->inner_ipv4_dst;
-
-	sel->src_port = encap->inner_src_port;
-	sel->dst_port = encap->inner_dst_port;
-
-	sel->ipv4_proto = encap->inner_ipv4_proto;
-
-	/*
-	 * Populate the outer IP data for encap direction
-	 */
-	oip->ipv4_dst = encap->outer_ipv4_dst;
-	oip->ipv4_src = encap->outer_ipv4_src;
-
-	oip->esp_spi = encap->esp_spi;
-
-	oip->ipv4_ttl = encap->outer_ipv4_ttl;
-
-	/*
-	 * Populate the data part
-	 */
-	data->cipher_algo = encap->cipher_algo;
-	data->esp_seq_skip = (encap->esp_seq_skip == 1);
-	data->esp_tail_skip = (encap->esp_tail_skip == 1);
-
-	data->esp_icv_len = encap->esp_icv_len;
-	data->auth_algo = encap->auth_algo;
-
-	data->crypto_index = encap->crypto_index;
-
-	data->nat_t_req = encap->nat_t_req;
-	data->use_pattern = encap->use_pattern;
-}
-
-/*
- * nss_ipsecmgr_copy_decap_add()
- * 	prepare the IPsec message for decap add operation
- */
-static void nss_ipsecmgr_copy_decap_add(struct net_device *dev, struct nss_ipsec_rule *msg, union nss_ipsecmgr_rule *rule)
-{
-	struct nss_ipsecmgr_decap_add *decap = &rule->decap_add;
-	struct nss_ipsec_rule_sel *sel = &msg->sel;
-	struct nss_ipsec_rule_data *data = &msg->data;
-	/*
-	 * Populate the selectors for encap direction
-	 */
-	sel->ipv4_src = decap->outer_ipv4_src;
-	sel->ipv4_dst = decap->outer_ipv4_dst;
-
-	sel->esp_spi = decap->esp_spi;
-
-	sel->ipv4_proto = IPPROTO_ESP;
-
-	/*
-	 * Populate the data part
-	 */
-	data->cipher_algo = decap->cipher_algo;
-
-	data->esp_icv_len = decap->esp_icv_len;
-	data->esp_seq_skip = (decap->esp_seq_skip == 1);
-	data->esp_tail_skip = (decap->esp_tail_skip == 1);
-	data->auth_algo = decap->auth_algo;
-
-	data->crypto_index = decap->crypto_index;
-
-	data->nat_t_req = decap->nat_t_req;
-	if (data->nat_t_req) {
-		sel->dst_port = NSS_IPSECMGR_NATT_PORT_DATA;
-	}
-
-	data->window_size = decap->window_size;
-}
-
-/*
- * nss_ipsecmgr_copy_encap_del()
- * 	prepare the IPsec message for encap del operation
- */
-static void nss_ipsecmgr_copy_encap_del(struct net_device *dev, struct nss_ipsec_rule *msg, union nss_ipsecmgr_rule *rule)
-{
-	struct nss_ipsecmgr_encap_del *encap = &rule->encap_del;
-	struct nss_ipsec_rule_sel *sel = &msg->sel;
-
-	/*
-	 * Populate the selectors for encap direction
-	 */
-	sel->ipv4_src = encap->inner_ipv4_src;
-	sel->ipv4_dst = encap->inner_ipv4_dst;
-
-	sel->src_port = encap->inner_src_port;
-	sel->dst_port = encap->inner_dst_port;
-
-	sel->ipv4_proto = encap->inner_ipv4_proto;
-}
-
-/*
- * nss_ipsecmgr_copy_decap_del()
- * 	prepare the IPsec message for decap del operation
- */
-static void nss_ipsecmgr_copy_decap_del(struct net_device *dev, struct nss_ipsec_rule *msg, union nss_ipsecmgr_rule *rule)
-{
-	struct nss_ipsecmgr_decap_del *decap = &rule->decap_del;
-	struct nss_ipsec_rule_sel *sel = &msg->sel;
-	/*
-	 * Populate the selectors for encap direction
-	 */
-	sel->ipv4_src = decap->outer_ipv4_src;
-	sel->ipv4_dst = decap->outer_ipv4_dst;
-
-	sel->esp_spi = decap->esp_spi;
-
-	sel->ipv4_proto = IPPROTO_ESP;
-}
-
-/*
- **********************
- * message handlers
- **********************
- */
-/*
- * nss_ipsecmgr_verify_add()
- * 	verify the Add operation before committing
- */
-static bool nss_ipsecmgr_verify_add(struct net_device *dev, struct nss_ipsecmgr_tbl *tbl, struct nss_ipsec_msg *nim)
-{
-	struct nss_ipsec_rule *rule = &nim->msg.push;
-	struct nss_ipsecmgr_tbl_entry *entry;
-	uint32_t tbl_idx;
-
-	tbl_idx = rule->rule_idx;
-	if (tbl_idx >= NSS_IPSEC_MAX_RULES) {
-		nss_ipsecmgr_error("table index out of range\n");
-		return false;
-	}
-
-	entry = &tbl->entry[tbl_idx];
-
-	/*
-	 * XXX:Duplicate hit or hash collision; We need to handle
-	 * hash collision
-	 */
-	if (entry->state == NSS_IPSECMGR_ENTRY_STATE_VALID) {
-		return false;
-	}
-
-	/*
-	 * Table full, XXX:must increment stats
-	 */
-	if ((tbl->count + 1) >= NSS_IPSEC_MAX_RULES) {
-		return false;
-	}
-
-	return true;
-}
-
-/*
- * nss_ipsecmgr_commit_add()
- * 	commit the Add operation
- */
-static bool nss_ipsecmgr_commit_add(struct net_device *dev, struct nss_ipsecmgr_tbl *tbl, struct nss_ipsec_msg *nim)
-{
-	struct nss_ipsec_rule *rule = &nim->msg.push;
-	struct nss_ipsecmgr_tbl_entry *entry;
-	struct nss_ipsecmgr_priv *priv;
-	struct nss_ipsec_sa *sa;
-	uint32_t tbl_idx;
-	uint32_t sa_idx;
-
-	priv = netdev_priv(dev);
-
-	/* Reduce the number of availabe SA(s) as we have successfully added one */
-	atomic_dec(&gbl_drv_ctx.sa_count);
-
-	tbl_idx = rule->rule_idx;
-	entry = &tbl->entry[tbl_idx];
-
-	tbl->count++;
-
-	memcpy(&entry->sel, &rule->sel, sizeof(struct nss_ipsec_rule_sel));
-	entry->state = NSS_IPSECMGR_ENTRY_STATE_VALID;
-
-	/* increment SA use count */
-	sa_idx = rule->sa_idx;
-	sa = nss_ipsecmgr_sa_get(priv->sa_tbl, sa_idx);
-
-	/* copy rule data to SA */
-	memcpy(&sa->data, &rule->data, sizeof(struct nss_ipsec_rule_data));
-
-	/* save rule type (encap/decap) */
-	sa->type = nss_ipsecmgr_get_type(nim->cm.interface);
-
-	/* save ESP SPI in SA */
-	switch (nim->cm.interface) {
-	case NSS_IPSEC_ENCAP_IF_NUMBER:
-		sa->esp_spi = rule->oip.esp_spi;
-		break;
-
-	case NSS_IPSEC_DECAP_IF_NUMBER:
-		sa->esp_spi = rule->sel.esp_spi;
-		break;
-
-	default:
-		nss_ipsecmgr_error("invalid interface num = %d\n", nim->cm.interface);
-		return false;
-	}
-
-	/* save SA table index for this rule entry */
-	entry->sa_idx = sa_idx;
-
-	return true;
-}
-
-/*
- * nss_ipsecmgr_verify_del()
- * 	verify the del operation before committing
- */
-static bool nss_ipsecmgr_verify_del(struct net_device *dev, struct nss_ipsecmgr_tbl *tbl, struct nss_ipsec_msg *nim)
-{
-	struct nss_ipsec_rule *rule = &nim->msg.push;
-	struct nss_ipsecmgr_tbl_entry *entry;
-	uint32_t tbl_idx;
-
-	tbl_idx = rule->rule_idx;
-	if (tbl_idx >= NSS_IPSEC_MAX_RULES) {
-		nss_ipsecmgr_error("table index out of range\n");
-		return false;
-	}
-
-	entry = &tbl->entry[tbl_idx];
-
-	/*
-	 * Entry already deleted, XXX:must increment stats
-	 */
-	if (entry->state == NSS_IPSECMGR_ENTRY_STATE_INVALID) {
-		return false;
-	}
-
-	/*
-	 * Entry never existed, XXX:must increment stats
-	 */
-	if (entry->state == NSS_IPSECMGR_ENTRY_STATE_INIT) {
-		return false;
-	}
-
-	/*
-	 * Table empty, XXX:must increment stats
-	 */
-	if (tbl->count == 0) {
-		return false;
-	}
-
-	return true;
-}
-
-/*
- * nss_ipsecmgr_commit_del()
- * 	commit the Del operation
- */
-static bool nss_ipsecmgr_commit_del(struct net_device *dev, struct nss_ipsecmgr_tbl *tbl, struct nss_ipsec_msg *nim)
-{
-	struct nss_ipsec_rule *rule = &nim->msg.push;
-	struct nss_ipsecmgr_tbl_entry *entry;
-	struct nss_ipsecmgr_priv *priv;
-	uint32_t tbl_idx;
-	uint32_t sa_idx;
-
-	priv = netdev_priv(dev);
-
-	/* Increase the number of available SA(s) as we have successfully freed one */
-	atomic_inc(&gbl_drv_ctx.sa_count);
-
-	tbl_idx = rule->rule_idx;
-	entry = &tbl->entry[tbl_idx];
-
-	tbl->count--;
-
-	memset(&entry->sel, 0, sizeof(struct nss_ipsec_rule_sel));
-	entry->state = NSS_IPSECMGR_ENTRY_STATE_INVALID;
-
-	/* decrement SA use count */
-	sa_idx = rule->sa_idx;
-	nss_ipsecmgr_sa_put(priv->sa_tbl, sa_idx);
-
-	return true;
-}
-
-/*
- * nss_ipsecmgr_verify_stats()
- * 	verify stats update operation
- */
-static bool nss_ipsecmgr_verify_stats(struct net_device *dev, struct nss_ipsecmgr_tbl *tbl, struct nss_ipsec_msg *nim)
-{
-	struct nss_ipsec_sa_stats *msg_sa_stats = &nim->msg.stats;
-
-	/*
-	 * Table empty, nothing to update
-	 */
-	if (tbl->count == 0) {
-		return false;
-	}
-
-	if (msg_sa_stats->sa_idx > NSS_CRYPTO_MAX_IDXS) {
-		return false;
-	}
-
-	return true;
-}
-
-/*
- * nss_ipsecmgr_commit_stats()
- * 	commit stats for the SA
- */
-static bool nss_ipsecmgr_commit_stats(struct net_device *dev, struct nss_ipsecmgr_tbl *tbl, struct nss_ipsec_msg *nim)
-{
-	struct nss_ipsec_sa_stats *msg_stats = &nim->msg.stats;
-	struct nss_ipsec_sa_stats *sa_stats;
-	struct nss_ipsec_sa *sa;
-	struct nss_ipsecmgr_priv *priv;
-	struct nss_ipsecmgr_event event = {.type = NSS_IPSECMGR_EVENT_SA_STATS};
-	struct nss_ipsecmgr_sa_stats *event_stats = &event.data.stats;
-	nss_ipsecmgr_event_cb_t event_cb;
-	void *cb_ctx;
-	uint32_t sa_idx;
-
-	priv = netdev_priv(dev);
-
-	/* get reference to SA stats */
-	sa_idx = msg_stats->sa_idx;
-	sa = nss_ipsecmgr_sa_get(priv->sa_tbl, sa_idx);
-
-	sa_stats = &sa->stats;
-
-	/* copy SA statistics */
-	sa_stats->seqnum = msg_stats->seqnum;
-	memcpy(&sa_stats->pkts, &msg_stats->pkts, sizeof(struct nss_ipsec_pkt_stats));
-
-	/* execute event callback to send SA stats event */
-	event_cb = priv->event_cb;
-	cb_ctx = priv->cb_ctx;
-	if (event_cb && cb_ctx) {
-		event_stats->esp_spi = sa->esp_spi;
-		event_stats->seqnum = sa_stats->seqnum;
-		event_stats->crypto_index = sa->data.crypto_index;
-		event_stats->type = sa->type;
-
-		event_stats->pkts_processed = sa_stats->pkts.processed;
-		event_stats->pkts_dropped = sa_stats->pkts.dropped;
-		event_stats->pkts_failed = sa_stats->pkts.failed;
-
-		event_cb(cb_ctx, &event);
-	}
-
-	/* decrement SA use count */
-	nss_ipsecmgr_sa_put(priv->sa_tbl, sa_idx);
-
-	return true;
-}
-
-/*
- * nss_ipsecmgr_verify_flush()
- * 	verify the flush operation
- */
-static bool nss_ipsecmgr_verify_flush(struct net_device *dev, struct nss_ipsecmgr_tbl *tbl, struct nss_ipsec_msg *nim)
-{
-	return true;
-}
-
-/*
- * nss_ipsecmgr_commit_flush()
- * 	commit the flush operation
- */
-static bool nss_ipsecmgr_commit_flush(struct net_device *dev, struct nss_ipsecmgr_tbl *tbl, struct nss_ipsec_msg *nim)
-{
-	struct nss_ipsecmgr_priv *priv;
-	struct nss_ipsec_sa *sa;
-	int32_t count;
-
-	priv = netdev_priv(dev);
-
-	tbl->count = 0;
-
-	for (count = 0, sa = &priv->sa_tbl[0]; count < NSS_IPSEC_MAX_SA; count++, sa++) {
-		nss_ipsecmgr_sa_init(sa);
-	}
-
-	return true;
-}
-
-/*
- * callback operation
- */
-const static struct nss_ipsecmgr_ops cb_ops[NSS_IPSEC_MSG_TYPE_MAX] = {
-	[NSS_IPSEC_MSG_TYPE_ADD_RULE] = {nss_ipsecmgr_verify_add, nss_ipsecmgr_commit_add},
-	[NSS_IPSEC_MSG_TYPE_DEL_RULE] = {nss_ipsecmgr_verify_del, nss_ipsecmgr_commit_del},
-	[NSS_IPSEC_MSG_TYPE_SYNC_STATS] = {nss_ipsecmgr_verify_stats, nss_ipsecmgr_commit_stats},
-	[NSS_IPSEC_MSG_TYPE_FLUSH_TUN] = {nss_ipsecmgr_verify_flush, nss_ipsecmgr_commit_flush}
-};
-
-/*
- * nss_ipsecmgr_op_receive()
- * 	asynchronous event reception
- */
-static void nss_ipsecmgr_op_receive(void *app_data, struct nss_ipsec_msg *nim)
-{
-	struct net_device *tun_dev = (struct net_device *)app_data;
-	struct nss_ipsecmgr_priv *priv;
-	struct nss_ipsecmgr_tbl *tbl;
-	nss_ipsecmgr_op_t verify_fn;
-	nss_ipsecmgr_op_t commit_fn;
-	struct net_device *dev;
-
-	BUG_ON(tun_dev == NULL);
-	BUG_ON(nim == NULL);
-
-	/* this holds the ref_cnt for the device */
-	dev = dev_get_by_index(&init_net, nim->tunnel_id);
-	if (dev == NULL) {
-		nss_ipsecmgr_error("event received on deallocated I/F (%d)\n", nim->tunnel_id);
-		return;
-	}
-
-	if (dev != tun_dev) {
-		nss_ipsecmgr_error("event received on incorrect I/F (%d)\n", nim->tunnel_id);
-		goto done;
-	}
-
-	priv = netdev_priv(dev);
-
-	tbl = nss_ipsecmgr_get_tbl(priv, nim->cm.interface);
-	if (tbl == NULL) {
-		nss_ipsecmgr_error("invalid interface number(%d)\n", nim->cm.interface);
-		goto done;
-	}
-
-	verify_fn = cb_ops[nim->cm.type].verify_fn;
-	commit_fn = cb_ops[nim->cm.type].commit_fn;
-
-	if (!verify_fn || !commit_fn) {
-		nss_ipsecmgr_error("unhandled type (%d)\n", nim->cm.type);
-		goto done;
-	}
-
-	/*
-	 * Now we can operate on the entry of the table
-	 */
-	spin_lock_bh(&tbl->lock);
-
-	if (verify_fn(dev, tbl, nim) == true) {
-		commit_fn(dev, tbl, nim);
-	}
-
-	spin_unlock_bh(&tbl->lock);
-done:
-	/* release the device as we are done */
-	dev_put(dev);
-}
-
-/*
- * nss_ipsecmgr_op_send()
- * 	Push a IPsec rule to NSS
- */
-static bool nss_ipsecmgr_op_send(struct net_device *dev, struct nss_ipsec_msg *nim, uint32_t if_num, enum nss_ipsec_msg_type type)
-{
-	struct nss_ipsecmgr_priv *priv;
-	nss_tx_status_t status;
-
-	priv = netdev_priv(dev);
-	if (priv->nss_ctx == NULL) {
-		nss_ipsecmgr_error("Tunnel registration or de-registration is underway\n");
-		return false;
-	}
-
-	nim->tunnel_id = dev->ifindex;
-
-	nss_ipsec_msg_init(nim, if_num, type, NSS_IPSEC_MSG_LEN, (nss_ipsec_msg_callback_t *)nss_ipsecmgr_op_receive, dev);
-
-	status = nss_ipsec_tx_msg(priv->nss_ctx, nim);
-	if (status != NSS_TX_SUCCESS) {
-		nss_ipsecmgr_error("unable to push rule(%d) for %s\n", type, dev->name);
-		return false;
-	}
-
-	return true;
-}
-
-/*
- * nss_ipsecmgr_buf_receive()
- *	receive NSS exception packets
- */
-static void nss_ipsecmgr_buf_receive(struct net_device *dev, struct sk_buff *skb, __attribute((unused)) struct napi_struct *napi)
-{
-	struct nss_ipsecmgr_priv *priv;
-	nss_ipsecmgr_data_cb_t cb_fn;
-	void *cb_ctx;
-	struct iphdr *ip;
-
-	BUG_ON(dev == NULL);
-	BUG_ON(skb == NULL);
-
-	/* hold the device till we process it */
-	dev_hold(dev);
-
-	/*
-	 * XXX:need to ensure that the dev being accessed is not deleted
-	 */
-	priv = netdev_priv(dev);
-
-	skb->dev = dev;
-
-	cb_fn = priv->data_cb;
-	cb_ctx = priv->cb_ctx;
-
-	/*
-	 * if tunnel creator gave a callback then send the packet without
-	 * any modifications to him
-	 */
-	if (cb_fn && cb_ctx) {
-		cb_fn(cb_ctx, skb);
-		goto done;
-	}
-
-	ip = (struct iphdr *)skb->data;
-	if ((ip->version != IPVERSION) || (ip->ihl != 5)) {
-		nss_ipsecmgr_error("dropping packets(IP version:%x, Header len:%x)\n", ip->version, ip->ihl);
-		dev_kfree_skb_any(skb);
-		goto done;
-	}
-
-	skb_reset_network_header(skb);
-	skb_reset_mac_header(skb);
-
-	skb->pkt_type = PACKET_HOST;
-	skb->protocol = cpu_to_be16(ETH_P_IP);
-	skb->skb_iif = dev->ifindex;
-
-	netif_receive_skb(skb);
-done:
-	/* release the device as we are done */
-	dev_put(dev);
-}
-
-/*
- **********************
- * Netdev ops
- **********************
- */
-
-/*
- * nss_ipsecmgr_tunnel_init()
- * 	initiallizes the tunnel
- */
-static int nss_ipsecmgr_tunnel_init(struct net_device *dev)
-{
-	struct nss_ipsecmgr_priv *priv;
-
-	priv = netdev_priv(dev);
-
-	priv->nss_ctx = nss_ipsec_get_context();
-
-	return 0;
-}
-
-/*
- * nss_ipsecmgr_tunnel_exit()
- * 	deinitiallizes the tunnel
- */
-static void nss_ipsecmgr_tunnel_exit(struct net_device *dev)
-{
-	struct nss_ipsecmgr_priv *priv;
-
-	priv = netdev_priv(dev);
-
-	priv->nss_ctx = NULL;
-}
-
-/*
- * nss_ipsecmgr_tunnel_open()
- * 	open the tunnel for usage
- */
-static int nss_ipsecmgr_tunnel_open(struct net_device *dev)
-{
-	struct nss_ipsecmgr_priv *priv;
-
-	priv = netdev_priv(dev);
-
-	netif_start_queue(dev);
-
-	return 0;
-}
-
-/*
- * nss_ipsecmgr_tunnel_stop()
- * 	stop the IPsec tunnel
- */
-static int nss_ipsecmgr_tunnel_stop(struct net_device *dev)
-{
-	struct nss_ipsecmgr_priv *priv;
-
-	priv = netdev_priv(dev);
-
-	netif_stop_queue(dev);
-
-	return 0;
-}
-
-/*
- * nss_ipsecmgr_tunnel_xmit()
- * 	tunnel transmit function
- */
-static netdev_tx_t nss_ipsecmgr_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	uint32_t if_num;
-	struct iphdr *inner_ip;
-	struct nss_ipsecmgr_priv *priv;
-	struct nss_ipsecmgr_tbl *encap;
-
-	if_num = NSS_IPSEC_ENCAP_IF_NUMBER;
-	priv = netdev_priv(dev);
-	encap = &priv->encap;
-
-	if (skb_is_nonlinear(skb)) {
-		nss_ipsecmgr_error("%p: NSS IPSEC does not support fragments %p\n", priv->nss_ctx, skb);
-		goto fail;
-	}
-
-	/*
-	 * Check if skb is shared
-	 */
-	if (unlikely(skb_shared(skb))) {
-		nss_ipsecmgr_error("%p: Shared skb is not supported: %p\n", priv->nss_ctx, skb);
-		goto fail;
-	}
-
-	/*
-	 * Check the packet head room & tail room
-	 */
-	if (unlikely(skb_headroom(skb) < dev->needed_headroom)) {
-		nss_ipsecmgr_error("%p: Insufficient head room :%d in skb: %p\n", priv->nss_ctx, skb_headroom(skb), skb);
-		goto fail;
-	}
-
-	if (unlikely(skb_tailroom(skb) < dev->needed_tailroom)) {
-		nss_ipsecmgr_error("%p: Insufficient tail room:%d in skb: %p\n", priv->nss_ctx, skb_tailroom(skb), skb);
-		goto fail;
-	}
-
-	/*
-	 * Check if packet is given starting from network header
-	 */
-	if (skb->data != skb_network_header(skb)) {
-		nss_ipsecmgr_error("%p: 'Skb data is not starting from IP header", priv->nss_ctx);
-		goto fail;
-	}
-
-	inner_ip = (struct iphdr *)ip_hdr(skb);
-
-	/*
-	 * Validate if packet has ip options
-	 */
-	if ((inner_ip->version != IPVERSION) || (inner_ip->ihl != 5)) {
-		nss_ipsecmgr_error("%p: Unsupported IP header ipver: 0x%x iphdr_len: 0x%x\n", priv->nss_ctx,
-						inner_ip->version, inner_ip->ihl);
-		goto fail;
-	}
-
-	/*
-	 * Check the TTL value
-	 */
-	if ((inner_ip->ttl == 0)) {
-		nss_ipsecmgr_error("%p: IP TTL is zero, unabled to transmit\n", priv->nss_ctx);
-		goto fail;
-	}
-
-	/*
-	 * Send the packet down
-	 */
-	if (nss_ipsec_tx_buf(skb, if_num) != 0) {
-		/*
-		 * TODO: NEED TO STOP THE QUEUE
-		 */
-		goto fail;
-	}
-
-	/*
-	 * Increment the tx count
-	 */
-	encap->total_tx++;
-
-	return NETDEV_TX_OK;
-
-fail:
-	return NETDEV_TX_BUSY;
-}
-
-/*
- * nss_ipsecmgr_tunnel_stats()
- * 	get tunnel statistics
- */
-static struct net_device_stats *nss_ipsecmgr_tunnel_stats(struct net_device *dev)
-{
-	struct net_device_stats *stats = &dev->stats;
-	struct nss_ipsecmgr_priv *priv;
-	struct nss_ipsec_sa *sa;
-	uint32_t i;
-
-	memset(stats, 0, sizeof(struct net_device_stats));
-
-	priv = netdev_priv(dev);
-
-	for (i = 0, sa = &priv->sa_tbl[0]; i < NSS_IPSEC_MAX_SA; i++, sa++) {
-		if (atomic_read(&sa->user) == 0) {
-			continue;
-		}
-
-		switch (sa->type) {
-		case NSS_IPSECMGR_RULE_TYPE_ENCAP:
-			stats->tx_packets += sa->stats.pkts.processed;
-			stats->tx_dropped += sa->stats.pkts.dropped;
-			break;
-
-		case NSS_IPSECMGR_RULE_TYPE_DECAP:
-			stats->rx_packets += sa->stats.pkts.processed;
-			stats->rx_dropped += sa->stats.pkts.dropped;
-			break;
-
-		default:
-			nss_ipsecmgr_error("unknown ipsec rule type\n");
-			break;
-		}
-	}
-
-	return stats;
-}
-
-/* NSS IPsec tunnel operation */
-static const struct net_device_ops nss_ipsecmgr_tunnel_ops = {
-	.ndo_init = nss_ipsecmgr_tunnel_init,
-	.ndo_uninit = nss_ipsecmgr_tunnel_exit,
-	.ndo_start_xmit = nss_ipsecmgr_tunnel_xmit,
-	.ndo_open = nss_ipsecmgr_tunnel_open,
-	.ndo_stop = nss_ipsecmgr_tunnel_stop,
-	.ndo_get_stats = nss_ipsecmgr_tunnel_stats,
-};
-
-/*
- * nss_ipsecmgr_tunnel_free()
- * 	free an existing IPsec tunnel interface
- */
-static void nss_ipsecmgr_tunnel_free(struct net_device *dev)
-{
-	struct nss_ipsecmgr_priv *priv = netdev_priv(dev);
-	struct nss_ipsecmgr_tbl *encap_tbl;
-	struct nss_ipsecmgr_tbl *decap_tbl;
-
-	encap_tbl = &priv->encap;
-	decap_tbl = &priv->decap;
-
-	nss_ipsecmgr_info("IPsec tunnel device(%s) freed\n", dev->name);
-	nss_ipsecmgr_info("Entries left: encap(%d), decap(%d)\n", encap_tbl->count, decap_tbl->count);
-
-	free_netdev(dev);
-}
-
-/*
- * nss_ipsecmr_setup_tunnel()
- * 	setup the IPsec tunnel
- */
-static void nss_ipsecmgr_tunnel_setup(struct net_device *dev)
-{
-	dev->addr_len = ETH_ALEN;
-	dev->mtu = NSS_IPSECMGR_TUN_MTU(ETH_DATA_LEN);
-
-	dev->hard_header_len = NSS_IPSECMGR_TUN_MAX_HDR_LEN;
-	dev->needed_headroom = NSS_IPSECMGR_TUN_HEADROOM;
-	dev->needed_tailroom = NSS_IPSECMGR_TUN_TAILROOM;
-
-	dev->type = NSS_IPSEC_ARPHRD_IPSEC;
-
-	dev->ethtool_ops = NULL;
-	dev->header_ops = NULL;
-	dev->netdev_ops = &nss_ipsecmgr_tunnel_ops;
-
-	dev->destructor = nss_ipsecmgr_tunnel_free;
-
-	/*
-	 * XXX:should get the MAC address from the ethernet device
-	 */
-	memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len);
-	memset(dev->broadcast, 0xff, dev->addr_len);
-	memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
-}
-
-/*
- **********************
- * Exported Functions
- **********************
- */
-
-/*
- * nss_ipsecmgr_tunnel_add()
- * 	add a IPsec pseudo tunnel device
- */
-struct net_device *nss_ipsecmgr_tunnel_add(void *cb_ctx, nss_ipsecmgr_data_cb_t data_cb, nss_ipsecmgr_event_cb_t event_cb)
-{
-	struct net_device *dev;
-	struct nss_ipsecmgr_priv *priv;
-	struct nss_ipsec_sa *sa;
-	int status;
-	int count;
-	int32_t if_num;
-
-	/* Features denote the skb types supported */
-	uint32_t features = 0;
-
-	dev = alloc_netdev(sizeof(struct nss_ipsecmgr_priv), NSS_IPSECMGR_TUN_NAME, nss_ipsecmgr_tunnel_setup);
-	if (!dev) {
-		nss_ipsecmgr_error("unable to allocate a tunnel device\n");
-		return NULL;
-	}
-
-	priv = netdev_priv(dev);
-
-	priv->cb_ctx = cb_ctx;
-	priv->data_cb = data_cb;
-	priv->event_cb = event_cb;
-
-	/* initialize SA stats table for this tunnel */
-	for (count = 0, sa = &priv->sa_tbl[0]; count < NSS_IPSEC_MAX_SA; count++, sa++) {
-		nss_ipsecmgr_sa_init(sa);
-	}
-
-	spin_lock_init(&priv->encap.lock);
-	spin_lock_init(&priv->decap.lock);
-
-	status = rtnl_is_locked() ? register_netdevice(dev) : register_netdev(dev);
-	if (status < 0) {
-		goto fail;
-	}
-
-	if_num = nss_ipsec_get_interface(priv->nss_ctx);
-	if (if_num < 0) {
-		nss_ipsecmgr_error("Invalid nss interface :%d\n", if_num);
-		return NULL;
-	}
-
-	nss_ipsec_data_register(if_num, nss_ipsecmgr_buf_receive, dev, features);
-
-	/*
-	 * Store data interface number in private data
-	 */
-	priv->nss_ifnum = if_num;
-
-	nss_ipsec_notify_register(NSS_IPSEC_ENCAP_IF_NUMBER, nss_ipsecmgr_op_receive, dev);
-	nss_ipsec_notify_register(NSS_IPSEC_DECAP_IF_NUMBER, nss_ipsecmgr_op_receive, dev);
-
-	return dev;
-
-fail:
-	free_netdev(dev);
-
-	return NULL;
-}
-EXPORT_SYMBOL(nss_ipsecmgr_tunnel_add);
-
-/*
- * nss_ipsecmgr_del_tunnel()
- * 	delete an existing IPsec tunnel
- */
-bool nss_ipsecmgr_tunnel_del(struct net_device *dev)
-{
-	struct nss_ipsecmgr_priv *priv;
-	struct nss_ipsecmgr_tbl *encap;
-	struct nss_ipsecmgr_tbl *decap;
-	struct nss_ipsec_msg nim;
-	bool status;
-
-	priv = netdev_priv(dev);
-
-	encap = &priv->encap;
-	decap = &priv->decap;
-
-	/*
-	 * Unregister the callbacks from the HLOS as we are no longer
-	 * interested in exception data & async messages
-	 */
-	nss_ipsec_data_unregister(priv->nss_ctx, priv->nss_ifnum);
-
-	nss_ipsec_notify_unregister(priv->nss_ctx, NSS_IPSEC_ENCAP_IF_NUMBER);
-	nss_ipsec_notify_unregister(priv->nss_ctx, NSS_IPSEC_DECAP_IF_NUMBER);
-
-	priv->data_cb = NULL;
-	priv->event_cb = NULL;
-
-	/*
-	 * Prepare to flush all SA(s) inside a tunnel
-	 */
-	memset(&nim, 0, sizeof(struct nss_ipsec_msg));
-
-	status = nss_ipsecmgr_op_send(dev, &nim, NSS_IPSEC_ENCAP_IF_NUMBER, NSS_IPSEC_MSG_TYPE_FLUSH_TUN);
-	if (status != true) {
-		nss_ipsecmgr_error("unable complete tunnel deletion, for ingress rules\n");
-		goto fail;
-	}
-
-	/* release all SA(s) associated with the encap */
-	atomic_sub(encap->count, &gbl_drv_ctx.sa_count);
-
-	status = nss_ipsecmgr_op_send(dev, &nim, NSS_IPSEC_DECAP_IF_NUMBER, NSS_IPSEC_MSG_TYPE_FLUSH_TUN);
-	if (status != true) {
-		nss_ipsecmgr_error("unable complete tunnel deletion, for egress rules\n");
-		goto fail;
-	}
-
-	/* release all SA(s) associated with the decap */
-	atomic_sub(decap->count, &gbl_drv_ctx.sa_count);
-
-	/*
-	 * The unregister should start here but the expectation is that the free would
-	 * happen when the reference count goes down to '0'
-	 */
-	rtnl_is_locked() ? unregister_netdevice(dev) : unregister_netdev(dev);
-
-	return true;
-fail:
-	/* caller must retry */
-	return false;
-}
-EXPORT_SYMBOL(nss_ipsecmgr_tunnel_del);
-
-/*
- * nss_ipsecmgr_sa_add()
- * 	add a new SA to the tunnel
- */
-bool nss_ipsecmgr_sa_add(struct net_device *dev, union nss_ipsecmgr_rule *rule, enum nss_ipsecmgr_rule_type type)
-{
-	struct nss_ipsecmgr_priv *priv;
-	struct nss_ipsec_msg nim;
-	uint32_t if_num;
-
-	priv = netdev_priv(dev);
-
-	/* check if there are free SA(s) */
-	if (atomic_read(&gbl_drv_ctx.sa_count) == 0) {
-		return false;
-	}
-
-	memset(&nim, 0, sizeof(struct nss_ipsec_msg));
-
-	/* XXX: some basic validation of the passed rule needs to happen */
-
-	switch (type) {
-	case NSS_IPSECMGR_RULE_TYPE_ENCAP:
-		if_num = NSS_IPSEC_ENCAP_IF_NUMBER;
-		nss_ipsecmgr_copy_encap_add(dev, &nim.msg.push, rule);
-		break;
-
-	case NSS_IPSECMGR_RULE_TYPE_DECAP:
-		if_num = NSS_IPSEC_DECAP_IF_NUMBER;
-		nss_ipsecmgr_copy_decap_add(dev, &nim.msg.push, rule);
-		break;
-
-	default:
-		nss_ipsecmgr_error("Unknown rule type(%d) for Add operation\n", type);
-		return false;
-	}
-
-	return nss_ipsecmgr_op_send(dev, &nim, if_num, NSS_IPSEC_MSG_TYPE_ADD_RULE);
-
-}
-EXPORT_SYMBOL(nss_ipsecmgr_sa_add);
-
-/*
- * nss_ipsecmgr_sa_del()
- *
- */
-bool nss_ipsecmgr_sa_del(struct net_device *dev, union nss_ipsecmgr_rule *rule, enum nss_ipsecmgr_rule_type type)
-{
-	struct nss_ipsecmgr_priv *priv;
-	struct nss_ipsec_msg nim;
-	uint32_t if_num;
-
-	priv = netdev_priv(dev);
-
-	/* check if all SA(s) are already freed */
-	if (atomic_read(&gbl_drv_ctx.sa_count) == NSS_IPSEC_MAX_RULES) {
-		return false;
-	}
-
-	memset(&nim, 0, sizeof(struct nss_ipsec_msg));
-
-	/* XXX: some basic validation of the passed rule needs to happen */
-
-	switch (type) {
-	case NSS_IPSECMGR_RULE_TYPE_ENCAP:
-		if_num = NSS_IPSEC_ENCAP_IF_NUMBER;
-		nss_ipsecmgr_copy_encap_del(dev, &nim.msg.push, rule);
-		break;
-
-	case NSS_IPSECMGR_RULE_TYPE_DECAP:
-		if_num = NSS_IPSEC_DECAP_IF_NUMBER;
-		nss_ipsecmgr_copy_decap_del(dev, &nim.msg.push, rule);
-		break;
-
-	default:
-		nss_ipsecmgr_error("Unknown rule type(%d) for Del operation\n", type);
-		return false;
-	}
-	return nss_ipsecmgr_op_send(dev, &nim, if_num, NSS_IPSEC_MSG_TYPE_DEL_RULE);
-}
-EXPORT_SYMBOL(nss_ipsecmgr_sa_del);
-
-static int __init nss_ipsecmgr_init(void)
-{
-	nss_ipsecmgr_info("NSS IPsec manager loaded: Build date %s\n", __DATE__);
-
-	memset(&gbl_drv_ctx, 0, sizeof(struct nss_ipsecmgr_drv));
-
-	atomic_set(&gbl_drv_ctx.sa_count, NSS_IPSEC_MAX_RULES);
-
-	return 0;
-}
-
-
-static void __exit nss_ipsecmgr_exit(void)
-{
-	nss_ipsecmgr_info("NSS IPsec manager unloader\n");
-}
-
-module_init(nss_ipsecmgr_init);
-module_exit(nss_ipsecmgr_exit);
diff --git a/nss_ipv4.c b/nss_ipv4.c
index 1052de8..c7c3135 100644
--- a/nss_ipv4.c
+++ b/nss_ipv4.c
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -32,7 +32,9 @@
 static void nss_ipv4_driver_conn_sync_update(struct nss_ctx_instance *nss_ctx, struct nss_ipv4_conn_sync *nirs)
 {
 	struct nss_top_instance *nss_top = nss_ctx->nss_top;
+#if (NSS_PPP_SUPPORT == 1)
 	struct net_device *pppoe_dev = NULL;
+#endif
 
 	/*
 	 * Update statistics maintained by NSS driver
@@ -47,6 +49,7 @@
 	/*
 	 * Update the PPPoE interface stats, if there is any PPPoE session on the interfaces.
 	 */
+#if (NSS_PPP_SUPPORT == 1)
 	if (nirs->flow_pppoe_session_id) {
 		pppoe_dev = ppp_session_to_netdev(nirs->flow_pppoe_session_id, (uint8_t *)nirs->flow_pppoe_remote_mac);
 		if (pppoe_dev) {
@@ -64,6 +67,7 @@
 			dev_put(pppoe_dev);
 		}
 	}
+#endif
 }
 
 /*
@@ -302,7 +306,7 @@
 		 * Error, hence we are not updating the nss_ipv4_conn_cfg
 		 * Restore the current_value to its previous state
 		 */
-		i4cfgp.response = FAILURE;
+		i4cfgp.response = NSS_FAILURE;
 		complete(&i4cfgp.complete);
 		return;
 	}
@@ -312,7 +316,7 @@
 	 * saved at the sysctl handler.
 	 */
 	nss_info("IPv4 connection configuration success: %d\n", nim->cm.error);
-	i4cfgp.response = SUCCESS;
+	i4cfgp.response = NSS_SUCCESS;
 	complete(&i4cfgp.complete);
 }
 
@@ -327,7 +331,7 @@
 	struct nss_ipv4_msg nim;
 	struct nss_ipv4_rule_conn_cfg_msg *nirccm;
 	nss_tx_status_t nss_tx_status;
-	int ret = FAILURE;
+	int ret = NSS_FAILURE;
 	uint32_t sum_of_conn;
 
 	/*
@@ -372,7 +376,7 @@
 		 */
 		nss_ipv4_conn_cfg = i4cfgp.current_value;
 		up(&i4cfgp.sem);
-		return FAILURE;
+		return NSS_FAILURE;
 	}
 
 	nss_info("%p: IPv4 supported connections: %d\n", nss_ctx, nss_ipv4_conn_cfg);
@@ -394,7 +398,7 @@
 		 */
 		nss_ipv4_conn_cfg = i4cfgp.current_value;
 		up(&i4cfgp.sem);
-		return FAILURE;
+		return NSS_FAILURE;
 	}
 
 	/*
@@ -409,7 +413,7 @@
 		 */
 		nss_ipv4_conn_cfg = i4cfgp.current_value;
 		up(&i4cfgp.sem);
-		return FAILURE;
+		return NSS_FAILURE;
 	}
 
 	/*
@@ -417,18 +421,18 @@
 	 * If ACK: Callback function will update nss_ipv4_conn_cfg with
 	 * i4cfgp.num_conn_valid, which holds the user input
 	 */
-	if (FAILURE == i4cfgp.response) {
+	if (NSS_FAILURE == i4cfgp.response) {
 
 		/*
 		 * Restore the current_value to its previous state
 		 */
 		nss_ipv4_conn_cfg = i4cfgp.current_value;
 		up(&i4cfgp.sem);
-		return FAILURE;
+		return NSS_FAILURE;
 	}
 
 	up(&i4cfgp.sem);
-	return SUCCESS;
+	return NSS_SUCCESS;
 }
 
 static ctl_table nss_ipv4_table[] = {
diff --git a/nss_ipv6.c b/nss_ipv6.c
index 0b1400b..4e56cc5 100644
--- a/nss_ipv6.c
+++ b/nss_ipv6.c
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -31,7 +31,9 @@
 static void nss_ipv6_driver_conn_sync_update(struct nss_ctx_instance *nss_ctx, struct nss_ipv6_conn_sync *nics)
 {
 	struct nss_top_instance *nss_top = nss_ctx->nss_top;
+#if (NSS_PPP_SUPPORT == 1)
 	struct net_device *pppoe_dev = NULL;
+#endif
 
 	/*
 	 * Update statistics maintained by NSS driver
@@ -46,6 +48,7 @@
 	/*
 	 * Update the PPPoE interface stats, if there is any PPPoE session on the interfaces.
 	 */
+#if (NSS_PPP_SUPPORT == 1)
 	if (nics->flow_pppoe_session_id) {
 		pppoe_dev = ppp_session_to_netdev(nics->flow_pppoe_session_id, (uint8_t *)nics->flow_pppoe_remote_mac);
 		if (pppoe_dev) {
@@ -63,6 +66,7 @@
 			dev_put(pppoe_dev);
 		}
 	}
+#endif
 }
 
 /*
@@ -301,7 +305,7 @@
 		 * Error, hence we are not updating the nss_ipv4_conn_cfg
 		 * Restore the current_value to its previous state
 		 */
-		i6cfgp.response = FAILURE;
+		i6cfgp.response = NSS_FAILURE;
 		complete(&i6cfgp.complete);
 		return;
 	}
@@ -311,7 +315,7 @@
 	 * saved at the sysctl handler.
 	 */
 	nss_info("IPv6 connection configuration success: %d\n", nim->cm.error);
-	i6cfgp.response = SUCCESS;
+	i6cfgp.response = NSS_SUCCESS;
 	complete(&i6cfgp.complete);
 }
 
@@ -327,7 +331,7 @@
 	struct nss_ipv6_msg nim;
 	struct nss_ipv6_rule_conn_cfg_msg *nirccm;
 	nss_tx_status_t nss_tx_status;
-	int ret = FAILURE;
+	int ret = NSS_FAILURE;
 	uint32_t sum_of_conn;
 
 	/*
@@ -370,7 +374,7 @@
 		 */
 		nss_ipv6_conn_cfg = i6cfgp.current_value;
 		up(&i6cfgp.sem);
-		return FAILURE;
+		return NSS_FAILURE;
 	}
 
 
@@ -393,7 +397,7 @@
 		 */
 		nss_ipv6_conn_cfg = i6cfgp.current_value;
 		up(&i6cfgp.sem);
-		return FAILURE;
+		return NSS_FAILURE;
 	}
 
 	/*
@@ -408,7 +412,7 @@
 		 */
 		nss_ipv6_conn_cfg = i6cfgp.current_value;
 		up(&i6cfgp.sem);
-		return FAILURE;
+		return NSS_FAILURE;
 	}
 
 	/*
@@ -416,17 +420,17 @@
 	 * If ACK: Callback function will update nss_ipv4_conn_cfg with
 	 * i6cfgp.num_conn_valid, which holds the user input
 	 */
-	if (FAILURE == i6cfgp.response) {
+	if (NSS_FAILURE == i6cfgp.response) {
 		/*
 		 * Restore the current_value to its previous state
 		 */
 		nss_ipv6_conn_cfg = i6cfgp.current_value;
 		up(&i6cfgp.sem);
-		return FAILURE;
+		return NSS_FAILURE;
 	}
 
 	up(&i6cfgp.sem);
-	return SUCCESS;
+	return NSS_SUCCESS;
 }
 
 static ctl_table nss_ipv6_table[] = {
diff --git a/nss_log.c b/nss_log.c
index e37b08d..b271763 100644
--- a/nss_log.c
+++ b/nss_log.c
@@ -30,7 +30,6 @@
 #include <linux/interrupt.h>
 #include <linux/time.h>
 #include <linux/platform_device.h>
-#include <mach/msm_nss.h>
 #include <linux/device.h>
 #include <nss_hal.h>
 #include "nss_core.h"
diff --git a/nss_n2h.c b/nss_n2h.c
index bb725ee..f1b46d8 100755
--- a/nss_n2h.c
+++ b/nss_n2h.c
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -21,61 +21,26 @@
 
 #include "nss_tx_rx_common.h"
 
-#define NSS_N2H_TIMEOUT 5*HZ
-
-wait_queue_head_t nss_n2h_wq;
+#define NSS_CORE_0			0
+#define NSS_CORE_1			1
 
 /*
- * nss_n2h_tx()
- *	Send Message to NSS to enable RPS.
- *
- * This API could be used for any additional RPS related
- * configuration in future.
+ * This number is chosen becuase currently default IPV4 + IPV6
+ * connection size is 1024 + 1024 = 2048.
+ *  FYI: However this doesnt have any impact on n2h/ipv6 connections
  */
-nss_tx_status_t nss_n2h_tx(struct nss_ctx_instance *nss_ctx, uint32_t enable_rps)
-{
-	struct sk_buff *nbuf;
-	nss_tx_status_t status;
-	struct nss_n2h_msg *nnhm;
-	struct nss_n2h_rps *rps_cfg;
+#define NSS_N2H_MIN_EMPTY_POOL_BUF_SZ		2048
+#define NSS_N2H_DEFAULT_EMPTY_POOL_BUF_SZ	8192
 
-	NSS_VERIFY_CTX_MAGIC(nss_ctx);
-	if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) {
-		return NSS_TX_FAILURE_NOT_READY;
-	}
+int nss_n2h_empty_pool_buf_cfg[NSS_MAX_CORES] __read_mostly = {NSS_N2H_DEFAULT_EMPTY_POOL_BUF_SZ, NSS_N2H_DEFAULT_EMPTY_POOL_BUF_SZ};
 
-	nbuf = dev_alloc_skb(NSS_NBUF_PAYLOAD_SIZE);
-	if (unlikely(!nbuf)) {
-		spin_lock_bh(&nss_ctx->nss_top->stats_lock);
-		nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NBUF_ALLOC_FAILS]++;
-		spin_unlock_bh(&nss_ctx->nss_top->stats_lock);
-		return NSS_TX_FAILURE;
-	}
+struct nss_n2h_registered_data {
+	nss_n2h_msg_callback_t n2h_callback;
+	void *app_data;
+};
 
-	nnhm = (struct nss_n2h_msg *)skb_put(nbuf, sizeof(struct nss_n2h_msg));
-
-	nnhm->cm.type = NSS_TX_METADATA_TYPE_N2H_RPS_CFG;
-	nnhm->cm.version = NSS_HLOS_MESSAGE_VERSION;
-	nnhm->cm.interface = NSS_N2H_INTERFACE;
-	nnhm->cm.len = nbuf->len;
-
-	rps_cfg = &nnhm->msg.rps_cfg;
-
-	rps_cfg->enable = enable_rps;
-
-	nss_info("n22_n2h_rps_configure %d \n", enable_rps);
-
-	status = nss_core_send_buffer(nss_ctx, 0, nbuf, NSS_IF_CMD_QUEUE, H2N_BUFFER_CTRL, 0);
-	if (status != NSS_CORE_STATUS_SUCCESS) {
-		dev_kfree_skb_any(nbuf);
-		nss_info("%p: unable to enqueue 'nss frequency change' - marked as stopped\n", nss_ctx);
-		return NSS_TX_FAILURE;
-	}
-
-	nss_hal_send_interrupt(nss_ctx->nmap, nss_ctx->h2n_desc_rings[NSS_IF_CMD_QUEUE].desc_ring.int_bit, NSS_REGS_H2N_INTR_STATUS_DATA_COMMAND_QUEUE);
-
-	return NSS_TX_SUCCESS;
-}
+static struct nss_n2h_cfg_pvt nss_n2h_nepbcfgp[NSS_MAX_CORES];
+static struct nss_n2h_registered_data nss_n2h_rd[NSS_MAX_CORES];
 
 /*
  * nss_n2h_stats_sync()
@@ -120,6 +85,22 @@
 	 */
 	nss_ctx->stats_n2h[NSS_STATS_N2H_PAYLOAD_ALLOC_FAILS] += nnss->payload_alloc_fails;
 
+	/*
+	 * Host <=> NSS control traffic stats
+	 */
+	nss_ctx->stats_n2h[NSS_STATS_N2H_H2N_CONTROL_PACKETS] += nnss->h2n_ctrl_pkts;
+	nss_ctx->stats_n2h[NSS_STATS_N2H_H2N_CONTROL_BYTES] += nnss->h2n_ctrl_bytes;
+	nss_ctx->stats_n2h[NSS_STATS_N2H_N2H_CONTROL_PACKETS] += nnss->n2h_ctrl_pkts;
+	nss_ctx->stats_n2h[NSS_STATS_N2H_N2H_CONTROL_BYTES] += nnss->n2h_ctrl_bytes;
+
+	/*
+	 * Host <=> NSS control data traffic stats
+	 */
+	nss_ctx->stats_n2h[NSS_STATS_N2H_H2N_DATA_PACKETS] += nnss->h2n_data_pkts;
+	nss_ctx->stats_n2h[NSS_STATS_N2H_H2N_DATA_BYTES] += nnss->h2n_data_bytes;
+	nss_ctx->stats_n2h[NSS_STATS_N2H_N2H_DATA_PACKETS] += nnss->n2h_data_pkts;
+	nss_ctx->stats_n2h[NSS_STATS_N2H_N2H_DATA_BYTES] += nnss->n2h_data_bytes;
+
 	spin_unlock_bh(&nss_top->stats_lock);
 }
 
@@ -130,6 +111,7 @@
 static void nss_n2h_interface_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm, __attribute__((unused))void *app_data)
 {
 	struct nss_n2h_msg *nnm = (struct nss_n2h_msg *)ncm;
+	nss_n2h_msg_callback_t cb;
 
 	BUG_ON(ncm->interface != NSS_N2H_INTERFACE);
 
@@ -145,12 +127,14 @@
 	case NSS_TX_METADATA_TYPE_N2H_RPS_CFG:
 		nss_ctx->n2h_rps_en = nnm->msg.rps_cfg.enable;
 		nss_info("NSS N2H rps_en %d \n",nnm->msg.rps_cfg.enable);
-		wake_up(&nss_n2h_wq);
+		break;
+
+	case NSS_TX_METADATA_TYPE_N2H_EMPTY_POOL_BUF_CFG:
+		nss_info("%p: empty pool buf cfg response from FW", nss_ctx);
 		break;
 
 	case NSS_RX_METADATA_TYPE_N2H_STATS_SYNC:
 		nss_n2h_stats_sync(nss_ctx, &nnm->msg.stats_sync);
-		wake_up(&nss_n2h_wq);
 		break;
 
 	default:
@@ -162,6 +146,435 @@
 						nss_ctx, ncm->response, ncm->type, ncm->interface);
 		}
 	}
+
+	/*
+	 * Update the callback and app_data for NOTIFY messages, IPv4 sends all notify messages
+	 * to the same callback/app_data.
+	 */
+	if (nnm->cm.response == NSS_CMM_RESPONSE_NOTIFY) {
+		/*
+		 * Place holder for the user to create right call
+		 * back and app data when response is NSS_CMM_RESPONSE_NOTIFY
+		 */
+		ncm->cb = (uint32_t)nss_n2h_rd[nss_ctx->id].n2h_callback;
+		ncm->app_data = (uint32_t)nss_n2h_rd[nss_ctx->id].app_data;
+	}
+
+	/*
+	 * Do we have a callback?
+	 */
+	if (!ncm->cb) {
+		return;
+	}
+
+	/*
+	 * Callback
+	 */
+	cb = (nss_n2h_msg_callback_t)ncm->cb;
+	cb((void *)ncm->app_data, nnm);
+}
+
+/*
+ * nss_n2h_empty_pool_buf_cfg_core1_callback()
+ *	call back function for the n2h connection configuration handler
+ */
+static void nss_n2h_empty_pool_buf_cfg_callback(void *app_data,
+						struct nss_n2h_msg *nnm)
+{
+	int core_num = (int)app_data;
+	if (nnm->cm.response != NSS_CMN_RESPONSE_ACK) {
+		struct nss_n2h_empty_pool_buf *nnepbcm;
+		nnepbcm = &nnm->msg.empty_pool_buf_cfg;
+
+		/*
+		 * Error, hence we are not updating the nss_n2h_empty_pool_buf
+		 * Restore the current_value to its previous state
+		 */
+		nss_warning("Core %d empty pool buf set failure: %d\n", core_num, nnm->cm.error);
+		nss_n2h_nepbcfgp[core_num].response = NSS_FAILURE;
+		complete(&nss_n2h_nepbcfgp[core_num].complete);
+		return;
+	}
+
+	/*
+	 * Sucess at NSS FW, hence updating nss_n2h_empty_pool_buf, with the valid value
+	 * saved at the sysctl handler.
+	 */
+	nss_info("Core %d empty pool buf set success: %d\n", core_num, nnm->cm.error);
+	nss_n2h_nepbcfgp[core_num].response = NSS_SUCCESS;
+	complete(&nss_n2h_nepbcfgp[core_num].complete);
+}
+
+/*
+ * nss_n2h_empty_pool_buf_core1_handler()
+ *	Sets the number of connections for IPv4
+ */
+static int nss_n2h_set_empty_pool_buf(ctl_table *ctl, int write, void __user *buffer,
+					size_t *lenp, loff_t *ppos,
+					int core_num, int *new_val)
+{
+	struct nss_top_instance *nss_top = &nss_top_main;
+	struct nss_ctx_instance *nss_ctx = &nss_top->nss[core_num];
+	struct nss_n2h_msg nnm;
+	struct nss_n2h_empty_pool_buf *nnepbcm;
+	nss_tx_status_t nss_tx_status;
+	int ret = NSS_FAILURE;
+
+	/*
+	 * Acquiring semaphore
+	 */
+	down(&nss_n2h_nepbcfgp[core_num].sem);
+
+	/*
+	 * Take snap shot of current value
+	 */
+	nss_n2h_nepbcfgp[core_num].current_value = *new_val;
+
+	/*
+	 * Write the variable with user input
+	 */
+	ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+	if (ret || (!write)) {
+		up(&nss_n2h_nepbcfgp[core_num].sem);
+		return ret;
+	}
+
+	/*
+	 * Input for n2h should be atleast 2048 to support defalt connections
+	 * of 1024 (IPV4) + 1024 (IPV6) connections.
+	 */
+	if ((*new_val < NSS_N2H_MIN_EMPTY_POOL_BUF_SZ)) {
+		nss_warning("%p: core %d setting %d is less than minimum number of buffer",
+				nss_ctx, core_num, *new_val);
+
+		/*
+		 * Restore the current_value to its previous state
+		 */
+		*new_val = nss_n2h_nepbcfgp[core_num].current_value;
+		up(&nss_n2h_nepbcfgp[core_num].sem);
+		return NSS_FAILURE;
+	}
+
+	nss_info("%p: core %d number of empty pool buffer is : %d\n",
+		nss_ctx, core_num, *new_val);
+
+	nss_n2h_msg_init(&nnm, NSS_N2H_INTERFACE,
+			NSS_TX_METADATA_TYPE_N2H_EMPTY_POOL_BUF_CFG,
+			sizeof(struct nss_n2h_empty_pool_buf),
+			(nss_n2h_msg_callback_t *)nss_n2h_empty_pool_buf_cfg_callback,
+			(void *)core_num);
+
+	nnepbcm = &nnm.msg.empty_pool_buf_cfg;
+	nnepbcm->pool_size = htonl(*new_val);
+	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 empty pool buffer: %d\n",
+				nss_ctx, core_num, *new_val);
+
+		/*
+		 * Restore the current_value to its previous state
+		 */
+		*new_val = nss_n2h_nepbcfgp[core_num].current_value;
+		up(&nss_n2h_nepbcfgp[core_num].sem);
+		return NSS_FAILURE;
+	}
+
+	/*
+	 * Blocking call, wait till we get ACK for this msg.
+	 */
+	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, core_num);
+
+		/*
+		 * Restore the current_value to its previous state
+		 */
+		*new_val = nss_n2h_nepbcfgp[core_num].current_value;
+		up(&nss_n2h_nepbcfgp[core_num].sem);
+		return NSS_FAILURE;
+	}
+
+	/*
+	 * ACK/NACK received from NSS FW
+	 * If ACK: Callback function will update nss_n2h_empty_pool_buf with
+	 * nss_n2h_nepbcfgp.num_conn_valid, which holds the user input
+	 */
+	if (NSS_FAILURE == nss_n2h_nepbcfgp[core_num].response) {
+
+		/*
+		 * Restore the current_value to its previous state
+		 */
+		*new_val = nss_n2h_nepbcfgp[core_num].current_value;
+		up(&nss_n2h_nepbcfgp[core_num].sem);
+		return NSS_FAILURE;
+	}
+
+	up(&nss_n2h_nepbcfgp[core_num].sem);
+	return NSS_SUCCESS;
+}
+
+/*
+ * nss_n2h_empty_pool_buf_core1_handler()
+ *	Sets the number of empty buffer for core 1
+ */
+static int nss_n2h_empty_pool_buf_cfg_core1_handler(ctl_table *ctl,
+						    int write, void __user *buffer,
+						    size_t *lenp, loff_t *ppos)
+{
+	return nss_n2h_set_empty_pool_buf(ctl, write, buffer, lenp, ppos,
+					NSS_CORE_1, &nss_n2h_empty_pool_buf_cfg[NSS_CORE_1]);
+}
+
+/*
+ * nss_n2h_empty_pool_buf_core0_handler()
+ *	Sets the number of empty buffer for core 0
+ */
+static int nss_n2h_empty_pool_buf_cfg_core0_handler(ctl_table *ctl,
+						    int write, void __user *buffer,
+						    size_t *lenp, loff_t *ppos)
+{
+	return nss_n2h_set_empty_pool_buf(ctl, write, buffer, lenp, ppos,
+					NSS_CORE_0, &nss_n2h_empty_pool_buf_cfg[NSS_CORE_0]);
+}
+
+static ctl_table nss_n2h_table[] = {
+	{
+		.procname		= "n2h_empty_pool_buf_core0",
+		.data			= &nss_n2h_empty_pool_buf_cfg[NSS_CORE_0],
+		.maxlen			= sizeof(int),
+		.mode			= 0644,
+		.proc_handler   	= &nss_n2h_empty_pool_buf_cfg_core0_handler,
+	},
+	{
+		.procname		= "n2h_empty_pool_buf_core1",
+		.data			= &nss_n2h_empty_pool_buf_cfg[NSS_CORE_1],
+		.maxlen			= sizeof(int),
+		.mode			= 0644,
+		.proc_handler   	= &nss_n2h_empty_pool_buf_cfg_core1_handler,
+	},
+
+	{ }
+};
+
+static ctl_table nss_n2h_dir[] = {
+	{
+		.procname		= "n2hcfg",
+		.mode			= 0555,
+		.child			= nss_n2h_table,
+	},
+	{ }
+};
+
+
+static ctl_table nss_n2h_root_dir[] = {
+	{
+		.procname		= "nss",
+		.mode			= 0555,
+		.child			= nss_n2h_dir,
+	},
+	{ }
+};
+
+static ctl_table nss_n2h_root[] = {
+	{
+		.procname		= "dev",
+		.mode			= 0555,
+		.child			= nss_n2h_root_dir,
+	},
+	{ }
+};
+
+static struct ctl_table_header *nss_n2h_header;
+
+/*
+ * nss_n2h_msg_init()
+ *	Initialize IPv4 message.
+ */
+void nss_n2h_msg_init(struct nss_n2h_msg *nim, uint16_t if_num, uint32_t type,
+		      uint32_t len, nss_n2h_msg_callback_t *cb, void *app_data)
+{
+	nss_cmn_msg_init(&nim->cm, if_num, type, len, (void *)cb, app_data);
+}
+
+
+/*
+ * nss_n2h_register_sysctl()
+ *	Register sysctl specific to n2h
+ */
+void nss_n2h_empty_pool_buf_register_sysctl(void)
+{
+	/*
+	 * Register sysctl table.
+	 */
+	nss_n2h_header = register_sysctl_table(nss_n2h_root);
+
+	/*
+	 * Core0
+	 */
+	sema_init(&nss_n2h_nepbcfgp[NSS_CORE_0].sem, 1);
+	init_completion(&nss_n2h_nepbcfgp[NSS_CORE_0].complete);
+	nss_n2h_nepbcfgp[NSS_CORE_0].current_value = nss_n2h_empty_pool_buf_cfg[NSS_CORE_0];
+
+	/*
+	 * Core1
+	 */
+	sema_init(&nss_n2h_nepbcfgp[NSS_CORE_1].sem, 1);
+	init_completion(&nss_n2h_nepbcfgp[NSS_CORE_1].complete);
+	nss_n2h_nepbcfgp[NSS_CORE_1].current_value = nss_n2h_empty_pool_buf_cfg[NSS_CORE_1];
+}
+
+/*
+ * nss_n2h_unregister_sysctl()
+ *	Unregister sysctl specific to n2h
+ */
+void nss_n2h_empty_pool_buf_unregister_sysctl(void)
+{
+	/*
+	 * Unregister sysctl table.
+	 */
+	if (nss_n2h_header) {
+		unregister_sysctl_table(nss_n2h_header);
+	}
+}
+
+/*
+ * nss_n2h_tx_msg()
+ *	Send messages to NSS n2h pacakge
+ */
+nss_tx_status_t nss_n2h_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_n2h_msg *nnm)
+{
+	struct nss_n2h_msg *nnm2;
+	struct nss_cmn_msg *ncm = &nnm->cm;
+	struct sk_buff *nbuf;
+	nss_tx_status_t status;
+
+	NSS_VERIFY_CTX_MAGIC(nss_ctx);
+	if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) {
+		return NSS_TX_FAILURE_NOT_READY;
+	}
+
+	/*
+	 * Sanity check the message
+	 */
+	if (ncm->interface != NSS_N2H_INTERFACE) {
+		nss_warning("%p: 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);
+		return NSS_TX_FAILURE;
+	}
+
+	if (ncm->len > sizeof(struct nss_n2h_msg)) {
+		nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface);
+		return NSS_TX_FAILURE;
+	}
+
+
+	nbuf = dev_alloc_skb(NSS_NBUF_PAYLOAD_SIZE);
+	if (unlikely(!nbuf)) {
+		spin_lock_bh(&nss_ctx->nss_top->stats_lock);
+		nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NBUF_ALLOC_FAILS]++;
+		spin_unlock_bh(&nss_ctx->nss_top->stats_lock);
+		return NSS_TX_FAILURE;
+	}
+
+	/*
+	 * Copy the message to our skb.
+	 */
+	nnm2 = (struct nss_n2h_msg *)skb_put(nbuf, sizeof(struct nss_n2h_msg));
+	memcpy(nnm2, nnm, sizeof(struct nss_n2h_msg));
+	status = nss_core_send_buffer(nss_ctx, 0, nbuf, NSS_IF_CMD_QUEUE, H2N_BUFFER_CTRL, 0);
+	if (status != NSS_CORE_STATUS_SUCCESS) {
+		dev_kfree_skb_any(nbuf);
+		nss_info("%p: unable to enqueue 'nss frequency change' - marked as stopped\n", nss_ctx);
+		return NSS_TX_FAILURE;
+	}
+
+	nss_hal_send_interrupt(nss_ctx->nmap,
+				nss_ctx->h2n_desc_rings[NSS_IF_CMD_QUEUE].desc_ring.int_bit,
+				NSS_REGS_H2N_INTR_STATUS_DATA_COMMAND_QUEUE);
+	NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_TX_CMD_REQ]);
+	return NSS_TX_SUCCESS;
+}
+
+
+/*
+ * nss_n2h_tx()
+ *	Send Message to NSS to enable RPS.
+ *
+ * This API could be used for any additional RPS related
+ * configuration in future.
+ *
+ * TODO: rename to _rps and rewrite assignment from handler to a callback.
+ */
+nss_tx_status_t nss_n2h_tx(struct nss_ctx_instance *nss_ctx, uint32_t enable_rps)
+{
+	struct sk_buff *nbuf;
+	nss_tx_status_t status;
+	struct nss_n2h_msg *nnhm;
+	struct nss_n2h_rps *rps_cfg;
+
+	NSS_VERIFY_CTX_MAGIC(nss_ctx);
+	if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) {
+		return NSS_TX_FAILURE_NOT_READY;
+	}
+
+	nbuf = dev_alloc_skb(NSS_NBUF_PAYLOAD_SIZE);
+	if (unlikely(!nbuf)) {
+		spin_lock_bh(&nss_ctx->nss_top->stats_lock);
+		nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NBUF_ALLOC_FAILS]++;
+		spin_unlock_bh(&nss_ctx->nss_top->stats_lock);
+		return NSS_TX_FAILURE;
+	}
+
+	nnhm = (struct nss_n2h_msg *)skb_put(nbuf, sizeof(struct nss_n2h_msg));
+
+	nss_n2h_msg_init(nnhm, NSS_N2H_INTERFACE, NSS_TX_METADATA_TYPE_N2H_RPS_CFG,
+			sizeof(struct nss_n2h_rps),
+			NULL, NULL);
+
+	rps_cfg = &nnhm->msg.rps_cfg;
+
+	rps_cfg->enable = enable_rps;
+
+	nss_info("n22_n2h_rps_configure %d \n", enable_rps);
+
+	status = nss_core_send_buffer(nss_ctx, 0, nbuf, NSS_IF_CMD_QUEUE, H2N_BUFFER_CTRL, 0);
+	if (status != NSS_CORE_STATUS_SUCCESS) {
+		dev_kfree_skb_any(nbuf);
+		nss_info("%p: unable to enqueue 'nss frequency change' - marked as stopped\n", nss_ctx);
+		return NSS_TX_FAILURE;
+	}
+
+	nss_hal_send_interrupt(nss_ctx->nmap,
+				nss_ctx->h2n_desc_rings[NSS_IF_CMD_QUEUE].desc_ring.int_bit,
+				NSS_REGS_H2N_INTR_STATUS_DATA_COMMAND_QUEUE);
+
+	return NSS_TX_SUCCESS;
+}
+
+/*
+ * nss_n2h_notify_register()
+ *	Register to received N2H events.
+ *
+ * NOTE: Do we want to pass an nss_ctx here so that we can register for n2h on any core?
+ */
+struct nss_ctx_instance *nss_n2h_notify_register(int core, nss_n2h_msg_callback_t cb, void *app_data)
+{
+	if (core >= NSS_MAX_CORES) {
+		nss_warning("Input core number %d is wrong \n", core);
+		return NULL;
+	}
+	/*
+	 * TODO: We need to have a new array in support of the new API
+	 * TODO: If we use a per-context array, we would move the array into nss_ctx based.
+	 */
+	nss_n2h_rd[core].n2h_callback = cb;
+	nss_n2h_rd[core].app_data = app_data;
+	return &nss_top_main.nss[core];
 }
 
 /*
@@ -171,8 +584,13 @@
 {
 	nss_core_register_handler(NSS_N2H_INTERFACE, nss_n2h_interface_handler, NULL);
 
+	nss_n2h_notify_register(NSS_CORE_0, NULL, NULL);
+	nss_n2h_notify_register(NSS_CORE_1, NULL, NULL);
+
 	/*
-	 * Initialize wait queue
+	 * Registering sysctl for n2h empty pool buffer.
 	 */
-	init_waitqueue_head(&nss_n2h_wq);
+	nss_n2h_empty_pool_buf_register_sysctl();
 }
+
+EXPORT_SYMBOL(nss_n2h_notify_register);
diff --git a/nss_pm.c b/nss_pm.c
index 65305eb..e8c944f 100644
--- a/nss_pm.c
+++ b/nss_pm.c
@@ -23,7 +23,9 @@
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include "nss_clocks.h"
+#include <nss_api_if.h>
 
+#if (NSS_PM_SUPPORT == 1)
 #include "nss_pm.h"
 
 /*
@@ -188,6 +190,7 @@
 DEFINE_SIMPLE_ATTRIBUTE(perf_level_fops, nss_pm_dbg_perf_level_get, nss_pm_dbg_perf_level_set, "%llu\n");
 
 DEFINE_SIMPLE_ATTRIBUTE(autoscale_fops, nss_pm_dbg_autoscale_get, nss_pm_dbg_autoscale_set, "%llu\n");
+#endif /** (NSS_PM_SUPPORT == 1) */
 
 /*
  * nss_pm_client_register
@@ -200,6 +203,7 @@
  */
 void *nss_pm_client_register(nss_pm_client_t client_id)
 {
+#if (NSS_PM_SUPPORT == 1)
 	int ret;
 	struct dentry *pm_dentry;
 	nss_pm_client_data_t *pm_client;
@@ -265,6 +269,7 @@
 out:
 	return (void *)pm_client;
 error:
+#endif
 	return NULL;
 }
 EXPORT_SYMBOL(nss_pm_client_register);
@@ -275,6 +280,7 @@
  */
 int nss_pm_client_unregister(nss_pm_client_t client_id)
 {
+#if (NSS_PM_SUPPORT == 1)
 	nss_pm_client_data_t *pm_client;
 
 	if (unlikely(client_id >= NSS_PM_MAX_CLIENTS))  {
@@ -302,6 +308,7 @@
 	return NSS_PM_API_SUCCESS;
 
 error:
+#endif
 	return NSS_PM_API_FAILED;
 }
 
@@ -311,6 +318,7 @@
  */
 nss_pm_interface_status_t nss_pm_set_perf_level(void *handle, nss_pm_perf_level_t lvl)
 {
+#if (NSS_PM_SUPPORT == 1)
 	int ret = 0;
 	nss_pm_client_data_t *pm_client;
 
@@ -377,11 +385,12 @@
 
 	nss_pm_info("perf level request, current: %d new: %d \n", pm_client->current_perf_lvl, lvl);
 	pm_client->current_perf_lvl = lvl;
-
+#endif
 	return NSS_PM_API_SUCCESS;
 }
 EXPORT_SYMBOL(nss_pm_set_perf_level);
 
+#if (NSS_PM_SUPPORT == 1)
 /*
  * nss_pm_set_turbo()
  *   Sets the turbo support flag globally for all clients
@@ -409,3 +418,4 @@
 		nss_pm_warning("Failed to create qca-nss-drv directory in debugfs");
 	}
 }
+#endif
diff --git a/nss_pm.h b/nss_pm.h
index f94cb6a..2a2cb8d 100644
--- a/nss_pm.h
+++ b/nss_pm.h
@@ -22,10 +22,13 @@
 #ifndef __NSS_PM_H
 #define __NSS_PM_H
 
+#include<linux/version.h>
+
 #include <mach/msm_nss_gmac.h>
 #include <mach/msm_nss_crypto.h>
 #include <mach/msm_bus_board.h>
 #include <mach/msm_bus.h>
+
 #include <nss_api_if.h>
 
 /*
diff --git a/nss_pppoe.c b/nss_pppoe.c
index 0cfe3a2..3d5f2a9 100644
--- a/nss_pppoe.c
+++ b/nss_pppoe.c
@@ -222,6 +222,7 @@
  */
 static void nss_pppoe_rule_create_success(struct nss_ctx_instance *nss_ctx, struct nss_pppoe_rule_create_success_msg *pcs)
 {
+#if (NSS_PPP_SUPPORT == 1)
 	struct net_device *ppp_dev = ppp_session_to_netdev(pcs->pppoe_session_id, pcs->pppoe_remote_mac);
 
 	if (!ppp_dev) {
@@ -240,6 +241,7 @@
 	}
 
 	dev_put(ppp_dev);
+#endif
 }
 
 /*
diff --git a/nss_qdisc/Makefile b/nss_qdisc/Makefile
deleted file mode 100755
index 8facfeb..0000000
--- a/nss_qdisc/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-##########################################################################
-# Copyright (c) 2014, 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.
-##########################################################################
-
-ccflags-y := -I$(obj)/../exports -I$(srctree)/net/bridge -DNSS_QDISC_DEBUG_LEVEL=0
-
-obj-m += qca-nss-qdisc.o
-qca-nss-qdisc-objs := 	nss_qdisc.o \
-			nss_fifo.o \
-			nss_codel.o \
-			nss_tbl.o \
-			nss_prio.o \
-			nss_bf.o \
-			nss_wrr.o \
-			nss_htb.o \
-			nss_blackhole.o \
-			nss_wred.o
diff --git a/nss_qdisc/nss_bf.c b/nss_qdisc/nss_bf.c
deleted file mode 100644
index e7146b7..0000000
--- a/nss_qdisc/nss_bf.c
+++ /dev/null
@@ -1,699 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_qdisc.h"
-
-struct nss_bf_class_data {
-	struct nss_qdisc nq;		/* Base class used by nss_qdisc */
-	struct Qdisc_class_common cl_common;	/* Common class structure */
-	u32 rate;				/* Allowed bandwidth for this class */
-	u32 burst;				/* Allowed burst for this class */
-	u32 mtu;				/* MTU size of the interface */
-	u32 quantum;				/* Quantum allocation for DRR */
-	struct Qdisc *qdisc;			/* Pointer to child qdisc */
-};
-
-struct nss_bf_sched_data {
-	struct nss_qdisc nq;		/* Base class used by nss_qdisc */
-	u16 defcls;				/* default class id */
-	struct nss_bf_class_data root;		/* root class */
-	struct Qdisc_class_hash clhash;		/* class hash */
-};
-
-static inline struct nss_bf_class_data *nss_bf_find_class(u32 classid,
-							struct Qdisc *sch)
-{
-	struct nss_bf_sched_data *q = qdisc_priv(sch);
-	struct Qdisc_class_common *clc;
-	clc = qdisc_class_find(&q->clhash, classid);
-	if (clc == NULL) {
-		nss_qdisc_warning("%s: Cannot find class with classid %u in qdisc %p hash table %p\n", __func__, classid, sch, &q->clhash);
-		return NULL;
-	}
-	return container_of(clc, struct nss_bf_class_data, cl_common);
-}
-
-static const struct nla_policy nss_bf_policy[TCA_NSSBF_MAX + 1] = {
-	[TCA_NSSBF_CLASS_PARMS] = { .len = sizeof(struct tc_nssbf_class_qopt) },
-};
-
-static int nss_bf_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
-		  struct nlattr **tca, unsigned long *arg)
-{
-	struct nss_bf_sched_data *q = qdisc_priv(sch);
-	struct nss_bf_class_data *cl = (struct nss_bf_class_data *)*arg;
-	struct nlattr *opt = tca[TCA_OPTIONS];
-	struct nlattr *na[TCA_NSSBF_MAX + 1];
-	struct tc_nssbf_class_qopt *qopt;
-	int err;
-	struct nss_if_msg nim_config;
-	struct net_device *dev = qdisc_dev(sch);
-
-	nss_qdisc_info("%s: Changing bf class %u\n", __func__, classid);
-        if (opt == NULL)
-                return -EINVAL;
-
-        err = nla_parse_nested(na, TCA_NSSBF_MAX, opt, nss_bf_policy);
-        if (err < 0)
-                return err;
-
-        if (na[TCA_NSSBF_CLASS_PARMS] == NULL)
-                return -EINVAL;
-
-	/*
-	 * If class with a given classid is not found, we allocate a new one
-	 */
-	if (!cl) {
-		struct nss_if_msg nim_attach;
-		nss_qdisc_info("%s: Bf class %u not found. Allocating a new class.\n", __func__, classid);
-		cl = kzalloc(sizeof(struct nss_bf_class_data), GFP_KERNEL);
-
-		if (!cl) {
-			nss_qdisc_error("%s: Class allocation failed for classid %u\n", __func__, classid);
-			return -EINVAL;
-		}
-
-		nss_qdisc_info("%s: Bf class %u allocated %p\n", __func__, classid, cl);
-		cl->cl_common.classid = classid;
-
-		/*
-		 * We make the child qdisc a noop qdisc, and
-		 * set reference count to 1. This is important,
-		 * reference count should not be 0.
-		 */
-		cl->qdisc = &noop_qdisc;
-		atomic_set(&cl->nq.refcnt, 1);
-		*arg = (unsigned long)cl;
-
-		nss_qdisc_info("%s: Adding classid %u to qdisc %p hash queue %p\n", __func__, 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.
-		 */
-		if (nss_qdisc_init(sch, &cl->nq, NSS_SHAPER_NODE_TYPE_BF_GROUP, classid) < 0) {
-			nss_qdisc_error("%s: Nss init for class %u failed\n", __func__, classid);
-			kfree(cl);
-			return -EINVAL;
-		}
-
-		/*
-		 * Set qos_tag of parent to which the class needs to e attached to.
-		 */
-		nim_attach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
-
-		/*
-		 * Set the child to be this class.
-		 */
-		nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_attach.child_qos_tag = cl->nq.qos_tag;
-
-		/*
-		 * Send node_attach command down to the NSS
-		 */
-		if (nss_qdisc_node_attach(&q->nq, &cl->nq, &nim_attach,
-				NSS_SHAPER_CONFIG_TYPE_BF_ATTACH) < 0) {
-			nss_qdisc_error("%s: Nss attach for class %u failed\n", __func__, classid);
-			nss_qdisc_destroy(&cl->nq);
-			kfree(cl);
-			return -EINVAL;
-		}
-
-		/*
-		 * Add class to hash tree once it is attached in the NSS
-		 */
-		sch_tree_lock(sch);
-		qdisc_class_hash_insert(&q->clhash, &cl->cl_common);
-		sch_tree_unlock(sch);
-
-		/*
-		 * Hash grow should not come within the tree lock
-		 */
-		qdisc_class_hash_grow(sch, &q->clhash);
-
-		/*
-		 * Start the stats polling timer
-		 */
-		nss_qdisc_start_basic_stats_polling(&cl->nq);
-
-		nss_qdisc_info("%s: Class %u successfully allocated\n", __func__, classid);
-	}
-
-	qopt = nla_data(na[TCA_NSSBF_CLASS_PARMS]);
-
-	sch_tree_lock(sch);
-	cl->rate = qopt->rate;
-	cl->burst = qopt->burst;
-
-	/*
-	 * If MTU and quantum values are not provided, set them to
-	 * the interface's MTU value.
-	 */
-	if (!qopt->mtu) {
-		cl->mtu = psched_mtu(dev);
-		nss_qdisc_info("MTU not provided for bf class on interface %s. "
-				"Setting MTU to %u bytes\n", dev->name, cl->mtu);
-	} else {
-		cl->mtu = qopt->mtu;
-	}
-
-	if (!qopt->quantum) {
-		cl->quantum = psched_mtu(dev);
-		nss_qdisc_info("Quantum value not provided for bf class on interface %s. "
-				"Setting quantum to %u\n", dev->name, cl->quantum);
-	} else {
-		cl->quantum = qopt->quantum;
-	}
-
-	sch_tree_unlock(sch);
-
-	/*
-	 * Fill information that needs to be sent down to the NSS for configuring the
-	 * bf class.
-	 */
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_group_param.quantum = cl->quantum;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_group_param.lap.rate = cl->rate;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_group_param.lap.burst = cl->burst;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_group_param.lap.max_size = cl->mtu;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_group_param.lap.short_circuit = false;
-
-	nss_qdisc_info("Rate = %u Burst = %u MTU = %u Quantum = %u\n", cl->rate, cl->burst, cl->mtu, cl->quantum);
-
-	/*
-	 * Send configure command to the NSS
-	 */
-	if (nss_qdisc_configure(&cl->nq, &nim_config,
-			NSS_SHAPER_CONFIG_TYPE_BF_GROUP_CHANGE_PARAM) < 0) {
-		nss_qdisc_error("%s: Failed to configure class %u\n", __func__, classid);
-		return -EINVAL;
-	}
-
-	nss_qdisc_info("%s: Class %u changed successfully\n", __func__, classid);
-	return 0;
-}
-
-static void nss_bf_destroy_class(struct Qdisc *sch, struct nss_bf_class_data *cl)
-{
-	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);
-
-	/*
-	 * Note, this function gets called even for NSSBF and not just for NSSBF_GROUP.
-	 * If this is BF qdisc then we should not call nss_qdisc_destroy or stop polling
-	 * for stats. These two actions will happen inside nss_bf_destroy(), which is called
-	 * only for the root qdisc.
-	 */
-	if (cl == &q->root) {
-		nss_qdisc_info("%s: We do not destroy bf class %p here since this is "
-				"the qdisc %p\n", __func__, cl, sch);
-		return;
-	}
-
-	/*
-	 * We always have to detach our child qdisc in NSS, before destroying it.
-	 */
-	if (cl->qdisc != &noop_qdisc) {
-		struct nss_qdisc *nq_child = qdisc_priv(cl->qdisc);
-		nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
-		if (nss_qdisc_node_detach(&cl->nq, nq_child, &nim,
-				NSS_SHAPER_CONFIG_TYPE_BF_GROUP_DETACH) < 0) {
-			nss_qdisc_error("%s: Failed to detach child %x from class %x\n",
-					__func__, cl->qdisc->handle, q->nq.qos_tag);
-			return;
-		}
-	}
-
-	/*
-	 * And now we destroy the child.
-	 */
-	qdisc_destroy(cl->qdisc);
-
-	/*
-	 * Stop the stats polling timer and free class
-	 */
-	nss_qdisc_stop_basic_stats_polling(&cl->nq);
-
-	/*
-	 * Destroy the shaper in NSS
-	 */
-	nss_qdisc_destroy(&cl->nq);
-
-	/*
-	 * Free class
-	 */
-	kfree(cl);
-}
-
-static int nss_bf_delete_class(struct Qdisc *sch, unsigned long arg)
-{
-	struct nss_bf_sched_data *q = qdisc_priv(sch);
-	struct nss_bf_class_data *cl = (struct nss_bf_class_data *)arg;
-	struct nss_if_msg nim;
-	int refcnt;
-	struct nss_qdisc *nq_child = (struct nss_qdisc *)qdisc_priv(cl->qdisc);
-
-	/*
-	 * Since all classes are leaf nodes in our case, we dont have to make
-	 * that check.
-	 */
-	if (cl == &q->root)
-		return -EBUSY;
-
-	/*
-	 * The message to NSS should be sent to the parent of this class
-	 */
-	nss_qdisc_info("%s: Detaching bf class: %p\n", __func__, 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,
-			NSS_SHAPER_CONFIG_TYPE_BF_DETACH) < 0) {
-		return -EINVAL;
-	}
-
-	sch_tree_lock(sch);
-	qdisc_reset(cl->qdisc);
-	qdisc_class_hash_remove(&q->clhash, &cl->cl_common);
-	refcnt = atomic_sub_return(1, &cl->nq.refcnt);
-	sch_tree_unlock(sch);
-	if (!refcnt) {
-		nss_qdisc_error("%s: Reference count should not be zero for class %p\n", __func__, cl);
-	}
-
-	return 0;
-}
-
-static int nss_bf_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
-								 struct Qdisc **old)
-{
-	struct nss_bf_sched_data *q = qdisc_priv(sch);
-	struct nss_bf_class_data *cl = (struct nss_bf_class_data *)arg;
-	struct nss_if_msg nim_detach;
-	struct nss_if_msg nim_attach;
-	struct nss_qdisc *nq_new = qdisc_priv(new);
-
-	nss_qdisc_info("Grafting class %p\n", sch);
-
-	if (cl == &q->root) {
-		nss_qdisc_error("%p: Can't graft root class\n", cl);
-		return -EINVAL;
-	}
-
-	if (new == NULL)
-		new = &noop_qdisc;
-
-	sch_tree_lock(sch);
-	*old = cl->qdisc;
-	sch_tree_unlock(sch);
-
-	/*
-	 * 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("%s:Grafting old: %p with new: %p\n", __func__, *old, new);
-	if (*old != &noop_qdisc) {
-		struct nss_qdisc *nq_old = (struct nss_qdisc *)qdisc_priv(*old);
-		nss_qdisc_info("%s: Detaching old: %p\n", __func__, *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_BF_GROUP_DETACH) < 0) {
-			return -EINVAL;
-		}
-	}
-
-	/*
-	 * If the new qdisc is a noop qdisc, we do not send down an attach command
-	 * to the NSS.
-	 */
-	if (new != &noop_qdisc) {
-		nss_qdisc_info("%s: Attaching new: %p\n", __func__, 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,
-				NSS_SHAPER_CONFIG_TYPE_BF_GROUP_ATTACH) < 0) {
-			return -EINVAL;
-		}
-	}
-
-	/*
-	 * Attach qdisc once it is done in the NSS
-	 */
-	sch_tree_lock(sch);
-	cl->qdisc = new;
-	sch_tree_unlock(sch);
-
-	nss_qdisc_info("Nssbf grafted");
-
-	return 0;
-}
-
-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);
-
-	/*
-	 * Since all nss_bf groups are leaf nodes, we can always
-	 * return the attached qdisc.
-	 */
-	return cl->qdisc;
-}
-
-static void nss_bf_qlen_notify(struct Qdisc *sch, unsigned long arg)
-{
-	nss_qdisc_info("bf qlen notify %p\n", sch);
-	/*
-	 * Gets called when qlen of child changes (Useful for deactivating)
-	 * Not useful for us here.
-	 */
-}
-
-static unsigned long nss_bf_get_class(struct Qdisc *sch, u32 classid)
-{
-	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);
-
-	if (cl != NULL)
-		atomic_add(1, &cl->nq.refcnt);
-
-	return (unsigned long)cl;
-}
-
-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);
-
-	/*
-	 * We are safe to destroy the qdisc if the reference count
-	 * goes down to 0.
-	 */
-	if (atomic_sub_return(1, &cl->nq.refcnt) == 0) {
-		nss_bf_destroy_class(sch, cl);
-	}
-}
-
-static int nss_bf_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
-		struct tcmsg *tcm)
-{
-	struct nss_bf_class_data *cl = (struct nss_bf_class_data *)arg;
-	struct nlattr *opts;
-	struct tc_nssbf_class_qopt qopt;
-
-	nss_qdisc_info("Dumping class %p of Qdisc %p\n", cl, sch);
-
-	qopt.burst = cl->burst;
-	qopt.rate = cl->rate;
-	qopt.mtu = cl->mtu;
-	qopt.quantum = cl->quantum;
-
-	/*
-	 * All bf group nodes are root nodes. i.e. they dont
-	 * have any mode bf groups attached beneath them.
-	 */
-	tcm->tcm_parent = TC_H_ROOT;
-	tcm->tcm_handle = cl->cl_common.classid;
-	tcm->tcm_info = cl->qdisc->handle;
-
-	opts = nla_nest_start(skb, TCA_OPTIONS);
-	if (opts == NULL)
-		goto nla_put_failure;
-	NLA_PUT(skb, TCA_NSSBF_CLASS_PARMS, sizeof(qopt), &qopt);
-	return nla_nest_end(skb, opts);
-
-nla_put_failure:
-	nla_nest_cancel(skb, opts);
-	return -EMSGSIZE;
-}
-
-static int nss_bf_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)arg;
-
-	if (gnet_stats_copy_basic(d, &nq->bstats) < 0 ||
-		gnet_stats_copy_queue(d, &nq->qstats) < 0) {
-		return -1;
-	}
-
-	return 0;
-}
-
-static void nss_bf_walk(struct Qdisc *sch, struct qdisc_walker *arg)
-{
-	struct nss_bf_sched_data *q = qdisc_priv(sch);
-	struct hlist_node *n;
-	struct nss_bf_class_data *cl;
-	unsigned int i;
-
-	nss_qdisc_info("In bf walk %p\n", sch);
-	if (arg->stop)
-		return;
-
-	for (i = 0; i < q->clhash.hashsize; i++) {
-		hlist_for_each_entry(cl, n, &q->clhash.hash[i],
-				cl_common.hnode) {
-			if (arg->count < arg->skip) {
-				arg->count++;
-				continue;
-			}
-			if (arg->fn(sch, (unsigned long)cl, arg) < 0) {
-				arg->stop = 1;
-				return;
-			}
-			arg->count++;
-		}
-	}
-}
-
-static int nss_bf_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_bf_sched_data *q = qdisc_priv(sch);
-	struct tc_nssbf_qopt *qopt;
-	int err;
-
-	nss_qdisc_info("Init bf qdisc %p\n", sch);
-	if (opt == NULL || nla_len(opt) < sizeof(*qopt))
-		return -EINVAL;
-	qopt = nla_data(opt);
-
-	q->defcls = qopt->defcls;
-	err = qdisc_class_hash_init(&q->clhash);
-	if (err < 0)
-		return err;
-
-	q->root.cl_common.classid = sch->handle;
-	q->root.qdisc = &noop_qdisc;
-
-	qdisc_class_hash_insert(&q->clhash, &q->root.cl_common);
-	qdisc_class_hash_grow(sch, &q->clhash);
-
-	/*
-	 * Initialize the NSSBF shaper in NSS
-	 */
-	if (nss_qdisc_init(sch, &q->nq, NSS_SHAPER_NODE_TYPE_BF, 0) < 0)
-		return -EINVAL;
-
-	nss_qdisc_info("Nssbf initialized - handle %x parent %x\n", sch->handle, sch->parent);
-
-	/*
-	 * Start the stats polling timer
-	 */
-	nss_qdisc_start_basic_stats_polling(&q->nq);
-
-	return 0;
-}
-
-static int nss_bf_change_qdisc(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_bf_sched_data *q = qdisc_priv(sch);
-	struct tc_nssbf_qopt *qopt;
-
-	/*
-	 * NSSBF does not care about the defcls, so we dont send down any
-	 * configuration parameter.
-	 */
-	nss_qdisc_info("Changing bf qdisc %p\n", sch);
-	if (opt == NULL || nla_len(opt) < sizeof(*qopt))
-		return -EINVAL;
-	qopt = nla_data(opt);
-
-	sch_tree_lock(sch);
-	q->defcls = qopt->defcls;
-	sch_tree_unlock(sch);
-
-	return 0;
-}
-
-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);
-}
-
-static void nss_bf_reset_qdisc(struct Qdisc *sch)
-{
-	struct nss_bf_sched_data *q = qdisc_priv(sch);
-	struct nss_bf_class_data *cl;
-	struct hlist_node *n;
-	unsigned int i;
-
-	for (i = 0; i < q->clhash.hashsize; i++) {
-		hlist_for_each_entry(cl, n, &q->clhash.hash[i], cl_common.hnode)
-			nss_bf_reset_class(cl);
-	}
-
-	nss_qdisc_reset(sch);
-	nss_qdisc_info("Nssbf qdisc resetted %p\n", sch);
-}
-
-static void nss_bf_destroy_qdisc(struct Qdisc *sch)
-{
-	struct nss_bf_sched_data *q = qdisc_priv(sch);
-	struct hlist_node *n, *next;
-	struct nss_bf_class_data *cl;
-	struct nss_if_msg nim;
-	unsigned int i;
-
-	/*
-	 * Destroy all the classes before the root qdisc is destroyed.
-	 */
-	for (i = 0; i < q->clhash.hashsize; i++) {
-		hlist_for_each_entry_safe(cl, n, next, &q->clhash.hash[i], cl_common.hnode) {
-
-			/*
-			 * If this is the root class, we dont have to destroy it. This will be taken
-			 * care of by the nss_bf_destroy() function.
-			 */
-			if (cl == &q->root) {
-				nss_qdisc_info("%s: We do not detach or destroy bf class %p here since this is "
-						"the qdisc %p\n", __func__, cl, sch);
-				continue;
-			}
-
-			/*
-			 * Reduce refcnt by 1 before destroying. This is to
-			 * ensure that polling of stat stops properly.
-			 */
-			atomic_sub(1, &cl->nq.refcnt);
-
-			/*
-			 * Detach class before destroying it. We dont check for noop qdisc here
-			 * since we do not attach anu such at init.
-			 */
-			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, &cl->nq, &nim,
-					NSS_SHAPER_CONFIG_TYPE_BF_DETACH) < 0) {
-				nss_qdisc_error("%s: Node detach failed for qdisc %x class %x\n",
-							__func__, cl->nq.qos_tag, q->nq.qos_tag);
-				return;
-			}
-
-			/*
-			 * Now we can destroy the class.
-			 */
-			nss_bf_destroy_class(sch, cl);
-		}
-	}
-	qdisc_class_hash_destroy(&q->clhash);
-
-	/*
-	 * Stop the polling of basic stats
-	 */
-	nss_qdisc_stop_basic_stats_polling(&q->nq);
-
-	/*
-	 * Now we can go ahead and destroy the qdisc.
-	 * Note: We dont have to detach ourself from our parent because this
-	 *	 will be taken care of by the graft call.
-	 */
-	nss_qdisc_destroy(&q->nq);
-	nss_qdisc_info("Nssbf destroyed %p\n", sch);
-}
-
-static int nss_bf_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
-{
-	struct nss_bf_sched_data *q = qdisc_priv(sch);
-	unsigned char *b = skb_tail_pointer(skb);
-	struct tc_nssbf_qopt qopt;
-	struct nlattr *nest;
-
-	nss_qdisc_info("In bf dump qdisc\n");
-
-	nest = nla_nest_start(skb, TCA_OPTIONS);
-	if (nest == NULL) {
-		goto nla_put_failure;
-	}
-
-	qopt.defcls = q->defcls;
-	NLA_PUT(skb, TCA_NSSBF_QDISC_PARMS, sizeof(qopt), &qopt);
-	nla_nest_end(skb, nest);
-
-	return skb->len;
-
- nla_put_failure:
-	nlmsg_trim(skb, b);
-	return -1;
-}
-
-static int nss_bf_enqueue(struct sk_buff *skb, struct Qdisc *sch)
-{
-	return nss_qdisc_enqueue(skb, sch);
-}
-
-static struct sk_buff *nss_bf_dequeue(struct Qdisc *sch)
-{
-	return nss_qdisc_dequeue(sch);
-}
-
-static unsigned int nss_bf_drop(struct Qdisc *sch)
-{
-	printk("In bf drop\n");
-	return nss_qdisc_drop(sch);
-}
-
-const struct Qdisc_class_ops nss_bf_class_ops = {
-	.change		= nss_bf_change_class,
-	.delete		= nss_bf_delete_class,
-	.graft		= nss_bf_graft_class,
-	.leaf		= nss_bf_leaf_class,
-	.qlen_notify	= nss_bf_qlen_notify,
-	.get		= nss_bf_get_class,
-	.put		= nss_bf_put_class,
-	.dump		= nss_bf_dump_class,
-	.dump_stats	= nss_bf_dump_class_stats,
-	.walk		= nss_bf_walk
-};
-
-struct Qdisc_ops nss_bf_qdisc_ops __read_mostly = {
-	.id		= "nssbf",
-	.init		= nss_bf_init_qdisc,
-	.change		= nss_bf_change_qdisc,
-	.reset		= nss_bf_reset_qdisc,
-	.destroy	= nss_bf_destroy_qdisc,
-	.dump		= nss_bf_dump_qdisc,
-	.enqueue	= nss_bf_enqueue,
-	.dequeue	= nss_bf_dequeue,
-	.peek		= qdisc_peek_dequeued,
-	.drop		= nss_bf_drop,
-	.cl_ops		= &nss_bf_class_ops,
-	.priv_size	= sizeof(struct nss_bf_sched_data),
-	.owner		= THIS_MODULE
-};
-
diff --git a/nss_qdisc/nss_bf.h b/nss_qdisc/nss_bf.h
deleted file mode 100644
index d7da15c..0000000
--- a/nss_qdisc/nss_bf.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-extern struct Qdisc_ops nss_bf_qdisc_ops;
diff --git a/nss_qdisc/nss_blackhole.c b/nss_qdisc/nss_blackhole.c
deleted file mode 100644
index 6a4e753..0000000
--- a/nss_qdisc/nss_blackhole.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_qdisc.h"
-
-/*
- * nss_blackhole private qdisc structure
- */
-struct nss_blackhole_sched_data {
-	struct nss_qdisc nq;	/* Common base class for all nss qdiscs */
-	u8 set_default;		/* Flag to set qdisc as default qdisc for enqueue */
-};
-
-/*
- * nss_blackhole_enqueue()
- *	Enqueue API for nss blackhole qdisc.
- */
-static int nss_blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch)
-{
-	return nss_qdisc_enqueue(skb, sch);
-}
-
-/*
- * nss_blackhole_dequeue()
- * 	Dequeue API for nss blackhole qdisc.
- */
-static struct sk_buff *nss_blackhole_dequeue(struct Qdisc *sch)
-{
-	return nss_qdisc_dequeue(sch);
-}
-
-/*
- * nss_blackhole_drop()
- *	The following function drops a packet from HLOS queue.
- *
- * Note, this does not drop packets from queues in the NSS. We do not support that.
- */
-static unsigned int nss_blackhole_drop(struct Qdisc *sch)
-{
-	nss_qdisc_info("%s: qdisc %x dropping\n", __func__, sch->handle);
-	return nss_qdisc_drop(sch);
-}
-
-/*
- * nss_blackhole_reset()
- *	Resets the nss blackhole qdisc.
- */
-static void nss_blackhole_reset(struct Qdisc *sch)
-{
-	nss_qdisc_info("%s: qdisc %x resetting\n", __func__, sch->handle);
-	nss_qdisc_reset(sch);
-}
-
-/*
- * nss_blackhole_destroy()
- *	Destroys the nss blackhole qdisc.
- */
-static void nss_blackhole_destroy(struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)qdisc_priv(sch);
-
-	/*
-	 * Stop the polling of basic stats
-	 */
-	nss_qdisc_stop_basic_stats_polling(nq);
-
-	nss_qdisc_info("%s: destroying qdisc %x\n", __func__, sch->handle);
-	nss_qdisc_destroy(nq);
-}
-
-/*
- * nss_blackhole policy structure
- */
-static const struct nla_policy nss_blackhole_policy[TCA_NSSBLACKHOLE_MAX + 1] = {
-	[TCA_NSSBLACKHOLE_PARMS] = { .len = sizeof(struct tc_nssblackhole_qopt) },
-};
-
-/*
- * nss_blackhole_change()
- *	Function call used to configure the parameters of the nss blackhole qdisc.
- */
-static int nss_blackhole_change(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_blackhole_sched_data *q;
-	struct nlattr *na[TCA_NSSBLACKHOLE_MAX + 1];
-	struct tc_nssblackhole_qopt *qopt;
-	int err;
-	struct nss_if_msg nim;
-
-	q = qdisc_priv(sch);
-
-	if (opt == NULL) {
-		return -EINVAL;
-	}
-
-	err = nla_parse_nested(na, TCA_NSSBLACKHOLE_MAX, opt, nss_blackhole_policy);
-	if (err < 0)
-		return err;
-
-	if (na[TCA_NSSBLACKHOLE_PARMS] == NULL)
-		return -EINVAL;
-
-	qopt = nla_data(na[TCA_NSSBLACKHOLE_PARMS]);
-
-	/*
-	 * Required for basic stats display
-	 */
-	sch->limit = 0;
-
-	q->set_default = qopt->set_default;
-	nss_qdisc_info("%s: qdisc set_default = %u\n", __func__, qopt->set_default);
-
-	/*
-	 * Underneath nss_bloackhole uses a fifo in the NSS. This is why we are sending down a configuration
-	 * message to a fifo node. There are no blackhole shaper in the NSS as yet.
-	 *
-	 * Note: We simply set the limit of fifo to zero to get the blackhole behavior.
-	 */
-	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.fifo_param.limit = 0;
-	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_FIFO_CHANGE_PARAM) < 0) {
-		nss_qdisc_error("%s: qdisc %x configuration failed\n", __func__, sch->handle);
-		return -EINVAL;
-	}
-
-	/*
-	 * There is nothing we need to do if the qdisc is not
-	 * set as default qdisc.
-	 */
-	if (q->set_default == 0)
-		return 0;
-
-	/*
-	 * Set this qdisc to be the default qdisc for enqueuing packets.
-	 */
-	if (nss_qdisc_set_default(&q->nq) < 0) {
-		nss_qdisc_error("%s: qdisc %x set_default failed\n", __func__, sch->handle);
-		return -EINVAL;
-	}
-
-	nss_qdisc_info("%s: qdisc %x set as default\n", __func__, q->nq.qos_tag);
-	return 0;
-}
-
-/*
- * nss_blackhole_init()
- *	Initializes a nss blackhole qdisc.
- */
-static int nss_blackhole_init(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-
-	if (opt == NULL)
-		return -EINVAL;
-
-	nss_qdisc_info("%s: qdisc %x initializing\n", __func__, sch->handle);
-	nss_blackhole_reset(sch);
-
-	if (nss_qdisc_init(sch, nq, NSS_SHAPER_NODE_TYPE_FIFO, 0) < 0)
-		return -EINVAL;
-
-	nss_qdisc_info("%s: qdisc %x initialized with parent %x\n", __func__, sch->handle, sch->parent);
-	if (nss_blackhole_change(sch, opt) < 0) {
-		nss_qdisc_destroy(nq);
-		return -EINVAL;
-	}
-
-	/*
-	 * Start the stats polling timer
-	 */
-	nss_qdisc_start_basic_stats_polling(nq);
-
-	return 0;
-}
-
-/*
- * nss_blackhole_dump()
- *	Dumps qdisc parameters for nss blackhole.
- */
-static int nss_blackhole_dump(struct Qdisc *sch, struct sk_buff *skb)
-{
-	struct nss_blackhole_sched_data *q;
-	struct nlattr *opts = NULL;
-	struct tc_nssblackhole_qopt opt;
-
-	nss_qdisc_info("%s: qdisc %x dumping!\n", __func__, sch->handle);
-
-	q = qdisc_priv(sch);
-	if (q == NULL) {
-		return -1;
-	}
-
-	opt.set_default = q->set_default;
-
-	opts = nla_nest_start(skb, TCA_OPTIONS);
-	if (opts == NULL) {
-		goto nla_put_failure;
-	}
-	if (nla_put(skb, TCA_NSSBLACKHOLE_PARMS, sizeof(opt), &opt))
-		goto nla_put_failure;
-
-	return nla_nest_end(skb, opts);
-
-nla_put_failure:
-	nla_nest_cancel(skb, opts);
-	return -EMSGSIZE;
-}
-
-/*
- * nss_blackhole_peek()
- *	Peeks the first packet in queue for this qdisc.
- *
- * Note: This just peeks at the first packet in what is present in HLOS. This does not
- * perform an actual peak into the queue in the NSS. Given the async delay between
- * the processors, there is less use in implementing this function.
- */
-static struct sk_buff *nss_blackhole_peek(struct Qdisc *sch)
-{
-	nss_qdisc_info("%s: qdisc %x peeked\n", __func__, sch->handle);
-	return nss_qdisc_peek(sch);
-}
-
-/*
- * Registration structure for nss blackhole qdisc
- */
-struct Qdisc_ops nss_blackhole_qdisc_ops __read_mostly = {
-	.id		=	"nssblackhole",
-	.priv_size	=	sizeof(struct nss_blackhole_sched_data),
-	.enqueue	=	nss_blackhole_enqueue,
-	.dequeue	=	nss_blackhole_dequeue,
-	.peek		=	nss_blackhole_peek,
-	.drop		=	nss_blackhole_drop,
-	.init		=	nss_blackhole_init,
-	.reset		=	nss_blackhole_reset,
-	.destroy	=	nss_blackhole_destroy,
-	.change		=	nss_blackhole_change,
-	.dump		=	nss_blackhole_dump,
-	.owner		=	THIS_MODULE,
-};
diff --git a/nss_qdisc/nss_blackhole.h b/nss_qdisc/nss_blackhole.h
deleted file mode 100644
index 58dce8b..0000000
--- a/nss_qdisc/nss_blackhole.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-extern struct Qdisc_ops nss_blackhole_qdisc_ops;
diff --git a/nss_qdisc/nss_codel.c b/nss_qdisc/nss_codel.c
deleted file mode 100644
index 36517d7..0000000
--- a/nss_qdisc/nss_codel.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_qdisc.h"
-
-struct nss_codel_stats {
-	u32 peak_queue_delay;		/* Peak delay experienced by a dequeued packet */
-	u32 peak_drop_delay;		/* Peak delay experienced by a packet that is dropped */
-};
-
-struct nss_codel_sched_data {
-	struct nss_qdisc nq;	/* Common base class for all nss qdiscs */
-	u32 target;			/* Acceptable value of queue delay */
-	u32 limit;			/* Length of queue */
-	u32 interval;			/* Monitoring interval */
-	u8 set_default;			/* Flag to set qdisc as default qdisc for enqueue */
-	struct nss_codel_stats stats;	/* Contains nss_codel related stats */
-};
-
-static int nss_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch)
-{
-	return nss_qdisc_enqueue(skb, sch);
-}
-
-static struct sk_buff *nss_codel_dequeue(struct Qdisc *sch)
-{
-	return nss_qdisc_dequeue(sch);
-}
-
-static unsigned int nss_codel_drop(struct Qdisc *sch)
-{
-	return nss_qdisc_drop(sch);
-}
-
-static void nss_codel_reset(struct Qdisc *sch)
-{
-	nss_qdisc_info("nss_codel resetting!");
-	nss_qdisc_reset(sch);
-}
-
-static void nss_codel_destroy(struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-	/*
-	 * Stop the polling of basic stats
-	 */
-	nss_qdisc_stop_basic_stats_polling(nq);
-	nss_qdisc_destroy(nq);
-	nss_qdisc_info("nss_codel destroyed");
-}
-
-static const struct nla_policy nss_codel_policy[TCA_NSSCODEL_MAX + 1] = {
-	[TCA_NSSCODEL_PARMS] = { .len = sizeof(struct tc_nsscodel_qopt) },
-};
-
-static int nss_codel_change(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_codel_sched_data *q;
-	struct nlattr *na[TCA_NSSCODEL_MAX + 1];
-	struct tc_nsscodel_qopt *qopt;
-	struct nss_if_msg nim;
-	int err;
-	struct net_device *dev = qdisc_dev(sch);
-
-	q = qdisc_priv(sch);
-
-	if (opt == NULL)
-		return -EINVAL;
-
-	err = nla_parse_nested(na, TCA_NSSCODEL_MAX, opt, nss_codel_policy);
-	if (err < 0)
-		return err;
-
-	if (na[TCA_NSSCODEL_PARMS] == NULL)
-		return -EINVAL;
-
-	qopt = nla_data(na[TCA_NSSCODEL_PARMS]);
-
-	if (!qopt->target || !qopt->interval) {
-		nss_qdisc_error("nss_codel requires a non-zero value for target "
-				"and interval\n");
-		return -EINVAL;
-	}
-
-	if (!qopt->limit)
-		qopt->limit = dev->tx_queue_len ? : 1;
-
-	q->target = qopt->target;
-	q->limit = qopt->limit;
-	q->interval = qopt->interval;
-	q->set_default = qopt->set_default;
-
-	/*
-	 * Required for basic stats display
-	 */
-	sch->limit = qopt->limit;
-
-	nss_qdisc_info("Target:%u Limit:%u Interval:%u set_default = %u\n",
-		q->target, q->limit, q->interval, qopt->set_default);
-
-
-	nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
-	/*
-	 * Target and interval time needs to be provided in milliseconds
-	 * (tc provides us the time in mircoseconds and therefore we divide by 1000)
-	 */
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.codel_param.qlen_max = q->limit;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.codel_param.cap.interval = q->interval/1000;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.codel_param.cap.target = q->target/1000;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.codel_param.cap.mtu = psched_mtu(dev);
-	nss_qdisc_info("%s: MTU size of interface %s is %u bytes\n", __func__, dev->name,
-			nim.msg.shaper_configure.config.msg.shaper_node_config.snc.codel_param.cap.mtu);
-
-	if (nss_qdisc_configure(&q->nq, &nim,
-				NSS_SHAPER_CONFIG_TYPE_CODEL_CHANGE_PARAM) < 0) {
-		return -EINVAL;
-	}
-
-	/*
-	 * There is nothing we need to do if the qdisc is not
-	 * set as default qdisc.
-	 */
-	if (!q->set_default)
-		return 0;
-
-	/*
-	 * Set this qdisc to be the default qdisc for enqueuing packets.
-	 */
-	if (nss_qdisc_set_default(&q->nq) < 0)
-		return -EINVAL;
-
-	return 0;
-}
-
-static int nss_codel_init(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-
-	if (opt == NULL)
-		return -EINVAL;
-
-	nss_codel_reset(sch);
-	if (nss_qdisc_init(sch, nq, NSS_SHAPER_NODE_TYPE_CODEL, 0) < 0)
-		return -EINVAL;
-
-	if (nss_codel_change(sch, opt) < 0) {
-		nss_qdisc_destroy(nq);
-		return -EINVAL;
-	}
-
-	/*
-	 * Start the stats polling timer
-	 */
-	nss_qdisc_start_basic_stats_polling(nq);
-
-	return 0;
-}
-
-static int nss_codel_dump(struct Qdisc *sch, struct sk_buff *skb)
-{
-	struct nss_codel_sched_data *q;
-	struct nlattr *opts = NULL;
-	struct tc_nsscodel_qopt opt;
-
-	nss_qdisc_info("NssCodel Dumping!");
-
-	q = qdisc_priv(sch);
-	if (q == NULL) {
-		return -1;
-	}
-
-	opt.target = q->target;
-	opt.limit = q->limit;
-	opt.interval = q->interval;
-	opt.set_default = q->set_default;
-	opts = nla_nest_start(skb, TCA_OPTIONS);
-	if (opts == NULL) {
-		goto nla_put_failure;
-	}
-	if (nla_put(skb, TCA_NSSCODEL_PARMS, sizeof(opt), &opt))
-		goto nla_put_failure;
-
-	return nla_nest_end(skb, opts);
-
-nla_put_failure:
-	nla_nest_cancel(skb, opts);
-	return -EMSGSIZE;
-}
-
-static int nss_codel_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
-{
-	struct nss_codel_sched_data *q = qdisc_priv(sch);
-	struct tc_nsscodel_xstats st = {
-		.peak_queue_delay = q->nq.basic_stats_latest.packet_latency_peak_msec_dequeued,
-		.peak_drop_delay = q->nq.basic_stats_latest.packet_latency_peak_msec_dropped,
-	};
-
-	return gnet_stats_copy_app(d, &st, sizeof(st));
-}
-
-static struct sk_buff *nss_codel_peek(struct Qdisc *sch)
-{
-	nss_qdisc_info("Nsscodel Peeking");
-	return nss_qdisc_peek(sch);
-}
-
-
-struct Qdisc_ops nss_codel_qdisc_ops __read_mostly = {
-	.id		=	"nsscodel",
-	.priv_size	=	sizeof(struct nss_codel_sched_data),
-	.enqueue	=	nss_codel_enqueue,
-	.dequeue	=	nss_codel_dequeue,
-	.peek		=	nss_codel_peek,
-	.drop		=	nss_codel_drop,
-	.init		=	nss_codel_init,
-	.reset		=	nss_codel_reset,
-	.destroy	=	nss_codel_destroy,
-	.change		=	nss_codel_change,
-	.dump		=	nss_codel_dump,
-	.dump_stats	=	nss_codel_dump_stats,
-	.owner		=	THIS_MODULE,
-};
diff --git a/nss_qdisc/nss_codel.h b/nss_qdisc/nss_codel.h
deleted file mode 100644
index d01643b..0000000
--- a/nss_qdisc/nss_codel.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-extern struct Qdisc_ops nss_codel_qdisc_ops;
diff --git a/nss_qdisc/nss_fifo.c b/nss_qdisc/nss_fifo.c
deleted file mode 100644
index 7f4ab45..0000000
--- a/nss_qdisc/nss_fifo.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_qdisc.h"
-
-struct nss_fifo_sched_data {
-	struct nss_qdisc nq;	/* Common base class for all nss qdiscs */
-	u32 limit;			/* Queue length in packets */
-					/* TODO: Support for queue length in bytes */
-	u8 set_default;			/* Flag to set qdisc as default qdisc for enqueue */
-};
-
-static int nss_fifo_enqueue(struct sk_buff *skb, struct Qdisc *sch)
-{
-	return nss_qdisc_enqueue(skb, sch);
-}
-
-static struct sk_buff *nss_fifo_dequeue(struct Qdisc *sch)
-{
-	return nss_qdisc_dequeue(sch);
-}
-
-static unsigned int nss_fifo_drop(struct Qdisc *sch)
-{
-	nss_qdisc_info("nss_fifo dropping");
-	return nss_qdisc_drop(sch);
-}
-
-static void nss_fifo_reset(struct Qdisc *sch)
-{
-	nss_qdisc_info("nss_fifo resetting!");
-	nss_qdisc_reset(sch);
-}
-
-static void nss_fifo_destroy(struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)qdisc_priv(sch);
-
-	/*
-	 * Stop the polling of basic stats
-	 */
-	nss_qdisc_stop_basic_stats_polling(nq);
-
-	nss_qdisc_destroy(nq);
-	nss_qdisc_info("nss_fifo destroyed");
-}
-
-static const struct nla_policy nss_fifo_policy[TCA_NSSFIFO_MAX + 1] = {
-	[TCA_NSSFIFO_PARMS] = { .len = sizeof(struct tc_nssfifo_qopt) },
-};
-
-static int nss_fifo_change(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_fifo_sched_data *q;
-	struct nlattr *na[TCA_NSSFIFO_MAX + 1];
-	struct tc_nssfifo_qopt *qopt;
-	int err;
-	struct nss_if_msg nim;
-
-	q = qdisc_priv(sch);
-
-	if (opt == NULL) {
-		return -EINVAL;
-	}
-
-	err = nla_parse_nested(na, TCA_NSSFIFO_MAX, opt, nss_fifo_policy);
-	if (err < 0)
-		return err;
-
-	if (na[TCA_NSSFIFO_PARMS] == NULL)
-		return -EINVAL;
-
-	qopt = nla_data(na[TCA_NSSFIFO_PARMS]);
-
-	if (!qopt->limit)
-		qopt->limit = qdisc_dev(sch)->tx_queue_len ? : 1;
-
-	q->limit = qopt->limit;
-
-	/*
-	 * Required for basic stats display
-	 */
-	sch->limit = qopt->limit;
-
-	q->set_default = qopt->set_default;
-	nss_qdisc_info("%s: limit:%u set_default:%u\n", __func__, qopt->limit, qopt->set_default);
-
-	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.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_FIFO_CHANGE_PARAM) < 0) {
-		nss_qdisc_error("%s: nss_fifo %p configuration failed\n", __func__, sch);
-		return -EINVAL;
-	}
-
-	/*
-	 * There is nothing we need to do if the qdisc is not
-	 * set as default qdisc.
-	 */
-	if (q->set_default == 0)
-		return 0;
-
-	/*
-	 * Set this qdisc to be the default qdisc for enqueuing packets.
-	 */
-	if (nss_qdisc_set_default(&q->nq) < 0) {
-		nss_qdisc_error("%s: nss_fifo %p set_default failed\n", __func__, sch);
-		return -EINVAL;
-	}
-
-	nss_qdisc_info("%s: nss_fifo queue (qos_tag:%u) set as default\n", __func__, q->nq.qos_tag);
-	return 0;
-}
-
-static int nss_fifo_init(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-
-	if (opt == NULL)
-		return -EINVAL;
-
-	nss_qdisc_info("Initializing Fifo - type %d\n", NSS_SHAPER_NODE_TYPE_FIFO);
-	nss_fifo_reset(sch);
-
-	if (nss_qdisc_init(sch, nq, NSS_SHAPER_NODE_TYPE_FIFO, 0) < 0)
-		return -EINVAL;
-
-	nss_qdisc_info("NSS fifo initialized - handle %x parent %x\n", sch->handle, sch->parent);
-	if (nss_fifo_change(sch, opt) < 0) {
-		nss_qdisc_destroy(nq);
-		return -EINVAL;
-	}
-
-	/*
-	 * Start the stats polling timer
-	 */
-	nss_qdisc_start_basic_stats_polling(nq);
-
-	return 0;
-}
-
-static int nss_fifo_dump(struct Qdisc *sch, struct sk_buff *skb)
-{
-	struct nss_fifo_sched_data *q;
-	struct nlattr *opts = NULL;
-	struct tc_nssfifo_qopt opt;
-
-	nss_qdisc_info("Nssfifo Dumping!");
-
-	q = qdisc_priv(sch);
-	if (q == NULL) {
-		return -1;
-	}
-
-	opt.limit = q->limit;
-	opt.set_default = q->set_default;
-
-	opts = nla_nest_start(skb, TCA_OPTIONS);
-	if (opts == NULL) {
-		goto nla_put_failure;
-	}
-	if (nla_put(skb, TCA_NSSFIFO_PARMS, sizeof(opt), &opt))
-		goto nla_put_failure;
-
-	return nla_nest_end(skb, opts);
-
-nla_put_failure:
-	nla_nest_cancel(skb, opts);
-	return -EMSGSIZE;
-}
-
-static struct sk_buff *nss_fifo_peek(struct Qdisc *sch)
-{
-	nss_qdisc_info("Nssfifo Peeking");
-	return nss_qdisc_peek(sch);
-}
-
-struct Qdisc_ops nss_pfifo_qdisc_ops __read_mostly = {
-	.id		=	"nsspfifo",
-	.priv_size	=	sizeof(struct nss_fifo_sched_data),
-	.enqueue	=	nss_fifo_enqueue,
-	.dequeue	=	nss_fifo_dequeue,
-	.peek		=	nss_fifo_peek,
-	.drop		=	nss_fifo_drop,
-	.init		=	nss_fifo_init,
-	.reset		=	nss_fifo_reset,
-	.destroy	=	nss_fifo_destroy,
-	.change		=	nss_fifo_change,
-	.dump		=	nss_fifo_dump,
-	.owner		=	THIS_MODULE,
-};
-
-struct Qdisc_ops nss_bfifo_qdisc_ops __read_mostly = {
-	.id		=	"nssbfifo",
-	.priv_size	=	sizeof(struct nss_fifo_sched_data),
-	.enqueue	=	nss_fifo_enqueue,
-	.dequeue	=	nss_fifo_dequeue,
-	.peek		=	nss_fifo_peek,
-	.drop		=	nss_fifo_drop,
-	.init		=	nss_fifo_init,
-	.reset		=	nss_fifo_reset,
-	.destroy	=	nss_fifo_destroy,
-	.change		=	nss_fifo_change,
-	.dump		=	nss_fifo_dump,
-	.owner		=	THIS_MODULE,
-};
diff --git a/nss_qdisc/nss_fifo.h b/nss_qdisc/nss_fifo.h
deleted file mode 100644
index 3635dfe..0000000
--- a/nss_qdisc/nss_fifo.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-extern struct Qdisc_ops nss_pfifo_qdisc_ops;
-extern struct Qdisc_ops nss_bfifo_qdisc_ops;
diff --git a/nss_qdisc/nss_htb.c b/nss_qdisc/nss_htb.c
deleted file mode 100644
index 263f631..0000000
--- a/nss_qdisc/nss_htb.c
+++ /dev/null
@@ -1,919 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_qdisc.h"
-
-#define NSS_HTB_MAX_PRIORITY 4
-
-/*
- * nss_htb class instance structure
- */
-struct nss_htb_class_data {
-	struct nss_qdisc nq;			/* Base class used by nss_qdisc */
-	struct Qdisc_class_common sch_common;	/* Common class structure for scheduler use */
-	struct nss_htb_class_data *parent;	/* Pointer to our parent class */
-	struct Qdisc *qdisc;			/* Child qdisc, used by leaf classes */
-	int children;				/* Count of number of attached child classes */
-	bool is_leaf;				/* True if leaf class */
-
-	u32 rate;				/* Allowed bandwidth for this class */
-	u32 burst;				/* Allowed burst for this class */
-	u32 crate;				/* Ceil bandwidth for this class */
-	u32 cburst;				/* Ceil burst for this class */
-	u32 quantum;				/* Quantum allocation for DRR */
-	u32 priority;				/* Priority value of this class */
-	u32 overhead;				/* Overhead in bytes to be added for each packet */
-};
-
-/*
- * nss_htb qdisc instance structure
- */
-struct nss_htb_sched_data {
-	struct nss_qdisc nq;		/* Base class used by nss_qdisc */
-	u16 r2q;			/* The rate to quantum conversion ratio */
-	struct nss_htb_class_data root;	/* Root class */
-	struct Qdisc_class_hash clhash;	/* Class hash */
-};
-
-/*
- * nss_htb_find_class()
- *	Returns a pointer to class if classid matches with a class under this qdisc.
- */
-static inline struct nss_htb_class_data *nss_htb_find_class(u32 classid, struct Qdisc *sch)
-{
-	struct nss_htb_sched_data *q = qdisc_priv(sch);
-	struct Qdisc_class_common *clc;
-	clc = qdisc_class_find(&q->clhash, classid);
-	if (clc == NULL) {
-		nss_qdisc_warning("%s: cannot find class with classid %x in qdisc %x hash\n",
-					__func__, classid, sch->handle);
-		return NULL;
-	}
-	return container_of(clc, struct nss_htb_class_data, sch_common);
-}
-
-/*
- * nss_htb_policy structure
- */
-static const struct nla_policy nss_htb_policy[TCA_NSSHTB_MAX + 1] = {
-	[TCA_NSSHTB_CLASS_PARMS] = { .len = sizeof(struct tc_nsshtb_class_qopt) },
-};
-
-/*
- * nss_htb_change_class()
- *	Configures a new class.
- */
-static int nss_htb_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
-		  struct nlattr **tca, unsigned long *arg)
-{
-	struct nss_htb_sched_data *q = qdisc_priv(sch);
-	struct nss_htb_class_data *cl = (struct nss_htb_class_data *)*arg;
-	struct nss_htb_class_data *parent;
-	struct nss_qdisc *nq_parent;
-	struct nlattr *opt = tca[TCA_OPTIONS];
-	struct nlattr *na[TCA_NSSHTB_MAX + 1];
-	struct tc_nsshtb_class_qopt *qopt;
-	int err;
-	struct nss_if_msg nim_config;
-	struct net_device *dev = qdisc_dev(sch);
-	unsigned int mtu = psched_mtu(dev);
-
-	nss_qdisc_trace("%s: configuring htb class %x of qdisc %x\n", __func__, classid, sch->handle);
-
-	if (opt == NULL) {
-		nss_qdisc_error("%s: passing null opt for configuring htb class %x\n", __func__, classid);
-		return -EINVAL;
-	}
-
-	err = nla_parse_nested(na, TCA_NSSHTB_MAX, opt, nss_htb_policy);
-	if (err < 0) {
-		nss_qdisc_error("%s: failed to parse configuration parameters for htb class %x\n",
-					__func__, classid);
-		return err;
-	}
-
-	if (na[TCA_NSSHTB_CLASS_PARMS] == NULL) {
-		nss_qdisc_error("%s: parsed values have no content - htb class %x\n", __func__, classid);
-		return -EINVAL;
-	}
-
-	parent = (parentid == TC_H_ROOT) ? NULL : nss_htb_find_class(parentid, sch);
-
-	/*
-	 * The parent could be the htb qdisc, or a class. We set nq_parent pointer
-	 * accordingly.
-	 */
-	if (parent) {
-		nq_parent = &parent->nq;
-	} else {
-		nq_parent = &q->nq;
-	}
-
-	/*
-	 * If class with a given classid is not found, we allocate a new one
-	 */
-	if (!cl) {
-		struct nss_if_msg nim_attach;
-
-		/*
-		 * check for valid classid
-		 */
-		if (!classid || TC_H_MAJ(classid ^ sch->handle) || nss_htb_find_class(classid, sch)) {
-			goto failure;
-		}
-
-		/*
-		 * TODO: We are not setting a limit on the tree depth
-		 * do we have to set one?
-		 */
-
-		nss_qdisc_trace("%s: htb class %x not found. Allocating a new class.\n", __func__, classid);
-		cl = kzalloc(sizeof(struct nss_htb_class_data), GFP_KERNEL);
-
-		if (!cl) {
-			nss_qdisc_error("%s: class allocation failed for classid %x\n", __func__, classid);
-			goto failure;
-		}
-
-		nss_qdisc_trace("%s: htb class %x allocated - addr %p\n", __func__, classid, cl);
-		cl->parent = parent;
-		cl->sch_common.classid = classid;
-
-		/*
-		 * Set this class as leaf. If a new class is attached as
-		 * child, it will set this value to false during the attach
-		 * process.
-		 */
-		cl->is_leaf = true;
-
-		/*
-		 * We make the child qdisc a noop qdisc, and
-		 * set reference count to 1. This is important,
-		 * reference count should not be 0.
-		 */
-		cl->qdisc = &noop_qdisc;
-		atomic_set(&cl->nq.refcnt, 1);
-		*arg = (unsigned long)cl;
-
-		nss_qdisc_trace("%s: adding class %x to qdisc %x\n", __func__, classid, sch->handle);
-
-		/*
-		 * This is where a class gets initialized. Classes do not have a init function
-		 * that is registered to Linux. Therefore we initialize the NSSHTB_GROUP shaper
-		 * here.
-		 */
-		if (nss_qdisc_init(sch, &cl->nq, NSS_SHAPER_NODE_TYPE_HTB_GROUP, classid) < 0) {
-			nss_qdisc_error("%s: nss_init for htb class %x failed\n", __func__, classid);
-			goto failure;
-		}
-
-		/*
-		 * Set qos_tag of parent to which the class needs to e attached to.
-		 */
-		nim_attach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = nq_parent->qos_tag;
-
-		/*
-		 * Set the child to be this class.
-		 */
-		nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_attach.child_qos_tag = cl->nq.qos_tag;
-
-		/*
-		 * Send node_attach command down to the NSS
-		 */
-		if (nss_qdisc_node_attach(nq_parent, &cl->nq, &nim_attach,
-				NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_ATTACH) < 0) {
-			nss_qdisc_error("%s: nss_attach for class %x failed\n", __func__, classid);
-			nss_qdisc_destroy(&cl->nq);
-			goto failure;
-		}
-
-		/*
-		 * We have successfully attached ourselves in the NSS. We can therefore
-		 * add this class to qdisc hash tree, and increment parent's child count
-		 * (if parent exists)
-		 */
-		sch_tree_lock(sch);
-		qdisc_class_hash_insert(&q->clhash, &cl->sch_common);
-		if (parent) {
-			parent->children++;
-
-			/*
-			 * Parent can no longer be leaf. Set flag to false.
-			 */
-			parent->is_leaf = false;
-		}
-		sch_tree_unlock(sch);
-
-		/*
-		 * Hash grow should not come within the tree lock
-		 */
-		qdisc_class_hash_grow(sch, &q->clhash);
-
-		/*
-		 * Start the stats polling timer
-		 */
-		nss_qdisc_start_basic_stats_polling(&cl->nq);
-
-		nss_qdisc_trace("%s: class %x successfully allocated and initialized\n", __func__, classid);
-	}
-
-	qopt = nla_data(na[TCA_NSSHTB_CLASS_PARMS]);
-
-	if (qopt->rate && !qopt->burst) {
-		nss_qdisc_error("%s: burst needed if rate is non zero - class %x\n", __func__, classid);
-		return -EINVAL;
-	}
-
-	if (!qopt->crate || !qopt->cburst) {
-		nss_qdisc_error("%s: crate and cburst need to be non zero - class %x\n",
-					__func__, classid);
-		return -EINVAL;
-	}
-
-	if (!(qopt->priority < NSS_HTB_MAX_PRIORITY)) {
-		nss_qdisc_error("%s: priority %u of htb class %x greater than max prio %u",
-					__func__, qopt->priority, classid, NSS_HTB_MAX_PRIORITY);
-		return -EINVAL;
-	}
-
-	sch_tree_lock(sch);
-	cl->rate = qopt->rate;
-	cl->burst = qopt->burst;
-	cl->crate = qopt->crate;
-	cl->cburst = qopt->cburst;
-	cl->overhead = qopt->overhead;
-	cl->quantum = qopt->quantum;
-	cl->priority = qopt->priority;
-
-	/*
-	 * If quantum value is not provided, set it to
-	 * the interface's MTU value.
-	 */
-	if (!cl->quantum) {
-		/*
-		 * If quantum was not provided, we have two options.
-		 * One, use r2q and rate to figure out the quantum. Else,
-		 * use the interface's MTU as the value of quantum.
-		 */
-		if (q->r2q && cl->rate) {
-			cl->quantum = (cl->rate / q->r2q) / 8;
-			nss_qdisc_info("%s: quantum not provided for htb class %x on interface %s\n"
-					"Setting quantum to %uB based on r2q %u and rate %uBps\n",
-					__func__, classid, dev->name, cl->quantum, q->r2q, cl->rate / 8);
-		} else {
-			cl->quantum = mtu;
-			nss_qdisc_info("%s: quantum value not provided for htb class %x on interface %s\n"
-					"Setting quantum to MTU %uB\n", __func__, classid, dev->name, cl->quantum);
-		}
-	}
-
-	sch_tree_unlock(sch);
-
-	/*
-	 * Fill information that needs to be sent down to the NSS for configuring the
-	 * htb class.
-	 */
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.quantum = cl->quantum;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.priority = cl->priority;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.overhead = cl->overhead;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.rate_police.rate = cl->rate;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.rate_police.burst = cl->burst;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.rate_police.max_size = mtu;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.rate_police.short_circuit = false;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.rate_ceil.rate = cl->crate;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.rate_ceil.burst = cl->cburst;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.rate_ceil.max_size = mtu;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_param.rate_ceil.short_circuit = false;
-
-	nss_qdisc_info("%s: htb class %x - rate = %ubps burst = %ubytes crate = %ubps cburst = %ubytes MTU = %ubytes "
-			"quantum = %ubytes priority = %u\n", __func__, classid, cl->rate, cl->burst, cl->crate,
-			cl->cburst, mtu, cl->quantum, cl->priority);
-
-	/*
-	 * Send configure command to the NSS
-	 */
-	if (nss_qdisc_configure(&cl->nq, &nim_config,
-			NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM) < 0) {
-		nss_qdisc_error("%s: failed to send configure message for htb class %x\n", __func__, classid);
-		return -EINVAL;
-	}
-
-	nss_qdisc_info("%s: htb class %x configured successfully\n", __func__, classid);
-	return 0;
-
-failure:
-	if (cl) {
-		kfree(cl);
-	}
-	return -EINVAL;
-}
-
-/*
- * nss_htb_destroy_class()
- *	Detaches all child nodes and destroys the class.
- */
-static void nss_htb_destroy_class(struct Qdisc *sch, struct nss_htb_class_data *cl)
-{
-	struct nss_htb_sched_data *q __attribute__((unused)) = qdisc_priv(sch);
-	struct nss_if_msg nim;
-	struct nss_qdisc *nq_child;
-
-	nss_qdisc_trace("%s: destroying htb class %x from qdisc %x\n", __func__,
-				cl->nq.qos_tag, sch->handle);
-
-	/*
-	 * We always have to detach the child qdisc, before destroying it.
-	 */
-	if (cl->qdisc != &noop_qdisc) {
-		nq_child = qdisc_priv(cl->qdisc);
-		nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
-		nim.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_detach.child_qos_tag = nq_child->qos_tag;
-		if (nss_qdisc_node_detach(&cl->nq, nq_child, &nim,
-				NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
-			nss_qdisc_error("%s: failed to detach child %x from class %x\n",
-					__func__, cl->qdisc->handle, q->nq.qos_tag);
-			return;
-		}
-	}
-
-	/*
-	 * And now we destroy the child.
-	 */
-	qdisc_destroy(cl->qdisc);
-
-	/*
-	 * Stop the stats polling timer and free class
-	 */
-	nss_qdisc_stop_basic_stats_polling(&cl->nq);
-
-	/*
-	 * Destroy the shaper in NSS
-	 */
-	nss_qdisc_destroy(&cl->nq);
-
-	/*
-	 * Free class
-	 */
-	kfree(cl);
-}
-
-/*
- * nss_htb_delete_class()
- *	Detaches a class from operation, but does not destroy it.
- */
-static int nss_htb_delete_class(struct Qdisc *sch, unsigned long arg)
-{
-	struct nss_htb_sched_data *q = qdisc_priv(sch);
-	struct nss_htb_class_data *cl = (struct nss_htb_class_data *)arg;
-	struct nss_if_msg nim;
-	int refcnt;
-
-	/*
-	 * If the class still has child nodes, then we do not
-	 * support deleting it.
-	 */
-	if (cl->children) {
-		return -EBUSY;
-	}
-
-	/*
-	 * Check if we are root class or not (parent pointer is NULL for a root class)
-	 */
-	if (cl->parent) {
-
-		/*
-		 * The htb class to be detached has a parent class (i.e. not the root class),
-		 * so we need to send a detach msg to its parent class.
-		 */
-		nss_qdisc_info("%s: detaching from parent htb class %x ", __func__, cl->parent->nq.qos_tag);
-		nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->parent->nq.qos_tag;
-		nim.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_detach.child_qos_tag = cl->nq.qos_tag;
-		if (nss_qdisc_node_detach(&q->nq, &cl->nq, &nim, NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
-			return -EINVAL;
-		}
-	} else {
-		/*
-		 * The message to NSS should be sent to the parent of this class
-		 */
-		nss_qdisc_info("%s: detaching from parent htb qdisc %x", __func__, q->nq.qos_tag);
-		nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
-		if (nss_qdisc_node_detach(&q->nq, &cl->nq, &nim, NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
-			return -EINVAL;
-		}
-	}
-
-	sch_tree_lock(sch);
-	qdisc_reset(cl->qdisc);
-	qdisc_class_hash_remove(&q->clhash, &cl->sch_common);
-
-	/*
-	 * If we are root class, we dont have to update our parent.
-	 * We simply deduct refcnt and return.
-	 */
-	if (!cl->parent) {
-		refcnt = atomic_sub_return(1, &cl->nq.refcnt);
-		sch_tree_unlock(sch);
-		return 0;
-	}
-
-	/*
-	 * We are not root class. Therefore we reduce the children count
-	 * for our parent and also update its 'is_leaf' status.
-	 */
-	cl->parent->children--;
-	if (!cl->parent->children) {
-		cl->parent->is_leaf = true;
-	}
-
-	/*
-	 * Decrement refcnt and return
-	 */
-	refcnt = atomic_sub_return(1, &cl->nq.refcnt);
-	sch_tree_unlock(sch);
-
-	return 0;
-}
-
-/*
- * nss_htb_graft_class()
- *	Replaces the qdisc attached to the provided class.
- */
-static int nss_htb_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, struct Qdisc **old)
-{
-	struct nss_htb_class_data *cl = (struct nss_htb_class_data *)arg;
-	struct nss_if_msg nim_detach;
-	struct nss_if_msg nim_attach;
-	struct nss_qdisc *nq_new = qdisc_priv(new);
-	struct nss_qdisc *nq_old;
-
-	nss_qdisc_trace("%s: grafting htb class %x\n", __func__, cl->nq.qos_tag);
-
-	if (new == NULL) {
-		new = &noop_qdisc;
-	}
-
-	sch_tree_lock(sch);
-	*old = cl->qdisc;
-	sch_tree_unlock(sch);
-
-	/*
-	 * 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("%s: grafting old: %x with new: %x\n", __func__, (*old)->handle, new->handle);
-	if (*old != &noop_qdisc) {
-		nss_qdisc_trace("%s: detaching old: %x\n", __func__, (*old)->handle);
-		nq_old = qdisc_priv(*old);
-		nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
-		nim_detach.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_detach.child_qos_tag = nq_old->qos_tag;
-		if (nss_qdisc_node_detach(&cl->nq, nq_old, &nim_detach,
-				NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
-			nss_qdisc_error("%s: detach of old qdisc %x failed\n", __func__, (*old)->handle);
-			return -EINVAL;
-		}
-	}
-
-	/*
-	 * If the new qdisc is a noop qdisc, we do not send down an attach command
-	 * to the NSS.
-	 */
-	if (new != &noop_qdisc) {
-		nss_qdisc_trace("%s: attaching new: %x\n", __func__, new->handle);
-		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.htb_group_attach.child_qos_tag = nq_new->qos_tag;
-		if (nss_qdisc_node_attach(&cl->nq, nq_new, &nim_attach,
-				NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_ATTACH) < 0) {
-			nss_qdisc_error("%s: attach of new qdisc %x failed\n", __func__, new->handle);
-			return -EINVAL;
-		}
-	}
-
-	/*
-	 * Attach qdisc once it is done in the NSS
-	 */
-	sch_tree_lock(sch);
-	cl->qdisc = new;
-	sch_tree_unlock(sch);
-	return 0;
-}
-
-/*
- * nss_htb_leaf_class()
- *	Returns pointer to qdisc if leaf class.
- */
-static struct Qdisc *nss_htb_leaf_class(struct Qdisc *sch, unsigned long arg)
-{
-	struct nss_htb_class_data *cl = (struct nss_htb_class_data *)arg;
-	nss_qdisc_trace("%s: htb class %x is leaf %d\n", __func__, cl->nq.qos_tag, cl->is_leaf);
-
-	/*
-	 * Return qdisc pointer if this is level 0 class
-	 */
-	return cl->is_leaf ? cl->qdisc : NULL;
-}
-
-/*
- * nss_htb_qlen_notify()
- *	We dont maintain a live set of stats in linux, so this function is not implemented.
- */
-static void nss_htb_qlen_notify(struct Qdisc *sch, unsigned long arg)
-{
-	nss_qdisc_trace("%s: qlen notify called for htb qdisc %x\n", __func__, sch->handle);
-
-	/*
-	 * Gets called when qlen of child changes (Useful for deactivating)
-	 * Not useful for us here.
-	 */
-}
-
-/*
- * nss_htb_get_class()
- *	Fetches the class pointer if provided the classid.
- */
-static unsigned long nss_htb_get_class(struct Qdisc *sch, u32 classid)
-{
-	struct nss_htb_class_data *cl = nss_htb_find_class(classid, sch);
-
-	if (cl != NULL) {
-		nss_qdisc_trace("%s: fetched htb class %x from qdisc %x\n",
-				__func__, cl->nq.qos_tag, sch->handle);
-		atomic_add(1, &cl->nq.refcnt);
-	}
-
-	return (unsigned long)cl;
-}
-
-/*
- * nss_htb_put_class()
- *	Reduces reference count for this class.
- */
-static void nss_htb_put_class(struct Qdisc *sch, unsigned long arg)
-{
-	struct nss_htb_class_data *cl = (struct nss_htb_class_data *)arg;
-	nss_qdisc_trace("%s: executing put on htb class %x in qdisc %x\n",
-			__func__, cl->nq.qos_tag, sch->handle);
-
-	/*
-	 * We are safe to destroy the qdisc if the reference count
-	 * goes down to 0.
-	 */
-	if (atomic_sub_return(1, &cl->nq.refcnt) == 0) {
-		nss_htb_destroy_class(sch, cl);
-	}
-}
-
-/*
- * nss_htb_dump_class()
- *	Dumps all configurable parameters pertaining to this class.
- */
-static int nss_htb_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, struct tcmsg *tcm)
-{
-	struct nss_htb_class_data *cl = (struct nss_htb_class_data *)arg;
-	struct nlattr *opts;
-	struct tc_nsshtb_class_qopt qopt;
-
-	nss_qdisc_trace("%s: dumping htb class %x of qdisc %x\n", __func__, cl->nq.qos_tag, sch->handle);
-
-	qopt.burst = cl->burst;
-	qopt.rate = cl->rate;
-	qopt.crate = cl->crate;
-	qopt.cburst = cl->cburst;
-	qopt.overhead = cl->overhead;
-	qopt.quantum = cl->quantum;
-	qopt.priority = cl->priority;
-
-	/*
-	 * All htb group nodes are root nodes. i.e. they dont
-	 * have any mode htb groups attached beneath them.
-	 */
-	tcm->tcm_parent = TC_H_ROOT;
-	tcm->tcm_handle = cl->sch_common.classid;
-	tcm->tcm_info = cl->qdisc->handle;
-
-	opts = nla_nest_start(skb, TCA_OPTIONS);
-
-	if (opts == NULL) {
-		goto nla_put_failure;
-	}
-
-	NLA_PUT(skb, TCA_NSSHTB_CLASS_PARMS, sizeof(qopt), &qopt);
-	return nla_nest_end(skb, opts);
-
-nla_put_failure:
-	nla_nest_cancel(skb, opts);
-	nss_qdisc_error("%s: htb class %x dumo failed\n", __func__, cl->nq.qos_tag);
-	return -EMSGSIZE;
-}
-
-/*
- * nss_htb_dump_class_stats()
- *	Dumps class statistics.
- */
-static int nss_htb_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)arg;
-
-	if (gnet_stats_copy_basic(d, &nq->bstats) < 0 ||
-		gnet_stats_copy_queue(d, &nq->qstats) < 0) {
-		nss_qdisc_error("%s: htb class %x stats dump failed\n", __func__, nq->qos_tag);
-		return -1;
-	}
-
-	return 0;
-}
-
-/*
- * nss_htb_walk()
- *	Used to walk the tree.
- */
-static void nss_htb_walk(struct Qdisc *sch, struct qdisc_walker *arg)
-{
-	struct nss_htb_sched_data *q = qdisc_priv(sch);
-	struct hlist_node *n;
-	struct nss_htb_class_data *cl;
-	unsigned int i;
-
-	nss_qdisc_trace("%s: walking htb qdisc %x\n", __func__, sch->handle);
-
-	if (arg->stop)
-		return;
-
-	for (i = 0; i < q->clhash.hashsize; i++) {
-		hlist_for_each_entry(cl, n, &q->clhash.hash[i],
-				sch_common.hnode) {
-			if (arg->count < arg->skip) {
-				arg->count++;
-				continue;
-			}
-			if (arg->fn(sch, (unsigned long)cl, arg) < 0) {
-				arg->stop = 1;
-				return;
-			}
-			arg->count++;
-		}
-	}
-}
-
-/*
- * nss_htb_init_qdisc()
- *	Initializes the htb qdisc.
- */
-static int nss_htb_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_htb_sched_data *q = qdisc_priv(sch);
-	struct tc_nsshtb_qopt *qopt;
-	int err;
-
-	nss_qdisc_trace("%s: initializing htb qdisc %x\n", __func__, sch->handle);
-
-	if (opt == NULL || nla_len(opt) < sizeof(*qopt)) {
-		nss_qdisc_error("%s: error in input parameter for htb qdisc %x\n",
-					__func__, sch->handle);
-		return -EINVAL;
-	}
-
-	qopt = nla_data(opt);
-
-	sch_tree_lock(sch);
-	q->r2q = qopt->r2q;
-	sch_tree_unlock(sch);
-
-	err = qdisc_class_hash_init(&q->clhash);
-	if (err < 0) {
-		nss_qdisc_error("%s: hash init failed for htb qdisc %x", __func__, sch->handle);
-		return err;
-	}
-
-	/*
-	 * Initialize the NSSHTB shaper in NSS
-	 */
-	if (nss_qdisc_init(sch, &q->nq, NSS_SHAPER_NODE_TYPE_HTB, 0) < 0) {
-		nss_qdisc_error("%s: failed to initialize htb qdisc %x in nss", __func__, sch->handle);
-		return -EINVAL;
-	}
-
-	nss_qdisc_info("%s: htb qdisc initialized with handle %x\n", __func__, sch->handle);
-
-	/*
-	 * Start the stats polling timer
-	 */
-	nss_qdisc_start_basic_stats_polling(&q->nq);
-
-	return 0;
-}
-
-/*
- * nss_htb_change_qdisc()
- *	Can be used to configure a htb qdisc.
- */
-static int nss_htb_change_qdisc(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_htb_sched_data *q = qdisc_priv(sch);
-	struct tc_nsshtb_qopt *qopt;
-
-	nss_qdisc_trace("%s: configuring htb qdisc %x\n", __func__, sch->handle);
-	if (opt == NULL || nla_len(opt) < sizeof(*qopt)) {
-		nss_qdisc_error("%s: error in configuration parameter for qdisc %x\n",
-					__func__, sch->handle);
-		return -EINVAL;
-	}
-
-	qopt = nla_data(opt);
-
-	sch_tree_lock(sch);
-	q->r2q = qopt->r2q;
-	sch_tree_unlock(sch);
-
-	return 0;
-}
-
-/*
- * nss_htb_reset_class()
- *	Resets child qdisc of class to be reset.
- */
-static void nss_htb_reset_class(struct nss_htb_class_data *cl)
-{
-	nss_qdisc_reset(cl->qdisc);
-	nss_qdisc_trace("%s: htb class %x reset\n", __func__, cl->nq.qos_tag);
-}
-
-/*
- * nss_htb_reset_qdisc()
- *	Resets htb qdisc and its classes.
- */
-static void nss_htb_reset_qdisc(struct Qdisc *sch)
-{
-	struct nss_htb_sched_data *q = qdisc_priv(sch);
-	struct nss_htb_class_data *cl;
-	struct hlist_node *n;
-	unsigned int i;
-
-	for (i = 0; i < q->clhash.hashsize; i++) {
-		hlist_for_each_entry(cl, n, &q->clhash.hash[i], sch_common.hnode)
-			nss_htb_reset_class(cl);
-	}
-
-	nss_qdisc_reset(sch);
-	nss_qdisc_trace("%s: nss htb qdisc %x reset\n", __func__, sch->handle);
-}
-
-/*
- * nss_htb_destroy_qdisc()
- *	Call to destroy a htb qdisc and its associated classes.
- */
-static void nss_htb_destroy_qdisc(struct Qdisc *sch)
-{
-	struct nss_htb_sched_data *q = qdisc_priv(sch);
-	struct hlist_node *n, *next;
-	struct nss_htb_class_data *cl;
-	unsigned int i;
-
-	/*
-	 * Destroy all the classes before the root qdisc is destroyed.
-	 */
-	for (i = 0; i < q->clhash.hashsize; i++) {
-		hlist_for_each_entry_safe(cl, n, next, &q->clhash.hash[i], sch_common.hnode) {
-
-			/*
-			 * If this is the root class, we dont have to destroy it. This will be taken
-			 * care of by the nss_htb_destroy() function.
-			 */
-			if (cl == &q->root) {
-				continue;
-			}
-
-			/*
-			 * Reduce refcnt by 1 before destroying. This is to
-			 * ensure that polling of stat stops properly.
-			 */
-			atomic_sub(1, &cl->nq.refcnt);
-
-			/*
-			 * Now we can destroy the class.
-			 */
-			nss_htb_destroy_class(sch, cl);
-		}
-	}
-	qdisc_class_hash_destroy(&q->clhash);
-
-	/*
-	 * Stop the polling of basic stats
-	 */
-	nss_qdisc_stop_basic_stats_polling(&q->nq);
-
-	/*
-	 * Now we can go ahead and destroy the qdisc.
-	 * Note: We dont have to detach ourself from our parent because this
-	 *	 will be taken care of by the graft call.
-	 */
-	nss_qdisc_destroy(&q->nq);
-	nss_qdisc_info("%s: htb qdisc %x destroyed\n", __func__, sch->handle);
-}
-
-/*
- * nss_htb_dump_qdisc()
- *	Dumps htb qdisc's configurable parameters.
- */
-static int nss_htb_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
-{
-	struct nss_htb_sched_data *q = qdisc_priv(sch);
-	unsigned char *b = skb_tail_pointer(skb);
-	struct tc_nsshtb_qopt qopt;
-	struct nlattr *nest;
-
-	nss_qdisc_trace("%s: dumping htb qdisc %x\n", __func__, sch->handle);
-
-	nest = nla_nest_start(skb, TCA_OPTIONS);
-	if (nest == NULL) {
-		goto nla_put_failure;
-	}
-
-	qopt.r2q = q->r2q;
-	NLA_PUT(skb, TCA_NSSHTB_QDISC_PARMS, sizeof(qopt), &qopt);
-	nla_nest_end(skb, nest);
-
-	return skb->len;
-
- nla_put_failure:
-	nlmsg_trim(skb, b);
-	return -1;
-}
-
-/*
- * nss_htb_enqueue()
- *	Enqueues a skb to htb qdisc.
- */
-static int nss_htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
-{
-	return nss_qdisc_enqueue(skb, sch);
-}
-
-/*
- * nss_htb_dequeue()
- *	Dequeues a skb from htb qdisc.
- */
-static struct sk_buff *nss_htb_dequeue(struct Qdisc *sch)
-{
-	return nss_qdisc_dequeue(sch);
-}
-
-/*
- * nss_htb_drop()
- *	Drops a single sbk from linux queue, if not empty.
- *
- * Does not drop packets that are queued in the NSS.
- */
-static unsigned int nss_htb_drop(struct Qdisc *sch)
-{
-	nss_qdisc_trace("%s: drop called on htb qdisc %x\n", __func__, sch->handle);
-	return nss_qdisc_drop(sch);
-}
-
-/*
- * Registration structure for htb class
- */
-const struct Qdisc_class_ops nss_htb_class_ops = {
-	.change		= nss_htb_change_class,
-	.delete		= nss_htb_delete_class,
-	.graft		= nss_htb_graft_class,
-	.leaf		= nss_htb_leaf_class,
-	.qlen_notify	= nss_htb_qlen_notify,
-	.get		= nss_htb_get_class,
-	.put		= nss_htb_put_class,
-	.dump		= nss_htb_dump_class,
-	.dump_stats	= nss_htb_dump_class_stats,
-	.walk		= nss_htb_walk
-};
-
-/*
- * Registration structure for htb qdisc
- */
-struct Qdisc_ops nss_htb_qdisc_ops __read_mostly = {
-	.id		= "nsshtb",
-	.init		= nss_htb_init_qdisc,
-	.change		= nss_htb_change_qdisc,
-	.reset		= nss_htb_reset_qdisc,
-	.destroy	= nss_htb_destroy_qdisc,
-	.dump		= nss_htb_dump_qdisc,
-	.enqueue	= nss_htb_enqueue,
-	.dequeue	= nss_htb_dequeue,
-	.peek		= qdisc_peek_dequeued,
-	.drop		= nss_htb_drop,
-	.cl_ops		= &nss_htb_class_ops,
-	.priv_size	= sizeof(struct nss_htb_sched_data),
-	.owner		= THIS_MODULE
-};
diff --git a/nss_qdisc/nss_htb.h b/nss_qdisc/nss_htb.h
deleted file mode 100644
index 5f9cbbd..0000000
--- a/nss_qdisc/nss_htb.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-extern struct Qdisc_ops nss_htb_qdisc_ops;
diff --git a/nss_qdisc/nss_prio.c b/nss_qdisc/nss_prio.c
deleted file mode 100644
index f8e79ba..0000000
--- a/nss_qdisc/nss_prio.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_qdisc.h"
-
-struct nss_prio_sched_data {
-	struct nss_qdisc nq;	/* Common base class for all nss qdiscs */
-	int bands;			/* Number of priority bands to use */
-	struct Qdisc *queues[TCA_NSSPRIO_MAX_BANDS];
-					/* Array of child qdisc holder */
-};
-
-static int nss_prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
-{
-	return nss_qdisc_enqueue(skb, sch);
-}
-
-static struct sk_buff *nss_prio_dequeue(struct Qdisc *sch)
-{
-	return nss_qdisc_dequeue(sch);
-}
-
-static unsigned int nss_prio_drop(struct Qdisc *sch)
-{
-	return nss_qdisc_drop(sch);
-}
-
-static struct sk_buff *nss_prio_peek(struct Qdisc *sch)
-{
-	return nss_qdisc_peek(sch);
-}
-
-static void nss_prio_reset(struct Qdisc *sch)
-{
-	return nss_qdisc_reset(sch);
-}
-
-static void nss_prio_destroy(struct Qdisc *sch)
-{
-	struct nss_prio_sched_data *q = qdisc_priv(sch);
-	struct nss_if_msg nim;
-	int i;
-
-	nss_qdisc_info("Destroying prio");
-
-	/*
-	 * Destroy all attached child nodes before destroying prio
-	 */
-	for (i = 0; i < q->bands; i++) {
-
-		/*
-		 * We always detach the shaper in NSS before destroying it.
-		 * It is very important to check for noop qdisc since those dont
-		 * exist in the NSS.
-		 */
-		if (q->queues[i] != &noop_qdisc) {
-			struct nss_qdisc *nq_child = qdisc_priv(q->queues[i]);
-			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.prio_detach.priority = i;
-			if (nss_qdisc_node_detach(&q->nq, nq_child, &nim,
-					NSS_SHAPER_CONFIG_TYPE_PRIO_DETACH) < 0) {
-				nss_qdisc_error("%s: Failed to detach child in band %d from prio %x\n",
-							__func__, i, q->nq.qos_tag);
-				return;
-			}
-		}
-
-		/*
-		 * We can now destroy it
-		 */
-		qdisc_destroy(q->queues[i]);
-	}
-
-	/*
-	 * Stop the polling of basic stats
-	 */
-	nss_qdisc_stop_basic_stats_polling(&q->nq);
-
-	/*
-	 * Destroy the qdisc in NSS
-	 */
-	nss_qdisc_destroy(&q->nq);
-}
-
-static const struct nla_policy nss_prio_policy[TCA_NSSPRIO_MAX + 1] = {
-	[TCA_NSSPRIO_PARMS] = { .len = sizeof(struct tc_nssprio_qopt) },
-};
-
-static int nss_prio_change(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_prio_sched_data *q;
-	struct nlattr *na[TCA_NSSPRIO_MAX + 1];
-	struct tc_nssprio_qopt *qopt;
-	int err;
-
-	q = qdisc_priv(sch);
-
-	if (opt == NULL) {
-		return -EINVAL;
-	}
-
-	err = nla_parse_nested(na, TCA_NSSPRIO_MAX, opt, nss_prio_policy);
-	if (err < 0) {
-		return err;
-	}
-
-	if (na[TCA_NSSPRIO_PARMS] == NULL) {
-		return -EINVAL;
-	}
-
-	qopt = nla_data(na[TCA_NSSPRIO_PARMS]);
-
-	if (qopt->bands > TCA_NSSPRIO_MAX_BANDS) {
-		return -EINVAL;
-	}
-
-	q->bands = qopt->bands;
-	nss_qdisc_info("Bands = %u\n", qopt->bands);
-
-	return 0;
-}
-
-static int nss_prio_init(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_prio_sched_data *q = qdisc_priv(sch);
-	int i;
-
-	if (opt == NULL)
-		return -EINVAL;
-
-	for (i = 0; i < TCA_NSSPRIO_MAX_BANDS; i++)
-		q->queues[i] = &noop_qdisc;
-
-	q->bands = 0;
-	if (nss_qdisc_init(sch, &q->nq, NSS_SHAPER_NODE_TYPE_PRIO, 0) < 0)
-		return -EINVAL;
-
-	nss_qdisc_info("Nssprio initialized - handle %x parent %x\n",
-			sch->handle, sch->parent);
-
-	if (nss_prio_change(sch, opt) < 0) {
-		nss_qdisc_destroy(&q->nq);
-		return -EINVAL;
-	}
-
-	/*
-	 * Start the stats polling timer
-	 */
-	nss_qdisc_start_basic_stats_polling(&q->nq);
-	return 0;
-}
-
-static int nss_prio_dump(struct Qdisc *sch, struct sk_buff *skb)
-{
-	struct nss_prio_sched_data *q = qdisc_priv(sch);
-	struct nlattr *opts = NULL;
-	struct tc_nssprio_qopt qopt; 
-
-	nss_qdisc_info("Nssprio dumping");
-	qopt.bands = q->bands;
-
-	opts = nla_nest_start(skb, TCA_OPTIONS);
-	if (opts == NULL)
-		goto nla_put_failure;
-	NLA_PUT(skb, TCA_NSSPRIO_PARMS, sizeof(qopt), &qopt);
-	return nla_nest_end(skb, opts);
-
-nla_put_failure:
-	nla_nest_cancel(skb, opts);
-	return -EMSGSIZE;
-}
-
-static int nss_prio_graft(struct Qdisc *sch, unsigned long arg,
-				struct Qdisc *new, struct Qdisc **old)
-{
-	struct nss_prio_sched_data *q = qdisc_priv(sch);
-	struct nss_qdisc *nq_new = qdisc_priv(new);
-	uint32_t band = (uint32_t)(arg - 1);
-	struct nss_if_msg nim_attach;
-	struct nss_if_msg nim_detach;
-
-	nss_qdisc_info("Grafting band %u, available bands %u\n", band, q->bands);
-
-	if (new == NULL)
-		new = &noop_qdisc;
-
-	if (band > q->bands)
-		return -EINVAL;
-
-	sch_tree_lock(sch);
-	*old = q->queues[band];
-	q->queues[band] = new;
-	qdisc_reset(*old);
-	sch_tree_unlock(sch);
-
-	nss_qdisc_info("%s:Grafting old: %p with new: %p\n", __func__, *old, new);
-	if (*old != &noop_qdisc) {
-		struct nss_qdisc *nq_old = qdisc_priv(*old);
-		nss_qdisc_info("%s:Detaching old: %p\n", __func__, *old);
-		nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
-		nim_detach.msg.shaper_configure.config.msg.shaper_node_config.snc.prio_detach.priority = band;
-		if (nss_qdisc_node_detach(&q->nq, nq_old, &nim_detach,
-				NSS_SHAPER_CONFIG_TYPE_PRIO_DETACH) < 0) {
-			return -EINVAL;
-		}
-	}
-
-	if (new != &noop_qdisc) {
-		nss_qdisc_info("%s:Attaching new child with qos tag: %x, priority: %u to "
-				"qos_tag: %x\n", __func__, nq_new->qos_tag, band, q->nq.qos_tag);
-		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.prio_attach.child_qos_tag = nq_new->qos_tag;
-		nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.prio_attach.priority = band;
-		if (nss_qdisc_node_attach(&q->nq, nq_new, &nim_attach,
-				NSS_SHAPER_CONFIG_TYPE_PRIO_ATTACH) < 0) {
-			return -EINVAL;
-		}
-	}
-	nss_qdisc_info("Nssprio grafted");
-
-	return 0;
-}
-
-static struct Qdisc *nss_prio_leaf(struct Qdisc *sch, unsigned long arg)
-{
-	struct nss_prio_sched_data *q = qdisc_priv(sch);
-	uint32_t band = (uint32_t)(arg - 1);
-
-	nss_qdisc_info("Nssprio returns leaf\n");
-
-	if (band > q->bands)
-		return NULL;
-
-	return q->queues[band];
-}
-
-static unsigned long nss_prio_get(struct Qdisc *sch, u32 classid)
-{
-	struct nss_prio_sched_data *q = qdisc_priv(sch);
-	unsigned long band = TC_H_MIN(classid);
-
-	nss_qdisc_info("Inside get. Handle - %x Classid - %x Band %lu Available band %u\n", sch->handle, classid, band, q->bands);
-
-	if (band > q->bands)
-		return 0;
-
-	return band;
-}
-
-static void nss_prio_put(struct Qdisc *sch, unsigned long arg)
-{
-	nss_qdisc_info("Inside prio get\n");
-}
-
-static void nss_prio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
-{
-	struct nss_prio_sched_data *q = qdisc_priv(sch);
-	int i;
-
-	if (arg->stop)
-		return;
-
-	for (i = 0; i < q->bands; i++) {
-		if (arg->count < arg->skip) {
-			arg->count++;
-			continue;
-		}
-		if (arg->fn(sch, i + 1, arg) < 0) {
-			arg->stop = 1;
-			break;
-		}
-		arg->count++;
-	}
-	nss_qdisc_info("Nssprio walk called\n");
-}
-
-static int nss_prio_dump_class(struct Qdisc *sch, unsigned long cl,
-			     struct sk_buff *skb, struct tcmsg *tcm)
-{
-	struct nss_prio_sched_data *q = qdisc_priv(sch);
-
-	tcm->tcm_handle |= TC_H_MIN(cl);
-	tcm->tcm_info = q->queues[cl - 1]->handle;
-
-	nss_qdisc_info("Nssprio dumping class\n");
-	return 0;
-}
-
-static int nss_prio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
-			     	    struct gnet_dump *d)
-{
-	struct nss_prio_sched_data *q = qdisc_priv(sch);
-	struct Qdisc *cl_q;
-
-	cl_q = q->queues[cl - 1];
-	cl_q->qstats.qlen = cl_q->q.qlen;
-	if (gnet_stats_copy_basic(d, &cl_q->bstats) < 0 ||
-	    gnet_stats_copy_queue(d, &cl_q->qstats) < 0)
-		return -1;
-
-	nss_qdisc_info("Nssprio dumping class stats\n");
-	return 0;
-}
-
-const struct Qdisc_class_ops nss_prio_class_ops = {
-	.graft		=	nss_prio_graft,
-	.leaf		=	nss_prio_leaf,
-	.get		=	nss_prio_get,
-	.put		=	nss_prio_put,
-	.walk		=	nss_prio_walk,
-	.dump		=	nss_prio_dump_class,
-	.dump_stats	=	nss_prio_dump_class_stats,
-};
-
-struct Qdisc_ops nss_prio_qdisc_ops __read_mostly = {
-	.next		=	NULL,
-	.id		=	"nssprio",
-	.priv_size	=	sizeof(struct nss_prio_sched_data),
-	.cl_ops		=	&nss_prio_class_ops,
-	.enqueue	=	nss_prio_enqueue,
-	.dequeue	=	nss_prio_dequeue,
-	.peek		=	nss_prio_peek,
-	.drop		=	nss_prio_drop,
-	.init		=	nss_prio_init,
-	.reset		=	nss_prio_reset,
-	.destroy	=	nss_prio_destroy,
-	.change		=	nss_prio_change,
-	.dump		=	nss_prio_dump,
-	.owner		=	THIS_MODULE,
-};
-
diff --git a/nss_qdisc/nss_prio.h b/nss_qdisc/nss_prio.h
deleted file mode 100644
index 2833a81..0000000
--- a/nss_qdisc/nss_prio.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-extern struct Qdisc_ops nss_prio_qdisc_ops;
diff --git a/nss_qdisc/nss_qdisc.c b/nss_qdisc/nss_qdisc.c
deleted file mode 100644
index 74d22f7..0000000
--- a/nss_qdisc/nss_qdisc.c
+++ /dev/null
@@ -1,2248 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_qdisc.h"
-
-#include "nss_fifo.h"
-#include "nss_codel.h"
-#include "nss_tbl.h"
-#include "nss_prio.h"
-#include "nss_bf.h"
-#include "nss_wrr.h"
-#include "nss_wfq.h"
-#include "nss_htb.h"
-#include "nss_blackhole.h"
-#include "nss_wred.h"
-
-void *nss_qdisc_ctx;			/* Shaping context for nss_qdisc */
-wait_queue_head_t nss_qdics_wq;			/* Wait queue used to wait on responses from the NSS */
-
-#define NSS_QDISC_COMMAND_TIMEOUT 5*HZ	/* We set 5sec to be the timeout value for responses to */
-					/* come back from the NSS */
-
-/*
- * Defines related to root hash maintenance
- */
-#define NSS_QDISC_ROOT_HASH_SIZE 4
-#define NSS_QDISC_ROOT_HASH_MASK (NSS_QDISC_ROOT_HASH_SIZE - 1)
-
-/*
- * nss_qdisc_msg_init()
- *      Initialize the qdisc specific message
- */
-static void nss_qdisc_msg_init(struct nss_if_msg *nim, uint16_t if_num, uint32_t msg_type, uint32_t len,
-				nss_if_msg_callback_t *cb, void *app_data)
-{
-	nss_cmn_msg_init(&nim->cm, if_num, msg_type, len, (void*)cb, app_data);
-}
-
-/*
- * nss_qdisc_get_interface_msg()
- *	Returns the correct message that needs to be sent down to the NSS interface.
- */
-static inline int nss_qdisc_get_interface_msg(bool is_bridge, uint32_t msg_type)
-{
-	/*
-	 * We re-assign the message based on whether this is for the I shaper
-	 * or the B shaper. The is_bridge flag tells if we are on a bridge interface.
-	 */
-	if (is_bridge) {
-		switch(msg_type) {
-		case NSS_QDISC_IF_SHAPER_ASSIGN:
-			return NSS_IF_BSHAPER_ASSIGN;
-		case NSS_QDISC_IF_SHAPER_UNASSIGN:
-			return NSS_IF_BSHAPER_UNASSIGN;
-		case NSS_QDISC_IF_SHAPER_CONFIG:
-			return NSS_IF_BSHAPER_CONFIG;
-		default:
-			nss_qdisc_info("%s: Unknown message type for a bridge - type %d", __func__, msg_type);
-			return -1;
-		}
-	} else {
-		switch(msg_type) {
-		case NSS_QDISC_IF_SHAPER_ASSIGN:
-			return NSS_IF_ISHAPER_ASSIGN;
-		case NSS_QDISC_IF_SHAPER_UNASSIGN:
-			return NSS_IF_ISHAPER_UNASSIGN;
-		case NSS_QDISC_IF_SHAPER_CONFIG:
-			return NSS_IF_ISHAPER_CONFIG;
-		default:
-			nss_qdisc_info("%s: Unknown message type for an interface - type %d", __func__, msg_type);
-			return -1;
-		}
-	}
-}
-
-/*
- * nss_qdisc_get_br_port()
- * 	Returns the bridge port structure of the bridge to which the device is attached to.
- */
-static inline struct net_bridge_port *nss_qdisc_get_br_port(const struct net_device *dev)
-{
-	struct net_bridge_port *br_port;
-
-	if (!dev) {
-		return NULL;
-	}
-
-	rcu_read_lock();
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
-	br_port = br_port_get_rcu(dev);
-#else
-	br_port = rcu_dereference(dev->br_port);
-#endif
-	rcu_read_unlock();
-
-	return br_port;
-}
-
-/*
- * nss_qdisc_attach_bshaper_callback()
- *	Call back funtion for bridge shaper attach to an interface.
- */
-static void nss_qdisc_attach_bshaper_callback(void *app_data, struct nss_if_msg *nim)
-{
-	struct Qdisc *sch = (struct Qdisc *)app_data;
-	struct nss_qdisc *nq = qdisc_priv(sch);
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_warning("%s: B-shaper attach FAILED - response: %d\n", __func__,
-				nim->cm.error);
-		atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE);
-		return;
-	}
-
-	nss_qdisc_info("%s: B-shaper attach SUCCESS\n", __func__);
-	atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-}
-
-/*
- * nss_qdisc_attach_bridge()
- *	Attaches a given bridge shaper to a given interface (Different from shaper_assign)
- */
-static int nss_qdisc_attach_bshaper(struct Qdisc *sch, uint32_t if_num)
-{
-	struct nss_if_msg nim;
-	struct nss_qdisc *nq = (struct nss_qdisc *)qdisc_priv(sch);
-	int32_t state, rc;
-
-	nss_qdisc_info("%s: Attaching B-shaper %u to interface %u\n", __func__,
-			nq->shaper_id, if_num);
-
-	state = atomic_read(&nq->state);
-	if (state != NSS_QDISC_STATE_READY) {
-		nss_qdisc_warning("%s: qdisc %p (type %d) is not ready: State - %d\n",
-				__func__, sch, nq->type, state);
-		return -1;
-	}
-
-	/*
-	 * Set shaper node state to IDLE
-	 */
-	atomic_set(&nq->state, NSS_QDISC_STATE_IDLE);
-
-	/*
-	 * Populate the message and send it down
-	 */
-	nss_qdisc_msg_init(&nim, if_num, NSS_IF_BSHAPER_ASSIGN,
-				sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_attach_bshaper_callback,
-				sch);
-	/*
-	 * Assign the ID of the Bshaper that needs to be assigned to the interface recognized
-	 * by if_num.
-	 */
-	nim.msg.shaper_assign.shaper_id = nq->shaper_id;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, &nim);
-
-	if (rc != NSS_TX_SUCCESS) {
-		nss_qdisc_warning("%s: Failed to send bshaper (id: %u) attach for "
-				"interface(if_num: %u)\n", __func__, nq->shaper_id, if_num);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	while (NSS_QDISC_STATE_IDLE == (state = atomic_read(&nq->state))) {
-		yield();
-	}
-
-	if (state == NSS_QDISC_STATE_FAILED_RESPONSE) {
-		nss_qdisc_error("%s: Failed to attach B-shaper %u to interface %u\n",
-				__func__, nq->shaper_id, if_num);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	nss_qdisc_info("%s: Attach of B-shaper %u to interface %u is complete\n",
-			__func__, nq->shaper_id, if_num);
-	atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-	return 0;
-}
-
-/*
- * nss_qdisc_detach_bshaper_callback()
- *	Call back function for bridge shaper detach
- */
-static void nss_qdisc_detach_bshaper_callback(void *app_data, struct nss_if_msg *nim)
-{
-	struct Qdisc *sch = (struct Qdisc *)app_data;
-	struct nss_qdisc *nq = qdisc_priv(sch);
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_error("%s: B-shaper detach FAILED - response: %d\n",
-				__func__, nim->cm.error);
-		atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE);
-		return;
-	}
-
-	nss_qdisc_info("%s: B-shaper detach SUCCESS\n", __func__);
-	atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-}
-
-/*
- * nss_qdisc_detach_bridge()
- *	Detaches a given bridge shaper from a given interface (different from shaper unassign)
- */
-static int nss_qdisc_detach_bshaper(struct Qdisc *sch, uint32_t if_num)
-{
-	struct nss_if_msg nim;
-	struct nss_qdisc *nq = (struct nss_qdisc *)qdisc_priv(sch);
-	int32_t state, rc;
-
-	nss_qdisc_info("%s: Detaching B-shaper %u from interface %u\n",
-			__func__, nq->shaper_id, if_num);
-
-	state = atomic_read(&nq->state);
-	if (state != NSS_QDISC_STATE_READY) {
-		nss_qdisc_warning("%s: qdisc %p (type %d) is not ready: %d\n",
-				__func__, sch, nq->type, state);
-		return -1;
-	}
-
-	/*
-	 * Set shaper node state to IDLE
-	 */
-	atomic_set(&nq->state, NSS_QDISC_STATE_IDLE);
-
-	/*
-	 * Create and send shaper unassign message to the NSS interface
-	 */
-	nss_qdisc_msg_init(&nim, if_num, NSS_IF_BSHAPER_UNASSIGN,
-				sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_detach_bshaper_callback,
-				sch);
-	nim.msg.shaper_unassign.shaper_id = nq->shaper_id;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, &nim);
-
-	if (rc != NSS_TX_SUCCESS) {
-		nss_qdisc_warning("%s: Failed to send B-shaper (id: %u) detach "
-			"for interface(if_num: %u)\n", __func__, nq->shaper_id, if_num);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	nss_qdisc_info("%s: Detach of B-shaper %u to interface %u is complete.",
-			__func__, nq->shaper_id, if_num);
-	atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-	return 0;
-}
-
-/*
- * nss_qdisc_refresh_bshaper_assignment()
- *	Performs assign on unassign of bshaper for interfaces on the bridge.
- */
-static int nss_qdisc_refresh_bshaper_assignment(struct Qdisc *br_qdisc,
-					enum nss_qdisc_bshaper_tasks task)
-{
-	struct net_device *dev;
-	struct net_device *br_dev = qdisc_dev(br_qdisc);
-	struct nss_qdisc *nq;
-	struct nss_qdisc_bridge_update br_update;
-	int i;
-
-	if ((br_qdisc->parent != TC_H_ROOT) && (br_qdisc->parent != TC_H_UNSPEC)) {
-		nss_qdisc_error("%s: Qdisc not root qdisc for the bridge interface: "
-				"Handle - %x", __func__, br_qdisc->parent);
-		return -1;
-	}
-
-	nq = qdisc_priv(br_qdisc);
-
-	/*
-	 * Initialize the bridge update srtucture.
-	 */
-	br_update.port_list_count = 0;
-	br_update.unassign_count = 0;
-
-	read_lock(&dev_base_lock);
-	dev = first_net_device(&init_net);
-	while(dev) {
-		struct net_bridge_port *br_port = nss_qdisc_get_br_port(dev);
-		int nss_if_num;
-
-		nss_qdisc_info("%s: Scanning device %s", __func__, dev->name);
-		if (!br_port || !br_port->br) {
-			goto nextdev;
-		}
-
-		/*
-		 * Dont care if this device is not on the
-		 * bridge that is of concern.
-		 */
-		if (br_port->br->dev != br_dev) {
-			goto nextdev;
-		}
-
-		/*
-		 * If the interface is known to NSS then we will have to shape it.
-		 * Irrespective of whether it has an interface qdisc or not.
-		 */
-		nss_if_num = nss_cmn_get_interface_number(nq->nss_shaping_ctx, dev);
-		if (nss_if_num < 0) {
-			goto nextdev;
-		}
-
-		nss_qdisc_info("%s: Will be linking/unlinking %s to/from bridge %s\n", __func__,
-				dev->name, br_dev->name);
-		br_update.port_list[br_update.port_list_count++] = nss_if_num;
-nextdev:
-		dev = next_net_device(dev);
-	}
-	read_unlock(&dev_base_lock);
-
-	nss_qdisc_info("%s: List count %d\n", __func__, br_update.port_list_count);
-
-	if (task == NSS_QDISC_SCAN_AND_ASSIGN_BSHAPER) {
-		/*
-		 * Loop through the ports and assign them with B-shapers.
-		 */
-		for (i = 0; i < br_update.port_list_count; i++) {
-			if (nss_qdisc_attach_bshaper(br_qdisc, br_update.port_list[i]) >= 0) {
-				nss_qdisc_info("%s: Interface %u added to bridge %s\n",
-					__func__, br_update.port_list[i], br_dev->name);
-				continue;
-			}
-			nss_qdisc_error("%s: Unable to attach bshaper with shaper-id: %u, "
-				"to interface if_num: %d\n", __func__, nq->shaper_id,
-				br_update.port_list[i]);
-			br_update.unassign_count = i;
-			break;
-		}
-		nss_qdisc_info("%s: Unassign count %d\n", __func__, br_update.unassign_count);
-		if (br_update.unassign_count == 0) {
-			return 0;
-		}
-
-		/*
-		 * In case of a failure, unassign the B-shapers that were assigned above
-		 */
-		for (i = 0; i < br_update.unassign_count; i++) {
-			if (nss_qdisc_detach_bshaper(br_qdisc, br_update.port_list[i]) >= 0) {
-				continue;
-			}
-			nss_qdisc_assert(NULL, "%s: Unable to detach bshaper with shaper-id: %u, "
-				"from interface if_num: %d\n", __func__, nq->shaper_id,
-				br_update.port_list[i]);
-		}
-
-		nss_qdisc_info("%s: Failed to link interfaces to bridge\n", __func__);
-		return -1;
-	} else if (task == NSS_QDISC_SCAN_AND_UNASSIGN_BSHAPER) {
-		/*
-		 * Loop through the ports and assign them with B-shapers.
-		 */
-		for (i = 0; i < br_update.port_list_count; i++) {
-			if (nss_qdisc_detach_bshaper(br_qdisc, br_update.port_list[i]) >= 0) {
-				nss_qdisc_info("%s: Interface %u removed from bridge %s\n",
-					__func__, br_update.port_list[i], br_dev->name);
-				continue;
-			}
-			nss_qdisc_assert(NULL, "%s: Unable to detach bshaper with shaper-id: %u, "
-				"from interface if_num: %d\n", __func__, nq->shaper_id,
-				br_update.port_list[i]);
-		}
-	}
-
-	return 0;
-}
-
-/*
- * nss_qdisc_root_cleanup_final()
- *	Performs final cleanup of a root shaper node after all other
- *	shaper node cleanup is complete.
- */
-static void nss_qdisc_root_cleanup_final(struct nss_qdisc *nq)
-{
-	nss_qdisc_info("%s: Root qdisc %p (type %d) final cleanup\n", __func__,
-				nq->qdisc, nq->type);
-
-	/*
-	 * If we are a bridge then we have to unregister for bridge bouncing
-	 * AND destroy the virtual interface that provides bridge shaping.
-	 */
-	if (nq->is_bridge) {
-		/*
-		 * Unregister for bouncing to the NSS for bridge shaping
-	 	 */
-		nss_qdisc_info("%s: Unregister for bridge bouncing: %p\n", __func__,
-				nq->bounce_context);
-		nss_shaper_unregister_shaper_bounce_bridge(nq->nss_interface_number);
-
-		/*
-		 * Unregister the virtual interface we use to act as shaper
-		 * for bridge shaping.
-	 	 */
-		nss_qdisc_info("%s: Release root bridge virtual interface: %p\n",
-				__func__, nq->virtual_interface_context);
-		nss_destroy_virt_if(nq->virtual_interface_context);
-	}
-
-	/*
-	 * If we are a virual interface other than a bridge then we simply
-	 * unregister for interface bouncing and not care about deleting the
-	 * interface.
-	 */
-	if (nq->is_virtual && !nq->is_bridge) {
-		/*
-		 * Unregister for interface bouncing of packets
-	 	 */
-		nss_qdisc_info("%s: Unregister for interface bouncing: %p\n",
-				__func__, nq->bounce_context);
-		nss_shaper_unregister_shaper_bounce_interface(nq->nss_interface_number);
-	}
-
-	/*
-	 * Finally unregister for shaping
-	 */
-	nss_qdisc_info("%s: Unregister for shaping\n", __func__);
-	nss_shaper_unregister_shaping(nq->nss_shaping_ctx);
-
-	/*
-	 * Now set our final state
-	 */
-	atomic_set(&nq->state, nq->pending_final_state);
-}
-
-/*
- * nss_qdisc_root_cleanup_shaper_unassign_callback()
- *	Invoked on the response to a shaper unassign config command issued
- */
-static void nss_qdisc_root_cleanup_shaper_unassign_callback(void *app_data,
-							struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_assert(NULL, "%s: Root qdisc %p (type %d) shaper unsassign FAILED\n", __func__, nq->qdisc, nq->type);
-	}
-
-	nss_qdisc_root_cleanup_final(nq);
-}
-
-/*
- * nss_qdisc_root_cleanup_shaper_unassign()
- *	Issue command to unassign the shaper
- */
-static void nss_qdisc_root_cleanup_shaper_unassign(struct nss_qdisc *nq)
-{
-	struct nss_if_msg nim;
-	nss_tx_status_t rc;
-	int msg_type;
-
-	nss_qdisc_info("%s: Root qdisc %p (type %d): shaper unassign: %d\n",
-			__func__, nq->qdisc, nq->type, nq->shaper_id);
-
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_UNASSIGN);
-	nss_qdisc_msg_init(&nim, nq->nss_interface_number, msg_type,
-			sizeof(struct nss_if_msg), 
-			(nss_if_msg_callback_t *)nss_qdisc_root_cleanup_shaper_unassign_callback,
-			nq);
-	nim.msg.shaper_unassign.shaper_id = nq->shaper_id;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, &nim);
-
-	if (rc == NSS_TX_SUCCESS) {
-		return;
-	}
-
-	nss_qdisc_error("%s: Root qdisc %p (type %d): unassign command send failed: "
-		"%d, shaper id: %d\n", __func__, nq->qdisc, nq->type, rc, nq->shaper_id);
-
-	nss_qdisc_root_cleanup_final(nq);
-}
-
-/*
- * nss_qdisc_root_cleanup_free_node_callback()
- *	Invoked on the response to freeing a shaper node
- */
-static void nss_qdisc_root_cleanup_free_node_callback(void *app_data,
-						struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_assert(NULL, "%s: Root qdisc %p (type %d) free FAILED response "
-				"type: %d\n", __func__, nq->qdisc, nq->type,
-				nim->msg.shaper_configure.config.response_type);
-	}
-
-	nss_qdisc_info("%s: Root qdisc %p (type %d) free SUCCESS - response "
-			"type: %d\n", __func__, nq->qdisc, nq->type,
-			nim->msg.shaper_configure.config.response_type);
-
-	nss_qdisc_root_cleanup_shaper_unassign(nq);
-}
-
-/*
- * nss_qdisc_root_cleanup_free_node()
- *	Free the shaper node, issue command to do so.
- */
-static void nss_qdisc_root_cleanup_free_node(struct nss_qdisc *nq)
-{
-	struct nss_if_msg nim;
-	nss_tx_status_t rc;
-	int msg_type;
-
-	nss_qdisc_info("%s: Root qdisc %p (type %d): freeing shaper node\n",
-			__func__, nq->qdisc, nq->type);
-
-	/*
-	 * Construct and send the shaper configure message down to the NSS interface
-	 */
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_CONFIG);
-	nss_qdisc_msg_init(&nim, nq->nss_interface_number, msg_type,
-				sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_root_cleanup_free_node_callback,
-				nq);
-	nim.msg.shaper_configure.config.request_type = NSS_SHAPER_CONFIG_TYPE_FREE_SHAPER_NODE;
-	nim.msg.shaper_configure.config.msg.free_shaper_node.qos_tag = nq->qos_tag;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, &nim);
-
-	if (rc == NSS_TX_SUCCESS) {
-		return;
-	}
-
-	nss_qdisc_error("%s: Qdisc %p (type %d): free command send "
-		"failed: %d, qos tag: %x\n", __func__, nq->qdisc, nq->type,
-		rc, nq->qos_tag);
-
-	/*
-	 * Move onto unassigning the shaper instead
-	 */
-	nss_qdisc_root_cleanup_shaper_unassign(nq);
-}
-
-/*
- * nss_qdisc_root_init_root_assign_callback()
- *	Invoked on the response to assigning shaper node as root
- */
-static void nss_qdisc_root_init_root_assign_callback(void *app_data,
-						struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_error("%s: Root assign FAILED for qdisc %p (type %d), "
-			"response type: %d\n", __func__, nq->qdisc, nq->type,
-			nim->msg.shaper_configure.config.response_type);
-		nq->pending_final_state = NSS_QDISC_STATE_ROOT_SET_FAIL;
-		nss_qdisc_root_cleanup_free_node(nq);
-		return;
-	}
-
-	nss_qdisc_info("%s: Qdisc %p (type %d): set as root is done. Response - %d"
-			, __func__, nq->qdisc, nq->type, nim->msg.shaper_configure.config.response_type);
-	atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-}
-
-/*
- * nss_qdisc_root_init_alloc_node_callback()
- *	Invoked on the response to creating a shaper node as root
- */
-static void nss_qdisc_root_init_alloc_node_callback(void *app_data,
-						struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-	nss_tx_status_t rc;
-	int msg_type;
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_info("%s: Qdisc %p (type %d) root alloc node FAILED "
-			"response type: %d\n", __func__, nq->qdisc, nq->type,
-			nim->msg.shaper_configure.config.response_type);
-
-		nq->pending_final_state = NSS_QDISC_STATE_NODE_ALLOC_FAIL;
-
-		/*
-		 * No shaper node created, cleanup from unsassigning the shaper
-		 */
-		nss_qdisc_root_cleanup_shaper_unassign(nq);
-		return;
-	}
-
-	nss_qdisc_info("%s: Qdisc %p (type %d), shaper node alloc success: %u\n",
-				__func__, nq->qdisc, nq->type, nq->shaper_id);
-
-	/*
-	 * Create and send shaper configure message to the NSS interface
-	 */
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_CONFIG);
-	nss_qdisc_msg_init(nim, nq->nss_interface_number, msg_type,
-				sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *) nss_qdisc_root_init_root_assign_callback,
-				nq);
-	nim->msg.shaper_configure.config.request_type = NSS_SHAPER_CONFIG_TYPE_SET_ROOT;
-	nim->msg.shaper_configure.config.msg.set_root_node.qos_tag = nq->qos_tag;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, nim);
-
-	if (rc == NSS_TX_SUCCESS) {
-		return;
-	}
-
-	nss_qdisc_error("%s: Root assign send command failed: %d\n",
-			__func__, rc);
-
-	nq->pending_final_state = NSS_QDISC_STATE_ROOT_SET_SEND_FAIL;
-	nss_qdisc_root_cleanup_free_node(nq);
-}
-
-/*
- * nss_qdisc_root_init_shaper_assign_callback()
- *	Invoked on the response to a shaper assign config command issued
- */
-static void nss_qdisc_root_init_shaper_assign_callback(void *app_data,
-						struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-	nss_tx_status_t rc;
-	int msg_type;
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_warning("%s: Qdisc %x (type %d): shaper assign failed - phys_if response type: %d\n",
-			__func__, nq->qos_tag, nq->type, nim->cm.error);
-		/*
-		 * Unable to assign a shaper, perform cleanup from final stage
-		 */
-		nq->pending_final_state = NSS_QDISC_STATE_SHAPER_ASSIGN_FAILED;
-		nss_qdisc_root_cleanup_final(nq);
-		return;
-	}
-
-	if (nim->cm.type != NSS_IF_ISHAPER_ASSIGN && nim->cm.type != NSS_IF_BSHAPER_ASSIGN) {
-		nss_qdisc_error("%s: Qdisc %x (type %d): shaper assign callback received garbage: %d\n",
-			__func__, nq->qos_tag, nq->type, nim->cm.type);
-		/*
-		 * Unable to assign a shaper, perform cleanup from final stage
-		 */
-		nq->pending_final_state = NSS_QDISC_STATE_SHAPER_ASSIGN_FAILED;
-		nss_qdisc_root_cleanup_final(nq);
-		return;
-	} else {
-		nss_qdisc_info("%s: Qdisc %x (type %d): shaper assign callback received sane message: %d\n",
-			__func__, nq->qos_tag, nq->type, nim->cm.type);
-	}
-
-	/*
-	 * Shaper has been allocated and assigned
-	 */
-	nq->shaper_id = nim->msg.shaper_assign.new_shaper_id;
-	nss_qdisc_info("%s: Qdisc %p (type %d), shaper assigned: %u\n",
-				__func__, nq->qdisc, nq->type, nq->shaper_id);
-
-	/*
-	 * Create and send the shaper configure message to the NSS interface
-	 */
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_CONFIG);
-	nss_qdisc_msg_init(nim, nq->nss_interface_number, msg_type, sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_root_init_alloc_node_callback,
-				nq);
-	nim->msg.shaper_configure.config.request_type = NSS_SHAPER_CONFIG_TYPE_ALLOC_SHAPER_NODE;
-	nim->msg.shaper_configure.config.msg.alloc_shaper_node.node_type = nq->type;
-	nim->msg.shaper_configure.config.msg.alloc_shaper_node.qos_tag = nq->qos_tag;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, nim);
-
-	if (rc == NSS_TX_SUCCESS) {
-		return;
-	}
-
-	/*
-	 * Unable to send alloc node command, cleanup from unassigning the shaper
-	 */
-	nss_qdisc_error("%s: Qdisc %p (type %d) create command failed: %d\n",
-			__func__, 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
- *	cleanup is complete.
- */
-static void nss_qdisc_child_cleanup_final(struct nss_qdisc *nq)
-{
-	nss_qdisc_info("%s: Final cleanup type %d: %p\n", __func__,
-			nq->type, nq->qdisc);
-
-	/*
-	 * Finally unregister for shaping
-	 */
-	nss_qdisc_info("%s: Unregister for shaping\n", __func__);
-	nss_shaper_unregister_shaping(nq->nss_shaping_ctx);
-
-	/*
-	 * Now set our final state
-	 */
-	atomic_set(&nq->state, nq->pending_final_state);
-}
-
-
-/*
- * nss_qdisc_child_cleanup_free_node_callback()
- *	Invoked on the response to freeing a child shaper node
- */
-static void nss_qdisc_child_cleanup_free_node_callback(void *app_data,
-						struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_info("%s: Qdisc %p (type %d qos_tag %x): child free FAILED response type: %d\n",
-			__func__, nq->qdisc, nq->type, nq->qos_tag, nim->msg.shaper_configure.config.response_type);
-		return;
-	}
-
-	nss_qdisc_info("%s: Qdisc %p (type %d): child shaper node "
-			"free complete\n", __func__, nq->qdisc, nq->type);
-
-	/*
-	 * Perform final cleanup
-	 */
-	nss_qdisc_child_cleanup_final(nq);
-}
-
-/*
- * nss_qdisc_child_cleanup_free_node()
- *	Free the child shaper node, issue command to do so.
- */
-static void nss_qdisc_child_cleanup_free_node(struct nss_qdisc *nq)
-{
-	struct nss_if_msg nim;
-	nss_tx_status_t rc;
-	int msg_type;
-
-	nss_qdisc_info("%s: Qdisc %p (type %d qos_tag %x): free shaper node command\n",
-			__func__, nq->qdisc, nq->type, nq->qos_tag);
-
-	/*
-	 * Create and send the shaper configure message to the NSS interface
-	 */
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_CONFIG);
-	nss_qdisc_msg_init(&nim, nq->nss_interface_number, msg_type, sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_child_cleanup_free_node_callback,
-				nq);
-	nim.msg.shaper_configure.config.request_type = NSS_SHAPER_CONFIG_TYPE_FREE_SHAPER_NODE;
-	nim.msg.shaper_configure.config.msg.free_shaper_node.qos_tag = nq->qos_tag;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, &nim);
-
-	if (rc == NSS_TX_SUCCESS) {
-		return;
-	}
-
-	nss_qdisc_error("%s: Qdisc %p (type %d): child free node command send "
-			"failed: %d, qos tag: %x\n", __func__, nq->qdisc, nq->type,
-			rc, nq->qos_tag);
-
-	/*
-	 * Perform final cleanup
-	 */
-	nss_qdisc_child_cleanup_final(nq);
-}
-
-/*
- * nss_qdisc_child_init_alloc_node_callback()
- *	Invoked on the response to creating a child shaper node
- */
-static void nss_qdisc_child_init_alloc_node_callback(void *app_data, struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_error("%s: Qdisc %p (type %d): child alloc node FAILED, response "
-			"type: %d\n", __func__, nq->qdisc, nq->type, nim->msg.shaper_configure.config.response_type);
-		/*
-		 * Cleanup from final stage
-		 */
-		nq->pending_final_state = NSS_QDISC_STATE_NODE_ALLOC_FAIL_CHILD;
-		nss_qdisc_child_cleanup_final(nq);
-		return;
-	}
-
-	/*
-	 * Shaper node has been allocated
-	 */
-	nss_qdisc_info("%s: Qdisc %p (type %d): shaper node successfully "
-			"created as a child node\n",__func__, nq->qdisc, nq->type);
-
-	atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-}
-
-/*
- * nss_qdisc_add_to_tail_protected()
- *	Adds to list while holding the qdisc lock.
- */
-static inline void nss_qdisc_add_to_tail_protected(struct sk_buff *skb, struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-
-	/*
-	 * Since packets can come back from the NSS at any time (in case of bounce),
-	 * enqueue's and dequeue's can cause corruption, if not done within locks.
-	 */
-	spin_lock_bh(&nq->bounce_protection_lock);
-
-	/*
-	 * We do not use the qdisc_enqueue_tail() API here in order
-	 * to prevent stats from getting updated by the API.
-	 */
-	__skb_queue_tail(&sch->q, skb);
-
-	spin_unlock_bh(&nq->bounce_protection_lock);
-};
-
-/*
- * nss_qdisc_add_to_tail()
- *	Adds to list without holding any locks.
- */
-static inline void nss_qdisc_add_to_tail(struct sk_buff *skb, struct Qdisc *sch)
-{
-	/*
-	 * We do not use the qdisc_enqueue_tail() API here in order
-	 * to prevent stats from getting updated by the API.
-	 */
-	__skb_queue_tail(&sch->q, skb);
-};
-
-/*
- * nss_qdisc_remove_from_tail_protected()
- *	Removes from list while holding the qdisc lock.
- */
-static inline struct sk_buff *nss_qdisc_remove_from_tail_protected(struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-	struct sk_buff *skb;
-
-	/*
-	 * Since packets can come back from the NSS at any time (in case of bounce),
-	 * enqueue's and dequeue's can cause corruption, if not done within locks.
-	 */
-	spin_lock_bh(&nq->bounce_protection_lock);
-
-	/*
-	 * We use __skb_dequeue() to ensure that
-	 * stats don't get updated twice.
-	 */
-	skb = __skb_dequeue(&sch->q);
-
-	spin_unlock_bh(&nq->bounce_protection_lock);
-
-	return skb;
-};
-
-/*
- * nss_qdisc_remove_to_tail_protected()
- *	Removes from list without holding any locks.
- */
-static inline struct sk_buff *nss_qdisc_remove_from_tail(struct Qdisc *sch)
-{
-	/*
-	 * We use __skb_dequeue() to ensure that
-	 * stats don't get updated twice.
-	 */
-	return __skb_dequeue(&sch->q);
-};
-
-/*
- * nss_qdisc_bounce_callback()
- *	Enqueues packets bounced back from NSS firmware.
- */
-static void nss_qdisc_bounce_callback(void *app_data, struct sk_buff *skb)
-{
-	struct Qdisc *sch = (struct Qdisc *)app_data;
-
-	/*
-	 * Enqueue the packet for transmit and schedule a dequeue
-	 * This enqueue has to be protected in order to avoid corruption.
-	 */
-	nss_qdisc_add_to_tail_protected(skb, sch);
-	__netif_schedule(sch);
-}
-
-/*
- * nss_qdisc_peek()
- *	Called to peek at the head of an nss qdisc
- */
-struct sk_buff *nss_qdisc_peek(struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-	struct sk_buff *skb;
-
-	if (!nq->is_virtual) {
-		skb = skb_peek(&sch->q);
-	} else {
-		spin_lock_bh(&nq->bounce_protection_lock);
-		skb = skb_peek(&sch->q);
-		spin_unlock_bh(&nq->bounce_protection_lock);
-	}
-
-	return skb;
-}
-
-/*
- * nss_qdisc_drop()
- *	Called to drop the packet at the head of queue
- */
-unsigned int nss_qdisc_drop(struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-	unsigned int ret;
-
-	if (!nq->is_virtual) {
-		ret = __qdisc_queue_drop_head(sch, &sch->q);
-	} else {
-		spin_lock_bh(&nq->bounce_protection_lock);
-		/*
-		 * This function is safe to call within locks
-		 */
-		ret = __qdisc_queue_drop_head(sch, &sch->q);
-		spin_unlock_bh(&nq->bounce_protection_lock);
-	}
-
-	return ret;
-}
-
-/*
- * nss_qdisc_reset()
- *	Called when a qdisc is reset
- */
-void nss_qdisc_reset(struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-
-	nss_qdisc_info("%s: Qdisc %p (type %d) resetting\n",
-			__func__, sch, nq->type);
-
-	/*
-	 * Delete all packets pending in the output queue and reset stats
-	 */
-	if (!nq->is_virtual) {
-		qdisc_reset_queue(sch);
-	} else {
-		spin_lock_bh(&nq->bounce_protection_lock);
-		/*
-		 * This function is safe to call within locks
-		 */
-		qdisc_reset_queue(sch);
-		spin_unlock_bh(&nq->bounce_protection_lock);
-	}
-
-	nss_qdisc_info("%s: Qdisc %p (type %d) reset complete\n",
-			__func__, sch, nq->type);
-}
-
-/*
- * nss_qdisc_enqueue()
- *	Generic enqueue call for enqueuing packets into NSS for shaping
- */
-int nss_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-	nss_tx_status_t status;
-
-	/*
-	 * If we are not the root qdisc then we should not be getting packets!!
-	 */
-	if (unlikely(!nq->is_root)) {
-		nss_qdisc_error("%s: Qdisc %p (type %d): unexpected packet "
-			"for child qdisc - skb: %p\n", __func__, sch, nq->type, skb);
-		nss_qdisc_add_to_tail(skb, sch);
-		__netif_schedule(sch);
-		return NET_XMIT_SUCCESS;
-	}
-
-	/*
-	 * Packet enueued in linux for transmit.
-	 *
-	 * What we do here depends upon whether we are a bridge or not. If not a
-	 * bridge then it depends on if we are a physical or virtual interface
-	 * The decision we are trying to reach is whether to bounce a packet to
-	 * the NSS to be shaped or not.
-	 *
-	 * is_bridge		is_virtual	Meaning
-	 * ---------------------------------------------------------------------------
-	 * false		false		Physical interface in NSS
-	 *
-	 * Action: Simply allow the packet to be dequeued. The packet will be
-	 * shaped by the interface shaper in the NSS by the usual transmit path.
-	 *
-	 *
-	 * false		true		Physical interface in Linux.
-	 * 					NSS still responsible for shaping
-	 *
-	 * Action: Bounce the packet to the NSS virtual interface that represents
-	 * this Linux physical interface for INTERFACE shaping. When the packet is
-	 * returned from being shaped we allow it to be dequeued for transmit.
-	 *
-	 * true			n/a		Logical Linux interface.
-	 *					Root qdisc created a virtual interface
-	 *					to represent it in the NSS for shaping
-	 *					purposes.
-	 *
-	 * Action: Bounce the packet to the NSS virtual interface (for BRIDGE shaping)
-	 * the bridge root qdisc created for it. When the packet is returned from being
-	 * shaped we allow it to be dequeued for transmit.
-	 */
-
-	if (!nq->is_virtual) {
-		/*
-		 * TX to an NSS physical - the shaping will occur as part of normal
-		 * transmit path.
-		 */
-		nss_qdisc_add_to_tail(skb, sch);
-		__netif_schedule(sch);
-		return NET_XMIT_SUCCESS;
-	}
-
-	if (nq->is_bridge) {
-		/*
-		 * TX to a bridge, this is to be shaped by the b shaper on the virtual interface created
-		 * to represent the bridge interface.
-		 */
-		status = nss_shaper_bounce_bridge_packet(nq->bounce_context, nq->nss_interface_number, skb);
-		if (likely(status == NSS_TX_SUCCESS)) {
-			return NET_XMIT_SUCCESS;
-		}
-
-		nss_qdisc_warning("%s: Qdisc %p (type %d): failed to bounce for bridge %d, skb: %p\n",
-					__func__, sch, nq->type, nq->nss_interface_number, skb);
-		goto enqueue_drop;
-	}
-
-	/*
-	 * TX to a physical Linux (NSS virtual).  Bounce packet to NSS for
-	 * interface shaping.
-	 */
-	status = nss_shaper_bounce_interface_packet(nq->bounce_context,
-							nq->nss_interface_number, skb);
-	if (likely(status == NSS_TX_SUCCESS)) {
-		return NET_XMIT_SUCCESS;
-	}
-
-	/*
-	 * We failed to bounce the packet for shaping on a virtual interface
-	 */
-	nss_qdisc_warning("%s: Qdisc %p (type %d): failed to bounce for "
-		"interface: %d, skb: %p\n", __func__, sch, nq->type,
-		nq->nss_interface_number, skb);
-
-enqueue_drop:
-	/*
-	 * We were unable to transmit the packet for bridge shaping.
-	 * We therefore drop it.
-	 */
-	kfree_skb(skb);
-
-	return NET_XMIT_DROP;
-}
-
-/*
- * nss_qdisc_dequeue()
- *	Generic dequeue call for dequeuing bounced packets.
- */
-inline struct sk_buff *nss_qdisc_dequeue(struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-
-	/*
-	 * We use the protected dequeue API if the interface involves bounce.
-	 * That is, a bridge or a virtual interface. Else, we use the unprotected
-	 * API.
-	 */
-	if (nq->is_virtual) {
-		return nss_qdisc_remove_from_tail_protected(sch);
-	} else {
-		return nss_qdisc_remove_from_tail(sch);
-	}
-}
-
-/*
- * nss_qdisc_set_default_callback()
- *	The callback function for a shaper node set default
- */
-static void nss_qdisc_set_default_callback(void *app_data,
-					struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_error("%s: Qdisc %p (type %d): shaper node set default FAILED, response type: %d\n",
-			__func__, nq->qdisc, nq->type, nim->msg.shaper_configure.config.response_type);
-		atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE);
-		return;
-	}
-
-	nss_qdisc_info("%s: Qdisc %p (type %d): attach complete\n", __func__, nq->qdisc, nq->type);
-	atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-}
-
-/*
- * nss_qdisc_node_set_default()
- *	Configuration function that sets shaper node as default for packet enqueue
- */
-int nss_qdisc_set_default(struct nss_qdisc *nq)
-{
-	int32_t state, rc;
-	int msg_type;
-	struct nss_if_msg nim;
-	struct nss_qdisc *nq_root;
-
-	/*
-	 * Get root nss qdisc
-	 */
-	if (nq->is_root) {
-		nq_root = nq;
-	} else {
-		struct Qdisc *root = qdisc_root(nq->qdisc);
-		nq_root = qdisc_priv(root);
-	}
-
-	nss_qdisc_info("%s: Setting qdisc %p (type %d) as default\n", __func__,
-			nq->qdisc, nq->type);
-
-	state = atomic_read(&nq->state);
-	if (state != NSS_QDISC_STATE_READY) {
-		nss_qdisc_warning("%s: Qdisc %p (type %d): qdisc state not ready: %d\n", __func__,
-				nq->qdisc, nq->type, state);
-		return -1;
-	}
-
-	/*
-	 * Set shaper node state to IDLE
-	 */
-	atomic_set(&nq->state, NSS_QDISC_STATE_IDLE);
-
-	/*
-	 * Create the shaper configure message and send it down to the NSS interface
-	 */
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_CONFIG);
-	nss_qdisc_msg_init(&nim, nq->nss_interface_number, msg_type, sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_set_default_callback,
-				nq);
-	nim.msg.shaper_configure.config.request_type = NSS_SHAPER_CONFIG_TYPE_SET_DEFAULT;
-	nim.msg.shaper_configure.config.msg.set_default_node.qos_tag = nq->qos_tag;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, &nim);
-
-	if (rc != NSS_TX_SUCCESS) {
-		nss_qdisc_warning("%s: Failed to send set default message for "
-					"qdisc type %d\n", __func__, nq->type);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	/*
-	 * Wait until cleanup operation is complete at which point the state
-	 * shall become idle. NOTE: This relies on the NSS driver to be able
-	 * to operate asynchronously which means kernel preemption is required.
-	 */
-	while (NSS_QDISC_STATE_IDLE == (state = atomic_read(&nq->state))) {
-		yield();
-	}
-
-	if (state == NSS_QDISC_STATE_FAILED_RESPONSE) {
-		nss_qdisc_error("%s: Qdisc %p (type %d): failed to default "
-			"State: %d\n", __func__, nq->qdisc, nq->type, state);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	/*
-	 * Save the default nss qdisc pointer
-	 */
-	spin_lock_bh(&nq_root->lock);
-	nq_root->default_nq = nq;
-	spin_unlock_bh(&nq_root->lock);
-
-	nss_qdisc_info("%s: Qdisc %p (type %d): shaper node default complete\n",
-			__func__, nq->qdisc, nq->type);
-	return 0;
-}
-
-/*
- * nss_qdisc_node_attach_callback()
- *	The callback function for a shaper node attach message
- */
-static void nss_qdisc_node_attach_callback(void *app_data,
-					struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_info("%s: Qdisc %p (type %d) shaper node attach FAILED - response "
-			"type: %d\n", __func__, nq->qdisc, nq->type,
-			nim->msg.shaper_configure.config.response_type);
-		atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE);
-		return;
-	}
-
-	nss_qdisc_info("%s: qdisc type %d: %p, attach complete\n", __func__,
-			nq->type, nq->qdisc);
-
-	atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-}
-
-/*
- * nss_qdisc_node_attach()
- *	Configuration function that helps attach a child shaper node to a parent.
- */
-int nss_qdisc_node_attach(struct nss_qdisc *nq, struct nss_qdisc *nq_child,
-			struct nss_if_msg *nim, int32_t attach_type)
-{
-	int32_t state, rc;
-	int msg_type;
-
-	nss_qdisc_info("%s: Qdisc %p (type %d) attaching\n",
-			__func__, nq->qdisc, nq->type);
-
-	state = atomic_read(&nq->state);
-	if (state != NSS_QDISC_STATE_READY) {
-		nss_qdisc_warning("%s: Qdisc %p (type %d): not ready, state: %d\n",
-				__func__, nq->qdisc, nq->type, state);
-		return -1;
-	}
-
-	/*
-	 * Set shaper node state to IDLE
-	 */
-	atomic_set(&nq->state, NSS_QDISC_STATE_IDLE);
-
-	/*
-	 * Create the shaper configure message and send it down to the NSS interface
-	 */
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_CONFIG);
-	nss_qdisc_msg_init(nim, nq->nss_interface_number, msg_type, sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_node_attach_callback,
-				nq);
-	nim->msg.shaper_configure.config.request_type = attach_type;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, nim);
-
-	if (rc != NSS_TX_SUCCESS) {
-		nss_qdisc_warning("%s: Failed to send configure message for "
-					"qdisc type %d\n", __func__, nq->type);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	/*
-	 * Wait until cleanup operation is complete at which point the state
-	 * shall become idle. NOTE: This relies on the NSS driver to be able
-	 * to operate asynchronously which means kernel preemption is required.
-	 */
-	while (NSS_QDISC_STATE_IDLE == (state = atomic_read(&nq->state))) {
-		yield();
-	}
-
-	if (state == NSS_QDISC_STATE_FAILED_RESPONSE) {
-		nss_qdisc_error("%s: Qdisc %p (type %d) failed to attach child "
-			"node, State: %d\n", __func__, nq->qdisc, nq->type, state);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	spin_lock_bh(&nq_child->lock);
-	nq_child->parent = nq;
-	spin_unlock_bh(&nq_child->lock);
-
-	nss_qdisc_info("%s: Qdisc %p (type %d): shaper node attach complete\n",
-			__func__, nq->qdisc, nq->type);
-	return 0;
-}
-
-/*
- * nss_qdisc_node_detach_callback()
- *	The callback function for a shaper node detach message
- */
-static void nss_qdisc_node_detach_callback(void *app_data,
-					struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_info("%s: Qdisc %p (type %d): shaper node detach FAILED - response "
-			"type: %d\n", __func__, nq->qdisc, nq->type,
-			nim->msg.shaper_configure.config.response_type);
-		atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE);
-		return;
-	}
-
-	nss_qdisc_info("%s: Qdisc %p (type %d): detach complete\n",
-			__func__, nq->qdisc, nq->type);
-
-	atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-}
-
-/*
- * nss_qdisc_node_detach()
- *	Configuration function that helps detach a child shaper node to a parent.
- */
-int nss_qdisc_node_detach(struct nss_qdisc *nq, struct nss_qdisc *nq_child,
-	struct nss_if_msg *nim, int32_t detach_type)
-{
-	int32_t state, rc, msg_type;
-
-	nss_qdisc_info("%s: Qdisc %p (type %d) detaching\n",
-			__func__, nq->qdisc, nq->type);
-
-	state = atomic_read(&nq->state);
-	if (state != NSS_QDISC_STATE_READY) {
-		nss_qdisc_warning("%s: Qdisc %p (type %d): not ready, state: %d\n",
-				__func__, nq->qdisc, nq->type, state);
-		return -1;
-	}
-
-	/*
-	 * Set shaper node state to IDLE
-	 */
-	atomic_set(&nq->state, NSS_QDISC_STATE_IDLE);
-
-	/*
-	 * Create and send the shaper configure message to the NSS interface
-	 */
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_CONFIG);
-	nss_qdisc_msg_init(nim, nq->nss_interface_number, msg_type, sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_node_detach_callback,
-				nq);
-	nim->msg.shaper_configure.config.request_type = detach_type;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, nim);
-
-	if (rc != NSS_TX_SUCCESS) {
-		nss_qdisc_warning("%s: Qdisc %p (type %d): Failed to send configure "
-					"message.", __func__, nq->qdisc, nq->type);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	/*
-	 * Wait until cleanup operation is complete at which point the state shall become idle.
-	 * NOTE: This relies on the NSS driver to be able to operate asynchronously which means
-	 * kernel preemption is required.
-	 */
-	while (NSS_QDISC_STATE_IDLE == (state = atomic_read(&nq->state))) {
-		yield();
-	}
-
-	if (state == NSS_QDISC_STATE_FAILED_RESPONSE) {
-		nss_qdisc_error("%s: Qdisc %p (type %d): failed to detach child node, "
-				"State: %d\n", __func__, nq->qdisc, nq->type, state);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	spin_lock_bh(&nq_child->lock);
-	nq_child->parent = NULL;
-	spin_unlock_bh(&nq_child->lock);
-
-	nss_qdisc_info("%s: Qdisc %p (type %d): shaper node detach complete\n",
-			__func__, nq->qdisc, nq->type);
-	return 0;
-}
-
-/*
- * nss_qdisc_configure_callback()
- *	The call back function for a shaper node configure message
- */
-static void nss_qdisc_configure_callback(void *app_data,
-				struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_info("%s: Qdisc %p (type %d): shaper node configure FAILED "
-			"response type: %d\n", __func__, nq->qdisc, nq->type,
-			nim->msg.shaper_configure.config.response_type);
-		atomic_set(&nq->state, NSS_QDISC_STATE_FAILED_RESPONSE);
-		return;
-	}
-
-	nss_qdisc_info("%s: Qdisc %p (type %d): configuration complete\n",
-			__func__, nq->qdisc, nq->type);
-	atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-}
-
-/*
- * nss_qdisc_configure()
- *	Configuration function that aids in tuning of queuing parameters.
- */
-int nss_qdisc_configure(struct nss_qdisc *nq,
-	struct nss_if_msg *nim, int32_t config_type)
-{
-	int32_t state, rc;
-	int msg_type;
-
-	nss_qdisc_info("%s: Qdisc %p (type %d) configuring\n", __func__, nq->qdisc, nq->type);
-
-	state = atomic_read(&nq->state);
-	if (state != NSS_QDISC_STATE_READY) {
-		nss_qdisc_warning("%s: Qdisc %p (type %d): not ready for configure, "
-				"state : %d\n", __func__, nq->qdisc, nq->type, state);
-		return -1;
-	}
-
-	/*
-	 * Set shaper node state to IDLE
-	 */
-	atomic_set(&nq->state, NSS_QDISC_STATE_IDLE);
-
-	/*
-	 * Create and send the shaper configure message to the NSS interface
-	 */
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_CONFIG);
-	nss_qdisc_msg_init(nim, nq->nss_interface_number, msg_type, sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_configure_callback,
-				nq);
-	nim->msg.shaper_configure.config.request_type = config_type;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, nim);
-
-	if (rc != NSS_TX_SUCCESS) {
-		nss_qdisc_warning("%s: Qdisc %p (type %d): Failed to send configure "
-			"message\n", __func__, nq->qdisc, nq->type);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	/*
-	 * Wait until cleanup operation is complete at which point the state
-	 * shall become idle. NOTE: This relies on the NSS driver to be able
-	 * to operate asynchronously which means kernel preemption is required.
-	 */
-	while (NSS_QDISC_STATE_IDLE == (state = atomic_read(&nq->state))) {
-		yield();
-	}
-
-	if (state == NSS_QDISC_STATE_FAILED_RESPONSE) {
-		nss_qdisc_error("%s: Qdisc %p (type %d): failed to configure shaper "
-			"node: State: %d\n", __func__, nq->qdisc, nq->type, state);
-		atomic_set(&nq->state, NSS_QDISC_STATE_READY);
-		return -1;
-	}
-
-	nss_qdisc_info("%s: Qdisc %p (type %d): shaper node configure complete\n",
-			__func__, nq->qdisc, nq->type);
-	return 0;
-}
-
-/*
- * nss_qdisc_destroy()
- *	Destroys a shaper in NSS, and the sequence is based on the position of
- *	this qdisc (child or root) and the interface to which it is attached to.
- */
-void nss_qdisc_destroy(struct nss_qdisc *nq)
-{
-	int32_t state;
-
-	nss_qdisc_info("%s: Qdisc %p (type %d) destroy\n",
-			__func__, nq->qdisc, nq->type);
-
-
-	state = atomic_read(&nq->state);
-	if (state != NSS_QDISC_STATE_READY) {
-		nss_qdisc_warning("%s: Qdisc %p (type %d): destroy not ready, "
-				"state: %d\n", __func__, nq->qdisc, nq->type, state);
-		return;
-	}
-
-	/*
-	 * 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 this is root on a bridge interface, then unassign
-		 * the bshaper from all the attached interfaces.
-		 */
-		if (nq->is_bridge) {
-			nss_qdisc_info("%s: Qdisc %p (type %d): is root on bridge. Need to "
-				"unassign bshapers from its interfaces\n", __func__, nq->qdisc, nq->type);
-			nss_qdisc_refresh_bshaper_assignment(nq->qdisc, NSS_QDISC_SCAN_AND_UNASSIGN_BSHAPER);
-		}
-
-		/*
-		 * Begin by freeing the root shaper node
-		 */
-		nss_qdisc_root_cleanup_free_node(nq);
-
-	} else {
-		nss_qdisc_child_cleanup_free_node(nq);
-	}
-
-	/*
-	 * Wait until cleanup operation is complete at which point the state
-	 * shall become idle. NOTE: This relies on the NSS driver to be able
-	 * to operate asynchronously which means kernel preemption is required.
-	 */
-	while (NSS_QDISC_STATE_IDLE != (state = atomic_read(&nq->state))) {
-		yield();
-	}
-
-	if (nq->destroy_virtual_interface) {
-		nss_destroy_virt_if((void *)nq->nss_interface_number);
-	}
-
-	nss_qdisc_info("%s: Qdisc %p (type %d): destroy complete\n",
-			__func__, nq->qdisc, nq->type);
-}
-
-/*
- * nss_qdisc_init()
- *	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.
- */
-int nss_qdisc_init(struct Qdisc *sch, struct nss_qdisc *nq, nss_shaper_node_type_t type, uint32_t classid)
-{
-	struct Qdisc *root;
-	u32 parent;
-	nss_tx_status_t rc;
-	struct net_device *dev;
-	int32_t state;
-	struct nss_if_msg nim;
-	int msg_type;
-
-	/*
-	 * Initialize locks
-	 */
-	spin_lock_init(&nq->bounce_protection_lock);
-	spin_lock_init(&nq->lock);
-
-	/*
-	 * Record our qdisc and type in the private region for handy use
-	 */
-	nq->qdisc = sch;
-	nq->type = type;
-
-	/*
-	 * We dont have to destroy a virtual interface unless
-	 * we are the ones who created it. So set it to false
-	 * by default.
-	 */
-	nq->destroy_virtual_interface = false;
-
-	/*
-	 * Set shaper node state to IDLE
-	 */
-	atomic_set(&nq->state, NSS_QDISC_STATE_IDLE);
-
-	/*
-	 * If we are a class, then classid is used as the qos tag.
-	 * Else the qdisc handle will be used as the qos tag.
-	 */
-	if (classid) {
-		nq->qos_tag = classid;
-		nq->is_class = true;
-	} else {
-		nq->qos_tag = (uint32_t)sch->handle;
-		nq->is_class = false;
-	}
-
-	parent = sch->parent;
-
-	/*
-	 * If our parent is TC_H_ROOT and we are not a class, then we are the root qdisc.
-	 * Note, classes might have its qdisc as root, however we should not set is_root to
-	 * true for classes. This is the reason why we check for classid.
-	 */
-	if ((sch->parent == TC_H_ROOT) && (!nq->is_class)) {
-		nss_qdisc_info("%s: Qdisc %p (type %d) is root\n", __func__, nq->qdisc, nq->type);
-		nq->is_root = true;
-		root = sch;
-	} else {
-		nss_qdisc_info("%s: Qdisc %p (type %d) not root\n", __func__, nq->qdisc, nq->type);
-		nq->is_root = false;
-		root = qdisc_root(sch);
-	}
-
-	/*
-	 * Get the net device as it will tell us if we are on a bridge,
-	 * or on a net device that is represented by a virtual NSS interface (e.g. WIFI)
-	 */
-	dev = qdisc_dev(sch);
-	nss_qdisc_info("%s: Qdisc %p (type %d) init dev: %p\n", __func__, nq->qdisc, nq->type, dev);
-
-	/*
-	 * 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("%s: Qdisc %p (type %d) init qdisc: %p, is bridge\n",
-			__func__, nq->qdisc, nq->type, nq->qdisc);
-		nq->is_bridge = true;
-	} else {
-		nss_qdisc_info("%s: Qdisc %p (type %d) init qdisc: %p, not bridge\n",
-			__func__, nq->qdisc, nq->type, nq->qdisc);
-		nq->is_bridge = false;
-	}
-
-	nss_qdisc_info("%s: Qdisc %p (type %d) init root: %p, qos tag: %x, "
-		"parent: %x rootid: %s owner: %p\n", __func__, nq->qdisc, nq->type, root,
-		nq->qos_tag, parent, root->ops->id, root->ops->owner);
-
-	/*
-	 * The root must be of an nss type (unless we are of course going to be root).
-	 * This is to prevent mixing NSS qdisc with other types of qdisc.
-	 */
-	if ((parent != TC_H_ROOT) && (root->ops->owner != THIS_MODULE)) {
-		nss_qdisc_warning("%s: NSS qdisc %p (type %d) used along with non-NSS qdiscs,"
-			" or the interface is currently down", __func__, nq->qdisc, nq->type);
-	}
-
-	/*
-	 * Register for NSS shaping
-	 */
-	nq->nss_shaping_ctx = nss_shaper_register_shaping();
-	if (!nq->nss_shaping_ctx) {
-		nss_qdisc_error("%s: no shaping context returned for type %d\n",
-				__func__, nq->type);
-		atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED);
-		return -1;
-	}
-
-	/*
-	 * If we are not the root qdisc then we have a simple enough job to do
-	 */
-	if (!nq->is_root) {
-		struct nss_if_msg nim_alloc;
-		nss_qdisc_info("%s: Qdisc %p (type %d) initializing non-root qdisc\n",
-				__func__, nq->qdisc, nq->type);
-
-		/*
-		 * The device we are operational on MUST be recognised as an NSS interface.
-		 * NOTE: We do NOT support non-NSS known interfaces in this implementation.
-		 * NOTE: This will still work where the dev is registered as virtual, in which case
-		 * nss_interface_number shall indicate a virtual NSS interface.
-		 */
-		nq->nss_interface_number = nss_cmn_get_interface_number(nq->nss_shaping_ctx, dev);
-		if (nq->nss_interface_number < 0) {
-			nss_qdisc_error("%s: Qdisc %p (type %d) net device unknown to "
-				"nss driver %s\n", __func__, nq->qdisc, nq->type, dev->name);
-			nss_shaper_unregister_shaping(nq->nss_shaping_ctx);
-			atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED);
-			return -1;
-		}
-
-		/*
-		 * Set the virtual flag
-		 */
-		nq->is_virtual = nss_cmn_interface_is_virtual(nq->nss_shaping_ctx, nq->nss_interface_number);
-
-		/*
-		 * Create a shaper node for requested type.
-		 * Essentially all we need to do is create the shaper node.
-		 */
-		nss_qdisc_info("%s: Qdisc %p (type %d) non-root (child) create\n",
-				__func__, nq->qdisc, nq->type);
-
-		/*
-		 * Create and send the shaper configure message to the interface
-		 */
-		msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_CONFIG);
-		nss_qdisc_msg_init(&nim_alloc, nq->nss_interface_number, msg_type, sizeof(struct nss_if_msg),
-					(nss_if_msg_callback_t *)nss_qdisc_child_init_alloc_node_callback,
-					nq);
-		nim_alloc.msg.shaper_configure.config.request_type = NSS_SHAPER_CONFIG_TYPE_ALLOC_SHAPER_NODE;
-		nim_alloc.msg.shaper_configure.config.msg.alloc_shaper_node.node_type = nq->type;
-		nim_alloc.msg.shaper_configure.config.msg.alloc_shaper_node.qos_tag = nq->qos_tag;
-		rc = nss_if_tx_msg(nq->nss_shaping_ctx, &nim_alloc);
-
-		if (rc != NSS_TX_SUCCESS) {
-			nss_qdisc_error("%s: Qdisc %p (type %d) create command "
-				"failed: %d\n", __func__, nq->qdisc, nq->type, rc);
-			nq->pending_final_state = NSS_QDISC_STATE_CHILD_ALLOC_SEND_FAIL;
-			nss_qdisc_child_cleanup_final(nq);
-			return -1;
-		}
-
-		/*
-		 * Wait until init operation is complete.
-		 * NOTE: This relies on the NSS driver to be able to operate
-		 * asynchronously which means kernel preemption is required.
-		 */
-		while (NSS_QDISC_STATE_IDLE == (state = atomic_read(&nq->state))) {
-			yield();
-		}
-		nss_qdisc_info("%s: Qdisc %p (type %d): initialised with state: %d\n",
-					__func__, nq->qdisc, nq->type, state);
-		if (state > 0) {
-			return 0;
-		}
-		return -1;
-	}
-
-	/*
-	 * Root qdisc has a lot of work to do. It is responsible for setting up
-	 * the shaper and creating the root and default shaper nodes. Also, when
-	 * operating on a bridge, a virtual NSS interface is created to represent
-	 * 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("%s: init qdisc type %d : %p, ROOT\n", __func__, nq->type, nq->qdisc);
-
-	/*
-	 * Detect if we are operating on a bridge or interface
-	 */
-	if (nq->is_bridge) {
-		nss_qdisc_info("%s: Qdisc %p (type %d): initializing root qdisc on "
-			"bridge\n", __func__, nq->qdisc, nq->type);
-
-		/*
-		 * As we are a root qdisc on this bridge then we have to create a
-		 * virtual interface to represent this bridge in the NSS. This will
-		 * allow us to bounce packets to the NSS for bridge shaping action.
-		 * Also set the destroy virtual interface flag so that it is destroyed
-		 * when the module goes down. If this is not done, the OS waits for
-		 * the interface to be released.
-		 */
-		nq->virtual_interface_context = nss_create_virt_if(dev);
-		if (!nq->virtual_interface_context) {
-			nss_qdisc_error("%s: Qdisc %p (type %d): cannot create virtual "
-				"interface\n", __func__, nq->qdisc, nq->type);
-			nss_shaper_unregister_shaping(nq->nss_shaping_ctx);
-			atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED);
-			return -1;
-		}
-		nss_qdisc_info("%s: Qdisc %p (type %d): virtual interface registered "
-			"in NSS: %p\n", __func__, nq->qdisc, nq->type, nq->virtual_interface_context);
-
-		/*
-		 * Get the virtual interface number, and set the related flags
-		 */
-		nq->nss_interface_number = nss_virt_if_get_interface_num(nq->virtual_interface_context);
-		nq->destroy_virtual_interface = true;
-		nq->is_virtual = true;
-		nss_qdisc_info("%s: Qdisc %p (type %d) virtual interface number: %d\n",
-				__func__, nq->qdisc, nq->type, nq->nss_interface_number);
-
-		/*
-		 * The root qdisc will get packets enqueued to it, so it must
-		 * register for bridge bouncing as it will be responsible for
-		 * bouncing packets to the NSS for bridge shaping.
-		 */
-		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("%s: Qdisc %p (type %d): is root but cannot register "
-					"for bridge bouncing\n", __func__, nq->qdisc, nq->type);
-			nss_destroy_virt_if(nq->virtual_interface_context);
-			nss_shaper_unregister_shaping(nq->nss_shaping_ctx);
-			atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED);
-			return -1;
-		}
-
-	} else {
-		nss_qdisc_info("%s: Qdisc %p (type %d): is interface\n", __func__, nq->qdisc, nq->type);
-
-		/*
-		 * The device we are operational on MUST be recognised as an NSS interface.
-		 * NOTE: We do NOT support non-NSS known interfaces in this basic implementation.
-		 * NOTE: This will still work where the dev is registered as virtual, in which case
-		 * nss_interface_number shall indicate a virtual NSS interface.
-		 */
-		nq->nss_interface_number = nss_cmn_get_interface_number(nq->nss_shaping_ctx, dev);
-		if (nq->nss_interface_number < 0) {
-			nss_qdisc_error("%s: Qdisc %p (type %d): interface unknown to nss driver %s\n",
-					__func__, nq->qdisc, nq->type, dev->name);
-			nss_shaper_unregister_shaping(nq->nss_shaping_ctx);
-			atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED);
-			return -1;
-		}
-
-		/*
-		 * Is the interface virtual or not?
-		 * NOTE: If this interface is virtual then we have to bounce packets to it for shaping
-		 */
-		nq->is_virtual = nss_cmn_interface_is_virtual(nq->nss_shaping_ctx, nq->nss_interface_number);
-		if (!nq->is_virtual) {
-			nss_qdisc_info("%s: Qdisc %p (type %d): interface %u is physical\n",
-					__func__, nq->qdisc, nq->type, nq->nss_interface_number);
-		} else {
-			nss_qdisc_info("%s: Qdisc %p (type %d): interface %u is virtual\n",
-					__func__, nq->qdisc, nq->type, nq->nss_interface_number);
-
-			/*
-			 * Register for interface bounce shaping.
-			 */
-			nq->bounce_context = nss_shaper_register_shaper_bounce_interface(nq->nss_interface_number,
-								nss_qdisc_bounce_callback, nq->qdisc, THIS_MODULE);
-			if (!nq->bounce_context) {
-				nss_qdisc_error("%s: Qdisc %p (type %d): is root but failed "
-				"to register for interface bouncing\n", __func__, nq->qdisc, nq->type);
-				nss_shaper_unregister_shaping(nq->nss_shaping_ctx);
-				atomic_set(&nq->state, NSS_QDISC_STATE_INIT_FAILED);
-				return -1;
-			}
-		}
-	}
-
-	/*
-	 * We need to issue a command to establish a shaper on the interface.
-	 */
-
-	/*
-	 * Create and send the shaper assign message to the NSS interface
-	 */
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_ASSIGN);
-	nss_qdisc_msg_init(&nim, nq->nss_interface_number, msg_type, sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_root_init_shaper_assign_callback,
-				nq);
-	nim.msg.shaper_assign.shaper_id = 0;	/* Any free shaper will do */
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, &nim);
-
-	if (rc != NSS_TX_SUCCESS) {
-		nss_qdisc_error("%s: shaper assign command failed: %d\n", __func__, rc);
-		nq->pending_final_state = NSS_QDISC_STATE_ASSIGN_SHAPER_SEND_FAIL;
-		nss_qdisc_root_cleanup_final(nq);
-		/*
-		 * We dont have to clean up the virtual interface, since this is
-		 * taken care of by the nss_qdisc_root_cleanup_final() function.
-		 */
-		return -1;
-	}
-
-	/*
-	 * Wait until init operation is complete.
-	 * NOTE: This relies on the NSS driver to be able to operate asynchronously which means
-	 * kernel preemption is required.
-	 */
-	nss_qdisc_info("%s: Qdisc %p (type %d): Waiting on response from NSS for "
-			"shaper assign message\n", __func__, nq->qdisc, nq->type);
-	while (NSS_QDISC_STATE_IDLE == (state = atomic_read(&nq->state))) {
-		yield();
-	}
-	nss_qdisc_info("%s: Qdisc %p (type %d): is initialised with state: %d\n",
-			__func__, nq->qdisc, nq->type, state);
-
-	if (state > 0) {
-
-		/*
-		 * Return if this is not a root qdisc on a bridge interface.
-		 */
-		if (!nq->is_root || !nq->is_bridge) {
-			return 0;
-		}
-
-		nss_qdisc_info("%s: This is a bridge interface. Linking bridge ...\n",
-				__func__);
-		/*
-		 * This is a root qdisc added to a bridge interface. Now we go ahead
-		 * and add this B-shaper to interfaces known to the NSS
-		 */
-		if (nss_qdisc_refresh_bshaper_assignment(nq->qdisc, NSS_QDISC_SCAN_AND_ASSIGN_BSHAPER) < 0) {
-			nss_qdisc_destroy(nq);
-			nss_qdisc_error("%s: bridge linking failed\n", __func__);
-			return -1;
-		}
-		nss_qdisc_info("%s: Bridge linking complete\n", __func__);
-		return 0;
-	}
-
-	/*
-	 * Destroy any virtual interfaces created by us before returning a failure.
-	 */
-	if (nq->destroy_virtual_interface) {
-		nss_destroy_virt_if(nq->virtual_interface_context);
-	}
-
-	return -1;
-}
-
-/*
- * nss_qdisc_basic_stats_callback()
- *	Invoked after getting basic stats
- */
-static void nss_qdisc_basic_stats_callback(void *app_data,
-				struct nss_if_msg *nim)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
-	struct Qdisc *qdisc = nq->qdisc;
-	struct gnet_stats_basic_packed *bstats;	/* Basic class statistics */
-	struct gnet_stats_queue *qstats;	/* Qstats for use by classes */
-	atomic_t *refcnt;
-
-	if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
-		nss_qdisc_info("%s: Qdisc %p (type %d): Receive stats FAILED - "
-			"response: type: %d\n", __func__, qdisc, nq->type,
-			nim->msg.shaper_configure.config.response_type);
-		atomic_sub(1, &nq->pending_stat_requests);
-		return;
-	}
-
-	/*
-	 * Record latest basic stats
-	 */
-	nq->basic_stats_latest = nim->msg.shaper_configure.config.msg.shaper_node_basic_stats_get;
-
-	/*
-	 * Get the right stats pointers based on whether it is a class
-	 * or a qdisc.
-	 */
-	if (nq->is_class) {
-		bstats = &nq->bstats;
-		qstats = &nq->qstats;
-		refcnt = &nq->refcnt;
-	} else {
-		bstats = &qdisc->bstats;
-		qstats = &qdisc->qstats;
-		refcnt = &qdisc->refcnt;
-		qdisc->q.qlen = nq->basic_stats_latest.qlen_packets;
-	}
-
-	/*
-	 * Get the right stats pointers based on whether it is a class
-	 * or a qdisc.
-	 */
-	if (nq->is_class) {
-		bstats = &nq->bstats;
-		qstats = &nq->qstats;
-		refcnt = &nq->refcnt;
-	} else {
-		bstats = &qdisc->bstats;
-		qstats = &qdisc->qstats;
-		refcnt = &qdisc->refcnt;
-		qdisc->q.qlen = nq->basic_stats_latest.qlen_packets;
-	}
-
-	/*
-	 * Update qdisc->bstats
-	 */
-	spin_lock_bh(&nq->lock);
-	bstats->bytes += (__u64)nq->basic_stats_latest.delta.dequeued_bytes;
-	bstats->packets += nq->basic_stats_latest.delta.dequeued_packets;
-
-	/*
-	 * Update qdisc->qstats
-	 */
-	qstats->backlog = nq->basic_stats_latest.qlen_bytes;
-
-	qstats->drops += (nq->basic_stats_latest.delta.enqueued_packets_dropped +
-				nq->basic_stats_latest.delta.dequeued_packets_dropped);
-
-	/*
-	 * Update qdisc->qstats
-	 */
-	qstats->qlen = nq->basic_stats_latest.qlen_packets;
-	qstats->requeues = 0;
-	qstats->overlimits += nq->basic_stats_latest.delta.queue_overrun;
-	spin_unlock_bh(&nq->lock);
-
-	/*
-	 * All access to nq fields below do not need lock protection. They
-	 * do not get manipulated on different thread contexts.
-	 */
-	if (atomic_read(refcnt) == 0) {
-		atomic_sub(1, &nq->pending_stat_requests);
-		wake_up(&nss_qdics_wq);
-		return;
-	}
-
-	/*
-	 * Requests for stats again, after 1 sec.
-	 */
-	nq->stats_get_timer.expires += HZ;
-	if (nq->stats_get_timer.expires <= jiffies) {
-		nss_qdisc_warning("losing time %lu, jiffies = %lu\n",
-				nq->stats_get_timer.expires, jiffies);
-		nq->stats_get_timer.expires = jiffies + HZ;
-	}
-	add_timer(&nq->stats_get_timer);
-}
-
-/*
- * nss_qdisc_get_stats_timer_callback()
- *	Invoked periodically to get updated stats
- */
-static void nss_qdisc_get_stats_timer_callback(unsigned long int data)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)data;
-	nss_tx_status_t rc;
-	struct nss_if_msg nim;
-	int msg_type;
-
-	/*
-	 * Create and send the shaper configure message to the NSS interface
-	 */
-	msg_type = nss_qdisc_get_interface_msg(nq->is_bridge, NSS_QDISC_IF_SHAPER_CONFIG);
-	nss_qdisc_msg_init(&nim, nq->nss_interface_number, msg_type, sizeof(struct nss_if_msg),
-				(nss_if_msg_callback_t *)nss_qdisc_basic_stats_callback,
-				nq);
-	nim.msg.shaper_configure.config.request_type = NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_BASIC_STATS_GET;
-	nim.msg.shaper_configure.config.msg.shaper_node_basic_stats_get.qos_tag = nq->qos_tag;
-	rc = nss_if_tx_msg(nq->nss_shaping_ctx, &nim);
-
-	if (rc != NSS_TX_SUCCESS) {
-		nss_qdisc_error("%s: %p: basic stats get failed to send\n",
-				__func__, nq->qdisc);
-		atomic_sub(1, &nq->pending_stat_requests);
-		wake_up(&nss_qdics_wq);
-	}
-}
-
-/*
- * nss_qdisc_start_basic_stats_polling()
- *	Call to initiate the stats polling timer
- */
-void nss_qdisc_start_basic_stats_polling(struct nss_qdisc *nq)
-{
-	init_timer(&nq->stats_get_timer);
-	nq->stats_get_timer.function = nss_qdisc_get_stats_timer_callback;
-	nq->stats_get_timer.data = (unsigned long)nq;
-	nq->stats_get_timer.expires = jiffies + HZ;
-	atomic_set(&nq->pending_stat_requests, 1);
-	add_timer(&nq->stats_get_timer);
-}
-
-/*
- * nss_qdisc_stop_basic_stats_polling()
- *	Call to stop polling of basic stats
- */
-void nss_qdisc_stop_basic_stats_polling(struct nss_qdisc *nq)
-{
-	/*
-	 * If the timer was active, then delete timer and return.
-	 */
-	if (del_timer(&nq->stats_get_timer) > 0) {
-		/*
-		 * The timer was still active (counting down) when it was deleted.
-		 * Therefore we are sure that there are no pending stats request
-		 * for which we need to wait for. We can therefore return.
-		 */
-		return;
-	}
-
-	/*
-	 * The timer has already fired, which means we have a pending stat response.
-	 * We will have to wait until we have received the pending response.
-	 */
-	if (!wait_event_timeout(nss_qdics_wq, atomic_read(&nq->pending_stat_requests) == 0,
-				NSS_QDISC_COMMAND_TIMEOUT)) {
-		nss_qdisc_error("Stats request command for %x timedout!\n", nq->qos_tag);
-	}
-}
-
-/*
- * nss_qdisc_if_event_cb()
- *	Callback function that is registered to listen to events on net_device.
- */
-static int nss_qdisc_if_event_cb(struct notifier_block *unused,
-					unsigned long event, void *ptr)
-{
-	struct net_device *dev = (struct net_device *)ptr;
-	struct net_device *br;
-	struct Qdisc *br_qdisc;
-	int if_num, br_num;
-
-	switch (event) {
-	case NETDEV_BR_JOIN:
-		nss_qdisc_info("Reveived NETDEV_BR_JOIN on interface %s\n",
-				dev->name);
-	case NETDEV_BR_LEAVE:
-		nss_qdisc_info("Reveived NETDEV_BR_LEAVE on interface %s\n",
-				dev->name);
-		br = dev->master;
-		if_num = nss_cmn_get_interface_number(nss_qdisc_ctx, dev);
-
-		if (br == NULL || br->priv_flags != IFF_EBRIDGE) {
-			nss_qdisc_error("Sensed bridge activity on interface %s "
-				"that is not on any bridge\n", dev->name);
-			break;
-		}
-
-		br_num = nss_cmn_get_interface_number(nss_qdisc_ctx, br);
-		br_qdisc = br->qdisc;
-		/*
-		 * TODO: Properly ensure that the interface and bridge are
-		 * shaped by us.
-		 */
-		if (if_num < 0 || br_num < 0) {
-			nss_qdisc_info("No action taken since if_num is %d for %s "
-					"and br_num is %d for bridge %s\n", if_num,
-					dev->name, br_num, br->name);
-			break;
-		}
-
-		/*
-		 * Call attach or detach according as per event type.
-		 */
-		if (event == NETDEV_BR_JOIN) {
-			nss_qdisc_info("Instructing interface %s to attach to bridge(%s) "
-					"shaping\n", dev->name, br->name);
-			nss_qdisc_attach_bshaper(br_qdisc, if_num);
-		} else if (event == NETDEV_BR_LEAVE) {
-			nss_qdisc_info("Instructing interface %s to detach from bridge(%s) "
-					"shaping\n",dev->name, br->name);
-			nss_qdisc_detach_bshaper(br_qdisc, if_num);
-		}
-
-		break;
-	default:
-		nss_qdisc_info("Received NETDEV_DEFAULT on interface %s\n", dev->name);
-		break;
-	}
-
-	return NOTIFY_DONE;
-}
-
-static struct notifier_block nss_qdisc_device_notifier = {
-		.notifier_call = nss_qdisc_if_event_cb };
-
-/*
- * TODO: Get the bridge related code out into nss_qdisc_bridge.c
- * Get the stats into nss_qdisc_stats.c
- *
- */
-
-/* ================== Module registration ================= */
-
-static int __init nss_qdisc_module_init(void)
-{
-	int ret;
-	nss_qdisc_info("Module initializing");
-	nss_qdisc_ctx = nss_shaper_register_shaping();
-
-	/*
-	 * Initialize the wait queue node
-	 */
-	init_waitqueue_head(&nss_qdics_wq);
-
-	ret = register_qdisc(&nss_pfifo_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nsspfifo registered");
-
-	ret = register_qdisc(&nss_bfifo_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nssbfifo registered");
-
-	ret = register_qdisc(&nss_codel_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nsscodel registered");
-
-	ret = register_qdisc(&nss_tbl_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nsstbl registered");
-
-	ret = register_qdisc(&nss_prio_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nssprio registered");
-
-	ret = register_qdisc(&nss_bf_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nssbf registered");
-
-	ret = register_qdisc(&nss_wrr_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nsswrr registered");
-
-	ret = register_qdisc(&nss_wfq_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nsswfq registered");
-
-	ret = register_qdisc(&nss_htb_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nsshtb registered");
-
-	ret = register_qdisc(&nss_blackhole_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nssblackhole registered");
-
-	ret = register_qdisc(&nss_red_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nssred registered");
-
-	ret = register_qdisc(&nss_wred_qdisc_ops);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nsswred registered");
-
-	ret = register_netdevice_notifier(&nss_qdisc_device_notifier);
-	if (ret != 0)
-		return ret;
-	nss_qdisc_info("nss qdisc device notifiers registered");
-
-	return 0;
-}
-
-static void __exit nss_qdisc_module_exit(void)
-{
-	unregister_qdisc(&nss_pfifo_qdisc_ops);
-	nss_qdisc_info("nsspfifo unregistered");
-
-	unregister_qdisc(&nss_bfifo_qdisc_ops);
-	nss_qdisc_info("nssbfifo unregistered");
-
-	unregister_qdisc(&nss_codel_qdisc_ops);
-	nss_qdisc_info("nsscodel unregistered");
-
-	unregister_qdisc(&nss_tbl_qdisc_ops);
-	nss_qdisc_info("nsstbl unregistered");
-
-	unregister_qdisc(&nss_prio_qdisc_ops);
-	nss_qdisc_info("nssprio unregistered");
-
-	unregister_qdisc(&nss_bf_qdisc_ops);
-	nss_qdisc_info("nssbf unregistered\n");
-
-	unregister_qdisc(&nss_wrr_qdisc_ops);
-	nss_qdisc_info("nsswrr unregistered\n");
-
-	unregister_qdisc(&nss_wfq_qdisc_ops);
-	nss_qdisc_info("nsswfq unregistered\n");
-
-	unregister_qdisc(&nss_htb_qdisc_ops);
-	nss_qdisc_info("nsshtb unregistered\n");
-
-	unregister_qdisc(&nss_blackhole_qdisc_ops);
-	nss_qdisc_info("nssblackhole unregistered\n");
-
-	unregister_qdisc(&nss_red_qdisc_ops);
-	nss_qdisc_info("nssred unregistered\n");
-
-	unregister_qdisc(&nss_wred_qdisc_ops);
-	nss_qdisc_info("nsswred unregistered\n");
-
-	unregister_netdevice_notifier(&nss_qdisc_device_notifier);
-}
-
-module_init(nss_qdisc_module_init)
-module_exit(nss_qdisc_module_exit)
-
-MODULE_LICENSE("GPL");
diff --git a/nss_qdisc/nss_qdisc.h b/nss_qdisc/nss_qdisc.h
deleted file mode 100644
index 84a4944..0000000
--- a/nss_qdisc/nss_qdisc.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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 <linux/module.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/skbuff.h>
-#include <net/pkt_sched.h>
-#include <net/inet_ecn.h>
-#include <net/netfilter/nf_conntrack.h>
-#include <linux/if_bridge.h>
-#include <linux/list.h>
-#include <linux/version.h>
-#include <br_private.h>
-#include <nss_api_if.h>
-
-/*
- * NSS QDisc debug macros
- */
-#if (NSS_QDISC_DEBUG_LEVEL < 1)
-#define nss_qdisc_assert(c, s, args...)
-#define nss_qdisc_error(fmt, args...)
-#else
-#define nss_qdisc_assert(c, s, args...) if (!(c)) { printk("%d:ASSERT:"s, __LINE__, ##args); BUG(); }
-#define nss_qdisc_error(fmt, args...) printk(KERN_ERR "%d:ERROR:"fmt, __LINE__, ##args)
-#endif
-
-#if (NSS_QDISC_DEBUG_LEVEL < 2)
-#define nss_qdisc_warning(fmt, args...)
-#else
-#define nss_qdisc_warning(fmt, args...) printk(KERN_WARNING "%d:WARN:"fmt, __LINE__, ##args)
-#endif
-
-#if (NSS_QDISC_DEBUG_LEVEL < 3)
-#define nss_qdisc_info(fmt, args...)
-#else
-#define nss_qdisc_info(fmt, args...) printk(KERN_INFO "%d:INFO:"fmt, __LINE__, ##args)
-#endif
-
-#if (NSS_QDISC_DEBUG_LEVEL < 4)
-#define nss_qdisc_trace(fmt, args...)
-#else
-#define nss_qdisc_trace(fmt, args...) printk(KERN_DEBUG "%d:TRACE:"fmt, __LINE__, ##args)
-#endif
-
-/*
- * State values
- */
-#define NSS_QDISC_STATE_IDLE 0
-#define NSS_QDISC_STATE_READY 1
-#define NSS_QDISC_STATE_BUSY 2
-
-#define NSS_QDISC_STATE_INIT_FAILED -1
-#define NSS_QDISC_STATE_ASSIGN_SHAPER_SEND_FAIL -2
-#define NSS_QDISC_STATE_SHAPER_ASSIGN_FAILED -3
-#define NSS_QDISC_STATE_NODE_ALLOC_SEND_FAIL -4
-#define NSS_QDISC_STATE_NODE_ALLOC_FAIL -5
-#define NSS_QDISC_STATE_ROOT_SET_SEND_FAIL -6
-#define NSS_QDISC_STATE_ROOT_SET_FAIL -7
-#define NSS_QDISC_STATE_DEFAULT_SET_SEND_FAIL -8
-#define NSS_QDISC_STATE_DEFAULT_SET_FAIL -9
-#define NSS_QDISC_STATE_CHILD_ALLOC_SEND_FAIL -10
-#define NSS_QDISC_STATE_NODE_ALLOC_FAIL_CHILD -11
-#define NSS_QDISC_STATE_FAILED_RESPONSE -12
-
-#define NSS_QDISC_BRIDGE_PORT_MAX 100
-
-
-struct nss_qdisc {
-	struct Qdisc *qdisc;			/* Handy pointer back to containing qdisc */
-	struct nss_qdisc *parent;		/* Pointer to parent nss qdisc */
-	struct nss_qdisc *default_nq;		/* Default enqueue node */
-	void *nss_shaping_ctx;			/* NSS context for general operations */
-	int32_t nss_interface_number;		/* NSS Interface number we are shaping on */
-	nss_shaper_node_type_t type;		/* Type of shaper node */
-	bool is_class;				/* True if this represents a class and not a qdisc */
-	bool is_root;				/* True if root qdisc on a net device */
-	bool is_bridge;				/* True when qdisc is a bridge */
-	bool is_virtual;			/* True when the device is represented as a virtual in
-						 * the NSS e.g. perhaps operating on a wifi interface
-						 * or bridge.
-						 */
-	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.
-						 */
-	atomic_t state;				/* < 0: Signal that qdisc has 'failed'. 0
-						 * indicates 'pending' setup.  > 0 is READY.
-						 * NOTE: volatile AND atomic - this is polled
-						 * AND is used for syncronisation.
-						 */
-	uint32_t shaper_id;			/* Used when is_root. Child qdiscs use this
-						 * information to know what shaper under
-						 * which to create shaper nodes
-						 */
-	uint32_t qos_tag;			/* QoS tag of this node */
-	volatile int32_t pending_final_state;	/* Used to let the callback cycle know what
-						 * state to set the qdisc in on successful
-						 * completion.
-						 */
-	void *virtual_interface_context;	/* Context provided by the NSS driver for
-						 * new interfaces that are registered.
-						 */
-	void *bounce_context;			/* Context for bounce registration. Bounce
-						 * enables packets to be sent to NSS for
-						 * shaping purposes, and is returned to
-						 * Linux for transmit.
-						 */
-	spinlock_t bounce_protection_lock;	/* Lock to protect the enqueue and dequeue
-						 * operation on skb lists triggeret by bounce
-						 * callbacks.
-						 */
-	void (*stats_update_callback)(void *, struct nss_shaper_configure *);
-						/* Stats update callback function for qdisc specific
-						 * stats update. Currently unused.
-						 */
-	struct gnet_stats_basic_packed bstats;	/* Basic class statistics */
-	struct gnet_stats_queue qstats;		/* Qstats for use by classes */
-	atomic_t refcnt;			/* Reference count for class use */
-	struct timer_list stats_get_timer;	/* Timer used to poll for stats */
-	atomic_t pending_stat_requests;		/* Number of pending stats responses */
-	struct nss_shaper_shaper_node_basic_stats_get basic_stats_latest;
-						/* Latest stats obtained */
-	struct hlist_head *hash;		/* Pointer to hash table */
-	struct hlist_node hnode;		/* Node for participating in a hlist */
-	spinlock_t lock;			/* Lock to protect the nss qdisc structure */
-};
-
-/*
- * nss_qdisc bridge update structure
- */
-struct nss_qdisc_bridge_update {
-	int port_list[NSS_QDISC_BRIDGE_PORT_MAX];
-	int port_list_count;
-	int unassign_count;
-};
-
-/*
- * Task types for bridge scanner.
- */
-enum nss_qdisc_bshaper_tasks {
-	NSS_QDISC_SCAN_AND_ASSIGN_BSHAPER,
-	NSS_QDISC_SCAN_AND_UNASSIGN_BSHAPER,
-};
-
-/*
- * Types of messages sent down to NSS interfaces
- */
-enum nss_qdisc_interface_msgs {
-	NSS_QDISC_IF_SHAPER_ASSIGN,
-	NSS_QDISC_IF_SHAPER_UNASSIGN,
-	NSS_QDISC_IF_SHAPER_CONFIG,
-};
-
-/*
- * nss_qdisc_peek()
- *	Called to peek at the head of an nss qdisc
- */
-extern struct sk_buff *nss_qdisc_peek(struct Qdisc *sch);
-
-/*
- * nss_qdisc_drop()
- *	Called to drop the packet at the head of queue
- */
-extern unsigned int nss_qdisc_drop(struct Qdisc *sch);
-
-/*
- * nss_qdisc_reset()
- *	Called when a qdisc is reset
- */
-extern void nss_qdisc_reset(struct Qdisc *sch);
-
-/*
- * nss_qdisc_enqueue()
- *	Generic enqueue call for enqueuing packets into NSS for shaping
- */
-extern int nss_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch);
-
-/*
- * nss_qdisc_dequeue()
- *	Generic dequeue call for dequeuing bounced packets.
- */
-extern struct sk_buff *nss_qdisc_dequeue(struct Qdisc *sch);
-
-/*
- * nss_qdisc_node_set_default()
- *	Configuration function that sets shaper node as default for packet enqueue
- */
-extern int nss_qdisc_set_default(struct nss_qdisc *nq);
-
-/*
- * nss_qdisc_node_attach()
- *	Configuration function that helps attach a child shaper node to a parent.
- */
-extern int nss_qdisc_node_attach(struct nss_qdisc *nq, struct nss_qdisc *nq_child,
-					struct nss_if_msg *nim, int32_t attach_type);
-
-/*
- * nss_qdisc_node_detach()
- *	Configuration function that helps detach a child shaper node to a parent.
- */
-extern int nss_qdisc_node_detach(struct nss_qdisc *nq, struct nss_qdisc *nq_child,
-					struct nss_if_msg *nim, int32_t detach_type);
-
-/*
- * nss_qdisc_configure()
- *	Configuration function that aids in tuning of queuing parameters.
- */
-extern int nss_qdisc_configure(struct nss_qdisc *nq,
-	struct nss_if_msg *nim, int32_t config_type);
-
-/*
- * nss_qdisc_destroy()
- *	Destroys a shaper in NSS, and the sequence is based on the position of
- *	this qdisc (child or root) and the interface to which it is attached to.
- */
-extern void nss_qdisc_destroy(struct nss_qdisc *nq);
-
-/*
- * nss_qdisc_init()
- *	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.
- */
-extern int nss_qdisc_init(struct Qdisc *sch, struct nss_qdisc *nq, nss_shaper_node_type_t type, uint32_t classid);
-
-/*
- * nss_qdisc_start_basic_stats_polling()
- *	Call to initiate the stats polling timer
- */
-extern void nss_qdisc_start_basic_stats_polling(struct nss_qdisc *nq);
-
-/*
- * nss_qdisc_stop_basic_stats_polling()
- *	Call to stop polling of basic stats
- */
-extern void nss_qdisc_stop_basic_stats_polling(struct nss_qdisc *nq);
diff --git a/nss_qdisc/nss_tbl.c b/nss_qdisc/nss_tbl.c
deleted file mode 100644
index d86e15c..0000000
--- a/nss_qdisc/nss_tbl.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_qdisc.h"
-
-struct nss_tbl_sched_data {
-	struct nss_qdisc nq;	/* Common base class for all nss qdiscs */
-	u32 rate;			/* Limiting rate of TBL */
-	u32 peakrate;			/* Maximum rate to control bursts */
-	u32 burst;			/* Maximum allowed burst size */
-	u32 mtu;			/* MTU of the interface attached to */
-	struct Qdisc *qdisc;		/* Qdisc to which it is attached to */
-};
-
-
-static int nss_tbl_enqueue(struct sk_buff *skb, struct Qdisc *sch)
-{
-	return nss_qdisc_enqueue(skb, sch);
-}
-
-static struct sk_buff *nss_tbl_dequeue(struct Qdisc *sch)
-{
-	return nss_qdisc_dequeue(sch);
-}
-
-static unsigned int nss_tbl_drop(struct Qdisc *sch)
-{
-	return nss_qdisc_drop(sch);
-}
-
-static struct sk_buff *nss_tbl_peek(struct Qdisc *sch)
-{
-	return nss_qdisc_peek(sch);
-}
-
-static void nss_tbl_reset(struct Qdisc *sch)
-{
-	nss_qdisc_reset(sch);
-}
-
-static void nss_tbl_destroy(struct Qdisc *sch)
-{
-	struct nss_tbl_sched_data *q = qdisc_priv(sch);
-	struct nss_qdisc *nq_child = (struct nss_qdisc *)qdisc_priv(q->qdisc);
-	struct nss_if_msg nim;
-
-	/*
-	 * We must always detach our child node in NSS before destroying it.
-	 * Also, we make sure we dont send down the command for noop qdiscs.
-	 */
-	if (q->qdisc != &noop_qdisc) {
-		nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
-		if (nss_qdisc_node_detach(&q->nq, nq_child, &nim,
-				NSS_SHAPER_CONFIG_TYPE_TBL_DETACH) < 0) {
-			nss_qdisc_error("%s: Failed to detach child %x from nss_tbl %x\n",
-					__func__, q->qdisc->handle, q->nq.qos_tag);
-			return;
-		}
-	}
-
-	/*
-	 * Now we can destroy our child qdisc
-	 */
-	qdisc_destroy(q->qdisc);
-
-	/*
-	 * Stop the polling of basic stats and destroy qdisc.
-	 */
-	nss_qdisc_stop_basic_stats_polling(&q->nq);
-	nss_qdisc_destroy(&q->nq);
-}
-
-static const struct nla_policy nss_tbl_policy[TCA_NSSTBL_MAX + 1] = {
-	[TCA_NSSTBL_PARMS] = { .len = sizeof(struct tc_nsstbl_qopt) },
-};
-
-static int nss_tbl_change(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_tbl_sched_data *q = qdisc_priv(sch);
-	struct nlattr *na[TCA_NSSTBL_MAX + 1];
-	struct tc_nsstbl_qopt *qopt;
-	struct nss_if_msg nim;
-	int err;
-	struct net_device *dev = qdisc_dev(sch);
-
-	if (opt == NULL)
-		return -EINVAL;
-
-	err = nla_parse_nested(na, TCA_NSSTBL_MAX, opt, nss_tbl_policy);
-	if (err < 0)
-		return err;
-
-	if (na[TCA_NSSTBL_PARMS] == NULL)
-		return -EINVAL;
-
-	qopt = nla_data(na[TCA_NSSTBL_PARMS]);
-
-	/*
-	 * Set MTU if it wasn't specified explicitely
-	 */
-	if (!qopt->mtu) {
-		qopt->mtu = psched_mtu(dev);
-		nss_qdisc_info("MTU not provided for nss_tbl. Setting it to %s's default %u bytes\n", dev->name, qopt->mtu);
-	}
-
-	/*
-	 * Burst size cannot be less than MTU
-	 */
-	if (qopt->burst < qopt->mtu) {
-		nss_qdisc_error("Burst size: %u is less than the specified MTU: %u\n", qopt->burst, qopt->mtu);
-		return -EINVAL;
-	}
-
-	/*
-	 * Rate can be zero. Therefore we dont do a check on it.
-	 */
-	q->rate = qopt->rate;
-	nss_qdisc_info("Rate = %u", qopt->rate);
-	q->burst = qopt->burst;
-	nss_qdisc_info("Burst = %u", qopt->burst);
-	q->mtu = qopt->mtu;
-	nss_qdisc_info("MTU = %u", qopt->mtu);
-	q->peakrate = qopt->peakrate;
-	nss_qdisc_info("Peak Rate = %u", qopt->peakrate);
-
-	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.tbl_param.lap_cir.rate = q->rate;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_param.lap_cir.burst = q->burst;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_param.lap_cir.max_size = q->mtu;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_param.lap_cir.short_circuit = false;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_param.lap_pir.rate = q->peakrate;
-
-	/*
-	 * It is important to set these two parameters to be the same as MTU.
-	 * This ensures bursts from CIR dont go above the specified peakrate.
-	 */
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_param.lap_pir.burst = q->mtu;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_param.lap_pir.max_size = q->mtu;
-
-	/*
-	 * We can short circuit peakrate limiter if it is not being configured.
-	 */
-	if (q->peakrate) {
-		nim.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_param.lap_pir.short_circuit = false;
-	} else {
-		nim.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_param.lap_pir.short_circuit = true;
-	}
-
-	if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_TBL_CHANGE_PARAM) < 0) {
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int nss_tbl_init(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_tbl_sched_data *q = qdisc_priv(sch);
-
-	if (opt == NULL)
-		return -EINVAL;
-
-	q->qdisc = &noop_qdisc;
-
-	if (nss_qdisc_init(sch, &q->nq, NSS_SHAPER_NODE_TYPE_TBL, 0) < 0)
-		return -EINVAL;
-
-	if (nss_tbl_change(sch, opt) < 0) {
-		nss_qdisc_info("Failed to configure tbl\n");
-		nss_qdisc_destroy(&q->nq);
-		return -EINVAL;
-	}
-
-	/*
-	 * Start the stats polling timer
-	 */
-	nss_qdisc_start_basic_stats_polling(&q->nq);
-
-	return 0;
-}
-
-static int nss_tbl_dump(struct Qdisc *sch, struct sk_buff *skb)
-{
-	struct nss_tbl_sched_data *q = qdisc_priv(sch);
-	struct nlattr *opts = NULL;
-	struct tc_nsstbl_qopt opt = {
-		.rate		= q->rate,
-		.peakrate	= q->peakrate,
-		.burst		= q->burst,
-		.mtu		= q->mtu,
-	};
-
-	nss_qdisc_info("Nsstbl dumping");
-	opts = nla_nest_start(skb, TCA_OPTIONS);
-	if (opts == NULL)
-		goto nla_put_failure;
-	NLA_PUT(skb, TCA_NSSTBL_PARMS, sizeof(opt), &opt);
-	return nla_nest_end(skb, opts);
-
-nla_put_failure:
-	nla_nest_cancel(skb, opts);
-	return -EMSGSIZE;
-}
-
-static int nss_tbl_dump_class(struct Qdisc *sch, unsigned long cl,
-			     struct sk_buff *skb, struct tcmsg *tcm)
-{
-	struct nss_tbl_sched_data *q = qdisc_priv(sch);
-	nss_qdisc_info("Nsstbl dumping class");
-
-	tcm->tcm_handle |= TC_H_MIN(1);
-	tcm->tcm_info = q->qdisc->handle;
-
-	return 0;
-}
-
-static int nss_tbl_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
-			struct Qdisc **old)
-{
-	struct nss_tbl_sched_data *q = qdisc_priv(sch);
-	struct nss_qdisc *nq_new = (struct nss_qdisc *)qdisc_priv(new);
-	struct nss_if_msg nim_attach;
-	struct nss_if_msg nim_detach;
-
-	if (new == NULL)
-		new = &noop_qdisc;
-
-	sch_tree_lock(sch);
-	*old = q->qdisc;
-	q->qdisc = new;
-	qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
-	qdisc_reset(*old);
-	sch_tree_unlock(sch);
-
-	nss_qdisc_info("%s:Grafting old: %p with new: %p\n", __func__, *old, new);
-	if (*old != &noop_qdisc) {
-		struct nss_qdisc *nq_old = (struct nss_qdisc *)qdisc_priv(*old);
-		nss_qdisc_info("%s: Detaching old: %p\n", __func__, *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_TBL_DETACH) < 0) {
-			return -EINVAL;
-		}
-	}
-
-	if (new != &noop_qdisc) {
-		nss_qdisc_info("%s: Attaching new: %p\n", __func__, 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,
-				NSS_SHAPER_CONFIG_TYPE_TBL_ATTACH) < 0) {
-			return -EINVAL;
-		}
-	}
-
-	nss_qdisc_info("Nsstbl grafted");
-
-	return 0;
-}
-
-static struct Qdisc *nss_tbl_leaf(struct Qdisc *sch, unsigned long arg)
-{
-	struct nss_tbl_sched_data *q = qdisc_priv(sch);
-	nss_qdisc_info("Nsstbl returns leaf");
-	return q->qdisc;
-}
-
-static unsigned long nss_tbl_get(struct Qdisc *sch, u32 classid)
-{
-	return 1;
-}
-
-static void nss_tbl_put(struct Qdisc *sch, unsigned long arg)
-{
-}
-
-static void nss_tbl_walk(struct Qdisc *sch, struct qdisc_walker *walker)
-{
-	nss_qdisc_info("Nsstbl walk called");
-	if (!walker->stop) {
-		if (walker->count >= walker->skip)
-			if (walker->fn(sch, 1, walker) < 0) {
-				walker->stop = 1;
-				return;
-			}
-		walker->count++;
-	}
-}
-
-const struct Qdisc_class_ops nss_tbl_class_ops = {
-	.graft		=	nss_tbl_graft,
-	.leaf		=	nss_tbl_leaf,
-	.get		=	nss_tbl_get,
-	.put		=	nss_tbl_put,
-	.walk		=	nss_tbl_walk,
-	.dump		=	nss_tbl_dump_class,
-};
-
-struct Qdisc_ops nss_tbl_qdisc_ops __read_mostly = {
-	.next		=	NULL,
-	.id		=	"nsstbl",
-	.priv_size	=	sizeof(struct nss_tbl_sched_data),
-	.cl_ops		=	&nss_tbl_class_ops,
-	.enqueue	=	nss_tbl_enqueue,
-	.dequeue	=	nss_tbl_dequeue,
-	.peek		=	nss_tbl_peek,
-	.drop		=	nss_tbl_drop,
-	.init		=	nss_tbl_init,
-	.reset		=	nss_tbl_reset,
-	.destroy	=	nss_tbl_destroy,
-	.change		=	nss_tbl_change,
-	.dump		=	nss_tbl_dump,
-	.owner		=	THIS_MODULE,
-};
-
diff --git a/nss_qdisc/nss_tbl.h b/nss_qdisc/nss_tbl.h
deleted file mode 100644
index d9a9c33..0000000
--- a/nss_qdisc/nss_tbl.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-extern struct Qdisc_ops nss_tbl_qdisc_ops;
diff --git a/nss_qdisc/nss_wfq.h b/nss_qdisc/nss_wfq.h
deleted file mode 100644
index 27b8550..0000000
--- a/nss_qdisc/nss_wfq.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-extern struct Qdisc_ops nss_wfq_qdisc_ops;
diff --git a/nss_qdisc/nss_wred.c b/nss_qdisc/nss_wred.c
deleted file mode 100644
index 875807e..0000000
--- a/nss_qdisc/nss_wred.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_qdisc.h"
-
-#define NSS_WRED_SUPPORT_TRAFFIC_CLASS 6
-#define NSS_WRED_MAX_TRAFFIC_CLASS NSS_WRED_SUPPORT_TRAFFIC_CLASS+1
-
-/*
- * nsswred traffic class structure
- */
-struct nss_wred_traffic_class {
-	u32 limit;			/* Queue length */
-	u32 weight_mode_value;		/* Weight mode value */
-	struct tc_red_alg_parameter rap;/* Parameters for RED alg */
-};
-
-/*
- * nsswred private qdisc structure
- */
-struct nss_wred_sched_data {
-	struct nss_qdisc nq;			/* Common base class for all nss qdiscs */
-	u32 traffic_classes;			/* # of traffic classs in this wred*/
-	u32 def_traffic_class;			/* Default traffic class if no match */
-	tc_nsswred_weight_mode_t weight_mode;	/* Weight mode */
-	struct nss_wred_traffic_class nwtc[NSS_WRED_MAX_TRAFFIC_CLASS];
-						/* Parameters for each traffic class */
-	u8 ecn;					/* Mark ECN or drop pkt */
-	u8 weighted;				/* This is a wred or red */
-};
-
-/*
- * nss_wred_enqueue()
- *	Enqueue API for nsswred qdisc
- */
-static int nss_wred_enqueue(struct sk_buff *skb, struct Qdisc *sch)
-{
-	return nss_qdisc_enqueue(skb, sch);
-}
-
-/*
- * nss_wred_dequeue()
- *	Dequeue API for nsswred qdisc
- */
-static struct sk_buff *nss_wred_dequeue(struct Qdisc *sch)
-{
-	return nss_qdisc_dequeue(sch);
-}
-
-/*
- * nss_wred_drop()
- *	Drops a packet from HLOS queue.
- */
-static unsigned int nss_wred_drop(struct Qdisc *sch)
-{
-	nss_qdisc_info("nsswred dropping");
-	return nss_qdisc_drop(sch);
-}
-
-/*
- * nss_wred_reset()
- *	Reset the nsswred qdisc
- */
-static void nss_wred_reset(struct Qdisc *sch)
-{
-	nss_qdisc_info("nsswred resetting!");
-	nss_qdisc_reset(sch);
-}
-
-/*
- * nss_wred_destroy()
- *	Destroy the nsswred qdisc
- */
-static void nss_wred_destroy(struct Qdisc *sch)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)qdisc_priv(sch);
-
-	/*
-	 * Stop the polling of basic stats
-	 */
-	nss_qdisc_stop_basic_stats_polling(nq);
-
-	nss_qdisc_destroy(nq);
-	nss_qdisc_info("nsswred destroyed");
-}
-
-/*
- * nsswred policy structure
- */
-static const struct nla_policy nss_wred_policy[TCA_NSSWRED_MAX + 1] = {
-	[TCA_NSSWRED_PARMS] = { .len = sizeof(struct tc_nsswred_qopt) },
-};
-
-/*
- * nss_wred_change()
- *	Function call to configure the nsswred parameters
- */
-static int nss_wred_change(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_wred_sched_data *q;
-	struct nlattr *na[TCA_NSSWRED_MAX + 1];
-	struct tc_nsswred_qopt *qopt;
-	int err;
-	struct nss_if_msg nim;
-
-	q = qdisc_priv(sch);
-
-	if (opt == NULL) {
-		return -EINVAL;
-	}
-	err = nla_parse_nested(na, TCA_NSSWRED_MAX, opt, nss_wred_policy);
-	if (err < 0) {
-		return err;
-	}
-	if (na[TCA_NSSWRED_PARMS] == NULL) {
-		return -EINVAL;
-	}
-	qopt = nla_data(na[TCA_NSSWRED_PARMS]);
-
-	nss_qdisc_info("%s: nsswred %x traffic_classes:%d def_traffic_class: %d Weight_Mode:%d ECN:%d\n",
-			__func__, sch->handle, qopt->traffic_classes, qopt->def_traffic_class, qopt->weight_mode, qopt->ecn);
-
-	if (qopt->traffic_classes) {
-		/*
-		 * This is a wred setup command, do checks again because parameters might not come from tc utility
-		 */
-		if (qopt->traffic_classes > NSS_WRED_SUPPORT_TRAFFIC_CLASS) {
-			nss_qdisc_error("%s: nsswred %x traffic classes should not exceeds %d\n", __func__, sch->handle, NSS_WRED_SUPPORT_TRAFFIC_CLASS);
-			return -EINVAL;
-		}
-		if (qopt->def_traffic_class < 1 || qopt->def_traffic_class > qopt->traffic_classes) {
-			nss_qdisc_error("%s: nsswred %x invalid default traffic\n", __func__, sch->handle);
-			return -EINVAL;
-		}
-		if (qopt->weight_mode >= TC_NSSWRED_WEIGHT_MODES) {
-			nss_qdisc_error("%s: nsswred %x invalid weight_mode\n", __func__, sch->handle);
-			return -EINVAL;
-		}
-		q->traffic_classes = qopt->traffic_classes ;
-		q->def_traffic_class = qopt->def_traffic_class;
-		q->weight_mode = qopt->weight_mode;
-		q->ecn = qopt->ecn;
-		q->weighted = 1;
-	} else {
-		if (qopt->traffic_id) {
-			/*
-			 * This is a wred traffic class command
-			 */
-			if (!q->traffic_classes) {
-				nss_qdisc_error("%s: nsswred %x not setup yet, can't accept traffic class configuration\n", __func__, sch->handle);
-				return -EINVAL;
-			}
-			if (!qopt->limit || !qopt->rap.min || !qopt->rap.max || !qopt->weight_mode_value || !qopt->rap.exp_weight_factor) {
-				nss_qdisc_error("%s: nsswred %x Requires RED algorithm parameters and weight_mode_value\n", __func__, sch->handle);
-				return -EINVAL;
-			}
-		} else {
-			/*
-			 * This is a red setup command
-			 */
-			if (!qopt->limit || !qopt->rap.exp_weight_factor) {
-				nss_qdisc_error("%s: nsswred %x Requires RED algorithm parameters\n", __func__, sch->handle);
-				return -EINVAL;
-			}
-			/*
-			 * If min/max does not specify, calculated it
-			 */
-			if (!qopt->rap.max) {
-				qopt->rap.max = qopt->rap.min ? qopt->rap.min * 3 : qopt->limit / 4;
-			}
-			if (!qopt->rap.min) {
-				qopt->rap.min = qopt->rap.max / 3;
-			}
-			q->ecn = qopt->ecn;
-		}
-		q->nwtc[qopt->traffic_id].limit = qopt->limit;
-		q->nwtc[qopt->traffic_id].weight_mode_value = qopt->weight_mode_value;
-		q->nwtc[qopt->traffic_id].rap.min = qopt->rap.min;
-		q->nwtc[qopt->traffic_id].rap.max = qopt->rap.max;
-		q->nwtc[qopt->traffic_id].rap.probability = qopt->rap.probability;
-		q->nwtc[qopt->traffic_id].rap.exp_weight_factor = qopt->rap.exp_weight_factor;
-	}
-
-	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.wred_param.limit = qopt->limit;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.weight_mode = qopt->weight_mode;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.weight_mode_value = qopt->weight_mode_value;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.rap.min = qopt->rap.min;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.rap.max = qopt->rap.max;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.rap.probability = qopt->rap.probability;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.rap.exp_weight_factor = qopt->rap.exp_weight_factor;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.traffic_classes = qopt->traffic_classes;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.ecn = qopt->ecn;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.def_traffic_class = qopt->def_traffic_class;
-	nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.traffic_id = qopt->traffic_id;
-
-	if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM) < 0) {
-		nss_qdisc_error("%s: nsswred %x configuration failed\n", __func__, sch->handle);
-		return -EINVAL;
-	}
-
-	if (qopt->set_default == 0)
-		return 0;
-
-	/*
-	 * Set this qdisc to be the default qdisc for enqueuing packets.
-	*/
-	if (nss_qdisc_set_default(&q->nq) < 0) {
-		nss_qdisc_error("%s: nsswred %x set_default failed\n", __func__, sch->handle);
-		return -EINVAL;
-	}
-
-	nss_qdisc_info("%s: nsswred queue (qos_tag:%u) set as default\n", __func__, q->nq.qos_tag);
-
-	return 0;
-}
-
-/*
- * nss_wred_init()
- *	Init the nsswred qdisc
- */
-static int nss_wred_init(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_qdisc *nq = qdisc_priv(sch);
-
-	if (opt == NULL)
-		return -EINVAL;
-
-	nss_qdisc_info("Initializing Wred - type %d\n", NSS_SHAPER_NODE_TYPE_WRED);
-	nss_wred_reset(sch);
-
-	if (nss_qdisc_init(sch, nq, NSS_SHAPER_NODE_TYPE_WRED, 0) < 0)
-		return -EINVAL;
-
-	nss_qdisc_info("NSS wred initialized - handle %x parent %x\n", sch->handle, sch->parent);
-	if (nss_wred_change(sch, opt) < 0) {
-		nss_qdisc_destroy(nq);
-		return -EINVAL;
-	}
-
-	/*
-	 * Start the stats polling timer
-	 */
-	nss_qdisc_start_basic_stats_polling(nq);
-
-	return 0;
-}
-
-/*
- * nss_wred_dump()
- *	Dump the parameters of nsswred to tc
- */
-static int nss_wred_dump(struct Qdisc *sch, struct sk_buff *skb)
-{
-	struct nss_wred_sched_data *q;
-	struct nlattr *opts = NULL;
-	struct tc_nsswred_qopt opt;
-	int i;
-	nss_qdisc_info("Nsswred Dumping!");
-
-	q = qdisc_priv(sch);
-	if (q == NULL) {
-		return -1;
-	}
-
-	if (q->weighted) {
-		opt.traffic_classes = q->traffic_classes;
-		opt.def_traffic_class = q->def_traffic_class;
-		opt.ecn = q->ecn;
-		opt.weight_mode = q->weight_mode;
-		for (i = 0 ; i < q->traffic_classes; i++) {
-			opt.tntc[i].limit = q->nwtc[i+1].limit;
-			opt.tntc[i].weight_mode_value = q->nwtc[i+1].weight_mode_value;
-			opt.tntc[i].rap.exp_weight_factor = q->nwtc[i+1].rap.exp_weight_factor;
-			opt.tntc[i].rap.min = q->nwtc[i+1].rap.min;
-			opt.tntc[i].rap.max = q->nwtc[i+1].rap.max;
-			opt.tntc[i].rap.probability = q->nwtc[i+1].rap.probability;
-		}
-	} else {
-		opt.ecn = q->ecn;
-		opt.limit = q->nwtc[0].limit;
-		opt.rap.min = q->nwtc[0].rap.min;
-		opt.rap.max = q->nwtc[0].rap.max;
-		opt.rap.exp_weight_factor = q->nwtc[0].rap.exp_weight_factor;
-		opt.rap.probability = q->nwtc[0].rap.probability;
-	}
-
-	opts = nla_nest_start(skb, TCA_OPTIONS);
-	if (opts == NULL) {
-		goto nla_put_failure;
-	}
-	if (nla_put(skb, TCA_NSSWRED_PARMS, sizeof(opt), &opt))
-		goto nla_put_failure;
-
-	return nla_nest_end(skb, opts);
-
-nla_put_failure:
-	nla_nest_cancel(skb, opts);
-	return -EMSGSIZE;
-}
-
-/*
- * nss_wred_peek()
- *	Peeks the first packet in queue for this qdisc
- */
-static struct sk_buff *nss_wred_peek(struct Qdisc *sch)
-{
-	nss_qdisc_info("Nsswred Peeking");
-	return nss_qdisc_peek(sch);
-}
-
-/*
- * Registration structure for nss_red qdisc
- */
-struct Qdisc_ops nss_red_qdisc_ops __read_mostly = {
-	.id		=	"nssred",
-	.priv_size	=	sizeof(struct nss_wred_sched_data),
-	.enqueue	=	nss_wred_enqueue,
-	.dequeue	=	nss_wred_dequeue,
-	.peek		=	nss_wred_peek,
-	.drop		=	nss_wred_drop,
-	.init		=	nss_wred_init,
-	.reset		=	nss_wred_reset,
-	.destroy	=	nss_wred_destroy,
-	.change		=	nss_wred_change,
-	.dump		=	nss_wred_dump,
-	.owner		=	THIS_MODULE,
-};
-
-/*
- * Registration structure for nss_wred qdisc
- */
-struct Qdisc_ops nss_wred_qdisc_ops __read_mostly = {
-	.id		=	"nsswred",
-	.priv_size	=	sizeof(struct nss_wred_sched_data),
-	.enqueue	=	nss_wred_enqueue,
-	.dequeue	=	nss_wred_dequeue,
-	.peek		=	nss_wred_peek,
-	.drop		=	nss_wred_drop,
-	.init		=	nss_wred_init,
-	.reset		=	nss_wred_reset,
-	.destroy	=	nss_wred_destroy,
-	.change		=	nss_wred_change,
-	.dump		=	nss_wred_dump,
-	.owner		=	THIS_MODULE,
-};
diff --git a/nss_qdisc/nss_wred.h b/nss_qdisc/nss_wred.h
deleted file mode 100644
index 1666400..0000000
--- a/nss_qdisc/nss_wred.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-extern struct Qdisc_ops nss_red_qdisc_ops;
-extern struct Qdisc_ops nss_wred_qdisc_ops;
diff --git a/nss_qdisc/nss_wrr.c b/nss_qdisc/nss_wrr.c
deleted file mode 100644
index f3aa95e..0000000
--- a/nss_qdisc/nss_wrr.c
+++ /dev/null
@@ -1,717 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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_qdisc.h"
-
-struct nss_wrr_class_data {
-	struct nss_qdisc nq;		/* Base class used by nss_qdisc */
-	struct Qdisc_class_common cl_common;	/* Common class structure */
-	u32 quantum;				/* Quantum allocation for DRR */
-	struct Qdisc *qdisc;			/* Pointer to child qdisc */
-};
-
-struct nss_wrr_sched_data {
-	struct nss_qdisc nq;		/* Base class used by nss_qdisc */
-	struct nss_wrr_class_data root;		/* root class */
-	struct Qdisc_class_hash clhash;		/* class hash */
-};
-
-static inline struct nss_wrr_class_data *nss_wrr_find_class(u32 classid,
-							struct Qdisc *sch)
-{
-	struct nss_wrr_sched_data *q = qdisc_priv(sch);
-	struct Qdisc_class_common *clc;
-	clc = qdisc_class_find(&q->clhash, classid);
-	if (clc == NULL) {
-		nss_qdisc_warning("%s: Cannot find class with classid %u in qdisc %p hash table %p\n", __func__, classid, sch, &q->clhash);
-		return NULL;
-	}
-	return container_of(clc, struct nss_wrr_class_data, cl_common);
-}
-
-static const struct nla_policy nss_wrr_policy[TCA_NSSWRR_MAX + 1] = {
-	[TCA_NSSWRR_CLASS_PARMS] = { .len = sizeof(struct tc_nsswrr_class_qopt) },
-};
-
-static void nss_wrr_destroy_class(struct Qdisc *sch, struct nss_wrr_class_data *cl)
-{
-	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);
-
-	/*
-	 * Note, this function gets called even for NSSWRR and not just for NSSWRR_GROUP.
-	 * If this is wrr qdisc then we should not call nss_qdisc_destroy or stop polling
-	 * for stats. These two actions will happen inside nss_wrr_destroy(), which is called
-	 * only for the root qdisc.
-	 */
-	if (cl == &q->root) {
-		nss_qdisc_info("%s: We do not destroy nss_wrr class %p here since this is "
-				"the qdisc %p\n", __func__, cl, sch);
-		return;
-	}
-
-	/*
-	 * We always have to detach our child qdisc in NSS, before destroying it.
-	 */
-	if (cl->qdisc != &noop_qdisc) {
-		struct nss_qdisc *nq_child = qdisc_priv(cl->qdisc);
-		nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
-		if (nss_qdisc_node_detach(&cl->nq, nq_child, &nim,
-				NSS_SHAPER_CONFIG_TYPE_WRR_GROUP_DETACH) < 0) {
-			nss_qdisc_error("%s: Failed to detach child %x from class %x\n",
-					__func__, cl->qdisc->handle, q->nq.qos_tag);
-			return;
-		}
-	}
-
-	/*
-	 * And now we destroy the child.
-	 */
-	qdisc_destroy(cl->qdisc);
-
-	/*
-	 * Stop the stats polling timer and free class
-	 */
-	nss_qdisc_stop_basic_stats_polling(&cl->nq);
-
-	/*
-	 * Destroy the shaper in NSS
-	 */
-	nss_qdisc_destroy(&cl->nq);
-
-	/*
-	 * Free class
-	 */
-	kfree(cl);
-}
-
-static int nss_wrr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
-		  struct nlattr **tca, unsigned long *arg)
-{
-	struct nss_wrr_sched_data *q = qdisc_priv(sch);
-	struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)*arg;
-	struct nlattr *opt = tca[TCA_OPTIONS];
-	struct nlattr *na[TCA_NSSWRR_MAX + 1];
-	struct tc_nsswrr_class_qopt *qopt;
-	struct nss_if_msg nim_config;
-	struct net_device *dev = qdisc_dev(sch);
-	bool new_init = false;
-	int err;
-
-	nss_qdisc_info("%s: Changing nss_wrr class %u\n", __func__, classid);
-        if (opt == NULL)
-                return -EINVAL;
-
-        err = nla_parse_nested(na, TCA_NSSWRR_MAX, opt, nss_wrr_policy);
-        if (err < 0)
-                return err;
-
-        if (na[TCA_NSSWRR_CLASS_PARMS] == NULL)
-                return -EINVAL;
-
-	/*
-	 * If class with a given classid is not found, we allocate a new one
-	 */
-	if (!cl) {
-
-		struct nss_if_msg nim_attach;
-
-		/*
-		 * The class does not already exist, we are newly initializing it.
-		 */
-		new_init = true;
-
-		nss_qdisc_info("%s: nss_wrr class %u not found. Allocating a new class.\n", __func__, classid);
-		cl = kzalloc(sizeof(struct nss_wrr_class_data), GFP_KERNEL);
-
-		if (!cl) {
-			nss_qdisc_error("%s: Class allocation failed for classid %u\n", __func__, classid);
-			return -EINVAL;
-		}
-
-		nss_qdisc_info("%s: Bf class %u allocated %p\n", __func__, classid, cl);
-		cl->cl_common.classid = classid;
-
-		/*
-		 * We make the child qdisc a noop qdisc, and
-		 * set reference count to 1. This is important,
-		 * reference count should not be 0.
-		 */
-		cl->qdisc = &noop_qdisc;
-		atomic_set(&cl->nq.refcnt, 1);
-		*arg = (unsigned long)cl;
-
-		nss_qdisc_info("%s: Adding classid %u to qdisc %p hash queue %p\n", __func__, 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 NSSWRR_GROUP shaper
-		 * here.
-		 */
-		if (nss_qdisc_init(sch, &cl->nq, NSS_SHAPER_NODE_TYPE_WRR_GROUP, classid) < 0) {
-			nss_qdisc_error("%s: Nss init for class %u failed\n", __func__, classid);
-			return -EINVAL;
-		}
-
-		/*
-		 * Set qos_tag of parent to which the class needs to e attached to.
-		 */
-		nim_attach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
-
-		/*
-		 * Set the child to be this class.
-		 */
-		nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.wrr_attach.child_qos_tag = cl->nq.qos_tag;
-
-		/*
-		 * Send node_attach command down to the NSS
-		 */
-		if (nss_qdisc_node_attach(&q->nq, &cl->nq, &nim_attach,
-				NSS_SHAPER_CONFIG_TYPE_WRR_ATTACH) < 0) {
-			nss_qdisc_error("%s: Nss attach for class %u failed\n", __func__, classid);
-			nss_qdisc_destroy(&cl->nq);
-			return -EINVAL;
-		}
-
-		/*
-		 * Add class to hash tree once it is attached in the NSS
-		 */
-		sch_tree_lock(sch);
-		qdisc_class_hash_insert(&q->clhash, &cl->cl_common);
-		sch_tree_unlock(sch);
-
-		/*
-		 * Hash grow should not come within the tree lock
-		 */
-		qdisc_class_hash_grow(sch, &q->clhash);
-
-		/*
-		 * Start the stats polling timer
-		 */
-		nss_qdisc_start_basic_stats_polling(&cl->nq);
-
-		nss_qdisc_info("%s: Class %u successfully allocated\n", __func__, classid);
-	}
-
-	qopt = nla_data(na[TCA_NSSWRR_CLASS_PARMS]);
-
-	sch_tree_lock(sch);
-
-	/*
-	 * If the value of quantum is not provided default it based on the type
-	 * of operation (i.e. wrr or wfq)
-	 */
-	cl->quantum = qopt->quantum;
-	if (!cl->quantum) {
-		if (strncmp(sch->ops->id, "nss_wrr", 6) == 0) {
-			cl->quantum = 1;
-			nss_qdisc_info("Quantum value not provided for nss_wrr class on interface %s. "
-					"Setting quantum to %up\n", dev->name, cl->quantum);
-		} else if (strncmp(sch->ops->id, "nsswfq", 6) == 0) {
-			cl->quantum = psched_mtu(dev);
-			nss_qdisc_info("Quantum value not provided for nss_wrr class on interface %s. "
-					"Setting quantum to %ubytes\n", dev->name, cl->quantum);
-		} else {
-			nss_qdisc_error("%s: Unsupported parent type", __func__);
-			return -EINVAL;
-		}
-	}
-
-	sch_tree_unlock(sch);
-
-	/*
-	 * Fill information that needs to be sent down to the NSS for configuring the
-	 * bf class.
-	 */
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
-	nim_config.msg.shaper_configure.config.msg.shaper_node_config.snc.wrr_group_param.quantum = cl->quantum;
-
-	nss_qdisc_info("Quantum = %u\n", cl->quantum);
-
-	/*
-	 * Send configure command to the NSS
-	 */
-	if (nss_qdisc_configure(&cl->nq, &nim_config,
-			NSS_SHAPER_CONFIG_TYPE_WRR_GROUP_CHANGE_PARAM) < 0) {
-		nss_qdisc_error("%s: Failed to configure class %x\n", __func__, classid);
-
-		/*
-		 * We dont have to destroy the class if this was just a
-		 * change command.
-		 */
-		if (!new_init) {
-			return -EINVAL;
-		}
-
-		/*
-		 * Else, we have failed in the NSS and we will have to
-		 * destroy the class
-		 */
-		nss_wrr_destroy_class(sch, cl);
-		return -EINVAL;
-	}
-
-	nss_qdisc_info("%s: Class %x changed successfully\n", __func__, classid);
-	return 0;
-}
-
-static int nss_wrr_delete_class(struct Qdisc *sch, unsigned long arg)
-{
-	struct nss_wrr_sched_data *q = qdisc_priv(sch);
-	struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)arg;
-	struct nss_if_msg nim;
-	int refcnt;
-
-	/*
-	 * Since all classes are leaf nodes in our case, we dont have to make
-	 * that check.
-	 */
-	if (cl == &q->root)
-		return -EBUSY;
-
-	/*
-	 * The message to NSS should be sent to the parent of this class
-	 */
-	nss_qdisc_info("%s: Detaching nss_wrr class: %p\n", __func__, 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,
-			NSS_SHAPER_CONFIG_TYPE_WRR_DETACH) < 0) {
-		return -EINVAL;
-	}
-
-	sch_tree_lock(sch);
-	qdisc_reset(cl->qdisc);
-	qdisc_class_hash_remove(&q->clhash, &cl->cl_common);
-	refcnt = atomic_sub_return(1, &cl->nq.refcnt);
-	sch_tree_unlock(sch);
-	if (!refcnt) {
-		nss_qdisc_error("%s: Reference count should not be zero for class %p\n", __func__, cl);
-	}
-
-	return 0;
-}
-
-static int nss_wrr_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
-								 struct Qdisc **old)
-{
-	struct nss_wrr_sched_data *q = qdisc_priv(sch);
-	struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)arg;
-	struct nss_if_msg nim_detach;
-	struct nss_if_msg nim_attach;
-	struct nss_qdisc *nq_new = qdisc_priv(new);
-
-	nss_qdisc_info("Grafting class %p\n", sch);
-
-	if (cl == &q->root) {
-		nss_qdisc_error("%p: Can't graft root class\n", cl);
-		return -EINVAL;
-	}
-
-	if (new == NULL)
-		new = &noop_qdisc;
-
-	sch_tree_lock(sch);
-	*old = cl->qdisc;
-	sch_tree_unlock(sch);
-
-	/*
-	 * 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("%s:Grafting old: %p with new: %p\n", __func__, *old, new);
-	if (*old != &noop_qdisc) {
-		struct nss_qdisc *nq_child = qdisc_priv(*old);
-		nss_qdisc_info("%s: Detaching old: %p\n", __func__, *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_WRR_GROUP_DETACH) < 0) {
-			return -EINVAL;
-		}
-	}
-
-	/*
-	 * If the new qdisc is a noop qdisc, we do not send down an attach command
-	 * to the NSS.
-	 */
-	if (new != &noop_qdisc) {
-		nss_qdisc_info("%s: Attaching new: %p\n", __func__, 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,
-				NSS_SHAPER_CONFIG_TYPE_WRR_GROUP_ATTACH) < 0) {
-			return -EINVAL;
-		}
-	}
-
-	/*
-	 * Attach qdisc once it is done in the NSS
-	 */
-	sch_tree_lock(sch);
-	cl->qdisc = new;
-	sch_tree_unlock(sch);
-
-	nss_qdisc_info("Nsswrr grafted");
-
-	return 0;
-}
-
-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);
-
-	/*
-	 * Since all nss_wrr groups are leaf nodes, we can always
-	 * return the attached qdisc.
-	 */
-	return cl->qdisc;
-}
-
-static void nss_wrr_qlen_notify(struct Qdisc *sch, unsigned long arg)
-{
-	nss_qdisc_info("nss_wrr qlen notify %p\n", sch);
-	/*
-	 * Gets called when qlen of child changes (Useful for deactivating)
-	 * Not useful for us here.
-	 */
-}
-
-static unsigned long nss_wrr_get_class(struct Qdisc *sch, u32 classid)
-{
-	struct nss_wrr_class_data *cl = nss_wrr_find_class(classid, sch);
-
-	nss_qdisc_info("Get nss_wrr class %p - class match = %p\n", sch, cl);
-
-	if (cl != NULL)
-		atomic_add(1, &cl->nq.refcnt);
-
-	return (unsigned long)cl;
-}
-
-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);
-
-	/*
-	 * We are safe to destroy the qdisc if the reference count
-	 * goes down to 0.
-	 */
-	if (atomic_sub_return(1, &cl->nq.refcnt) == 0) {
-		nss_wrr_destroy_class(sch, cl);
-	}
-}
-
-static int nss_wrr_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
-		struct tcmsg *tcm)
-{
-	struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)arg;
-	struct nlattr *opts;
-	struct tc_nsswrr_class_qopt qopt;
-
-	nss_qdisc_info("Dumping class %p of Qdisc %x\n", cl, sch->handle);
-
-	qopt.quantum = cl->quantum;
-
-	/*
-	 * All bf group nodes are root nodes. i.e. they dont
-	 * have any mode bf groups attached beneath them.
-	 */
-	tcm->tcm_parent = TC_H_ROOT;
-	tcm->tcm_handle = cl->cl_common.classid;
-	tcm->tcm_info = cl->qdisc->handle;
-
-	opts = nla_nest_start(skb, TCA_OPTIONS);
-	if (opts == NULL)
-		goto nla_put_failure;
-	NLA_PUT(skb, TCA_NSSWRR_CLASS_PARMS, sizeof(qopt), &qopt);
-	return nla_nest_end(skb, opts);
-
-nla_put_failure:
-	nla_nest_cancel(skb, opts);
-	return -EMSGSIZE;
-}
-
-static int nss_wrr_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d)
-{
-	struct nss_qdisc *nq = (struct nss_qdisc *)arg;
-
-	if (gnet_stats_copy_basic(d, &nq->bstats) < 0 ||
-		gnet_stats_copy_queue(d, &nq->qstats) < 0) {
-		return -1;
-	}
-
-	return 0;
-}
-
-static void nss_wrr_walk(struct Qdisc *sch, struct qdisc_walker *arg)
-{
-	struct nss_wrr_sched_data *q = qdisc_priv(sch);
-	struct hlist_node *n;
-	struct nss_wrr_class_data *cl;
-	unsigned int i;
-
-	nss_qdisc_info("In nss_wrr walk %p\n", sch);
-	if (arg->stop)
-		return;
-
-	for (i = 0; i < q->clhash.hashsize; i++) {
-		hlist_for_each_entry(cl, n, &q->clhash.hash[i],
-				cl_common.hnode) {
-			if (arg->count < arg->skip) {
-				arg->count++;
-				continue;
-			}
-			if (arg->fn(sch, (unsigned long)cl, arg) < 0) {
-				arg->stop = 1;
-				return;
-			}
-			arg->count++;
-		}
-	}
-}
-
-static int nss_wrr_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
-{
-	struct nss_wrr_sched_data *q = qdisc_priv(sch);
-	int err;
-	struct nss_if_msg nim;
-
-	nss_qdisc_info("Init nss_wrr qdisc %p\n", sch);
-
-	err = qdisc_class_hash_init(&q->clhash);
-	if (err < 0)
-		return err;
-
-	q->root.cl_common.classid = sch->handle;
-	q->root.qdisc = &noop_qdisc;
-
-	qdisc_class_hash_insert(&q->clhash, &q->root.cl_common);
-	qdisc_class_hash_grow(sch, &q->clhash);
-
-	/*
-	 * Initialize the NSSWRR shaper in NSS
-	 */
-	if (nss_qdisc_init(sch, &q->nq, NSS_SHAPER_NODE_TYPE_WRR, 0) < 0)
-		return -EINVAL;
-
-	/*
-	 * Configure the qdisc to operate in one of the two modes
-	 */
-	nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
-	if (strncmp(sch->ops->id, "nsswrr", 6) == 0) {
-		nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wrr_param.operation_mode = NSS_SHAPER_WRR_MODE_ROUND_ROBIN;
-	} else if (strncmp(sch->ops->id, "nsswfq", 6) == 0) {
-		nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wrr_param.operation_mode = NSS_SHAPER_WRR_MODE_FAIR_QUEUEING;
-	} else {
-		nss_qdisc_error("%s: Unknow qdisc association", __func__);
-		nss_qdisc_destroy(&q->nq);
-		return -EINVAL;
-	}
-
-	/*
-	 * Send configure command to the NSS
-	 */
-	if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_WRR_CHANGE_PARAM) < 0) {
-		nss_qdisc_error("%s: Failed to configure nss_wrr qdisc %x\n", __func__, q->nq.qos_tag);
-		nss_qdisc_destroy(&q->nq);
-		return -EINVAL;
-	}
-
-	nss_qdisc_info("Nsswrr initialized - handle %x parent %x\n", sch->handle, sch->parent);
-
-	/*
-	 * Start the stats polling timer
-	 */
-	nss_qdisc_start_basic_stats_polling(&q->nq);
-
-	return 0;
-}
-
-static int nss_wrr_change_qdisc(struct Qdisc *sch, struct nlattr *opt)
-{
-	return 0;
-}
-
-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);
-}
-
-static void nss_wrr_reset_qdisc(struct Qdisc *sch)
-{
-	struct nss_wrr_sched_data *q = qdisc_priv(sch);
-	struct nss_wrr_class_data *cl;
-	struct hlist_node *n;
-	unsigned int i;
-
-	for (i = 0; i < q->clhash.hashsize; i++) {
-		hlist_for_each_entry(cl, n, &q->clhash.hash[i], cl_common.hnode)
-			nss_wrr_reset_class(cl);
-	}
-
-	nss_qdisc_reset(sch);
-	nss_qdisc_info("Nsswrr qdisc resetted %p\n", sch);
-}
-
-static void nss_wrr_destroy_qdisc(struct Qdisc *sch)
-{
-	struct nss_wrr_sched_data *q = qdisc_priv(sch);
-	struct hlist_node *n, *next;
-	struct nss_wrr_class_data *cl;
-	struct nss_if_msg nim;
-	unsigned int i;
-
-	/*
-	 * Destroy all the classes before the root qdisc is destroyed.
-	 */
-	for (i = 0; i < q->clhash.hashsize; i++) {
-		hlist_for_each_entry_safe(cl, n, next, &q->clhash.hash[i], cl_common.hnode) {
-
-			/*
-			 * If this is the root class, we dont have to destroy it. This will be taken
-			 * care of by the nss_wrr_destroy() function.
-			 */
-			if (cl == &q->root) {
-				nss_qdisc_info("%s: We do not detach or destroy nss_wrr class %p here since this is "
-						"the qdisc %p\n", __func__, cl, sch);
-				continue;
-			}
-
-			/*
-			 * Reduce refcnt by 1 before destroying. This is to
-			 * ensure that polling of stat stops properly.
-			 */
-			atomic_sub(1, &cl->nq.refcnt);
-
-			/*
-			 * Detach class before destroying it. We dont check for noop qdisc here
-			 * since we do not attach anu such at init.
-			 */
-			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, NSS_SHAPER_CONFIG_TYPE_WRR_DETACH) < 0) {
-				nss_qdisc_error("%s: Node detach failed for qdisc %x class %x\n",
-							__func__, cl->nq.qos_tag, q->nq.qos_tag);
-				return;
-			}
-
-			/*
-			 * Now we can destroy the class.
-			 */
-			nss_wrr_destroy_class(sch, cl);
-		}
-	}
-	qdisc_class_hash_destroy(&q->clhash);
-
-	/*
-	 * Stop the polling of basic stats
-	 */
-	nss_qdisc_stop_basic_stats_polling(&q->nq);
-
-	/*
-	 * Now we can go ahead and destroy the qdisc.
-	 * Note: We dont have to detach ourself from our parent because this
-	 *	 will be taken care of by the graft call.
-	 */
-	nss_qdisc_destroy(&q->nq);
-	nss_qdisc_info("Nsswrr destroyed %p\n", sch);
-}
-
-static int nss_wrr_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
-{
-	nss_qdisc_info("Nsswrr dumping qdisc\n");
-	return skb->len;
-}
-
-static int nss_wrr_enqueue(struct sk_buff *skb, struct Qdisc *sch)
-{
-	return nss_qdisc_enqueue(skb, sch);
-}
-
-static struct sk_buff *nss_wrr_dequeue(struct Qdisc *sch)
-{
-	return nss_qdisc_dequeue(sch);
-}
-
-static unsigned int nss_wrr_drop(struct Qdisc *sch)
-{
-	printk("In nss_wrr drop\n");
-	return nss_qdisc_drop(sch);
-}
-
-const struct Qdisc_class_ops nss_wrr_class_ops = {
-	.change		= nss_wrr_change_class,
-	.delete		= nss_wrr_delete_class,
-	.graft		= nss_wrr_graft_class,
-	.leaf		= nss_wrr_leaf_class,
-	.qlen_notify	= nss_wrr_qlen_notify,
-	.get		= nss_wrr_get_class,
-	.put		= nss_wrr_put_class,
-	.dump		= nss_wrr_dump_class,
-	.dump_stats	= nss_wrr_dump_class_stats,
-	.walk		= nss_wrr_walk
-};
-
-struct Qdisc_ops nss_wrr_qdisc_ops __read_mostly = {
-	.id		= "nsswrr",
-	.init		= nss_wrr_init_qdisc,
-	.change		= nss_wrr_change_qdisc,
-	.reset		= nss_wrr_reset_qdisc,
-	.destroy	= nss_wrr_destroy_qdisc,
-	.dump		= nss_wrr_dump_qdisc,
-	.enqueue	= nss_wrr_enqueue,
-	.dequeue	= nss_wrr_dequeue,
-	.peek		= qdisc_peek_dequeued,
-	.drop		= nss_wrr_drop,
-	.cl_ops		= &nss_wrr_class_ops,
-	.priv_size	= sizeof(struct nss_wrr_sched_data),
-	.owner		= THIS_MODULE
-};
-
-const struct Qdisc_class_ops nss_wfq_class_ops = {
-	.change		= nss_wrr_change_class,
-	.delete		= nss_wrr_delete_class,
-	.graft		= nss_wrr_graft_class,
-	.leaf		= nss_wrr_leaf_class,
-	.qlen_notify	= nss_wrr_qlen_notify,
-	.get		= nss_wrr_get_class,
-	.put		= nss_wrr_put_class,
-	.dump		= nss_wrr_dump_class,
-	.dump_stats	= nss_wrr_dump_class_stats,
-	.walk		= nss_wrr_walk
-};
-
-struct Qdisc_ops nss_wfq_qdisc_ops __read_mostly = {
-	.id		= "nsswfq",
-	.init		= nss_wrr_init_qdisc,
-	.change		= nss_wrr_change_qdisc,
-	.reset		= nss_wrr_reset_qdisc,
-	.destroy	= nss_wrr_destroy_qdisc,
-	.dump		= nss_wrr_dump_qdisc,
-	.enqueue	= nss_wrr_enqueue,
-	.dequeue	= nss_wrr_dequeue,
-	.peek		= qdisc_peek_dequeued,
-	.drop		= nss_wrr_drop,
-	.cl_ops		= &nss_wrr_class_ops,
-	.priv_size	= sizeof(struct nss_wrr_sched_data),
-	.owner		= THIS_MODULE
-};
-
diff --git a/nss_qdisc/nss_wrr.h b/nss_qdisc/nss_wrr.h
deleted file mode 100644
index 7ef5d93..0000000
--- a/nss_qdisc/nss_wrr.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-extern struct Qdisc_ops nss_wrr_qdisc_ops;
diff --git a/nss_stats.c b/nss_stats.c
index 02c20ab..2864c9e 100644
--- a/nss_stats.c
+++ b/nss_stats.c
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -114,7 +114,15 @@
 	"pbuf_default_alloc_fails",
 	"pbuf_default_free_count",
 	"pbuf_default_total_count",
-	"payload_fails"
+	"payload_fails",
+	"h2n_control_packets",
+	"h2n_control_bytes",
+	"n2h_control_packets",
+	"n2h_control_bytes",
+	"h2n_data_packets",
+	"h2n_data_bytes",
+	"n2h_data_packets",
+	"n2h_data_bytes",
 };
 
 /*
@@ -145,7 +153,15 @@
 	"rx_buffers_cmd_resp",
 	"rx_buffers_status_sync",
 	"rx_buffers_crypto",
-	"rx_buffers_virtual"
+	"rx_buffers_virtual",
+	"tx_skb_simple",
+	"tx_skb_nr_frags",
+	"tx_skb_fraglist",
+	"rx_skb_simple",
+	"rx_skb_nr_frags",
+	"rx_skb_fraglist",
+	"rx_bad_desciptor",
+	"nss_skb_count"
 };
 
 /*
diff --git a/nss_tx_rx_common.h b/nss_tx_rx_common.h
index 391d503..0dcf4c8 100644
--- a/nss_tx_rx_common.h
+++ b/nss_tx_rx_common.h
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -73,6 +73,9 @@
 extern void nss_tunipip6_register_handler(void);
 extern void nss_pppoe_register_handler(void);
 extern void nss_freq_register_handler(void);
+#if (NSS_PM_SUPPORT == 1)
+extern void nss_core_freq_register_handler(void);
+#endif
 extern void nss_eth_rx_register_handler(void);
 extern void nss_lag_register_handler(void);
 extern void nss_dynamic_interface_register_handler(void);
@@ -90,10 +93,4 @@
 extern void nss_if_msg_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm,
 		__attribute__((unused))void *app_data);
 
-/*
- * nss_n2h_tx()
- * 	API to enable/disable Host RPS support in NSS
- */
-extern nss_tx_status_t nss_n2h_tx(struct nss_ctx_instance *nss_ctx, uint32_t enable_rps);
-
 #endif /* __NSS_TX_RX_COMMON_H */
diff --git a/profiler/Makefile b/profiler/Makefile
deleted file mode 100755
index 6ede572..0000000
--- a/profiler/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-##########################################################################
-# Copyright (c) 2014, 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.
-##########################################################################
-
-ccflags-y := -I$(obj) -I$(obj)/.. -I$(obj)/../exports -DNSS_DEBUG_LEVEL=0 #-DPROFILE_DEBUG
-
-obj-m += qca-nss-profile-drv.o
-qca-nss-profile-drv-objs := profile.o
diff --git a/profiler/profile.c b/profiler/profile.c
deleted file mode 100644
index bdc4ada..0000000
--- a/profiler/profile.c
+++ /dev/null
@@ -1,843 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-/*
- * qsdk/qca/src/qca-nss-drv/profiler/profile.c
- *
- *   Implementation for NetAP Profiler
- */
-
-#include <linux/platform_device.h>
-#include <linux/export.h>
-#include <linux/module.h>
-#include <linux/seq_file.h>
-#include <linux/proc_fs.h>
-#include <linux/mm.h>
-#include <linux/mmzone.h>
-#include <linux/fs.h>
-#include <linux/page-flags.h>
-#include <linux/sched.h>
-#include <asm/uaccess.h>
-#include <asm/page.h>
-#include <asm/thread_info.h>
-
-#define	NSS_PKT_STATS_ENABLED	0	/* nss_core.h has no default DEF for NSS_PKT_STATS_ENABLED */
-#include "nss_core.h"			/* needs only the number of NSS CORES */
-
-#include "profilenode.h"
-#include "profpkt.h"
-
-/*
- * This is the driver for the NetAP Core profiler. The system interface to the driver is
- *	profile_register_performance_counter(), defined in <asm/profile.>
- *	a set of proc files (proc/profile/<*>), used by the profiler daemon
- *
- * communication between the profiler components is described in a set of header files.
- * There are multiple versions of these files that must be kept synchronized:
- *	in nss/source/pkg/profile
- *	in tools/profiler
- *	in qsdk/qca/src/qca-nss-drv/profiler
- *
- * profilesample.h specifies the sample format used by pkg/profile, profile driver, and ip3kprof (two versions)
- * profilenode.h specifies the driver node communication between NetAP and the profile driver. (two versions)
- * profpkt.h specifies the network packet format between the profile driver, profile daemon, and ip3kprof (two versions)
- *
- *
- * NSS profile sampler:
- *	pkg/profile/src/profile.c
- *	pkg/profile/include/profilenode.h
- *	pkg/profile/include/profilesample.h
- *
- * profile driver: this code
- *	qsdk/qca/src/qca-nss-drv/profiler
- *
- * profilerd: the user daemon that sends data to the tool
- *	qsdk/qca/feeds/qca/utils/profilerd
- *
- * ubicom32-prof: the Windows tool
- *	tools/profiler/src/(many files)
- *
- */
-
-#ifdef	PROFILE_DEBUG
-#define	profileDebug(s, ...) pr_debug("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define	profileInfo(s, ...) pr_info("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define	profileWarn(s, ...) pr_warn("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#else
-#define	profileDebug(s, ...)
-#define	profileInfo(s, ...)
-#define	profileWarn(s, ...)
-#endif
-
-static void profiler_handle_reply(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm);
-
-/*
- * LINUX and Ultra counters must all fit in one packet
- */
-#define PROFILE_LINUX_MAX_COUNTERS 40
-static int profile_num_counters = 0;
-static volatile unsigned int *profile_counter[PROFILE_LINUX_MAX_COUNTERS];
-static char profile_name[PROFILE_LINUX_MAX_COUNTERS][PROFILE_COUNTER_NAME_LENGTH];
-
-/*
- * internal function to check if @name has been registered before
- * return the found index, or -1 otherwise
- */
-static int __profile_find_entry(char *name)
-{
-	int i;
-
-	for (i = 0; i < profile_num_counters; i++) {
-		if (!strncasecmp(name, profile_name[i], PROFILE_COUNTER_NAME_LENGTH)) {
-			return i;
-		}
-	}
-	return -1;
-}
-
-/*
- * profile_register_performance_counter - register @counter into profile tracking list by key @name
- * @counter: pointer of the counter variable
- * @name: identifier of this counter
- *
- * Returns zero if total entries exceeding PROFILE_LINUX_MAX_COUNTERS
- * non-zero otherwise.
- *
- * Each @name gives unique entry for @counter, by allocating a new array slot or just use existing one.
- * No need of de-registration API, since a loadable module's new insmod, will replace the
- * @counter's * new address at the same profile_counter[] slot.
- */
-int profile_register_performance_counter(volatile unsigned int *counter, char *name)
-{
-	int i;
-
-	if (profile_num_counters >= PROFILE_LINUX_MAX_COUNTERS) {
-		return 0;
-	}
-
-	i = __profile_find_entry(name);
-	if (i < 0) {
-		i = profile_num_counters++;
-	}
-
-	profile_counter[i] = counter;
-	strncpy(profile_name[i], name, PROFILE_COUNTER_NAME_LENGTH);
-	profile_name[i][PROFILE_COUNTER_NAME_LENGTH - 1] = 0;
-
-	return 1;
-}
-
-/*
- * make a packet full of sample data
- */
-static int profile_make_data_packet(char *buf, int blen, struct profile_io *pn)
-{
-	int sp_samples = 0;	/* separated samples if any */
-	int ns;		/* number of samples requested */
-	struct profile_header ph;
-	struct profile_sample_ctrl_header *psc_hd = &pn->pnc.pn2h->psc_header;
-
-	if (blen < sizeof(ph) + sizeof(struct profile_sample)) {
-		return -EINVAL;
-	}
-
-	profileDebug("%p stat %x cnt %d %p\n", pn->pnc.pn2h, pn->pnc.pn2h->mh.md_type, psc_hd->count, pn->ccl);
-
-	if (pn->pnc.pn2h->mh.md_type == PINGPONG_EMPTY || psc_hd->count < 1) {
-		struct profile_n2h_sample_buf *nsb;
-		ns = (pn->ccl_read + 1) & (CCL_SIZE-1);
-		nsb = pn->ccl + ns;
-		if (ns == pn->ccl_write || nsb->mh.md_type != PINGPONG_FULL) {
-			profileInfo("%s: waiting more data %x %p : ns %d rd %d wr %d\n", __func__, nsb->mh.md_type, nsb, ns, pn->ccl_read, pn->ccl_write);
-			return -EAGAIN;
-		}
-		pn->ccl_read = ns;
-		profileInfo("sp %p => %p rd %d %p\n", pn->pnc.samples, nsb->samples, ns, nsb);
-		psc_hd = &nsb->psc_header;
-		pn->pnc.pn2h = nsb;
-		pn->pnc.samples = nsb->samples;
-		pn->pnc.cur = 0;
-	}
-	pn->pnc.pn2h->mh.md_type = PINGPONG_INUSE;
-
-	/*
-	 * fill in the packet header
-	 */
-	memset(&ph, 0, sizeof(ph));
-	ph.pph.magic = htons(PROF_MAGIC + PROFILE_VERSION);
-	ph.pph.header_size = sizeof(ph);
-	ph.pph.profile_instructions = 0;
-	ph.pph.clock_freq = pn->pnc.un.cpu_freq;
-	ph.pph.ddr_freq = pn->pnc.un.ddr_freq;
-	ph.pph.cpu_id = pn->pnc.un.cpu_id;
-	ph.pph.seq_num = htonl(pn->profile_sequence_num);
-	ph.pph.sample_stack_words = htonl(PROFILE_STACK_WORDS);
-
-	ns = (blen - sizeof(ph)) / sizeof(struct profile_sample);
-	profileInfo("%X: blen %d ns = %d psc_hd count %d ssets %d phs %d pss %d\n", pn->profile_sequence_num, blen, ns, psc_hd->count, psc_hd->exh.sample_sets, sizeof(ph), sizeof(struct profile_sample));
-	if (ns > psc_hd->count)
-		ns = psc_hd->count;
-	if (ns == 0) {
-		printk("NS should not be 0: rlen %d hd cnt %d\n", blen, psc_hd->count);
-		return 0;
-	}
-
-	/*
-	 * if buf cannot hold all samples, then samples must be separated by set.
-	 */
-	if (ns < psc_hd->count) {
-		ph.exh.sets_map = psc_hd->exh.sets_map;	/* save for separating sets */
-		do {
-			sp_samples += psc_hd->exh.sets_map & 0x0F;
-			psc_hd->exh.sets_map >>= 4;	/* remove the last set */
-			psc_hd->exh.sample_sets--;
-			ph.exh.sample_sets++;		/* save for restore later */
-		} while ((psc_hd->count - sp_samples) > ns);
-		ns = psc_hd->count - sp_samples;
-	}
-	ph.pph.sample_count = ns;
-	if (copy_to_user(buf, &ph.pph, sizeof(ph.pph)) != 0) {
-		return -EFAULT;
-	}
-	buf += sizeof(ph.pph);
-
-	/*
-	 *	ph.exh is unused dummy; and psc_hd->exh is used directly to avoid double mem copy
-	 */
-	if (copy_to_user(buf, &psc_hd->exh, sizeof(psc_hd->exh)) != 0) {
-		return -EFAULT;
-	}
-	buf += sizeof(psc_hd->exh);
-
-	blen = ns * sizeof(struct profile_sample);
-	profileDebug("-profile_make_data_packet %p slen %d cur %d dcped %d + %d\n", pn->pnc.samples, blen, pn->pnc.cur, sizeof(ph.pph), sizeof(psc_hd->exh));
-	if (copy_to_user(buf, &pn->pnc.samples[pn->pnc.cur], blen) != 0) {
-		return -EFAULT;
-	}
-	pn->pnc.cur += ns;
-	psc_hd->count -= ns;
-	if (psc_hd->count < 1)
-		pn->pnc.pn2h->mh.md_type = PINGPONG_EMPTY;
-
-	/*
-	 * restore left over sample counts; 0s for no one
-	 */
-	if (sp_samples) {
-		profileDebug("%d sps %d %d: sets %d : %d map %x <> %x\n", psc_hd->count, ns, sp_samples, psc_hd->exh.sample_sets, ph.exh.sample_sets, psc_hd->exh.sets_map, ph.exh.sets_map);
-		psc_hd->exh.sample_sets = ph.exh.sample_sets;
-		psc_hd->exh.sets_map = ph.exh.sets_map;
-	}
-
-	pn->profile_sequence_num++;
-	blen += sizeof(ph);
-	profileDebug("+profile_make_data_packet %d phd len %d nsp %p rd %d cnt %d\n", blen, sizeof(ph), pn->pnc.pn2h, pn->ccl_read, psc_hd->count);
-	return blen;
-}
-
-/*
- * This is no longer needed due to NetAP and Linux use different CPUs, and profile is NetAP only.
- * All related code will be removed after corresponging code in visual tool is corrected; otherwise
- * visual tool will mis-behave
- */
-struct profile_counter profile_builtin_stats[] =
-{
-	{
-	"Free memory(KB)", 0
-	},
-	{
-	"Max free Block(KB)", 0
-	}
-};
-
-/*
- * make a packet full of performance counters
- */
-static int profile_make_stats_packet(char *buf, int bytes, struct profile_io *pn)
-{
-	static char prof_pkt[PROFILE_MAX_PACKET_SIZE];
-
-	char *ptr;
-	int n;
-	struct profile_counter *counter_ptr;
-	struct profile_header_counters *hdr = (struct profile_header_counters *)prof_pkt;
-	struct profile_sample_ctrl_header *psc_hd = &pn->pnc.pn2h->psc_header;
-
-	if (bytes > PROFILE_MAX_PACKET_SIZE) {
-		bytes = PROFILE_MAX_PACKET_SIZE;
-	}
-	n = sizeof(profile_builtin_stats) + (pn->pnc.un.num_counters + profile_num_counters) * sizeof(*counter_ptr);
-
-	if ((bytes - sizeof(hdr)) < n) {
-		profileWarn("room too small %d for cnts %d\n", bytes, n);
-		return 0;
-	}
-
-	hdr->magic = htons(PROF_MAGIC_COUNTERS);
-	hdr->ultra_count = htons(pn->pnc.un.num_counters);
-	hdr->linux_count = htonl(profile_num_counters + sizeof(profile_builtin_stats) / sizeof(*counter_ptr));
-	hdr->ultra_sample_time = psc_hd->exh.clocks;
-	hdr->linux_sample_time = psc_hd->exh.clocks; /* QSDK has no time func */
-
-	n = pn->pnc.un.num_counters;	/* copy NSS counters */
-	n *= sizeof(pn->pnc.un.counters[0]);
-	ptr = (char*) (hdr + 1);
-	memcpy(ptr, (void *)(pn->pnc.un.counters), n);
-	ptr += n;
-
-	counter_ptr = (struct profile_counter *)ptr;
-	for (n = 0; n < profile_num_counters; ++n) {
-		counter_ptr->value = htonl(*profile_counter[n]);
-		strcpy(counter_ptr->name, profile_name[n]);
-		counter_ptr++;
-	}
-	ptr = (char*)counter_ptr;
-
-	/*
-	 * built in statistics
-	profile_get_memory_stats(&total_free, &max_free);
-	 */
-	profile_builtin_stats[0].value = 0;
-	profile_builtin_stats[1].value = 0;
-	memcpy(ptr, (void *)profile_builtin_stats, sizeof(profile_builtin_stats));
-	ptr += sizeof(profile_builtin_stats);
-
-	n = ptr - prof_pkt;
-	if (copy_to_user(buf, prof_pkt, n) != 0) {
-		return -EFAULT;
-	}
-	return n;
-}
-
-/*
- * space for all memory blocks so we can hold locks for short time when walking tables
- */
-static struct profile_io *node[NSS_MAX_CORES];
-
-static int profile_open(struct inode *inode, struct file *filp)
-{
-	int	n;
-	struct profile_io *pn;
-
-	if (filp->private_data)
-		printk(KERN_WARNING "%s: %p\n", filp->f_dentry->d_iname, filp->private_data);
-
-	n = filp->f_dentry->d_iname[strlen(filp->f_dentry->d_iname) - 1] - '0';
-	if (n < 0 || n >= NSS_MAX_CORES)
-		n = 0;
-	pn = node[n];
-	if (!pn) {
-		return -ENOENT;
-	}
-
-	if (!pn->pnc.enabled && nss_get_state(pn->ctx) == NSS_STATE_INITIALIZED) {
-		nss_tx_status_t ret;
-		pn->pnc.enabled = 1;
-		pn->profile_first_packet = 1;
-		pn->pnc.un.hd_magic = UBI32_PROFILE_HD_MAGIC | NSS_PROFILER_START_MSG;
-		ret = nss_profiler_if_tx_buf(pn->ctx, &pn->pnc.un, sizeof(pn->pnc.un), profiler_handle_reply);
-		profileInfo("%s: %d -- %p: ccl %p sp %p\n", __func__, ret, pn, pn->ccl, pn->pnc.samples);
-		filp->private_data = pn;
-		return 0;
-	}
-
-	profileWarn("profile ena %d nss stat %x\n", pn->pnc.enabled, nss_get_state(pn->ctx));
-	return -EBUSY;
-}
-
-/*
- * return a udp packet ready to send to the profiler tool
- * when there are no packets left to make, return 0
- */
-static int profile_read(struct file *filp, char *buf, size_t count, loff_t *f_pos)
-{
-	int result = 0;
-	int slen = 0;
-	struct profile_io *pn = (struct profile_io *)filp->private_data;
-	if (!pn) {
-		return -ENOENT;
-	}
-
-	if (!pn->pnc.enabled) {
-		return -EPERM;
-	}
-	if (!pn->pnc.samples) {
-		return -ENOMEM;
-	}
-
-	if (pn->profile_first_packet) {
-		result = profile_make_stats_packet(buf, count, pn);
-		pn->profile_first_packet = 0;
-		profileInfo("%d profile_make_stats_packet %d\n", result, count);
-
-#ifdef	PROFILE_SEP_STAT
-		/*
-		 * currectly, stat and sample data are combined in one pkt for efficient;
-		 * but this is harder to debug and required remote tool to handle
-		 * packet in all-in-one method instead of individual handler.
-		 */
-		return result;
-#endif
-	}
-
-	if (result > 0) {
-		buf += result;
-		count -= result;
-		slen = result;
-	}
-	result = profile_make_data_packet(buf, count, pn);
-	if (result == 0) {
-		pn->profile_first_packet = 1;
-	}
-	profileInfo("%d: profile_make_data_packet %d %d\n", result, count, slen);
-
-	profileInfo("%d: read\n", pn->pnc.enabled);
-	if (pn->pnc.enabled < 0) {
-		nss_tx_status_t ret;
-		pn->pnc.enabled = 1;
-		pn->pnc.un.hd_magic = UBI32_PROFILE_HD_MAGIC | NSS_PROFILER_START_MSG;
-		ret = nss_profiler_if_tx_buf(pn->ctx, &pn->pnc.un, sizeof(pn->pnc.un), profiler_handle_reply);
-		profileWarn("%s: restart %d -- %p: ccl %p sp %p\n", __func__, ret, pn, pn->ccl, pn->pnc.samples);
-	}
-
-	return result + slen;
-}
-
-/*
- * the close function paired with profiler_open
- */
-static int profile_release(struct inode *inode, struct file *filp)
-{
-	struct profile_io *pn = (struct profile_io *)filp->private_data;
-	if (!pn) {
-		return -ENOENT;
-	}
-
-	if (pn->pnc.enabled) {
-		nss_tx_status_t ret;
-		pn->pnc.enabled = 0;
-		pn->pnc.un.hd_magic = UBI32_PROFILE_HD_MAGIC | NSS_PROFILER_STOP_MSG;
-		ret = nss_profiler_if_tx_buf(pn->ctx, &pn->pnc.un, sizeof(pn->pnc.un), profiler_handle_reply);
-		profileInfo("%s: %p %d\n", __func__, pn, ret);
-		return 0;
-	}
-	profileWarn("%s: attempt closing non-open dev %p\n", __func__, pn);
-	pn->profile_first_packet = 1;
-	return -EBADF;
-}
-
-#define isspace(c)	(c==' ' || c=='\t')
-
-static int parseDbgData(const char *buf, size_t count, struct debug_box *db)
-{
-	char *cp;
-	int n;
-
-	printk("%p: buf (%s) cnt %d\n", buf, buf, count);
-	if (sscanf(buf, "%x", (uint32_t *)&db->base_addr) != 1) {
-		printk("%s: cannot get base addr\n", __func__);
-		return	-EINVAL;
-	}
-
-	cp = strchr(buf, ' ');
-	if (!cp) {
-noea:		printk("%s: no enough arguments\n", __func__);
-		return -EFAULT;
-	}
-
-	while (isspace(*cp)) cp++;
-	if (!strncmp(cp, "mio", 3) || !strncmp(cp, "moveio", 6)) {
-		printk("%p: cp (%s)\n", cp, cp);
-		cp = strchr(cp, ' ');
-		if (!cp) {
-			goto noea;
-		}
-		db->opts |= DEBUG_OPT_MOVEIO;
-	}
-
-	while (isspace(*cp)) cp++;
-	printk("base addr %p -- %s\n", db->base_addr, cp);
-
-	if (!strncmp(cp, "read", 4)) {
-		cp = strchr(cp, ' ');
-		if (cp) {
-			while (isspace(*cp)) cp++;
-			sscanf(cp, "%x", &db->dlen);
-		}
-		return 0;
-	}
-
-	n = 0;
-	do {
-		while (isspace(*cp)) cp++;
-		if (sscanf(cp, "%x", db->data+n) != 1) {
-			printk("n %d : %s\n", n, cp);
-			break;
-		}
-		printk("write %x to off %x\n", db->data[n], n * sizeof(db->data[0]));
-		n++;
-		cp = strchr(cp, ' ');
-	} while (cp && n < MAX_DB_WR);
-	return n;
-}
-
-/*
- * display memory content read from Phy addr
- */
-static void debug_if_show(struct debug_box *db, int buf_len)
-{
-	int i;
-
-	for (i=0; i < db->dlen; i++) {
-		if ((i & 3) == 0)
-			printk("\n%p: ", db->base_addr + i);
-		printk("%9x", db->data[i]);
-	}
-	printk("\ndumped %d (extra 1) blen %d\n", db->dlen, buf_len);
-}
-
-/*
- * show debug message we requested from NSS
- */
-static void profiler_handle_debug_reply(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm)
-{
-	debug_if_show((struct debug_box*)&ncm[1], ncm->len);
-}
-
-/*
- * a generic Krait <--> NSS debug interface
- */
-static int debug_if(struct file *filp, const char *buf, size_t count, loff_t *f_pos)
-{
-	int result;
-	struct debug_box *db;
-	struct profile_io *pio = node[0];
-
-	if (!pio) {
-		return -ENOENT;
-	}
-
-	if (!pio->pnc.enabled) {
-		return -EPERM;
-	}
-
-	db = (struct debug_box *) &pio->pnc;
-	db->dlen = db->opts = 0;
-	result = parseDbgData(buf, count, db);
-	if (result < 0) {
-		return	result;
-	}
-
-	if (!result) {
-		db->hd_magic = UBI32_PROFILE_HD_MAGIC | NSS_PROFILER_DEBUG_RD_MSG;
-	} else {
-		db->hd_magic = UBI32_PROFILE_HD_MAGIC | NSS_PROFILER_DEBUG_WR_MSG;
-		db->dlen = result;
-	}
-	result = nss_profiler_if_tx_buf(pio->ctx, &pio->pnc.un, sizeof(pio->pnc.un), profiler_handle_debug_reply);
-	printk("dbg res %d dlen = %d opt %x\n", result, db->dlen, db->opts);
-	return	count;
-}
-
-static const struct file_operations profile_fops = {
-	.open		= profile_open,
-	.read		= profile_read,
-	.release	= profile_release,
-	.write		= debug_if,
-};
-
-/*
- * showing sample status on Linux console
- */
-static int profile_rate_show(struct seq_file *m, void *v)
-{
-	struct profile_io *pn = node[0];
-	if (pn) {
-		struct profile_sample_ctrl_header *psc_hd = &pn->pnc.pn2h->psc_header;
-		seq_printf(m, "%d samples per second.  %d ultra, %d linux virtual counters.  %d dropped samples.  %d queued of %d max sampels.  %d sent packets.\n",
-			pn->pnc.un.rate, pn->pnc.un.num_counters, profile_num_counters, psc_hd->dropped_samples, psc_hd->count, psc_hd->max_samples, pn->profile_sequence_num);
-	} else {
-		seq_printf(m, "Profiler is not initialized.\n");
-	}
-	return 0;
-}
-
-static int profile_rate_open(struct inode *inode, struct file *filp)
-{
-	return single_open(filp, profile_rate_show, NULL);
-}
-
-static int profile_rate_write(struct file *filp, const char *buf, size_t len, loff_t *off)
-{
-	*off = 0;
-	return 0;
-}
-
-static const struct file_operations profile_rate_fops = {
-	.open		= profile_rate_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-	.write		= profile_rate_write,
-};
-
-/*
- * hex dump for debug
- */
-static void kxdump(void *buf, int len, const char *who)
-{
-	int *ip = (int*) buf;
-	int lns = len >> 5;	/* 32-B each line */
-	if (lns > 4)
-		lns = 4;
-	printk("%p: kxdump %s: len %d\n", buf, who, len);
-	do {
-		printk("%x %x %x %x %x %x %x %x\n", ip[0], ip[1], ip[2], ip[3], ip[4], ip[5], ip[6], ip[7]);
-		ip += 8;
-	} while (lns--);
-}
-
-/*
- * check magic # and detect Endian.
- * negtive return means failure.
- * return 1 means need to ntoh swap.
- */
-static int profiler_magic_verify(struct profile_sample_ctrl_header *psc_hd, int buf_len)
-{
-	int swap = 0;
-	if ((psc_hd->hd_magic & UBI32_PROFILE_HD_MMASK) != UBI32_PROFILE_HD_MAGIC) {
-		if ((psc_hd->hd_magic & UBI32_PROFILE_HD_MMASK_REV) != UBI32_PROFILE_HD_MAGIC_REV) {
-			kxdump(psc_hd, buf_len, "bad profile packet");
-			printk("bad profile packet %x : %d\n", psc_hd->hd_magic, buf_len);
-			return -1;
-		}
-		profileDebug("Profile data in different Endian type %x\n", psc_hd->hd_magic);
-		swap = 1;
-		psc_hd->hd_magic = ntohl(psc_hd->hd_magic);
-	}
-	return swap;
-}
-
-/*
- * process profile sample data from NSS
- */
-static void profile_handle_nss_data(void *arg, struct nss_profiler_msg *npm)
-{
-	int buf_len = npm->cm.len;
-	void *buf = &npm->payload;
-	struct profile_io *pn;
-	struct profile_n2h_sample_buf *nsb;
-	struct profile_sample_ctrl_header *psc_hd = (struct profile_sample_ctrl_header *)buf;
-	int	ret, wr;
-	int	swap = 0;	/* only for header and info data, not samples */
-
-	if (buf_len < (sizeof(struct profile_session) - sizeof(struct profile_counter) * (PROFILE_MAX_APP_COUNTERS))) {
-		printk("profile data packet is too small to be useful %d\n", buf_len);
-		return;
-	}
-
-	swap = profiler_magic_verify(psc_hd, buf_len);
-	if (swap < 0) {
-		return;
-	}
-
-	pn = (struct profile_io *)arg;
-	profileInfo("%s: dlen %d swap %d cmd %x - %d\n", __func__, buf_len, swap, npm->cm.type, (pn->ccl_read - pn->ccl_write) & (CCL_SIZE-1));
-	//kxdump(buf, buf_len, "process profile packet");
-
-	if (npm->cm.type == NSS_PROFILER_FIXED_INFO_MSG) {
-		struct profile_session *pTx = (struct profile_session *)buf;
-		if (swap) {
-			pn->pnc.un.rate = ntohl(pTx->rate);
-			pn->pnc.un.cpu_id = ntohl(pTx->cpu_id);
-			pn->pnc.un.cpu_freq = ntohl(pTx->cpu_freq);
-			pn->pnc.un.ddr_freq = ntohl(pTx->ddr_freq);
-			pn->pnc.un.num_counters = ntohl(pTx->num_counters);
-		} else {
-			pn->pnc.un = *pTx;
-		}
-		memcpy(pn->pnc.un.counters, pTx->counters, pn->pnc.un.num_counters * sizeof(pn->pnc.un.counters[0]));
-		pn->profile_first_packet = 1;
-		return;
-	}
-
-	wr = (pn->ccl_write + 1) & (CCL_SIZE-1);
-	nsb = pn->ccl + wr;
-	swap = (pn->ccl_read - wr) & (CCL_SIZE-1);	/* PROFILER_FLOWCTRL */
-	if (nsb->mh.md_type != PINGPONG_EMPTY || (swap && swap < 5)) {
-		if (pn->pnc.enabled > 0) {
-			pn->pnc.enabled = -1;
-			pn->pnc.un.hd_magic = UBI32_PROFILE_HD_MAGIC | NSS_PROFILER_STOP_MSG;
-			ret = nss_profiler_if_tx_buf(pn->ctx, &pn->pnc.un, sizeof(pn->pnc.un), profiler_handle_reply);
-			profileWarn("%d temp stop sampling engine %d\n", swap, ret);
-		}
-		if (swap < 3) {
-			profileWarn("w%p.%d: %d no room for new profile samples r%p.%d\n", nsb, wr, swap, pn->ccl+pn->ccl_read, pn->ccl_read);
-			return;	/* -EMSGSIZE */
-		}
-	}
-	pn->ccl_write = wr;
-
-	/*
-	 * sampling data -- hdr NBO swap is done at NSS side via SWAPB.
-	 */
-	memcpy(&nsb->psc_header, buf, buf_len); /* pn->pnc.pn2h->psc_header = *psc_hd; maybe faster, but take more memory */
-
-	nsb->mh.md_type = PINGPONG_FULL;
-	//kxdump((void*)(nsb->samples + 23), sizeof(*nsb->samples) << 1, "1st 2 samples");
-	if (!wr) {
-		/*
-		 * should be UBI32_PROFILE_HD_MAGIC | NSS_PROFILER_COUNTERS_MSG
-		 * but FW is hard to change due to packge warehouse, so using
-		 * STOP/START instead till PROFILER_COUNTERS_MSG done in FW
-		 */
-		pn->pnc.un.hd_magic = UBI32_PROFILE_HD_MAGIC | NSS_PROFILER_STOP_MSG;
-		ret = nss_profiler_if_tx_buf(pn->ctx, &pn->pnc.un, sizeof(pn->pnc.un), profiler_handle_reply);
-		if (ret == NSS_TX_FAILURE)
-			printk("STOP Cmd failed %d %d\n", ret, wr);
-		pn->pnc.un.hd_magic = UBI32_PROFILE_HD_MAGIC | NSS_PROFILER_START_MSG;
-		ret = nss_profiler_if_tx_buf(pn->ctx, &pn->pnc.un, sizeof(pn->pnc.un), profiler_handle_reply);
-	}
-	profileInfo("filled %p %p wr %d\n", nsb, nsb->samples, pn->ccl_write);
-}
-
-/*
- * process N2H reply for message we sent to NSS -- currently no action
- */
-static void profiler_handle_reply(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm)
-{
-	switch (ncm->response) {
-	default:
-		nss_warning("%p: profiler had error response %d\n", nss_ctx, ncm->response);
-		/*
-		 * fail through -- no plan to do anything yet
-		 */
-	case NSS_CMN_RESPONSE_ACK:
-		return;
-	}
-}
-
-/*
- * initialize basic profile data structure
- */
-static void profile_init(struct profile_io *node)
-{
-	int n;
-
-	memset(&node->pnc, 0, sizeof(node->pnc));
-	node->ccl_read = 0;
-	node->ccl_write = -1;
-	node->pnc.pn2h = node->ccl;
-	node->pnc.samples = node->ccl->samples;
-
-	for (n = 0; n < CCL_SIZE; n++) {
-		node->ccl[n].mh.md_type = PINGPONG_EMPTY;
-		node->ccl[n].psc_header.count = 0;
-	}
-
-	/*
-	 * sw_ksp is an array of pointers to struct thread_info, the current task executing for each linux virtual processor
-	node->sw_ksp_ptr = sw_ksp;
-	 */
-	node->task_offset = offsetof(struct thread_info, task);
-	node->pid_offset = offsetof(struct task_struct, tgid);
-}
-
-static struct proc_dir_entry *pdir;
-
-/*
- * init_module cannot call exit_MODULE, so use this wrapper
- */
-void netap_profile_release_resource(void)
-{
-	if (pdir) {
-		remove_proc_entry("rate", pdir);
-		remove_proc_entry("data", pdir);
-		remove_proc_entry("data1", pdir);
-	}
-	kfree(node[0]->ccl);
-	kfree(node[0]);
-	node[0] = NULL;
-}
-
-/*
- * kernel module entry
- */
-int __init netap_profile_init_module(void)
-{
-	/*
-	 * we need N nodes, not one node + N ctx, for N cores
-	 */
-	node[0] = kmalloc(sizeof(*node[0]) * NSS_MAX_CORES, GFP_KERNEL);
-	if (!node[0]) {
-		printk(KERN_INFO "Profiler CTRL kmalloc failed.\n");
-		return -ENOMEM;
-	}
-
-	node[0]->ccl = kmalloc(sizeof(*node[0]->ccl) * CCL_SIZE * NSS_MAX_CORES, GFP_KERNEL);
-	if (!node[0]->ccl) {
-		printk(KERN_INFO "Profiler n2h_sample_buf kmalloc failed.\n");
-		kfree(node[0]);
-		node[0] = NULL;
-		return -ENOMEM;
-	}
-
-	/*
-	 * connect to the file system
-	 */
-	pdir = proc_mkdir("profile", NULL);
-	if (!pdir ||
-	    !proc_create("data", 0, pdir, &profile_fops) ||
-	    !proc_create("data1", 0, pdir, &profile_fops) ||
-	    !proc_create("rate", 0, pdir, &profile_rate_fops)) {
-		netap_profile_release_resource();
-		return -ENOMEM;
-	}
-
-	profile_init(node[0]);
-
-	/*
-	 * attatch the device callback to N2H channel for CPU 0
-	 */
-	node[0]->ctx = nss_profiler_notify_register(NSS_CORE_0, profile_handle_nss_data, node[0]);
-#if NSS_MAX_CORES > 1
-	node[1] = node[0] + 1;
-	node[1]->ccl = node[0]->ccl + CCL_SIZE;
-
-	profile_init(node[1]);
-	node[1]->ctx = nss_profiler_notify_register(NSS_CORE_1, profile_handle_nss_data, node[1]);
-	profile_register_performance_counter(&node[1]->profile_sequence_num, "Profile1 DRV data packets");
-#endif
-
-	profile_register_performance_counter(&node[0]->profile_sequence_num, "Profile0 DRV data packets");
-	return 0;
-}
-
-/*
- * kernel module exit
- */
-void __exit netap_profile_exit_module(void)
-{
-	nss_profiler_notify_unregister(NSS_CORE_0);
-#if NSS_MAX_CORES > 1
-	nss_profiler_notify_unregister(NSS_CORE_1);
-#endif
-	netap_profile_release_resource();
-}
-
-module_init(netap_profile_init_module);
-module_exit(netap_profile_exit_module);
-
-MODULE_LICENSE("Dual BSD/GPL");
diff --git a/profiler/profilenode.h b/profiler/profilenode.h
deleted file mode 100644
index 9ffb181..0000000
--- a/profiler/profilenode.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-/*
- * profilenode.h
- *	device node for the profiler, to communicate with the linux driver
- *
- * WANRING:
- *	This file must present in both nss/source/pkg/profile/include for NSS driver,
- *	and linux-nbu/driver/.../nss for Linux driver
- */
-
-#include "profilesample.h"
-
-#define	UBI32_PROFILE_HD_MAGIC		0x4F525000	// 0 + "PRO"
-#define	UBI32_PROFILE_HD_MAGIC_REV	0x0050524F	// different endian
-#define	UBI32_PROFILE_HD_MMASK		0xFFFFFF00	// 1st byte is Rx/Tx cmd
-#define	UBI32_PROFILE_HD_MMASK_REV	0x00FFFFFF
-
-enum profile_cmds {
-	// cmds from HLOS to NSS
-	PROFILER_CHANGE_SAMPLING_RATE,	// change sampling clock timer
-	PROFILER_START,			// start/stop sampling engine
-	PROFILER_STOP,
-	PROFILER_FLOWCTRL,		// info how many buffers available
-	DEBUG_RD_REQ,			// I/O commands h2n
-	DEBUG_WR_REQ,
-	DEBUG_REPLY,			// n2h respond
-
-	// data from NSS to HLOS
-	PROFILER_FIXED_INFO = 8,	// set bit 3 for data
-	PROFILER_COUNTERS,
-	PROFILER_SAMPLES,
-};
-
-struct profile_sample_ctrl_header {
-	uint32_t hd_magic;	// cmd + MAGIC for packet and endianess check
-
-	/*
-	 * controlling data need to be sent to and used by upper layer (HLOS)
-	 */
-	uint16_t count;		// number of valid samples
-	uint16_t max_samples;	// how many samples can be in the samples array
-	uint32_t dropped_samples; // how many samples did the profiler drop due to buffer overruns
-
-	/*
-	 * info data -- sent to remote profiler tool (need swap)
-	 */
-	struct profile_ext_header exh;
-
-};
-
-/*
- * # of sample buffers in pbuf payload
- */
-#ifndef	PBUF_PAYLOAD_SIZE
-#define	PBUF_PAYLOAD_SIZE	1792	// for HLOS driver: must sync with pbuf_public
-typedef enum meta_types {
-	PINGPONG_EMPTY,
-	PINGPONG_FULL,
-	PINGPONG_INUSE,
-} flowctrl_t;
-#else
-typedef enum pnode_c2h_metadata_types	flowctrl_t;	// for NSS driver
-#endif
-
-#define	MAX_SAMPLES_PER_PBUF	((PBUF_PAYLOAD_SIZE - sizeof(struct profile_sample_ctrl_header)) / sizeof(struct profile_sample))
-
-struct n2h_meta_header {
-	flowctrl_t md_type;	// N2H (NSS) and receiver (HLOS) flow control (meta type)
-	uint32_t d_len;		// total data length start from psc_header
-};
-
-struct profile_session {	// use for per session start
-	uint32_t hd_magic;	// common ovarlay in all headers
-	uint32_t num_counters;	// how many registered performance (app) counters -- may change
-	uint32_t ocm_size;
-	uint32_t sram_start;
-
-	uint32_t rate;		// sampling rate
-	uint32_t cpu_id;	// chip_id register
-	uint32_t cpu_freq;	// chip clock
-	uint32_t ddr_freq;	// DDR MEM speed
-	struct profile_counter counters[PROFILE_MAX_APP_COUNTERS];
-};
-
-struct profile_n2h_sample_buf {
-	struct n2h_meta_header	mh;
-
-	struct profile_sample_ctrl_header	psc_header;	// per sample period
-	struct profile_sample	samples[MAX_SAMPLES_PER_PBUF];	// per thread samples - for NSS send
-};
-
-struct profile_common {
-	struct profile_session un;
-	/*
-	 * changable data sent everything pbuf
-	 */
-	struct profile_n2h_sample_buf *pn2h;	// sampling ctrl for this sample period
-	struct profile_sample *samples;	// samples array was allocated by the linux driver
-					// now NSS points it to pbuf + pn2h header
-	uint16_t	cur;		// pos where driver take (read) samples
-	int16_t		enabled;	// Is the profiler enabled to take samples?
-};
-
-/*
- * each buffer holds 4-7 sets (sample intrs) of samples; by average 5 sets per buffer,
- * at 10ms smaple clock, 1s sleep in profilerd requires kernel to have 1000 / 10 / 5 = 20
- * buffer to store one 1s samples. For higher sampling rate, either kernel needs more buffers
- * or profilerd needs less sleep time, but both needs to make match.
- */
-#define	CCL_SIZE	32
-
-struct profile_io {
-	struct profile_common	pnc;
-
-	/*
-	 * control fields - HLOS
-	 */
-	void	*ctx;		// nss_ctx for Linux driver
-	int	profile_first_packet;
-	int	profile_sequence_num;
-
-	/*
-	 * circular buffers for psc_header/samples
-	 */
-	struct profile_n2h_sample_buf *ccl;
-	int	ccl_read;
-	int	ccl_write;
-
-	/*
-	 * data from HLOS -- used to generate sample->pid in ULTRA -- no longer needed in NSS
-	 */
-	uint32_t *sw_ksp_ptr;	// pointer to array (per hardware thread) of pointers to struct thread_info
-	uint32_t task_offset;	// offset in bytes in thread_info to task_struct pointer
-	uint32_t pid_offset;	// offset in bytes in task_struct to the PID
-};
-
-/*
- * Krait <--> NSS debug mechanism. It lays over on profile_n2h_sample_buf.samples (ccl->samples)
- */
-#define	MAX_DB_WR	28	// profile_session has 31 4B words data (32W total with hd_magic) and
-#define	MAX_DB_RD	30	// common has two more ptrs
-struct debug_box {		// this overlays with profile_common (RD) or profile_session (WR)
-	uint32_t hd_magic;	// cmd + MAGIC for packet and endianess check
-
-	uint32_t opts;
-	uint32_t *base_addr;
-	int32_t	dlen;		// in 4B words
-	uint32_t data[MAX_DB_RD];
-};
-
-#define	DEBUG_OPT_BCTRL	1		// basic CTRL
-#define	DEBUG_OPT_MOVEIO	(1<<1)	// force to use moveio in case new OCP range is added
diff --git a/profiler/profilesample.h b/profiler/profilesample.h
deleted file mode 100644
index 72c4afa..0000000
--- a/profiler/profilesample.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-/*
- * profilesample.h
- *	Sample format for profiling
- */
-
-#ifndef	_PROFILE_SAMPLE_H_
-#define	_PROFILE_SAMPLE_H_
-
-#define PROFILE_STACK_WORDS 4
-
-/*
- * Each sample is for an enabled thread, not including the profiling thread.
- * HRT thread sampling is optional.
- * Sampled threads may be active or inactive.  Samples are included in thread number
- * order, so each sample interval has a set of samples starting with one from thread 0
- *
- * Samples include bits indicating if this thread is blocked
- */
-#define PROFILE_I_BLOCKED_BIT 5
-#define PROFILE_I_BLOCKED (1 << PROFILE_I_BLOCKED_BIT)
-#define PROFILE_D_BLOCKED_BIT 4
-#define PROFILE_D_BLOCKED (1 << PROFILE_D_BLOCKED_BIT)
-#define PROFILE_BTB_SHIFT 6
-
-#if !defined __unix__ && !defined __ELF__ && !defined __GNUC_
-typedef	unsigned char	uint8_t;
-typedef	unsigned short	uint16_t;
-typedef	unsigned int	uint32_t;
-#endif
-
-struct profile_sample {
-	uint32_t pc;		// PC value
-	uint32_t pid;		// pid for the current process, or 0 if NOMMU or unmapped space
-	uint16_t active;	// threads are active - for accurate counting
-	uint16_t d_blocked;	// threads are blocked due to D cache misses : may be removed
-	uint16_t i_blocked;	// threads are blocked due to I cache misses
-	uint8_t cond_codes;	// for branch prediction
-	uint8_t thread;		// 4-bit thread number
-	uint32_t a_reg;		// source An if PC points to a calli.  Otherwise a5 contents for parent of leaf function
-	uint32_t parent[PROFILE_STACK_WORDS];
-				// return addresses from stack, to find the caller
-};
-
-
-/*
- * variables for all components/modules
- */
-#ifdef	ARCH_NUM_THREADS
-#define PROFILE_MAX_THREADS ARCH_NUM_THREADS
-#else
-#define PROFILE_MAX_THREADS 12
-#endif
-
-/*
- * common variables cross profile components/modules
- */
-#define PROFILE_MAX_PACKET_SIZE 1440	// MSS - tcp/ip headers
-
-/*
- * values chosen so all counter values fit in a single 1400 byte UDP packet
- */
-#define PROFILE_COUNTERS 8
-#define PROFILE_COUNTER_NAME_LENGTH 20
-#define PROFILE_MAX_APP_COUNTERS 24
-
-#define PROFILE_MAX_COUNTERS ((PROFILE_MAX_PACKET_SIZE - sizeof(struct profile_header_counters)) / (PROFILE_COUNTER_NAME_LENGTH + 4))
-
-struct profile_counter {
-	char name[PROFILE_COUNTER_NAME_LENGTH];
-	uint32_t value;
-};
-
-/*
- * sampling period info cross all modules -- use extended struct to avoid copy
- */
-struct profile_ext_header {
-	uint16_t d_blocked;	// threads are blocked due to D cache misses
-	uint16_t i_blocked;	// threads are blocked due to I cache misses
-	uint16_t high;		// threads were enabled high priority -- unused
-	uint16_t enabled_threads;	// threads were enabled at the last sample time
-	uint16_t hrt;		// HRT threads
-	uint8_t profiler_tid;	// thread running the profile sampler
-	uint8_t sample_sets;	// typical 5-8 sets, and may be 9 - see design doc for details
-	uint32_t sets_map;	// a set map uses a nibble, 8 maps and 9th is derived
-	uint32_t clocks;		// system clock timer at last sample
-	uint32_t inst_count[PROFILE_MAX_THREADS]; // sampled instruction counts at most recent sample
-	uint32_t stats[PROFILE_COUNTERS]; // contents of the cache statistics counters
-};
-
-#endif	// _PROFILE_SAMPLE_H_
diff --git a/profiler/profpkt.h b/profiler/profpkt.h
deleted file mode 100644
index 752af06..0000000
--- a/profiler/profpkt.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- **************************************************************************
- * Copyright (c) 2014, 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.
- **************************************************************************
- */
-
-/*
- * profpkt.h
- *      profile packet header to communicate with the profiler display tool
- *
- * IMPORTANT!  There is a parallel verison of this file for both linux driver and profiler display tool
- *
- * Both this file and profilesample.h file must be placed
- * in dirver/.../nss (for linux driver)	and as well as	in tools/profiler/include directories
- *	(for profilerd.c of profilerd and profile.cpp:1600::on_packet of profile tool).
- *
- *   Ubi32 CPU Profiler packet formats for communication between the linux proc driver and the profiler display tool
- */
-
-#include "profilesample.h"	// common definitions
-
-#define PROFILE_PORT 51080
-#define PROFILE_CONTROL_PORT 51081
-#define PROFILE_POSIX_NAME_LENGTH 32
-
-/*
- * profile UDP packet format for communicating between ip3k and host
- *
- * every packet starts with a header, followed by samples.
- * samples are only taken for non-hrt threads that are
- * active
- */
-#define PROF_MAGIC 0x3ea0
-#define PROF_MAGIC_COUNTERS 0x9ea0
-#define PROF_MAGIC_MAPS 0xaea0
-
-/*
- * Versions (31 max):
- * 1 to 4 were before 6.0 release,  development versions
- * 5 was forward compatible version, shipped with 6.0 and 6.1
- * 6 adds heap packets, and clock_freq to header, shipped with 6.2
- * 7 adds a sequence numbers to check for dropped packets, shipped with 6.3.5
- * 8 adds mqueue timing information, shipped with 6.3.5
- * 9 adds sdram heap size information, shipped with 6.4
- * 10 adds heapmem heap callers and long latency stack traces.  shipped with 6.4
- * 11 adds support for Mars (IP5K).  shipped with 6.10
- * 12 adds more support for Mars.  Shipped with 7.0
- * 13 adds per sample latency measurement.  Shipped with 7.2
- * 14 changes the heap format and adds a string packet.  Shipped with 7.4
- * 15 adds dsr stats and posix.  shipped with 7.6
- * 16 corrects maximum packet count for Ares.  ships with 7.9
- * 17 adds a5 register value to sample
- * 18 adds counter support and removes unused header fields
- * 19 adds PID support for MMU profiling
- * 20 changes the protocol for transmitting map PID maps automatically
- * 21 adds support for multiple possible parents, configurable
- */
-
-#define PROFILE_VERSION 21
-
-
-/*
- * Each packet starts with a profile_header, then sample_count samples;
- * samples are gprof samples of pc, the return address, condition codes, and active threads.
- * For performance concern, the field sequence may be reordered to match profilenode to reduce
- * a memory copy.
- */
-struct profile_pkg_header {		// in network byte order !
-	uint16_t magic;			/* magic number and version */
-	uint8_t header_size;		/* number of bytes in profile header */
-	uint8_t sample_count;		/* number of samples in the packet */
-	uint32_t sample_stack_words;	/* number of stack words in the sample */
-	uint32_t seq_num;		/* to detect dropped profiler packets */
-	uint32_t profile_instructions;	/* instructions executed by profiler mainline */
-
-	uint32_t unused_overlay;	//  untouched fields below in Linux -- to reduce memcpy
-	uint32_t cpu_id;		/* CHIP_ID register contents */
-	uint32_t clock_freq;		/* clock frequency (Hz) of system being analyzed */
-	uint32_t ddr_freq;		/* DDR clock frequency */
-};
-
-struct profile_header {		// in network byte order !
-	struct profile_pkg_header pph;
-	struct profile_ext_header exh;
-};
-
-struct profile_header_counters {
-	uint16_t magic;
-	uint16_t ultra_count;		// how many ultra counters follow this
-	uint32_t ultra_sample_time;	// in chip clocks
-	uint32_t linux_count;		// how many linux counters follow this
-	uint32_t linux_sample_time;
-};
-
-/*
- * send memory maps from linux to profiler tool
- */
-
-struct profile_header_maps {
-	uint16_t magic;			/* magic number and last packet bit */
-	uint16_t count;
-	uint32_t page_shift;
-};
-
-#define PROFILE_MAP_NUM_TYPES 16
-
-/* size field is pages.  True size in bytes is (1 << PAGE_SHIFT) * size */
-#define PROFILE_MAP_TYPE_FREE 0
-#define PROFILE_MAP_TYPE_SMALL 1
-#define PROFILE_MAP_TYPE_FS 2
-#define PROFILE_MAP_TYPE_UNKNOWN_USED 4
-#define PROFILE_MAP_TYPE_TEXT 5
-#define PROFILE_MAP_TYPE_STACK 6
-#define PROFILE_MAP_TYPE_APP_DATA 7
-#define PROFILE_MAP_TYPE_ASHMEM 8
-#define PROFILE_MAP_TYPE_READ_SHARED 9
-#define PROFILE_MAP_TYPE_CACHE 10
-#define PROFILE_MAP_TYPE_VMA_WASTE 11
-#define PROFILE_MAP_RESERVED 15
-
-#define PROFILE_MAP_TYPE_SHIFT 12
-#define PROFILE_MAP_SIZE_MASK 0xfff
-
-struct profile_map {
-	uint16_t start;		/* start page number of segment, relative to start of OCM (Max 256 MB on IP7K or 1 GB on IP8K, plus 256 KB OCM) */
-	uint16_t type_size;	/* type (4 bits) of the segment and size (12 bits) in pages. A size of 0 means 4K pages */
-};
-
-#define PROFILE_MAX_MAPS (PROFILE_MAX_PACKET_SIZE - sizeof(struct profile_header_maps)) / sizeof(struct profile_map)
