QSDK-11.0 Branch

This commit is contained in:
Qosmio 2022-09-20 04:35:01 -04:00
parent 84b7c9704e
commit 1bcb3ee66d
23 changed files with 3598 additions and 24011 deletions

View File

@ -5,10 +5,10 @@ PKG_NAME:=qca-nss-clients
PKG_RELEASE:=2
PKG_JOBS=-j4
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-clients
PKG_SOURCE_DATE:=2020-10-29
PKG_SOURCE_DATE:=2020-01-06
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=ef082a735fad96bd2f6f59b94d6ea81defc4796e
PKG_MIRROR_HASH:=9375f2bbdd17826b6ddebc77607ec73c98626570243a9831a1e34e1051eb436c
PKG_SOURCE_VERSION:=1c60cab4a2d40d81a023d4788da36e0e42ca28d3
PKG_MIRROR_HASH:=d26946b38e2901ea751b0f4b09f7e594c4c6da26b8c1b6c0539c4069ae5d4a91
include $(INCLUDE_DIR)/package.mk

View File

@ -1,77 +1,67 @@
--- a/Makefile
+++ b/Makefile
@@ -10,14 +10,11 @@ qca-nss-tun6rd-objs := nss_connmgr_tun6r
ccflags-y += -DNSS_TUN6RD_DEBUG_LEVEL=0
--- a/vlan/Makefile
+++ b/vlan/Makefile
@@ -8,5 +8,5 @@ ifeq ($(SoC),$(filter $(SoC),ipq807x ipq
ccflags-y += -DNSS_VLAN_MGR_PPE_SUPPORT
endif
-ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=0
+ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=4
ccflags-y += -Werror
-KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION)))
-
obj-$(bridge-mgr)+= bridge/
obj-$(capwapmgr)+= capwapmgr/
obj-$(dtlsmgr)+= dtls/$(DTLSMGR_DIR)/
obj-$(gre)+= gre/
obj-$(ipsecmgr)+= ipsecmgr/$(IPSECMGR_DIR)/
-obj-$(ipsecmgr-klips)+= ipsecmgr/$(IPSECMGR_DIR)/plugins/klips/
obj-$(l2tpv2)+= l2tp/l2tpv2/
obj-$(lag-mgr)+= lag/
obj-$(map-t)+= map/map-t/
--- a/eogremgr/nss_eogremgr.c
+++ b/eogremgr/nss_eogremgr.c
@@ -19,6 +19,7 @@
* NSS EOGRE manager
*/
+#include <linux/of.h>
#include <nss_api_if.h>
#include <nss_cmn.h>
#include "nss_connmgr_gre_public.h"
--- a/gre/nss_connmgr_gre_v4.c
+++ b/gre/nss_connmgr_gre_v4.c
@@ -162,14 +162,6 @@ int nss_connmgr_gre_v4_set_config(struct
}
\ No newline at end of file
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -1209,8 +1209,10 @@ static int nss_bridge_mgr_register_event
*/
b_pvt->ifnum = ifnum;
b_pvt->mtu = dev->mtu;
+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
b_pvt->wan_if_num = -1;
b_pvt->wan_if_enabled = false;
+#endif
ether_addr_copy(b_pvt->dev_addr, dev->dev_addr);
spin_lock(&br_mgr_ctx.lock);
list_add(&b_pvt->list, &br_mgr_ctx.list);
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -995,6 +995,7 @@ static int nss_bridge_mgr_bond_slave_cha
return NOTIFY_DONE;
}
- /*
- * IP address validate
- */
- if ((cfg->src_ip == 0) || (cfg->dest_ip == 0)) {
- nss_connmgr_gre_warning("Source ip/Destination IP is invalid");
- return GRE_ERR_INVALID_IP;
- }
-
memset(t, 0, sizeof(struct ip_tunnel));
+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
/*
* Add or remove the slave based based on linking event
*/
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -1010,6 +1010,7 @@ static int nss_bridge_mgr_bond_slave_cha
cu_info->upper_dev->name, master->name);
}
}
+#endif
priv->pad_len = (cfg->add_padding) ? GRE_HDR_PAD_LEN : 0;
--- a/gre/nss_connmgr_gre_v6.c
+++ b/gre/nss_connmgr_gre_v6.c
@@ -95,7 +95,8 @@ static int nss_connmgr_gre_v6_get_mac_ad
/*
* Find src MAC address
*/
- local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, 1);
+ local_dev = NULL;
+ local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, local_dev);
if (!local_dev) {
nss_connmgr_gre_warning("Unable to find local dev for %pI6", src_ip);
return GRE_ERR_NO_LOCAL_NETDEV;
@@ -106,7 +107,6 @@ static int nss_connmgr_gre_v6_get_mac_ad
/*
* Find dest MAC address
*/
-
rt = nss_connmgr_gre_v6_route_lookup(&init_net, &dst_addr);
if (!rt) {
nss_connmgr_gre_warning("Unable to find route lookup for %pI6", dest_ip);
@@ -140,8 +140,7 @@ static int nss_connmgr_gre_v6_get_mac_ad
* Release hold on existing route entry, and find the route entry again
*/
ip6_rt_put(rt);
-
- rt = nss_connmgr_gre_v6_route_lookup(&init_net, &dst_addr);
+ rt = rt6_lookup(&init_net, &dst_addr, NULL, 0, NULL, 0);
if (!rt) {
nss_connmgr_gre_warning("Unable to find route lookup for %pI6\n", dest_ip);
return GRE_ERR_NEIGH_LOOKUP;
return NOTIFY_DONE;
}
--- a/clmapmgr/nss_clmapmgr.c
+++ b/clmapmgr/nss_clmapmgr.c
@@ -109,7 +109,6 @@ struct rtnl_link_stats64 *nss_clmapmgr_d
memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64));
dev_put(dev);
- return stats;
}
/*
--- a/dtls/v1.0/nss_connmgr_dtls_netdev.c
+++ b/dtls/v1.0/nss_connmgr_dtls_netdev.c
@@ -160,7 +160,7 @@ static void nss_dtlsmgr_dev_setup(struct
dev->ethtool_ops = NULL;
dev->header_ops = NULL;
dev->netdev_ops = &nss_dtlsmgr_session_ops;
- dev->destructor = NULL;
+ dev->priv_destructor = NULL;
memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);
--- a/gre/test/nss_connmgr_gre_test.c
+++ b/gre/test/nss_connmgr_gre_test.c
@@ -229,10 +229,12 @@ static int nss_connmgr_gre_test_open_pro
@ -91,53 +81,35 @@
};
/*
--- a/ipsecmgr/v1.0/nss_ipsecmgr.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c
@@ -377,7 +377,7 @@ free:
* nss_ipsecmgr_tunnel_stats()
* get tunnel statistics
*/
-static struct rtnl_link_stats64 *nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
+void nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{
struct nss_ipsecmgr_priv *priv = netdev_priv(dev);
--- a/gre/nss_connmgr_gre_v4.c
+++ b/gre/nss_connmgr_gre_v4.c
@@ -168,14 +168,6 @@ int nss_connmgr_gre_v4_set_config(struct
}
}
@@ -389,8 +389,6 @@ static struct rtnl_link_stats64 *nss_ips
read_lock_bh(&ipsecmgr_ctx->lock);
memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64));
read_unlock_bh(&ipsecmgr_ctx->lock);
- /*
- * IP address validate
- */
- if ((cfg->src_ip == 0) || (cfg->dest_ip == 0)) {
- nss_connmgr_gre_warning("Source ip/Destination IP is invalid");
- return GRE_ERR_INVALID_IP;
- }
-
- return stats;
}
/*
@@ -442,7 +440,7 @@ static void nss_ipsecmgr_tunnel_setup(st
dev->header_ops = NULL;
dev->netdev_ops = &nss_ipsecmgr_tunnel_ops;
- dev->destructor = nss_ipsecmgr_tunnel_free;
+ dev->priv_destructor = nss_ipsecmgr_tunnel_free;
memset(t, 0, sizeof(struct ip_tunnel));
priv->pad_len = (cfg->add_padding) ? GRE_HDR_PAD_LEN : 0;
--- a/gre/nss_connmgr_gre_v6.c
+++ b/gre/nss_connmgr_gre_v6.c
@@ -81,7 +81,8 @@ static int nss_connmgr_gre_v6_get_mac_ad
/*
* get the MAC address from the ethernet device
--- a/ipsecmgr/v1.0/nss_ipsecmgr_sa.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr_sa.c
@@ -265,6 +265,7 @@ static bool nss_ipsecmgr_sa_del(struct n
write_unlock_bh(&ipsecmgr_ctx->lock);
return true;
}
+EXPORT_SYMBOL(nss_ipsecmgr_sa_del);
/*
* nss_ipsecmgr_sa_add()
@@ -357,6 +358,7 @@ static bool nss_ipsecmgr_sa_add(struct n
write_unlock_bh(&ipsecmgr_ctx->lock);
return true;
}
+EXPORT_SYMBOL(nss_ipsecmgr_sa_add);
/*
* nss_ipsecmgr_sa_alloc()
* Find src MAC address
*/
- local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, 1);
+ local_dev = NULL;
+ local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, local_dev);
if (!local_dev) {
nss_connmgr_gre_warning("Unable to find local dev for %pI6", src_ip);
return GRE_ERR_NO_LOCAL_NETDEV;
--- a/l2tp/l2tpv2/nss_connmgr_l2tpv2.c
+++ b/l2tp/l2tpv2/nss_connmgr_l2tpv2.c
@@ -244,7 +244,7 @@ static struct nss_connmgr_l2tpv2_session
@ -149,6 +121,8 @@
data->l2tpv2.session.hdr_len = session->hdr_len;
data->l2tpv2.session.reorder_timeout = session->reorder_timeout;
data->l2tpv2.session.recv_seq = session->recv_seq;
--- a/l2tp/l2tpv2/nss_connmgr_l2tpv2.c
+++ b/l2tp/l2tpv2/nss_connmgr_l2tpv2.c
@@ -253,7 +253,7 @@ static struct nss_connmgr_l2tpv2_session
nss_connmgr_l2tpv2_info("sess %u, peer=%u nr=%u ns=%u off=%u hdr_len=%u timeout=%x"
" recv_seq=%x send_seq=%x\n",
@ -175,6 +149,80 @@
/*
* ----------------------------------------------------------------------------------
--- a/exports/nss_dtlsmgr.h
+++ b/exports/nss_dtlsmgr.h
@@ -100,7 +100,7 @@ enum nss_dtlsmgr_metadata_result {
* NSS DTLS manager cryptographic structure to represent key and its length.
*/
struct nss_dtlsmgr_crypto_data {
- const uint8_t *data; /**< Pointer to key or nonce. */
+ uint8_t *data; /**< Pointer to key or nonce. */
uint16_t len; /**< Length of the key. */
};
--- a/eogremgr/nss_eogremgr.c
+++ b/eogremgr/nss_eogremgr.c
@@ -19,6 +19,7 @@
* NSS EOGRE manager
*/
+#include <linux/of.h>
#include <nss_api_if.h>
#include <nss_cmn.h>
#include "nss_connmgr_gre_public.h"
--- a/ipsecmgr/v1.0/nss_ipsecmgr.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c
@@ -377,7 +377,7 @@ free:
* nss_ipsecmgr_tunnel_stats()
* get tunnel statistics
*/
-static struct rtnl_link_stats64 *nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
+void nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{
struct nss_ipsecmgr_priv *priv = netdev_priv(dev);
--- a/ipsecmgr/v1.0/nss_ipsecmgr.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c
@@ -389,8 +389,6 @@ void nss_ipsecmgr_tunnel_stats64(struct
read_lock_bh(&ipsecmgr_ctx->lock);
memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64));
read_unlock_bh(&ipsecmgr_ctx->lock);
-
- return stats;
}
/*
--- a/ipsecmgr/v1.0/nss_ipsecmgr.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c
@@ -440,7 +440,7 @@ static void nss_ipsecmgr_tunnel_setup(st
dev->header_ops = NULL;
dev->netdev_ops = &nss_ipsecmgr_tunnel_ops;
- dev->destructor = nss_ipsecmgr_tunnel_free;
+ dev->priv_destructor = nss_ipsecmgr_tunnel_free;
/*
* get the MAC address from the ethernet device
--- a/ipsecmgr/v1.0/nss_ipsecmgr_sa.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr_sa.c
@@ -265,6 +265,7 @@ static bool nss_ipsecmgr_sa_del(struct n
write_unlock_bh(&ipsecmgr_ctx->lock);
return true;
}
+EXPORT_SYMBOL(nss_ipsecmgr_sa_del);
/*
* nss_ipsecmgr_sa_add()
--- a/ipsecmgr/v1.0/nss_ipsecmgr_sa.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr_sa.c
@@ -358,6 +358,7 @@ static bool nss_ipsecmgr_sa_add(struct n
write_unlock_bh(&ipsecmgr_ctx->lock);
return true;
}
+EXPORT_SYMBOL(nss_ipsecmgr_sa_add);
/*
* nss_ipsecmgr_sa_alloc()
--- a/l2tp/l2tpv2/nss_l2tpv2_stats.c
+++ b/l2tp/l2tpv2/nss_l2tpv2_stats.c
@@ -21,6 +21,7 @@
@ -185,7 +233,9 @@
#include <linux/ppp_channel.h>
#include <nss_api_if.h>
#include <nss_dynamic_interface.h>
@@ -103,14 +104,14 @@ void nss_l2tpv2_update_dev_stats(struct
--- a/l2tp/l2tpv2/nss_l2tpv2_stats.c
+++ b/l2tp/l2tpv2/nss_l2tpv2_stats.c
@@ -104,14 +104,14 @@ void nss_l2tpv2_update_dev_stats(struct
/*
* Update tunnel & session stats
*/
@ -202,44 +252,9 @@
if (!session) {
tunnel_put(tunnel);
dev_put(dev);
--- a/match/nss_match.c
+++ b/match/nss_match.c
@@ -28,6 +28,7 @@
#include <linux/types.h>
#include <nss_api_if.h>
#include <linux/debugfs.h>
+#include <linux/of.h>
/*
* nss_match_verify_config_msg()
--- a/match/nss_match_priv.h
+++ b/match/nss_match_priv.h
@@ -29,19 +29,19 @@
/*
* Statically compile messages at different levels
*/
-#if (NSS_match_DEBUG_LEVEL < 2)
+#if (NSS_MATCH_DEBUG_LEVEL < 2)
#define nss_match_warn(s, ...)
#else
#define nss_match_warn(s, ...) pr_warn("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
-#if (NSS_match_DEBUG_LEVEL < 3)
+#if (NSS_MATCH_DEBUG_LEVEL < 3)
#define nss_match_info(s, ...)
#else
#define nss_match_info(s, ...) pr_notice("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
-#if (NSS_match_DEBUG_LEVEL < 4)
+#if (NSS_MATCH_DEBUG_LEVEL < 4)
#define nss_match_trace(s, ...)
#else
#define nss_match_trace(s, ...) pr_info("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
--- a/portifmgr/nss_portifmgr.c
+++ b/portifmgr/nss_portifmgr.c
@@ -187,16 +187,20 @@ drop:
@@ -188,16 +188,20 @@ drop:
}
/*
@ -263,7 +278,9 @@
}
/*
@@ -225,7 +229,7 @@ static const struct net_device_ops nss_p
--- a/portifmgr/nss_portifmgr.c
+++ b/portifmgr/nss_portifmgr.c
@@ -230,7 +230,7 @@ static const struct net_device_ops nss_p
.ndo_start_xmit = nss_portifmgr_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
.ndo_change_mtu = nss_portifmgr_change_mtu,
@ -272,6 +289,60 @@
};
/*
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -820,8 +820,10 @@ static struct nss_vlan_pvt *nss_vlan_mgr
*/
static void nss_vlan_mgr_instance_free(struct nss_vlan_pvt *v)
{
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
int32_t i;
int ret = 0;
+#endif
spin_lock(&vlan_mgr_ctx.lock);
BUG_ON(--v->refs);
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -981,8 +981,11 @@ static int nss_vlan_mgr_register_event(s
int ret;
#endif
uint32_t vlan_tag;
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *slave;
- int32_t port, port_if;
+ int32_t port;
+#endif
+ int32_t port_if;
struct vlan_dev_priv *vlan;
struct net_device *real_dev;
bool is_bond_master = false;
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -1359,8 +1359,10 @@ return_with_error:
int nss_vlan_mgr_join_bridge(struct net_device *dev, uint32_t bridge_vsi)
{
struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev);
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *real_dev;
int ret;
+#endif
if (!v)
return 0;
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -1422,8 +1422,10 @@ EXPORT_SYMBOL(nss_vlan_mgr_join_bridge);
int nss_vlan_mgr_leave_bridge(struct net_device *dev, uint32_t bridge_vsi)
{
struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev);
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *real_dev;
int ret;
+#endif
if (!v)
return 0;
--- a/profiler/profile.c
+++ b/profiler/profile.c
@@ -31,6 +31,7 @@
@ -282,7 +353,9 @@
#include <asm/uaccess.h>
#include <asm/page.h>
#include <asm/thread_info.h>
@@ -937,12 +938,26 @@ static ssize_t debug_if(struct file *fil
--- a/profiler/profile.c
+++ b/profiler/profile.c
@@ -891,12 +891,26 @@ static ssize_t debug_if(struct file *fil
return count;
}
@ -309,7 +382,9 @@
/*
* showing sample status on Linux console
@@ -971,6 +986,15 @@ static ssize_t profile_rate_write(struct
--- a/profiler/profile.c
+++ b/profiler/profile.c
@@ -939,6 +939,15 @@ static ssize_t profile_rate_write(struct
return 0;
}
@ -325,7 +400,9 @@
static const struct file_operations profile_rate_fops = {
.open = profile_rate_open,
.read = seq_read,
@@ -978,6 +1002,7 @@ static const struct file_operations prof
--- a/profiler/profile.c
+++ b/profiler/profile.c
@@ -955,6 +955,7 @@ static const struct file_operations prof
.release = single_release,
.write = profile_rate_write,
};
@ -333,158 +410,3 @@
/*
* hexdump
--- a/vlan/Makefile
+++ b/vlan/Makefile
@@ -8,7 +8,7 @@ ifeq ($(SoC),$(filter $(SoC),ipq807x ipq
ccflags-y += -DNSS_VLAN_MGR_PPE_SUPPORT
endif
-ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=0
+ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=4
ccflags-y += -Werror
ifneq (,$(filter $(CONFIG_BONDING),y m))
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -821,8 +821,10 @@ static struct nss_vlan_pvt *nss_vlan_mgr
*/
static void nss_vlan_mgr_instance_free(struct nss_vlan_pvt *v)
{
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
int32_t i;
int ret = 0;
+#endif
spin_lock(&vlan_mgr_ctx.lock);
BUG_ON(--v->refs);
@@ -980,8 +982,11 @@ static int nss_vlan_mgr_register_event(s
int ret;
#endif
uint32_t vlan_tag;
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *slave;
- int32_t port, port_if;
+ int32_t port;
+#endif
+ int32_t port_if;
struct vlan_dev_priv *vlan;
struct net_device *real_dev;
bool is_bond_master = false;
@@ -1355,8 +1360,10 @@ return_with_error:
int nss_vlan_mgr_join_bridge(struct net_device *dev, uint32_t bridge_vsi)
{
struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev);
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *real_dev;
int ret;
+#endif
if (!v)
return 0;
@@ -1416,8 +1423,10 @@ EXPORT_SYMBOL(nss_vlan_mgr_join_bridge);
int nss_vlan_mgr_leave_bridge(struct net_device *dev, uint32_t bridge_vsi)
{
struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev);
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *real_dev;
int ret;
+#endif
if (!v)
return 0;
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -1067,8 +1067,10 @@ int nss_bridge_mgr_register_br(struct ne
*/
b_pvt->ifnum = ifnum;
b_pvt->mtu = dev->mtu;
+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
b_pvt->wan_if_num = -1;
b_pvt->wan_if_enabled = false;
+#endif
ether_addr_copy(b_pvt->dev_addr, dev->dev_addr);
spin_lock(&br_mgr_ctx.lock);
list_add(&b_pvt->list, &br_mgr_ctx.list);
@@ -1130,6 +1132,7 @@ static int nss_bridge_mgr_bond_slave_cha
return NOTIFY_DONE;
}
+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
/*
* Add or remove the slave based based on linking event
*/
@@ -1144,6 +1147,7 @@ static int nss_bridge_mgr_bond_slave_cha
cu_info->upper_dev->name, master->name);
}
}
+#endif
return NOTIFY_DONE;
}
--- a/dtls/v1.0/nss_connmgr_dtls_netdev.c
+++ b/dtls/v1.0/nss_connmgr_dtls_netdev.c
@@ -160,7 +160,7 @@ static void nss_dtlsmgr_dev_setup(struct
dev->ethtool_ops = NULL;
dev->header_ops = NULL;
dev->netdev_ops = &nss_dtlsmgr_session_ops;
- dev->destructor = NULL;
+ dev->priv_destructor = NULL;
memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);
--- a/exports/nss_dtlsmgr.h
+++ b/exports/nss_dtlsmgr.h
@@ -128,7 +128,7 @@ enum nss_dtlsmgr_metadata_result {
* NSS DTLS manager cryptographic structure to represent key and its length.
*/
struct nss_dtlsmgr_crypto_data {
- const uint8_t *data; /**< Pointer to key or nonce. */
+ uint8_t *data; /**< Pointer to key or nonce. */
uint16_t len; /**< Length of the key. */
};
--- a/clmapmgr/nss_clmapmgr.c
+++ b/clmapmgr/nss_clmapmgr.c
@@ -87,14 +87,13 @@ fail:
* nss_clmapmgr_dev_stats64()
* Netdev ops function to retrieve stats.
*/
-struct rtnl_link_stats64 *nss_clmapmgr_dev_stats64(struct net_device *dev,
+void nss_clmapmgr_dev_stats64(struct net_device *dev,
struct rtnl_link_stats64 *stats)
{
struct nss_clmapmgr_priv_t *priv;
if (!stats) {
nss_clmapmgr_warning("%px: invalid rtnl structure\n", dev);
- return stats;
}
dev_hold(dev);
@@ -109,7 +108,6 @@ struct rtnl_link_stats64 *nss_clmapmgr_d
memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64));
dev_put(dev);
- return stats;
}
/*
--- a/tls/nss_tlsmgr_tun.c
+++ b/tls/nss_tlsmgr_tun.c
@@ -102,7 +102,7 @@ static int nss_tlsmgr_tun_open(struct ne
* nss_tlsmgr_tun_stats64()
* TLS manager tunnel device
*/
-static struct rtnl_link_stats64 *nss_tlsmgr_tun_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
+void nss_tlsmgr_tun_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{
struct nss_tlsmgr_tun *tun = netdev_priv(dev);
@@ -113,7 +113,6 @@ static struct rtnl_link_stats64 *nss_tls
nss_tlsmgr_ctx_stats_copy(&tun->ctx_dec, stats);
read_unlock_bh(&tun->lock);
- return stats;
}
/*

File diff suppressed because it is too large Load Diff

View File

@ -1,336 +0,0 @@
--- a/netlink/Makefile
+++ b/netlink/Makefile
@@ -1,3 +1,4 @@
+GRE_ENABLED := $(strip $(if $(filter $(gre), y), 1 , 0))
CAPWAP_ENABLED := $(strip $(if $(filter $(capwapmgr), y), 1 , 0))
IPSEC_ENABLED := $(strip $(if $(filter $(ipsecmgr), y), 1 , 0))
DTLS_ENABLED := $(strip $(if $(filter $(dtlsmgr), y), 1 , 0))
@@ -10,44 +11,39 @@ ccflags-y += -DNSS_CLIENT_BUILD_ID="$(BU
ccflags-y += -DCONFIG_NSS_NLIPV4=1
ccflags-y += -DCONFIG_NSS_NLIPV6=1
-ccflags-y += -DCONFIG_NSS_NLOAM=1
-ccflags-y += -DCONFIG_NSS_NLGRE_REDIR_FAMILY=1
+ccflags-y += -DCONFIG_NSS_NLOAM=0
+ccflags-y += -DCONFIG_NSS_NLGRE_REDIR_FAMILY=${GRE_ENABLED}
ccflags-y += -DCONFIG_NSS_NLETHRX=1
ccflags-y += -DCONFIG_NSS_NLDYNAMIC_INTERFACE=1
ccflags-y += -DCONFIG_NSS_NLN2H=1
-ccflags-y += -DCONFIG_NSS_NLIPV4_REASM=1
-ccflags-y += -DCONFIG_NSS_NLIPV6_REASM=1
+ccflags-y += -DCONFIG_NSS_NLIPV4_REASM=0
+ccflags-y += -DCONFIG_NSS_NLIPV6_REASM=0
ccflags-y += -DCONFIG_NSS_NLWIFILI=1
ccflags-y += -DCONFIG_NSS_NLLSO_RX=1
-ccflags-y += -DCONFIG_NSS_NLMAP_T=1
-ccflags-y += -DCONFIG_NSS_NLPPPOE=1
-ccflags-y += -DCONFIG_NSS_NLL2TPV2=1
-ccflags-y += -DCONFIG_NSS_NLPPTP=1
+ccflags-y += -DCONFIG_NSS_NLMAP_T=0
+ccflags-y += -DCONFIG_NSS_NLPPPOE=0
+ccflags-y += -DCONFIG_NSS_NLL2TPV2=0
+ccflags-y += -DCONFIG_NSS_NLPPTP=0
ccflags-y += -DCONFIG_NSS_NLCAPWAP=${CAPWAP_ENABLED}
ccflags-y += -DCONFIG_NSS_NLIPSEC=${IPSEC_ENABLED}
ccflags-y += -DCONFIG_NSS_NLDTLS=${DTLS_ENABLED}
qca-nss-netlink-objs := nss_nl.o
-qca-nss-netlink-objs += nss_nlgre_redir_family.o
-qca-nss-netlink-objs += nss_nlgre_redir_cmd.o
-qca-nss-netlink-objs += nss_nlgre_redir_cmn.o
-qca-nss-netlink-objs += nss_nlgre_redir.o
-qca-nss-netlink-objs += nss_nlgre_redir_lag.o
qca-nss-netlink-objs += nss_nlipv4.o
qca-nss-netlink-objs += nss_nlipv6.o
-qca-nss-netlink-objs += nss_nloam.o
+# qca-nss-netlink-objs += nss_nloam.o
qca-nss-netlink-objs += nss_nlethrx.o
qca-nss-netlink-objs += nss_nldynamic_interface.o
qca-nss-netlink-objs += nss_nln2h.o
-qca-nss-netlink-objs += nss_nlipv4_reasm.o
-qca-nss-netlink-objs += nss_nlipv6_reasm.o
+# qca-nss-netlink-objs += nss_nlipv4_reasm.o
+# qca-nss-netlink-objs += nss_nlipv6_reasm.o
qca-nss-netlink-objs += nss_nlwifili.o
qca-nss-netlink-objs += nss_nllso_rx.o
-qca-nss-netlink-objs += nss_nlmap_t.o
-qca-nss-netlink-objs += nss_nlpppoe.o
-qca-nss-netlink-objs += nss_nll2tpv2.o
-qca-nss-netlink-objs += nss_nlpptp.o
-
+# qca-nss-netlink-objs += nss_nlmap_t.o
+# qca-nss-netlink-objs += nss_nlpppoe.o
+# qca-nss-netlink-objs += nss_nll2tpv2.o
+# qca-nss-netlink-objs += nss_nlpptp.o
+#
ifneq (,$(filter $(capwapmgr), y))
qca-nss-netlink-objs += nss_nlcapwap.o
endif
@@ -60,6 +56,14 @@ ifneq (,$(filter $(ipsecmgr), y))
qca-nss-netlink-objs += nss_nlipsec.o
endif
+ifneq (,$(filter $(gre), y))
+qca-nss-netlink-objs += nss_nlgre_redir_family.o
+qca-nss-netlink-objs += nss_nlgre_redir_cmd.o
+qca-nss-netlink-objs += nss_nlgre_redir_cmn.o
+qca-nss-netlink-objs += nss_nlgre_redir.o
+qca-nss-netlink-objs += nss_nlgre_redir_lag.o
+endif
+
ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64))
ccflags-y += -DCONFIG_NSS_NLC2C_TX=1
ccflags-y += -DCONFIG_NSS_NLC2C_RX=1
--- a/netlink/nss_nl.c
+++ b/netlink/nss_nl.c
@@ -35,8 +35,6 @@
#include "nss_nlcmn_if.h"
#include "nss_nldtls.h"
#include "nss_nldtls_if.h"
-#include "nss_nlgre_redir_if.h"
-#include "nss_nlgre_redir_family.h"
#include "nss_nlipsec.h"
#include "nss_nlipsec_if.h"
#include "nss_nlipv4.h"
@@ -59,10 +57,6 @@
#include "nss_nlc2c_tx_if.h"
#include "nss_nlc2c_rx.h"
#include "nss_nlc2c_rx_if.h"
-#include "nss_nlipv4_reasm.h"
-#include "nss_nlipv4_reasm_if.h"
-#include "nss_nlipv6_reasm.h"
-#include "nss_nlipv6_reasm_if.h"
#include "nss_nlwifili.h"
#include "nss_nlwifili_if.h"
#include "nss_nllso_rx.h"
@@ -106,24 +100,6 @@ static struct nss_nl_family family_handl
},
{
/*
- * NSS_NLIPSEC
- */
- .name = NSS_NLIPSEC_FAMILY, /* ipsec */
- .entry = NSS_NLIPSEC_INIT, /* init */
- .exit = NSS_NLIPSEC_EXIT, /* exit */
- .valid = CONFIG_NSS_NLIPSEC /* 1 or 0 */
- },
- {
- /*
- * NSS_NLOAM
- */
- .name = NSS_NLOAM_FAMILY, /* oam */
- .entry = NSS_NLOAM_INIT, /* init */
- .exit = NSS_NLOAM_EXIT, /* exit */
- .valid = CONFIG_NSS_NLOAM /* 1 or 0 */
- },
- {
- /*
* NSS_NLIPV6
*/
.name = NSS_NLIPV6_FAMILY, /* ipv6 */
@@ -133,24 +109,6 @@ static struct nss_nl_family family_handl
},
{
/*
- * NSS_NLGRE_REDIR
- */
- .name = NSS_NLGRE_REDIR_FAMILY, /* gre_redir */
- .entry = NSS_NLGRE_REDIR_FAMILY_INIT, /* init */
- .exit = NSS_NLGRE_REDIR_FAMILY_EXIT, /* exit */
- .valid = CONFIG_NSS_NLGRE_REDIR_FAMILY /* 1 or 0 */
- },
- {
- /*
- * NSS_NLCAPWAP
- */
- .name = NSS_NLCAPWAP_FAMILY, /* capwap */
- .entry = NSS_NLCAPWAP_INIT, /* init */
- .exit = NSS_NLCAPWAP_EXIT, /* exit */
- .valid = CONFIG_NSS_NLCAPWAP /* 1 or 0 */
- },
- {
- /*
* NSS_NLDTLS
*/
.name = NSS_NLDTLS_FAMILY, /* dtls */
@@ -169,15 +127,6 @@ static struct nss_nl_family family_handl
},
{
/*
- * NSS_NLEDMA
- */
- .name = NSS_NLEDMA_FAMILY, /* edma */
- .entry = NSS_NLEDMA_INIT, /* init */
- .exit = NSS_NLEDMA_EXIT, /* exit */
- .valid = CONFIG_NSS_NLEDMA /* 1 or 0 */
- },
- {
- /*
* NSS_NLDYNAMIC_INTERFACE
*/
.name = NSS_NLDYNAMIC_INTERFACE_FAMILY, /* dynamic interface */
@@ -196,42 +145,6 @@ static struct nss_nl_family family_handl
},
{
/*
- * NSS_NLC2C_TX
- */
- .name = NSS_NLC2C_TX_FAMILY, /* c2c_tx */
- .entry = NSS_NLC2C_TX_INIT, /* init */
- .exit = NSS_NLC2C_TX_EXIT, /* exit */
- .valid = CONFIG_NSS_NLC2C_TX /* 1 or 0 */
- },
- {
- /*
- * NSS_NLC2C_RX
- */
- .name = NSS_NLC2C_RX_FAMILY, /* c2c_rx */
- .entry = NSS_NLC2C_RX_INIT, /* init */
- .exit = NSS_NLC2C_RX_EXIT, /* exit */
- .valid = CONFIG_NSS_NLC2C_RX /* 1 or 0 */
- },
- {
- /*
- * NSS_NLIPV4_REASM
- */
- .name = NSS_NLIPV4_REASM_FAMILY, /* ipv4_reasm */
- .entry = NSS_NLIPV4_REASM_INIT, /* init */
- .exit = NSS_NLIPV4_REASM_EXIT, /* exit */
- .valid = CONFIG_NSS_NLIPV4_REASM /* 1 or 0 */
- },
- {
- /*
- * NSS_NLIPV6_REASM
- */
- .name = NSS_NLIPV6_REASM_FAMILY, /* ipv6_reasm */
- .entry = NSS_NLIPV6_REASM_INIT, /* init */
- .exit = NSS_NLIPV6_REASM_EXIT, /* exit */
- .valid = CONFIG_NSS_NLIPV6_REASM /* 1 or 0 */
- },
- {
- /*
* NSS_NLWIFILI
*/
.name = NSS_NLWIFILI_FAMILY, /* wifili */
@@ -248,42 +161,6 @@ static struct nss_nl_family family_handl
.exit = NSS_NLLSO_RX_EXIT, /* exit */
.valid = CONFIG_NSS_NLLSO_RX /* 1 or 0 */
},
- {
- /*
- * NSS_NLMAP_T
- */
- .name = NSS_NLMAP_T_FAMILY, /* map_t */
- .entry = NSS_NLMAP_T_INIT, /* init */
- .exit = NSS_NLMAP_T_EXIT, /* exit */
- .valid = CONFIG_NSS_NLMAP_T /* 1 or 0 */
- },
- {
- /*
- * NSS_NLPPPOE
- */
- .name = NSS_NLPPPOE_FAMILY, /* pppoe */
- .entry = NSS_NLPPPOE_INIT, /* init */
- .exit = NSS_NLPPPOE_EXIT, /* exit */
- .valid = CONFIG_NSS_NLPPPOE /* 1 or 0 */
- },
- {
- /*
- * NSS_NLL2TPV2
- */
- .name = NSS_NLL2TPV2_FAMILY, /* l2tpv2 */
- .entry = NSS_NLL2TPV2_INIT, /* init */
- .exit = NSS_NLL2TPV2_EXIT, /* exit */
- .valid = CONFIG_NSS_NLL2TPV2 /* 1 or 0 */
- },
- {
- /*
- * NSS_NLPPTP
- */
- .name = NSS_NLPPTP_FAMILY, /* pptp */
- .entry = NSS_NLPPTP_INIT, /* init */
- .exit = NSS_NLPPTP_EXIT, /* exit */
- .valid = CONFIG_NSS_NLPPTP /* 1 or 0 */
- },
};
#define NSS_NL_FAMILY_HANDLER_SZ ARRAY_SIZE(family_handlers)
--- a/netlink/nss_nlipv4.c
+++ b/netlink/nss_nlipv4.c
@@ -336,20 +336,6 @@ static int nss_nlipv4_verify_conn_rule(s
tuple->return_ident, tuple->flow_ident);
break;
- case NSS_NL_IFTYPE_TUNNEL_GRE:
- /*
- * Currently this implementation is only for gre_redir
- */
- conn->flow_interface_num = nss_nlgre_redir_cmd_get_ifnum(flow_dev, tuple->protocol);
- if (conn->flow_interface_num < 0 ) {
- nss_nl_error("%px: Failed to get flow interface number (dev:%s, type:%d)\n",
- flow_dev, flow_dev->name, flow_iftype);
- return -EINVAL;
- }
-
- conn->flow_mtu = nss_nlgre_redir_cmd_get_mtu(flow_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV4, conn->flow_interface_num);
- break;
-
case NSS_NL_IFTYPE_VLAN:
conn->flow_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(flow_dev));
if (conn->flow_interface_num < 0 ) {
@@ -396,17 +382,6 @@ static int nss_nlipv4_verify_conn_rule(s
tuple->return_ident, tuple->flow_ident);
break;
- case NSS_NL_IFTYPE_TUNNEL_GRE:
- conn->return_interface_num = nss_nlgre_redir_cmd_get_ifnum(return_dev, tuple->protocol);
- if (conn->return_interface_num < 0 ) {
- nss_nl_error("%px: Failed to get return interface number (dev:%s, type:%d)\n",
- return_dev, return_dev->name, return_iftype);
- return -EINVAL;
- }
-
- conn->return_mtu = nss_nlgre_redir_cmd_get_mtu(return_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV4, conn->return_interface_num);
- break;
-
case NSS_NL_IFTYPE_VLAN:
conn->return_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(return_dev));
if (conn->return_interface_num < 0 ) {
--- a/netlink/nss_nlipv6.c
+++ b/netlink/nss_nlipv6.c
@@ -353,17 +353,6 @@ static int nss_nlipv6_verify_conn_rule(s
tuple->return_ident, tuple->flow_ident);
break;
- case NSS_NL_IFTYPE_TUNNEL_GRE:
- conn->flow_interface_num = nss_nlgre_redir_cmd_get_ifnum(flow_dev, tuple->protocol);
- if (conn->flow_interface_num < 0 ) {
- nss_nl_error("%px: Failed to get flow interface number (dev:%s, type:%d)\n",
- flow_dev, flow_dev->name, flow_iftype);
- return -EINVAL;
- }
-
- conn->flow_mtu = nss_nlgre_redir_cmd_get_mtu(flow_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV6, conn->flow_interface_num);
- break;
-
case NSS_NL_IFTYPE_VLAN:
conn->flow_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(flow_dev));
if (conn->flow_interface_num < 0 ) {
@@ -411,17 +400,6 @@ static int nss_nlipv6_verify_conn_rule(s
tuple->return_ident, tuple->flow_ident);
break;
- case NSS_NL_IFTYPE_TUNNEL_GRE:
- conn->return_interface_num = nss_nlgre_redir_cmd_get_ifnum(return_dev, tuple->protocol);
- if (conn->return_interface_num < 0 ) {
- nss_nl_error("%px: Failed to get return interface number (dev:%s, type:%d)\n",
- return_dev, return_dev->name, return_iftype);
- return -EINVAL;
- }
-
- conn->return_mtu = nss_nlgre_redir_cmd_get_mtu(return_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV6, conn->return_interface_num);
- break;
-
case NSS_NL_IFTYPE_VLAN:
conn->return_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(return_dev));
if (conn->return_interface_num < 0 ) {

File diff suppressed because it is too large Load Diff

View File

@ -1,458 +1,3 @@
diff --git a/exports/nss_connmgr_tunipip6.h b/exports/nss_connmgr_tunipip6.h
index 7f8bd2c..e1a5e21 100644
--- a/exports/nss_connmgr_tunipip6.h
+++ b/exports/nss_connmgr_tunipip6.h
@@ -28,12 +28,13 @@ enum nss_connmgr_tunipip6_err_codes {
NSS_CONNMGR_TUNIPIP6_TUN_DESTROY_FAILURE, /**< Tunnel destroy failure. */
NSS_CONNMGR_TUNIPIP6_TUN_NONE, /**< Invalid tunnel type */
NSS_CONNMGR_TUNIPIP6_NETDEV_TYPE_FAILURE, /**< Netdevice is not of type ipv6-in-ipv4. */
- NSS_CONNMGR_TUNIPIP6_MAPRULE_ADD_FAILURE, /**< BMR/FMR addition failure. */
- NSS_CONNMGR_TUNIPIP6_MAPRULE_DEL_FAILURE, /**< BMR/FMR deletion failure. */
- NSS_CONNMGR_TUNIPIP6_FMR_RULE_FLUSH_FAILURE, /**< FMR flush failure. */
+ NSS_CONNMGR_TUNIPIP6_MAPRULE_ADD_FAILURE, /**< BMR/FMR addition failure. */
+ NSS_CONNMGR_TUNIPIP6_MAPRULE_DEL_FAILURE, /**< BMR/FMR deletion failure. */
+ NSS_CONNMGR_TUNIPIP6_FMR_RULE_FLUSH_FAILURE, /**< FMR flush failure. */
NSS_CONNMGR_TUNIPIP6_NO_DEV, /**< No NSS node found. */
NSS_CONNMGR_TUNIPIP6_INVALID_PARAM, /**< Invalid tunnel parameters. */
NSS_CONNMGR_TUNIPIP6_INVALID_RULE_TYPE, /**< Invalid maprule type. */
+ NSS_CONNMGR_TUNIPIP6_CONTEXT_FAILURE, /**< Tunnel host context not found. */
};
/*
diff --git a/tunipip6/Makefile b/tunipip6/Makefile
index 4c22939..1500a9d 100644
--- a/tunipip6/Makefile
+++ b/tunipip6/Makefile
@@ -4,7 +4,7 @@ ccflags-y += -DNSS_CLIENT_BUILD_ID="$(BUILD_ID)"
ccflags-y += -DNSS_TUNIPIP6_DEBUG_LEVEL=0
ccflags-y += -Werror
obj-m += qca-nss-tunipip6.o
-qca-nss-tunipip6-objs := nss_connmgr_tunipip6.o nss_connmgr_tunipip6_sysctl.o
+qca-nss-tunipip6-objs := nss_connmgr_tunipip6.o nss_connmgr_tunipip6_sysctl.o nss_connmgr_tunipip6_stats.o
ifneq ($(findstring 4.4, $(KERNELVERSION)),)
ccflags-y += -DDRAFT03_SUPPORT
endif
diff --git a/tunipip6/nss_connmgr_tunipip6.c b/tunipip6/nss_connmgr_tunipip6.c
index 5391724..a7d24c6 100644
--- a/tunipip6/nss_connmgr_tunipip6.c
+++ b/tunipip6/nss_connmgr_tunipip6.c
@@ -20,7 +20,6 @@
#include <linux/types.h>
#include <linux/ip.h>
#include <linux/of.h>
-#include <linux/tcp.h>
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
@@ -29,71 +28,123 @@
#include <linux/if.h>
#include <net/ip_tunnels.h>
#include <net/ip6_tunnel.h>
-#include <linux/if_arp.h>
#include <nss_api_if.h>
#include "nss_connmgr_tunipip6.h"
#include "nss_connmgr_tunipip6_sysctl.h"
+#include "nss_connmgr_tunipip6_priv.h"
+
+#define NSS_TUNIPIP6_MAX_FMR 255 /* Maximum number of forward mapping rule (FMR). */
/*
- * NSS tunipip6 debug macros
+ * Frag Id update is disabled by default
*/
-#if (NSS_TUNIPIP6_DEBUG_LEVEL < 1)
-#define nss_tunipip6_assert(fmt, args...)
-#else
-#define nss_tunipip6_assert(c) if (!(c)) { BUG_ON(!(c)); }
-#endif
-
-#if defined(CONFIG_DYNAMIC_DEBUG)
+bool frag_id_update = false;
+/*
+ * Creating custom ipip6 interface is disabled by default.
+ */
+static bool enable_custom;
+module_param(enable_custom, bool, 0);
/*
- * Compile messages for dynamic enable/disable
+ * tunipip6 global context.
*/
-#define nss_tunipip6_warning(s, ...) pr_debug("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__)
-#define nss_tunipip6_info(s, ...) pr_debug("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__)
-#define nss_tunipip6_trace(s, ...) pr_debug("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__)
-#else
+struct nss_tunipip6_context tunipip6_ctx;
/*
- * Statically compile messages at different levels
+ * nss_tunipip6_alloc_instance()
+ * Allocate tunipip6 interface instance.
*/
-#if (NSS_TUNIPIP6_DEBUG_LEVEL < 2)
-#define nss_tunipip6_warning(s, ...)
-#else
-#define nss_tunipip6_warning(s, ...) pr_warn("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__)
-#endif
+static struct nss_tunipip6_instance *nss_tunipip6_alloc_instance(struct net_device *dev,
+ int inner_ifnum,
+ int outer_ifnum)
+{
+ struct nss_tunipip6_instance*ntii;
-#if (NSS_TUNIPIP6_DEBUG_LEVEL < 3)
-#define nss_tunipip6_info(s, ...)
-#else
-#define nss_tunipip6_info(s, ...) pr_notice("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__)
-#endif
+ ntii = vzalloc(sizeof(*ntii));
+ if (!ntii) {
+ nss_tunipip6_warning("%px: Not able to allocate tunipip6 instance\n", dev);
+ return NULL;
+ }
-#if (NSS_TUNIPIP6_DEBUG_LEVEL < 4)
-#define nss_tunipip6_trace(s, ...)
-#else
-#define nss_tunipip6_trace(s, ...) pr_info("%s[%d]:" s, __func__, __LINE__, ##__VA_ARGS__)
-#endif
-#endif
+ ntii->dev = dev;
+
+ /*
+ * Create statistics dentry.
+ */
+ if (!nss_tunipip6_stats_dentry_create(ntii)) {
+ vfree(ntii);
+ nss_tunipip6_warning("%px: Not able to create tunipip6 statistics dentry\n", dev);
+ return NULL;
+ }
+
+ INIT_LIST_HEAD(&ntii->list);
+ ntii->inner_ifnum = inner_ifnum;
+ ntii->outer_ifnum = outer_ifnum;
+ dev_hold(dev);
+ return ntii;
+}
/*
- * Frag Id update is disabled by default
+ * nss_tunipip6_free_instance()
+ * Delete the tunipip6 interface instance from the list and free it.
+ *
+ * Note: tunnel list lock is expected to be held by the caller.
*/
-bool frag_id_update = false;
+static void nss_tunipip6_free_instance(struct nss_tunipip6_instance *ntii)
+{
+ if (!list_empty(&ntii->list)) {
+ list_del(&ntii->list);
+ }
+
+ vfree(ntii);
+}
+
/*
- * Creating custom ipip6 interface is disabled by default.
+ * nss_tunipip6_find_instance()
+ * Find tunipip6 interface instance from list.
+ *
+ * Note: tunnel list lock is expected to be held by the caller.
*/
-static bool enable_custom;
-module_param(enable_custom, bool, 0);
+struct nss_tunipip6_instance *nss_tunipip6_find_instance(struct net_device *dev)
+{
+ struct nss_tunipip6_instance *ntii;
+
+ /*
+ * Check if dev instance is in the list
+ */
+ list_for_each_entry(ntii, &tunipip6_ctx.dev_list, list) {
+ if (ntii->dev == dev) {
+ return ntii;
+ }
+ }
+
+ return NULL;
+}
/*
- * tunipip6 stats structure
+ * nss_tunipip6_find_and_free_instance()
+ * Find and free the tunipip6 instance.
*/
-struct nss_tunipip6_stats {
- uint32_t rx_packets; /* Number of received packets */
- uint32_t rx_bytes; /* Number of received bytes */
- uint32_t tx_packets; /* Number of transmitted packets */
- uint32_t tx_bytes; /* Number of transmitted bytes */
-};
+static enum nss_connmgr_tunipip6_err_codes nss_tunipip6_find_and_free_instance(struct net_device *netdev)
+{
+ struct dentry *dentry;
+ struct nss_tunipip6_instance *ntii;
+
+ spin_lock_bh(&tunipip6_ctx.lock);
+ ntii = nss_tunipip6_find_instance(netdev);
+ if (!ntii) {
+ spin_unlock_bh(&tunipip6_ctx.lock);
+ nss_tunipip6_warning("%px: Not able to find tunipip6 instance for dev:%s\n", netdev, netdev->name);
+ return NSS_CONNMGR_TUNIPIP6_CONTEXT_FAILURE;
+ }
+
+ dentry = ntii->dentry;
+ nss_tunipip6_free_instance(ntii);
+ spin_unlock_bh(&tunipip6_ctx.lock);
+ debugfs_remove(dentry);
+ dev_put(netdev);
+ return NSS_CONNMGR_TUNIPIP6_SUCCESS;
+}
/*
* nss_tunipip6_encap_exception()
@@ -289,20 +340,29 @@ static void nss_tunipip6_decap_exception(struct net_device *dev, struct sk_buff
/*
* nss_tunipip6_update_dev_stats
- * Update the Dev stats received from NetAp
+ * Update the Dev stats received from NSS
*/
static void nss_tunipip6_update_dev_stats(struct net_device *dev,
- struct nss_tunipip6_stats_sync_msg *sync_stats)
+ struct nss_tunipip6_msg *tnlmsg)
{
struct pcpu_sw_netstats stats;
+ enum nss_dynamic_interface_type interface_type;
+ struct nss_tunipip6_stats_sync_msg *sync_stats = (struct nss_tunipip6_stats_sync_msg *)&tnlmsg->msg.stats_sync;
+
+ interface_type = nss_dynamic_interface_get_type(nss_tunipip6_get_context(), tnlmsg->cm.interface);
+
+ memset(&stats, 0, sizeof(stats));
+ if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_INNER) {
+ stats.tx_packets = sync_stats->node_stats.tx_packets;
+ stats.tx_bytes = sync_stats->node_stats.tx_bytes;
+ } else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_OUTER) {
+ stats.rx_packets = sync_stats->node_stats.rx_packets;
+ stats.rx_bytes = sync_stats->node_stats.rx_bytes;
+ } else {
+ nss_tunipip6_warning("%px: Invalid interface type received from NSS\n", dev);
+ return;
+ }
- u64_stats_init(&stats.syncp);
- u64_stats_update_begin(&stats.syncp);
- stats.rx_packets = sync_stats->node_stats.rx_packets;
- stats.rx_bytes = sync_stats->node_stats.rx_bytes;
- stats.tx_packets = sync_stats->node_stats.tx_packets;
- stats.tx_bytes = sync_stats->node_stats.tx_bytes;
- u64_stats_update_end(&stats.syncp);
dev->stats.rx_dropped += nss_cmn_rx_dropped_sum(&sync_stats->node_stats);
/* TODO: Update rx_dropped stats in ip6_update_offload_stats() */
@@ -316,11 +376,20 @@ static void nss_tunipip6_update_dev_stats(struct net_device *dev,
void nss_tunipip6_event_receive(void *if_ctx, struct nss_tunipip6_msg *tnlmsg)
{
struct net_device *netdev = NULL;
+
netdev = (struct net_device *)if_ctx;
switch (tnlmsg->cm.type) {
case NSS_TUNIPIP6_RX_STATS_SYNC:
- nss_tunipip6_update_dev_stats(netdev, (struct nss_tunipip6_stats_sync_msg *)&tnlmsg->msg.stats_sync);
+ /*
+ * Update netdevice statistics.
+ */
+ nss_tunipip6_update_dev_stats(netdev, tnlmsg);
+
+ /*
+ * Update NSS statistics for tunipip6.
+ */
+ nss_tunipip6_stats_sync(netdev, tnlmsg);
break;
default:
@@ -415,7 +484,7 @@ static void nss_tunipip6_dev_parse_param(struct net_device *netdev, struct nss_c
tnlcfg->ttl_inherit = false;
tnlcfg->tos_inherit = true;
tnlcfg->frag_id_update = frag_id_update;
-
+ tnlcfg->fmr_max = NSS_TUNIPIP6_MAX_FMR;
/*
* Flow Label In kernel is stored in big endian format.
*/
@@ -454,9 +523,9 @@ static void nss_connmgr_tunipip6_configure_fmr(struct net_device *netdev)
tunnel = (struct ip6_tnl *)netdev_priv(netdev);
/*
- * Configure FMR table up to NSS_TUNIPIP6_MAX_FMR_NUMBER, the rest will be forwarded to BR
+ * Configure FMR table up to NSS_TUNIPIP6_MAX_FMR, the rest will be forwarded to BR
*/
- for (fmr = tunnel->parms.fmrs; fmr && fmr_number < NSS_TUNIPIP6_MAX_FMR_NUMBER; fmr = fmr->next, fmr_number++) {
+ for (fmr = tunnel->parms.fmrs; fmr && fmr_number < NSS_TUNIPIP6_MAX_FMR; fmr = fmr->next, fmr_number++) {
/*
* Prepare "rulecfg"
*/
@@ -497,6 +566,7 @@ enum nss_connmgr_tunipip6_err_codes nss_connmgr_tunipip6_create_interface(struct
int inner_ifnum, outer_ifnum;
uint32_t features = 0;
nss_tx_status_t status;
+ struct nss_tunipip6_instance *ntii;
#if IS_ENABLED(CONFIG_MAP_E_SUPPORT)
#ifndef DRAFT03_SUPPORT
@@ -626,7 +696,7 @@ configure_tunnel:
status = nss_tunipip6_tx_sync(nss_ctx, &tnlmsg);
if (status != NSS_TX_SUCCESS) {
nss_tunipip6_warning("%px: Tunnel up command error %d\n", netdev, status);
- goto config_fail;
+ goto context_alloc_fail;
}
/*
@@ -644,12 +714,28 @@ configure_tunnel:
status = nss_tunipip6_tx_sync(nss_ctx, &tnlmsg);
if (status != NSS_TX_SUCCESS) {
nss_tunipip6_warning("%px: Tunnel up command error %d\n", netdev, status);
- goto config_fail;
+ goto context_alloc_fail;
}
+ /*
+ * Initialize tunipip6 instance.
+ */
+ ntii = nss_tunipip6_alloc_instance(netdev, inner_ifnum, outer_ifnum);
+ if (!ntii) {
+ nss_tunipip6_warning("%px: Not able to create tunipip6 instance\n", netdev);
+ goto context_alloc_fail;
+ }
+
+ /*
+ * Add the new tunipip6 instance to the global list.
+ */
+ spin_lock_bh(&tunipip6_ctx.lock);
+ list_add(&ntii->list, &tunipip6_ctx.dev_list);
+ spin_unlock_bh(&tunipip6_ctx.lock);
+
return NSS_CONNMGR_TUNIPIP6_SUCCESS;
-config_fail:
+context_alloc_fail:
nss_unregister_tunipip6_if(outer_ifnum);
outer_reg_fail:
nss_unregister_tunipip6_if(inner_ifnum);
@@ -675,6 +761,8 @@ EXPORT_SYMBOL(nss_connmgr_tunipip6_create_interface);
*/
enum nss_connmgr_tunipip6_err_codes nss_connmgr_tunipip6_destroy_interface(struct net_device *netdev)
{
+ enum nss_connmgr_tunipip6_err_codes ret;
+
/*
* Validate netdev for ipv6-in-ipv4 Tunnel
*/
@@ -682,7 +770,20 @@ enum nss_connmgr_tunipip6_err_codes nss_connmgr_tunipip6_destroy_interface(struc
return NSS_CONNMGR_TUNIPIP6_NETDEV_TYPE_FAILURE;
}
- return _nss_tunipip6_dyn_interface_destroy(netdev);
+ /*
+ * Destroy tunipip6 NSS context.
+ */
+ ret = _nss_tunipip6_dyn_interface_destroy(netdev);
+ if (ret != NSS_CONNMGR_TUNIPIP6_SUCCESS) {
+ nss_tunipip6_warning("%px: Not able to destroy NSS context. Err: %d\n", netdev, ret);
+ return ret;
+ }
+
+ /*
+ * Find and free the tunipip6 instance.
+ */
+ ret = nss_tunipip6_find_and_free_instance(netdev);
+ return ret;
}
EXPORT_SYMBOL(nss_connmgr_tunipip6_destroy_interface);
@@ -940,6 +1041,39 @@ static int nss_tunipip6_dev_event(struct notifier_block *nb,
return NOTIFY_DONE;
}
+/*
+ * nss_tunipip6_destroy_interface_all()
+ * Destroy NSS interfaces and free instance for all tunipip6 interfaces.
+ */
+static void nss_tunipip6_destroy_interface_all(void)
+{
+ struct net_device *netdev;
+ struct dentry *dentry;
+ struct nss_tunipip6_instance *ntii;
+
+ spin_lock_bh(&tunipip6_ctx.lock);
+ ntii = list_first_entry_or_null(&tunipip6_ctx.dev_list, struct nss_tunipip6_instance, list);
+ do {
+ if (!ntii) {
+ spin_unlock_bh(&tunipip6_ctx.lock);
+ return;
+ }
+
+ netdev = ntii->dev;
+ dentry = ntii->dentry;
+ nss_tunipip6_free_instance(ntii);
+ spin_unlock_bh(&tunipip6_ctx.lock);
+
+ dev_put(netdev);
+ debugfs_remove(dentry);
+ _nss_tunipip6_dyn_interface_destroy(netdev);
+
+ spin_lock_bh(&tunipip6_ctx.lock);
+ ntii = list_first_entry_or_null(&tunipip6_ctx.dev_list, struct nss_tunipip6_instance, list);
+ } while (ntii);
+ spin_unlock_bh(&tunipip6_ctx.lock);
+}
+
/*
* Linux Net device Notifier
*/
@@ -964,6 +1098,20 @@ int __init nss_tunipip6_init_module(void)
nss_tunipip6_info("module (platform - IPQ806x , %s) loaded\n",
NSS_CLIENT_BUILD_ID);
+ /*
+ * Initialize lock and dev list.
+ */
+ INIT_LIST_HEAD(&tunipip6_ctx.dev_list);
+ spin_lock_init(&tunipip6_ctx.lock);
+
+ /*
+ * Create the debugfs directory for statistics.
+ */
+ if (!nss_tunipip6_stats_dentry_init()) {
+ nss_tunipip6_trace("Failed to initialize debugfs\n");
+ return -1;
+ }
+
/*
* Do not register net device notification for
* custom tunnel. Net device notification is used only
@@ -999,6 +1147,16 @@ void __exit nss_tunipip6_exit_module(void)
}
#endif
+ /*
+ * Free Host and NSS tunipip6 instances.
+ */
+ nss_tunipip6_destroy_interface_all();
+
+ /*
+ * De-initialize debugfs.
+ */
+ nss_tunipip6_stats_dentry_deinit();
+
/*
* Unregister net device notification for standard tunnel.
*/
diff --git a/tunipip6/nss_connmgr_tunipip6_priv.h b/tunipip6/nss_connmgr_tunipip6_priv.h
new file mode 100644
index 0000000..3893038
--- /dev/null
+++ b/tunipip6/nss_connmgr_tunipip6_priv.h
@@ -0,0 +1,94 @@
@ -550,9 +95,6 @@ index 0000000..3893038
+struct nss_tunipip6_instance *nss_tunipip6_find_instance(struct net_device *dev);
+
+#endif /* __NSS_CONNMGR_TUNIPIP6_PRIV_H_ */
diff --git a/tunipip6/nss_connmgr_tunipip6_stats.c b/tunipip6/nss_connmgr_tunipip6_stats.c
new file mode 100644
index 0000000..0843300
--- /dev/null
+++ b/tunipip6/nss_connmgr_tunipip6_stats.c
@@ -0,0 +1,225 @@
@ -781,9 +323,6 @@ index 0000000..0843300
+
+ return true;
+}
diff --git a/tunipip6/nss_connmgr_tunipip6_stats.h b/tunipip6/nss_connmgr_tunipip6_stats.h
new file mode 100644
index 0000000..bbe7311
--- /dev/null
+++ b/tunipip6/nss_connmgr_tunipip6_stats.h
@@ -0,0 +1,73 @@
@ -860,65 +399,3 @@ index 0000000..bbe7311
+extern bool nss_tunipip6_stats_dentry_create(struct nss_tunipip6_instance *tun_inst);
+
+#endif /* _NSS_CONNMGR_TUNIPIP6_STATS_H_ */
diff --git a/tunipip6/nss_connmgr_tunipip6_sysctl.c b/tunipip6/nss_connmgr_tunipip6_sysctl.c
index fed8d81..3632d62 100644
--- a/tunipip6/nss_connmgr_tunipip6_sysctl.c
+++ b/tunipip6/nss_connmgr_tunipip6_sysctl.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -61,7 +61,7 @@ static int nss_tunipip6_data_parser(struct ctl_table *ctl, int write, void __use
bool ipv4_prefix_valid = false, ipv4_prefix_len_valid = false, ipv6_suffix_len_valid = false;
bool rule_type_valid = false, ea_len_valid = false, psid_offset_valid = false, netdev_valid = false;
struct nss_connmgr_tunipip6_maprule_cfg mrcfg = {0};
- char *buf = kzalloc(MAX_PROC_SIZE, GFP_KERNEL);
+ char *buf;
enum nss_connmgr_tunipip6_err_codes status;
struct net_device *dev = NULL;
char *pfree;
@@ -69,7 +69,11 @@ static int nss_tunipip6_data_parser(struct ctl_table *ctl, int write, void __use
int ret;
int count;
+ if (!write) {
+ return -EINVAL;
+ }
+ buf = kzalloc(MAX_PROC_SIZE, GFP_KERNEL);
if (!buf) {
return -ENOMEM;
}
@@ -122,6 +126,7 @@ static int nss_tunipip6_data_parser(struct ctl_table *ctl, int write, void __use
if ((rule_type !=NSS_CONNMGR_TUNIPIP6_RULE_BMR) &&
(rule_type != NSS_CONNMGR_TUNIPIP6_RULE_FMR)) {
+ kfree(pfree);
goto fail;
}
rule_type_valid = true;
@@ -135,6 +140,7 @@ static int nss_tunipip6_data_parser(struct ctl_table *ctl, int write, void __use
}
if (frag_id != 0 && frag_id != 1) {
+ kfree(pfree);
goto fail;
}
continue;
@@ -396,9 +402,9 @@ static int nss_tunipip6_cmd_procfs_read_help(struct ctl_table *ctl, int write, v
b. To delete maprule(BMR):\n\
echo dev=<map-mape/MAP-E netdevice> rule_type=<1> > remove_map_rule\n\
3. To flush FMR entries:\n\
- echo dev=<map-mape/MAP-E netdevice> > flush_fmr_rule\n\
- 4. To enable/disable frag id:\n\
- echo frag_id_update=<0/1> > frag_id\n\
+ echo dev=<map-mape/MAP-E netdevice> > flush_fmr_rule\n");
+ pr_info("\t\t\t4. To enable/disable frag id: \n\
+ echo frag_id_update=<0/1> > frag_id \n\
=====end of help=====\n");
*lenp = 0;
return ret;

View File

@ -1,96 +0,0 @@
diff --git a/match/nss_match_l2.c b/match/nss_match_l2.c
index a415fbc..5f54cef 100644
--- a/match/nss_match_l2.c
+++ b/match/nss_match_l2.c
@@ -1,6 +1,7 @@
/*
*******************************************************************************
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -133,7 +134,7 @@ static int nss_match_l2_cmd_parse(char *input_msg, struct nss_match_msg *rule_ms
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
int ret = 0;
uint32_t mask_val[4] = {0};
- uint32_t actions = 0, if_num = 0, setprio = 0, nexthop = 0;
+ uint32_t actions = 0, if_num = 0, setprio = NSS_MAX_NUM_PRI, nexthop = 0;
uint16_t smac[3] = {0}, dmac[3] = {0}, mask_id = 0, ethertype = 0;
uint8_t mac_addr_tmp[6];
char tmp[4];
@@ -340,22 +341,22 @@ static int nss_match_l2_cmd_parse(char *input_msg, struct nss_match_msg *rule_ms
switch(actions) {
case NSS_MATCH_ACTION_SETPRIO:
- if (nexthop || !setprio || setprio >= NSS_MAX_NUM_PRI) {
+ if (nexthop || setprio >= NSS_MAX_NUM_PRI) {
goto fail;
}
break;
case NSS_MATCH_ACTION_FORWARD:
- if (setprio || !nexthop) {
+ if (!(setprio == NSS_MAX_NUM_PRI) || !nexthop) {
goto fail;
}
break;
case NSS_MATCH_ACTION_SETPRIO | NSS_MATCH_ACTION_FORWARD:
- if (!setprio || !nexthop || setprio >= NSS_MAX_NUM_PRI) {
+ if (!nexthop || setprio >= NSS_MAX_NUM_PRI) {
goto fail;
}
break;
case NSS_MATCH_ACTION_DROP:
- if (setprio || nexthop) {
+ if (!(setprio == NSS_MAX_NUM_PRI) || nexthop) {
goto fail;
}
break;
diff --git a/match/nss_match_vow.c b/match/nss_match_vow.c
index cc395a9..2d27bd3 100644
--- a/match/nss_match_vow.c
+++ b/match/nss_match_vow.c
@@ -1,6 +1,6 @@
/*
*******************************************************************************
- * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -122,7 +122,7 @@ static int nss_match_vow_cmd_parse(char *input_msg, struct nss_match_msg *rule_m
char *token, *param, *value;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
int ret = 0;
- uint32_t actions = 0, if_num = 0, dscp = 0, outer_prio = 0, inner_prio = 0, setprio = 0, nexthop = 0;
+ uint32_t actions = 0, if_num = 0, dscp = 0, outer_prio = 0, inner_prio = 0, setprio = NSS_MAX_NUM_PRI, nexthop = 0;
uint16_t mask_id = 0;
uint32_t mask_val = 0;
@@ -301,22 +301,22 @@ static int nss_match_vow_cmd_parse(char *input_msg, struct nss_match_msg *rule_m
switch(actions) {
case NSS_MATCH_ACTION_SETPRIO:
- if (nexthop || !setprio || setprio >= NSS_MAX_NUM_PRI) {
+ if (nexthop || setprio >= NSS_MAX_NUM_PRI) {
goto fail;
}
break;
case NSS_MATCH_ACTION_FORWARD:
- if (setprio || !nexthop) {
+ if (!(setprio == NSS_MAX_NUM_PRI) || !nexthop) {
goto fail;
}
break;
case NSS_MATCH_ACTION_SETPRIO | NSS_MATCH_ACTION_FORWARD:
- if (!setprio || !nexthop || setprio >= NSS_MAX_NUM_PRI) {
+ if (!nexthop || setprio >= NSS_MAX_NUM_PRI) {
goto fail;
}
break;
case NSS_MATCH_ACTION_DROP:
- if (setprio || nexthop) {
+ if (!(setprio == NSS_MAX_NUM_PRI) || nexthop) {
goto fail;
}
break;

View File

@ -0,0 +1,245 @@
--- a/pppoe/Makefile
+++ b/pppoe/Makefile
@@ -1,6 +1,10 @@
# Makefile for pppoe client
ccflags-y += -I$(obj)/../exports -I$(obj)/.. -I$(obj)/nss_hal/include
ccflags-y += -DNSS_PPPOE_DEBUG_LEVEL=0
-ccflags-y += -Werror
+ccflags-y += -Wall -Werror
obj-m += qca-nss-pppoe.o
qca-nss-pppoe-objs := nss_connmgr_pppoe.o
+
+ifneq (,$(filter $(CONFIG_BONDING),y m))
+ccflags-y += -DBONDING_SUPPORT
+endif
--- a/pppoe/nss_connmgr_pppoe.c
+++ b/pppoe/nss_connmgr_pppoe.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -28,6 +28,7 @@
#include <linux/if_pppox.h>
#include <net/ip.h>
#include <linux/if_bridge.h>
+#include <net/bonding.h>
#ifdef CONFIG_OF
#include <linux/of.h>
#endif
@@ -50,25 +51,29 @@ static int nss_connmgr_pppoe_get_session
int ppp_ch_count;
if (ppp_is_multilink(dev)) {
- nss_connmgr_pppoe_warn("%p: channel is multilink PPP\n", dev);
+ nss_connmgr_pppoe_warn("%px: channel is multilink PPP\n", dev);
return -1;
}
ppp_ch_count = ppp_hold_channels(dev, channel, 1);
- nss_connmgr_pppoe_info("%p: PPP hold channel ret %d\n", dev, ppp_ch_count);
+ nss_connmgr_pppoe_info("%px: PPP hold channel ret %d\n", dev, ppp_ch_count);
if (ppp_ch_count != 1) {
- nss_connmgr_pppoe_warn("%p: hold channel for netdevice failed\n", dev);
+ nss_connmgr_pppoe_warn("%px: hold channel for netdevice failed\n", dev);
return -1;
}
px_proto = ppp_channel_get_protocol(channel[0]);
if (px_proto != PX_PROTO_OE) {
- nss_connmgr_pppoe_warn("%p: session socket is not of type PX_PROTO_OE\n", dev);
+ nss_connmgr_pppoe_warn("%px: session socket is not of type PX_PROTO_OE\n", dev);
ppp_release_channels(channel, 1);
return -1;
}
- pppoe_channel_addressing_get(channel[0], addressing);
+ if (pppoe_channel_addressing_get(channel[0], addressing)) {
+ nss_connmgr_pppoe_warn("%px: failed to get addressing information\n", dev);
+ ppp_release_channels(channel, 1);
+ return -1;
+ }
dev_put(addressing->dev);
ppp_release_channels(channel, 1);
@@ -88,7 +93,7 @@ static struct nss_connmgr_pppoe_session_
entry = kmalloc(sizeof(struct nss_connmgr_pppoe_session_entry),
GFP_KERNEL);
if (!entry) {
- nss_connmgr_pppoe_warn("%p: failed to allocate pppoe session entry\n", dev);
+ nss_connmgr_pppoe_warn("%px: failed to allocate pppoe session entry\n", dev);
return NULL;
}
@@ -101,7 +106,7 @@ static struct nss_connmgr_pppoe_session_
ether_addr_copy(info->server_mac, opt->pa.remote);
ether_addr_copy(info->local_mac, opt->dev->dev_addr);
- nss_connmgr_pppoe_info("%p: Added PPPoE session with session_id=%u server_mac=%pM local_mac %pM\n",
+ nss_connmgr_pppoe_info("%px: Added PPPoE session with session_id=%u server_mac=%pM local_mac %pM\n",
dev, info->session_id, info->server_mac, info->local_mac);
entry->dev = dev;
@@ -144,7 +149,7 @@ static int nss_connmgr_pppoe_disconnect(
*/
if_number = nss_cmn_get_interface_number_by_dev(dev);
if (if_number < 0) {
- nss_connmgr_pppoe_warn("%p: Net device is not registered with nss\n", dev);
+ nss_connmgr_pppoe_warn("%px: Net device is not registered with nss\n", dev);
return NOTIFY_DONE;
}
@@ -161,7 +166,7 @@ static int nss_connmgr_pppoe_disconnect(
}
if (!found) {
- nss_connmgr_pppoe_warn("%p: PPPoE session is not found for device: %s\n", dev, dev->name);
+ nss_connmgr_pppoe_warn("%px: PPPoE session is not found for device: %s\n", dev, dev->name);
return NOTIFY_DONE;
}
@@ -177,15 +182,15 @@ static int nss_connmgr_pppoe_disconnect(
nss_pppoe_msg_init(&npm, if_number, NSS_PPPOE_MSG_SESSION_DESTROY, sizeof(struct nss_pppoe_destroy_msg), NULL, NULL);
status = nss_pppoe_tx_msg_sync(nss_pppoe_get_context(), &npm);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pppoe_warn("%p: pppoe session destroy command failed, if_number = %d\n", dev, if_number);
+ nss_connmgr_pppoe_warn("%px: pppoe session destroy command failed, if_number = %d\n", dev, if_number);
goto done;
}
nss_unregister_pppoe_session_if(if_number);
status = nss_dynamic_interface_dealloc_node(if_number, NSS_DYNAMIC_INTERFACE_TYPE_PPPOE);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pppoe_warn("%p: pppoe dealloc node failure for if_number=%d\n", dev, if_number);
+ nss_connmgr_pppoe_warn("%px: pppoe dealloc node failure for if_number=%d\n", dev, if_number);
} else {
- nss_connmgr_pppoe_info("%p: PPPoE session is destroyed with if_number %d, session_id %d, server_mac %pM, local_mac %pM\n",
+ nss_connmgr_pppoe_info("%px: PPPoE session is destroyed with if_number %d, session_id %d, server_mac %pM, local_mac %pM\n",
dev, if_number, entry->info.session_id,
entry->info.server_mac, entry->info.local_mac);
}
@@ -223,13 +228,13 @@ static int nss_connmgr_pppoe_connect(str
*/
if_number = nss_cmn_get_interface_number_by_dev(dev);
if (if_number >= 0) {
- nss_connmgr_pppoe_warn("%p: Net device is already registered with nss\n", dev);
+ nss_connmgr_pppoe_warn("%px: Net device is already registered with nss\n", dev);
return NOTIFY_DONE;
}
ret = nss_connmgr_pppoe_get_session(dev, &opt);
if (ret < 0) {
- nss_connmgr_pppoe_warn("%p: Unable to get pppoe session from the netdev\n", dev);
+ nss_connmgr_pppoe_warn("%px: Unable to get pppoe session from the netdev\n", dev);
return NOTIFY_DONE;
}
@@ -238,20 +243,20 @@ static int nss_connmgr_pppoe_connect(str
*/
if_number = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_PPPOE);
if (if_number == -1) {
- nss_connmgr_pppoe_warn("%p: Request interface number failed\n", dev);
+ nss_connmgr_pppoe_warn("%px: Request interface number failed\n", dev);
return NOTIFY_DONE;
}
if (!nss_is_dynamic_interface(if_number)) {
- nss_connmgr_pppoe_warn("%p: Invalid NSS dynamic I/F number %d\n", dev, if_number);
+ nss_connmgr_pppoe_warn("%px: Invalid NSS dynamic I/F number %d\n", dev, if_number);
goto connect_fail1;
}
- nss_connmgr_pppoe_info("%p: PPPoE dynamic interface allocation is successful with if_number %d\n", dev, if_number);
+ nss_connmgr_pppoe_info("%px: PPPoE dynamic interface allocation is successful with if_number %d\n", dev, if_number);
entry = nss_connmgr_add_pppoe_session(dev, &opt);
if (!entry) {
- nss_connmgr_pppoe_warn("%p: PPPoE session add failed %d\n", dev, if_number);
+ nss_connmgr_pppoe_warn("%px: PPPoE session add failed %d\n", dev, if_number);
goto connect_fail1;
}
@@ -264,12 +269,11 @@ static int nss_connmgr_pppoe_connect(str
features,
entry);
if (!nss_ctx) {
- nss_connmgr_pppoe_warn("%p: nss_register_pppoe_session_if failed\n", dev);
+ nss_connmgr_pppoe_warn("%px: nss_register_pppoe_session_if failed\n", dev);
goto connect_fail2;
}
- nss_connmgr_pppoe_info("%p: PPPoE session interface registration is successful\n", nss_ctx);
-
+ nss_connmgr_pppoe_info("%px: PPPoE session interface registration is successful\n", nss_ctx);
memset(&npm, 0, sizeof(struct nss_pppoe_msg));
npm_create = &npm.msg.create;
@@ -282,11 +286,11 @@ static int nss_connmgr_pppoe_connect(str
*/
if (netif_is_bond_master(opt.dev)) {
int32_t bondid = -1;
-#if IS_ENABLED(CONFIG_BONDING)
+#if defined(BONDING_SUPPORT)
bondid = bond_get_id(opt.dev);
#endif
if (bondid < 0) {
- nss_connmgr_pppoe_warn("%p: Invalid LAG group id 0x%x\n", dev, bondid);
+ nss_connmgr_pppoe_warn("%px: Invalid LAG group id 0x%x\n", dev, bondid);
goto connect_fail3;
}
npm_create->base_if_num = bondid + NSS_LAG0_INTERFACE_NUM;
@@ -298,7 +302,7 @@ static int nss_connmgr_pppoe_connect(str
*/
struct net_device *port = br_port_dev_get(opt.dev, info->server_mac, NULL, 0);
if (!port) {
- nss_connmgr_pppoe_warn("%p: Unable to get the bridge port device from the bridge interface: %s\n",
+ nss_connmgr_pppoe_warn("%px: Unable to get the bridge port device from the bridge interface: %s\n",
dev, opt.dev->name);
goto connect_fail3;
}
@@ -327,20 +331,20 @@ static int nss_connmgr_pppoe_connect(str
ether_addr_copy(npm_create->local_mac, info->local_mac);
npm_create->mtu = dev->mtu;
- nss_connmgr_pppoe_info("%p: pppoe info\n", dev);
- nss_connmgr_pppoe_info("%p: session_id %d server_mac %pM local_mac %pM base_if %s (%d)\n",
+ nss_connmgr_pppoe_info("%px: pppoe info\n", dev);
+ nss_connmgr_pppoe_info("%px: session_id %d server_mac %pM local_mac %pM base_if %s (%d)\n",
dev, npm_create->session_id,
npm_create->server_mac, npm_create->local_mac, opt.dev->name, npm_create->base_if_num);
- nss_connmgr_pppoe_info("%p: Sending pppoe session create command to NSS\n", dev);
+ nss_connmgr_pppoe_info("%px: Sending pppoe session create command to NSS\n", dev);
nss_pppoe_msg_init(&npm, if_number, NSS_PPPOE_MSG_SESSION_CREATE, sizeof(struct nss_pppoe_create_msg), NULL, NULL);
status = nss_pppoe_tx_msg_sync(nss_ctx, &npm);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pppoe_warn("%p: nss pppoe session creation command error %d\n", dev, status);
+ nss_connmgr_pppoe_warn("%px: nss pppoe session creation command error %d\n", dev, status);
goto connect_fail3;
}
- nss_connmgr_pppoe_info("%p: PPPoE session creation is successful\n", dev);
+ nss_connmgr_pppoe_info("%px: PPPoE session creation is successful\n", dev);
return NOTIFY_DONE;
@@ -355,7 +359,7 @@ connect_fail2:
connect_fail1:
status = nss_dynamic_interface_dealloc_node(if_number, NSS_DYNAMIC_INTERFACE_TYPE_PPPOE);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pppoe_warn("%p: Unable to dealloc the node[%d] in the NSS fw!\n", dev, if_number);
+ nss_connmgr_pppoe_warn("%px: Unable to dealloc the node[%d] in the NSS fw!\n", dev, if_number);
}
return NOTIFY_DONE;
@@ -377,7 +381,7 @@ static int nss_connmgr_pppoe_channel_not
case PPP_CHANNEL_DISCONNECT:
return nss_connmgr_pppoe_disconnect(dev);
default:
- nss_connmgr_pppoe_info("%p: Unhandled channel event: %lu\n", dev, event);
+ nss_connmgr_pppoe_info("%px: Unhandled channel event: %lu\n", dev, event);
break;
}

View File

@ -0,0 +1,479 @@
--- a/pptp/Makefile
+++ b/pptp/Makefile
@@ -1,6 +1,6 @@
# Makefile for pptp client
ccflags-y += -I$(obj)/../exports -I$(obj)/.. -I$(obj)/nss_hal/include
ccflags-y += -DNSS_PPTP_DEBUG_LEVEL=0
-ccflags-y += -Werror
+ccflags-y += -Wall -Werror
obj-m += qca-nss-pptp.o
qca-nss-pptp-objs := nss_connmgr_pptp.o
--- a/pptp/nss_connmgr_pptp.c
+++ b/pptp/nss_connmgr_pptp.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2018, 2020, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -99,13 +99,13 @@ static int nss_connmgr_pptp_client_xmit(
*/
host_inner_if = nss_cmn_get_interface_number_by_dev_and_type(dev, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER);
if (host_inner_if < 0) {
- nss_connmgr_pptp_warning("%p: Net device is not registered\n", dev);
+ nss_connmgr_pptp_warning("%px: Net device is not registered\n", dev);
return -1;
}
nss_pptp_ctx = nss_pptp_get_context();
if (!nss_pptp_ctx) {
- nss_connmgr_pptp_warning("%p: NSS PPTP context not found for if_number %d\n", dev, host_inner_if);
+ nss_connmgr_pptp_warning("%px: NSS PPTP context not found for if_number %d\n", dev, host_inner_if);
return -1;
}
@@ -121,11 +121,11 @@ static int nss_connmgr_pptp_client_xmit(
* Found a match for a session and successfully posted
* packet to firmware. Retrun success.
*/
- nss_connmgr_pptp_info("%p: NSS FW tx success if_number %d\n", dev, host_inner_if);
+ nss_connmgr_pptp_info("%px: NSS FW tx success if_number %d\n", dev, host_inner_if);
return 0;
}
- nss_connmgr_pptp_info("%p: NSS FW tx failed if_number %d\n", dev, host_inner_if);
+ nss_connmgr_pptp_info("%px: NSS FW tx failed if_number %d\n", dev, host_inner_if);
return -1;
}
@@ -146,31 +146,36 @@ static int nss_connmgr_pptp_get_session(
/*
* check whether the interface is of type PPP
*/
- if (dev->type != ARPHRD_PPP || !(dev->priv_flags & IFF_PPP_PPTP)) {
- nss_connmgr_pptp_info("%p: netdevice is not a PPP tunnel type\n", dev);
+ if (dev->type != ARPHRD_PPP || !(dev->priv_flags_ext & IFF_EXT_PPP_PPTP)) {
+ nss_connmgr_pptp_info("%px: netdevice is not a PPP tunnel type\n", dev);
return -1;
}
if (ppp_is_multilink(dev)) {
- nss_connmgr_pptp_warning("%p: channel is multilink PPP\n", dev);
+ nss_connmgr_pptp_warning("%px: channel is multilink PPP\n", dev);
+ return -1;
+ }
+
+ if (ppp_is_cp_enabled(dev)) {
+ nss_connmgr_pptp_warning("%px: rx or tx compression is enabled for PPP\n", dev);
return -1;
}
ppp_ch_count = ppp_hold_channels(dev, channel, 1);
- nss_connmgr_pptp_info("%p: PPP hold channel ret %d\n", dev, ppp_ch_count);
+ nss_connmgr_pptp_info("%px: PPP hold channel ret %d\n", dev, ppp_ch_count);
if (ppp_ch_count != 1) {
- nss_connmgr_pptp_warning("%p: hold channel for netdevice failed\n", dev);
+ nss_connmgr_pptp_warning("%px: hold channel for netdevice failed\n", dev);
return -1;
}
if (!channel[0]) {
- nss_connmgr_pptp_warning("%p: channel don't have a ppp_channel\n", dev);
+ nss_connmgr_pptp_warning("%px: channel don't have a ppp_channel\n", dev);
return -1;
}
px_proto = ppp_channel_get_protocol(channel[0]);
if (px_proto != PX_PROTO_PPTP) {
- nss_connmgr_pptp_warning("%p: session socket is not of type PX_PROTO_PPTP\n", dev);
+ nss_connmgr_pptp_warning("%px: session socket is not of type PX_PROTO_PPTP\n", dev);
ppp_release_channels(channel, 1);
return -1;
}
@@ -195,7 +200,7 @@ static struct nss_connmgr_pptp_session_e
pptp_session_data = kmalloc(sizeof(struct nss_connmgr_pptp_session_entry),
GFP_KERNEL);
if (!pptp_session_data) {
- nss_connmgr_pptp_warning("%p: failed to allocate pptp_session_data\n", dev);
+ nss_connmgr_pptp_warning("%px: failed to allocate pptp_session_data\n", dev);
return NULL;
}
@@ -209,7 +214,7 @@ static struct nss_connmgr_pptp_session_e
data->src_ip = session->src_addr.sin_addr.s_addr;
data->dst_ip = session->dst_addr.sin_addr.s_addr;
- nss_connmgr_pptp_info("%p: src_call_id=%u peer_call_id=%u\n", dev, data->src_call, data->dst_call);
+ nss_connmgr_pptp_info("%px: src_call_id=%u peer_call_id=%u\n", dev, data->src_call, data->dst_call);
/*
* This netdev hold will be released when netdev
@@ -224,7 +229,7 @@ static struct nss_connmgr_pptp_session_e
*/
physical_dev = ip_dev_find(&init_net, data->src_ip);
if (!physical_dev) {
- nss_connmgr_pptp_warning("%p: couldn't find a phycal dev %s\n", dev, dev->name);
+ nss_connmgr_pptp_warning("%px: couldn't find a phycal dev %s\n", dev, dev->name);
dev_put(dev);
kfree(pptp_session_data);
return NULL;
@@ -261,7 +266,7 @@ static void nss_connmgr_pptp_event_recei
return;
}
- nss_connmgr_pptp_info("%p: Update PPP stats for PPTP netdev %p\n", session_info, netdev);
+ nss_connmgr_pptp_info("%px: Update PPP stats for PPTP netdev %px\n", session_info, netdev);
sync_stats = (struct nss_pptp_sync_session_stats_msg *)&tnlmsg->msg.stats;
dev_hold(netdev);
@@ -284,7 +289,7 @@ static void nss_connmgr_pptp_event_recei
break;
default:
- nss_connmgr_pptp_warning("%p: Unknown Event from NSS\n", session_info);
+ nss_connmgr_pptp_warning("%px: Unknown Event from NSS\n", session_info);
break;
}
}
@@ -332,7 +337,7 @@ static void nss_connmgr_pptp_decap_excep
gre_hdr = (struct nss_pptp_gre_hdr *)skb->data;
if ((ntohs(gre_hdr->protocol) != NSS_PPTP_GRE_PROTO) &&
(gre_hdr->flags_ver == NSS_PPTP_GRE_VER)) {
- nss_connmgr_pptp_warning("%p, Not PPTP_GRE_PROTO, so freeing\n", dev);
+ nss_connmgr_pptp_warning("%px, Not PPTP_GRE_PROTO, so freeing\n", dev);
dev_kfree_skb_any(skb);
return;
}
@@ -346,16 +351,16 @@ static void nss_connmgr_pptp_decap_excep
rt = ip_route_output_ports(&init_net, &fl4, NULL, tunnel_peer_ip,
tunnel_local_ip, 0, 0, IPPROTO_GRE, RT_TOS(0), 0);
if (unlikely(IS_ERR(rt))) {
- nss_connmgr_pptp_warning("%p: Martian packets, drop\n", dev);
- nss_connmgr_pptp_warning("%p: No route or out dev, drop packet...\n", dev);
+ nss_connmgr_pptp_warning("%px: Martian packets, drop\n", dev);
+ nss_connmgr_pptp_warning("%px: No route or out dev, drop packet...\n", dev);
dev_kfree_skb_any(skb);
return;
}
if (likely(rt->dst.dev)) {
- nss_connmgr_pptp_info("%p: dst route dev is %s\n", session_info, rt->dst.dev->name);
+ nss_connmgr_pptp_info("%px: dst route dev is %s\n", session_info, rt->dst.dev->name);
} else {
- nss_connmgr_pptp_warning("%p: No out dev, drop packet...\n", dev);
+ nss_connmgr_pptp_warning("%px: No out dev, drop packet...\n", dev);
dev_kfree_skb_any(skb);
}
@@ -381,7 +386,7 @@ static void nss_connmgr_pptp_decap_excep
}
}
rcu_read_unlock();
- nss_connmgr_pptp_warning("%p: unable to find session for PPTP exception packet from %s, so freeing\n", dev, dev->name);
+ nss_connmgr_pptp_warning("%px: unable to find session for PPTP exception packet from %s, so freeing\n", dev, dev->name);
dev_kfree_skb_any(skb);
}
@@ -421,7 +426,7 @@ static void nss_connmgr_pptp_encap_excep
} else if (iph_outer->version == 6) {
skb->protocol = htons(ETH_P_IPV6);
} else {
- nss_connmgr_pptp_info("%p: pkt may be a control packet\n", dev);
+ nss_connmgr_pptp_info("%px: pkt may be a control packet\n", dev);
}
skb_reset_network_header(skb);
@@ -429,12 +434,12 @@ static void nss_connmgr_pptp_encap_excep
skb->skb_iif = dev->ifindex;
skb->ip_summed = CHECKSUM_NONE;
skb->dev = dev;
- nss_connmgr_pptp_info("%p: send decapsulated packet through network stack", dev);
+ nss_connmgr_pptp_info("%px: send decapsulated packet through network stack", dev);
netif_receive_skb(skb);
return;
}
rcu_read_unlock();
- nss_connmgr_pptp_warning("%p: unable to find session for PPTP exception packet from %s, so freeing\n", dev, dev->name);
+ nss_connmgr_pptp_warning("%px: unable to find session for PPTP exception packet from %s, so freeing\n", dev, dev->name);
dev_kfree_skb_any(skb);
}
@@ -465,40 +470,40 @@ static int nss_connmgr_pptp_dev_up(struc
*/
inner_if = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_PPTP_INNER);
if (inner_if < 0) {
- nss_connmgr_pptp_warning("%p: Request inner interface number failed\n", dev);
+ nss_connmgr_pptp_warning("%px: Request inner interface number failed\n", dev);
return NOTIFY_DONE;
}
if (!nss_is_dynamic_interface(inner_if)) {
- nss_connmgr_pptp_warning("%p: Invalid NSS dynamic I/F number %d\n", dev, inner_if);
+ nss_connmgr_pptp_warning("%px: Invalid NSS dynamic I/F number %d\n", dev, inner_if);
goto inner_fail;
}
outer_if = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_PPTP_OUTER);
if (outer_if < 0) {
- nss_connmgr_pptp_warning("%p: Request outer interface number failed\n", dev);
+ nss_connmgr_pptp_warning("%px: Request outer interface number failed\n", dev);
goto inner_fail;
}
if (!nss_is_dynamic_interface(outer_if)) {
- nss_connmgr_pptp_warning("%p: Invalid NSS dynamic I/F number %d\n", dev, outer_if);
+ nss_connmgr_pptp_warning("%px: Invalid NSS dynamic I/F number %d\n", dev, outer_if);
goto outer_fail;
}
host_inner_if = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER);
if (host_inner_if < 0) {
- nss_connmgr_pptp_warning("%p: Request host inner interface number failed\n", dev);
+ nss_connmgr_pptp_warning("%px: Request host inner interface number failed\n", dev);
goto outer_fail;
}
if (!nss_is_dynamic_interface(host_inner_if)) {
- nss_connmgr_pptp_warning("%p: Invalid NSS dynamic I/F number %d\n", dev, host_inner_if);
+ nss_connmgr_pptp_warning("%px: Invalid NSS dynamic I/F number %d\n", dev, host_inner_if);
goto host_inner_fail;
}
session_info = nss_connmgr_add_pptp_session(dev, &opt);
if (!session_info) {
- nss_connmgr_pptp_warning("%p: PPTP session add failed\n", dev);
+ nss_connmgr_pptp_warning("%px: PPTP session add failed\n", dev);
goto host_inner_fail;
}
@@ -514,11 +519,11 @@ static int nss_connmgr_pptp_dev_up(struc
session_info);
if (!nss_ctx) {
- nss_connmgr_pptp_warning("%p: nss_register_pptp_if failed for inner\n", dev);
+ nss_connmgr_pptp_warning("%px: nss_register_pptp_if failed for inner\n", dev);
goto register_inner_if_fail;
}
- nss_connmgr_pptp_info("%p: inner interface registration successful\n", nss_ctx);
+ nss_connmgr_pptp_info("%px: inner interface registration successful\n", nss_ctx);
/*
* Register pptp tunnel outer interface with NSS
@@ -532,11 +537,11 @@ static int nss_connmgr_pptp_dev_up(struc
session_info);
if (!nss_ctx) {
- nss_connmgr_pptp_warning("%p: nss_register_pptp_if failed for outer\n", dev);
+ nss_connmgr_pptp_warning("%px: nss_register_pptp_if failed for outer\n", dev);
goto register_outer_if_fail;
}
- nss_connmgr_pptp_info("%p: outer interface registration successful\n", nss_ctx);
+ nss_connmgr_pptp_info("%px: outer interface registration successful\n", nss_ctx);
/*
* Register pptp tunnel inner interface with NSS
@@ -550,11 +555,11 @@ static int nss_connmgr_pptp_dev_up(struc
session_info);
if (!nss_ctx) {
- nss_connmgr_pptp_warning("%p: nss_register_pptp_if failed for host inner\n", dev);
+ nss_connmgr_pptp_warning("%px: nss_register_pptp_if failed for host inner\n", dev);
goto register_host_inner_if_fail;
}
- nss_connmgr_pptp_info("%p: host inner interface registration successful\n", nss_ctx);
+ nss_connmgr_pptp_info("%px: host inner interface registration successful\n", nss_ctx);
/*
* Initialize and configure inner I/F.
@@ -584,20 +589,20 @@ static int nss_connmgr_pptp_dev_up(struc
pptpcfg->sibling_ifnum_pri = outer_if;
pptpcfg->sibling_ifnum_aux = host_inner_if;
- nss_connmgr_pptp_info("%p: pptp info\n", dev);
- nss_connmgr_pptp_info("%p: local_call_id %d peer_call_id %d\n", dev,
+ nss_connmgr_pptp_info("%px: pptp info\n", dev);
+ nss_connmgr_pptp_info("%px: local_call_id %d peer_call_id %d\n", dev,
pptpcfg->src_call_id,
pptpcfg->dst_call_id);
- nss_connmgr_pptp_info("%p: saddr 0x%x daddr 0x%x \n", dev, pptpcfg->sip, pptpcfg->dip);
+ nss_connmgr_pptp_info("%px: saddr 0x%x daddr 0x%x \n", dev, pptpcfg->sip, pptpcfg->dip);
nss_pptp_msg_init(&pptpmsg, inner_if, NSS_PPTP_MSG_SESSION_CONFIGURE, sizeof(struct nss_pptp_session_configure_msg), NULL, NULL);
status = nss_pptp_tx_msg_sync(nss_ctx, &pptpmsg);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: nss pptp session creation command error %d\n", dev, status);
+ nss_connmgr_pptp_warning("%px: nss pptp session creation command error %d\n", dev, status);
goto tx_msg_fail;
}
- nss_connmgr_pptp_info("%p: nss_pptp_tx() successful for inner\n", dev);
+ nss_connmgr_pptp_info("%px: nss_pptp_tx() successful for inner\n", dev);
/*
* Initialize and configure outer I/F.
@@ -609,10 +614,10 @@ static int nss_connmgr_pptp_dev_up(struc
status = nss_pptp_tx_msg_sync(nss_ctx, &pptpmsg);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: nss pptp session creation command error %d\n", dev, status);
+ nss_connmgr_pptp_warning("%px: nss pptp session creation command error %d\n", dev, status);
goto tx_msg_fail;
}
- nss_connmgr_pptp_info("%p: nss_pptp_tx() successful for outer\n", dev);
+ nss_connmgr_pptp_info("%px: nss_pptp_tx() successful for outer\n", dev);
/*
* Initialize and configure host inner I/F.
@@ -624,10 +629,10 @@ static int nss_connmgr_pptp_dev_up(struc
status = nss_pptp_tx_msg_sync(nss_ctx, &pptpmsg);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: nss pptp session creation command error %d\n", dev, status);
+ nss_connmgr_pptp_warning("%px: nss pptp session creation command error %d\n", dev, status);
goto tx_msg_fail;
}
- nss_connmgr_pptp_info("%p: nss_pptp_tx() successful for host inner\n", dev);
+ nss_connmgr_pptp_info("%px: nss_pptp_tx() successful for host inner\n", dev);
/*
* Enable the offload mode for Linux PPTP kernel driver. After this
@@ -652,17 +657,17 @@ register_inner_if_fail:
host_inner_fail:
status = nss_dynamic_interface_dealloc_node(host_inner_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: Unable to dealloc the node[%d] in the NSS fw!\n", dev, host_inner_if);
+ nss_connmgr_pptp_warning("%px: Unable to dealloc the node[%d] in the NSS fw!\n", dev, host_inner_if);
}
outer_fail:
status = nss_dynamic_interface_dealloc_node(inner_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_OUTER);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: Unable to dealloc the node[%d] in the NSS fw!\n", dev, outer_if);
+ nss_connmgr_pptp_warning("%px: Unable to dealloc the node[%d] in the NSS fw!\n", dev, outer_if);
}
inner_fail:
status = nss_dynamic_interface_dealloc_node(inner_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_INNER);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: Unable to dealloc the node[%d] in the NSS fw!\n", dev, inner_if);
+ nss_connmgr_pptp_warning("%px: Unable to dealloc the node[%d] in the NSS fw!\n", dev, inner_if);
}
return NOTIFY_DONE;
@@ -686,8 +691,8 @@ static int nss_connmgr_pptp_dev_down(str
/*
* check whether the interface is of type PPP
*/
- if (dev->type != ARPHRD_PPP || !(dev->priv_flags & IFF_PPP_PPTP)) {
- nss_connmgr_pptp_info("%p: netdevice is not a pptp tunnel type\n", dev);
+ if (dev->type != ARPHRD_PPP || !(dev->priv_flags_ext & IFF_EXT_PPP_PPTP)) {
+ nss_connmgr_pptp_info("%px: netdevice is not a pptp tunnel type\n", dev);
return NOTIFY_DONE;
}
@@ -696,7 +701,7 @@ static int nss_connmgr_pptp_dev_down(str
*/
inner_if = nss_cmn_get_interface_number_by_dev_and_type(dev, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_INNER);
if (inner_if < 0) {
- nss_connmgr_pptp_warning("%p: outer I/F is not registered\n", dev);
+ nss_connmgr_pptp_warning("%px: outer I/F is not registered\n", dev);
return NOTIFY_DONE;
}
@@ -705,7 +710,7 @@ static int nss_connmgr_pptp_dev_down(str
*/
outer_if = nss_cmn_get_interface_number_by_dev_and_type(dev, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_OUTER);
if (outer_if < 0) {
- nss_connmgr_pptp_warning("%p: inner I/F is not registered\n", dev);
+ nss_connmgr_pptp_warning("%px: inner I/F is not registered\n", dev);
return NOTIFY_DONE;
}
@@ -714,7 +719,7 @@ static int nss_connmgr_pptp_dev_down(str
*/
host_inner_if = nss_cmn_get_interface_number_by_dev_and_type(dev, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER);
if (host_inner_if < 0) {
- nss_connmgr_pptp_warning("%p: Net device is not registered\n", dev);
+ nss_connmgr_pptp_warning("%px: Net device is not registered\n", dev);
return NOTIFY_DONE;
}
@@ -729,7 +734,7 @@ static int nss_connmgr_pptp_dev_down(str
}
if (!session_found) {
- nss_connmgr_pptp_warning("%p: pptp session is not found for this device", dev);
+ nss_connmgr_pptp_warning("%px: pptp session is not found for this device", dev);
return NOTIFY_DONE;
}
@@ -753,21 +758,21 @@ static int nss_connmgr_pptp_dev_down(str
nss_pptp_msg_init(&pptpmsg, inner_if, NSS_PPTP_MSG_SESSION_DECONFIGURE, sizeof(struct nss_pptp_session_deconfigure_msg), NULL, NULL);
status = nss_pptp_tx_msg_sync(nss_pptp_get_context(), &pptpmsg);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: pptp session destroy command failed, if_number = %d\n", dev, inner_if);
+ nss_connmgr_pptp_warning("%px: pptp session destroy command failed, if_number = %d\n", dev, inner_if);
goto fail;
}
nss_pptp_msg_init(&pptpmsg, outer_if, NSS_PPTP_MSG_SESSION_DECONFIGURE, sizeof(struct nss_pptp_session_deconfigure_msg), NULL, NULL);
status = nss_pptp_tx_msg_sync(nss_pptp_get_context(), &pptpmsg);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: pptp session destroy command failed, if_number = %d\n", dev, outer_if);
+ nss_connmgr_pptp_warning("%px: pptp session destroy command failed, if_number = %d\n", dev, outer_if);
goto fail;
}
nss_pptp_msg_init(&pptpmsg, host_inner_if, NSS_PPTP_MSG_SESSION_DECONFIGURE, sizeof(struct nss_pptp_session_deconfigure_msg), NULL, NULL);
status = nss_pptp_tx_msg_sync(nss_pptp_get_context(), &pptpmsg);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: pptp session destroy command failed, if_number = %d\n", dev, host_inner_if);
+ nss_connmgr_pptp_warning("%px: pptp session destroy command failed, if_number = %d\n", dev, host_inner_if);
goto fail;
}
@@ -783,23 +788,23 @@ static int nss_connmgr_pptp_dev_down(str
*/
status = nss_dynamic_interface_dealloc_node(inner_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_INNER);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: pptp dealloc node failure for inner if_number=%d\n", dev, inner_if);
+ nss_connmgr_pptp_warning("%px: pptp dealloc node failure for inner if_number=%d\n", dev, inner_if);
goto fail;
}
status = nss_dynamic_interface_dealloc_node(outer_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_OUTER);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: pptp dealloc node failure for outer if_number=%d\n", dev, outer_if);
+ nss_connmgr_pptp_warning("%px: pptp dealloc node failure for outer if_number=%d\n", dev, outer_if);
goto fail;
}
status = nss_dynamic_interface_dealloc_node(host_inner_if, NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER);
if (status != NSS_TX_SUCCESS) {
- nss_connmgr_pptp_warning("%p: pptp dealloc node failure for host inner if_number=%d\n", dev, host_inner_if);
+ nss_connmgr_pptp_warning("%px: pptp dealloc node failure for host inner if_number=%d\n", dev, host_inner_if);
goto fail;
}
- nss_connmgr_pptp_info("%p: deleting pptpsession, if_number %d, local_call_id %d, peer_call_id %d\n", dev,
+ nss_connmgr_pptp_info("%px: deleting pptpsession, if_number %d, local_call_id %d, peer_call_id %d\n", dev,
dev->ifindex, session_info->data.src_call, session_info->data.dst_call);
fail:
@@ -819,11 +824,11 @@ static int nss_connmgr_pptp_dev_event(st
switch (event) {
case NETDEV_UP:
- nss_connmgr_pptp_info("%p: netdevice '%s' UP event\n", netdev, netdev->name);
+ nss_connmgr_pptp_info("%px: netdevice '%s' UP event\n", netdev, netdev->name);
return nss_connmgr_pptp_dev_up(netdev);
case NETDEV_DOWN:
- nss_connmgr_pptp_info("%p: netdevice '%s' Down event\n", netdev, netdev->name);
+ nss_connmgr_pptp_info("%px: netdevice '%s' Down event\n", netdev, netdev->name);
return nss_connmgr_pptp_dev_down(netdev);
default:

View File

@ -5,9 +5,10 @@ PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-drv
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2020-03-20
PKG_SOURCE_VERSION:=3cfb9f43
PKG_MIRROR_HASH:=87ab6dab1c0a441b2df95b6c5d992f86a07c6ecd69a0d13eba35014fadaf98d8
PKG_SOURCE_DATE:=2019-12-12
PKG_SOURCE_VERSION:=f147342b4437ce91429d0676e5125adbe9a465e3
PKG_MIRROR_HASH:=1af498932f3cd5e16d5aae60c6f4879ababde620ff7ed6b13ab1ad12aafcbe92
# PKG_MIRROR_HASH:=87ab6dab1c0a441b2df95b6c5d992f86a07c6ecd69a0d13eba35014fadaf98d8
PKG_JOBS=-j4
PKG_BUILD_PARALLEL:=1
@ -127,7 +128,6 @@ ifeq ($(CONFIG_TARGET_BOARD), "ipq806x")
DRV_MAKE_OPTS+= \
TARGET_NSS_MINOR_VERSION=$(TARGET_NSS_MINOR_VERSION)
DRV_MAKE_OPTS+= \
NSS_DRV_C2C_ENABLE=n \
NSS_DRV_CAPWAP_ENABLE=n \
NSS_DRV_IPSEC_ENABLE=n \
NSS_DRV_BRIDGE_ENABLE=n \
@ -135,7 +135,6 @@ ifeq ($(CONFIG_TARGET_BOARD), "ipq806x")
NSS_DRV_VLAN_ENABLE=n \
NSS_DRV_L2TP_ENABLE=n \
NSS_DRV_LAG_ENABLE=n \
NSS_DRV_PVXLAN_ENABLE=n \
NSS_DRV_GRE_ENABLE=n \
NSS_DRV_GRE_REDIR_ENABLE=n \
NSS_DRV_GRE_TUNNEL_ENABLE=n \
@ -145,7 +144,7 @@ ifeq ($(CONFIG_TARGET_BOARD), "ipq806x")
NSS_DRV_TUNIPIP6_ENABLE=n \
NSS_DRV_QRFS_ENABLE=n \
NSS_DRV_RMNET_ENABLE=n \
NSS_DRV_OAM_ENABLE=y \
NSS_DRV_OAM_ENABLE=n \
NSS_DRV_CLMAP_ENABLE=n \
NSS_DRV_VXLAN_ENABLE=n \
NSS_DRV_MATCH_ENABLE=n \

View File

@ -9,3 +9,50 @@
#define NSS_DATA_PLANE_GMAC_MAX_INTERFACES 4
static DEFINE_SPINLOCK(nss_data_plane_gmac_stats_lock);
--- a/nss_core.c
+++ b/nss_core.c
@@ -45,7 +45,9 @@
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0))))))
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))))))
#error "Check skb recycle code in this file to match Linux version"
#endif
@@ -447,7 +449,11 @@ static void nss_get_ddr_info(struct nss_
struct device_node *node;
si_meminfo(&vals);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0))
cached = global_page_state(NR_FILE_PAGES);
+#else
+ cached = global_node_page_state(NR_FILE_PAGES);
+#endif
avail_ddr = (vals.totalram + cached + vals.sharedram) * vals.mem_unit;
mmu->num_active_cores = nss_top_main.num_nss;
@@ -744,7 +750,11 @@ static inline void nss_core_handle_virt_
* Mimic Linux behavior to allow multi-queue netdev choose which queue to use
*/
if (ndev->netdev_ops->ndo_select_queue) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0))
queue_offset = ndev->netdev_ops->ndo_select_queue(ndev, nbuf, NULL, NULL);
+#else
+ queue_offset = ndev->netdev_ops->ndo_select_queue(ndev, nbuf, NULL);
+#endif
}
skb_set_queue_mapping(nbuf, queue_offset);
--- a/nss_tx_rx_common.h
+++ b/nss_tx_rx_common.h
@@ -23,6 +23,7 @@
#define __NSS_TX_RX_COMMON_H
#include <nss_hal.h>
+#include <linux/kmemleak.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include "nss_tx_msg_sync.h"

View File

@ -14,7 +14,509 @@ Signed-off-by: Robert Marko <robert.marko@sartura.hr>
--- a/Makefile
+++ b/Makefile
@@ -405,14 +405,7 @@ NSS_CCFLAGS = -DNSS_DT_SUPPORT=1 -DNSS_F
@@ -8,125 +8,64 @@ obj-m += qca-nss-drv.o
# List the files that belong to the driver in alphabetical order.
#
qca-nss-drv-objs := \
- nss_bridge.o \
- nss_bridge_log.o \
- nss_c2c_tx.o \
- nss_c2c_tx_log.o \
- nss_c2c_tx_stats.o \
- nss_c2c_rx.o \
- nss_c2c_rx_stats.o \
- nss_capwap.o \
- nss_capwap_log.o \
- nss_capwap_stats.o \
- nss_clmap.o \
- nss_clmap_log.o \
- nss_clmap_stats.o \
nss_cmn.o \
nss_core.o \
nss_coredump.o \
nss_dynamic_interface.o \
nss_dynamic_interface_log.o \
- nss_edma.o \
- nss_edma_stats.o \
nss_eth_rx.o \
nss_eth_rx_stats.o \
- nss_gre.o \
- nss_gre_log.o \
- nss_gre_stats.o \
- nss_gre_redir.o \
- nss_gre_redir_log.o \
- nss_gre_redir_lag_ds.o \
- nss_gre_redir_lag_ds_log.o \
- nss_gre_redir_lag_ds_stats.o \
- nss_gre_redir_lag_us.o \
- nss_gre_redir_lag_us_log.o \
- nss_gre_redir_lag_us_stats.o \
- nss_gre_redir_stats.o \
- nss_gre_redir_mark.o \
- nss_gre_redir_mark_log.o \
- nss_gre_redir_mark_stats.o \
- nss_gre_tunnel.o \
- nss_gre_tunnel_log.o \
- nss_gre_tunnel_stats.o \
nss_if.o \
- nss_igs.o \
- nss_igs_stats.o \
nss_init.o \
nss_ipv4.o \
nss_ipv4_stats.o \
nss_ipv4_log.o \
- nss_ipv4_reasm.o \
- nss_ipv4_reasm_stats.o \
- nss_ipv6.o \
- nss_ipv6_stats.o \
- nss_ipv6_log.o \
- nss_ipv6_reasm.o \
- nss_ipv6_reasm_stats.o \
- nss_l2tpv2.o \
- nss_l2tpv2_log.o \
- nss_l2tpv2_stats.o \
- nss_lag.o \
- nss_lag_log.o \
nss_log.o \
nss_lso_rx.o \
nss_lso_rx_stats.o \
- nss_map_t.o \
- nss_map_t_log.o \
- nss_map_t_stats.o \
nss_meminfo.o \
nss_n2h.o \
nss_n2h_stats.o \
- nss_oam.o \
- nss_oam_log.o \
nss_phys_if.o \
nss_pm.o \
nss_profiler.o \
nss_project.o \
- nss_portid.o \
- nss_portid_log.o \
- nss_portid_stats.o \
- nss_ppe.o \
- nss_ppe_log.o \
- nss_ppe_stats.o \
- nss_pppoe.o \
- nss_pppoe_log.o \
- nss_pppoe_stats.o \
- nss_pptp.o \
- nss_pptp_log.o \
- nss_pptp_stats.o \
- nss_pvxlan.o \
- nss_pvxlan_log.o \
- nss_pvxlan_stats.o \
- nss_qrfs.o \
- nss_qrfs_log.o \
- nss_qrfs_stats.o \
- nss_rmnet_rx.o \
- nss_rmnet_rx_stats.o \
nss_rps.o \
- nss_shaper.o \
- nss_sjack.o \
- nss_sjack_log.o \
- nss_sjack_stats.o \
nss_stats.o \
- nss_tstamp.o \
- nss_tstamp_stats.o \
- nss_tun6rd.o \
- nss_tun6rd_log.o \
- nss_trustsec_tx.o \
- nss_trustsec_tx_log.o \
- nss_trustsec_tx_stats.o \
- nss_tunipip6.o \
- nss_tunipip6_log.o \
nss_tx_msg_sync.o \
nss_unaligned.o \
nss_unaligned_log.o \
- nss_unaligned_stats.o \
+ nss_unaligned_stats.o
+
+# Base NSS data plane/HAL support
+qca-nss-drv-objs += nss_data_plane/nss_data_plane.o
+qca-nss-drv-objs += nss_hal/nss_hal.o
+
+ifneq "$(NSS_DRV_PPPOE_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_PPPOE_ENABLE
+qca-nss-drv-objs += \
+ nss_pppoe.o \
+ nss_pppoe_log.o \
+ nss_pppoe_stats.o
+endif
+
+ifneq "$(NSS_DRV_VIRT_IF_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_VIRT_IF_ENABLE
+qca-nss-drv-objs += \
nss_virt_if.o \
- nss_virt_if_stats.o \
+ nss_virt_if_stats.o
+endif
+
+ifneq "$(NSS_DRV_VLAN_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_VLAN_ENABLE
+qca-nss-drv-objs += \
nss_vlan.o \
- nss_vlan_log.o \
- nss_tstamp.o \
- nss_wifi.o \
+ nss_vlan_log.o
+endif
+
+ifneq "$(NSS_DRV_WIFI_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_WIFI_ENABLE
+qca-nss-drv-objs += nss_wifi.o \
nss_wifi_log.o \
nss_wifi_stats.o \
nss_wifi_vdev.o \
@@ -135,58 +74,312 @@ qca-nss-drv-objs := \
nss_wifili.o \
nss_wifili_log.o \
nss_wifili_stats.o
+endif
-# Base NSS data plane/HAL support
-qca-nss-drv-objs += nss_data_plane/nss_data_plane.o
-qca-nss-drv-objs += nss_hal/nss_hal.o
+ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_BRIDGE_ENABLE
+qca-nss-drv-objs += \
+ nss_bridge.o \
+ nss_bridge_log.o
+endif
+
+ifneq "$(NSS_DRV_IPV4_REASM_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_IPV4_REASM_ENABLE
+qca-nss-drv-objs += \
+ nss_ipv4_reasm.o \
+ nss_ipv4_reasm_stats.o
+endif
+
+ifneq "$(NSS_DRV_L2TP_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_L2TP_ENABLE
+qca-nss-drv-objs += \
+ nss_l2tpv2.o \
+ nss_l2tpv2_log.o \
+ nss_l2tpv2_stats.o
+endif
+
+ifneq "$(NSS_DRV_LAG_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_LAG_ENABLE
+qca-nss-drv-objs += \
+ nss_lag.o \
+ nss_lag_log.o
+endif
+
+ifneq "$(NSS_DRV_PVXLAN_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_PVXLAN_ENABLE
+qca-nss-drv-objs += \
+ nss_pvxlan.o \
+ nss_pvxlan_log.o \
+ nss_pvxlan_stats.o
+endif
+
+ifneq "$(NSS_DRV_IPV6_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_IPV6_ENABLE
+qca-nss-drv-objs += \
+ nss_ipv6.o \
+ nss_ipv6_stats.o \
+ nss_ipv6_log.o
+ifneq "$(NSS_DRV_IPV6_REASM_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_IPV6_REASM_ENABLE
+qca-nss-drv-objs += \
+ nss_ipv6_reasm.o \
+ nss_ipv6_reasm_stats.o
+endif
+endif
+
+ifneq "$(NSS_DRV_TSTAMP_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_TSTAMP_ENABLE
+qca-nss-drv-objs += \
+ nss_tstamp.o \
+ nss_tstamp_stats.o
+endif
+
+ifneq "$(NSS_DRV_GRE_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_GRE_ENABLE
+qca-nss-drv-objs += \
+ nss_gre.o \
+ nss_gre_log.o \
+ nss_gre_stats.o
+endif
+
+ifneq "$(NSS_DRV_GRE_REDIR_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_GRE_REDIR_ENABLE
+qca-nss-drv-objs += \
+ nss_gre_redir.o \
+ nss_gre_redir_log.o \
+ nss_gre_redir_lag_ds.o \
+ nss_gre_redir_lag_ds_log.o \
+ nss_gre_redir_lag_ds_stats.o \
+ nss_gre_redir_lag_us.o \
+ nss_gre_redir_lag_us_log.o \
+ nss_gre_redir_lag_us_stats.o \
+ nss_gre_redir_stats.o \
+ nss_gre_redir_mark.o \
+ nss_gre_redir_mark_log.o \
+ nss_gre_redir_mark_stats.o
+endif
+
+ifneq "$(NSS_DRV_GRE_TUNNEL_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_GRE_TUNNEL_ENABLE
+qca-nss-drv-objs += \
+ nss_gre_tunnel.o \
+ nss_gre_tunnel_log.o \
+ nss_gre_tunnel_stats.o
+endif
+
+ifneq "$(NSS_DRV_CAPWAP_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_CAPWAP_ENABLE
+qca-nss-drv-objs += \
+ nss_capwap.o \
+ nss_capwap_log.o \
+ nss_capwap_stats.o
+endif
+
+ifneq "$(NSS_DRV_MAPT_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_MAPT_ENABLE
+qca-nss-drv-objs += \
+ nss_map_t.o \
+ nss_map_t_log.o \
+ nss_map_t_stats.o
+endif
+
+ifneq "$(NSS_DRV_PPTP_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_PPTP_ENABLE
+qca-nss-drv-objs += \
+ nss_pptp.o \
+ nss_pptp_log.o \
+ nss_pptp_stats.o
+endif
+
+ifneq "$(NSS_DRV_SHAPER_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_SHAPER_ENABLE
+qca-nss-drv-objs += \
+ nss_shaper.o
+endif
+
+ifneq "$(NSS_DRV_SJACK_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_SJACK_ENABLE
+qca-nss-drv-objs += \
+ nss_sjack.o \
+ nss_sjack_log.o \
+ nss_sjack_stats.o
+endif
+
+ifneq "$(NSS_DRV_TUN6RD_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_TUN6RD_ENABLE
+qca-nss-drv-objs += \
+ nss_tun6rd.o \
+ nss_tun6rd_log.o
+endif
+
+ifneq "$(NSS_DRV_TRUSTSEC_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_TRUSTSEC_ENABLE
+qca-nss-drv-objs += \
+ nss_trustsec_tx.o \
+ nss_trustsec_tx_log.o \
+ nss_trustsec_tx_stats.o
+endif
+
+ifneq "$(NSS_DRV_TUNIPIP6_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_TUNIPIP6_ENABLE
+qca-nss-drv-objs += \
+ nss_tunipip6.o \
+ nss_tunipip6_log.o
+endif
+
+ifneq "$(NSS_DRV_QRFS_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_QRFS_ENABLE
+qca-nss-drv-objs += \
+ nss_qrfs.o \
+ nss_qrfs_log.o \
+ nss_qrfs_stats.o
+endif
+
+ifneq "$(NSS_DRV_RMNET_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_RMNET_ENABLE
+qca-nss-drv-objs += \
+ nss_rmnet_rx.o \
+ nss_rmnet_rx_stats.o
+endif
+
+ifneq "$(NSS_DRV_PORTID_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_PORTID_ENABLE
+qca-nss-drv-objs += \
+ nss_portid.o \
+ nss_portid_log.o \
+ nss_portid_stats.o
+endif
+
+ifneq "$(NSS_DRV_IGS_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_IGS_ENABLE
+qca-nss-drv-objs += \
+ nss_igs.o \
+ nss_igs_stats.o
+endif
+
+ifneq "$(NSS_DRV_OAM_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_OAM_ENABLE
+qca-nss-drv-objs += \
+ nss_oam.o \
+ nss_oam_log.o
+endif
-ifeq ($(SoC),$(filter $(SoC),ipq806x ipq40xx))
+ifneq "$(NSS_DRV_CLMAP_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_CLMAP_ENABLE
+qca-nss-drv-objs += \
+ nss_clmap.o \
+ nss_clmap_log.o \
+ nss_clmap_stats.o
+endif
+
+
+ifeq ($(SoC),$(filter $(SoC),ipq806x))
qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \
- nss_hal/ipq806x/nss_hal_pvt.o \
- nss_dtls.o \
- nss_dtls_log.o \
- nss_dtls_stats.o \
- nss_crypto.o \
- nss_crypto_log.o \
+ nss_hal/ipq806x/nss_hal_pvt.o
+
+ifneq "$(NSS_DRV_C2C_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_C2C_ENABLE
+qca-nss-drv-objs += \
+ nss_c2c_tx.o \
+ nss_c2c_tx_log.o \
+ nss_c2c_tx_stats.o \
+ nss_c2c_rx.o \
+ nss_c2c_rx_stats.o
+endif
+ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_IPSEC_ENABLE
+qca-nss-drv-objs += \
nss_ipsec_log.o \
nss_ipsec.o
+endif
+
+ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_CRYPTO_ENABLE
+qca-nss-drv-objs += \
+ nss_crypto.o \
+ nss_crypto_log.o
+endif
+
+ifneq "$(NSS_DRV_DTLS_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_DTLS_ENABLE
+qca-nss-drv-objs += \
+ nss_dtls.o \
+ nss_dtls_log.o \
+ nss_dtls_stats.o
+endif
ccflags-y += -I$(obj)/nss_hal/ipq806x -DNSS_HAL_IPQ806X_SUPPORT
endif
-ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64))
-qca-nss-drv-objs += nss_data_plane/nss_data_plane_edma.o \
- nss_hal/ipq807x/nss_hal_pvt.o \
- nss_dtls_cmn.o \
- nss_dtls_cmn_log.o \
- nss_crypto_cmn.o \
- nss_crypto_cmn_log.o \
+ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64 ipq807x ipq807x_64))
+qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \
+ nss_edma.o \
+ nss_edma_stats.o \
+ nss_ppe.o \
+ nss_ppe_log.o \
+ nss_ppe_stats.o \
+
+ccflags-y += -DNSS_DRV_PPE_ENABLE
+ccflags-y += -DNSS_DRV_EDMA_ENABLE
+
+ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_IPSEC_ENABLE
+qca-nss-drv-objs += \
nss_ipsec_cmn_log.o \
- nss_ipsec_cmn.o \
- nss_qvpn.o \
- nss_qvpn_stats.o \
- nss_qvpn_log.o
+ nss_ipsec_cmn.o
+endif
+
+ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_CRYPTO_ENABLE
+ccflags-y += -DNSS_DRV_DMA_ENABLE
+
+qca-nss-drv-objs += \
+ nss_crypto_cmn.o \
+ nss_crypto_cmn_log.o
+endif
+
+ifneq "$(NSS_DRV_DTLS_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_DTLS_ENABLE
+qca-nss-drv-objs += \
+ nss_dtls_cmn.o \
+ nss_dtls_cmn_log.o
+endif
+
+ifneq "$(NSS_DRV_QVPN_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_QVPN_ENABLE
+qca-nss-drv-objs += \
+ nss_qvpn.o \
+ nss_qvpn_log.o \
+ nss_qvpn_stats.o
+endif
+endif
+
+ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64))
+qca-nss-drv-objs += nss_hal/ipq807x/nss_hal_pvt.o \
+ nss_data_plane/hal/nss_ipq807x.o
+ifneq "$(NSS_DRV_C2C_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_C2C_ENABLE
+qca-nss-drv-objs += \
+ nss_c2c_tx.o \
+ nss_c2c_tx_log.o \
+ nss_c2c_tx_stats.o \
+ nss_c2c_rx.o \
+ nss_c2c_rx_stats.o
+endif
ccflags-y += -I$(obj)/nss_hal/ipq807x -DNSS_HAL_IPQ807x_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT
endif
ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64))
-qca-nss-drv-objs += nss_data_plane/nss_data_plane_edma.o \
- nss_hal/ipq60xx/nss_hal_pvt.o \
- nss_dtls_cmn.o \
- nss_dtls_cmn_log.o \
- nss_crypto_cmn.o \
- nss_crypto_cmn_log.o \
- nss_ipsec_cmn_log.o \
- nss_ipsec_cmn.o \
- nss_qvpn.o \
- nss_qvpn_stats.o \
- nss_qvpn_log.o
+qca-nss-drv-objs += nss_hal/ipq60xx/nss_hal_pvt.o \
+ nss_data_plane/hal/nss_ipq60xx.o
ccflags-y += -I$(obj)/nss_hal/ipq60xx -DNSS_HAL_IPQ60XX_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT
endif
ccflags-y += -I$(obj)/nss_hal/include -I$(obj)/nss_data_plane/include -I$(obj)/exports -DNSS_DEBUG_LEVEL=0 -DNSS_PKT_STATS_ENABLED=1
-
+ccflags-y += -I$(obj)/nss_data_plane/hal/include
ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_REUSE_SUPPORT=1
-ccflags-y += -Werror
+ccflags-y += -Wall -Werror
+
+KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION)))
ifneq ($(findstring 3.4, $(KERNELVERSION)),)
NSS_CCFLAGS = -DNSS_DT_SUPPORT=0 -DNSS_FW_DBG_SUPPORT=1 -DNSS_PM_SUPPORT=1
@@ -196,14 +389,7 @@ NSS_CCFLAGS = -DNSS_DT_SUPPORT=1 -DNSS_F
ccflags-y += -I$(obj)
endif

View File

@ -1,6 +1,6 @@
--- a/nss_core.c
+++ b/nss_core.c
@@ -1116,7 +1116,7 @@ static inline bool nss_core_handle_nr_fr
@@ -1042,7 +1042,7 @@ static inline bool nss_core_handle_nr_fr
* ingress shaped flag set.
*/
if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
@ -9,7 +9,7 @@
}
#endif
goto pull;
@@ -1156,7 +1156,7 @@ static inline bool nss_core_handle_nr_fr
@@ -1082,7 +1082,7 @@ static inline bool nss_core_handle_nr_fr
* ingress shaped flag set.
*/
if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
@ -18,7 +18,7 @@
}
#endif
@@ -1271,7 +1271,7 @@ static inline bool nss_core_handle_linea
@@ -1194,7 +1194,7 @@ static inline bool nss_core_handle_linea
* ingress shaped flag set.
*/
if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
@ -27,7 +27,7 @@
}
#endif
@@ -1329,7 +1329,7 @@ static inline bool nss_core_handle_linea
@@ -1252,7 +1252,7 @@ static inline bool nss_core_handle_linea
* ingress shaped flag set.
*/
if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {

View File

@ -1,6 +1,6 @@
--- a/nss_meminfo.c
+++ b/nss_meminfo.c
@@ -711,7 +711,7 @@ bool nss_meminfo_init(struct nss_ctx_ins
@@ -706,7 +706,7 @@ bool nss_meminfo_init(struct nss_ctx_ins
/*
* meminfo_start is the label where the start address of meminfo map is stored.
*/
@ -22,7 +22,7 @@
goto out;
--- a/nss_hal/ipq60xx/nss_hal_pvt.c
+++ b/nss_hal/ipq60xx/nss_hal_pvt.c
@@ -207,13 +207,13 @@ static struct nss_platform_data *__nss_h
@@ -206,13 +206,13 @@ static struct nss_platform_data *__nss_h
npd->nphys = res_nphys.start;
npd->qgic_phys = res_qgic_phys.start;
@ -38,7 +38,7 @@
if (!npd->qgic_map) {
nss_info_always("%p: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id);
goto out;
@@ -434,13 +434,13 @@ static int __nss_hal_common_reset(struct
@@ -433,13 +433,13 @@ static int __nss_hal_common_reset(struct
of_node_put(cmn);
@ -76,7 +76,7 @@
return -EFAULT;
--- a/nss_hal/ipq807x/nss_hal_pvt.c
+++ b/nss_hal/ipq807x/nss_hal_pvt.c
@@ -234,7 +234,7 @@ static struct nss_platform_data *__nss_h
@@ -233,7 +233,7 @@ static struct nss_platform_data *__nss_h
npd->vphys = res_vphys.start;
npd->qgic_phys = res_qgic_phys.start;
@ -85,7 +85,7 @@
if (!npd->nmap) {
nss_info_always("%p: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
@@ -246,7 +246,7 @@ static struct nss_platform_data *__nss_h
@@ -245,7 +245,7 @@ static struct nss_platform_data *__nss_h
goto out;
}
@ -94,7 +94,7 @@
if (!npd->qgic_map) {
nss_info_always("%p: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id);
goto out;
@@ -466,7 +466,7 @@ static int __nss_hal_common_reset(struct
@@ -465,7 +465,7 @@ static int __nss_hal_common_reset(struct
}
of_node_put(cmn);

View File

@ -0,0 +1,153 @@
--- a/nss_igs.c
+++ b/nss_igs.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -17,6 +17,14 @@
#include "nss_tx_rx_common.h"
#include "nss_igs_stats.h"
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
+#ifdef CONFIG_NET_CLS_ACT
+#include <linux/tc_act/tc_nss_mirred.h>
+#endif
+#endif
+
+static struct module *nss_igs_module;
+
/*
* nss_igs_verify_if_num()
* Verify interface number passed to us.
@@ -51,12 +59,12 @@ static void nss_igs_handler(struct nss_c
* Is this a valid request/response packet?
*/
if (ncm->type >= NSS_IGS_MSG_MAX) {
- nss_warning("%p: received invalid message %d for IGS interface", nss_ctx, ncm->type);
+ nss_warning("%px: received invalid message %d for IGS interface", nss_ctx, ncm->type);
return;
}
if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_igs_msg)) {
- nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface);
+ nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface);
return;
}
@@ -87,7 +95,7 @@ static void nss_igs_handler(struct nss_c
* call igs callback
*/
if (!cb) {
- nss_warning("%p: No callback for igs interface %d",
+ nss_warning("%px: No callback for igs interface %d",
nss_ctx, ncm->interface);
return;
}
@@ -152,3 +160,40 @@ struct nss_ctx_instance *nss_igs_get_con
return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.igs_handler_id];
}
EXPORT_SYMBOL(nss_igs_get_context);
+
+#ifdef CONFIG_NET_CLS_ACT
+/*
+ * nss_igs_module_save()
+ * Save the ingress shaping module reference.
+ */
+void nss_igs_module_save(struct tc_action_ops *act, struct module *module)
+{
+ nss_assert(act);
+ nss_assert(act->type == TCA_ACT_MIRRED_NSS);
+
+ nss_igs_module = module;
+}
+EXPORT_SYMBOL(nss_igs_module_save);
+#endif
+
+/*
+ * nss_igs_module_get()
+ * Get the ingress shaping module reference.
+ */
+bool nss_igs_module_get()
+{
+ nss_assert(nss_igs_module);
+ return try_module_get(nss_igs_module);
+}
+EXPORT_SYMBOL(nss_igs_module_get);
+
+/*
+ * nss_igs_module_put()
+ * Release the ingress shaping module reference.
+ */
+void nss_igs_module_put()
+{
+ nss_assert(nss_igs_module);
+ module_put(nss_igs_module);
+}
+EXPORT_SYMBOL(nss_igs_module_put);
--- a/exports/nss_igs.h
+++ b/exports/nss_igs.h
@@ -22,8 +22,14 @@
#ifndef _NSS_IGS_H_
#define _NSS_IGS_H_
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+#ifdef CONFIG_NET_CLS_ACT
+#include <net/act_api.h>
+#endif
+#endif
+
/**
- * @addtogroup NSS ingress shaper subsystem
+ * @addtogroup nss_ingress_shaper_subsystem
* @{
*/
@@ -163,6 +169,44 @@ extern void nss_igs_unregister_if(uint32
*/
extern bool nss_igs_verify_if_num(uint32_t if_num);
+
+#ifdef CONFIG_NET_CLS_ACT
+/*
+ * nss_igs_module_save()
+ * Save the ingress shaping module reference.
+ *
+ * @datatypes
+ * tc_action_ops \n
+ * module
+ *
+ * @param[in] act Operation structure for ingress shaping action.
+ * @param[in] module Module structure of ingress shaping module.
+ *
+ * @return
+ * None.
+ */
+extern void nss_igs_module_save(struct tc_action_ops *act, struct module *module);
+#endif
+
+/*
+ * nss_igs_module_get()
+ * Get the ingress shaping module reference.
+ *
+ * @return
+ * False if not able to take the ingress shaping module reference, otherwise true.
+ *
+ */
+extern bool nss_igs_module_get(void);
+
+/*
+ * nss_igs_module_put()
+ * Release the ingress shaping module reference.
+ *
+ * @return
+ * None.
+ */
+extern void nss_igs_module_put(void);
+
/**
* @}
*/

View File

@ -1,6 +1,6 @@
--- a/nss_core.c
+++ b/nss_core.c
@@ -1599,7 +1599,7 @@ static int32_t nss_core_handle_cause_que
@@ -1522,7 +1522,7 @@ static int32_t nss_core_handle_cause_que
*
*/
if (unlikely((buffer_type == N2H_BUFFER_CRYPTO_RESP))) {

View File

@ -1,23 +1,40 @@
From f8cf061454a3707c0c84d0fca685e84455f91362 Mon Sep 17 00:00:00 2001
From: Suruchi Suman <surusuma@codeaurora.org>
Date: Tue, 3 Dec 2019 12:57:38 +0530
Subject: [qca-nss-drv] Exported set nexhop function from drv.
commit f8cf061454a3707c0c84d0fca685e84455f91362
Author: Suruchi Suman <surusuma@codeaurora.org>
Date: Tue Dec 3 12:57:38 2019 +0530
Change-Id: I3df6658bef72fe574ac9acfb7aac61785769766f
Signed-off-by: Suruchi Suman <surusuma@codeaurora.org>
---
nss_phys_if.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
[qca-nss-drv] Exported set nexhop function from drv.
Change-Id: I3df6658bef72fe574ac9acfb7aac61785769766f
Signed-off-by: Suruchi Suman <surusuma@codeaurora.org>
--- a/nss_core.c
+++ b/nss_core.c
@@ -52,7 +52,8 @@
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))))))
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))))))
#error "Check skb recycle code in this file to match Linux version"
#endif
--- a/nss_phys_if.c
+++ b/nss_phys_if.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -583,6 +583,12 @@ nss_tx_status_t nss_phys_if_set_nexthop(
struct nss_phys_if_msg nim;
NSS_VERIFY_CTX_MAGIC(nss_ctx);
+
+ if (nexthop >= NSS_MAX_NET_INTERFACES) {
+ nss_warning("%p: Invalid nexthop interface number: %d", nss_ctx, nexthop);
+ return NSS_TX_FAILURE_BAD_PARAM;
+ }
+
nss_info("%p: Phys If nexthop will be set to %d, id:%d\n", nss_ctx, nexthop, if_num);
nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_SET_NEXTHOP,
@@ -591,6 +597,7 @@ nss_tx_status_t nss_phys_if_set_nexthop(
return nss_phys_if_msg_sync(nss_ctx, &nim);
}
+EXPORT_SYMBOL(nss_phys_if_set_nexthop);
/*
* nss_get_state()

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
--- a/nss_core.c
+++ b/nss_core.c
@@ -53,7 +53,8 @@
@@ -47,7 +47,8 @@
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \
@ -26,7 +26,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
#error "Check skb recycle code in this file to match Linux version"
#endif
@@ -2562,7 +2563,11 @@ static inline bool nss_core_skb_can_reus
@@ -2454,7 +2455,11 @@ static inline bool nss_skb_can_reuse(str
if (unlikely(irqs_disabled()))
return false;

View File

@ -9,82 +9,14 @@
/**
* @addtogroup nss_dynamic_interface_subsystem
* @{
@@ -101,9 +103,11 @@ enum nss_dynamic_interface_type {
NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N,
NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0,
NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1,
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1))
NSS_DYNAMIC_INTERFACE_TYPE_TLS_INNER,
NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER,
NSS_DYNAMIC_INTERFACE_TYPE_MIRROR,
+#endif
NSS_DYNAMIC_INTERFACE_TYPE_MAX
};
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -381,13 +381,14 @@ int nss_hal_probe(struct platform_device
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_H2N] = nss_dev->id;
}
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3))
#ifdef NSS_DRV_CAPWAP_ENABLE
if (npd->capwap_enabled == NSS_FEATURE_ENABLED) {
nss_top->capwap_handler_id = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP] = nss_dev->id;
}
#endif
-
+#endif
if (npd->ipv4_reasm_enabled == NSS_FEATURE_ENABLED) {
nss_top->ipv4_reasm_handler_id = nss_dev->id;
nss_ipv4_reasm_register_handler();
@@ -646,6 +647,7 @@ int nss_hal_probe(struct platform_device
nss_match_init();
}
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1))
#ifdef NSS_DRV_TLS_ENABLE
#if defined(NSS_HAL_IPQ807x_SUPPORT) || defined(NSS_HAL_IPQ60XX_SUPPORT)
if (npd->tls_enabled == NSS_FEATURE_ENABLED) {
@@ -656,12 +658,15 @@ int nss_hal_probe(struct platform_device
}
#endif
#endif
+#ifdef NSS_DRV_MIRROR_ENABLE
if (npd->mirror_enabled == NSS_FEATURE_ENABLED) {
nss_top->mirror_handler_id = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_MIRROR] = nss_dev->id;
nss_mirror_register_handler();
nss_info("%d: NSS mirror is enabled", nss_dev->id);
}
+#endif
+#endif
if (nss_ctx->id == 0) {
#if (NSS_FREQ_SCALE_SUPPORT == 1)
--- a/exports/nss_ipv4.h
+++ b/exports/nss_ipv4.h
@@ -26,6 +26,8 @@
#include "nss_stats_public.h"
#endif
@@ -27,6 +27,8 @@
* @{
*/
+#include "nss_fw_version.h"
+
/**
* @addtogroup nss_ipv4_subsystem
* @{
--- /dev/null
+++ b/exports/nss_fw_version.h
@@ -0,0 +1,11 @@
+#ifndef __NSS_FW_VERSION_H
+#define __NSS_FW_VERSION_H
+
+#define NSS_FW_VERSION_MAJOR 11
+#define NSS_FW_VERSION_MINOR 0
+
+#define NSS_FW_VERSION(a,b) (((a) << 8) + (b))
+
+#define NSS_FW_VERSION_CODE NSS_FW_VERSION(NSS_FW_VERSION_MAJOR, NSS_FW_VERSION_MINOR)
+
+#endif /* __NSS_FW_VERSION_H */
* nss_ipv4_message_types
* IPv4 bridge and routing rule message types.

View File

@ -1,179 +1,22 @@
--- a/Makefile
+++ b/Makefile
@@ -46,13 +46,7 @@ qca-nss-drv-objs := \
nss_lso_rx.o \
nss_lso_rx_stats.o \
nss_lso_rx_strings.o \
- nss_match.o \
- nss_match_log.o \
- nss_match_stats.o \
nss_meminfo.o \
- nss_mirror.o \
- nss_mirror_log.o \
- nss_mirror_stats.o \
nss_n2h.o \
nss_n2h_stats.o \
nss_n2h_strings.o \
@@ -60,28 +54,44 @@ qca-nss-drv-objs := \
nss_pm.o \
nss_profiler.o \
nss_project.o \
- nss_ppe.o \
- nss_ppe_log.o \
- nss_ppe_stats.o \
- nss_ppe_vp.o \
- nss_ppe_vp_log.o \
- nss_ppe_vp_stats.o \
- nss_pppoe.o \
- nss_pppoe_log.o \
- nss_pppoe_stats.o \
- nss_pppoe_strings.o \
nss_rps.o \
nss_stats.o \
nss_strings.o \
nss_tx_msg_sync.o \
nss_unaligned.o \
nss_unaligned_log.o \
- nss_unaligned_stats.o \
+ nss_unaligned_stats.o
+
+# Base NSS data plane/HAL support
+qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o
+qca-nss-drv-objs += nss_hal/nss_hal.o
+
+ifneq "$(NSS_DRV_PPPOE_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_PPPOE_ENABLE
+qca-nss-drv-objs += \
+ nss_pppoe.o \
+ nss_pppoe_log.o \
+ nss_pppoe_stats.o \
+ nss_pppoe_strings.o
+endif
+
+ifneq "$(NSS_DRV_VIRT_IF_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_VIRT_IF_ENABLE
+qca-nss-drv-objs += \
nss_virt_if.o \
- nss_virt_if_stats.o \
+ nss_virt_if_stats.o
+endif
+
+ifneq "$(NSS_DRV_VLAN_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_VLAN_ENABLE
+qca-nss-drv-objs += \
nss_vlan.o \
- nss_vlan_log.o \
- nss_wifi.o \
+ nss_vlan_log.o
+endif
+
+ifneq "$(NSS_DRV_WIFI_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_WIFI_ENABLE
+qca-nss-drv-objs += nss_wifi.o \
nss_wifi_log.o \
nss_wifi_stats.o \
nss_wifi_vdev.o \
@@ -92,10 +102,7 @@ qca-nss-drv-objs := \
nss_wifili_stats.o \
nss_wifili_strings.o \
nss_wifi_mac_db.o
-
-# Base NSS data plane/HAL support
-qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o
-qca-nss-drv-objs += nss_hal/nss_hal.o
+endif
ifneq "$(NSS_DRV_L2TP_ENABLE)" "n"
ccflags-y += -DNSS_DRV_L2TP_ENABLE
@@ -121,6 +128,22 @@ qca-nss-drv-objs += \
nss_pvxlan_stats.o
endif
+ifneq "$(NSS_DRV_MATCH_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_MATCH_ENABLE
+qca-nss-drv-objs += \
+ nss_match.o \
+ nss_match_log.o \
+ nss_match_stats.o
+endif
+
+ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_MIRROR_ENABLE
+qca-nss-drv-objs += \
+ nss_mirror.o \
+ nss_mirror_log.o \
+ nss_mirror_stats.o
+endif
+
ifneq "$(NSS_DRV_TSTAMP_ENABLE)" "n"
ccflags-y += -DNSS_DRV_TSTAMP_ENABLE
qca-nss-drv-objs += \
@@ -292,6 +315,7 @@ endif
ifeq ($(SoC),$(filter $(SoC),ipq806x ipq40xx))
qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \
nss_hal/ipq806x/nss_hal_pvt.o
+
ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n"
ccflags-y += -DNSS_DRV_IPSEC_ENABLE
qca-nss-drv-objs += \
@@ -317,7 +341,16 @@ ccflags-y += -I$(obj)/nss_hal/ipq806x -D
endif
ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64 ipq807x ipq807x_64))
-qca-nss-drv-objs += nss_data_plane/nss_data_plane.o
+qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \
+ nss_ppe.o \
+ nss_ppe_log.o \
+ nss_ppe_stats.o \
+ nss_ppe_vp.o \
+ nss_ppe_vp_log.o \
+ nss_ppe_vp_stats.o
+
+ccflags-y += -DNSS_DRV_PPE_ENABLE
+ccflags-y += -DNSS_DRV_EDMA_ENABLE
ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n"
ccflags-y += -DNSS_DRV_IPSEC_ENABLE
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -458,16 +458,20 @@ int nss_hal_probe(struct platform_device
@@ -489,6 +489,7 @@ int nss_hal_probe(struct platform_device
nss_portid_register_handler();
}
#endif
+#ifdef NSS_DRV_PPPOE_ENABLE
if (npd->pppoe_enabled == NSS_FEATURE_ENABLED) {
nss_top->pppoe_handler_id = nss_dev->id;
nss_pppoe_register_handler();
}
+#endif
+#ifdef NSS_DRV_PPE_ENABLE
if (npd->ppe_enabled == NSS_FEATURE_ENABLED) {
nss_top->ppe_handler_id = nss_dev->id;
nss_ppe_register_handler();
nss_ppe_vp_register_handler();
}
+#endif
#ifdef NSS_DRV_L2TP_ENABLE
if (npd->l2tpv2_enabled == NSS_FEATURE_ENABLED) {
@@ -554,6 +558,7 @@ int nss_hal_probe(struct platform_device
}
#endif
+#ifdef NSS_DRV_WIFI_ENABLE
if (npd->wifioffload_enabled == NSS_FEATURE_ENABLED) {
nss_top->wifi_handler_id = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_VAP] = nss_dev->id;
@@ -569,6 +574,7 @@ int nss_hal_probe(struct platform_device
nss_top->wmdb_handler_id = nss_dev->id;
nss_wifi_mac_db_register_handler();
@@ -506,6 +507,7 @@ int nss_hal_probe(struct platform_device
nss_top->oam_handler_id = nss_dev->id;
nss_oam_register_handler();
}
+#endif
#ifdef NSS_DRV_OAM_ENABLE
if (npd->oam_enabled == NSS_FEATURE_ENABLED) {
@@ -583,11 +589,13 @@ int nss_hal_probe(struct platform_device
if (npd->bridge_enabled == NSS_FEATURE_ENABLED) {
nss_top->bridge_handler_id = nss_dev->id;
@@ -513,11 +515,13 @@ int nss_hal_probe(struct platform_device
nss_bridge_init();
}
@ -185,25 +28,11 @@
}
+#endif
#ifdef NSS_DRV_QVPN_ENABLE
#if defined(NSS_HAL_IPQ807x_SUPPORT) || defined(NSS_HAL_IPQ60XX_SUPPORT)
@@ -641,11 +649,13 @@ int nss_hal_probe(struct platform_device
}
#endif
+#ifdef NSS_DRV_MATCH_ENABLE
if (npd->match_enabled == NSS_FEATURE_ENABLED) {
nss_top->match_handler_id = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_MATCH] = nss_dev->id;
nss_match_init();
}
+#endif
#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1))
#ifdef NSS_DRV_TLS_ENABLE
if (npd->qvpn_enabled == NSS_FEATURE_ENABLED) {
--- a/nss_init.c
+++ b/nss_init.c
@@ -771,11 +771,12 @@ static int __init nss_init(void)
@@ -751,11 +751,12 @@ static int __init nss_init(void)
*/
nss_project_register_sysctl();
@ -217,22 +46,9 @@
/*
* Setup Runtime Sample values
*/
@@ -860,9 +861,9 @@ static int __init nss_init(void)
/*
* INIT ppe on supported platform
@@ -866,10 +867,12 @@ static void __exit nss_cleanup(void)
*/
- if (of_machine_is_compatible("qcom,ipq807x") || of_machine_is_compatible("qcom,ipq8074")|| of_machine_is_compatible("qcom,ipq6018")) {
- nss_ppe_init();
- }
+#ifdef NSS_DRV_PPE_ENABLE
+ nss_ppe_init();
+#endif
#ifdef NSS_DRV_DMA_ENABLE
nss_dma_init();
@@ -902,10 +903,12 @@ static void __exit nss_cleanup(void)
nss_c2c_tx_unregister_sysctl();
#endif
+#ifdef NSS_DRV_PPPOE_ENABLE
/*
@ -243,7 +59,7 @@
/*
* Unregister ipv4/6 specific sysctl
@@ -925,9 +928,9 @@ static void __exit nss_cleanup(void)
@@ -889,9 +892,9 @@ static void __exit nss_cleanup(void)
/*
* cleanup ppe on supported platform
*/

View File

@ -1,716 +0,0 @@
--- a/Makefile
+++ b/Makefile
@@ -8,8 +8,6 @@ obj-m += qca-nss-drv.o
# List the files that belong to the driver in alphabetical order.
#
qca-nss-drv-objs := \
- nss_bridge.o \
- nss_bridge_log.o \
nss_cmn.o \
nss_core.o \
nss_coredump.o \
@@ -18,9 +16,6 @@ qca-nss-drv-objs := \
nss_dynamic_interface.o \
nss_dynamic_interface_log.o \
nss_dynamic_interface_stats.o \
- nss_edma.o \
- nss_edma_stats.o \
- nss_edma_strings.o \
nss_eth_rx.o \
nss_eth_rx_stats.o \
nss_eth_rx_strings.o \
@@ -32,16 +27,6 @@ qca-nss-drv-objs := \
nss_ipv4_stats.o \
nss_ipv4_strings.o \
nss_ipv4_log.o \
- nss_ipv4_reasm.o \
- nss_ipv4_reasm_stats.o \
- nss_ipv4_reasm_strings.o \
- nss_ipv6.o \
- nss_ipv6_stats.o \
- nss_ipv6_strings.o \
- nss_ipv6_log.o \
- nss_ipv6_reasm.o \
- nss_ipv6_reasm_stats.o \
- nss_ipv6_reasm_strings.o \
nss_log.o \
nss_lso_rx.o \
nss_lso_rx_stats.o \
@@ -104,6 +89,21 @@ qca-nss-drv-objs += nss_wifi.o \
nss_wifi_mac_db.o
endif
+ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_BRIDGE_ENABLE
+qca-nss-drv-objs += \
+ nss_bridge.o \
+ nss_bridge_log.o
+endif
+
+ifneq "$(NSS_DRV_IPV4_REASM_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_IPV4_REASM_ENABLE
+qca-nss-drv-objs += \
+ nss_ipv4_reasm.o \
+ nss_ipv4_reasm_stats.o \
+ nss_ipv4_reasm_strings.o
+endif
+
ifneq "$(NSS_DRV_L2TP_ENABLE)" "n"
ccflags-y += -DNSS_DRV_L2TP_ENABLE
qca-nss-drv-objs += \
@@ -128,20 +128,20 @@ qca-nss-drv-objs += \
nss_pvxlan_stats.o
endif
-ifneq "$(NSS_DRV_MATCH_ENABLE)" "n"
-ccflags-y += -DNSS_DRV_MATCH_ENABLE
+ifneq "$(NSS_DRV_IPV6_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_IPV6_ENABLE
qca-nss-drv-objs += \
- nss_match.o \
- nss_match_log.o \
- nss_match_stats.o
+ nss_ipv6.o \
+ nss_ipv6_stats.o \
+ nss_ipv6_strings.o \
+ nss_ipv6_log.o
+ifneq "$(NSS_DRV_IPV6_REASM_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_IPV6_REASM_ENABLE
+qca-nss-drv-objs += \
+ nss_ipv6_reasm.o \
+ nss_ipv6_reasm_stats.o \
+ nss_ipv6_reasm_strings.o
endif
-
-ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n"
-ccflags-y += -DNSS_DRV_MIRROR_ENABLE
-qca-nss-drv-objs += \
- nss_mirror.o \
- nss_mirror_log.o \
- nss_mirror_stats.o
endif
ifneq "$(NSS_DRV_TSTAMP_ENABLE)" "n"
@@ -292,17 +292,6 @@ qca-nss-drv-objs += \
nss_clmap_stats.o
endif
-ifneq "$(NSS_DRV_C2C_ENABLE)" "n"
-ccflags-y += -DNSS_DRV_C2C_ENABLE
-qca-nss-drv-objs += \
- nss_c2c_tx.o \
- nss_c2c_tx_log.o \
- nss_c2c_tx_stats.o \
- nss_c2c_tx_strings.o \
- nss_c2c_rx.o \
- nss_c2c_rx_stats.o \
- nss_c2c_rx_strings.o
-endif
ifneq "$(NSS_DRV_VXLAN_ENABLE)" "n"
ccflags-y += -DNSS_DRV_VXLAN_ENABLE
@@ -312,10 +301,37 @@ qca-nss-drv-objs += \
nss_vxlan_stats.o
endif
-ifeq ($(SoC),$(filter $(SoC),ipq806x ipq40xx))
+ifneq "$(NSS_DRV_MATCH_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_MATCH_ENABLE
+qca-nss-drv-objs += \
+ nss_match.o \
+ nss_match_log.o \
+ nss_match_stats.o
+endif
+
+ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_MIRROR_ENABLE
+qca-nss-drv-objs += \
+ nss_mirror.o \
+ nss_mirror_log.o \
+ nss_mirror_stats.o
+endif
+
+ifeq ($(SoC),$(filter $(SoC),ipq806x))
qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \
nss_hal/ipq806x/nss_hal_pvt.o
+ifneq "$(NSS_DRV_C2C_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_C2C_ENABLE
+qca-nss-drv-objs += \
+ nss_c2c_tx.o \
+ nss_c2c_tx_log.o \
+ nss_c2c_tx_stats.o \
+ nss_c2c_tx_strings.o \
+ nss_c2c_rx.o \
+ nss_c2c_rx_stats.o \
+ nss_c2c_rx_strings.o
+endif
ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n"
ccflags-y += -DNSS_DRV_IPSEC_ENABLE
qca-nss-drv-objs += \
@@ -342,6 +358,9 @@ endif
ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64 ipq807x ipq807x_64))
qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \
+ nss_edma.o \
+ nss_edma_stats.o \
+ nss_edma_strings.o \
nss_ppe.o \
nss_ppe_log.o \
nss_ppe_stats.o \
@@ -382,9 +401,9 @@ endif
ifneq "$(NSS_DRV_QVPN_ENABLE)" "n"
ccflags-y += -DNSS_DRV_QVPN_ENABLE
qca-nss-drv-objs += \
- nss_qvpn.o \
- nss_qvpn_stats.o \
- nss_qvpn_log.o
+ nss_qvpn.o \
+ nss_qvpn_log.o \
+ nss_qvpn_stats.o
endif
ifneq "$(NSS_DRV_TLS_ENABLE)" "n"
ccflags-y += -DNSS_DRV_TLS_ENABLE
@@ -397,6 +416,17 @@ endif
ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64))
qca-nss-drv-objs += nss_hal/ipq807x/nss_hal_pvt.o \
nss_data_plane/hal/nss_ipq807x.o
+ifneq "$(NSS_DRV_C2C_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_C2C_ENABLE
+qca-nss-drv-objs += \
+ nss_c2c_tx.o \
+ nss_c2c_tx_log.o \
+ nss_c2c_tx_stats.o \
+ nss_c2c_tx_strings.o \
+ nss_c2c_rx.o \
+ nss_c2c_rx_stats.o \
+ nss_c2c_rx_strings.o
+endif
ccflags-y += -I$(obj)/nss_hal/ipq807x -DNSS_HAL_IPQ807x_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT
endif
@@ -437,7 +467,7 @@ endif
ccflags-y += -I$(obj)/nss_hal/include -I$(obj)/nss_data_plane/include -I$(obj)/exports -DNSS_DEBUG_LEVEL=0 -DNSS_PKT_STATS_ENABLED=1
ccflags-y += -I$(obj)/nss_data_plane/hal/include
ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_REUSE_SUPPORT=1
-ccflags-y += -Werror
+ccflags-y += -Wall -Werror
KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION)))
--- a/nss_core.c
+++ b/nss_core.c
@@ -895,7 +895,7 @@ static inline void nss_core_handle_buffe
/*
* linearize or free if requested.
*/
- if (unlikely(skb_is_nonlinear(nbuf))) {
+ if (unlikely(skb_is_nonlinear(nbuf))) {
if (nss_core_skb_needs_linearize(nbuf, ndev->features) && __skb_linearize(nbuf)) {
dev_kfree_skb_any(nbuf);
return;
@@ -953,11 +953,11 @@ static inline void nss_core_handle_ext_b
ext_cb = subsys_dp_reg->ext_cb;
if (likely(ext_cb) && likely(ndev)) {
- if (unlikely(skb_is_nonlinear(nbuf))) {
+ if (unlikely(skb_is_nonlinear(nbuf))) {
if (nss_core_skb_needs_linearize(nbuf, ndev->features) && __skb_linearize(nbuf)) {
/*
- * We needed to linearize, but __skb_linearize() failed. So free the nbuf.
- */
+ * We needed to linearize, but __skb_linearize() failed. So free the nbuf.
+ */
dev_kfree_skb_any(nbuf);
return;
}
@@ -1067,6 +1067,21 @@ static inline void nss_core_rx_pbuf(stru
}
/*
+ * nss_core_set_skb_classify()
+ * Set skb field to avoid ingress shaping.
+ */
+static inline void nss_core_set_skb_classify(struct sk_buff *nbuf)
+{
+#ifdef CONFIG_NET_CLS_ACT
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
+ nbuf->tc_verd = SET_TC_NCLS_NSS(nbuf->tc_verd);
+#else
+ skb_skip_tc_classify(nbuf);
+#endif
+#endif
+}
+
+/*
* nss_core_handle_nrfrag_skb()
* Handled the processing of fragmented skb's
*/
@@ -1119,9 +1134,10 @@ static inline bool nss_core_handle_nr_fr
* ingress shaped flag set.
*/
if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss);
+ nss_core_set_skb_classify(nbuf);
}
#endif
+
goto pull;
}
@@ -1159,7 +1175,7 @@ static inline bool nss_core_handle_nr_fr
* ingress shaped flag set.
*/
if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss);
+ nss_core_set_skb_classify(nbuf);
}
#endif
@@ -1274,7 +1290,7 @@ static inline bool nss_core_handle_linea
* ingress shaped flag set.
*/
if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss);
+ nss_core_set_skb_classify(nbuf);
}
#endif
@@ -1332,7 +1348,7 @@ static inline bool nss_core_handle_linea
* ingress shaped flag set.
*/
if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss);
+ nss_core_set_skb_classify(nbuf);
}
#endif
@@ -1702,7 +1718,7 @@ static void nss_core_init_nss(struct nss
if (nss_ctx->id) {
ret = nss_n2h_update_queue_config_async(nss_ctx, pn_mq_en, pn_qlimits);
if (ret != NSS_TX_SUCCESS) {
- nss_warning("Failed to send pnode queue config to core 1\n");
+ nss_warning("%px: Failed to send pnode queue config to core 1\n", nss_ctx);
}
return;
}
@@ -1717,9 +1733,14 @@ static void nss_core_init_nss(struct nss
* connections supported by the accelerator.
*/
nss_ipv4_conn_cfg = max_ipv4_conn;
+
+#ifdef NSS_DRV_IPV6_ENABLE
nss_ipv6_conn_cfg = max_ipv6_conn;
nss_ipv4_update_conn_count(max_ipv4_conn);
nss_ipv6_update_conn_count(max_ipv6_conn);
+#else
+ nss_ipv4_update_conn_count(max_ipv4_conn);
+#endif
#ifdef NSS_MEM_PROFILE_LOW
/*
--- a/nss_core.h
+++ b/nss_core.h
@@ -232,6 +232,8 @@ static inline void nss_core_dma_cache_ma
* INFO: The LOW and MAX value together describe the "performance" band that we should operate the frequency at.
*
*/
+#define NSS_FREQ_SCALE_NA 0xFAADFAAD /* Frequency scale not supported */
+
#define NSS_FREQ_110 110000000 /* Frequency in hz */
#define NSS_FREQ_110_MIN 0x03000 /* Instructions Per ms Min */
#define NSS_FREQ_110_MAX 0x07000 /* Instructions Per ms Max */
--- a/nss_coredump.c
+++ b/nss_coredump.c
@@ -1,6 +1,8 @@
/*
**************************************************************************
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -47,7 +49,8 @@ static struct workqueue_struct *coredump
*/
static void nss_coredump_wait(struct work_struct *work)
{
- panic("did not get all coredump finished signals\n");
+ if (!(nss_cmd_buf.coredump & 0xFFFFFFFE))
+ panic("did not get all coredump finished signals\n");
}
/*
--- a/nss_dma.c
+++ b/nss_dma.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -120,7 +120,7 @@ static void nss_dma_msg_handler(struct n
*/
if (ndm->cm.type == NSS_DMA_MSG_TYPE_SYNC_STATS) {
nss_dma_stats_sync(nss_ctx, &ndm->msg.stats);
-
+ nss_dma_stats_notify(nss_ctx);
}
/*
--- a/nss_dma_stats.c
+++ b/nss_dma_stats.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -17,10 +17,16 @@
*/
#include "nss_core.h"
+#include "nss_dma.h"
#include "nss_dma_stats.h"
#include "nss_dma_strings.h"
/*
+ * Declare atomic notifier data structure for statistics.
+ */
+ATOMIC_NOTIFIER_HEAD(nss_dma_stats_notifier);
+
+/*
* Spinlock to protect DMA statistics update/read
*/
DEFINE_SPINLOCK(nss_dma_stats_lock);
@@ -117,3 +123,41 @@ void nss_dma_stats_sync(struct nss_ctx_i
spin_unlock_bh(&nss_dma_stats_lock);
}
+
+/*
+ * nss_dma_stats_notify()
+ * Sends notifications to all the registered modules.
+ *
+ * Leverage NSS-FW statistics timing to update Netlink.
+ */
+void nss_dma_stats_notify(struct nss_ctx_instance *nss_ctx)
+{
+ struct nss_dma_stats_notification dma_stats;
+
+ spin_lock_bh(&nss_dma_stats_lock);
+ dma_stats.core_id = nss_ctx->id;
+ memcpy(dma_stats.stats_ctx, nss_dma_stats, sizeof(dma_stats.stats_ctx));
+ spin_unlock_bh(&nss_dma_stats_lock);
+
+ atomic_notifier_call_chain(&nss_dma_stats_notifier, NSS_STATS_EVENT_NOTIFY, &dma_stats);
+}
+
+/*
+ * nss_dma_stats_unregister_notifier()
+ * Deregisters statistics notifier.
+ */
+int nss_dma_stats_unregister_notifier(struct notifier_block *nb)
+{
+ return atomic_notifier_chain_unregister(&nss_dma_stats_notifier, nb);
+}
+EXPORT_SYMBOL(nss_dma_stats_unregister_notifier);
+
+/*
+ * nss_dma_stats_register_notifier()
+ * Registers statistics notifier.
+ */
+int nss_dma_stats_register_notifier(struct notifier_block *nb)
+{
+ return atomic_notifier_chain_register(&nss_dma_stats_notifier, nb);
+}
+EXPORT_SYMBOL(nss_dma_stats_register_notifier);
--- a/nss_hal/ipq806x/nss_hal_pvt.c
+++ b/nss_hal/ipq806x/nss_hal_pvt.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2013, 2015-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013, 2015-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -464,6 +464,7 @@ static struct nss_platform_data *__nss_h
goto out;
}
+ nss_assert(npd->vphys);
npd->vmap = ioremap_cache(npd->vphys, resource_size(&res_vphys));
if (!npd->vmap) {
nss_info_always("%px: nss%d: ioremap() fail for vphys\n", nss_ctx, nss_ctx->id);
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -41,7 +41,6 @@
/*
* Macros
*/
-#define MIN_IMG_SIZE (64*1024)
#define NSS_AP0_IMAGE "qca-nss0.bin"
#define NSS_AP1_IMAGE "qca-nss1.bin"
@@ -74,10 +73,6 @@ int nss_hal_firmware_load(struct nss_ctx
return rc;
}
- if (nss_fw->size < MIN_IMG_SIZE) {
- nss_info_always("%px: nss firmware is truncated, size:%d", nss_ctx, (int)nss_fw->size);
- return rc;
- }
load_mem = ioremap(npd->load_addr, nss_fw->size);
if (!load_mem) {
@@ -293,7 +288,6 @@ int nss_hal_probe(struct platform_device
* Physical address of logical registers space
*/
nss_ctx->vphys = npd->vphys;
- nss_assert(nss_ctx->vphys);
nss_info("%d:ctx=%px, vphys=%x, vmap=%px, nphys=%x, nmap=%px", nss_ctx->id,
nss_ctx, nss_ctx->vphys, nss_ctx->vmap, nss_ctx->nphys, nss_ctx->nmap);
@@ -364,8 +358,10 @@ int nss_hal_probe(struct platform_device
nss_top->ipv4_handler_id = nss_dev->id;
nss_ipv4_register_handler();
+#ifdef NSS_DRV_EDMA_ENABLE
nss_top->edma_handler_id = nss_dev->id;
nss_edma_register_handler();
+#endif
nss_eth_rx_register_handler(nss_ctx);
#ifdef NSS_DRV_LAG_ENABLE
nss_lag_register_handler();
@@ -389,20 +385,27 @@ int nss_hal_probe(struct platform_device
}
#endif
#endif
+
+#ifdef NSS_DRV_IPV4_REASM_ENABLE
if (npd->ipv4_reasm_enabled == NSS_FEATURE_ENABLED) {
nss_top->ipv4_reasm_handler_id = nss_dev->id;
nss_ipv4_reasm_register_handler();
}
+#endif
+#ifdef NSS_DRV_IPV6_ENABLE
if (npd->ipv6_enabled == NSS_FEATURE_ENABLED) {
nss_top->ipv6_handler_id = nss_dev->id;
nss_ipv6_register_handler();
}
+#ifdef NSS_DRV_IPV6_REASM_ENABLE
if (npd->ipv6_reasm_enabled == NSS_FEATURE_ENABLED) {
nss_top->ipv6_reasm_handler_id = nss_dev->id;
nss_ipv6_reasm_register_handler();
}
+#endif
+#endif
#ifdef NSS_DRV_CRYPTO_ENABLE
/*
@@ -583,11 +586,13 @@ int nss_hal_probe(struct platform_device
}
#endif
+#ifdef NSS_DRV_BRIDGE_ENABLE
if (npd->bridge_enabled == NSS_FEATURE_ENABLED) {
nss_top->bridge_handler_id = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE] = nss_dev->id;
nss_bridge_init();
}
+#endif
#ifdef NSS_DRV_VLAN_ENABLE
if (npd->vlan_enabled == NSS_FEATURE_ENABLED) {
--- a/nss_hlos_if.h
+++ b/nss_hlos_if.h
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2019, 2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -33,7 +33,11 @@
*/
#if defined (NSS_MEM_PROFILE_LOW)
#define NSS_DEFAULT_NUM_CONN 512 /* Default number of connections for IPv4 and IPv6 each, for low memory profile */
+#if defined (NSS_DRV_IPV6_ENABLE)
#define NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6 1024 /* MAX Connection shared between IPv4 and IPv6 for low memory profile */
+#else
+#define NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6 512 /* MAX Connection for IPv4 for low memory profile */
+#endif
#define NSS_LOW_MEM_EMPTY_POOL_BUF_SZ 4096 /* Default empty buffer pool size for low profile */
#elif defined (NSS_MEM_PROFILE_MEDIUM)
#define NSS_DEFAULT_NUM_CONN 2048 /* Default number of connections for IPv4 and IPv6 each, for medium memory profile */
--- a/nss_init.c
+++ b/nss_init.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -307,7 +307,9 @@ static int nss_get_freq_table_handler(st
i = 0;
while (i < NSS_FREQ_MAX_SCALE) {
- printk("%d Hz ", nss_runtime_samples.freq_scale[i].frequency);
+ if (nss_runtime_samples.freq_scale[i].frequency != NSS_FREQ_SCALE_NA) {
+ printk("%d Hz ", nss_runtime_samples.freq_scale[i].frequency);
+ }
i++;
}
printk("\n");
@@ -738,7 +740,9 @@ static int __init nss_init(void)
* Registering sysctl for ipv4/6 specific config.
*/
nss_ipv4_register_sysctl();
+#ifdef NSS_DRV_IPV6_ENABLE
nss_ipv6_register_sysctl();
+#endif
/*
* Registering sysctl for n2h specific config.
@@ -911,16 +915,15 @@ static void __exit nss_cleanup(void)
#endif
/*
- * Unregister ipv4/6 specific sysctl
+ * Unregister ipv4/6 specific sysctl and free allocated to connection tables
*/
nss_ipv4_unregister_sysctl();
- nss_ipv6_unregister_sysctl();
-
- /*
- * Free Memory allocated for connection tables
- */
nss_ipv4_free_conn_tables();
+
+#ifdef NSS_DRV_IPV6_ENABLE
+ nss_ipv6_unregister_sysctl();
nss_ipv6_free_conn_tables();
+#endif
nss_project_unregister_sysctl();
nss_data_plane_destroy_delay_work();
--- a/nss_meminfo.c
+++ b/nss_meminfo.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -311,6 +311,15 @@ static bool nss_meminfo_init_block_lists
switch (mtype) {
case NSS_MEMINFO_MEMTYPE_IMEM:
/*
+ * For SOC's where TCM is not present
+ */
+ if (!nss_ctx->vphys) {
+ nss_info_always("%px:IMEM requested but TCM not defined "
+ "for this SOC\n", nss_ctx);
+ goto cleanup;
+ }
+
+ /*
* Return SoC real address for IMEM as DMA address.
*/
dma_addr = nss_meminfo_alloc_imem(nss_ctx, r->size, r->alignment);
@@ -453,6 +462,15 @@ static bool nss_meminfo_allocate_n2h_h2n
}
break;
case NSS_MEMINFO_MEMTYPE_IMEM:
+ /*
+ * For SOC's where TCM is not present
+ */
+ if (!nss_ctx->vphys) {
+ nss_info_always("%px:IMEM requested but TCM not defined "
+ "for this SOC\n", nss_ctx);
+ return false;
+ }
+
info->dma_addr = nss_meminfo_alloc_imem(nss_ctx, info->total_size, L1_CACHE_BYTES);
if (!info->dma_addr)
return false;
@@ -517,6 +535,13 @@ static bool nss_meminfo_configure_n2h_h2
}
/*
+ * Returning true allows to execute firmware bin
+ */
+ if (!mem_ctx->if_map) {
+ return true;
+ }
+
+ /*
* Bring a fresh copy of if_map from memory in order to read it correctly.
*/
if_map = mem_ctx->if_map;
@@ -705,7 +730,6 @@ bool nss_meminfo_init(struct nss_ctx_ins
struct nss_meminfo_map *map;
struct nss_top_instance *nss_top = &nss_top_main;
- NSS_VERIFY_CTX_MAGIC(nss_ctx);
mem_ctx = &nss_ctx->meminfo_ctx;
/*
--- a/nss_profiler.c
+++ b/nss_profiler.c
@@ -153,8 +153,10 @@ void nss_profiler_release_dma(struct nss
ctrl = nss_ctx->meminfo_ctx.sdma_ctrl;
- if (ctrl && ctrl->consumer[0].ring.kp)
+ if (ctrl && ctrl->consumer[0].ring.kp) {
kfree(ctrl->consumer[0].ring.kp);
+ ctrl->consumer[0].ring.kp = NULL;
+ }
}
EXPORT_SYMBOL(nss_profiler_release_dma);
@@ -198,10 +200,12 @@ EXPORT_SYMBOL(nss_profile_dma_deregister
struct nss_profile_sdma_ctrl *nss_profile_dma_get_ctrl(struct nss_ctx_instance *nss_ctx)
{
struct nss_profile_sdma_ctrl *ctrl = nss_ctx->meminfo_ctx.sdma_ctrl;
- if (ctrl) {
- dmac_inv_range(ctrl, &ctrl->cidx);
- dsb(sy);
+ if (!ctrl) {
+ return ctrl;
}
+
+ dmac_inv_range(ctrl, &ctrl->cidx);
+ dsb(sy);
return ctrl;
}
EXPORT_SYMBOL(nss_profile_dma_get_ctrl);
@@ -233,7 +237,7 @@ void nss_profiler_notify_unregister(nss_
{
nss_assert(core_id < NSS_CORE_MAX);
- nss_core_register_handler(&nss_top_main.nss[core_id], NSS_PROFILER_INTERFACE, NULL, NULL);
+ nss_core_unregister_handler(&nss_top_main.nss[core_id], NSS_PROFILER_INTERFACE);
nss_top_main.profiler_callback[core_id] = NULL;
nss_top_main.profiler_ctx[core_id] = NULL;
}

View File

@ -1,372 +0,0 @@
--- a/exports/nss_api_if.h
+++ b/exports/nss_api_if.h
@@ -119,7 +119,11 @@
#define NSS_MAX_PHYSICAL_INTERFACES 8 /**< Maximum number of physical interfaces. */
#define NSS_MAX_VIRTUAL_INTERFACES 16 /**< Maximum number of virtual interfaces. */
#define NSS_MAX_TUNNEL_INTERFACES 4 /**< Maximum number of tunnel interfaces. */
+#if (NSS_FW_VERSION_CODE < NSS_FW_VERSION(11,1))
+#define NSS_MAX_SPECIAL_INTERFACES 55 /**< Maximum number of special interfaces. */
+#else
#define NSS_MAX_SPECIAL_INTERFACES 67 /**< Maximum number of special interfaces. */
+#endif
#define NSS_MAX_WIFI_RADIO_INTERFACES 3 /**< Maximum number of radio interfaces. */
/*
@@ -253,6 +257,10 @@
/**< Special interface number for timestamp receive. */
#define NSS_GRE_REDIR_MARK_INTERFACE (NSS_SPECIAL_IF_START + 56)
/**< Special interface number for GRE redirect mark. */
+#if (NSS_FW_VERSION_CODE < NSS_FW_VERSION(11,1))
+#define NSS_RMNET_RX_INTERFACE (NSS_SPECIAL_IF_START + 57)
+ /**< Special interface number for RMNET receive handler. */
+#else
#define NSS_VXLAN_INTERFACE (NSS_SPECIAL_IF_START + 57)
/**< Special interface number for VxLAN handler. */
#define NSS_RMNET_RX_INTERFACE (NSS_SPECIAL_IF_START + 58)
@@ -269,7 +277,7 @@
/**< Special interface number for the Wi-Fi MAC database. */
#define NSS_DMA_INTERFACE (NSS_SPECIAL_IF_START + 66)
/**< Special interface number for the DMA interface. */
-
+#endif
#ifdef __KERNEL__ /* only kernel will use. */
--- a/exports/nss_dynamic_interface.h
+++ b/exports/nss_dynamic_interface.h
@@ -59,7 +59,11 @@ enum nss_dynamic_interface_type {
NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE,
NSS_DYNAMIC_INTERFACE_TYPE_VLAN,
NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_3,
+#if (NSS_FW_VERSION_CODE <= NSS_FW_VERSION(11,0))
+ NSS_DYNAMIC_INTERFACE_TYPE_WIFILI,
+#else
NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_INTERNAL,
+#endif
NSS_DYNAMIC_INTERFACE_TYPE_MAP_T_INNER,
NSS_DYNAMIC_INTERFACE_TYPE_MAP_T_OUTER,
NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER,
@@ -96,14 +100,16 @@ enum nss_dynamic_interface_type {
NSS_DYNAMIC_INTERFACE_TYPE_IGS,
NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_US,
NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_DS,
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
NSS_DYNAMIC_INTERFACE_TYPE_VXLAN_INNER,
NSS_DYNAMIC_INTERFACE_TYPE_VXLAN_OUTER,
NSS_DYNAMIC_INTERFACE_TYPE_MATCH,
+#endif
NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_N2H,
NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N,
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0,
NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1,
-#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1))
NSS_DYNAMIC_INTERFACE_TYPE_TLS_INNER,
NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER,
NSS_DYNAMIC_INTERFACE_TYPE_MIRROR,
--- a/nss_core.c
+++ b/nss_core.c
@@ -924,6 +924,7 @@ static inline void nss_core_handle_buffe
dev_put(ndev);
}
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
/*
* nss_core_handle_ext_buffer_pkt()
* Handle Extended data plane packet received on physical or virtual interface.
@@ -968,6 +969,7 @@ static inline void nss_core_handle_ext_b
dev_kfree_skb_any(nbuf);
}
}
+#endif
/*
* nss_core_rx_pbuf()
@@ -984,7 +986,9 @@ static inline void nss_core_rx_pbuf(stru
NSS_PKT_STATS_DEC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_NSS_SKB_COUNT]);
if (interface_num >= NSS_MAX_NET_INTERFACES) {
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_INVALID_INTERFACE]);
+#endif
nss_warning("%px: Invalid interface_num: %d", nss_ctx, interface_num);
dev_kfree_skb_any(nbuf);
return;
@@ -994,7 +998,9 @@ static inline void nss_core_rx_pbuf(stru
* Check if core_id value is valid.
*/
if (core_id > nss_top_main.num_nss) {
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_INVALID_CORE_ID]);
+#endif
nss_warning("%px: Invalid core id: %d", nss_ctx, core_id);
dev_kfree_skb_any(nbuf);
return;
@@ -1026,9 +1032,11 @@ static inline void nss_core_rx_pbuf(stru
nss_core_handle_bounced_pkt(nss_ctx, reg, nbuf);
break;
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
case N2H_BUFFER_PACKET_EXT:
nss_core_handle_ext_buffer_pkt(nss_ctx, interface_num, nbuf, napi, desc->bit_flags);
break;
+#endif
case N2H_BUFFER_STATUS:
NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_STATUS]);
@@ -1060,7 +1068,9 @@ static inline void nss_core_rx_pbuf(stru
break;
default:
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_RX_INVALID_BUFFER_TYPE]);
+#endif
nss_warning("%px: Invalid buffer type %d received from NSS", nss_ctx, buffer_type);
dev_kfree_skb_any(nbuf);
}
--- a/nss_dynamic_interface_stats.c
+++ b/nss_dynamic_interface_stats.c
@@ -43,7 +43,11 @@ const char *nss_dynamic_interface_type_n
"NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE",
"NSS_DYNAMIC_INTERFACE_TYPE_VLAN",
"NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_3",
+#if (NSS_FW_VERSION_CODE <= NSS_FW_VERSION(11,0))
+ "NSS_DYNAMIC_INTERFACE_TYPE_WIFILI",
+#else
"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_INTERNAL",
+#endif
"NSS_DYNAMIC_INTERFACE_TYPE_MAP_T_INNER",
"NSS_DYNAMIC_INTERFACE_TYPE_MAP_T_OUTER",
"NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER",
@@ -80,13 +84,22 @@ const char *nss_dynamic_interface_type_n
"NSS_DYNAMIC_INTERFACE_TYPE_IGS",
"NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_US",
"NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_DS",
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
"NSS_DYNAMIC_INTERFACE_TYPE_VXLAN_INNER",
"NSS_DYNAMIC_INTERFACE_TYPE_VXLAN_OUTER",
"NSS_DYNAMIC_INTERFACE_TYPE_MATCH",
+#endif
"NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_N2H",
"NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N",
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0",
"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1",
+#endif
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1))
+ "NSS_DYNAMIC_INTERFACE_TYPE_TLS_INNER",
+ "NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER",
+ "NSS_DYNAMIC_INTERFACE_TYPE_MIRROR",
+#endif
};
/*
--- a/nss_n2h_strings.c
+++ b/nss_n2h_strings.c
@@ -38,14 +38,14 @@ struct nss_stats_info nss_n2h_strings_st
{"ticks" , NSS_STATS_TYPE_SPECIAL},
{"worst_ticks" , NSS_STATS_TYPE_SPECIAL},
{"iterations" , NSS_STATS_TYPE_SPECIAL},
- {"pbuf_ocm_total_count" , NSS_STATS_TYPE_SPECIAL},
- {"pbuf_ocm_free_count" , NSS_STATS_TYPE_SPECIAL},
{"pbuf_ocm_alloc_fail_payload" , NSS_STATS_TYPE_SPECIAL},
+ {"pbuf_ocm_free_count" , NSS_STATS_TYPE_SPECIAL},
+ {"pbuf_ocm_total_count" , NSS_STATS_TYPE_SPECIAL},
{"pbuf_ocm_alloc_fail_nopayload", NSS_STATS_TYPE_SPECIAL},
- {"pbuf_def_total_count" , NSS_STATS_TYPE_SPECIAL},
- {"pbuf_def_free_count" , NSS_STATS_TYPE_SPECIAL},
{"pbuf_def_alloc_fail_payload" , NSS_STATS_TYPE_SPECIAL},
+ {"pbuf_def_free_count" , NSS_STATS_TYPE_SPECIAL},
{"pbuf_def_alloc_fail_nopayload", NSS_STATS_TYPE_SPECIAL},
+ {"pbuf_def_total_count" , NSS_STATS_TYPE_SPECIAL},
{"payload_alloc_fails" , NSS_STATS_TYPE_SPECIAL},
{"payload_free_count" , NSS_STATS_TYPE_SPECIAL},
{"h2n_control_pkts" , NSS_STATS_TYPE_SPECIAL},
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -88,6 +88,7 @@ int nss_hal_firmware_load(struct nss_ctx
return 0;
}
+
/*
* nss_hal_dt_parse_features()
*/
@@ -98,14 +99,12 @@ void nss_hal_dt_parse_features(struct de
*/
npd->bridge_enabled = of_property_read_bool(np, "qcom,bridge-enabled");
npd->capwap_enabled = of_property_read_bool(np, "qcom,capwap-enabled");
- npd->clmap_enabled = of_property_read_bool(np, "qcom,clmap-enabled");
npd->crypto_enabled = of_property_read_bool(np, "qcom,crypto-enabled");
npd->dtls_enabled = of_property_read_bool(np, "qcom,dtls-enabled");
npd->gre_enabled = of_property_read_bool(np, "qcom,gre-enabled");
npd->gre_redir_enabled = of_property_read_bool(np, "qcom,gre-redir-enabled");
npd->gre_tunnel_enabled = of_property_read_bool(np, "qcom,gre_tunnel_enabled");
npd->gre_redir_mark_enabled = of_property_read_bool(np, "qcom,gre-redir-mark-enabled");
- npd->igs_enabled = of_property_read_bool(np, "qcom,igs-enabled");
npd->ipsec_enabled = of_property_read_bool(np, "qcom,ipsec-enabled");
npd->ipv4_enabled = of_property_read_bool(np, "qcom,ipv4-enabled");
npd->ipv4_reasm_enabled = of_property_read_bool(np, "qcom,ipv4-reasm-enabled");
@@ -119,20 +118,18 @@ void nss_hal_dt_parse_features(struct de
npd->pptp_enabled = of_property_read_bool(np, "qcom,pptp-enabled");
npd->portid_enabled = of_property_read_bool(np, "qcom,portid-enabled");
npd->pvxlan_enabled = of_property_read_bool(np, "qcom,pvxlan-enabled");
+ npd->clmap_enabled = of_property_read_bool(np, "qcom,clmap-enabled");
npd->qvpn_enabled = of_property_read_bool(np, "qcom,qvpn-enabled");
npd->rmnet_rx_enabled = of_property_read_bool(np, "qcom,rmnet_rx-enabled");
npd->shaping_enabled = of_property_read_bool(np, "qcom,shaping-enabled");
- npd->tls_enabled = of_property_read_bool(np, "qcom,tls-enabled");
npd->tstamp_enabled = of_property_read_bool(np, "qcom,tstamp-enabled");
npd->turbo_frequency = of_property_read_bool(np, "qcom,turbo-frequency");
npd->tun6rd_enabled = of_property_read_bool(np, "qcom,tun6rd-enabled");
npd->tunipip6_enabled = of_property_read_bool(np, "qcom,tunipip6-enabled");
npd->vlan_enabled = of_property_read_bool(np, "qcom,vlan-enabled");
- npd->vxlan_enabled = of_property_read_bool(np, "qcom,vxlan-enabled");
npd->wlanredirect_enabled = of_property_read_bool(np, "qcom,wlanredirect-enabled");
npd->wifioffload_enabled = of_property_read_bool(np, "qcom,wlan-dataplane-offload-enabled");
- npd->match_enabled = of_property_read_bool(np, "qcom,match-enabled");
- npd->mirror_enabled = of_property_read_bool(np, "qcom,mirror-enabled");
+ npd->igs_enabled = of_property_read_bool(np, "qcom,igs-enabled");
}
/*
* nss_hal_clean_up_irq()
@@ -567,15 +564,18 @@ int nss_hal_probe(struct platform_device
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_VAP] = nss_dev->id;
nss_wifi_register_handler();
nss_wifili_register_handler();
+#if (NSS_FW_VERSION_CODE <= NSS_FW_VERSION(11,0))
+ nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_WIFILI] = nss_dev->id;
+#else
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_INTERNAL] = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0] = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1] = nss_dev->id;
-
/*
* Register wifi mac database when offload enabled
*/
nss_top->wmdb_handler_id = nss_dev->id;
nss_wifi_mac_db_register_handler();
+#endif
}
#endif
--- a/nss_wifili.c
+++ b/nss_wifili.c
@@ -50,8 +50,11 @@ static void nss_wifili_handler(struct ns
*/
BUG_ON((nss_is_dynamic_interface(ncm->interface))
|| ((ncm->interface != NSS_WIFILI_INTERNAL_INTERFACE)
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
&& (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE0)
- && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE1)));
+ && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE1)
+#endif
+ ));
/*
* Trace messages.
@@ -172,8 +175,13 @@ nss_tx_status_t nss_wifili_tx_msg(struct
* The interface number shall be one of the wifili soc interfaces
*/
if ((ncm->interface != NSS_WIFILI_INTERNAL_INTERFACE)
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
&& (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE0)
- && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE1)) {
+ && (ncm->interface != NSS_WIFILI_EXTERNAL_INTERFACE1))
+#else
+ )
+#endif
+ {
nss_warning("%px: tx request for interface that is not a wifili: %d", nss_ctx, ncm->interface);
return NSS_TX_FAILURE;
}
@@ -230,6 +238,7 @@ EXPORT_SYMBOL(nss_wifili_get_context);
* nss_get_available_wifili_external_if()
* Check and return the available external interface
*/
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
uint32_t nss_get_available_wifili_external_if(void)
{
struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.wifi_handler_id];
@@ -250,7 +259,7 @@ uint32_t nss_get_available_wifili_extern
return NSS_MAX_NET_INTERFACES;
}
EXPORT_SYMBOL(nss_get_available_wifili_external_if);
-
+#endif
/*
* nss_wifili_msg_init()
* Initialize nss_wifili_msg.
@@ -362,9 +371,10 @@ void nss_wifili_register_handler(void)
nss_info("nss_wifili_register_handler");
nss_core_register_handler(nss_ctx, NSS_WIFILI_INTERNAL_INTERFACE, nss_wifili_handler, NULL);
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
nss_core_register_handler(nss_ctx, NSS_WIFILI_EXTERNAL_INTERFACE0, nss_wifili_handler, NULL);
nss_core_register_handler(nss_ctx, NSS_WIFILI_EXTERNAL_INTERFACE1, nss_wifili_handler, NULL);
-
+#endif
nss_wifili_stats_dentry_create();
nss_wifili_strings_dentry_create();
--- a/nss_wifili_stats.c
+++ b/nss_wifili_stats.c
@@ -248,6 +248,7 @@ void nss_wifili_stats_sync(struct nss_ct
nwss->soc_maxpdev = NSS_WIFILI_MAX_PDEV_NUM_MSG;
break;
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
case NSS_WIFILI_EXTERNAL_INTERFACE0:
nwss = &soc_stats[1];
nwss->soc_maxpdev = NSS_WIFILI_SOC_ATTACHED_MAX_PDEV_NUM;
@@ -257,6 +258,7 @@ void nss_wifili_stats_sync(struct nss_ct
nwss = &soc_stats[2];
nwss->soc_maxpdev = NSS_WIFILI_SOC_ATTACHED_MAX_PDEV_NUM;
break;
+#endif
default:
nss_warning("%px: Invalid wifili interface\n", nss_ctx);
@@ -470,6 +472,7 @@ void nss_wifili_stats_notify(struct nss_
index = 0;
break;
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
case NSS_WIFILI_EXTERNAL_INTERFACE0:
index = 1;
break;
@@ -477,6 +480,7 @@ void nss_wifili_stats_notify(struct nss_
case NSS_WIFILI_EXTERNAL_INTERFACE1:
index = 2;
break;
+#endif
default:
nss_warning("%px: Invalid wifili interface\n", nss_ctx);
--- a/Makefile
+++ b/Makefile
@@ -85,8 +85,10 @@ qca-nss-drv-objs += nss_wifi.o \
nss_wifili.o \
nss_wifili_log.o \
nss_wifili_stats.o \
- nss_wifili_strings.o \
- nss_wifi_mac_db.o
+ nss_wifili_strings.o
+ifeq ($(shell test $(TARGET_NSS_MINOR_VERSION) -gt 0; echo $$?),0)
+qca-nss-drv-objs += nss_wifi_mac_db.o
+endif
endif
ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n"
--- a/nss_tx_rx_common.h
+++ b/nss_tx_rx_common.h
@@ -96,7 +96,9 @@ extern void nss_wifili_register_handler(
extern void nss_ppe_register_handler(void);
extern void nss_gre_redir_mark_register_handler(void);
extern void nss_ppe_vp_register_handler(void);
+#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,0))
extern void nss_wifi_mac_db_register_handler(void);
+#endif
/*
* nss_if_msg_handler()