nss-packages-qosmio/qca-nss-drv/patches/0013-backport-12.1.patch
Qosmio 69febdb1da QSDK 12.1 backport + fixes
* qca-nss-drv: backport 12.1 (add more firmware checks)
    * qca-nss-ecm: backport 12.1
    * qca-nss-gmac: consolidate patches
2022-09-16 08:19:33 -04:00

717 lines
21 KiB
Diff

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