nss: Properly build drv/client based on FW

There are significant changes between NSS version 11.4.0.5 and 12.1 (12.0.5),
that it doesn't really make sense to use it with older firmware (i.e. using mesh releated
features).

This change will explicitly link building the proper driver and client
packages when FW 12.1 or 11.4 is selected, while also backporting
patches from 12.4.
This commit is contained in:
Qosmio 2024-03-09 12:25:24 -05:00
parent 79597046e6
commit 7329a4f74d
48 changed files with 5684 additions and 11 deletions

View File

@ -22,7 +22,7 @@ PKG_MAINTAINER:=Sean K <datapronix@protonmail.com>
PKG_CONFIG_DEPENDS:= \
CONFIG_NSS_FIRMWARE_VERSION_11_4 \
CONFIG_NSS_FIRMWARE_VERSION_12_0
CONFIG_NSS_FIRMWARE_VERSION_12_1
include $(INCLUDE_DIR)/package.mk
@ -68,9 +68,9 @@ define Package/nss-firmware-default/config
choice
prompt "Version"
default NSS_FIRMWARE_VERSION_12_0
default NSS_FIRMWARE_VERSION_12_1
config NSS_FIRMWARE_VERSION_12_0
config NSS_FIRMWARE_VERSION_12_1
bool "NSS Firmware 12.1 Release 022"
help
This version does not work with NSS MESH
@ -87,13 +87,11 @@ ifneq ($(CONFIG_NSS_FIRMWARE_VERSION_11_4),)
NSS_MAJOR:=11.4
NSS_MINOR:=11.4.0.5
NSS_REL:=5
NSS_PROFILE:=R
VERSION_PATH=$(PKG_BUILD_DIR)/QCA_Networking_2021.SPF_$(NSS_MAJOR)/CS
else
NSS_MAJOR:=12.0.0
NSS_MINOR:=12.1
NSS_REL:=022
NSS_PROFILE:=R
VERSION_PATH=$(PKG_BUILD_DIR)/QCA_Networking_2022.SPF_$(NSS_MAJOR)/ED1
endif
@ -101,8 +99,8 @@ define Build/Compile
endef
define Package/nss-firmware/install
$(eval NSS_ARCHIVE := $(VERSION_PATH)/$(IPQ_PLATFORM).ATH.$(NSS_MAJOR)/BIN-NSS*.$(NSS_MINOR)-$(NSS_REL)*$(NSS_PROFILE).tar.bz2)
mkdir -p $(PKG_BUILD_DIR)/$(IPQ_PLATFORM)
$(eval NSS_ARCHIVE ?= $(VERSION_PATH)/$(IPQ_PLATFORM).ATH.$(NSS_MAJOR)/BIN-NSS*.$(NSS_MINOR)-$(NSS_REL)*$(NSS_PROFILE).tar.bz2)
$(INSTALL_DIR) $(PKG_BUILD_DIR)/$(IPQ_PLATFORM)
$(TAR) -C $(PKG_BUILD_DIR)/$(IPQ_PLATFORM) -xf $(NSS_ARCHIVE) --strip-components=1
$(INSTALL_DIR) $(1)/lib/firmware/
$(INSTALL_DATA) \

View File

@ -46,7 +46,15 @@ PKG_CONFIG_DEPENDS:=\
CONFIG_NSS_DRV_VXLAN_ENABLE \
CONFIG_NSS_DRV_WIFIOFFLOAD_ENABLE \
CONFIG_NSS_DRV_WIFI_MESH_ENABLE \
CONFIG_NSS_DRV_WIFI_LEGACY_ENABLE
CONFIG_NSS_DRV_WIFI_LEGACY_ENABLE \
CONFIG_NSS_FIRMWARE_VERSION_11_4
ifdef CONFIG_NSS_FIRMWARE_VERSION_11_4
PKG_SOURCE_DATE:=2021-08-17
PKG_SOURCE_VERSION:=153998d70fdba508a59a28c13a606032cbf32686
PKG_MIRROR_HASH:=8b0eb211da44c36022ef85fe0bf7c37836333f6ffa6c312117a43e5473dffdf8
PATCH_DIR:=$(CURDIR)/patches-11.4
endif
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk

View File

@ -0,0 +1,153 @@
--- a/nss_qdisc/igs/nss_mirred.c
+++ b/nss_qdisc/igs/nss_mirred.c
@@ -82,20 +82,24 @@ static const struct nla_policy nss_mirre
* nss_mirred_init()
* Initialize the nss mirred action.
*/
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
static int nss_mirred_init(struct net *net, struct nlattr *nla,
- struct nlattr *est, struct tc_action *tc_act, int ovr,
- int bind)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
+ struct nlattr *est, struct tc_action *tc_act, int ovr,
+ int bind)
+{
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
+ struct nlattr *est, struct tc_action **tc_act, int ovr,
+ int bind, bool rtnl_held, struct tcf_proto *tp,
+ u32 flags, struct netlink_ext_ack *extack)
{
#else
-static int nss_mirred_init(struct net *net, struct nlattr *nla,
- struct nlattr *est, struct tc_action **tc_act, int ovr,
- int bind, bool rtnl_held, struct tcf_proto *tp,
- struct netlink_ext_ack *extack)
+ struct nlattr *est, struct tc_action **tc_act,
+ struct tcf_proto *tp, u32 flags, struct netlink_ext_ack *extack)
{
+ bool bind = flags & TCA_ACT_FLAGS_BIND;
+#endif
struct tc_action_net *tn = net_generic(net, nss_mirred_net_id);
u32 index;
-#endif
struct nlattr *arr[TC_NSS_MIRRED_MAX + 1];
struct tc_nss_mirred *parm;
struct nss_mirred_tcf *act;
@@ -239,8 +243,13 @@ static int nss_mirred_init(struct net *n
}
if (!ret) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))
ret = tcf_idr_create(tn, index, est, tc_act, &nss_mirred_act_ops,
bind, true);
+#else
+ ret = tcf_idr_create(tn, index, est, tc_act, &nss_mirred_act_ops,
+ bind, true, 0);
+#endif
if (ret) {
tcf_idr_cleanup(tn, index);
return ret;
--- a/nss_qdisc/nss_bf.c
+++ b/nss_qdisc/nss_bf.c
@@ -74,7 +74,7 @@ static inline struct nss_bf_class_data *
*/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
static int nss_bf_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
- struct nlattr **tca, unsigned long *arg)
+ struct nlattr **tca, unsigned long *arg, struct netlink_ext_ack *extack)
{
struct netlink_ext_ack *extack = NULL;
#else
@@ -290,7 +290,11 @@ static void nss_bf_destroy_class(struct
* nss_bf_delete_class()
* Detaches a class from operation, but does not destroy it.
*/
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
+static int nss_bf_delete_class(struct Qdisc *sch, unsigned long arg, struct netlink_ext_ack *extack)
+#else
static int nss_bf_delete_class(struct Qdisc *sch, unsigned long arg)
+#endif
{
struct nss_bf_sched_data *q = qdisc_priv(sch);
struct nss_bf_class_data *cl = (struct nss_bf_class_data *)arg;
--- a/nss_qdisc/nss_htb.c
+++ b/nss_qdisc/nss_htb.c
@@ -282,7 +282,7 @@ static int nss_htb_ppe_change_class(stru
*/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
static int nss_htb_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
- struct nlattr **tca, unsigned long *arg)
+ struct nlattr **tca, unsigned long *arg, struct netlink_ext_ack *extack)
{
struct netlink_ext_ack *extack = NULL;
#else
@@ -516,7 +516,11 @@ static void nss_htb_destroy_class(struct
* nss_htb_delete_class()
* Detaches a class from operation, but does not destroy it.
*/
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
+static int nss_htb_delete_class(struct Qdisc *sch, unsigned long arg, struct netlink_ext_ack *extack)
+#else
static int nss_htb_delete_class(struct Qdisc *sch, unsigned long arg)
+#endif
{
struct nss_htb_sched_data *q = qdisc_priv(sch);
struct nss_htb_class_data *cl = (struct nss_htb_class_data *)arg;
--- a/nss_qdisc/nss_qdisc.c
+++ b/nss_qdisc/nss_qdisc.c
@@ -1140,15 +1140,16 @@ unsigned int nss_qdisc_drop(struct Qdisc
{
struct nss_qdisc *nq = qdisc_priv(sch);
unsigned int ret;
+ struct sk_buff *to_free = qdisc_peek_head(sch);
if (!nq->is_virtual) {
- ret = __qdisc_queue_drop_head(sch, &sch->q);
+ ret = __qdisc_queue_drop_head(sch, &sch->q, &to_free);
} else {
spin_lock_bh(&nq->bounce_protection_lock);
/*
* This function is safe to call within locks
*/
- ret = __qdisc_queue_drop_head(sch, &sch->q);
+ ret = __qdisc_queue_drop_head(sch, &sch->q, &to_free);
spin_unlock_bh(&nq->bounce_protection_lock);
}
@@ -1209,10 +1210,10 @@ static bool nss_qdisc_iterate_fl(struct
return 0;
}
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
- status = tc_classify(skb, tcf, &res, false);
-#else
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
status = tcf_classify(skb, tcf, &res, false);
+#else
+ status = tcf_classify(skb, NULL, tcf, &res, false);
#endif
if ((status == TC_ACT_STOLEN) || (status == TC_ACT_QUEUED)) {
return 1;
--- a/nss_qdisc/nss_wrr.c
+++ b/nss_qdisc/nss_wrr.c
@@ -229,7 +229,7 @@ static int nss_wrr_ppe_change_class(stru
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
static int nss_wrr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
- struct nlattr **tca, unsigned long *arg)
+ struct nlattr **tca, unsigned long *arg, struct netlink_ext_ack *extack)
{
struct netlink_ext_ack *extack = NULL;
#else
@@ -400,7 +400,11 @@ failure:
return -EINVAL;
}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
+static int nss_wrr_delete_class(struct Qdisc *sch, unsigned long arg, struct netlink_ext_ack *extack)
+#else
static int nss_wrr_delete_class(struct Qdisc *sch, unsigned long arg)
+#endif
{
struct nss_wrr_sched_data *q = qdisc_priv(sch);
struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)arg;

View File

@ -0,0 +1,31 @@
--- a/gre/nss_connmgr_gre_v6.c
+++ b/gre/nss_connmgr_gre_v6.c
@@ -95,7 +95,8 @@ static int nss_connmgr_gre_v6_get_mac_ad
/*
* Find src MAC address
*/
- local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, 1);
+ local_dev = NULL;
+ local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, local_dev);
if (!local_dev) {
nss_connmgr_gre_warning("Unable to find local dev for %pI6", src_ip);
return GRE_ERR_NO_LOCAL_NETDEV;
--- a/gre/test/nss_connmgr_gre_test.c
+++ b/gre/test/nss_connmgr_gre_test.c
@@ -229,10 +229,12 @@ static int nss_connmgr_gre_test_open_pro
/*
* Proc ops
*/
-static const struct file_operations nss_connmgr_gre_test_proc_ops = {
- .open = nss_connmgr_gre_test_open_proc,
- .write = nss_connmgr_gre_test_write_proc,
- .read = seq_read,
+static const struct proc_ops nss_connmgr_gre_test_proc_ops = {
+ .proc_open = nss_connmgr_gre_test_open_proc,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+ .proc_write = nss_connmgr_gre_test_write_proc,
};
/*

View File

@ -0,0 +1,29 @@
--- a/ipsecmgr/v1.0/nss_ipsecmgr.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c
@@ -377,7 +377,7 @@ free:
* nss_ipsecmgr_tunnel_stats()
* get tunnel statistics
*/
-static struct rtnl_link_stats64 *nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
+void nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{
struct nss_ipsecmgr_priv *priv = netdev_priv(dev);
@@ -389,8 +389,6 @@ static struct rtnl_link_stats64 *nss_ips
read_lock_bh(&ipsecmgr_ctx->lock);
memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64));
read_unlock_bh(&ipsecmgr_ctx->lock);
-
- return stats;
}
/*
@@ -442,7 +440,7 @@ static void nss_ipsecmgr_tunnel_setup(st
dev->header_ops = NULL;
dev->netdev_ops = &nss_ipsecmgr_tunnel_ops;
- dev->destructor = nss_ipsecmgr_tunnel_free;
+ dev->priv_destructor = nss_ipsecmgr_tunnel_free;
/*
* get the MAC address from the ethernet device

View File

@ -0,0 +1,11 @@
--- a/dtls/v1.0/nss_connmgr_dtls_netdev.c
+++ b/dtls/v1.0/nss_connmgr_dtls_netdev.c
@@ -160,7 +160,7 @@ static void nss_dtlsmgr_dev_setup(struct
dev->ethtool_ops = NULL;
dev->header_ops = NULL;
dev->netdev_ops = &nss_dtlsmgr_session_ops;
- dev->destructor = NULL;
+ dev->priv_destructor = NULL;
memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);

View File

@ -0,0 +1,59 @@
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -800,8 +800,10 @@ static struct nss_vlan_pvt *nss_vlan_mgr
*/
static void nss_vlan_mgr_instance_free(struct nss_vlan_pvt *v)
{
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
int32_t i;
int ret = 0;
+#endif
spin_lock(&vlan_mgr_ctx.lock);
BUG_ON(--v->refs);
@@ -961,8 +963,11 @@ static int nss_vlan_mgr_register_event(s
int ret;
#endif
uint32_t vlan_tag;
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *slave;
- int32_t port, port_if;
+ int32_t port;
+#endif
+ int32_t port_if;
struct vlan_dev_priv *vlan;
struct net_device *real_dev;
bool is_bond_master = false;
@@ -1355,8 +1360,10 @@ return_with_error:
int nss_vlan_mgr_join_bridge(struct net_device *dev, uint32_t bridge_vsi)
{
struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev);
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *real_dev;
int ret;
+#endif
if (!v)
return 0;
@@ -1416,8 +1423,10 @@ EXPORT_SYMBOL(nss_vlan_mgr_join_bridge);
int nss_vlan_mgr_leave_bridge(struct net_device *dev, uint32_t bridge_vsi)
{
struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev);
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *real_dev;
int ret;
+#endif
if (!v)
return 0;
--- a/vlan/Makefile
+++ b/vlan/Makefile
@@ -8,7 +8,7 @@ ifeq ($(SoC),$(filter $(SoC),ipq807x ipq
ccflags-y += -DNSS_VLAN_MGR_PPE_SUPPORT
endif
-ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=0
+ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=4
ccflags-y += -Wall -Werror
ifneq (,$(filter $(CONFIG_BONDING),y m))

View File

@ -0,0 +1,25 @@
--- a/match/nss_match_priv.h
+++ b/match/nss_match_priv.h
@@ -29,19 +29,19 @@
/*
* Statically compile messages at different levels
*/
-#if (NSS_match_DEBUG_LEVEL < 2)
+#if (NSS_MATCH_DEBUG_LEVEL < 2)
#define nss_match_warn(s, ...)
#else
#define nss_match_warn(s, ...) pr_warn("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
-#if (NSS_match_DEBUG_LEVEL < 3)
+#if (NSS_MATCH_DEBUG_LEVEL < 3)
#define nss_match_info(s, ...)
#else
#define nss_match_info(s, ...) pr_notice("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
-#if (NSS_match_DEBUG_LEVEL < 4)
+#if (NSS_MATCH_DEBUG_LEVEL < 4)
#define nss_match_trace(s, ...)
#else
#define nss_match_trace(s, ...) pr_info("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)

View File

@ -0,0 +1,29 @@
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -1098,8 +1098,10 @@ int nss_bridge_mgr_register_br(struct ne
*/
b_pvt->ifnum = ifnum;
b_pvt->mtu = dev->mtu;
+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
b_pvt->wan_if_num = -1;
b_pvt->wan_if_enabled = false;
+#endif
ether_addr_copy(b_pvt->dev_addr, dev->dev_addr);
spin_lock(&br_mgr_ctx.lock);
list_add(&b_pvt->list, &br_mgr_ctx.list);
@@ -1165,6 +1167,7 @@ static int nss_bridge_mgr_bond_slave_cha
return NOTIFY_DONE;
}
+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
/*
* Add or remove the slave based based on linking event
*/
@@ -1179,6 +1182,7 @@ static int nss_bridge_mgr_bond_slave_cha
cu_info->upper_dev->name, master->name);
}
}
+#endif
return NOTIFY_DONE;
}

View File

@ -0,0 +1,61 @@
--- a/profiler/profile.c
+++ b/profiler/profile.c
@@ -31,6 +31,7 @@
#include <linux/fs.h>
#include <linux/page-flags.h>
#include <linux/sched.h>
+#include <linux/version.h>
#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
return count;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
+#define HAVE_PROC_OPS
+#endif
+
+#ifdef HAVE_PROC_OPS
+static const struct proc_ops profile_fops = {
+ .proc_open = profile_open,
+ .proc_read = profile_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = profile_release,
+ .proc_write = debug_if,
+};
+#else
static const struct file_operations profile_fops = {
.open = profile_open,
.read = profile_read,
.release = profile_release,
.write = debug_if,
};
+#endif
/*
* showing sample status on Linux console
@@ -971,6 +986,15 @@ static ssize_t profile_rate_write(struct
return 0;
}
+#ifdef HAVE_PROC_OPS
+static const struct proc_ops profile_rate_fops = {
+ .proc_open = profile_rate_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+ .proc_write = profile_rate_write,
+};
+#else
static const struct file_operations profile_rate_fops = {
.open = profile_rate_open,
.read = seq_read,
@@ -978,6 +1002,7 @@ static const struct file_operations prof
.release = single_release,
.write = profile_rate_write,
};
+#endif
/*
* hexdump

View File

@ -0,0 +1,17 @@
--- a/gre/nss_connmgr_gre_v4.c
+++ b/gre/nss_connmgr_gre_v4.c
@@ -172,14 +172,6 @@ int nss_connmgr_gre_v4_set_config(struct
}
}
- /*
- * IP address validate
- */
- if ((cfg->src_ip == 0) || (cfg->dest_ip == 0)) {
- nss_connmgr_gre_warning("Source ip/Destination IP is invalid");
- return GRE_ERR_INVALID_IP;
- }
-
memset(t, 0, sizeof(struct ip_tunnel));
priv->pad_len = (cfg->add_padding) ? GRE_HDR_PAD_LEN : 0;

View File

@ -0,0 +1,35 @@
--- a/portifmgr/nss_portifmgr.c
+++ b/portifmgr/nss_portifmgr.c
@@ -187,16 +187,20 @@ drop:
}
/*
- * nss_portifmgr_get_stats()
+ * nss_portifmgr_get_stats64()
* Netdev get stats function to get port stats
*/
-static struct rtnl_link_stats64 *nss_portifmgr_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
+/*
+ * nss_nlgre_redir_cmn_dev_stats64
+ * Report packet statistics to linux
+ */
+static void nss_portifmgr_get_stats64(struct net_device *dev,
+ struct rtnl_link_stats64 *stats)
{
struct nss_portifmgr_priv *priv = (struct nss_portifmgr_priv *)netdev_priv(dev);
BUG_ON(priv == NULL);
nss_portid_get_stats(priv->if_num, stats);
- return stats;
}
/*
@@ -225,7 +229,7 @@ static const struct net_device_ops nss_p
.ndo_start_xmit = nss_portifmgr_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
.ndo_change_mtu = nss_portifmgr_change_mtu,
- .ndo_get_stats64 = nss_portifmgr_get_stats,
+ .ndo_get_stats64 = nss_portifmgr_get_stats64,
};
/*

View File

@ -0,0 +1,48 @@
--- a/dtls/v2.0/nss_dtlsmgr.c
+++ b/dtls/v2.0/nss_dtlsmgr.c
@@ -38,7 +38,13 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <crypto/skcipher.h>
#include <crypto/hash.h>
--- a/dtls/v2.0/nss_dtlsmgr_ctx.c
+++ b/dtls/v2.0/nss_dtlsmgr_ctx.c
@@ -40,7 +40,13 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <crypto/skcipher.h>
#include <crypto/hash.h>
--- a/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
+++ b/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
@@ -36,7 +36,13 @@
#include <net/protocol.h>
#include <net/route.h>
#include <crypto/aes.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <nss_api_if.h>
#include <nss_dynamic_interface.h>

View File

@ -0,0 +1,36 @@
--- a/dtls/v2.0/nss_dtlsmgr_private.h
+++ b/dtls/v2.0/nss_dtlsmgr_private.h
@@ -36,9 +36,9 @@
/*
* Compile messages for dynamic enable/disable
*/
-#define nss_dtlsmgr_warn(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
-#define nss_dtlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
-#define nss_dtlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
+#define nss_dtlsmgr_warn(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
+#define nss_dtlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
+#define nss_dtlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
#else
/*
@@ -46,17 +46,17 @@
*/
#define nss_dtlsmgr_warn(s, ...) { \
if (NSS_DTLSMGR_DEBUG_LEVEL > NSS_DTLSMGR_DEBUG_LEVEL_ERROR) \
- pr_warn("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \
+ pr_warn("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \
}
#define nss_dtlsmgr_info(s, ...) { \
if (NSS_DTLSMGR_DEBUG_LEVEL > NSS_DTLSMGR_DEBUG_LEVEL_WARN) \
- pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \
+ pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \
}
#define nss_dtlsmgr_trace(s, ...) { \
if (NSS_DTLSMGR_DEBUG_LEVEL > NSS_DTLSMGR_DEBUG_LEVEL_INFO) \
- pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \
+ pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \
}
#endif /* CONFIG_DYNAMIC_DEBUG */

View File

@ -0,0 +1,32 @@
--- a/tls/nss_tlsmgr_crypto.c
+++ b/tls/nss_tlsmgr_crypto.c
@@ -41,7 +41,13 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <crypto/skcipher.h>
#include <crypto/hash.h>
#include <crypto/internal/hash.h>
--- a/tls/nss_tlsmgr_tun.c
+++ b/tls/nss_tlsmgr_tun.c
@@ -35,7 +35,13 @@
#include <linux/atomic.h>
#include <linux/tlshdr.h>
#include <crypto/aes.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <nss_api_if.h>
#include <nss_dynamic_interface.h>

View File

@ -0,0 +1,32 @@
--- a/openvpn/src/nss_ovpnmgr_crypto.c
+++ b/openvpn/src/nss_ovpnmgr_crypto.c
@@ -28,7 +28,13 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <crypto/hash.h>
#include <nss_api_if.h>
--- a/openvpn/src/nss_ovpnmgr_route.c
+++ b/openvpn/src/nss_ovpnmgr_route.c
@@ -34,7 +34,13 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <crypto/hash.h>
#include <nss_api_if.h>

View File

@ -0,0 +1,11 @@
--- a/tunipip6/nss_connmgr_tunipip6.c
+++ b/tunipip6/nss_connmgr_tunipip6.c
@@ -258,7 +258,7 @@ static void nss_tunipip6_decap_exception
struct iphdr *iph;
struct rtable *rt;
int cpu;
- int8_t ver = skb->data[0] >> 4;
+ __attribute__((unused)) int8_t ver = skb->data[0] >> 4;
nss_tunipip6_trace("%px: received - %d bytes name %s ver %x\n",
dev, skb->len, dev->name, ver);

View File

@ -0,0 +1,34 @@
--- a/tls/nss_tlsmgr_priv.h
+++ b/tls/nss_tlsmgr_priv.h
@@ -28,7 +28,7 @@
#define NSS_TLSMGR_DEBUG_LEVEL_INFO 3
#define NSS_TLSMGR_DEBUG_LEVEL_TRACE 4
-#define nss_tlsmgr_info_always(s, ...) pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
+#define nss_tlsmgr_info_always(s, ...) pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
#define nss_tlsmgr_error(s, ...) do { \
if (net_ratelimit()) { \
@@ -43,18 +43,18 @@
} while (0)
#if defined(CONFIG_DYNAMIC_DEBUG)
-#define nss_tlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
-#define nss_tlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
+#define nss_tlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
+#define nss_tlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
#else
#define nss_tlsmgr_info(s, ...) { \
if (NSS_TLSMGR_DEBUG_LEVEL > NSS_TLSMGR_DEBUG_LEVEL_WARN) \
- pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \
+ pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \
}
#define nss_tlsmgr_trace(s, ...) { \
if (NSS_TLSMGR_DEBUG_LEVEL > NSS_TLSMGR_DEBUG_LEVEL_INFO) \
- pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \
+ pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \
}
#endif /* CONFIG_DYNAMIC_DEBUG */

View File

@ -0,0 +1,344 @@
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -1045,7 +1045,7 @@ int nss_bridge_mgr_register_br(struct ne
}
#endif
- err = nss_bridge_tx_set_mac_addr_msg(ifnum, dev->dev_addr);
+ err = nss_bridge_tx_set_mac_addr_msg(ifnum, (uint8_t *) dev->dev_addr);
if (err != NSS_TX_SUCCESS) {
nss_bridge_mgr_warn("%px: failed to set mac_addr msg, error = %d\n", b_pvt, err);
goto fail_3;
@@ -1202,7 +1202,7 @@ static int nss_bridge_mgr_changeaddr_eve
nss_bridge_mgr_trace("%px: MAC changed to %pM, update NSS\n", b_pvt, dev->dev_addr);
- if (nss_bridge_tx_set_mac_addr_msg(b_pvt->ifnum, dev->dev_addr) != NSS_TX_SUCCESS) {
+ if (nss_bridge_tx_set_mac_addr_msg(b_pvt->ifnum, (uint8_t *) dev->dev_addr) != NSS_TX_SUCCESS) {
nss_bridge_mgr_warn("%px: Failed to send change MAC address message to NSS\n", b_pvt);
return NOTIFY_DONE;
}
--- a/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
+++ b/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
@@ -532,7 +532,7 @@ void nss_dtlsmgr_ctx_dev_setup(struct ne
#else
dev->priv_destructor = nss_dtlsmgr_ctx_dev_free;
#endif
- memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len);
+ memcpy((void *) dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
}
--- a/gre/test/nss_connmgr_gre_test.c
+++ b/gre/test/nss_connmgr_gre_test.c
@@ -223,7 +223,7 @@ static int nss_connmgr_gre_test_show_pro
*/
static int nss_connmgr_gre_test_open_proc(struct inode *inode, struct file *filp)
{
- return single_open(filp, nss_connmgr_gre_test_show_proc, PDE_DATA(inode));
+ return single_open(filp, nss_connmgr_gre_test_show_proc, pde_data(inode));
}
/*
--- a/gre/nss_connmgr_gre.c
+++ b/gre/nss_connmgr_gre.c
@@ -279,10 +279,10 @@ static struct rtnl_link_stats64 *nss_con
#else
start = u64_stats_fetch_begin_irq(&tstats->syncp);
#endif
- rx_packets = tstats->rx_packets;
- tx_packets = tstats->tx_packets;
- rx_bytes = tstats->rx_bytes;
- tx_bytes = tstats->tx_bytes;
+ rx_packets = u64_stats_read(&tstats->rx_packets);
+ tx_packets = u64_stats_read(&tstats->tx_packets);
+ rx_bytes = u64_stats_read(&tstats->rx_bytes);
+ tx_bytes = u64_stats_read(&tstats->tx_bytes);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0))
} while (u64_stats_fetch_retry_bh(&tstats->syncp, start));
#else
@@ -697,11 +697,11 @@ static void nss_connmgr_gre_event_receiv
tstats = this_cpu_ptr(dev->tstats);
u64_stats_update_begin(&tstats->syncp);
if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_INNER) {
- tstats->tx_packets += stats->tx_packets;
- tstats->tx_bytes += stats->tx_bytes;
+ u64_stats_add(&tstats->tx_packets, stats->tx_packets);
+ u64_stats_add(&tstats->tx_bytes, stats->tx_bytes);
} else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_OUTER) {
- tstats->rx_packets += stats->rx_packets;
- tstats->rx_bytes += stats->rx_bytes;
+ u64_stats_add(&tstats->rx_packets, stats->rx_packets);
+ u64_stats_add(&tstats->rx_bytes, stats->rx_bytes);
}
u64_stats_update_end(&tstats->syncp);
dev->stats.rx_dropped += nss_cmn_rx_dropped_sum(stats);
--- a/tunipip6/nss_connmgr_tunipip6.c
+++ b/tunipip6/nss_connmgr_tunipip6.c
@@ -354,11 +354,11 @@ static void nss_tunipip6_update_dev_stat
memset(&stats, 0, sizeof(stats));
if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_INNER) {
- stats.tx_packets = sync_stats->node_stats.tx_packets;
- stats.tx_bytes = sync_stats->node_stats.tx_bytes;
+ u64_stats_set(&stats.tx_packets, sync_stats->node_stats.tx_packets);
+ u64_stats_set(&stats.tx_bytes, sync_stats->node_stats.tx_bytes);
} else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_OUTER) {
- stats.rx_packets = sync_stats->node_stats.rx_packets;
- stats.rx_bytes = sync_stats->node_stats.rx_bytes;
+ u64_stats_set(&stats.rx_packets, sync_stats->node_stats.rx_packets);
+ u64_stats_set(&stats.rx_bytes, sync_stats->node_stats.rx_bytes);
} else {
nss_tunipip6_warning("%px: Invalid interface type received from NSS\n", dev);
return;
--- a/nss_qdisc/igs/nss_mirred.c
+++ b/nss_qdisc/igs/nss_mirred.c
@@ -317,7 +317,7 @@ static int nss_mirred_act(struct sk_buff
* Update the last use of action.
*/
tcf_lastuse_update(&act->tcf_tm);
- bstats_cpu_update(this_cpu_ptr(act->common.cpu_bstats), skb);
+ bstats_update(this_cpu_ptr(act->common.cpu_bstats), skb);
rcu_read_lock();
retval = READ_ONCE(act->tcf_action);
--- a/nss_qdisc/nss_qdisc.h
+++ b/nss_qdisc/nss_qdisc.h
@@ -188,7 +188,7 @@ struct nss_qdisc {
/* Shaper configure callback for reading shaper specific
* responses (e.g. memory size).
*/
- struct gnet_stats_basic_packed bstats; /* Basic class statistics */
+ struct gnet_stats_basic_sync bstats; /* Basic class statistics */
struct gnet_stats_queue qstats; /* Qstats for use by classes */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0))
atomic_t refcnt; /* Reference count for class use */
@@ -445,7 +445,7 @@ extern void nss_qdisc_stop_basic_stats_p
* Wrapper around gnet_stats_copy_basic()
*/
extern int nss_qdisc_gnet_stats_copy_basic(struct Qdisc *sch,
- struct gnet_dump *d, struct gnet_stats_basic_packed *b);
+ struct gnet_dump *d, struct gnet_stats_basic_sync *b);
/*
* nss_qdisc_gnet_stats_copy_queue()
--- a/nss_qdisc/igs/nss_ifb.c
+++ b/nss_qdisc/igs/nss_ifb.c
@@ -544,8 +544,10 @@ static void nss_ifb_update_dev_stats(str
* post shaping. Therefore IFB interface's stats should be updated
* with NSS firmware's IFB TX stats only.
*/
- stats.rx_packets = stats.tx_packets = node_stats->tx_packets;
- stats.rx_bytes = stats.tx_bytes = node_stats->tx_bytes;
+ u64_stats_set(&stats.rx_packets, node_stats->tx_packets);
+ u64_stats_set(&stats.tx_packets, node_stats->tx_packets);
+ u64_stats_set(&stats.rx_bytes, node_stats->tx_bytes);
+ u64_stats_set(&stats.tx_bytes, node_stats->tx_bytes);
dev->stats.rx_dropped = dev->stats.tx_dropped += sync_stats->igs_stats.tx_dropped;
u64_stats_update_end(&stats.syncp);
--- a/nss_qdisc/nss_qdisc.c
+++ b/nss_qdisc/nss_qdisc.c
@@ -14,6 +14,7 @@
**************************************************************************
*/
+#include "net/gen_stats.h"
#include <nss_api_if.h>
#include "nss_qdisc.h"
#include "nss_fifo.h"
@@ -2173,7 +2174,7 @@ int __nss_qdisc_init(struct Qdisc *sch,
* This is to prevent mixing NSS and PPE qdisc with linux qdisc.
*/
if ((parent != TC_H_ROOT) && (root->ops->owner != THIS_MODULE)) {
- nss_qdisc_warning("NSS qdisc %px (type %d) used along with non-nss qdiscs,"
+ nss_qdisc_info("NSS qdisc %px (type %d) used along with non-nss qdiscs,"
" or the interface is currently down", nq->qdisc, nq->type);
}
@@ -2562,7 +2563,7 @@ static void nss_qdisc_basic_stats_callba
{
struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
struct Qdisc *qdisc = nq->qdisc;
- struct gnet_stats_basic_packed *bstats;
+ struct gnet_stats_basic_sync *bstats;
struct gnet_stats_queue *qstats;
struct nss_shaper_node_stats_response *response;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0))
@@ -2601,8 +2602,8 @@ static void nss_qdisc_basic_stats_callba
* Update qdisc->bstats
*/
spin_lock_bh(&nq->lock);
- bstats->bytes += (__u64)response->sn_stats.delta.dequeued_bytes;
- bstats->packets += response->sn_stats.delta.dequeued_packets;
+ u64_stats_add(&bstats->bytes, (__u64)response->sn_stats.delta.dequeued_bytes);
+ u64_stats_add(&bstats->packets, response->sn_stats.delta.dequeued_packets);
/*
* Update qdisc->qstats
@@ -2762,12 +2763,14 @@ void nss_qdisc_stop_basic_stats_polling(
* Wrapper around gnet_stats_copy_basic()
*/
int nss_qdisc_gnet_stats_copy_basic(struct Qdisc *sch, struct gnet_dump *d,
- struct gnet_stats_basic_packed *b)
+ struct gnet_stats_basic_sync *b)
{
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(3, 18, 0))
return gnet_stats_copy_basic(d, b);
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0))
return gnet_stats_copy_basic(d, NULL, b);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0))
+ return gnet_stats_copy_basic(d, NULL, b, true);
#else
return gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), d, NULL, b);
#endif
@@ -2798,7 +2801,6 @@ static int nss_qdisc_if_event_cb(struct
struct net_device *br;
struct Qdisc *br_qdisc;
int if_num, br_num;
- struct nss_qdisc *nq;
dev = nss_qdisc_get_dev(ptr);
if (!dev) {
@@ -2841,8 +2843,6 @@ static int nss_qdisc_if_event_cb(struct
break;
}
- nq = (struct nss_qdisc *)qdisc_priv(br_qdisc);
-
/*
* Call attach or detach according as per event type.
*/
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -808,7 +808,7 @@ static struct nss_vlan_pvt *nss_vlan_mgr
}
v->mtu = dev->mtu;
- ether_addr_copy(v->dev_addr, dev->dev_addr);
+ ether_addr_copy(v->dev_addr, (uint8_t *) dev->dev_addr);
v->ifindex = dev->ifindex;
v->refs = 1;
@@ -956,14 +956,14 @@ static int nss_vlan_mgr_changeaddr_event
}
spin_unlock(&vlan_mgr_ctx.lock);
- if (nss_vlan_tx_set_mac_addr_msg(v_pvt->nss_if, dev->dev_addr) != NSS_TX_SUCCESS) {
+ if (nss_vlan_tx_set_mac_addr_msg(v_pvt->nss_if, (uint8_t *) dev->dev_addr) != NSS_TX_SUCCESS) {
nss_vlan_mgr_warn("%s: Failed to send change MAC address message to NSS\n", dev->name);
nss_vlan_mgr_instance_deref(v_pvt);
return NOTIFY_BAD;
}
spin_lock(&vlan_mgr_ctx.lock);
- ether_addr_copy(v_pvt->dev_addr, dev->dev_addr);
+ ether_addr_copy(v_pvt->dev_addr, (uint8_t *) dev->dev_addr);
spin_unlock(&vlan_mgr_ctx.lock);
nss_vlan_mgr_trace("%s: MAC changed to %pM, updated NSS\n", dev->name, dev->dev_addr);
nss_vlan_mgr_instance_deref(v_pvt);
--- a/vxlanmgr/nss_vxlanmgr_tunnel.c
+++ b/vxlanmgr/nss_vxlanmgr_tunnel.c
@@ -465,8 +465,8 @@ static void nss_vxlanmgr_tunnel_inner_st
tstats = this_cpu_ptr(dev->tstats);
u64_stats_update_begin(&tstats->syncp);
- tstats->tx_packets += stats->node_stats.tx_packets;
- tstats->tx_bytes += stats->node_stats.tx_bytes;
+ u64_stats_add(&tstats->tx_packets, stats->node_stats.tx_packets);
+ u64_stats_add(&tstats->tx_bytes, stats->node_stats.tx_bytes);
u64_stats_update_end(&tstats->syncp);
netdev_stats->tx_dropped += dropped;
dev_put(dev);
@@ -503,8 +503,8 @@ static void nss_vxlanmgr_tunnel_outer_st
tstats = this_cpu_ptr(dev->tstats);
u64_stats_update_begin(&tstats->syncp);
- tstats->rx_packets += stats->node_stats.tx_packets;
- tstats->rx_bytes += stats->node_stats.tx_bytes;
+ u64_stats_add(&tstats->rx_packets, stats->node_stats.tx_packets);
+ u64_stats_add(&tstats->rx_bytes, stats->node_stats.tx_bytes);
u64_stats_update_end(&tstats->syncp);
netdev_stats->rx_dropped += dropped;
dev_put(dev);
--- a/pvxlanmgr/nss_pvxlanmgr.c
+++ b/pvxlanmgr/nss_pvxlanmgr.c
@@ -177,7 +177,7 @@ static struct rtnl_link_stats64 *nss_pvx
* Netdev seems to be incrementing rx_dropped because we don't give IP header.
* So reset it as it's of no use for us.
*/
- atomic_long_set(&dev->rx_dropped, 0);
+ atomic_long_set(&(dev)->stats.__rx_dropped, 0);
priv = netdev_priv(dev);
memset(stats, 0, sizeof(struct rtnl_link_stats64));
memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64));
@@ -305,7 +305,7 @@ static void nss_pvxlanmgr_dummy_netdev_s
dev->priv_destructor = NULL;
#endif
- memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
+ memcpy((void *) dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
}
--- a/tls/nss_tlsmgr_tun.c
+++ b/tls/nss_tlsmgr_tun.c
@@ -185,7 +185,7 @@ static void nss_tlsmgr_tun_setup(struct
/*
* Get the MAC address from the ethernet device
*/
- random_ether_addr(dev->dev_addr);
+ eth_random_addr((u8 *) dev->dev_addr);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
--- a/netlink/nss_nlgre_redir_cmn.c
+++ b/netlink/nss_nlgre_redir_cmn.c
@@ -384,7 +384,7 @@ static int nss_nlgre_redir_cmn_set_mac_a
return -EINVAL;
}
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ memcpy((void *) dev->dev_addr, addr->sa_data, ETH_ALEN);
return 0;
}
--- a/nss_connmgr_tun6rd.c
+++ b/nss_connmgr_tun6rd.c
@@ -101,10 +101,10 @@ static void nss_tun6rd_update_dev_stats(
u64_stats_init(&stats.syncp);
u64_stats_update_begin(&stats.syncp);
- stats.rx_packets = sync_stats->node_stats.rx_packets;
- stats.rx_bytes = sync_stats->node_stats.rx_bytes;
- stats.tx_packets = sync_stats->node_stats.tx_packets;
- stats.tx_bytes = sync_stats->node_stats.tx_bytes;
+ u64_stats_set(&stats.rx_packets, sync_stats->node_stats.rx_packets);
+ u64_stats_set(&stats.rx_bytes, sync_stats->node_stats.rx_bytes);
+ u64_stats_set(&stats.tx_packets, sync_stats->node_stats.tx_packets);
+ u64_stats_set(&stats.tx_bytes, sync_stats->node_stats.tx_bytes);
u64_stats_update_end(&stats.syncp);
#else
struct nss_tun6rd_stats stats;
--- a/ipsecmgr/v1.0/nss_ipsecmgr.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c
@@ -445,7 +445,7 @@ static void nss_ipsecmgr_tunnel_setup(st
/*
* get the MAC address from the ethernet device
*/
- random_ether_addr(dev->dev_addr);
+ eth_random_addr((u8 *) dev->dev_addr);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
--- a/ipsecmgr/v2.0/nss_ipsecmgr_tunnel.c
+++ b/ipsecmgr/v2.0/nss_ipsecmgr_tunnel.c
@@ -445,7 +445,7 @@ static void nss_ipsecmgr_tunnel_setup(st
/*
* Get the MAC address from the ethernet device
*/
- random_ether_addr(dev->dev_addr);
+ eth_random_addr((u8 *) dev->dev_addr);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);

View File

@ -0,0 +1,225 @@
--- a/wifi_meshmgr/nss_wifi_meshmgr.c
+++ b/wifi_meshmgr/nss_wifi_meshmgr.c
@@ -49,7 +49,7 @@ static bool nss_wifi_meshmgr_verify_if_n
*/
static nss_wifi_meshmgr_status_t nss_wifi_meshmgr_tx_msg(struct nss_wifi_mesh_msg *msg)
{
- return nss_wifi_mesh_tx_msg(wmgr_ctx.nss_ctx, msg);
+ return (nss_wifi_meshmgr_status_t)nss_wifi_mesh_tx_msg(wmgr_ctx.nss_ctx, msg);
}
/*
@@ -126,7 +126,7 @@ static void nss_wifi_meshmgr_cleanup(str
* Unregister and dealloc decap DI.
*/
nss_unregister_wifi_mesh_if(decap_ifnum);
- nss_status = nss_dynamic_interface_dealloc_node(decap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_dynamic_interface_dealloc_node(decap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER);
if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) {
nss_wifi_meshmgr_warn("%px: Failed to dealloc decap: %d\n", &wmgr_ctx, nss_status);
}
@@ -135,7 +135,7 @@ static void nss_wifi_meshmgr_cleanup(str
* Unregister and dealloc encap DI.
*/
nss_unregister_wifi_mesh_if(encap_ifnum);
- nss_status = nss_dynamic_interface_dealloc_node(encap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_dynamic_interface_dealloc_node(encap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER);
if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) {
nss_wifi_meshmgr_warn("%px: Failed to dealloc encap: %d\n", &wmgr_ctx, nss_status);
}
@@ -249,10 +249,10 @@ static void nss_wifi_meshmgr_tx_msg_cb(v
/*
* FIXME: The wmesh_ctx can be invalid if the memory goes away with the caller being timedout.
*/
- wmesh_ctx->response = NSS_WIFI_MESHMGR_SUCCESS;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_SUCCESS;
if (ncm->response != NSS_CMN_RESPONSE_ACK) {
nss_wifi_meshmgr_warn("%px: WiFi-Mesh error response %d error_code: %u\n", &wmgr_ctx, ncm->response, error_code);
- wmesh_ctx->response = nss_wifi_meshmgr_remap_error(error_code);
+ wmesh_ctx->response = (nss_tx_status_t)nss_wifi_meshmgr_remap_error(error_code);
}
complete(&wmesh_ctx->complete);
@@ -281,10 +281,10 @@ static nss_wifi_meshmgr_status_t nss_wif
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- status = wmesh_ctx->response;
+ status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
return status;
}
@@ -316,7 +316,7 @@ nss_wifi_meshmgr_status_t nss_wifi_meshm
return NSS_WIFI_MESHMGR_FAILURE;
}
- nss_status = nss_wifi_mesh_tx_buf(wmgr_ctx.nss_ctx, os_buf, encap_ifnum);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_wifi_mesh_tx_buf(wmgr_ctx.nss_ctx, os_buf, encap_ifnum);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
return nss_status;
}
@@ -540,10 +540,10 @@ nss_wifi_meshmgr_dump_mesh_path_sync(nss
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -635,10 +635,10 @@ nss_wifi_meshmgr_dump_mesh_proxy_path_sy
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -707,7 +707,7 @@ nss_wifi_meshmgr_assoc_link_vap(nss_wifi
/*
* Send the link vap mesage to the NSS synchronously.
*/
- nss_status = nss_wifi_vdev_tx_msg(wmgr_ctx.nss_ctx, wifivdevmsg);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_wifi_vdev_tx_msg(wmgr_ctx.nss_ctx, wifivdevmsg);
if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) {
nss_wifi_meshmgr_warn("%px: Mesh link vap association failed: %d.\n", &wmgr_ctx, nss_status);
}
@@ -753,10 +753,10 @@ nss_wifi_meshmgr_assoc_link_vap_sync(nss
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -878,10 +878,10 @@ nss_wifi_meshmgr_mesh_config_update_sync
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -977,10 +977,10 @@ nss_wifi_meshmgr_mesh_proxy_path_delete_
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1076,10 +1076,10 @@ nss_wifi_meshmgr_mesh_proxy_path_update_
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1175,10 +1175,10 @@ nss_wifi_meshmgr_mesh_proxy_path_add_syn
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1274,10 +1274,10 @@ nss_wifi_meshmgr_mesh_path_delete_sync(n
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1373,10 +1373,10 @@ nss_wifi_meshmgr_mesh_path_add_sync(nss_
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
return nss_status;
@@ -1471,10 +1471,10 @@ nss_wifi_meshmgr_mesh_path_update_sync(n
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1570,10 +1570,10 @@ nss_wifi_meshmgr_mesh_path_exception_syn
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1663,7 +1663,7 @@ nss_wifi_mesh_handle_t nss_wifi_meshmgr_
int32_t encap_ifnum, decap_ifnum;
uint32_t features = 0;
nss_wifi_mesh_handle_t mesh_handle;
- nss_wifi_meshmgr_status_t nss_status;
+ nss_wifi_meshmgr_status_t nss_status = NSS_WIFI_MESHMGR_SUCCESS;
struct nss_wifi_meshmgr_mesh_ctx *wmesh_ctx;
spin_lock_bh(&wmgr_ctx.ref_lock);

View File

@ -0,0 +1,169 @@
--- a/capwapmgr/nss_capwapmgr.c
+++ b/capwapmgr/nss_capwapmgr.c
@@ -331,7 +331,7 @@ static struct rtnl_link_stats64 *nss_cap
* Netdev seems to be incrementing rx_dropped because we don't give IP header.
* So reset it as it's of no use for us.
*/
- atomic_long_set(&dev->rx_dropped, 0);
+ dev->stats.rx_dropped = 0;
memset(stats, 0, sizeof (struct rtnl_link_stats64));
nss_capwapmgr_fill_up_stats(stats, &global.tunneld);
@@ -376,7 +376,6 @@ static const struct net_device_ops nss_c
.ndo_stop = nss_capwapmgr_close,
.ndo_start_xmit = nss_capwapmgr_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
- .ndo_change_mtu = eth_change_mtu,
.ndo_get_stats64 = nss_capwapmgr_dev_tunnel_stats,
};
@@ -400,7 +399,7 @@ static void nss_capwapmgr_dummpy_netdev_
#else
dev->priv_destructor = NULL;
#endif
- memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
+ memcpy((u8 *)dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
}
@@ -569,7 +568,7 @@ static struct nss_capwapmgr_tunnel *nss_
* nss_capwapmgr_netdev_create()
* API to create a CAPWAP netdev
*/
-struct net_device *nss_capwapmgr_netdev_create()
+struct net_device *nss_capwapmgr_netdev_create(void)
{
struct nss_capwapmgr_priv *priv;
struct nss_capwapmgr_response *r;
@@ -1168,7 +1167,7 @@ static nss_capwapmgr_status_t nss_capwap
/*
* Call NSS driver
*/
- status = nss_capwap_tx_msg(ctx, msg);
+ status = (nss_capwapmgr_status_t)nss_capwap_tx_msg(ctx, msg);
if (status != NSS_CAPWAPMGR_SUCCESS) {
up(&r->sem);
dev_put(dev);
@@ -1209,7 +1208,7 @@ static nss_capwapmgr_status_t nss_capwap
struct nss_ctx_instance *ctx = nss_capwap_get_ctx();
struct nss_capwap_msg capwapmsg;
struct nss_capwap_rule_msg *capwapcfg;
- nss_tx_status_t status;
+ nss_capwapmgr_status_t status;
nss_capwapmgr_info("%px: ctx: CAPWAP Rule src_port: 0x%d dest_port:0x%d\n", ctx,
ntohl(msg->encap.src_port), ntohl(msg->encap.dest_port));
@@ -1274,7 +1273,7 @@ static nss_capwapmgr_status_t nss_capwap
nss_capwapmgr_msg_event_receive, dev);
status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
- if (status != NSS_TX_SUCCESS) {
+ if (status != NSS_CAPWAPMGR_SUCCESS) {
nss_capwapmgr_warn("%px: ctx: create encap data tunnel error %d \n", ctx, status);
return status;
}
@@ -1286,10 +1285,10 @@ static nss_capwapmgr_status_t nss_capwap
* nss_capwapmgr_tx_msg_enable_tunnel()
* Common function to send CAPWAP tunnel enable msg
*/
-static nss_tx_status_t nss_capwapmgr_tx_msg_enable_tunnel(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, uint32_t sibling_if_num)
+static nss_capwapmgr_status_t nss_capwapmgr_tx_msg_enable_tunnel(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, uint32_t sibling_if_num)
{
struct nss_capwap_msg capwapmsg;
- nss_tx_status_t status;
+ nss_capwapmgr_status_t status;
/*
* Prepare the tunnel configuration parameter to send to NSS FW
@@ -1303,7 +1302,7 @@ static nss_tx_status_t nss_capwapmgr_tx_
nss_capwap_msg_init(&capwapmsg, if_num, NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL, sizeof(struct nss_capwap_enable_tunnel_msg), nss_capwapmgr_msg_event_receive, dev);
status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
- if (status != NSS_TX_SUCCESS) {
+ if (status != NSS_CAPWAPMGR_SUCCESS) {
nss_capwapmgr_warn("%px: ctx: CMD: %d Tunnel error : %d \n", ctx, NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL, status);
}
@@ -1315,7 +1314,7 @@ static nss_tx_status_t nss_capwapmgr_tx_
* Common function for CAPWAP tunnel operation messages without
* any message data structures.
*/
-static nss_tx_status_t nss_capwapmgr_tunnel_action(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, nss_capwap_msg_type_t cmd)
+static nss_capwapmgr_status_t nss_capwapmgr_tunnel_action(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, nss_capwap_msg_type_t cmd)
{
struct nss_capwap_msg capwapmsg;
nss_tx_status_t status;
@@ -1330,12 +1329,12 @@ static nss_tx_status_t nss_capwapmgr_tun
*/
nss_capwap_msg_init(&capwapmsg, if_num, cmd, 0, nss_capwapmgr_msg_event_receive, dev);
- status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
+ status = (nss_tx_status_t)nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
if (status != NSS_TX_SUCCESS) {
nss_capwapmgr_warn("%px: ctx: CMD: %d Tunnel error : %d \n", ctx, cmd, status);
}
- return status;
+ return (nss_capwapmgr_status_t)status;
}
/*
@@ -1460,7 +1459,6 @@ EXPORT_SYMBOL(nss_capwapmgr_update_path_
*/
nss_capwapmgr_status_t nss_capwapmgr_update_dest_mac_addr(struct net_device *dev, uint8_t tunnel_id, uint8_t *mac_addr)
{
- struct nss_capwapmgr_priv *priv;
struct nss_capwapmgr_tunnel *t;
nss_tx_status_t nss_status;
nss_capwapmgr_status_t status = NSS_CAPWAPMGR_SUCCESS;
@@ -1476,7 +1474,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
}
- priv = netdev_priv(dev);
nss_capwapmgr_info("%px: %d: tunnel update mac Addr is being called\n", dev, tunnel_id);
/*
@@ -1523,7 +1520,6 @@ EXPORT_SYMBOL(nss_capwapmgr_update_dest_
*/
nss_capwapmgr_status_t nss_capwapmgr_update_src_interface(struct net_device *dev, uint8_t tunnel_id, uint32_t src_interface_num)
{
- struct nss_capwapmgr_priv *priv;
struct nss_capwapmgr_tunnel *t;
nss_tx_status_t nss_status;
uint32_t outer_trustsec_enabled, dtls_enabled, forward_if_num, src_interface_num_temp;
@@ -1537,7 +1533,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
}
- priv = netdev_priv(dev);
nss_capwapmgr_info("%px: %d: tunnel update source interface is being called\n", dev, tunnel_id);
outer_trustsec_enabled = t->capwap_rule.enabled_features & NSS_CAPWAPMGR_FEATURE_OUTER_TRUSTSEC_ENABLED;
dtls_enabled = t->capwap_rule.enabled_features & NSS_CAPWAPMGR_FEATURE_DTLS_ENABLED;
@@ -1576,7 +1571,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
/*
* Destroy the IP rule only if it already exist.
*/
- if (t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
+ if (NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
struct nss_ipv4_destroy v4_destroy;
v4_destroy.protocol = IPPROTO_UDP;
v4_destroy.src_ip = t->ip_rule.v4.src_ip;
@@ -1606,7 +1601,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
/*
* Destroy the IP rule only if it already exist.
*/
- if (t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
+ if (NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
struct nss_ipv6_destroy v6_destroy;
if (t->capwap_rule.which_udp == NSS_CAPWAP_TUNNEL_UDP) {
@@ -1750,7 +1745,7 @@ nss_capwapmgr_status_t nss_capwapmgr_dsc
uint8_t rule_nr = NSS_CAPWAPMGR_RULE_NR;
uint8_t list_id, v4_rule_id, v6_rule_id;
uint8_t lid, rid, i, j;
- int8_t err, fail_dscp;
+ uint8_t err, fail_dscp;
int8_t uid = -1;
nss_capwapmgr_info("Setting priority %u for dscp %u mask %u\n", pri, dscp_value, dscp_mask);

View File

@ -0,0 +1,44 @@
--- a/netlink/Makefile
+++ b/netlink/Makefile
@@ -26,7 +26,6 @@ ccflags-y += -DCONFIG_NSS_NLPPTP=1
ccflags-y += -DCONFIG_NSS_NLCAPWAP=${CAPWAP_ENABLED}
ccflags-y += -DCONFIG_NSS_NLIPSEC=${IPSEC_ENABLED}
ccflags-y += -DCONFIG_NSS_NLDTLS=${DTLS_ENABLED}
-ccflags-y += -DCONFIG_NSS_NLUDP_ST=1
qca-nss-netlink-objs := nss_nl.o
qca-nss-netlink-objs += nss_nlgre_redir_family.o
@@ -48,7 +47,6 @@ qca-nss-netlink-objs += nss_nlmap_t.o
qca-nss-netlink-objs += nss_nlpppoe.o
qca-nss-netlink-objs += nss_nll2tpv2.o
qca-nss-netlink-objs += nss_nlpptp.o
-qca-nss-netlink-objs += nss_nludp_st.o
ifneq (,$(filter $(capwapmgr), y))
qca-nss-netlink-objs += nss_nlcapwap.o
@@ -79,4 +77,11 @@ else
ccflags-y += -DCONFIG_NSS_NLEDMA=0
endif
+ifeq ($(SoC),$(filter $(SoC),ipq95xx ipq50xx))
+ccflags-y += -DCONFIG_NSS_NLUDP_ST=1
+qca-nss-netlink-objs += nss_nludp_st.o
+else
+ccflags-y += -DCONFIG_NSS_NLUDP_ST=0
+endif
+
obj-m += qca-nss-netlink.o
--- a/netlink/nss_nludp_st.h
+++ b/netlink/nss_nludp_st.h
@@ -23,10 +23,9 @@
#ifndef __NSS_NLUDP_ST_H
#define __NSS_NLUDP_ST_H
+#if defined(CONFIG_NSS_NLUDP_ST) && CONFIG_NSS_NLUDP_ST > 0
bool nss_nludp_st_init(void);
bool nss_nludp_st_exit(void);
-
-#if defined(CONFIG_NSS_NLUDP_ST)
#define NSS_NLUDP_ST_INIT nss_nludp_st_init
#define NSS_NLUDP_ST_EXIT nss_nludp_st_exit
#else

View File

@ -0,0 +1,10 @@
--- a/mirror/Makefile
+++ b/mirror/Makefile
@@ -1,6 +1,6 @@
# Makefile for NSS MIRROR
-ccflags-y += $(NSS_CCFLAGS) -I$(obj)/../../exports
+ccflags-y += $(NSS_CCFLAGS) -I$(obj)/../exports
ccflags-y += -DNSS_MIRROR_DEBUG_LEVEL=2
ccflags-y += -Wall -Werror

View File

@ -0,0 +1,60 @@
--- a/match/nss_match_cmd.c
+++ b/match/nss_match_cmd.c
@@ -460,10 +460,10 @@ static int nss_match_cmd_procfs_reset_ne
char *cmd_buf = nss_match_data;
nss_tx_status_t nss_tx_status;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
- struct nss_ctx_instance *wifi_nss_ctx = nss_wifi_get_context();
+ struct nss_ctx_instance *wifili_nss_ctx = nss_wifi_get_context();
- if (!nss_ctx || !wifi_nss_ctx) {
- pr_warn("%px: NSS Context not found. wifi_nss_ctx: %px. Reset nexthop failed", nss_ctx, wifi_nss_ctx);
+ if (!nss_ctx || !wifili_nss_ctx) {
+ pr_warn("%px: NSS Context not found. wifili_nss_ctx: %px. Reset nexthop failed", nss_ctx, wifili_nss_ctx);
return -ENOMEM;
}
@@ -495,9 +495,9 @@ static int nss_match_cmd_procfs_reset_ne
* nss_phys_if_reset_nexthop: Used for physical interfaces.
* nss_if_reset_nexthop: used for VAP interfaces.
*/
- type = nss_dynamic_interface_get_type(wifi_nss_ctx, if_num);
+ type = nss_dynamic_interface_get_type(wifili_nss_ctx, if_num);
if (type == NSS_DYNAMIC_INTERFACE_TYPE_VAP) {
- nss_tx_status = nss_if_reset_nexthop(wifi_nss_ctx, if_num);
+ nss_tx_status = nss_if_reset_nexthop(wifili_nss_ctx, if_num);
} else if (if_num < NSS_MAX_PHYSICAL_INTERFACES) {
nss_tx_status = nss_phys_if_reset_nexthop(nss_ctx, if_num);
} else {
@@ -528,7 +528,7 @@ static int nss_match_cmd_procfs_set_if_n
uint32_t nh_if_num;
int table_id;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
- struct nss_ctx_instance *wifi_nss_ctx = nss_wifi_get_context();
+ struct nss_ctx_instance *wifili_nss_ctx = nss_wifi_get_context();
char *dev_name, *nexthop_msg;
char *cmd_buf = NULL;
size_t count = *lenp;
@@ -539,8 +539,8 @@ static int nss_match_cmd_procfs_set_if_n
return ret;
}
- if (!nss_ctx || !wifi_nss_ctx) {
- pr_warn("%px: NSS Context not found. wifi_nss_ctx: %px. Set nexthop failed", nss_ctx, wifi_nss_ctx);
+ if (!nss_ctx || !wifili_nss_ctx) {
+ pr_warn("%px: NSS Context not found. wifili_nss_ctx: %px. Set nexthop failed", nss_ctx, wifili_nss_ctx);
return -ENOMEM;
}
@@ -607,9 +607,9 @@ static int nss_match_cmd_procfs_set_if_n
* nss_phys_if_set_nexthop: Used for physical interfaces.
* nss_if_set_nexthop: used for VAP interfaces.
*/
- type = nss_dynamic_interface_get_type(wifi_nss_ctx, if_num);
+ type = nss_dynamic_interface_get_type(wifili_nss_ctx, if_num);
if (type == NSS_DYNAMIC_INTERFACE_TYPE_VAP) {
- nss_tx_status = nss_if_set_nexthop(wifi_nss_ctx, if_num, nh_if_num);
+ nss_tx_status = nss_if_set_nexthop(wifili_nss_ctx, if_num, nh_if_num);
} else if (if_num < NSS_MAX_PHYSICAL_INTERFACES) {
nss_tx_status = nss_phys_if_set_nexthop(nss_ctx, if_num, nh_if_num);
} else {

View File

@ -0,0 +1,42 @@
--- a/pvxlanmgr/nss_pvxlanmgr.c
+++ b/pvxlanmgr/nss_pvxlanmgr.c
@@ -18,6 +18,7 @@
* nss_pvxlanmgr.c
* NSS to HLOS Pvxlan manager
*/
+#include "nss_pvxlanmgr.h"
#include "nss_pvxlanmgr_priv.h"
/*
@@ -431,19 +432,19 @@ EXPORT_SYMBOL(nss_pvxlanmgr_netdev_disab
nss_pvxlanmgr_status_t nss_pvxlanmgr_netdev_enable(struct net_device *dev)
{
struct nss_pvxlanmgr_priv *priv;
- nss_tx_status_t ret;
+ nss_pvxlanmgr_status_t ret;
dev_hold(dev);
priv = netdev_priv(dev);
nss_pvxlanmgr_info("%px: tunnel enable is being called\n", dev);
- ret = nss_pvxlanmgr_tunnel_tx_msg_enable(priv->pvxlan_ctx, priv->if_num_host_inner, priv->if_num_outer);
+ ret = (nss_pvxlanmgr_status_t)nss_pvxlanmgr_tunnel_tx_msg_enable(priv->pvxlan_ctx, priv->if_num_host_inner, priv->if_num_outer);
if (ret != NSS_TX_SUCCESS) {
nss_pvxlanmgr_warn("%px: Tunnel enable failed: %d\n", dev, ret);
dev_put(dev);
return ret;
}
- ret = nss_pvxlanmgr_tunnel_tx_msg_enable(priv->pvxlan_ctx, priv->if_num_outer, priv->if_num_host_inner);
+ ret = (nss_pvxlanmgr_status_t)nss_pvxlanmgr_tunnel_tx_msg_enable(priv->pvxlan_ctx, priv->if_num_outer, priv->if_num_host_inner);
if (ret != NSS_TX_SUCCESS) {
nss_pvxlanmgr_warn("%px: Tunnel enable failed: %d\n", dev, ret);
nss_pvxlanmgr_tunnel_tx_msg_disable(priv->pvxlan_ctx, priv->if_num_host_inner);
@@ -524,7 +525,7 @@ EXPORT_SYMBOL(nss_pvxlanmgr_netdev_destr
* nss_pvxlanmgr_netdev_create()
* API to create a Pvxlan netdev
*/
-struct net_device *nss_pvxlanmgr_netdev_create()
+struct net_device *nss_pvxlanmgr_netdev_create(void)
{
struct nss_pvxlanmgr_priv *priv;
struct net_device *dev;

View File

@ -0,0 +1,330 @@
--- a/nss_qdisc/nss_bf.c
+++ b/nss_qdisc/nss_bf.c
@@ -331,10 +331,19 @@ static int nss_bf_delete_class(struct Qd
qdisc_class_hash_remove(&q->clhash, &cl->cl_common);
refcnt = nss_qdisc_atomic_sub_return(&cl->nq);
sch_tree_unlock(sch);
+
+ /*
+ * For 5.4 and above kernels, calling nss_htb_destroy_class
+ * explicitly as there is no put_class which would have called
+ * nss_bf_destroy_class when refcnt becomes zero.
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
+ nss_bf_destroy_class(sch, cl);
+#else
if (!refcnt) {
nss_qdisc_error("Reference count should not be zero for class %px\n", cl);
}
-
+#endif
return 0;
}
@@ -634,6 +643,11 @@ static int nss_bf_change_qdisc(struct Qd
*/
static void nss_bf_reset_class(struct nss_bf_class_data *cl)
{
+ if (cl->qdisc == &noop_qdisc) {
+ nss_qdisc_trace("Class %x has no child qdisc to reset\n", cl->nq.qos_tag);
+ return;
+ }
+
nss_qdisc_reset(cl->qdisc);
nss_qdisc_info("Nssbf class resetted %px\n", cl->qdisc);
}
--- a/nss_qdisc/nss_htb.c
+++ b/nss_qdisc/nss_htb.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -574,10 +574,16 @@ static int nss_htb_delete_class(struct Q
/*
* If we are root class, we dont have to update our parent.
* We simply deduct refcnt and return.
+ * For 5.4 and above kernels, calling nss_htb_destroy_class
+ * explicitly as there is no put_class which would have called
+ * nss_htb_destroy_class when refcnt becomes zero.
*/
if (!cl->parent) {
refcnt = nss_qdisc_atomic_sub_return(&cl->nq);
sch_tree_unlock(sch);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
+ nss_htb_destroy_class(sch, cl);
+#endif
return 0;
}
@@ -596,6 +602,14 @@ static int nss_htb_delete_class(struct Q
refcnt = nss_qdisc_atomic_sub_return(&cl->nq);
sch_tree_unlock(sch);
+ /*
+ * For 5.4 and above kernels, calling nss_htb_destroy_class
+ * explicitly as there is no put_class which would have called
+ * nss_htb_destroy_class when refcnt becomes zero.
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
+ nss_htb_destroy_class(sch, cl);
+#endif
return 0;
}
@@ -898,6 +912,11 @@ static int nss_htb_change_qdisc(struct Q
*/
static void nss_htb_reset_class(struct nss_htb_class_data *cl)
{
+ if (cl->qdisc == &noop_qdisc) {
+ nss_qdisc_trace("Class %x has no child qdisc to reset\n", cl->nq.qos_tag);
+ return;
+ }
+
nss_qdisc_reset(cl->qdisc);
nss_qdisc_trace("htb class %x reset\n", cl->nq.qos_tag);
}
--- a/nss_qdisc/nss_qdisc.c
+++ b/nss_qdisc/nss_qdisc.c
@@ -30,9 +30,6 @@
void *nss_qdisc_ctx; /* Shaping context for nss_qdisc */
-#define NSS_QDISC_COMMAND_TIMEOUT (10*HZ) /* We set 10sec to be the command */
- /* timeout value for messages */
-
/*
* Defines related to root hash maintenance
*/
@@ -40,6 +37,53 @@ void *nss_qdisc_ctx; /* Shaping contex
#define NSS_QDISC_ROOT_HASH_MASK (NSS_QDISC_ROOT_HASH_SIZE - 1)
/*
+ * nss_qdisc_get_interface_msg()
+ * Returns the correct message that needs to be sent down to the NSS interface.
+ */
+int nss_qdisc_get_interface_msg(bool is_bridge, uint32_t msg_type)
+{
+ /*
+ * We re-assign the message based on whether this is for the I shaper
+ * or the B shaper. The is_bridge flag tells if we are on a bridge interface.
+ */
+ if (is_bridge) {
+ switch (msg_type) {
+ case NSS_QDISC_IF_SHAPER_ASSIGN:
+ return NSS_IF_BSHAPER_ASSIGN;
+ case NSS_QDISC_IF_SHAPER_UNASSIGN:
+ return NSS_IF_BSHAPER_UNASSIGN;
+ case NSS_QDISC_IF_SHAPER_CONFIG:
+ return NSS_IF_BSHAPER_CONFIG;
+ default:
+ nss_qdisc_info("Unknown message type for a bridge - type %d", msg_type);
+ return -1;
+ }
+ } else {
+ switch (msg_type) {
+ case NSS_QDISC_IF_SHAPER_ASSIGN:
+ return NSS_IF_ISHAPER_ASSIGN;
+ case NSS_QDISC_IF_SHAPER_UNASSIGN:
+ return NSS_IF_ISHAPER_UNASSIGN;
+ case NSS_QDISC_IF_SHAPER_CONFIG:
+ return NSS_IF_ISHAPER_CONFIG;
+ default:
+ nss_qdisc_info("Unknown message type for an interface - type %d", msg_type);
+ return -1;
+ }
+ }
+}
+
+/*
+ * nss_qdisc_msg_init()
+ * Initialize the qdisc specific message
+ */
+void nss_qdisc_msg_init(struct nss_if_msg *nim, uint16_t if_num, uint32_t msg_type, uint32_t len,
+ nss_if_msg_callback_t cb, void *app_data)
+{
+ nss_cmn_msg_init(&nim->cm, if_num, msg_type, len, (void *)cb, app_data);
+}
+
+/*
* nss_qdisc_interface_is_virtual()
* Return true if it is redirect or bridge interface.
*/
@@ -122,53 +166,6 @@ static int nss_qdisc_ppe_init(struct Qdi
#endif
/*
- * nss_qdisc_msg_init()
- * Initialize the qdisc specific message
- */
-static void nss_qdisc_msg_init(struct nss_if_msg *nim, uint16_t if_num, uint32_t msg_type, uint32_t len,
- nss_if_msg_callback_t cb, void *app_data)
-{
- nss_cmn_msg_init(&nim->cm, if_num, msg_type, len, (void*)cb, app_data);
-}
-
-/*
- * nss_qdisc_get_interface_msg()
- * Returns the correct message that needs to be sent down to the NSS interface.
- */
-static inline int nss_qdisc_get_interface_msg(bool is_bridge, uint32_t msg_type)
-{
- /*
- * We re-assign the message based on whether this is for the I shaper
- * or the B shaper. The is_bridge flag tells if we are on a bridge interface.
- */
- if (is_bridge) {
- switch(msg_type) {
- case NSS_QDISC_IF_SHAPER_ASSIGN:
- return NSS_IF_BSHAPER_ASSIGN;
- case NSS_QDISC_IF_SHAPER_UNASSIGN:
- return NSS_IF_BSHAPER_UNASSIGN;
- case NSS_QDISC_IF_SHAPER_CONFIG:
- return NSS_IF_BSHAPER_CONFIG;
- default:
- nss_qdisc_info("Unknown message type for a bridge - type %d", msg_type);
- return -1;
- }
- } else {
- switch(msg_type) {
- case NSS_QDISC_IF_SHAPER_ASSIGN:
- return NSS_IF_ISHAPER_ASSIGN;
- case NSS_QDISC_IF_SHAPER_UNASSIGN:
- return NSS_IF_ISHAPER_UNASSIGN;
- case NSS_QDISC_IF_SHAPER_CONFIG:
- return NSS_IF_ISHAPER_CONFIG;
- default:
- nss_qdisc_info("Unknown message type for an interface - type %d", msg_type);
- return -1;
- }
- }
-}
-
-/*
* nss_qdisc_attach_bshaper_callback()
* Call back funtion for bridge shaper attach to an interface.
*/
@@ -613,7 +610,6 @@ static void nss_qdisc_root_cleanup_free_
nss_qdisc_info("Root qdisc %px (type %d) free SUCCESS - response "
"type: %d\n", nq->qdisc, nq->type,
nim->msg.shaper_configure.config.response_type);
-
nss_qdisc_root_cleanup_shaper_unassign(nq);
}
@@ -1168,8 +1164,15 @@ unsigned int nss_qdisc_drop(struct Qdisc
*/
void nss_qdisc_reset(struct Qdisc *sch)
{
- struct nss_qdisc *nq = qdisc_priv(sch);
+ struct nss_qdisc *nq;
+ if(!(sch->flags & TCQ_F_NSS)) {
+ qdisc_reset_queue(sch);
+ nss_qdisc_info("Qdisc %px resetting non NSS qdisc\n", sch);
+ return;
+ }
+
+ nq = qdisc_priv(sch);
nss_qdisc_info("Qdisc %px (type %d) resetting\n",
sch, nq->type);
@@ -1891,6 +1894,7 @@ int nss_qdisc_configure(struct nss_qdisc
return 0;
}
+
/*
* nss_qdisc_register_configure_callback()
* Register shaper configure callback, which gets invoked on receiving a response.
@@ -2117,6 +2121,8 @@ int __nss_qdisc_init(struct Qdisc *sch,
*/
if ((sch->parent == TC_H_ROOT) && (!nq->is_class)) {
nss_qdisc_info("Qdisc %px (type %d) is root\n", nq->qdisc, nq->type);
+ nss_qdisc_info("Qdisc %px dev-name %s qdisc_dev(sch)->qdisc %px, qdisc_dev(sch)->qdisc->handle %x\n", qdisc_dev(sch), qdisc_dev(sch)->name, qdisc_dev(sch)->qdisc, qdisc_dev(sch)->qdisc->handle);
+ nss_qdisc_info("Qdisc %px (sch %px) is root, sch->handle %x\n", nq->qdisc, sch, sch->handle);
nq->is_root = true;
root = sch;
} else {
--- a/nss_qdisc/nss_qdisc.h
+++ b/nss_qdisc/nss_qdisc.h
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2014-2018, 2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018, 2020-2021 The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -41,6 +41,9 @@
#define NSS_QDISC_DEBUG_LEVEL_INFO 3
#define NSS_QDISC_DEBUG_LEVEL_TRACE 4
+#define NSS_QDISC_COMMAND_TIMEOUT (10*HZ) /* We set 10sec to be the command */
+ /* timeout value for messages */
+
/*
* Debug message for module init and exit
*/
@@ -486,3 +489,15 @@ extern unsigned long nss_qdisc_tcf_bind(
* Unbind the filter from the qdisc.
*/
extern void nss_qdisc_tcf_unbind(struct Qdisc *sch, unsigned long arg);
+
+/*
+ * nss_qdisc_get_interface_msg()
+ * Returns the correct message that needs to be sent down to the NSS interface.
+ */
+extern int nss_qdisc_get_interface_msg(bool is_bridge, uint32_t msg_type);
+
+/*
+ * nss_qdisc_msg_init()
+ * Initialize the qdisc specific message
+ */
+extern void nss_qdisc_msg_init(struct nss_if_msg *nim, uint16_t if_num, uint32_t msg_type, uint32_t len, nss_if_msg_callback_t cb, void *app_data);
--- a/nss_qdisc/nss_wrr.c
+++ b/nss_qdisc/nss_wrr.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -442,10 +442,19 @@ static int nss_wrr_delete_class(struct Q
refcnt = nss_qdisc_atomic_sub_return(&cl->nq);
sch_tree_unlock(sch);
+
+ /*
+ * For 5.4 and above kernels, calling nss_htb_destroy_class
+ * explicitly as there is no put_class which would have called
+ * nss_wrr_destroy_class when refcnt becomes zero.
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
+ nss_wrr_destroy_class(sch, cl);
+#else
if (!refcnt) {
nss_qdisc_error("Reference count should not be zero for class %px\n", cl);
}
-
+#endif
return 0;
}
@@ -764,6 +773,11 @@ static int nss_wrr_change_qdisc(struct Q
static void nss_wrr_reset_class(struct nss_wrr_class_data *cl)
{
+ if (cl->qdisc == &noop_qdisc) {
+ nss_qdisc_trace("Class %x has no child qdisc to reset\n", cl->nq.qos_tag);
+ return;
+ }
+
nss_qdisc_reset(cl->qdisc);
nss_qdisc_info("Nsswrr class resetted %px\n", cl->qdisc);
}

View File

@ -56,7 +56,15 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_NSS_DRV_WIFIOFFLOAD_ENABLE \
CONFIG_NSS_DRV_WIFI_EXT_VDEV_ENABLE \
CONFIG_NSS_DRV_WIFI_MESH_ENABLE \
CONFIG_NSS_DRV_WIFI_LEGACY_ENABLE
CONFIG_NSS_DRV_WIFI_LEGACY_ENABLE \
CONFIG_NSS_FIRMWARE_VERSION_11_4
ifdef CONFIG_NSS_FIRMWARE_VERSION_11_4
PKG_SOURCE_DATE:=2021-06-24
PKG_SOURCE_VERSION:=dc14ca2
PKG_MIRROR_HASH:=316d683281818ab3715ca31af42e9b82e1f1a9f13713a015030277f84febea25
PATCH_DIR:=$(CURDIR)/patches-11.4
endif
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
@ -109,8 +117,6 @@ define Build/InstallDev
$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-drv/
ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_64" "ipq60xx" "ipq60xx_64" "ipq50xx" "ipq50xx_64"))
$(RM) $(1)/usr/include/qca-nss-drv/nss_ipsecmgr.h
# $(INSTALL_DIR) $(1)/usr/include/qca-nss-clients
# $(CP) $(NSS_CLIENTS_DIR)/exports/nss_ipsecmgr.h $(1)/usr/include/qca-nss-clients/.
endif
endef

View File

@ -0,0 +1,178 @@
From dddfe22459a988a5b86d195bc3cc3bd3c2ac7037 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sat, 14 Jan 2023 21:52:38 +0100
Subject: [PATCH 1/4] nss-drv: replace ioremap_nocache() with ioremap()
Since 5.5 ioremap_nocache is equal to ioremap on all archs and was removed
from the kernel, so just use ioremap instead.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
nss_hal/fsm9010/nss_hal_pvt.c | 2 +-
nss_hal/ipq50xx/nss_hal_pvt.c | 6 +++---
nss_hal/ipq60xx/nss_hal_pvt.c | 8 ++++----
nss_hal/ipq806x/nss_hal_pvt.c | 4 ++--
nss_hal/ipq807x/nss_hal_pvt.c | 6 +++---
nss_hal/ipq95xx/nss_hal_pvt.c | 6 +++---
nss_hal/nss_hal.c | 4 ++--
nss_meminfo.c | 2 +-
nss_ppe.c | 2 +-
9 files changed, 20 insertions(+), 20 deletions(-)
--- a/nss_hal/fsm9010/nss_hal_pvt.c
+++ b/nss_hal/fsm9010/nss_hal_pvt.c
@@ -145,7 +145,7 @@ static struct nss_platform_data *__nss_h
npd->nphys = res_nphys.start;
npd->vphys = res_vphys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
--- a/nss_hal/ipq50xx/nss_hal_pvt.c
+++ b/nss_hal/ipq50xx/nss_hal_pvt.c
@@ -184,13 +184,13 @@ static struct nss_platform_data *__nss_h
npd->nphys = res_nphys.start;
npd->qgic_phys = res_qgic_phys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
}
- npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys));
+ npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys));
if (!npd->qgic_map) {
nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id);
goto out;
@@ -348,7 +348,7 @@ static int __nss_hal_common_reset(struct
of_node_put(cmn);
- nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
+ nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
if (!nss_misc_reset) {
pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev);
return -EFAULT;
--- a/nss_hal/ipq60xx/nss_hal_pvt.c
+++ b/nss_hal/ipq60xx/nss_hal_pvt.c
@@ -207,13 +207,13 @@ static struct nss_platform_data *__nss_h
npd->nphys = res_nphys.start;
npd->qgic_phys = res_qgic_phys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
}
- npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys));
+ npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys));
if (!npd->qgic_map) {
nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id);
goto out;
@@ -433,13 +433,13 @@ static int __nss_hal_common_reset(struct
of_node_put(cmn);
- nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
+ nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
if (!nss_misc_reset) {
pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev);
return -EFAULT;
}
- nss_misc_reset_flag = ioremap_nocache(res_nss_misc_reset_flag.start, resource_size(&res_nss_misc_reset_flag));
+ nss_misc_reset_flag = ioremap(res_nss_misc_reset_flag.start, resource_size(&res_nss_misc_reset_flag));
if (!nss_misc_reset_flag) {
pr_err("%px: ioremap fail for nss_misc_reset_flag\n", nss_dev);
return -EFAULT;
--- a/nss_hal/ipq806x/nss_hal_pvt.c
+++ b/nss_hal/ipq806x/nss_hal_pvt.c
@@ -458,7 +458,7 @@ static struct nss_platform_data *__nss_h
npd->nphys = res_nphys.start;
npd->vphys = res_vphys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
@@ -711,7 +711,7 @@ static int __nss_hal_common_reset(struct
}
of_node_put(cmn);
- fpb_base = ioremap_nocache(res_nss_fpb_base.start, resource_size(&res_nss_fpb_base));
+ fpb_base = ioremap(res_nss_fpb_base.start, resource_size(&res_nss_fpb_base));
if (!fpb_base) {
pr_err("%px: ioremap fail for nss_fpb_base\n", nss_dev);
return -EFAULT;
--- a/nss_hal/ipq807x/nss_hal_pvt.c
+++ b/nss_hal/ipq807x/nss_hal_pvt.c
@@ -234,7 +234,7 @@ static struct nss_platform_data *__nss_h
npd->vphys = res_vphys.start;
npd->qgic_phys = res_qgic_phys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
@@ -247,7 +247,7 @@ static struct nss_platform_data *__nss_h
goto out;
}
- npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys));
+ npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys));
if (!npd->qgic_map) {
nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id);
goto out;
@@ -467,7 +467,7 @@ static int __nss_hal_common_reset(struct
}
of_node_put(cmn);
- nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
+ nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
if (!nss_misc_reset) {
pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev);
return -EFAULT;
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -78,9 +78,9 @@ int nss_hal_firmware_load(struct nss_ctx
return rc;
}
- load_mem = ioremap_nocache(npd->load_addr, nss_fw->size);
+ load_mem = ioremap(npd->load_addr, nss_fw->size);
if (!load_mem) {
- nss_info_always("%px: ioremap_nocache failed: %x", nss_ctx, npd->load_addr);
+ nss_info_always("%px: ioremap failed: %x", nss_ctx, npd->load_addr);
release_firmware(nss_fw);
return rc;
}
--- a/nss_meminfo.c
+++ b/nss_meminfo.c
@@ -728,7 +728,7 @@ bool nss_meminfo_init(struct nss_ctx_ins
/*
* meminfo_start is the label where the start address of meminfo map is stored.
*/
- meminfo_start = (uint32_t *)ioremap_nocache(nss_ctx->load + NSS_MEMINFO_MAP_START_OFFSET,
+ meminfo_start = (uint32_t *)ioremap(nss_ctx->load + NSS_MEMINFO_MAP_START_OFFSET,
NSS_MEMINFO_RESERVE_AREA_SIZE);
if (!meminfo_start) {
nss_info_always("%px: cannot remap meminfo start\n", nss_ctx);
--- a/nss_ppe.c
+++ b/nss_ppe.c
@@ -357,7 +357,7 @@ void nss_ppe_init(void)
/*
* Get the PPE base address
*/
- ppe_pvt.ppe_base = ioremap_nocache(PPE_BASE_ADDR, PPE_REG_SIZE);
+ ppe_pvt.ppe_base = ioremap(PPE_BASE_ADDR, PPE_REG_SIZE);
if (!ppe_pvt.ppe_base) {
nss_warning("DRV can't get PPE base address\n");
return;

View File

@ -0,0 +1,31 @@
From 40d4b080f17883ac6b39c74a5feb1af384ab6a51 Mon Sep 17 00:00:00 2001
From: Robert Marko <robert.marko@sartura.hr>
Date: Thu, 11 Jun 2020 16:57:39 +0200
Subject: [PATCH] nss-drv: Control fab scaling from package Makefile
Lets control the fab scaling from the package Makefile
instead of using kernel checks that dont work.
Fab scaling in OpenWrt is done in a external way.
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
---
Makefile | 9 ---------
1 file changed, 9 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -481,14 +481,7 @@ NSS_CCFLAGS = -DNSS_DT_SUPPORT=1 -DNSS_F
ccflags-y += -I$(obj)
endif
-# Fabric scaling is supported in 3.14 and 4.4 only
-ifneq ($(findstring 3.14, $(KERNELVERSION)),)
-NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=1
-else ifneq ($(findstring 4.4, $(KERNELVERSION)),)
-NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=1
-else
NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=0
-endif
# Disable Frequency scaling
ifeq "$(NSS_FREQ_SCALE_DISABLE)" "y"

View File

@ -0,0 +1,11 @@
--- a/nss_core.c
+++ b/nss_core.c
@@ -1616,7 +1616,7 @@ static int32_t nss_core_handle_cause_que
*
*/
if (unlikely((buffer_type == N2H_BUFFER_CRYPTO_RESP))) {
- dma_unmap_single(NULL, (desc->buffer + desc->payload_offs), desc->payload_len, DMA_FROM_DEVICE);
+ dma_unmap_single(nss_ctx->dev, (desc->buffer + desc->payload_offs), desc->payload_len, DMA_FROM_DEVICE);
goto consume;
}

View File

@ -0,0 +1,30 @@
From 89949decfd9a0f86427b502aae4fbc3a3ef399f0 Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Tue, 23 Jun 2020 19:50:28 +0200
Subject: [PATCH] Fix Kernel Panic dma with NULL dev
---
nss_coredump.c | 4 ++--
nss_log.c | 8 +++++---
2 files changed, 8 insertions(+), 6 deletions(-)
--- a/nss_coredump.c
+++ b/nss_coredump.c
@@ -154,7 +154,7 @@ void nss_fw_coredump_notify(struct nss_c
dma_addr = nss_own->meminfo_ctx.logbuffer_dma;
}
- dma_sync_single_for_cpu(NULL, dma_addr, sizeof(struct nss_log_descriptor), DMA_FROM_DEVICE);
+ dma_sync_single_for_cpu(nss_own->dev, dma_addr, sizeof(struct nss_log_descriptor), DMA_FROM_DEVICE);
/*
* If the current entry is smaller than or equal to the number of NSS_LOG_COREDUMP_LINE_NUM,
@@ -181,7 +181,7 @@ void nss_fw_coredump_notify(struct nss_c
offset = (index * sizeof(struct nss_log_entry))
+ offsetof(struct nss_log_descriptor, log_ring_buffer);
- dma_sync_single_for_cpu(NULL, dma_addr + offset,
+ dma_sync_single_for_cpu(nss_own->dev, dma_addr + offset,
sizeof(struct nss_log_entry), DMA_FROM_DEVICE);
nss_info_always("%px: %s\n", nss_own, nle_print->message);
nle_print++;

View File

@ -0,0 +1,11 @@
--- a/nss_clmap_stats.c
+++ b/nss_clmap_stats.c
@@ -63,7 +63,7 @@ void nss_clmap_stats_session_unregister(
* nss_clmap_stats_session_register
* Register debug statistic for clmap session.
*/
-bool nss_clmap_stats_session_register(uint32_t if_num, uint32_t if_type, struct net_device *netdev)
+bool nss_clmap_stats_session_register(uint32_t if_num, enum nss_clmap_interface_type if_type, struct net_device *netdev)
{
uint32_t i;
bool stats_status = false;

View File

@ -0,0 +1,23 @@
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.
Change-Id: I3df6658bef72fe574ac9acfb7aac61785769766f
Signed-off-by: Suruchi Suman <surusuma@codeaurora.org>
---
nss_phys_if.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--- a/nss_core.c
+++ b/nss_core.c
@@ -52,7 +52,8 @@
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))))))
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))))))
#error "Check skb recycle code in this file to match Linux version"
#endif

View File

@ -0,0 +1,11 @@
--- a/exports/nss_wifili_if.h
+++ b/exports/nss_wifili_if.h
@@ -1974,7 +1974,7 @@ nss_if_num_t nss_get_available_wifili_ex
*/
uint8_t nss_wifili_thread_scheme_alloc(struct nss_ctx_instance *nss_ctx,
int32_t radio_ifnum,
- uint32_t radio_priority);
+ enum nss_wifili_thread_scheme_priority radio_priority);
/**
* nss_wifili_thread_scheme_dealloc

View File

@ -0,0 +1,74 @@
From 2a3b9f4659542e529f4e1a535c33dfde7e272707 Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Tue, 5 Apr 2022 18:10:57 +0200
Subject: [PATCH 2/4] nss-drv: add support for kernel 5.15
- Fix coredump panic notifier include change.
- Fix skb ZEROCOPY flag.
- Add skb reuse support for 5.15 kernel version.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
nss_core.c | 5 +++--
nss_coredump.c | 4 ++++
nss_hal/nss_hal.c | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
--- a/nss_core.c
+++ b/nss_core.c
@@ -53,7 +53,9 @@
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))))))
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)))) || \
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)))) || \
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))))))
#error "Check skb recycle code in this file to match Linux version"
#endif
@@ -2578,7 +2580,7 @@ static inline bool nss_core_skb_can_reus
if (unlikely(irqs_disabled()))
return false;
- if (unlikely(skb_shinfo(nbuf)->tx_flags & SKBTX_DEV_ZEROCOPY))
+ if (unlikely(skb_shinfo(nbuf)->flags & SKBFL_ZEROCOPY_ENABLE))
return false;
if (unlikely(skb_is_nonlinear(nbuf)))
--- a/nss_coredump.c
+++ b/nss_coredump.c
@@ -23,7 +23,11 @@
#include "nss_hal.h"
#include "nss_log.h"
#include <linux/kernel.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
#include <linux/notifier.h> /* for panic_notifier_list */
+#else
+#include <linux/panic_notifier.h>
+#endif
#include <linux/jiffies.h> /* for time */
#include "nss_tx_rx_common.h"
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -24,6 +24,7 @@
#include <linux/firmware.h>
#include <linux/of.h>
#include <linux/irq.h>
+#include <linux/ethtool.h>
#include "nss_hal.h"
#include "nss_arch.h"
@@ -57,9 +58,9 @@ int nss_hal_firmware_load(struct nss_ctx
int rc;
if (nss_ctx->id == 0) {
- rc = request_firmware(&nss_fw, NSS_AP0_IMAGE, &(nss_dev->dev));
+ rc = firmware_request_nowarn(&nss_fw, NSS_AP0_IMAGE, &(nss_dev->dev));
} else if (nss_ctx->id == 1) {
- rc = request_firmware(&nss_fw, NSS_AP1_IMAGE, &(nss_dev->dev));
+ rc = firmware_request_nowarn(&nss_fw, NSS_AP1_IMAGE, &(nss_dev->dev));
} else {
nss_warning("%px: Invalid nss dev: %d\n", nss_ctx, nss_ctx->id);
return -EINVAL;

View File

@ -0,0 +1,18 @@
--- a/nss_dynamic_interface_stats.c
+++ b/nss_dynamic_interface_stats.c
@@ -87,8 +87,15 @@ const char *nss_dynamic_interface_type_n
"NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N",
"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0",
"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1",
+ "NSS_DYNAMIC_INTERFACE_TYPE_TLS_INNER",
+ "NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER",
+ "NSS_DYNAMIC_INTERFACE_TYPE_MIRROR",
+ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_EXT_VDEV_WDS",
"NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_HOST_INNER",
"NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_OUTER",
+ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_EXT_VDEV_VLAN",
+ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER",
+ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER"
};
/*

View File

@ -0,0 +1,114 @@
From 1c2b564d7b29644765925a784d468f40555ded8a Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 10 Feb 2023 12:50:51 +0100
Subject: [PATCH] nss-drv: rework getting the reserved-memory size
Currently, the way NSS DRV gets the reserved memory node strictly depends
on the nss@40000000 node being present so it can find it after globaly
looking for the reserved-memory node and then going through its children.
After that its evaluation the address and size cells manually in order to
properly calculate the size of reserved-memory.
We can make this way more reliable and generic, so lets pass the memory
region wia the NSS common DTS node, match it via its compatible and then
get the memory region phandle and simply convert it to a resource.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
nss_core.c | 70 +++++++++++++++++++++++-------------------------------
1 file changed, 30 insertions(+), 40 deletions(-)
--- a/nss_core.c
+++ b/nss_core.c
@@ -23,6 +23,8 @@
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/sizes.h>
#include <nss_hal.h>
#include <net/dst.h>
#ifdef CONFIG_BRIDGE_NETFILTER
@@ -450,50 +452,38 @@ static void nss_core_handle_crypto_pkt(s
*/
static uint32_t nss_soc_mem_info(void)
{
- struct device_node *node;
- struct device_node *snode;
- int addr_cells;
- int size_cells;
- int n_items;
- uint32_t nss_msize = 8 << 20; /* default: 8MB */
- const __be32 *ppp;
-
- node = of_find_node_by_name(NULL, "reserved-memory");
- if (!node) {
- nss_info_always("reserved-memory not found\n");
- return nss_msize;
- }
-
- ppp = (__be32 *)of_get_property(node, "#address-cells", NULL);
- addr_cells = ppp ? be32_to_cpup(ppp) : 2;
- nss_info("%px addr cells %d\n", ppp, addr_cells);
- ppp = (__be32 *)of_get_property(node, "#size-cells", NULL);
- size_cells = ppp ? be32_to_cpup(ppp) : 2;
- nss_info("%px size cells %d\n", ppp, size_cells);
-
- for_each_child_of_node(node, snode) {
- /*
- * compare (snode->full_name, "/reserved-memory/nss@40000000") may be safer
- */
- nss_info("%px snode %s fn %s\n", snode, snode->name, snode->full_name);
- if (strcmp(snode->name, "nss") == 0)
- break;
- }
- of_node_put(node);
- if (!snode) {
- nss_info_always("nss@node not found: needed to determine NSS reserved DDR\n");
- return nss_msize;
- }
-
- ppp = (__be32 *)of_get_property(snode, "reg", &n_items);
- if (ppp) {
- n_items /= sizeof(ppp[0]);
- nss_msize = be32_to_cpup(ppp + addr_cells + size_cells - 1);
- nss_info_always("addr/size storage words %d %d # words %d in DTS, ddr size %x\n",
- addr_cells, size_cells, n_items, nss_msize);
+ struct device_node *common_node, *memory_node;
+ struct resource r;
+ int ret;
+
+ common_node = of_find_compatible_node(NULL, NULL, "qcom,nss-common");
+ if (!common_node) {
+ nss_info_always("NSS common node not found!\n");
+ goto err_use_default_memsize;
+ }
+
+ memory_node = of_parse_phandle(common_node, "memory-region", 0);
+ if (!memory_node) {
+ nss_info_always("NSS reserved-memory node not found!\n");
+ goto err_use_default_memsize;
+ }
+
+ ret = of_address_to_resource(memory_node, 0, &r);
+ of_node_put(common_node);
+ of_node_put(memory_node);
+ if (ret) {
+ nss_info_always("NSS reserved-memory resource not found!\n");
+ goto err_use_default_memsize;
}
- of_node_put(snode);
- return nss_msize;
+
+ nss_info_always("NSS DDR size is 0x%x\n", (uint32_t) resource_size(&r));
+
+ return resource_size(&r);
+
+err_use_default_memsize:
+ nss_info_always("Using default NSS reserved-memory size of 0x%x !\n", SZ_8M);
+
+ return SZ_8M;
}
/*

View File

@ -0,0 +1,204 @@
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,9 @@
obj-m += qca-nss-drv.o
#
+# Regular NSS path
+#
+#
# List the files that belong to the driver in alphabetical order.
#
qca-nss-drv-objs := \
@@ -16,57 +19,38 @@ qca-nss-drv-objs := \
nss_dynamic_interface.o \
nss_dynamic_interface_log.o \
nss_dynamic_interface_stats.o \
- nss_eth_rx.o \
- nss_eth_rx_stats.o \
- nss_eth_rx_strings.o \
- nss_gmac_stats.o \
- nss_if.o \
- nss_if_log.o \
nss_init.o \
- nss_ipv4.o \
- nss_ipv4_stats.o \
- nss_ipv4_strings.o \
- nss_ipv4_log.o \
nss_log.o \
- nss_lso_rx.o \
- nss_lso_rx_stats.o \
- nss_lso_rx_strings.o \
nss_meminfo.o \
nss_n2h.o \
nss_n2h_stats.o \
nss_n2h_strings.o \
- nss_phys_if.o \
nss_pm.o \
nss_profiler.o \
nss_project.o \
- nss_pppoe.o \
- nss_pppoe_log.o \
- nss_pppoe_stats.o \
- nss_pppoe_strings.o \
nss_rps.o \
nss_stats.o \
nss_strings.o \
- nss_tx_msg_sync.o \
nss_unaligned.o \
nss_unaligned_log.o \
- nss_unaligned_stats.o \
+ nss_unaligned_stats.o
+
+# Base NSS HAL support
+qca-nss-drv-objs += nss_hal/nss_hal.o
+
+ifneq "$(NSS_DRV_POINT_OFFLOAD)" "y"
+qca-nss-drv-objs += \
+ nss_gmac_stats.o \
+ nss_if.o \
+ nss_if_log.o \
+ nss_phys_if.o \
+ nss_tx_msg_sync.o \
nss_virt_if.o \
- nss_virt_if_stats.o \
- nss_vlan.o \
- nss_vlan_log.o \
- nss_wifi.o \
- nss_wifi_log.o \
- nss_wifi_stats.o \
- nss_wifi_vdev.o \
- nss_wifili.o \
- nss_wifili_log.o \
- nss_wifili_stats.o \
- nss_wifili_strings.o \
- nss_wifi_mac_db.o
+ nss_virt_if_stats.o
-# Base NSS data plane/HAL support
+# Base NSS data plane support
qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o
-qca-nss-drv-objs += nss_hal/nss_hal.o
+endif
ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n"
ccflags-y += -DNSS_DRV_BRIDGE_ENABLE
@@ -332,7 +316,70 @@ qca-nss-drv-objs += \
nss_udp_st_strings.o
endif
+ifneq "$(NSS_DRV_IPV4_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_IPV4_ENABLE
+qca-nss-drv-objs += \
+ nss_ipv4.o \
+ nss_ipv4_stats.o \
+ nss_ipv4_strings.o \
+ nss_ipv4_log.o
+endif
+
+ifneq "$(NSS_DRV_ETH_RX_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_ETH_RX_ENABLE
+qca-nss-drv-objs += \
+ nss_eth_rx.o \
+ nss_eth_rx_stats.o \
+ nss_eth_rx_strings.o
+endif
+
+ifneq "$(NSS_DRV_PPPOE_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_PPPOE_ENABLE
+qca-nss-drv-objs += \
+ nss_pppoe.o \
+ nss_pppoe_log.o \
+ nss_pppoe_stats.o \
+ nss_pppoe_strings.o
+endif
+
+ifneq "$(NSS_DRV_WIFIOFFLOAD_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_WIFIOFFLOAD_ENABLE
+ifneq "$(NSS_DRV_WIFI_LEGACY_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_WIFI_LEGACY_ENABLE
+qca-nss-drv-objs += \
+ nss_wifi.o \
+ nss_wifi_log.o \
+ nss_wifi_stats.o
ifeq ($(SoC),$(filter $(SoC),ipq806x))
+ccflags-y += -DNSS_HAL_IPQ806x_SUPPORT
+endif
+endif
+qca-nss-drv-objs += \
+ nss_wifi_vdev.o \
+ nss_wifili.o \
+ nss_wifili_log.o \
+ nss_wifili_stats.o \
+ nss_wifili_strings.o \
+ nss_wifi_mac_db.o
+endif
+
+ifneq "$(NSS_DRV_VLAN_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_VLAN_ENABLE
+qca-nss-drv-objs += \
+ nss_vlan.o \
+ nss_vlan_log.o
+endif
+
+ifneq "$(NSS_DRV_LSO_RX_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_LSO_RX_ENABLE
+qca-nss-drv-objs += \
+ nss_lso_rx.o \
+ nss_lso_rx_stats.o \
+ nss_lso_rx_strings.o
+endif
+
+ifeq ($(SoC),$(filter $(SoC),ipq806x))
+ccflags-y += -DNSS_DRV_IPV4_ENABLE -DNSS_DRV_IPV6_ENABLE
qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \
nss_hal/ipq806x/nss_hal_pvt.o
@@ -438,6 +485,8 @@ qca-nss-drv-objs += \
endif
endif
+ccflags-y += -DNSS_DATA_PLANE_GENERIC_SUPPORT
+
ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64))
qca-nss-drv-objs += nss_hal/ipq807x/nss_hal_pvt.o \
nss_data_plane/hal/nss_ipq807x.o
@@ -496,6 +545,7 @@ ccflags-y += -I$(obj)/nss_hal/ipq50xx -D
endif
ccflags-y += -I$(obj)/nss_hal/include -I$(obj)/nss_data_plane/include -I$(obj)/exports -DNSS_DEBUG_LEVEL=0 -DNSS_PKT_STATS_ENABLED=1
+
ccflags-y += -I$(obj)/nss_data_plane/hal/include
ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_REUSE_SUPPORT=1
ccflags-y += -Wall -Werror
@@ -510,7 +560,14 @@ NSS_CCFLAGS = -DNSS_DT_SUPPORT=1 -DNSS_F
ccflags-y += -I$(obj)
endif
+# Fabric scaling is supported in 3.14 and 4.4 only
+ifneq ($(findstring 3.14, $(KERNELVERSION)),)
+NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=1
+else ifneq ($(findstring 4.4, $(KERNELVERSION)),)
+NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=1
+else
NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=0
+endif
# Disable Frequency scaling
ifeq "$(NSS_FREQ_SCALE_DISABLE)" "y"
--- a/nss_init.c
+++ b/nss_init.c
@@ -880,6 +880,13 @@ static int __init nss_init(void)
#endif
/*
+ * Init Wi-Fi mesh
+ */
+#ifdef NSS_DRV_WIFI_MESH_ENABLE
+ nss_wifi_mesh_init();
+#endif
+
+ /*
* Register platform_driver
*/
return platform_driver_register(&nss_driver);

View File

@ -0,0 +1,80 @@
--- a/nss_core.c
+++ b/nss_core.c
@@ -477,7 +477,7 @@ static uint32_t nss_soc_mem_info(void)
goto err_use_default_memsize;
}
- nss_info_always("NSS DDR size is 0x%x\n", (uint32_t) resource_size(&r));
+ nss_info("NSS DDR size is 0x%x\n", (uint32_t) resource_size(&r));
return resource_size(&r);
--- a/nss_hal/ipq50xx/nss_hal_pvt.c
+++ b/nss_hal/ipq50xx/nss_hal_pvt.c
@@ -449,15 +449,15 @@ static int __nss_hal_clock_configure(str
}
}
- nss_info_always("Supported Frequencies - ");
+ nss_info("Supported Frequencies - ");
for (i = 0; i < NSS_FREQ_MAX_SCALE; i++) {
switch (nss_runtime_samples.freq_scale[i].frequency) {
case NSS_FREQ_850:
- nss_info_always("850 MHz ");
+ nss_info("850 MHz ");
break;
case NSS_FREQ_1000:
- nss_info_always("1 GHz ");
+ nss_info("1 GHz ");
break;
case NSS_FREQ_SCALE_NA:
--- a/nss_hal/ipq60xx/nss_hal_pvt.c
+++ b/nss_hal/ipq60xx/nss_hal_pvt.c
@@ -532,16 +532,16 @@ static int __nss_hal_clock_configure(str
}
}
- nss_info_always("Supported Frequencies - ");
+ nss_info("Supported Frequencies - ");
for (i = 0; i < NSS_FREQ_MAX_SCALE; i++) {
if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_187) {
- nss_info_always("187.2 MHz ");
+ nss_info("187.2 MHz ");
} else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_748) {
- nss_info_always("748.8 MHz ");
+ nss_info("748.8 MHz ");
} else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_1497) {
- nss_info_always("1.4976 GHz ");
+ nss_info("1.4976 GHz ");
} else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_1689) {
- nss_info_always("1.6896 GHz ");
+ nss_info("1.6896 GHz ");
} else {
nss_info_always("Error\nNo Table/Invalid Frequency Found\n");
return -EFAULT;
--- a/nss_hal/ipq807x/nss_hal_pvt.c
+++ b/nss_hal/ipq807x/nss_hal_pvt.c
@@ -571,16 +571,16 @@ static int __nss_hal_clock_configure(str
}
}
- nss_info_always("Supported Frequencies - ");
+ nss_info("Supported Frequencies - ");
for (i = 0; i < NSS_FREQ_MAX_SCALE; i++) {
if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_187) {
- nss_info_always("187.2 MHz ");
+ nss_info("187.2 MHz ");
} else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_748) {
- nss_info_always("748.8 MHz ");
+ nss_info("748.8 MHz ");
} else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_1497) {
- nss_info_always("1.4976 GHz ");
+ nss_info("1.4976 GHz ");
} else if (nss_runtime_samples.freq_scale[i].frequency == NSS_FREQ_1689) {
- nss_info_always("1.6896 GHz ");
+ nss_info("1.6896 GHz ");
} else {
nss_info_always("Error\nNo Table/Invalid Frequency Found\n");
return -EFAULT;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -572,7 +572,9 @@ int nss_hal_probe(struct platform_device
if (npd->wifioffload_enabled == NSS_FEATURE_ENABLED) {
nss_top->wifi_handler_id = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_VAP] = nss_dev->id;
+#if defined(NSS_HAL_IPQ806x_SUPPORT)
nss_wifi_register_handler();
+#endif
nss_wifili_register_handler();
#ifdef NSS_DRV_WIFI_EXT_VDEV_ENABLE
nss_wifi_ext_vdev_register_handler();

View File

@ -0,0 +1,183 @@
--- a/nss_hal/fsm9010/nss_hal_pvt.c
+++ b/nss_hal/fsm9010/nss_hal_pvt.c
@@ -291,7 +291,7 @@ static int __nss_hal_request_irq(struct
}
int_ctx->irq = npd->irq[irq_num];
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
return 0;
}
--- a/nss_hal/ipq50xx/nss_hal_pvt.c
+++ b/nss_hal/ipq50xx/nss_hal_pvt.c
@@ -598,7 +598,7 @@ static int __nss_hal_request_irq(struct
return err;
}
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
int_ctx->cause = cause;
err = request_irq(irq, nss_hal_handle_irq, 0, irq_name, int_ctx);
if (err) {
--- a/nss_hal/ipq60xx/nss_hal_pvt.c
+++ b/nss_hal/ipq60xx/nss_hal_pvt.c
@@ -614,62 +614,62 @@ static int __nss_hal_request_irq(struct
irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY);
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_SOS) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFERS_SOS;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_sos", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_QUEUE) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT);
int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFER_QUEUE;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_queue", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_TX_UNBLOCKED) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT);
int_ctx->cause = NSS_N2H_INTR_TX_UNBLOCKED;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss-tx-unblock", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_0) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_0;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue0", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_1) {
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_1;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue1", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_2) {
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_2;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue2", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_3) {
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_3;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue3", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_COREDUMP_COMPLETE) {
int_ctx->cause = NSS_N2H_INTR_COREDUMP_COMPLETE;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_coredump_complete", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PAGED_EMPTY_BUFFER_SOS) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
int_ctx->cause = NSS_N2H_INTR_PAGED_EMPTY_BUFFERS_SOS;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_paged_empty_buf_sos", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PROFILE_DMA) {
int_ctx->cause = NSS_N2H_INTR_PROFILE_DMA;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_profile_dma", int_ctx);
}
--- a/nss_hal/ipq806x/nss_hal_pvt.c
+++ b/nss_hal/ipq806x/nss_hal_pvt.c
@@ -1186,7 +1186,7 @@ static int __nss_hal_request_irq(struct
}
int_ctx->irq = npd->irq[irq_num];
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
return 0;
}
--- a/nss_hal/ipq807x/nss_hal_pvt.c
+++ b/nss_hal/ipq807x/nss_hal_pvt.c
@@ -657,62 +657,62 @@ static int __nss_hal_request_irq(struct
irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY);
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_SOS) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFERS_SOS;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_sos", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_QUEUE) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT);
int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFER_QUEUE;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_queue", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_TX_UNBLOCKED) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT);
int_ctx->cause = NSS_N2H_INTR_TX_UNBLOCKED;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss-tx-unblock", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_0) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_0;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue0", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_1) {
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_1;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue1", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_2) {
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_2;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue2", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_3) {
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_3;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue3", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_COREDUMP_COMPLETE) {
int_ctx->cause = NSS_N2H_INTR_COREDUMP_COMPLETE;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_coredump_complete", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PAGED_EMPTY_BUFFER_SOS) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
int_ctx->cause = NSS_N2H_INTR_PAGED_EMPTY_BUFFERS_SOS;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_paged_empty_buf_sos", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PROFILE_DMA) {
int_ctx->cause = NSS_N2H_INTR_PROFILE_DMA;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_profile_dma", int_ctx);
}

View File

@ -0,0 +1,14 @@
--- a/nss_stats.c
+++ b/nss_stats.c
@@ -388,8 +388,9 @@ size_t nss_stats_print(char *node, char
*/
void nss_stats_create_dentry(char *name, const struct file_operations *ops)
{
- if (!debugfs_create_file(name, 0400, nss_top_main.stats_dentry, &nss_top_main, ops)) {
- nss_warning("Failed to create debug entry for subsystem %s\n", name);
+ if (!debugfs_lookup(name, nss_top_main.stats_dentry))
+ if (!debugfs_create_file(name, 0400, nss_top_main.stats_dentry, &nss_top_main, ops)) {
+ nss_warning("Failed to create debug entry for subsystem %s\n", name);
}
}

View File

@ -0,0 +1,40 @@
--- a/nss_igs.c
+++ b/nss_igs.c
@@ -163,7 +163,7 @@ EXPORT_SYMBOL(nss_igs_register_if);
* nss_igs_get_context()
* Get the IGS context.
*/
-struct nss_ctx_instance *nss_igs_get_context()
+struct nss_ctx_instance *nss_igs_get_context(void)
{
return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.igs_handler_id];
}
@@ -177,8 +177,9 @@ EXPORT_SYMBOL(nss_igs_get_context);
void nss_igs_module_save(struct tc_action_ops *act, struct module *module)
{
nss_assert(act);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
nss_assert(act->type == TCA_ACT_MIRRED_NSS);
-
+#endif
nss_igs_module = module;
}
EXPORT_SYMBOL(nss_igs_module_save);
@@ -188,7 +189,7 @@ EXPORT_SYMBOL(nss_igs_module_save);
* nss_igs_module_get()
* Get the ingress shaping module reference.
*/
-bool nss_igs_module_get()
+bool nss_igs_module_get(void)
{
nss_assert(nss_igs_module);
return try_module_get(nss_igs_module);
@@ -199,7 +200,7 @@ EXPORT_SYMBOL(nss_igs_module_get);
* nss_igs_module_put()
* Release the ingress shaping module reference.
*/
-void nss_igs_module_put()
+void nss_igs_module_put(void)
{
nss_assert(nss_igs_module);
module_put(nss_igs_module);

View File

@ -0,0 +1,558 @@
From e6814c47d22ee5133a71016375239f87ea265794 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 5 Apr 2022 15:38:18 +0200
Subject: [PATCH 4/4] nss-drv: rework NSS_CORE_DMA_CACHE_MAINT ops
Rework NSS_CORE_DMA_CACHE_MAINT ops to use standard dma sync ops instead
of using the direct arch function. This permit to skip any hack/patch
needed for nss-drv to correctly compile on upstream kernel.
We drop any NSS_CORE_DMA_CACHE_MAINT use in nss_core and we correctly
use the dma_sync_single_for_device we correctly dma addr using the new
DMA helper.
We drop sync for IOREMAP addr and we just leave a memory block.
We hope the nss_profiler is correctly ported.
We finally drop the NSS_CORE_DMA_CACHE_MAINT jus in case someone wants
to use it.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
nss_core.c | 136 +++++++++++++++++++++++++---------
nss_core.h | 41 +++++-----
nss_hal/ipq806x/nss_hal_pvt.c | 5 +-
nss_hal/ipq807x/nss_hal_pvt.c | 5 +-
nss_meminfo.c | 5 +-
nss_profiler.c | 3 +-
6 files changed, 127 insertions(+), 68 deletions(-)
--- a/nss_core.c
+++ b/nss_core.c
@@ -1421,6 +1421,8 @@ static inline void nss_core_handle_empty
uint32_t count, uint32_t hlos_index,
uint16_t mask)
{
+ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
+
while (count) {
/*
* Since we only return the primary skb, we have no way to unmap
@@ -1474,7 +1476,9 @@ next:
n2h_desc_ring->hlos_index = hlos_index;
if_map->n2h_hlos_index[NSS_IF_N2H_EMPTY_BUFFER_RETURN_QUEUE] = hlos_index;
- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->n2h_hlos_index[NSS_IF_N2H_EMPTY_BUFFER_RETURN_QUEUE], sizeof(uint32_t), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev,
+ n2h_hlos_index_to_dma(mem_ctx->if_map_dma, NSS_IF_N2H_EMPTY_BUFFER_RETURN_QUEUE),
+ sizeof(uint32_t), DMA_TO_DEVICE);
NSS_CORE_DSB();
}
@@ -1496,6 +1500,7 @@ static int32_t nss_core_handle_cause_que
struct nss_ctx_instance *nss_ctx = int_ctx->nss_ctx;
struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
struct nss_if_mem_map *if_map = mem_ctx->if_map;
+ int dma_size;
qid = nss_core_cause_to_queue(cause);
@@ -1507,7 +1512,8 @@ static int32_t nss_core_handle_cause_que
n2h_desc_ring = &nss_ctx->n2h_desc_ring[qid];
desc_if = &n2h_desc_ring->desc_ring;
desc_ring = desc_if->desc;
- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->n2h_nss_index[qid], sizeof(uint32_t), DMA_FROM_DEVICE);
+ dma_sync_single_for_cpu(nss_ctx->dev, n2h_nss_index_to_dma(mem_ctx->if_map_dma, qid),
+ sizeof(uint32_t), DMA_FROM_DEVICE);
NSS_CORE_DSB();
nss_index = if_map->n2h_nss_index[qid];
@@ -1536,13 +1542,23 @@ static int32_t nss_core_handle_cause_que
start = hlos_index;
end = (hlos_index + count) & mask;
if (end > start) {
- dmac_inv_range((void *)&desc_ring[start], (void *)&desc_ring[end] + sizeof(struct n2h_descriptor));
+ dma_size = sizeof(struct n2h_descriptor) * (end - start + 1);
+
+ dma_sync_single_for_cpu(nss_ctx->dev, n2h_desc_index_to_dma(if_map, qid, start),
+ dma_size, DMA_FROM_DEVICE);
} else {
/*
* We have wrapped around
*/
- dmac_inv_range((void *)&desc_ring[start], (void *)&desc_ring[mask] + sizeof(struct n2h_descriptor));
- dmac_inv_range((void *)&desc_ring[0], (void *)&desc_ring[end] + sizeof(struct n2h_descriptor));
+ dma_size = sizeof(struct n2h_descriptor) * (mask - start + 1);
+
+ dma_sync_single_for_cpu(nss_ctx->dev, n2h_desc_index_to_dma(if_map, qid, start),
+ dma_size, DMA_FROM_DEVICE);
+
+ dma_size = sizeof(struct n2h_descriptor) * (end + 1);
+
+ dma_sync_single_for_cpu(nss_ctx->dev, n2h_desc_index_to_dma(if_map, qid, 0), dma_size,
+ DMA_FROM_DEVICE);
}
/*
@@ -1671,7 +1687,8 @@ next:
n2h_desc_ring->hlos_index = hlos_index;
if_map->n2h_hlos_index[qid] = hlos_index;
- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->n2h_hlos_index[qid], sizeof(uint32_t), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, n2h_hlos_index_to_dma(mem_ctx->if_map_dma, qid),
+ sizeof(uint32_t), DMA_TO_DEVICE);
NSS_CORE_DSB();
return count;
@@ -1683,11 +1700,12 @@ next:
*/
static void nss_core_init_nss(struct nss_ctx_instance *nss_ctx, struct nss_if_mem_map *if_map)
{
+ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
struct nss_top_instance *nss_top;
int ret;
int i;
- NSS_CORE_DMA_CACHE_MAINT((void *)if_map, sizeof(*if_map), DMA_FROM_DEVICE);
+ dma_sync_single_for_cpu(nss_ctx->dev, mem_ctx->if_map_dma, sizeof(*if_map), DMA_FROM_DEVICE);
NSS_CORE_DSB();
/*
@@ -1763,6 +1781,7 @@ static void nss_core_alloc_paged_buffers
uint16_t count, int16_t mask, int32_t hlos_index, uint32_t alloc_fail_count,
uint32_t buffer_type, uint32_t buffer_queue, uint32_t stats_index)
{
+ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
struct sk_buff *nbuf;
struct page *npage;
struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[buffer_queue];
@@ -1832,7 +1851,9 @@ static void nss_core_alloc_paged_buffers
/*
* Flush the descriptor
*/
- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev,
+ h2n_desc_index_to_dma(if_map, buffer_queue, hlos_index),
+ sizeof(*desc), DMA_TO_DEVICE);
hlos_index = (hlos_index + 1) & (mask);
count--;
@@ -1846,7 +1867,8 @@ static void nss_core_alloc_paged_buffers
h2n_desc_ring->hlos_index = hlos_index;
if_map->h2n_hlos_index[buffer_queue] = hlos_index;
- NSS_CORE_DMA_CACHE_MAINT(&if_map->h2n_hlos_index[buffer_queue], sizeof(uint32_t), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_hlos_index_to_dma(mem_ctx->if_map_dma, buffer_queue),
+ sizeof(uint32_t), DMA_TO_DEVICE);
NSS_CORE_DSB();
NSS_PKT_STATS_INC(&nss_top->stats_drv[stats_index]);
@@ -1859,7 +1881,7 @@ static void nss_core_alloc_paged_buffers
static void nss_core_alloc_jumbo_mru_buffers(struct nss_ctx_instance *nss_ctx, struct nss_if_mem_map *if_map,
int jumbo_mru, uint16_t count, int16_t mask, int32_t hlos_index)
{
-
+ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
struct sk_buff *nbuf;
struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_BUFFER_QUEUE];
struct h2n_desc_if_instance *desc_if = &h2n_desc_ring->desc_ring;
@@ -1906,7 +1928,9 @@ static void nss_core_alloc_jumbo_mru_buf
/*
* Flush the descriptor
*/
- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev,
+ h2n_desc_index_to_dma(if_map, NSS_IF_H2N_EMPTY_BUFFER_QUEUE, hlos_index),
+ sizeof(*desc), DMA_TO_DEVICE);
hlos_index = (hlos_index + 1) & (mask);
count--;
@@ -1920,7 +1944,8 @@ static void nss_core_alloc_jumbo_mru_buf
h2n_desc_ring->hlos_index = hlos_index;
if_map->h2n_hlos_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE] = hlos_index;
- NSS_CORE_DMA_CACHE_MAINT(&if_map->h2n_hlos_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE], sizeof(uint32_t), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_hlos_index_to_dma(mem_ctx->if_map_dma, NSS_IF_H2N_EMPTY_BUFFER_QUEUE),
+ sizeof(uint32_t), DMA_TO_DEVICE);
NSS_CORE_DSB();
NSS_PKT_STATS_INC(&nss_top->stats_drv[NSS_DRV_STATS_TX_EMPTY]);
@@ -1933,6 +1958,7 @@ static void nss_core_alloc_jumbo_mru_buf
static void nss_core_alloc_max_avail_size_buffers(struct nss_ctx_instance *nss_ctx, struct nss_if_mem_map *if_map,
uint16_t max_buf_size, uint16_t count, int16_t mask, int32_t hlos_index)
{
+ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_BUFFER_QUEUE];
struct h2n_desc_if_instance *desc_if = &h2n_desc_ring->desc_ring;
struct h2n_descriptor *desc_ring = desc_if->desc;
@@ -1940,6 +1966,7 @@ static void nss_core_alloc_max_avail_siz
uint16_t payload_len = max_buf_size + NET_SKB_PAD;
uint16_t start = hlos_index;
uint16_t prev_hlos_index;
+ int dma_size;
while (count) {
dma_addr_t buffer;
@@ -1992,13 +2019,26 @@ static void nss_core_alloc_max_avail_siz
* Flush the descriptors, including the descriptor at prev_hlos_index.
*/
if (prev_hlos_index > start) {
- dmac_clean_range((void *)&desc_ring[start], (void *)&desc_ring[prev_hlos_index] + sizeof(struct h2n_descriptor));
+ dma_size = sizeof(struct h2n_descriptor) * (prev_hlos_index - start + 1);
+
+ dma_sync_single_for_device(nss_ctx->dev,
+ h2n_desc_index_to_dma(if_map, NSS_IF_H2N_EMPTY_BUFFER_QUEUE, start),
+ dma_size, DMA_TO_DEVICE);
} else {
/*
* We have wrapped around
*/
- dmac_clean_range((void *)&desc_ring[start], (void *)&desc_ring[mask] + sizeof(struct h2n_descriptor));
- dmac_clean_range((void *)&desc_ring[0], (void *)&desc_ring[prev_hlos_index] + sizeof(struct h2n_descriptor));
+ dma_size = sizeof(struct h2n_descriptor) * (mask - start + 1);
+
+ dma_sync_single_for_device(nss_ctx->dev,
+ h2n_desc_index_to_dma(if_map, NSS_IF_H2N_EMPTY_BUFFER_QUEUE, start),
+ dma_size, DMA_TO_DEVICE);
+
+ dma_size = sizeof(struct h2n_descriptor) * (prev_hlos_index + 1);
+
+ dma_sync_single_for_device(nss_ctx->dev,
+ h2n_desc_index_to_dma(if_map, NSS_IF_H2N_EMPTY_BUFFER_QUEUE, 0),
+ dma_size, DMA_TO_DEVICE);
}
/*
@@ -2009,7 +2049,8 @@ static void nss_core_alloc_max_avail_siz
h2n_desc_ring->hlos_index = hlos_index;
if_map->h2n_hlos_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE] = hlos_index;
- NSS_CORE_DMA_CACHE_MAINT(&if_map->h2n_hlos_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE], sizeof(uint32_t), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_hlos_index_to_dma(mem_ctx->if_map_dma, NSS_IF_H2N_EMPTY_BUFFER_QUEUE),
+ sizeof(uint32_t), DMA_TO_DEVICE);
NSS_CORE_DSB();
NSS_PKT_STATS_INC(&nss_top->stats_drv[NSS_DRV_STATS_TX_EMPTY]);
@@ -2022,6 +2063,7 @@ static void nss_core_alloc_max_avail_siz
static inline void nss_core_handle_empty_buffer_sos(struct nss_ctx_instance *nss_ctx,
struct nss_if_mem_map *if_map, uint16_t max_buf_size)
{
+ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
uint16_t count, size, mask;
int32_t nss_index, hlos_index;
struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_BUFFER_QUEUE];
@@ -2032,7 +2074,8 @@ static inline void nss_core_handle_empty
/*
* Check how many empty buffers could be filled in queue
*/
- NSS_CORE_DMA_CACHE_MAINT(&if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE], sizeof(uint32_t), DMA_FROM_DEVICE);
+ dma_sync_single_for_cpu(nss_ctx->dev, h2n_nss_index_to_dma(mem_ctx->if_map_dma, NSS_IF_H2N_EMPTY_BUFFER_QUEUE),
+ sizeof(uint32_t), DMA_FROM_DEVICE);
NSS_CORE_DSB();
nss_index = if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE];
@@ -2077,6 +2120,7 @@ static inline void nss_core_handle_empty
static inline void nss_core_handle_paged_empty_buffer_sos(struct nss_ctx_instance *nss_ctx,
struct nss_if_mem_map *if_map, uint16_t max_buf_size)
{
+ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
uint16_t count, size, mask;
int32_t nss_index, hlos_index;
struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE];
@@ -2084,7 +2128,8 @@ static inline void nss_core_handle_paged
/*
* Check how many empty buffers could be filled in queue
*/
- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE], sizeof(uint32_t), DMA_FROM_DEVICE);
+ dma_sync_single_for_cpu(nss_ctx->dev, h2n_nss_index_to_dma(mem_ctx->if_map_dma, NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE),
+ sizeof(uint32_t), DMA_FROM_DEVICE);
NSS_CORE_DSB();
nss_index = if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE];
@@ -2652,9 +2697,11 @@ void nss_skb_reuse(struct sk_buff *nbuf)
* Sends one skb to NSS FW
*/
static inline int32_t nss_core_send_buffer_simple_skb(struct nss_ctx_instance *nss_ctx,
- struct h2n_desc_if_instance *desc_if, uint32_t if_num,
- struct sk_buff *nbuf, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss)
+ struct h2n_desc_if_instance *desc_if, uint32_t if_num, struct sk_buff *nbuf,
+ uint16_t qid, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss)
{
+ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
+ struct nss_if_mem_map *if_map = mem_ctx->if_map;
struct h2n_descriptor *desc_ring = desc_if->desc;
struct h2n_descriptor *desc;
uint16_t bit_flags;
@@ -2708,7 +2755,8 @@ static inline int32_t nss_core_send_buff
(nss_ptr_t)nbuf, (uint16_t)(nbuf->data - nbuf->head), nbuf->len,
sz, (uint32_t)nbuf->priority, mss, bit_flags);
- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index),
+ sizeof(*desc), DMA_TO_DEVICE);
/*
* We are done using the skb fields and can reuse it now
@@ -2732,7 +2780,8 @@ no_reuse:
(nss_ptr_t)nbuf, (uint16_t)(nbuf->data - nbuf->head), nbuf->len,
(uint16_t)skb_end_offset(nbuf), (uint32_t)nbuf->priority, mss, bit_flags);
- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index),
+ sizeof(*desc), DMA_TO_DEVICE);
NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_SIMPLE]);
return 1;
@@ -2746,9 +2795,11 @@ no_reuse:
* Used to differentiate from FRAGLIST
*/
static inline int32_t nss_core_send_buffer_nr_frags(struct nss_ctx_instance *nss_ctx,
- struct h2n_desc_if_instance *desc_if, uint32_t if_num,
- struct sk_buff *nbuf, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss)
+ struct h2n_desc_if_instance *desc_if, uint32_t if_num, struct sk_buff *nbuf,
+ uint16_t qid, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss)
{
+ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
+ struct nss_if_mem_map *if_map = mem_ctx->if_map;
struct h2n_descriptor *desc_ring = desc_if->desc;
struct h2n_descriptor *desc;
const skb_frag_t *frag;
@@ -2788,7 +2839,8 @@ static inline int32_t nss_core_send_buff
(nss_ptr_t)NULL, nbuf->data - nbuf->head, nbuf->len - nbuf->data_len,
skb_end_offset(nbuf), (uint32_t)nbuf->priority, mss, bit_flags | H2N_BIT_FLAG_FIRST_SEGMENT);
- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index),
+ sizeof(*desc), DMA_TO_DEVICE);
/*
* Now handle rest of the fragments.
@@ -2812,7 +2864,8 @@ static inline int32_t nss_core_send_buff
(nss_ptr_t)NULL, 0, skb_frag_size(frag), skb_frag_size(frag),
nbuf->priority, mss, bit_flags);
- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index),
+ sizeof(*desc), DMA_TO_DEVICE);
}
/*
@@ -2828,7 +2881,8 @@ static inline int32_t nss_core_send_buff
desc->bit_flags &= ~(H2N_BIT_FLAG_DISCARD);
desc->opaque = (nss_ptr_t)nbuf;
- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index),
+ sizeof(*desc), DMA_TO_DEVICE);
NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_NR_FRAGS]);
return i+1;
@@ -2842,9 +2896,11 @@ static inline int32_t nss_core_send_buff
* Used to differentiate from FRAGS
*/
static inline int32_t nss_core_send_buffer_fraglist(struct nss_ctx_instance *nss_ctx,
- struct h2n_desc_if_instance *desc_if, uint32_t if_num,
- struct sk_buff *nbuf, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss)
+ struct h2n_desc_if_instance *desc_if, uint32_t if_num, struct sk_buff *nbuf,
+ uint16_t qid, uint16_t hlos_index, uint16_t flags, uint8_t buffer_type, uint16_t mss)
{
+ struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
+ struct nss_if_mem_map *if_map = mem_ctx->if_map;
struct h2n_descriptor *desc_ring = desc_if->desc;
struct h2n_descriptor *desc;
dma_addr_t buffer;
@@ -2883,7 +2939,8 @@ static inline int32_t nss_core_send_buff
(nss_ptr_t)nbuf, nbuf->data - nbuf->head, nbuf->len - nbuf->data_len,
skb_end_offset(nbuf), (uint32_t)nbuf->priority, mss, bit_flags | H2N_BIT_FLAG_FIRST_SEGMENT);
- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index),
+ sizeof(*desc), DMA_TO_DEVICE);
/*
* Walk the frag_list in nbuf
@@ -2936,7 +2993,8 @@ static inline int32_t nss_core_send_buff
(nss_ptr_t)iter, iter->data - iter->head, iter->len - iter->data_len,
skb_end_offset(iter), iter->priority, mss, bit_flags);
- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index),
+ sizeof(*desc), DMA_TO_DEVICE);
i++;
}
@@ -2955,7 +3013,8 @@ static inline int32_t nss_core_send_buff
* Update bit flag for last descriptor.
*/
desc->bit_flags |= H2N_BIT_FLAG_LAST_SEGMENT;
- NSS_CORE_DMA_CACHE_MAINT((void *)desc, sizeof(*desc), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_desc_index_to_dma(if_map, qid, hlos_index),
+ sizeof(*desc), DMA_TO_DEVICE);
NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_FRAGLIST]);
return i+1;
@@ -3034,8 +3093,10 @@ int32_t nss_core_send_buffer(struct nss_
* We need to work out if there's sufficent space in our transmit descriptor
* ring to place all the segments of a nbuf.
*/
- NSS_CORE_DMA_CACHE_MAINT((void *)&if_map->h2n_nss_index[qid], sizeof(uint32_t), DMA_FROM_DEVICE);
+ dma_sync_single_for_cpu(nss_ctx->dev, h2n_nss_index_to_dma(mem_ctx->if_map_dma, qid),
+ sizeof(uint32_t), DMA_FROM_DEVICE);
NSS_CORE_DSB();
+
nss_index = if_map->h2n_nss_index[qid];
h2n_desc_ring->nss_index_local = nss_index;
count = ((nss_index - hlos_index - 1) + size) & (mask);
@@ -3100,13 +3161,13 @@ int32_t nss_core_send_buffer(struct nss_
count = 0;
if (likely((segments == 0) || is_bounce)) {
count = nss_core_send_buffer_simple_skb(nss_ctx, desc_if, if_num,
- nbuf, hlos_index, flags, buffer_type, mss);
+ nbuf, qid, hlos_index, flags, buffer_type, mss);
} else if (skb_has_frag_list(nbuf)) {
count = nss_core_send_buffer_fraglist(nss_ctx, desc_if, if_num,
- nbuf, hlos_index, flags, buffer_type, mss);
+ nbuf, qid, hlos_index, flags, buffer_type, mss);
} else {
count = nss_core_send_buffer_nr_frags(nss_ctx, desc_if, if_num,
- nbuf, hlos_index, flags, buffer_type, mss);
+ nbuf, qid, hlos_index, flags, buffer_type, mss);
}
if (unlikely(count <= 0)) {
@@ -3130,7 +3191,8 @@ int32_t nss_core_send_buffer(struct nss_
h2n_desc_ring->hlos_index = hlos_index;
if_map->h2n_hlos_index[qid] = hlos_index;
- NSS_CORE_DMA_CACHE_MAINT(&if_map->h2n_hlos_index[qid], sizeof(uint32_t), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, h2n_hlos_index_to_dma(mem_ctx->if_map_dma, qid),
+ sizeof(uint32_t), DMA_TO_DEVICE);
NSS_CORE_DSB();
#ifdef CONFIG_DEBUG_KMEMLEAK
--- a/nss_core.h
+++ b/nss_core.h
@@ -100,31 +100,30 @@
#endif
/*
- * Cache operation
+ * DMA Offset helper
*/
-#define NSS_CORE_DSB() dsb(sy)
-#define NSS_CORE_DMA_CACHE_MAINT(start, size, dir) nss_core_dma_cache_maint(start, size, dir)
+#define n2h_desc_index_offset(_index) sizeof(struct n2h_descriptor) * (_index)
+#define h2n_desc_index_offset(_index) sizeof(struct h2n_descriptor) * (_index)
+
+#define n2h_desc_index_to_dma(_if_map_addr, _qid, _index) (_if_map_addr)->n2h_desc_if[(_qid)].desc_addr + n2h_desc_index_offset(_index)
+#define h2n_desc_index_to_dma(_if_map_addr, _qid, _index) (_if_map_addr)->h2n_desc_if[(_qid)].desc_addr + h2n_desc_index_offset(_index)
+
+#define h2n_nss_index_offset offsetof(struct nss_if_mem_map, h2n_nss_index)
+#define n2h_nss_index_offset offsetof(struct nss_if_mem_map, n2h_nss_index)
+#define h2n_hlos_index_offset offsetof(struct nss_if_mem_map, h2n_hlos_index)
+#define n2h_hlos_index_offset offsetof(struct nss_if_mem_map, n2h_hlos_index)
+
+#define h2n_nss_index_to_dma(_if_map_addr, _index) (_if_map_addr) + h2n_nss_index_offset + (sizeof(uint32_t) * (_index))
+#define n2h_nss_index_to_dma(_if_map_addr, _index) (_if_map_addr) + n2h_nss_index_offset + (sizeof(uint32_t) * (_index))
+#define h2n_hlos_index_to_dma(_if_map_addr, _index) (_if_map_addr) + h2n_hlos_index_offset + (sizeof(uint32_t) * (_index))
+#define n2h_hlos_index_to_dma(_if_map_addr, _index) (_if_map_addr) + n2h_hlos_index_offset + (sizeof(uint32_t) * (_index))
/*
- * nss_core_dma_cache_maint()
- * Perform the appropriate cache op based on direction
+ * Cache operation
*/
-static inline void nss_core_dma_cache_maint(void *start, uint32_t size, int direction)
-{
- switch (direction) {
- case DMA_FROM_DEVICE:/* invalidate only */
- dmac_inv_range(start, start + size);
- break;
- case DMA_TO_DEVICE:/* writeback only */
- dmac_clean_range(start, start + size);
- break;
- case DMA_BIDIRECTIONAL:/* writeback and invalidate */
- dmac_flush_range(start, start + size);
- break;
- default:
- BUG();
- }
-}
+#define NSS_CORE_DSB() dsb(sy)
+#define NSS_CORE_DMA_CACHE_MAINT(dev, start, size, dir) BUILD_BUG_ON_MSG(1, \
+ "NSS_CORE_DMA_CACHE_MAINT is deprecated. Fix the code to use correct dma_sync_* API")
#define NSS_DEVICE_IF_START NSS_PHYSICAL_IF_START
--- a/nss_hal/ipq806x/nss_hal_pvt.c
+++ b/nss_hal/ipq806x/nss_hal_pvt.c
@@ -477,10 +477,9 @@ static struct nss_platform_data *__nss_h
/*
* Clear TCM memory used by this core
*/
- for (i = 0; i < resource_size(&res_vphys) ; i += 4) {
+ for (i = 0; i < resource_size(&res_vphys) ; i += 4)
nss_write_32(npd->vmap, i, 0);
- NSS_CORE_DMA_CACHE_MAINT((npd->vmap + i), 4, DMA_TO_DEVICE);
- }
+
NSS_CORE_DSB();
/*
--- a/nss_hal/ipq807x/nss_hal_pvt.c
+++ b/nss_hal/ipq807x/nss_hal_pvt.c
@@ -256,10 +256,9 @@ static struct nss_platform_data *__nss_h
/*
* Clear TCM memory used by this core
*/
- for (i = 0; i < resource_size(&res_vphys) ; i += 4) {
+ for (i = 0; i < resource_size(&res_vphys) ; i += 4)
nss_write_32(npd->vmap, i, 0);
- NSS_CORE_DMA_CACHE_MAINT((npd->vmap + i), 4, DMA_TO_DEVICE);
- }
+
NSS_CORE_DSB();
/*
--- a/nss_meminfo.c
+++ b/nss_meminfo.c
@@ -415,7 +415,6 @@ static bool nss_meminfo_init_block_lists
/*
* Flush the updated meminfo request.
*/
- NSS_CORE_DMA_CACHE_MAINT(r, sizeof(struct nss_meminfo_request), DMA_TO_DEVICE);
NSS_CORE_DSB();
/*
@@ -546,7 +545,7 @@ static bool nss_meminfo_configure_n2h_h2
* Bring a fresh copy of if_map from memory in order to read it correctly.
*/
if_map = mem_ctx->if_map;
- NSS_CORE_DMA_CACHE_MAINT((void *)if_map, sizeof(struct nss_if_mem_map), DMA_FROM_DEVICE);
+ dma_sync_single_for_cpu(nss_ctx->dev, mem_ctx->if_map_dma, sizeof(struct nss_if_mem_map), DMA_FROM_DEVICE);
NSS_CORE_DSB();
if_map->n2h_rings = NSS_N2H_RING_COUNT;
@@ -584,7 +583,7 @@ static bool nss_meminfo_configure_n2h_h2
/*
* Flush the updated nss_if_mem_map.
*/
- NSS_CORE_DMA_CACHE_MAINT((void *)if_map, sizeof(struct nss_if_mem_map), DMA_TO_DEVICE);
+ dma_sync_single_for_device(nss_ctx->dev, mem_ctx->if_map_dma, sizeof(struct nss_if_mem_map), DMA_TO_DEVICE);
NSS_CORE_DSB();
return true;
--- a/nss_profiler.c
+++ b/nss_profiler.c
@@ -209,11 +209,12 @@ EXPORT_SYMBOL(nss_profile_dma_deregister
struct nss_profile_sdma_ctrl *nss_profile_dma_get_ctrl(struct nss_ctx_instance *nss_ctx)
{
struct nss_profile_sdma_ctrl *ctrl = nss_ctx->meminfo_ctx.sdma_ctrl;
+ int size = offsetof(struct nss_profile_sdma_ctrl, cidx);
if (!ctrl) {
return ctrl;
}
- dmac_inv_range(ctrl, &ctrl->cidx);
+ dma_sync_single_for_cpu(nss_ctx->dev, (dma_addr_t) ctrl, size, DMA_FROM_DEVICE);
dsb(sy);
return ctrl;
}

View File

@ -0,0 +1,39 @@
--- a/nss_stats.c
+++ b/nss_stats.c
@@ -401,7 +401,7 @@ void nss_stats_create_dentry(char *name,
/*
* gmac_stats_ops
*/
-NSS_STATS_DECLARE_FILE_OPERATIONS(gmac);
+// NSS_STATS_DECLARE_FILE_OPERATIONS(gmac);
/*
* wt_stats_ops
@@ -456,7 +456,7 @@ void nss_stats_init(void)
/*
* gmac_stats
*/
- nss_stats_create_dentry("gmac", &nss_gmac_stats_ops);
+ // nss_stats_create_dentry("gmac", &nss_gmac_stats_ops);
/*
* Per-project stats
--- a/Makefile
+++ b/Makefile
@@ -40,7 +40,6 @@ qca-nss-drv-objs += nss_hal/nss_hal.o
ifneq "$(NSS_DRV_POINT_OFFLOAD)" "y"
qca-nss-drv-objs += \
- nss_gmac_stats.o \
nss_if.o \
nss_if_log.o \
nss_phys_if.o \
@@ -381,7 +380,7 @@ endif
ifeq ($(SoC),$(filter $(SoC),ipq806x))
ccflags-y += -DNSS_DRV_IPV4_ENABLE -DNSS_DRV_IPV6_ENABLE
qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \
- nss_hal/ipq806x/nss_hal_pvt.o
+ nss_hal/ipq806x/nss_hal_pvt.o nss_gmac_stats.o
ifneq "$(NSS_DRV_C2C_ENABLE)" "n"
ccflags-y += -DNSS_DRV_C2C_ENABLE