mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-11-03 03:47:50 +00:00 
			
		
		
		
	ipq807x: update to 11.4-CS
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		@@ -6,7 +6,7 @@ PKG_SOURCE_PROTO:=git
 | 
				
			|||||||
PKG_BRANCH:=master
 | 
					PKG_BRANCH:=master
 | 
				
			||||||
PKG_RELEASE:=2
 | 
					PKG_RELEASE:=2
 | 
				
			||||||
PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-clients/
 | 
					PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-clients/
 | 
				
			||||||
PKG_VERSION:=9136ef60bf68ceed760781d3acbeddb05470e432
 | 
					PKG_VERSION:=153998d70fdba508a59a28c13a606032cbf32686
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 | 
					PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 | 
				
			||||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 | 
					PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 | 
				
			||||||
@@ -24,17 +24,10 @@ else
 | 
				
			|||||||
subtarget:=$(CONFIG_TARGET_BOARD)
 | 
					subtarget:=$(CONFIG_TARGET_BOARD)
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_ipq807x" "ipq60xx" "ipq807x_ipq60xx"))
 | 
					 | 
				
			||||||
# DTLS Manager v2.0 for Hawkeye/Cypress
 | 
					# DTLS Manager v2.0 for Hawkeye/Cypress
 | 
				
			||||||
  DTLSMGR_DIR:=v2.0
 | 
					  DTLSMGR_DIR:=v2.0
 | 
				
			||||||
# IPsec Manager v2.0 for Hawkeye/Cypress
 | 
					# IPsec Manager v2.0 for Hawkeye/Cypress
 | 
				
			||||||
  IPSECMGR_DIR:=v2.0
 | 
					  IPSECMGR_DIR:=v2.0
 | 
				
			||||||
else
 | 
					 | 
				
			||||||
# DTLS Manager v1.0 for Akronite.
 | 
					 | 
				
			||||||
  DTLSMGR_DIR:=v1.0
 | 
					 | 
				
			||||||
# IPsec Manager v1.0 for Akronite.
 | 
					 | 
				
			||||||
  IPSECMGR_DIR:=v1.0
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
define KernelPackage/qca-nss-drv-tun6rd
 | 
					define KernelPackage/qca-nss-drv-tun6rd
 | 
				
			||||||
  SECTION:=kernel
 | 
					  SECTION:=kernel
 | 
				
			||||||
@@ -437,6 +430,20 @@ define Build/InstallDev/qca-nss-clients
 | 
				
			|||||||
	$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-clients/
 | 
						$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-clients/
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					define KernelPackage/qca-nss-drv-wifi-meshmgr
 | 
				
			||||||
 | 
					  SECTION:=kernel
 | 
				
			||||||
 | 
					  CATEGORY:=Kernel modules
 | 
				
			||||||
 | 
					  SUBMENU:=Network Devices
 | 
				
			||||||
 | 
					  DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18
 | 
				
			||||||
 | 
					  TITLE:=NSS WiFi-Mesh Manager for QCA NSS driver
 | 
				
			||||||
 | 
					  FILES:=$(PKG_BUILD_DIR)/wifi_meshmgr/qca-nss-wifi-meshmgr.ko
 | 
				
			||||||
 | 
					  AUTOLOAD:=$(call AutoLoad,51,qca-nss-wifi-meshmgr)
 | 
				
			||||||
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					define KernelPackage/qca-nss-drv-wifi-meshmgr/Description
 | 
				
			||||||
 | 
					Kernel module for WiFi Mesh manager
 | 
				
			||||||
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define Build/InstallDev
 | 
					define Build/InstallDev
 | 
				
			||||||
	$(call Build/InstallDev/qca-nss-clients,$(1))
 | 
						$(call Build/InstallDev/qca-nss-clients,$(1))
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
@@ -585,6 +592,10 @@ ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-mirror),)
 | 
				
			|||||||
MAKE_OPTS+=mirror=y
 | 
					MAKE_OPTS+=mirror=y
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-wifi-meshmgr),)
 | 
				
			||||||
 | 
					MAKE_OPTS+=wifi-meshmgr=y
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define Build/Compile
 | 
					define Build/Compile
 | 
				
			||||||
	$(MAKE) -C "$(LINUX_DIR)" $(strip $(MAKE_OPTS)) \
 | 
						$(MAKE) -C "$(LINUX_DIR)" $(strip $(MAKE_OPTS)) \
 | 
				
			||||||
		CROSS_COMPILE="$(TARGET_CROSS)" \
 | 
							CROSS_COMPILE="$(TARGET_CROSS)" \
 | 
				
			||||||
@@ -624,3 +635,4 @@ $(eval $(call KernelPackage,qca-nss-drv-vxlanmgr))
 | 
				
			|||||||
$(eval $(call KernelPackage,qca-nss-drv-match))
 | 
					$(eval $(call KernelPackage,qca-nss-drv-match))
 | 
				
			||||||
#$(eval $(call KernelPackage,qca-nss-drv-tlsmgr))
 | 
					#$(eval $(call KernelPackage,qca-nss-drv-tlsmgr))
 | 
				
			||||||
$(eval $(call KernelPackage,qca-nss-drv-mirror))
 | 
					$(eval $(call KernelPackage,qca-nss-drv-mirror))
 | 
				
			||||||
 | 
					$(eval $(call KernelPackage,qca-nss-drv-wifi-meshmgr))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,7 +30,7 @@ NSS_DP_INCLUDE += -I$(obj)/hal/gmac_hal_ops/syn/gmac
 | 
				
			|||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ccflags-y += $(NSS_DP_INCLUDE)
 | 
					ccflags-y += $(NSS_DP_INCLUDE)
 | 
				
			||||||
ccflags-y += -Werror
 | 
					ccflags-y += -Wall -Werror
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64 ipq60xx ipq60xx_64))
 | 
					ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64 ipq60xx ipq60xx_64))
 | 
				
			||||||
ccflags-y += -DNSS_DP_PPE_SUPPORT
 | 
					ccflags-y += -DNSS_DP_PPE_SUPPORT
 | 
				
			||||||
@@ -43,7 +43,7 @@ endif
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64))
 | 
					ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64))
 | 
				
			||||||
qca-nss-dp-objs += hal/arch/ipq807x/nss_ipq807x.o
 | 
					qca-nss-dp-objs += hal/arch/ipq807x/nss_ipq807x.o
 | 
				
			||||||
ccflags-y += -DNSS_DP_IPQ807X
 | 
					ccflags-y += -DNSS_DP_IPQ807X -DNSS_DP_EDMA_TX_SMALL_PKT_WAR
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq ($(SoC),$(filter $(SoC),ipq50xx ipq50xx_64))
 | 
					ifeq ($(SoC),$(filter $(SoC),ipq50xx ipq50xx_64))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,8 +68,13 @@ static void nss_dp_hal_tcsr_set(void)
 | 
				
			|||||||
	 * If TZ is not enabled, we can write to the register directly.
 | 
						 * If TZ is not enabled, we can write to the register directly.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (qcom_scm_is_available()) {
 | 
						if (qcom_scm_is_available()) {
 | 
				
			||||||
 | 
					#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
 | 
				
			||||||
		err = qcom_scm_tcsr_reg_write((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
 | 
							err = qcom_scm_tcsr_reg_write((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
 | 
				
			||||||
						TCSR_GMAC_AXI_CACHE_OVERRIDE_VALUE);
 | 
											TCSR_GMAC_AXI_CACHE_OVERRIDE_VALUE);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
							err = qti_scm_tcsr_reg_write((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
 | 
				
			||||||
 | 
											TCSR_GMAC_AXI_CACHE_OVERRIDE_VALUE);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		if (err) {
 | 
							if (err) {
 | 
				
			||||||
			pr_err("%s: SCM TCSR write error: %d\n", __func__, err);
 | 
								pr_err("%s: SCM TCSR write error: %d\n", __func__, err);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * 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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for any
 | 
				
			||||||
 * purpose with or without fee is hereby granted, provided that the above
 | 
					 * purpose with or without fee is hereby granted, provided that the above
 | 
				
			||||||
@@ -67,6 +67,76 @@ void edma_reg_write(uint32_t reg_off, uint32_t val)
 | 
				
			|||||||
	writel(val, edma_hw.reg_base + reg_off);
 | 
						writel(val, edma_hw.reg_base + reg_off);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * edma_disable_interrupts()
 | 
				
			||||||
 | 
					 *	Disable EDMA RX/TX interrupt masks.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static void edma_disable_interrupts(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct edma_rxdesc_ring *rxdesc_ring = NULL;
 | 
				
			||||||
 | 
						struct edma_rxfill_ring *rxfill_ring = NULL;
 | 
				
			||||||
 | 
						struct edma_txcmpl_ring *txcmpl_ring = NULL;
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (i = 0; i < edma_hw.rxdesc_rings; i++) {
 | 
				
			||||||
 | 
							rxdesc_ring = &edma_hw.rxdesc_ring[i];
 | 
				
			||||||
 | 
							edma_reg_write(EDMA_REG_RXDESC_INT_MASK(rxdesc_ring->id),
 | 
				
			||||||
 | 
								       EDMA_MASK_INT_CLEAR);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (i = 0; i < edma_hw.txcmpl_rings; i++) {
 | 
				
			||||||
 | 
							txcmpl_ring = &edma_hw.txcmpl_ring[i];
 | 
				
			||||||
 | 
							edma_reg_write(EDMA_REG_TX_INT_MASK(txcmpl_ring->id),
 | 
				
			||||||
 | 
								       EDMA_MASK_INT_CLEAR);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (i = 0; i < edma_hw.rxfill_rings; i++) {
 | 
				
			||||||
 | 
							rxfill_ring = &edma_hw.rxfill_ring[i];
 | 
				
			||||||
 | 
							edma_reg_write(EDMA_REG_RXFILL_INT_MASK(rxfill_ring->id),
 | 
				
			||||||
 | 
								       EDMA_MASK_INT_CLEAR);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Clear MISC interrupt mask.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						edma_reg_write(EDMA_REG_MISC_INT_MASK, EDMA_MASK_INT_CLEAR);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * edma_enable_interrupts()
 | 
				
			||||||
 | 
					 *	Enable RX/TX EDMA interrupt masks.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static void edma_enable_interrupts(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct edma_rxdesc_ring *rxdesc_ring = NULL;
 | 
				
			||||||
 | 
						struct edma_rxfill_ring *rxfill_ring = NULL;
 | 
				
			||||||
 | 
						struct edma_txcmpl_ring *txcmpl_ring = NULL;
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (i = 0; i < edma_hw.rxfill_rings; i++) {
 | 
				
			||||||
 | 
							rxfill_ring = &edma_hw.rxfill_ring[i];
 | 
				
			||||||
 | 
							edma_reg_write(EDMA_REG_RXFILL_INT_MASK(rxfill_ring->id),
 | 
				
			||||||
 | 
									edma_hw.rxfill_intr_mask);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (i = 0; i < edma_hw.txcmpl_rings; i++) {
 | 
				
			||||||
 | 
							txcmpl_ring = &edma_hw.txcmpl_ring[i];
 | 
				
			||||||
 | 
							edma_reg_write(EDMA_REG_TX_INT_MASK(txcmpl_ring->id),
 | 
				
			||||||
 | 
									edma_hw.txcmpl_intr_mask);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (i = 0; i < edma_hw.rxdesc_rings; i++) {
 | 
				
			||||||
 | 
							rxdesc_ring = &edma_hw.rxdesc_ring[i];
 | 
				
			||||||
 | 
							edma_reg_write(EDMA_REG_RXDESC_INT_MASK(rxdesc_ring->id),
 | 
				
			||||||
 | 
									edma_hw.rxdesc_intr_mask);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Enable MISC interrupt mask.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						edma_reg_write(EDMA_REG_MISC_INT_MASK, edma_hw.misc_intr_mask);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_dp_edma_if_open()
 | 
					 * nss_dp_edma_if_open()
 | 
				
			||||||
 *	Do slow path data plane open
 | 
					 *	Do slow path data plane open
 | 
				
			||||||
@@ -85,6 +155,12 @@ static int edma_if_open(struct nss_dp_data_plane_ctx *dpc,
 | 
				
			|||||||
		return NSS_DP_SUCCESS;
 | 
							return NSS_DP_SUCCESS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	napi_enable(&edma_hw.napi);
 | 
						napi_enable(&edma_hw.napi);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Enable the interrupt masks.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						edma_enable_interrupts();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return NSS_DP_SUCCESS;
 | 
						return NSS_DP_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -97,6 +173,11 @@ static int edma_if_close(struct nss_dp_data_plane_ctx *dpc)
 | 
				
			|||||||
	if (--edma_hw.active != 0)
 | 
						if (--edma_hw.active != 0)
 | 
				
			||||||
		return NSS_DP_SUCCESS;
 | 
							return NSS_DP_SUCCESS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Disable the interrupt masks.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						edma_disable_interrupts();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Disable NAPI
 | 
						 * Disable NAPI
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
@@ -311,9 +392,6 @@ static int edma_if_deinit(struct nss_dp_data_plane_ctx *dpc)
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
static int edma_irq_init(void)
 | 
					static int edma_irq_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct edma_rxdesc_ring *rxdesc_ring = NULL;
 | 
					 | 
				
			||||||
	struct edma_rxfill_ring *rxfill_ring = NULL;
 | 
					 | 
				
			||||||
	struct edma_txcmpl_ring *txcmpl_ring = NULL;
 | 
					 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	uint32_t entry_num, i;
 | 
						uint32_t entry_num, i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -433,28 +511,6 @@ static int edma_irq_init(void)
 | 
				
			|||||||
		goto misc_intr_req_fail;
 | 
							goto misc_intr_req_fail;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * Set interrupt mask
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	for (i = 0; i < edma_hw.rxfill_rings; i++) {
 | 
					 | 
				
			||||||
		rxfill_ring = &edma_hw.rxfill_ring[i];
 | 
					 | 
				
			||||||
		edma_reg_write(EDMA_REG_RXFILL_INT_MASK(rxfill_ring->id),
 | 
					 | 
				
			||||||
				edma_hw.rxfill_intr_mask);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (i = 0; i < edma_hw.txcmpl_rings; i++) {
 | 
					 | 
				
			||||||
		txcmpl_ring = &edma_hw.txcmpl_ring[i];
 | 
					 | 
				
			||||||
		edma_reg_write(EDMA_REG_TX_INT_MASK(txcmpl_ring->id),
 | 
					 | 
				
			||||||
				edma_hw.txcmpl_intr_mask);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (i = 0; i < edma_hw.rxdesc_rings; i++) {
 | 
					 | 
				
			||||||
		rxdesc_ring = &edma_hw.rxdesc_ring[i];
 | 
					 | 
				
			||||||
		edma_reg_write(EDMA_REG_RXDESC_INT_MASK(rxdesc_ring->id),
 | 
					 | 
				
			||||||
				edma_hw.rxdesc_intr_mask);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	edma_reg_write(EDMA_REG_MISC_INT_MASK, edma_hw.misc_intr_mask);
 | 
					 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
misc_intr_req_fail:
 | 
					misc_intr_req_fail:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2016, 2018-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2016, 2018-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
@@ -30,7 +30,7 @@
 | 
				
			|||||||
#define EDMA_NAPI_WORK			100
 | 
					#define EDMA_NAPI_WORK			100
 | 
				
			||||||
#define EDMA_START_GMACS		NSS_DP_START_IFNUM
 | 
					#define EDMA_START_GMACS		NSS_DP_START_IFNUM
 | 
				
			||||||
#define EDMA_MAX_GMACS			NSS_DP_HAL_MAX_PORTS
 | 
					#define EDMA_MAX_GMACS			NSS_DP_HAL_MAX_PORTS
 | 
				
			||||||
#define EDMA_TX_PKT_MIN_SIZE		33
 | 
					#define EDMA_TX_PKT_MIN_SIZE		33	/* IPQ807x EDMA needs a minimum packet size of 33 bytes */
 | 
				
			||||||
#if defined(NSS_DP_IPQ60XX)
 | 
					#if defined(NSS_DP_IPQ60XX)
 | 
				
			||||||
#define EDMA_MAX_TXCMPL_RINGS		24	/* Max TxCmpl rings */
 | 
					#define EDMA_MAX_TXCMPL_RINGS		24	/* Max TxCmpl rings */
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2016-2018, 2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2016-2018, 2020-21, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for any
 | 
					 * Permission to use, copy, modify, and/or distribute this software for any
 | 
				
			||||||
 * purpose with or without fee is hereby granted, provided that the above
 | 
					 * purpose with or without fee is hereby granted, provided that the above
 | 
				
			||||||
@@ -524,7 +524,7 @@ enum edma_tx edma_ring_xmit(struct edma_hw *ehw,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	struct nss_dp_dev *dp_dev = netdev_priv(netdev);
 | 
						struct nss_dp_dev *dp_dev = netdev_priv(netdev);
 | 
				
			||||||
	struct edma_txdesc_desc *txdesc = NULL;
 | 
						struct edma_txdesc_desc *txdesc = NULL;
 | 
				
			||||||
	uint16_t buf_len = skb_headlen(skb);
 | 
						uint16_t buf_len;
 | 
				
			||||||
	uint16_t hw_next_to_use, hw_next_to_clean, chk_idx;
 | 
						uint16_t hw_next_to_use, hw_next_to_clean, chk_idx;
 | 
				
			||||||
	uint32_t data;
 | 
						uint32_t data;
 | 
				
			||||||
	uint32_t store_index = 0;
 | 
						uint32_t store_index = 0;
 | 
				
			||||||
@@ -560,6 +560,28 @@ enum edma_tx edma_ring_xmit(struct edma_hw *ehw,
 | 
				
			|||||||
		return EDMA_TX_DESC;
 | 
							return EDMA_TX_DESC;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(NSS_DP_EDMA_TX_SMALL_PKT_WAR)
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * IPQ807x EDMA hardware can't process the packet if the packet size is
 | 
				
			||||||
 | 
						 * less than EDMA_TX_PKT_MIN_SIZE (33 Byte). So, if the packet size
 | 
				
			||||||
 | 
						 * is indeed less than EDMA_TX_PKT_MIN_SIZE, perform padding
 | 
				
			||||||
 | 
						 * (if possible), otherwise drop the packet.
 | 
				
			||||||
 | 
						 * Using skb_padto() API for padding the packet. This API will drop
 | 
				
			||||||
 | 
						 * the packet if the padding is not possible.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						if (unlikely(skb->len < EDMA_TX_PKT_MIN_SIZE)) {
 | 
				
			||||||
 | 
							if (skb_padto(skb, EDMA_TX_PKT_MIN_SIZE)) {
 | 
				
			||||||
 | 
								netdev_dbg(netdev, "padding couldn't happen, skb is freed.\n");
 | 
				
			||||||
 | 
								netdev->stats.tx_dropped++;
 | 
				
			||||||
 | 
								spin_unlock_bh(&txdesc_ring->tx_lock);
 | 
				
			||||||
 | 
								return EDMA_TX_OK;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							skb->len = EDMA_TX_PKT_MIN_SIZE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						buf_len = skb_headlen(skb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Deliver the ptp packet to phy driver for TX timestamping
 | 
						 * Deliver the ptp packet to phy driver for TX timestamping
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
@@ -208,6 +208,10 @@ static int nss_dp_attr_set(struct net_device *dev,
 | 
				
			|||||||
				struct switchdev_trans *trans)
 | 
									struct switchdev_trans *trans)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct nss_dp_dev *dp_priv = (struct nss_dp_dev *)netdev_priv(dev);
 | 
						struct nss_dp_dev *dp_priv = (struct nss_dp_dev *)netdev_priv(dev);
 | 
				
			||||||
 | 
						struct net_device *upper_dev;
 | 
				
			||||||
 | 
						struct vlan_dev_priv *vlan;
 | 
				
			||||||
 | 
						struct list_head *iter;
 | 
				
			||||||
 | 
						uint32_t stp_state = attr->u.stp_state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (switchdev_trans_ph_prepare(trans))
 | 
						if (switchdev_trans_ph_prepare(trans))
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
@@ -218,7 +222,33 @@ static int nss_dp_attr_set(struct net_device *dev,
 | 
				
			|||||||
		netdev_dbg(dev, "set brport_flags %lu\n", attr->u.brport_flags);
 | 
							netdev_dbg(dev, "set brport_flags %lu\n", attr->u.brport_flags);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
 | 
						case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
 | 
				
			||||||
		return nss_dp_stp_state_set(dp_priv, attr->u.stp_state);
 | 
							/*
 | 
				
			||||||
 | 
							 * The stp state is not changed to FAL_STP_DISABLED if
 | 
				
			||||||
 | 
							 * the net_device (dev) has any vlan configured. Otherwise
 | 
				
			||||||
 | 
							 * traffic on other vlan(s) will not work.
 | 
				
			||||||
 | 
							 *
 | 
				
			||||||
 | 
							 * Note: STP for VLANs is not supported by PPE.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							if ((stp_state == BR_STATE_DISABLED) ||
 | 
				
			||||||
 | 
								(stp_state == BR_STATE_BLOCKING)) {
 | 
				
			||||||
 | 
								rcu_read_lock();
 | 
				
			||||||
 | 
								netdev_for_each_upper_dev_rcu(dev, upper_dev, iter) {
 | 
				
			||||||
 | 
									if (!is_vlan_dev(upper_dev))
 | 
				
			||||||
 | 
										continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									vlan = vlan_dev_priv(upper_dev);
 | 
				
			||||||
 | 
									if (vlan->real_dev == dev) {
 | 
				
			||||||
 | 
										rcu_read_unlock();
 | 
				
			||||||
 | 
										netdev_dbg(dev, "Do not update stp state to: %u since vlan id: %d is configured on netdevice: %s\n",
 | 
				
			||||||
 | 
												stp_state, vlan->vlan_id, vlan->real_dev->name);
 | 
				
			||||||
 | 
										return 0;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								rcu_read_unlock();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return nss_dp_stp_state_set(dp_priv, stp_state);
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		return -EOPNOTSUPP;
 | 
							return -EOPNOTSUPP;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,7 @@ ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_64" "ipq60xx" "ipq60xx_64
 | 
				
			|||||||
endif
 | 
					endif
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-gmac -I$(STAGING_DIR)/usr/include/qca-nss-dp
 | 
					EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-gmac -I$(STAGING_DIR)/usr/include/qca-nss-dp -I$(STAGING_DIR)/usr/include/qca-ssdk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Keeping default as ipq806x for branches that does not have subtarget framework
 | 
					# Keeping default as ipq806x for branches that does not have subtarget framework
 | 
				
			||||||
subtarget:=$(SUBTARGET)
 | 
					subtarget:=$(SUBTARGET)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,8 +8,6 @@ obj-m += qca-nss-drv.o
 | 
				
			|||||||
# List the files that belong to the driver in alphabetical order.
 | 
					# List the files that belong to the driver in alphabetical order.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
qca-nss-drv-objs := \
 | 
					qca-nss-drv-objs := \
 | 
				
			||||||
			nss_bridge.o \
 | 
					 | 
				
			||||||
			nss_bridge_log.o \
 | 
					 | 
				
			||||||
			nss_cmn.o \
 | 
								nss_cmn.o \
 | 
				
			||||||
			nss_core.o \
 | 
								nss_core.o \
 | 
				
			||||||
			nss_coredump.o \
 | 
								nss_coredump.o \
 | 
				
			||||||
@@ -29,16 +27,6 @@ qca-nss-drv-objs := \
 | 
				
			|||||||
			nss_ipv4_stats.o \
 | 
								nss_ipv4_stats.o \
 | 
				
			||||||
			nss_ipv4_strings.o \
 | 
								nss_ipv4_strings.o \
 | 
				
			||||||
			nss_ipv4_log.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_log.o \
 | 
				
			||||||
			nss_lso_rx.o \
 | 
								nss_lso_rx.o \
 | 
				
			||||||
			nss_lso_rx_stats.o \
 | 
								nss_lso_rx_stats.o \
 | 
				
			||||||
@@ -70,21 +58,48 @@ qca-nss-drv-objs := \
 | 
				
			|||||||
			nss_wifi_log.o \
 | 
								nss_wifi_log.o \
 | 
				
			||||||
			nss_wifi_stats.o \
 | 
								nss_wifi_stats.o \
 | 
				
			||||||
			nss_wifi_vdev.o \
 | 
								nss_wifi_vdev.o \
 | 
				
			||||||
			nss_wifi_if.o \
 | 
					 | 
				
			||||||
			nss_wifi_if_stats.o \
 | 
					 | 
				
			||||||
			nss_wifili.o \
 | 
								nss_wifili.o \
 | 
				
			||||||
			nss_wifili_log.o \
 | 
								nss_wifili_log.o \
 | 
				
			||||||
			nss_wifili_stats.o \
 | 
								nss_wifili_stats.o \
 | 
				
			||||||
			nss_wifili_strings.o \
 | 
								nss_wifili_strings.o \
 | 
				
			||||||
			nss_wifi_mac_db.o \
 | 
								nss_wifi_mac_db.o
 | 
				
			||||||
			nss_wifi_ext_vdev.o \
 | 
					 | 
				
			||||||
			nss_wifi_ext_vdev_stats.o \
 | 
					 | 
				
			||||||
			nss_wifi_ext_vdev_log.o
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Base NSS data plane/HAL support
 | 
					# Base NSS data plane/HAL support
 | 
				
			||||||
qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o
 | 
					qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o
 | 
				
			||||||
qca-nss-drv-objs += nss_hal/nss_hal.o
 | 
					qca-nss-drv-objs += nss_hal/nss_hal.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n"
 | 
				
			||||||
 | 
					ccflags-y += -DNSS_DRV_BRIDGE_ENABLE
 | 
				
			||||||
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
 | 
							    nss_bridge.o \
 | 
				
			||||||
 | 
							    nss_bridge_log.o
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ifneq "$(NSS_DRV_WIFI_EXT_VDEV_ENABLE)" "n"
 | 
				
			||||||
 | 
					ccflags-y += -DNSS_DRV_WIFI_EXT_VDEV_ENABLE
 | 
				
			||||||
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
 | 
							    nss_wifi_ext_vdev.o \
 | 
				
			||||||
 | 
							    nss_wifi_ext_vdev_stats.o \
 | 
				
			||||||
 | 
							    nss_wifi_ext_vdev_log.o
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ifneq "$(NSS_DRV_WIFI_MESH_ENABLE)" "n"
 | 
				
			||||||
 | 
					ccflags-y += -DNSS_DRV_WIFI_MESH_ENABLE
 | 
				
			||||||
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
 | 
							    nss_wifi_mesh.o \
 | 
				
			||||||
 | 
							    nss_wifi_mesh_log.o \
 | 
				
			||||||
 | 
							    nss_wifi_mesh_stats.o \
 | 
				
			||||||
 | 
							    nss_wifi_mesh_strings.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"
 | 
					ifneq "$(NSS_DRV_L2TP_ENABLE)" "n"
 | 
				
			||||||
ccflags-y += -DNSS_DRV_L2TP_ENABLE
 | 
					ccflags-y += -DNSS_DRV_L2TP_ENABLE
 | 
				
			||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
@@ -109,6 +124,22 @@ qca-nss-drv-objs += \
 | 
				
			|||||||
			 nss_pvxlan_stats.o
 | 
								 nss_pvxlan_stats.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ifneq "$(NSS_DRV_IPV6_ENABLE)" "n"
 | 
				
			||||||
 | 
					ccflags-y += -DNSS_DRV_IPV6_ENABLE
 | 
				
			||||||
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
 | 
								nss_ipv6.o \
 | 
				
			||||||
 | 
								nss_ipv6_stats.o \
 | 
				
			||||||
 | 
								nss_ipv6_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
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq "$(NSS_DRV_TSTAMP_ENABLE)" "n"
 | 
					ifneq "$(NSS_DRV_TSTAMP_ENABLE)" "n"
 | 
				
			||||||
ccflags-y += -DNSS_DRV_TSTAMP_ENABLE
 | 
					ccflags-y += -DNSS_DRV_TSTAMP_ENABLE
 | 
				
			||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
@@ -121,7 +152,8 @@ ccflags-y += -DNSS_DRV_GRE_ENABLE
 | 
				
			|||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
			 nss_gre.o \
 | 
								 nss_gre.o \
 | 
				
			||||||
			 nss_gre_log.o \
 | 
								 nss_gre_log.o \
 | 
				
			||||||
			 nss_gre_stats.o
 | 
								 nss_gre_stats.o \
 | 
				
			||||||
 | 
								 nss_gre_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq "$(NSS_DRV_GRE_REDIR_ENABLE)" "n"
 | 
					ifneq "$(NSS_DRV_GRE_REDIR_ENABLE)" "n"
 | 
				
			||||||
@@ -132,13 +164,17 @@ qca-nss-drv-objs += \
 | 
				
			|||||||
			 nss_gre_redir_lag_ds.o \
 | 
								 nss_gre_redir_lag_ds.o \
 | 
				
			||||||
			 nss_gre_redir_lag_ds_log.o \
 | 
								 nss_gre_redir_lag_ds_log.o \
 | 
				
			||||||
			 nss_gre_redir_lag_ds_stats.o \
 | 
								 nss_gre_redir_lag_ds_stats.o \
 | 
				
			||||||
 | 
								 nss_gre_redir_lag_ds_strings.o \
 | 
				
			||||||
			 nss_gre_redir_lag_us.o \
 | 
								 nss_gre_redir_lag_us.o \
 | 
				
			||||||
			 nss_gre_redir_lag_us_log.o \
 | 
								 nss_gre_redir_lag_us_log.o \
 | 
				
			||||||
			 nss_gre_redir_lag_us_stats.o \
 | 
								 nss_gre_redir_lag_us_stats.o \
 | 
				
			||||||
 | 
								 nss_gre_redir_lag_us_strings.o \
 | 
				
			||||||
			 nss_gre_redir_stats.o \
 | 
								 nss_gre_redir_stats.o \
 | 
				
			||||||
 | 
								 nss_gre_redir_strings.o \
 | 
				
			||||||
			 nss_gre_redir_mark.o \
 | 
								 nss_gre_redir_mark.o \
 | 
				
			||||||
			 nss_gre_redir_mark_log.o \
 | 
								 nss_gre_redir_mark_log.o \
 | 
				
			||||||
			 nss_gre_redir_mark_stats.o
 | 
								 nss_gre_redir_mark_stats.o \
 | 
				
			||||||
 | 
								 nss_gre_redir_mark_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq "$(NSS_DRV_GRE_TUNNEL_ENABLE)" "n"
 | 
					ifneq "$(NSS_DRV_GRE_TUNNEL_ENABLE)" "n"
 | 
				
			||||||
@@ -146,7 +182,8 @@ ccflags-y += -DNSS_DRV_GRE_TUNNEL_ENABLE
 | 
				
			|||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
			 nss_gre_tunnel.o \
 | 
								 nss_gre_tunnel.o \
 | 
				
			||||||
			 nss_gre_tunnel_log.o \
 | 
								 nss_gre_tunnel_log.o \
 | 
				
			||||||
			 nss_gre_tunnel_stats.o
 | 
								 nss_gre_tunnel_stats.o \
 | 
				
			||||||
 | 
								 nss_gre_tunnel_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq "$(NSS_DRV_CAPWAP_ENABLE)" "n"
 | 
					ifneq "$(NSS_DRV_CAPWAP_ENABLE)" "n"
 | 
				
			||||||
@@ -255,7 +292,8 @@ ccflags-y += -DNSS_DRV_CLMAP_ENABLE
 | 
				
			|||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
			 nss_clmap.o \
 | 
								 nss_clmap.o \
 | 
				
			||||||
			 nss_clmap_log.o \
 | 
								 nss_clmap_log.o \
 | 
				
			||||||
			 nss_clmap_stats.o
 | 
								 nss_clmap_stats.o \
 | 
				
			||||||
 | 
								 nss_clmap_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -272,7 +310,8 @@ ccflags-y += -DNSS_DRV_MATCH_ENABLE
 | 
				
			|||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
			nss_match.o \
 | 
								nss_match.o \
 | 
				
			||||||
			nss_match_log.o \
 | 
								nss_match_log.o \
 | 
				
			||||||
			nss_match_stats.o
 | 
								nss_match_stats.o \
 | 
				
			||||||
 | 
								nss_match_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n"
 | 
					ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n"
 | 
				
			||||||
@@ -280,7 +319,17 @@ ccflags-y += -DNSS_DRV_MIRROR_ENABLE
 | 
				
			|||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
			nss_mirror.o \
 | 
								nss_mirror.o \
 | 
				
			||||||
			nss_mirror_log.o \
 | 
								nss_mirror_log.o \
 | 
				
			||||||
			nss_mirror_stats.o
 | 
								nss_mirror_stats.o \
 | 
				
			||||||
 | 
								nss_mirror_strings.o
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ifneq "$(NSS_DRV_UDP_ST_ENABLE)" "n"
 | 
				
			||||||
 | 
					ccflags-y += -DNSS_DRV_UDP_ST_ENABLE
 | 
				
			||||||
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
 | 
								nss_udp_st.o \
 | 
				
			||||||
 | 
								nss_udp_st_log.o \
 | 
				
			||||||
 | 
								nss_udp_st_stats.o \
 | 
				
			||||||
 | 
								nss_udp_st_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq ($(SoC),$(filter $(SoC),ipq806x))
 | 
					ifeq ($(SoC),$(filter $(SoC),ipq806x))
 | 
				
			||||||
@@ -330,6 +379,7 @@ qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \
 | 
				
			|||||||
					nss_ppe.o \
 | 
										nss_ppe.o \
 | 
				
			||||||
					nss_ppe_log.o \
 | 
										nss_ppe_log.o \
 | 
				
			||||||
					nss_ppe_stats.o \
 | 
										nss_ppe_stats.o \
 | 
				
			||||||
 | 
										nss_ppe_strings.o \
 | 
				
			||||||
					nss_ppe_vp.o \
 | 
										nss_ppe_vp.o \
 | 
				
			||||||
					nss_ppe_vp_log.o \
 | 
										nss_ppe_vp_log.o \
 | 
				
			||||||
					nss_ppe_vp_stats.o
 | 
										nss_ppe_vp_stats.o
 | 
				
			||||||
@@ -341,7 +391,9 @@ ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n"
 | 
				
			|||||||
ccflags-y += -DNSS_DRV_IPSEC_ENABLE
 | 
					ccflags-y += -DNSS_DRV_IPSEC_ENABLE
 | 
				
			||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
		    nss_ipsec_cmn_log.o \
 | 
							    nss_ipsec_cmn_log.o \
 | 
				
			||||||
		    nss_ipsec_cmn.o
 | 
							    nss_ipsec_cmn.o \
 | 
				
			||||||
 | 
							    nss_ipsec_cmn_stats.o \
 | 
				
			||||||
 | 
							    nss_ipsec_cmn_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n"
 | 
					ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n"
 | 
				
			||||||
@@ -351,6 +403,8 @@ ccflags-y += -DNSS_DRV_DMA_ENABLE
 | 
				
			|||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
		    nss_crypto_cmn.o \
 | 
							    nss_crypto_cmn.o \
 | 
				
			||||||
		    nss_crypto_cmn_log.o \
 | 
							    nss_crypto_cmn_log.o \
 | 
				
			||||||
 | 
							    nss_crypto_cmn_stats.o \
 | 
				
			||||||
 | 
							    nss_crypto_cmn_strings.o \
 | 
				
			||||||
		    nss_dma.o \
 | 
							    nss_dma.o \
 | 
				
			||||||
		    nss_dma_log.o \
 | 
							    nss_dma_log.o \
 | 
				
			||||||
		    nss_dma_stats.o \
 | 
							    nss_dma_stats.o \
 | 
				
			||||||
@@ -361,21 +415,26 @@ ifneq "$(NSS_DRV_DTLS_ENABLE)" "n"
 | 
				
			|||||||
ccflags-y += -DNSS_DRV_DTLS_ENABLE
 | 
					ccflags-y += -DNSS_DRV_DTLS_ENABLE
 | 
				
			||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
		    nss_dtls_cmn.o \
 | 
							    nss_dtls_cmn.o \
 | 
				
			||||||
		    nss_dtls_cmn_log.o
 | 
							    nss_dtls_cmn_log.o \
 | 
				
			||||||
 | 
							    nss_dtls_cmn_stats.o \
 | 
				
			||||||
 | 
							    nss_dtls_cmn_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq "$(NSS_DRV_QVPN_ENABLE)" "n"
 | 
					ifneq "$(NSS_DRV_QVPN_ENABLE)" "n"
 | 
				
			||||||
ccflags-y += -DNSS_DRV_QVPN_ENABLE
 | 
					ccflags-y += -DNSS_DRV_QVPN_ENABLE
 | 
				
			||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
	     nss_qvpn.o \
 | 
						     nss_qvpn.o \
 | 
				
			||||||
 | 
						     nss_qvpn_log.o \
 | 
				
			||||||
	     nss_qvpn_stats.o \
 | 
						     nss_qvpn_stats.o \
 | 
				
			||||||
             nss_qvpn_log.o
 | 
						     nss_qvpn_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
ifneq "$(NSS_DRV_TLS_ENABLE)" "n"
 | 
					ifneq "$(NSS_DRV_TLS_ENABLE)" "n"
 | 
				
			||||||
ccflags-y += -DNSS_DRV_TLS_ENABLE
 | 
					ccflags-y += -DNSS_DRV_TLS_ENABLE
 | 
				
			||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
		     nss_tls.o \
 | 
							     nss_tls.o \
 | 
				
			||||||
		     nss_tls_log.o
 | 
							     nss_tls_log.o \
 | 
				
			||||||
 | 
							     nss_tls_stats.o \
 | 
				
			||||||
 | 
							     nss_tls_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -411,21 +470,27 @@ ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n"
 | 
				
			|||||||
ccflags-y += -DNSS_DRV_IPSEC_ENABLE
 | 
					ccflags-y += -DNSS_DRV_IPSEC_ENABLE
 | 
				
			||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
		    nss_ipsec_cmn_log.o \
 | 
							    nss_ipsec_cmn_log.o \
 | 
				
			||||||
		    nss_ipsec_cmn.o
 | 
							    nss_ipsec_cmn.o \
 | 
				
			||||||
 | 
							    nss_ipsec_cmn_stats.o \
 | 
				
			||||||
 | 
							    nss_ipsec_cmn_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n"
 | 
					ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n"
 | 
				
			||||||
ccflags-y += -DNSS_DRV_CRYPTO_ENABLE
 | 
					ccflags-y += -DNSS_DRV_CRYPTO_ENABLE
 | 
				
			||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
		    nss_crypto_cmn.o \
 | 
							    nss_crypto_cmn.o \
 | 
				
			||||||
		    nss_crypto_cmn_log.o
 | 
							    nss_crypto_cmn_log.o \
 | 
				
			||||||
 | 
							    nss_crypto_cmn_stats.o \
 | 
				
			||||||
 | 
							    nss_crypto_cmn_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq "$(NSS_DRV_DTLS_ENABLE)" "n"
 | 
					ifneq "$(NSS_DRV_DTLS_ENABLE)" "n"
 | 
				
			||||||
ccflags-y += -DNSS_DRV_DTLS_ENABLE
 | 
					ccflags-y += -DNSS_DRV_DTLS_ENABLE
 | 
				
			||||||
qca-nss-drv-objs += \
 | 
					qca-nss-drv-objs += \
 | 
				
			||||||
		    nss_dtls_cmn.o \
 | 
							    nss_dtls_cmn.o \
 | 
				
			||||||
		    nss_dtls_cmn_log.o
 | 
							    nss_dtls_cmn_log.o \
 | 
				
			||||||
 | 
							    nss_dtls_cmn_stats.o \
 | 
				
			||||||
 | 
							    nss_dtls_cmn_strings.o
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
ccflags-y += -I$(obj)/nss_hal/ipq50xx -DNSS_HAL_IPQ50XX_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT
 | 
					ccflags-y += -I$(obj)/nss_hal/ipq50xx -DNSS_HAL_IPQ50XX_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
@@ -433,7 +498,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_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 += -I$(obj)/nss_data_plane/hal/include
 | 
				
			||||||
ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_REUSE_SUPPORT=1
 | 
					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)))
 | 
					KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										524
									
								
								feeds/ipq807x/qca-nss-drv/src/exports/nss_api_if.h
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										524
									
								
								feeds/ipq807x/qca-nss-drv/src/exports/nss_api_if.h
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -65,7 +65,6 @@
 | 
				
			|||||||
#include "nss_wifi_vdev.h"
 | 
					#include "nss_wifi_vdev.h"
 | 
				
			||||||
#include "nss_n2h.h"
 | 
					#include "nss_n2h.h"
 | 
				
			||||||
#include "nss_rps.h"
 | 
					#include "nss_rps.h"
 | 
				
			||||||
#include "nss_wifi_if.h"
 | 
					 | 
				
			||||||
#include "nss_portid.h"
 | 
					#include "nss_portid.h"
 | 
				
			||||||
#include "nss_oam.h"
 | 
					#include "nss_oam.h"
 | 
				
			||||||
#include "nss_dtls.h"
 | 
					#include "nss_dtls.h"
 | 
				
			||||||
@@ -100,6 +99,10 @@
 | 
				
			|||||||
#include "nss_lso_rx.h"
 | 
					#include "nss_lso_rx.h"
 | 
				
			||||||
#include "nss_wifi_mac_db_if.h"
 | 
					#include "nss_wifi_mac_db_if.h"
 | 
				
			||||||
#include "nss_wifi_ext_vdev_if.h"
 | 
					#include "nss_wifi_ext_vdev_if.h"
 | 
				
			||||||
 | 
					#include "nss_wifili_if.h"
 | 
				
			||||||
 | 
					#include "nss_ppe_vp.h"
 | 
				
			||||||
 | 
					#include "nss_wifi_mesh.h"
 | 
				
			||||||
 | 
					#include "nss_udp_st.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /*__KERNEL__ */
 | 
					#endif /*__KERNEL__ */
 | 
				
			||||||
@@ -120,7 +123,7 @@
 | 
				
			|||||||
#define NSS_MAX_PHYSICAL_INTERFACES 8	/**< Maximum number of physical interfaces. */
 | 
					#define NSS_MAX_PHYSICAL_INTERFACES 8	/**< Maximum number of physical interfaces. */
 | 
				
			||||||
#define NSS_MAX_VIRTUAL_INTERFACES 16	/**< Maximum number of virtual interfaces. */
 | 
					#define NSS_MAX_VIRTUAL_INTERFACES 16	/**< Maximum number of virtual interfaces. */
 | 
				
			||||||
#define NSS_MAX_TUNNEL_INTERFACES 4	/**< Maximum number of tunnel interfaces. */
 | 
					#define NSS_MAX_TUNNEL_INTERFACES 4	/**< Maximum number of tunnel interfaces. */
 | 
				
			||||||
#define NSS_MAX_SPECIAL_INTERFACES 68	/**< Maximum number of special interfaces. */
 | 
					#define NSS_MAX_SPECIAL_INTERFACES 69	/**< Maximum number of special interfaces. */
 | 
				
			||||||
#define NSS_MAX_WIFI_RADIO_INTERFACES 3	/**< Maximum number of radio interfaces. */
 | 
					#define NSS_MAX_WIFI_RADIO_INTERFACES 3	/**< Maximum number of radio interfaces. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
@@ -271,511 +274,12 @@
 | 
				
			|||||||
#define NSS_DMA_INTERFACE (NSS_SPECIAL_IF_START + 66)
 | 
					#define NSS_DMA_INTERFACE (NSS_SPECIAL_IF_START + 66)
 | 
				
			||||||
		/**< Special interface number for the DMA interface. */
 | 
							/**< Special interface number for the DMA interface. */
 | 
				
			||||||
#define NSS_WIFI_EXT_VDEV_INTERFACE (NSS_SPECIAL_IF_START + 67)
 | 
					#define NSS_WIFI_EXT_VDEV_INTERFACE (NSS_SPECIAL_IF_START + 67)
 | 
				
			||||||
		/**< Special interface number for WiFi extended virtual interface. */
 | 
							/**< Special interface number for the Wi-Fi extended virtual interface. */
 | 
				
			||||||
 | 
					#define NSS_UDP_ST_INTERFACE (NSS_SPECIAL_IF_START + 68)
 | 
				
			||||||
 | 
							/**< Special interface number for the UDP speed test interface. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __KERNEL__ /* only kernel will use. */
 | 
					#ifdef __KERNEL__ /* only kernel will use. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Wireless Multimedia Extention Access Category to TID. @hideinitializer
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define NSS_WIFILI_WME_AC_TO_TID(_ac) (	\
 | 
					 | 
				
			||||||
		((_ac) == NSS_WIFILI_WME_AC_VO) ? 6 : \
 | 
					 | 
				
			||||||
		(((_ac) == NSS_WIFILI_WME_AC_VI) ? 5 : \
 | 
					 | 
				
			||||||
		(((_ac) == NSS_WIFILI_WME_AC_BK) ? 1 : \
 | 
					 | 
				
			||||||
		0)))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Wireless TID to Wireless Extension Multimedia Access Category. @hideinitializer
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define NSS_WIFILI_TID_TO_WME_AC(_tid) (	\
 | 
					 | 
				
			||||||
		(((_tid) == 0) || ((_tid) == 3)) ? NSS_WIFILI_WME_AC_BE : \
 | 
					 | 
				
			||||||
		((((_tid) == 1) || ((_tid) == 2)) ? NSS_WIFILI_WME_AC_BK : \
 | 
					 | 
				
			||||||
		((((_tid) == 4) || ((_tid) == 5)) ? NSS_WIFILI_WME_AC_VI : \
 | 
					 | 
				
			||||||
		NSS_WIFILI_WME_AC_VO)))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Converts the format of an IPv6 address from Linux to NSS. @hideinitializer
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define IN6_ADDR_TO_IPV6_ADDR(ipv6, in6) \
 | 
					 | 
				
			||||||
	{ \
 | 
					 | 
				
			||||||
		((uint32_t *)ipv6)[0] = in6.in6_u.u6_addr32[0]; \
 | 
					 | 
				
			||||||
		((uint32_t *)ipv6)[1] = in6.in6_u.u6_addr32[1]; \
 | 
					 | 
				
			||||||
		((uint32_t *)ipv6)[2] = in6.in6_u.u6_addr32[2]; \
 | 
					 | 
				
			||||||
		((uint32_t *)ipv6)[3] = in6.in6_u.u6_addr32[3]; \
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Converts the format of an IPv6 address from NSS to Linux. @hideinitializer
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define IPV6_ADDR_TO_IN6_ADDR(in6, ipv6) \
 | 
					 | 
				
			||||||
	{ \
 | 
					 | 
				
			||||||
		in6.in6_u.u6_addr32[0] = ((uint32_t *)ipv6)[0]; \
 | 
					 | 
				
			||||||
		in6.in6_u.u6_addr32[1] = ((uint32_t *)ipv6)[1]; \
 | 
					 | 
				
			||||||
		in6.in6_u.u6_addr32[2] = ((uint32_t *)ipv6)[2]; \
 | 
					 | 
				
			||||||
		in6.in6_u.u6_addr32[3] = ((uint32_t *)ipv6)[3]; \
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Format of an IPv6 address (16 * 8 bits).
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define IPV6_ADDR_OCTAL_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Prints an IPv6 address (16 * 8 bits).
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define IPV6_ADDR_TO_OCTAL(ipv6) ((uint16_t *)ipv6)[0], ((uint16_t *)ipv6)[1], ((uint16_t *)ipv6)[2], ((uint16_t *)ipv6)[3], ((uint16_t *)ipv6)[4], ((uint16_t *)ipv6)[5], ((uint16_t *)ipv6)[6], ((uint16_t *)ipv6)[7]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * IPv4 rule sync reasons.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define NSS_IPV4_SYNC_REASON_STATS 0	/**< Rule for synchronizing statistics. */
 | 
					 | 
				
			||||||
#define NSS_IPV4_SYNC_REASON_FLUSH 1	/**< Rule for flushing a cache entry. */
 | 
					 | 
				
			||||||
#define NSS_IPV4_SYNC_REASON_EVICT 2	/**< Rule for evicting a cache entry. */
 | 
					 | 
				
			||||||
#define NSS_IPV4_SYNC_REASON_DESTROY 3
 | 
					 | 
				
			||||||
		/**< Rule for destroying a cache entry (requested by the host OS). */
 | 
					 | 
				
			||||||
#define NSS_IPV4_SYNC_REASON_PPPOE_DESTROY 4
 | 
					 | 
				
			||||||
		/**< Rule for destroying a cache entry that belongs to a PPPoE session. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv4_create
 | 
					 | 
				
			||||||
 *	Information for an IPv4 flow or connection create rule.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * All fields must be passed in host-endian order.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_ipv4_create {
 | 
					 | 
				
			||||||
	int32_t src_interface_num;
 | 
					 | 
				
			||||||
				/**< Source interface number (virtual or physical). */
 | 
					 | 
				
			||||||
	int32_t dest_interface_num;
 | 
					 | 
				
			||||||
				/**< Destination interface number (virtual or physical). */
 | 
					 | 
				
			||||||
	int32_t protocol;	/**< L4 protocol (e.g., TCP or UDP). */
 | 
					 | 
				
			||||||
	uint32_t flags;		/**< Flags (if any) associated with this rule. */
 | 
					 | 
				
			||||||
	uint32_t from_mtu;	/**< MTU of the incoming interface. */
 | 
					 | 
				
			||||||
	uint32_t to_mtu;	/**< MTU of the outgoing interface. */
 | 
					 | 
				
			||||||
	uint32_t src_ip;	/**< Source IP address. */
 | 
					 | 
				
			||||||
	int32_t src_port;	/**< Source L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
	uint32_t src_ip_xlate;	/**< Translated source IP address (used with SNAT). */
 | 
					 | 
				
			||||||
	int32_t src_port_xlate;	/**< Translated source L4 port (used with SNAT). */
 | 
					 | 
				
			||||||
	uint32_t dest_ip;	/**< Destination IP address. */
 | 
					 | 
				
			||||||
	int32_t dest_port;	/**< Destination L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
	uint32_t dest_ip_xlate;
 | 
					 | 
				
			||||||
			/**< Translated destination IP address (used with DNAT). */
 | 
					 | 
				
			||||||
	int32_t dest_port_xlate;
 | 
					 | 
				
			||||||
			/**< Translated destination L4 port (used with DNAT). */
 | 
					 | 
				
			||||||
	uint8_t src_mac[ETH_ALEN];
 | 
					 | 
				
			||||||
			/**< Source MAC address. */
 | 
					 | 
				
			||||||
	uint8_t dest_mac[ETH_ALEN];
 | 
					 | 
				
			||||||
			/**< Destination MAC address. */
 | 
					 | 
				
			||||||
	uint8_t src_mac_xlate[ETH_ALEN];
 | 
					 | 
				
			||||||
			/**< Translated source MAC address (post-routing). */
 | 
					 | 
				
			||||||
	uint8_t dest_mac_xlate[ETH_ALEN];
 | 
					 | 
				
			||||||
			/**< Translated destination MAC address (post-routing). */
 | 
					 | 
				
			||||||
	uint8_t flow_window_scale;	/**< Window scaling factor (TCP). */
 | 
					 | 
				
			||||||
	uint32_t flow_max_window;	/**< Maximum window size (TCP). */
 | 
					 | 
				
			||||||
	uint32_t flow_end;		/**< TCP window end. */
 | 
					 | 
				
			||||||
	uint32_t flow_max_end;		/**< TCP window maximum end. */
 | 
					 | 
				
			||||||
	uint32_t flow_pppoe_if_exist;
 | 
					 | 
				
			||||||
			/**< Flow direction: PPPoE interface exist flag. */
 | 
					 | 
				
			||||||
	int32_t flow_pppoe_if_num;
 | 
					 | 
				
			||||||
			/**< Flow direction: PPPoE interface number. */
 | 
					 | 
				
			||||||
	uint16_t ingress_vlan_tag;	/**< Ingress VLAN tag expected for this flow. */
 | 
					 | 
				
			||||||
	uint8_t return_window_scale;
 | 
					 | 
				
			||||||
			/**< Window scaling factor of the return direction (TCP). */
 | 
					 | 
				
			||||||
	uint32_t return_max_window;
 | 
					 | 
				
			||||||
			/**< Maximum window size of the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_end;
 | 
					 | 
				
			||||||
			/**< Flow end for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_max_end;
 | 
					 | 
				
			||||||
			/**< Flow maximum end for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_pppoe_if_exist;
 | 
					 | 
				
			||||||
			/**< Return direction: PPPoE interface existence flag. */
 | 
					 | 
				
			||||||
	int32_t return_pppoe_if_num;
 | 
					 | 
				
			||||||
			/**< Return direction: PPPoE interface number. */
 | 
					 | 
				
			||||||
	uint16_t egress_vlan_tag;	/**< Egress VLAN tag expected for this flow. */
 | 
					 | 
				
			||||||
	uint8_t spo_needed;		/**< Indicates whether SPO is required. */
 | 
					 | 
				
			||||||
	uint32_t param_a0;		/**< Custom parameter 0. */
 | 
					 | 
				
			||||||
	uint32_t param_a1;		/**< Custom parameter 1. */
 | 
					 | 
				
			||||||
	uint32_t param_a2;		/**< Custom parameter 2. */
 | 
					 | 
				
			||||||
	uint32_t param_a3;		/**< Custom parameter 3. */
 | 
					 | 
				
			||||||
	uint32_t param_a4;		/**< Custom parameter 4. */
 | 
					 | 
				
			||||||
	uint32_t qos_tag;		/**< Deprecated, will be removed soon. */
 | 
					 | 
				
			||||||
	uint32_t flow_qos_tag;		/**< QoS tag value for the flow direction. */
 | 
					 | 
				
			||||||
	uint32_t return_qos_tag;	/**< QoS tag value for the return direction. */
 | 
					 | 
				
			||||||
	uint8_t dscp_itag;		/**< DSCP marking tag. */
 | 
					 | 
				
			||||||
	uint8_t dscp_imask;		/**< DSCP marking input mask. */
 | 
					 | 
				
			||||||
	uint8_t dscp_omask;		/**< DSCP marking output mask. */
 | 
					 | 
				
			||||||
	uint8_t dscp_oval;		/**< DSCP marking output value. */
 | 
					 | 
				
			||||||
	uint16_t vlan_itag;		/**< VLAN marking tag. */
 | 
					 | 
				
			||||||
	uint16_t vlan_imask;		/**< VLAN marking input mask. */
 | 
					 | 
				
			||||||
	uint16_t vlan_omask;		/**< VLAN marking output mask. */
 | 
					 | 
				
			||||||
	uint16_t vlan_oval;		/**< VLAN marking output value. */
 | 
					 | 
				
			||||||
	uint32_t in_vlan_tag[MAX_VLAN_DEPTH];
 | 
					 | 
				
			||||||
			/**< Ingress VLAN tag expected for this flow. */
 | 
					 | 
				
			||||||
	uint32_t out_vlan_tag[MAX_VLAN_DEPTH];
 | 
					 | 
				
			||||||
			/**< Egress VLAN tag expected for this flow. */
 | 
					 | 
				
			||||||
	uint8_t flow_dscp;		/**< IP DSCP value for the flow direction. */
 | 
					 | 
				
			||||||
	uint8_t return_dscp;		/**< IP DSCP value for the return direction. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * IPv4 connection flags (to be used with nss_ipv4_create::flags).
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define NSS_IPV4_CREATE_FLAG_NO_SEQ_CHECK 0x01
 | 
					 | 
				
			||||||
		/**< Rule for not checking sequence numbers. */
 | 
					 | 
				
			||||||
#define NSS_IPV4_CREATE_FLAG_BRIDGE_FLOW 0x02
 | 
					 | 
				
			||||||
		/**< Rule that indicates pure bridge flow (no routing is involved). */
 | 
					 | 
				
			||||||
#define NSS_IPV4_CREATE_FLAG_ROUTED 0x04	/**< Rule for a routed connection. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define NSS_IPV4_CREATE_FLAG_DSCP_MARKING 0x08	/**< Rule for DSCP marking. */
 | 
					 | 
				
			||||||
#define NSS_IPV4_CREATE_FLAG_VLAN_MARKING 0x10	/**< Rule for VLAN marking. */
 | 
					 | 
				
			||||||
#define NSS_IPV4_CREATE_FLAG_QOS_VALID 0x20	/**< Rule for QoS is valid. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv4_destroy
 | 
					 | 
				
			||||||
 *	Information for an IPv4 flow or connection destroy rule.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_ipv4_destroy {
 | 
					 | 
				
			||||||
	int32_t protocol;	/**< L4 protocol ID. */
 | 
					 | 
				
			||||||
	uint32_t src_ip;	/**< Source IP address. */
 | 
					 | 
				
			||||||
	int32_t src_port;	/**< Source L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
	uint32_t dest_ip;	/**< Destination IP address. */
 | 
					 | 
				
			||||||
	int32_t dest_port;	/**< Destination L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * IPv6 rule sync reasons.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define NSS_IPV6_SYNC_REASON_STATS 0	/**< Rule for synchronizing statistics. */
 | 
					 | 
				
			||||||
#define NSS_IPV6_SYNC_REASON_FLUSH 1	/**< Rule for flushing a cache entry. */
 | 
					 | 
				
			||||||
#define NSS_IPV6_SYNC_REASON_EVICT 2	/**< Rule for evicting a cache entry. */
 | 
					 | 
				
			||||||
#define NSS_IPV6_SYNC_REASON_DESTROY 3
 | 
					 | 
				
			||||||
		/**< Rule for destroying a cache entry (requested by the host OS). */
 | 
					 | 
				
			||||||
#define NSS_IPV6_SYNC_REASON_PPPOE_DESTROY 4
 | 
					 | 
				
			||||||
		/**< Rule for destroying a cache entry that belongs to a PPPoE session. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv6_create
 | 
					 | 
				
			||||||
 *	Information for an IPv6 flow or connection create rule.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * All fields must be passed in host-endian order.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_ipv6_create {
 | 
					 | 
				
			||||||
	int32_t src_interface_num;
 | 
					 | 
				
			||||||
			/**< Source interface number (virtual or physical). */
 | 
					 | 
				
			||||||
	int32_t dest_interface_num;
 | 
					 | 
				
			||||||
			/**< Destination interface number (virtual or physical). */
 | 
					 | 
				
			||||||
	int32_t protocol;	/**< L4 protocol (e.g., TCP or UDP). */
 | 
					 | 
				
			||||||
	uint32_t flags;		/**< Flags (if any) associated with this rule. */
 | 
					 | 
				
			||||||
	uint32_t from_mtu;	/**< MTU of the incoming interface. */
 | 
					 | 
				
			||||||
	uint32_t to_mtu;	/**< MTU of the outgoing interface. */
 | 
					 | 
				
			||||||
	uint32_t src_ip[4];	/**< Source IP address. */
 | 
					 | 
				
			||||||
	int32_t src_port;	/**< Source L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
	uint32_t dest_ip[4];	/**< Destination IP address. */
 | 
					 | 
				
			||||||
	int32_t dest_port;	/**< Destination L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
	uint8_t src_mac[ETH_ALEN];	/**< Source MAC address. */
 | 
					 | 
				
			||||||
	uint8_t dest_mac[ETH_ALEN];	/**< Destination MAC address. */
 | 
					 | 
				
			||||||
	uint8_t flow_window_scale;	/**< Window scaling factor (TCP). */
 | 
					 | 
				
			||||||
	uint32_t flow_max_window;	/**< Maximum window size (TCP). */
 | 
					 | 
				
			||||||
	uint32_t flow_end;		/**< TCP window end. */
 | 
					 | 
				
			||||||
	uint32_t flow_max_end;		/**< TCP window maximum end. */
 | 
					 | 
				
			||||||
	uint32_t flow_pppoe_if_exist;
 | 
					 | 
				
			||||||
			/**< Flow direction: PPPoE interface existence flag. */
 | 
					 | 
				
			||||||
	int32_t flow_pppoe_if_num;
 | 
					 | 
				
			||||||
			/**< Flow direction: PPPoE interface number. */
 | 
					 | 
				
			||||||
	uint16_t ingress_vlan_tag;
 | 
					 | 
				
			||||||
			/**< Ingress VLAN tag expected for this flow. */
 | 
					 | 
				
			||||||
	uint8_t return_window_scale;
 | 
					 | 
				
			||||||
			/**< Window scaling factor (TCP) for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_max_window;
 | 
					 | 
				
			||||||
			/**< Maximum window size (TCP) for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_end;
 | 
					 | 
				
			||||||
			/**< End for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_max_end;
 | 
					 | 
				
			||||||
			/**< Maximum end for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_pppoe_if_exist;
 | 
					 | 
				
			||||||
			/**< Return direction: PPPoE interface exist flag. */
 | 
					 | 
				
			||||||
	int32_t return_pppoe_if_num;
 | 
					 | 
				
			||||||
			/**< Return direction: PPPoE interface number. */
 | 
					 | 
				
			||||||
	uint16_t egress_vlan_tag;	/**< Egress VLAN tag expected for this flow. */
 | 
					 | 
				
			||||||
	uint32_t qos_tag;		/**< Deprecated; will be removed soon. */
 | 
					 | 
				
			||||||
	uint32_t flow_qos_tag;		/**< QoS tag value for flow direction. */
 | 
					 | 
				
			||||||
	uint32_t return_qos_tag;	/**< QoS tag value for the return direction. */
 | 
					 | 
				
			||||||
	uint8_t dscp_itag;		/**< DSCP marking tag. */
 | 
					 | 
				
			||||||
	uint8_t dscp_imask;		/**< DSCP marking input mask. */
 | 
					 | 
				
			||||||
	uint8_t dscp_omask;		/**< DSCP marking output mask. */
 | 
					 | 
				
			||||||
	uint8_t dscp_oval;		/**< DSCP marking output value. */
 | 
					 | 
				
			||||||
	uint16_t vlan_itag;		/**< VLAN marking tag. */
 | 
					 | 
				
			||||||
	uint16_t vlan_imask;		/**< VLAN marking input mask. */
 | 
					 | 
				
			||||||
	uint16_t vlan_omask;		/**< VLAN marking output mask. */
 | 
					 | 
				
			||||||
	uint16_t vlan_oval;		/**< VLAN marking output value. */
 | 
					 | 
				
			||||||
	uint32_t in_vlan_tag[MAX_VLAN_DEPTH];
 | 
					 | 
				
			||||||
					/**< Ingress VLAN tag expected for this flow. */
 | 
					 | 
				
			||||||
	uint32_t out_vlan_tag[MAX_VLAN_DEPTH];
 | 
					 | 
				
			||||||
					/**< Egress VLAN tag expected for this flow. */
 | 
					 | 
				
			||||||
	uint8_t flow_dscp;		/**< IP DSCP value for flow direction. */
 | 
					 | 
				
			||||||
	uint8_t return_dscp;		/**< IP DSCP value for the return direction. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * IPv6 connection flags (to be used with nss_ipv6_create::flags.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define NSS_IPV6_CREATE_FLAG_NO_SEQ_CHECK 0x1
 | 
					 | 
				
			||||||
		/**< Indicates that sequence numbers are not to be checked. */
 | 
					 | 
				
			||||||
#define NSS_IPV6_CREATE_FLAG_BRIDGE_FLOW 0x02
 | 
					 | 
				
			||||||
		/**< Indicates that this is a pure bridge flow (no routing is involved). */
 | 
					 | 
				
			||||||
#define NSS_IPV6_CREATE_FLAG_ROUTED 0x04	/**< Rule is for a routed connection. */
 | 
					 | 
				
			||||||
#define NSS_IPV6_CREATE_FLAG_DSCP_MARKING 0x08	/**< Rule for DSCP marking. */
 | 
					 | 
				
			||||||
#define NSS_IPV6_CREATE_FLAG_VLAN_MARKING 0x10	/**< Rule for VLAN marking. */
 | 
					 | 
				
			||||||
#define NSS_IPV6_CREATE_FLAG_QOS_VALID 0x20	/**< Rule for Valid QoS. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv6_destroy
 | 
					 | 
				
			||||||
 *	Information for an IPv6 flow or connection destroy rule.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_ipv6_destroy {
 | 
					 | 
				
			||||||
	int32_t protocol;	/**< L4 protocol (e.g., TCP or UDP). */
 | 
					 | 
				
			||||||
	uint32_t src_ip[4];	/**< Source IP address. */
 | 
					 | 
				
			||||||
	int32_t src_port;	/**< Source L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
	uint32_t dest_ip[4];	/**< Destination IP address. */
 | 
					 | 
				
			||||||
	int32_t dest_port;	/**< Destination L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv4_sync
 | 
					 | 
				
			||||||
 *	Defines packet statistics for IPv4 and also keeps the connection entry alive.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Statistics are bytes and packets seen over a connection.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * The addresses are NON-NAT addresses (i.e., true endpoint
 | 
					 | 
				
			||||||
 * addressing).
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * The source (src) creates the connection.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_ipv4_sync {
 | 
					 | 
				
			||||||
	uint32_t index;		/**< Slot ID for cache statistics to host OS. */
 | 
					 | 
				
			||||||
			/*TODO: use an opaque information as host and NSS
 | 
					 | 
				
			||||||
			  may be using a different mechanism to store rules. */
 | 
					 | 
				
			||||||
	int32_t protocol;	/**< L4 protocol (e.g., TCP or UDP). */
 | 
					 | 
				
			||||||
	uint32_t src_ip;	/**< Source IP address. */
 | 
					 | 
				
			||||||
	int32_t src_port;	/**< Source L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
	uint32_t src_ip_xlate;	/**< Translated source IP address (used with SNAT). */
 | 
					 | 
				
			||||||
	int32_t src_port_xlate;	/**< Translated source L4 port (used with SNAT). */
 | 
					 | 
				
			||||||
	uint32_t dest_ip;	/**< Destination IP address. */
 | 
					 | 
				
			||||||
	int32_t dest_port;	/**< Destination L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
	uint32_t dest_ip_xlate;
 | 
					 | 
				
			||||||
			/**< Translated destination IP address (used with DNAT). */
 | 
					 | 
				
			||||||
	int32_t dest_port_xlate;
 | 
					 | 
				
			||||||
			/**< Translated destination L4 port (used with DNAT). */
 | 
					 | 
				
			||||||
	uint32_t flow_max_window;	/**< Maximum window size (TCP). */
 | 
					 | 
				
			||||||
	uint32_t flow_end;		/**< TCP window end. */
 | 
					 | 
				
			||||||
	uint32_t flow_max_end;		/**< TCP window maximum end. */
 | 
					 | 
				
			||||||
	uint32_t flow_rx_packet_count;	/**< Rx packet count for the flow interface. */
 | 
					 | 
				
			||||||
	uint32_t flow_rx_byte_count;	/**< Rx byte count for the flow interface. */
 | 
					 | 
				
			||||||
	uint32_t flow_tx_packet_count;	/**< Tx packet count for the flow interface. */
 | 
					 | 
				
			||||||
	uint32_t flow_tx_byte_count;	/**< Tx byte count for the flow interface. */
 | 
					 | 
				
			||||||
	uint32_t return_max_window;
 | 
					 | 
				
			||||||
			/**< Maximum window size (TCP) for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_end;
 | 
					 | 
				
			||||||
			/**< End for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_max_end;
 | 
					 | 
				
			||||||
			/**< Maximum end for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_rx_packet_count;
 | 
					 | 
				
			||||||
			/**< Rx packet count for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_rx_byte_count;
 | 
					 | 
				
			||||||
			/**< Rx byte count for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_tx_packet_count;
 | 
					 | 
				
			||||||
			/**< Tx packet count for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_tx_byte_count;
 | 
					 | 
				
			||||||
			/**< Tx byte count for the return direction. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Time in Linux jiffies to be added to the current timeout to keep the
 | 
					 | 
				
			||||||
	 * connection alive.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	unsigned long int delta_jiffies;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	uint8_t reason;		/**< Reason for synchronization. */
 | 
					 | 
				
			||||||
	uint32_t param_a0;	/**< Custom parameter 0. */
 | 
					 | 
				
			||||||
	uint32_t param_a1;	/**< Custom parameter 1. */
 | 
					 | 
				
			||||||
	uint32_t param_a2;	/**< Custom parameter 2. */
 | 
					 | 
				
			||||||
	uint32_t param_a3;	/**< Custom parameter 3. */
 | 
					 | 
				
			||||||
	uint32_t param_a4;	/**< Custom parameter 4. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	uint8_t flags;		/**< Flags indicating the status of the flow. */
 | 
					 | 
				
			||||||
	uint32_t qos_tag;	/**< QoS value of the flow. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv4_establish
 | 
					 | 
				
			||||||
 *	Defines connection-established message parameters for IPv4.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_ipv4_establish {
 | 
					 | 
				
			||||||
	uint32_t index;			/**< Slot ID for cache statistics to host OS. */
 | 
					 | 
				
			||||||
			/*TODO: use an opaque information as host and NSS
 | 
					 | 
				
			||||||
			  may be using a different mechanism to store rules. */
 | 
					 | 
				
			||||||
	uint8_t protocol;		/**< Protocol number. */
 | 
					 | 
				
			||||||
	uint8_t reserved[3];		/**< Padding for word alignment. */
 | 
					 | 
				
			||||||
	int32_t flow_interface;		/**< Flow interface number. */
 | 
					 | 
				
			||||||
	uint32_t flow_mtu;		/**< MTU for the flow interface. */
 | 
					 | 
				
			||||||
	uint32_t flow_ip;		/**< Flow IP address. */
 | 
					 | 
				
			||||||
	uint32_t flow_ip_xlate;		/**< Translated flow IP address. */
 | 
					 | 
				
			||||||
	uint32_t flow_ident;		/**< Flow identifier (e.g., port). */
 | 
					 | 
				
			||||||
	uint32_t flow_ident_xlate;	/**< Translated flow identifier (e.g., port). */
 | 
					 | 
				
			||||||
	uint16_t flow_mac[3];		/**< Source MAC address for the flow direction. */
 | 
					 | 
				
			||||||
	uint32_t flow_pppoe_if_exist;	/**< Flow direction: PPPoE interface existence flag. */
 | 
					 | 
				
			||||||
	int32_t flow_pppoe_if_num;	/**< Flow direction: PPPoE interface number. */
 | 
					 | 
				
			||||||
	uint16_t ingress_vlan_tag;	/**< Ingress VLAN tag. */
 | 
					 | 
				
			||||||
	int32_t return_interface;	/**< Return interface number. */
 | 
					 | 
				
			||||||
	uint32_t return_mtu;		/**< MTU for the return interface. */
 | 
					 | 
				
			||||||
	uint32_t return_ip;		/**< Return IP address. */
 | 
					 | 
				
			||||||
	uint32_t return_ip_xlate;	/**< Translated return IP address. */
 | 
					 | 
				
			||||||
	uint32_t return_ident;		/**< Return identier (e.g., port). */
 | 
					 | 
				
			||||||
	uint32_t return_ident_xlate;	/**< Translated return identifier (e.g., port). */
 | 
					 | 
				
			||||||
	uint16_t return_mac[3];		/**< Source MAC address for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_pppoe_if_exist;	/**< Return direction: PPPoE interface existence flag. */
 | 
					 | 
				
			||||||
	int32_t return_pppoe_if_num;	/**< Return direction: PPPoE interface number. */
 | 
					 | 
				
			||||||
	uint16_t egress_vlan_tag;	/**< Egress VLAN tag. */
 | 
					 | 
				
			||||||
	uint8_t flags;			/**< Flags indicating the status of the flow. */
 | 
					 | 
				
			||||||
	uint32_t qos_tag;		/**< QoS value of the flow. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv4_cb_reason
 | 
					 | 
				
			||||||
 *	Reasons for an IPv4 callback.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_ipv4_cb_reason {
 | 
					 | 
				
			||||||
	NSS_IPV4_CB_REASON_ESTABLISH = 0,
 | 
					 | 
				
			||||||
	NSS_IPV4_CB_REASON_SYNC,
 | 
					 | 
				
			||||||
	NSS_IPV4_CB_REASON_ESTABLISH_FAIL,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv4_cb_params
 | 
					 | 
				
			||||||
 *	Message parameters for an IPv4 callback.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_ipv4_cb_params {
 | 
					 | 
				
			||||||
	enum nss_ipv4_cb_reason reason;		/**< Reason for the callback. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Message parameters for an IPv4 callback.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	union {
 | 
					 | 
				
			||||||
		struct nss_ipv4_sync sync;
 | 
					 | 
				
			||||||
				/**< Parameters for synchronization. */
 | 
					 | 
				
			||||||
		struct nss_ipv4_establish establish;
 | 
					 | 
				
			||||||
				/**< Parameters for establishing a connection. */
 | 
					 | 
				
			||||||
	} params;		/**< Payload of parameters. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv6_sync
 | 
					 | 
				
			||||||
 *	Update packet statistics (bytes and packets seen over a connection) and also keep the connection entry alive.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * The addresses are NON-NAT addresses (i.e., true endpoint addressing).
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * The source (src) creates the connection.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_ipv6_sync {
 | 
					 | 
				
			||||||
	uint32_t index;		/**< Slot ID for cache statistics to the host OS. */
 | 
					 | 
				
			||||||
	int32_t protocol;	/**< L4 protocol (e.g., TCP or UDP). */
 | 
					 | 
				
			||||||
	uint32_t src_ip[4];	/**< Source IP address. */
 | 
					 | 
				
			||||||
	int32_t src_port;	/**< Source L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
	uint32_t dest_ip[4];	/**< Destination IP address. */
 | 
					 | 
				
			||||||
	int32_t dest_port;	/**< Destination L4 port (e.g., TCP or UDP port). */
 | 
					 | 
				
			||||||
	uint32_t flow_max_window;	/**< Maximum window size (TCP). */
 | 
					 | 
				
			||||||
	uint32_t flow_end;		/**< TCP window end. */
 | 
					 | 
				
			||||||
	uint32_t flow_max_end;		/**< TCP window maximum end. */
 | 
					 | 
				
			||||||
	uint32_t flow_rx_packet_count;	/**< Rx packet count for the flow interface. */
 | 
					 | 
				
			||||||
	uint32_t flow_rx_byte_count;	/**< Rx byte count for the flow interface. */
 | 
					 | 
				
			||||||
	uint32_t flow_tx_packet_count;	/**< Tx packet count for the flow interface. */
 | 
					 | 
				
			||||||
	uint32_t flow_tx_byte_count;	/**< Tx byte count for the flow interface. */
 | 
					 | 
				
			||||||
	uint32_t return_max_window;
 | 
					 | 
				
			||||||
			/**< Maximum window size (TCP) for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_end;
 | 
					 | 
				
			||||||
			/**< End for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_max_end;
 | 
					 | 
				
			||||||
			/**< Maximum end for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_rx_packet_count;
 | 
					 | 
				
			||||||
			/**< Rx packet count for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_rx_byte_count;
 | 
					 | 
				
			||||||
			/**< Rx byte count for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_tx_packet_count;
 | 
					 | 
				
			||||||
			/**< Tx packet count for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_tx_byte_count;
 | 
					 | 
				
			||||||
			/**< Tx byte count for the return direction. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Time in Linux jiffies to be added to the current timeout to keep the
 | 
					 | 
				
			||||||
	 * connection alive.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	unsigned long int delta_jiffies;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Non-zero when the NA has ceased to accelerate the given connection.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	uint8_t final_sync;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	uint8_t evicted;	/**< Non-zero if the connection is evicted. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	uint8_t flags;		/**< Flags indicating the status of the flow. */
 | 
					 | 
				
			||||||
	uint32_t qos_tag;	/**< QoS value of the flow. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv6_establish
 | 
					 | 
				
			||||||
 *	Defines connection-established message parameters for IPv6.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_ipv6_establish {
 | 
					 | 
				
			||||||
	uint32_t index;		/**< Slot ID for cache statistics to the host OS. */
 | 
					 | 
				
			||||||
	uint8_t protocol;	/**< Protocol number. */
 | 
					 | 
				
			||||||
	int32_t flow_interface;	/**< Flow interface number. */
 | 
					 | 
				
			||||||
	uint32_t flow_mtu;	/**< MTU for the flow interface. */
 | 
					 | 
				
			||||||
	uint32_t flow_ip[4];	/**< Flow IP address. */
 | 
					 | 
				
			||||||
	uint32_t flow_ident;	/**< Flow identifier (e.g., port). */
 | 
					 | 
				
			||||||
	uint16_t flow_mac[3];	/**< Source MAC address for the flow direction. */
 | 
					 | 
				
			||||||
	uint32_t flow_pppoe_if_exist;	/**< Flow direction: PPPoE interface existence flag. */
 | 
					 | 
				
			||||||
	int32_t flow_pppoe_if_num;	/**< Flow direction: PPPoE interface number. */
 | 
					 | 
				
			||||||
	uint16_t ingress_vlan_tag;	/**< Ingress VLAN tag. */
 | 
					 | 
				
			||||||
	int32_t return_interface;	/**< Return interface number. */
 | 
					 | 
				
			||||||
	uint32_t return_mtu;		/**< MTU for the return interface. */
 | 
					 | 
				
			||||||
	uint32_t return_ip[4];		/**< Return IP address. */
 | 
					 | 
				
			||||||
	uint32_t return_ident;		/**< Return identier (e.g., port). */
 | 
					 | 
				
			||||||
	uint16_t return_mac[3];		/**< Source MAC address for the return direction. */
 | 
					 | 
				
			||||||
	uint32_t return_pppoe_if_exist;	/**< Return direction: PPPoE interface existence flag. */
 | 
					 | 
				
			||||||
	int32_t return_pppoe_if_num;	/**< Return direction: PPPoE interface number. */
 | 
					 | 
				
			||||||
	uint16_t egress_vlan_tag;	/**< VLAN tag to be inserted for egress direction. */
 | 
					 | 
				
			||||||
	uint8_t flags;			/**< Flags indicating the status of the flow. */
 | 
					 | 
				
			||||||
	uint32_t qos_tag;		/**< QoS value of the flow. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv6_cb_reason
 | 
					 | 
				
			||||||
 *	Reasons for an IPv6 callback.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_ipv6_cb_reason {
 | 
					 | 
				
			||||||
	NSS_IPV6_CB_REASON_ESTABLISH = 0,
 | 
					 | 
				
			||||||
	NSS_IPV6_CB_REASON_SYNC,
 | 
					 | 
				
			||||||
	NSS_IPV6_CB_REASON_ESTABLISH_FAIL,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipv6_cb_params
 | 
					 | 
				
			||||||
 *	Message parameters for an IPv6 callback.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_ipv6_cb_params {
 | 
					 | 
				
			||||||
	enum nss_ipv6_cb_reason reason;		/**< Reason for the callback. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Message parameters for an IPv6 callback.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	union {
 | 
					 | 
				
			||||||
		struct nss_ipv6_sync sync;
 | 
					 | 
				
			||||||
				/**< Parameters for synchronization. */
 | 
					 | 
				
			||||||
		struct nss_ipv6_establish establish;
 | 
					 | 
				
			||||||
				/**< Parameters for establishing a connection. */
 | 
					 | 
				
			||||||
	} params;		/**< Callback parameters. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * General utilities
 | 
					 * General utilities
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -791,16 +295,6 @@ struct nss_ipv6_cb_params {
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*nss_if_rx_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg);
 | 
					typedef void (*nss_if_rx_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Callback function for IPv4 connection synchronization messages.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * nss_ipv4_cb_params
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] nicb  Pointer to the parameter structure for an NSS IPv4 callback.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef void (*nss_ipv4_callback_t)(struct nss_ipv4_cb_params *nicb);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_get_state
 | 
					 * nss_get_state
 | 
				
			||||||
 *	Gets the NSS state.
 | 
					 *	Gets the NSS state.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -139,8 +139,8 @@ struct nss_capwap_stats_msg {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	uint32_t rx_frag_timeout_drops;
 | 
						uint32_t rx_frag_timeout_drops;
 | 
				
			||||||
			/**< Packets dropped because of a reassembly timeout. */
 | 
								/**< Packets dropped because of a reassembly timeout. */
 | 
				
			||||||
	uint32_t rx_queue_full_drops;
 | 
						uint32_t rx_n2h_drops;
 | 
				
			||||||
			/**< Packets dropped because the queue is full. */
 | 
								/**< Packets dropped because of error in packet processing. */
 | 
				
			||||||
	uint32_t rx_n2h_queue_full_drops;
 | 
						uint32_t rx_n2h_queue_full_drops;
 | 
				
			||||||
			/**< Packets dropped because the NSS-to-host queue is full. */
 | 
								/**< Packets dropped because the NSS-to-host queue is full. */
 | 
				
			||||||
	uint32_t rx_csum_drops;
 | 
						uint32_t rx_csum_drops;
 | 
				
			||||||
@@ -297,6 +297,14 @@ struct nss_capwap_flow_rule_msg {
 | 
				
			|||||||
	uint32_t flow_id;		/**< Flow identification. */
 | 
						uint32_t flow_id;		/**< Flow identification. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_capwap_enable_tunnel_msg
 | 
				
			||||||
 | 
					 *	Structure to update sibling interface number.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_capwap_enable_tunnel_msg {
 | 
				
			||||||
 | 
						uint32_t sibling_if_num; /**< Sibling interface Number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_capwap_msg
 | 
					 * nss_capwap_msg
 | 
				
			||||||
 *	Data for sending and receiving CAPWAP messages.
 | 
					 *	Data for sending and receiving CAPWAP messages.
 | 
				
			||||||
@@ -322,6 +330,8 @@ struct nss_capwap_msg {
 | 
				
			|||||||
				/**< Flow rule add message. */
 | 
									/**< Flow rule add message. */
 | 
				
			||||||
		struct nss_capwap_flow_rule_msg flow_rule_del;
 | 
							struct nss_capwap_flow_rule_msg flow_rule_del;
 | 
				
			||||||
				/**< Flow rule delete message. */
 | 
									/**< Flow rule delete message. */
 | 
				
			||||||
 | 
							struct nss_capwap_enable_tunnel_msg enable_tunnel;
 | 
				
			||||||
 | 
									/**< Enable tunnel message. */
 | 
				
			||||||
	} msg;			/**< Message payload. */
 | 
						} msg;			/**< Message payload. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -358,8 +368,8 @@ struct nss_capwap_tunnel_stats {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	uint64_t rx_frag_timeout_drops;
 | 
						uint64_t rx_frag_timeout_drops;
 | 
				
			||||||
			/**< Packets dropped because of a reassembly timeout. */
 | 
								/**< Packets dropped because of a reassembly timeout. */
 | 
				
			||||||
	uint64_t rx_queue_full_drops;
 | 
						uint64_t rx_n2h_drops;
 | 
				
			||||||
			/**< Packets dropped because the queue is full. */
 | 
								/**< Packets dropped because of error in processing the packet. */
 | 
				
			||||||
	uint64_t rx_n2h_queue_full_drops;
 | 
						uint64_t rx_n2h_queue_full_drops;
 | 
				
			||||||
			/**< Packets dropped because the NSS-to-host queue is full. */
 | 
								/**< Packets dropped because the NSS-to-host queue is full. */
 | 
				
			||||||
	uint64_t rx_csum_drops;
 | 
						uint64_t rx_csum_drops;
 | 
				
			||||||
@@ -374,6 +384,7 @@ struct nss_capwap_tunnel_stats {
 | 
				
			|||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Tx/encap stats
 | 
						 * Tx/encap stats
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
 | 
						uint64_t tx_dropped_inner;	/**<Packets dropped due to inflow queue full. */
 | 
				
			||||||
	uint64_t tx_segments;		/**< Number of segments or fragments. */
 | 
						uint64_t tx_segments;		/**< Number of segments or fragments. */
 | 
				
			||||||
	uint64_t tx_queue_full_drops;
 | 
						uint64_t tx_queue_full_drops;
 | 
				
			||||||
			/**< Packets dropped because the queue is full. */
 | 
								/**< Packets dropped because the queue is full. */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -67,6 +67,50 @@ typedef enum nss_clmap_error_types {
 | 
				
			|||||||
	NSS_CLMAP_ERROR_MAX,			/**< Maximum error type. */
 | 
						NSS_CLMAP_ERROR_MAX,			/**< Maximum error type. */
 | 
				
			||||||
} nss_clmap_error_t;
 | 
					} nss_clmap_error_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_clmap_interface_type
 | 
				
			||||||
 | 
					 *	Client map NSS interface type.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_clmap_interface_type {
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_TYPE_US,
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_TYPE_DS,
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_TYPE_MAX
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_clmap_stats_type
 | 
				
			||||||
 | 
					 *	Client map statistic counters.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_clmap_stats_type {
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_RX_PKTS,			/**< Number of packets received. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_RX_BYTES,			/**< Number of bytes received. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_TX_PKTS,			/**< Number of packets transmitted. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_TX_BYTES,			/**< Number of bytes transmitted. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_RX_QUEUE_0_DROPPED,		/**< Dropped receive packets 0. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_RX_QUEUE_1_DROPPED,		/**< Dropped receive packets 1. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_RX_QUEUE_2_DROPPED,		/**< Dropped receive packets 2. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_RX_QUEUE_3_DROPPED,		/**< Dropped receive packets 3. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_DROPPED_MACDB_LOOKUP_FAILED,	/**< Dropped due to MAC database look up failed. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_DROPPED_INVALID_PACKET_SIZE,	/**< Dropped due to invalid size packets. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_DROPPED_LOW_HEADROOM,		/**< Dropped due to insufficent headroom. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_DROPPED_NEXT_NODE_QUEUE_FULL,	/**< Dropped due to next node queue full. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_DROPPED_PBUF_ALLOC_FAILED,	/**< Dropped due to buffer allocation failure. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_DROPPED_LINEAR_FAILED,	/**< Dropped due to linear copy failure. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_SHARED_PACKET_CNT,		/**< Shared packet count. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_ETHERNET_FRAME_ERROR,		/**< Ethernet frame error count. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_MACDB_CREATE_REQUESTS_CNT,	/**< MAC database create requests count. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_MACDB_CREATE_MAC_EXISTS_CNT,	/**< MAC database create failures, MAC exist count. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_MACDB_CREATE_MAC_TABLE_FULL_CNT,
 | 
				
			||||||
 | 
													/**< MAC database create failures, MAC database full count. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_MACDB_DESTROY_REQUESTS_CNT,	/**< MAC database destroy requests count. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_MACDB_DESTROY_MAC_NOT_FOUND_CNT,
 | 
				
			||||||
 | 
													/**< MAC database destroy failures, MAC not found count. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_MACDB_DESTROY_MAC_UNHASHED_CNT,
 | 
				
			||||||
 | 
													/**< MAC database destroy failures, MAC unhashed count. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_MACDB_FLUSH_REQUESTS_CNT,	/**< MAC database flush requests count. */
 | 
				
			||||||
 | 
						NSS_CLMAP_INTERFACE_STATS_MAX,				/**< Maximum statistics type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_clmap_stats_msg
 | 
					 * nss_clmap_stats_msg
 | 
				
			||||||
 *	Per-interface statistics messages from the NSS firmware.
 | 
					 *	Per-interface statistics messages from the NSS firmware.
 | 
				
			||||||
@@ -111,6 +155,16 @@ struct nss_clmap_flush_mac_msg {
 | 
				
			|||||||
	uint32_t nexthop_ifnum;			/**< Next hop interface number. */
 | 
						uint32_t nexthop_ifnum;			/**< Next hop interface number. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_clmap_stats_notification
 | 
				
			||||||
 | 
					 *	Client map transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_clmap_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_ctx[NSS_CLMAP_INTERFACE_STATS_MAX];	/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;					/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;					/**< Interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_clmap_msg
 | 
					 * nss_clmap_msg
 | 
				
			||||||
 *	Data for sending and receiving client map messages.
 | 
					 *	Data for sending and receiving client map messages.
 | 
				
			||||||
@@ -301,6 +355,34 @@ extern void nss_clmap_init(void);
 | 
				
			|||||||
extern void nss_clmap_msg_init(struct nss_clmap_msg *ncm, uint16_t if_num, uint32_t type, uint32_t len,
 | 
					extern void nss_clmap_msg_init(struct nss_clmap_msg *ncm, uint16_t if_num, uint32_t type, uint32_t len,
 | 
				
			||||||
								nss_clmap_msg_callback_t cb, void *app_data);
 | 
													nss_clmap_msg_callback_t cb, void *app_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_clmap_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_clmap_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_clmap_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_clmap_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2014, 2016-2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2014, 2016-2020, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -27,6 +27,13 @@
 | 
				
			|||||||
 * @{
 | 
					 * @{
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Interface Number 1 Valid 7 Core 8 Type 16 Index
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					typedef int32_t nss_if_num_t;
 | 
				
			||||||
 | 
					#define NSS_IF_IS_TYPE_DYNAMIC(if_num)		(if_num != -1)
 | 
				
			||||||
 | 
					#define NSS_IF_IS_VALID(if_num)		(if_num < NSS_MAX_NET_INTERFACES)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @struct nss_ctx_instance
 | 
					 * @struct nss_ctx_instance
 | 
				
			||||||
 *	Forward declaration for structure that contains instance data for each
 | 
					 *	Forward declaration for structure that contains instance data for each
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
@@ -52,6 +52,43 @@ enum nss_dma_msg_error {
 | 
				
			|||||||
	NSS_DMA_MSG_ERROR_MAX			/**< Maximum error type. */
 | 
						NSS_DMA_MSG_ERROR_MAX			/**< Maximum error type. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_dma_stats_types
 | 
				
			||||||
 | 
					 *	DMA node statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_dma_stats_types {
 | 
				
			||||||
 | 
						NSS_DMA_STATS_NO_REQ = NSS_STATS_NODE_MAX,
 | 
				
			||||||
 | 
										/**< Request descriptor not available. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_NO_DESC,		/**< DMA descriptors not available. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_NEXTHOP,		/**< Failed to retrive next hop. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_NEXTHOP_QUEUE,
 | 
				
			||||||
 | 
										/**< Failed to queue next hop. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_LINEAR_SZ,	/**< Failed to get memory for linearization. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_LINEAR_ALLOC,/**< Failed to allocate buffer for linearization. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_LINEAR_NO_SG,/**< Skip linearization due to non-SG packet. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_SPLIT_SZ,	/**< Failed to spliting buffer into multiple buffers. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_SPLIT_ALLOC,	/**< Failed to allocate buffer for split. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_SYNC_ALLOC,	/**< Failed to allocate buffer for sending statistics. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_CTX_ACTIVE,	/**< Failed to queue as the node is not active. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E0,	/**< Failed to process in hardware, error code E0. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E1,	/**< Failed to process in hardware, error code E1. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E2,	/**< Failed to process in hardware, error code E2. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E3,	/**< Failed to process in hardware, error code E3. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E4,	/**< Failed to process in hardware, error code E4. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E5,	/**< Failed to process in hardware, error code E5. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E6,	/**< Failed to process in hardware, error code E6. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E7,	/**< Failed to process in hardware, error code E7. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E8,	/**< Failed to process in hardware, error code E8. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E9,	/**< Failed to process in hardware, error code E9. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E10,	/**< Failed to process in hardware, error code E10. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E11,	/**< Failed to process in hardware, error code E11. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E12,	/**< Failed to process in hardware, error code E12. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E13,	/**< Failed to process in hardware, error code E13. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E14,	/**< Failed to process in hardware, error code E14. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_FAIL_HW_E15,	/**< Failed to process in hardware, error code E15. */
 | 
				
			||||||
 | 
						NSS_DMA_STATS_MAX,		/**< Maximum message type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_dma_test_type
 | 
					 * nss_dma_test_type
 | 
				
			||||||
 *	DMA Test types.
 | 
					 *	DMA Test types.
 | 
				
			||||||
@@ -64,6 +101,15 @@ enum nss_dma_test_type {
 | 
				
			|||||||
	NSS_DMA_TEST_TYPE_MAX			/**< Maximum test type. */
 | 
						NSS_DMA_TEST_TYPE_MAX			/**< Maximum test type. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_dma_stats_notification
 | 
				
			||||||
 | 
					 *	DMA transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_dma_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_ctx[NSS_DMA_STATS_MAX];		/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;				/**< Core ID. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __KERNEL__ /* only kernel will use. */
 | 
					#ifdef __KERNEL__ /* only kernel will use. */
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Maximum number of HW specific statistics
 | 
					 * Maximum number of HW specific statistics
 | 
				
			||||||
@@ -129,11 +175,6 @@ struct nss_dma_msg {
 | 
				
			|||||||
 * nss_dma_register_handler
 | 
					 * nss_dma_register_handler
 | 
				
			||||||
 *	Registers the DMA message handler.
 | 
					 *	Registers the DMA message handler.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * nss_ctx_instance
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * None.
 | 
					 * None.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -255,6 +296,34 @@ void nss_dma_init(void);
 | 
				
			|||||||
 * Pointer to the NSS core context.
 | 
					 * Pointer to the NSS core context.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern struct nss_ctx_instance *nss_dma_get_context(void);
 | 
					extern struct nss_ctx_instance *nss_dma_get_context(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_dma_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_dma_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_dma_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_dma_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
#endif /*__KERNEL__ */
 | 
					#endif /*__KERNEL__ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -74,6 +74,85 @@ enum nss_dtls_cmn_error {
 | 
				
			|||||||
	NSS_DTLS_CMN_ERROR_MAX,
 | 
						NSS_DTLS_CMN_ERROR_MAX,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_ctx_stats_types
 | 
				
			||||||
 | 
					 *	DTLS common context statistics types.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_dtls_cmn_ctx_stats_types {
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_RX_SINGLE_REC = NSS_STATS_NODE_MAX,
 | 
				
			||||||
 | 
											/**< Received single DTLS record datagrams. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_RX_MULTI_REC,	/**< Received multiple DTLS record datagrams. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_CRYPTO_RESOURCE,/**< Failure in crypto resource allocation. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_CRYPTO_ENQUEUE,	/**< Failure due to full queue in crypto or hardware. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_HEADROOM,	/**< Failure in headroom check. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_TAILROOM,	/**< Failure in tailroom check. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_VER,		/**< Failure in DTLS version check. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_EPOCH,		/**< Failure in DTLS epoch check. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_DTLS_RECORD,	/**< Failure in reading DTLS record. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_CAPWAP,		/**< Failure in CAPWAP classification. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_REPLAY,		/**< Failure in anti-replay check. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_REPLAY_DUP,	/**< Failure in anti-replay; duplicate records. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_REPLAY_WIN,	/**< Failure in anti-replay; packet outside the window. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_QUEUE,		/**< Failure due to full queue in DTLS. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_QUEUE_NEXTHOP,	/**< Failure due to full queue in next hop. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_PBUF_ALLOC,	/**< Failure in pbuf allocation. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_PBUF_LINEAR,	/**< Failure in pbuf linearization. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_PBUF_STATS,	/**< Failure in pbuf allocation for statistics. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_PBUF_ALIGN,	/**< Failure in pbuf alignment. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_CTX_ACTIVE,	/**< Failure in enqueue due to inactive context. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_HWCTX_ACTIVE,	/**< Failure in enqueue due to inactive hardware context. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_CIPHER,		/**< Failure in decrypting the data. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_AUTH,		/**< Failure in authenticating the data. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_SEQ_OVF,	/**< Failure due to sequence number overflow. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_BLK_LEN,	/**< Failure in decapsulation due to bad cipher length. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_FAIL_HASH_LEN,	/**< Failure in decapsulation due to bad hash length. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_LEN_ERROR,		/**< Length error. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_TOKEN_ERROR,		/**< Token error, unknown token command or instruction. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_BYPASS_ERROR,	/**< Token contains too much bypass data. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CONFIG_ERROR,	/**< Invalid command, algorithm, or mode combination. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_ALGO_ERROR,		/**< Unsupported algorithm. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_HASH_OVF_ERROR,	/**< Hash input overflow. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_TTL_ERROR,		/**< TTL or HOP-Limit underflow. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CSUM_ERROR,		/**< Checksum error. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_TIMEOUT_ERROR,	/**< Data timed out. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_0,		/**< Classification failure 0. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_1,		/**< Classification failure 1. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_2,		/**< Classification failure 2. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_3,		/**< Classification failure 3. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_4,		/**< Classification failure 4. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_5,		/**< Classification failure 5. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_6,		/**< Classification failure 6. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_7,		/**< Classification failure 7. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_8,		/**< Classification failure 8. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_9,		/**< Classification failure 9. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_10,	/**< Classification failure 10. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_11,	/**< Classification failure 11. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_12,	/**< Classification failure 12. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_13,	/**< Classification failure 13. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_14,	/**< Classification failure 14. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_15,	/**< Classification failure 15. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_16,	/**< Classification failure 16. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_17,	/**< Classification failure 17. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_18,	/**< Classification failure 18. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_19,	/**< Classification failure 19. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_20,	/**< Classification failure 20. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_21,	/**< Classification failure 21. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_22,	/**< Classification failure 22. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_23,	/**< Classification failure 23. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_24,	/**< Classification failure 24. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_25,	/**< Classification failure 25. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_26,	/**< Classification failure 26. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_27,	/**< Classification failure 27. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_28,	/**< Classification failure 28. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_29,	/**< Classification failure 29. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_30,	/**< Classification failure 30. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_CLE_ERROR_31,	/**< Classification failure 31. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_SEQ_LOW,		/**< Lower 32 bits of current transmit sequence number. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_SEQ_HIGH,		/**< Upper 16 bits of current transmit sequence number. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_STATS_EPOCH,		/**< Current epoch value. */
 | 
				
			||||||
 | 
						NSS_DTLS_CMN_CTX_STATS_MAX,		/**< Maximum message type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_dtls_cmn_node_stats
 | 
					 * nss_dtls_cmn_node_stats
 | 
				
			||||||
 * 	DTLS node statistics.
 | 
					 * 	DTLS node statistics.
 | 
				
			||||||
@@ -183,6 +262,16 @@ struct nss_dtls_cmn_ctx_config_dtls {
 | 
				
			|||||||
	uint8_t res1;		/**< Reserved for alignment. */
 | 
						uint8_t res1;		/**< Reserved for alignment. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_notification
 | 
				
			||||||
 | 
					 *	DTLS common transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_dtls_cmn_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_ctx[NSS_DTLS_CMN_CTX_STATS_MAX];		/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;					/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;					/**< Interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_dtls_cmn_msg
 | 
					 * nss_dtls_cmn_msg
 | 
				
			||||||
 *	Data for sending and receiving DTLS messages.
 | 
					 *	Data for sending and receiving DTLS messages.
 | 
				
			||||||
@@ -280,6 +369,20 @@ extern nss_tx_status_t nss_dtls_cmn_tx_msg_sync(struct nss_ctx_instance *nss_ctx
 | 
				
			|||||||
						enum nss_dtls_cmn_msg_type type, uint16_t len,
 | 
											enum nss_dtls_cmn_msg_type type, uint16_t len,
 | 
				
			||||||
						struct nss_dtls_cmn_msg *ndcm, enum nss_dtls_cmn_error *resp);
 | 
											struct nss_dtls_cmn_msg *ndcm, enum nss_dtls_cmn_error *resp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_unregister_if
 | 
				
			||||||
 | 
					 *	Deregisters a DTLS session interface from the NSS.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] if_num  NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * None.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @dependencies
 | 
				
			||||||
 | 
					 * The DTLS session interface must have been previously registered.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern void nss_dtls_cmn_unregister_if(uint32_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_dtls_cmn_register_if
 | 
					 * nss_dtls_cmn_register_if
 | 
				
			||||||
 *	Registers a DTLS session interface with the NSS for sending and receiving
 | 
					 *	Registers a DTLS session interface with the NSS for sending and receiving
 | 
				
			||||||
@@ -309,22 +412,19 @@ extern struct nss_ctx_instance *nss_dtls_cmn_register_if(uint32_t if_num,
 | 
				
			|||||||
							 void *app_ctx);
 | 
												 void *app_ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_dtls_cmn_unregister_if
 | 
					 * nss_dtls_cmn_notify_unregister
 | 
				
			||||||
 *	Deregisters a DTLS session interface from the NSS.
 | 
					 *	Deregisters an event callback.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in] if_num  NSS interface number.
 | 
					 * @param[in] ifnum  NSS interface number.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * None.
 | 
					 * None.
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @dependencies
 | 
					 | 
				
			||||||
 * The DTLS session interface must have been previously registered.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern void nss_dtls_cmn_unregister_if(uint32_t if_num);
 | 
					extern void nss_dtls_cmn_notify_unregister(uint32_t ifnum);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_dtls_cmn_notify_register
 | 
					 * nss_dtls_cmn_notify_register
 | 
				
			||||||
 *	Register an event callback to handle notification from DTLS firmware package.
 | 
					 *	Registers an event callback to handle notification from DTLS firmware package.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in] ifnum     NSS interface number.
 | 
					 * @param[in] ifnum     NSS interface number.
 | 
				
			||||||
 * @param[in] ev_cb     Callback for DTLS tunnel message.
 | 
					 * @param[in] ev_cb     Callback for DTLS tunnel message.
 | 
				
			||||||
@@ -336,17 +436,6 @@ extern void nss_dtls_cmn_unregister_if(uint32_t if_num);
 | 
				
			|||||||
extern struct nss_ctx_instance *nss_dtls_cmn_notify_register(uint32_t ifnum, nss_dtls_cmn_msg_callback_t ev_cb,
 | 
					extern struct nss_ctx_instance *nss_dtls_cmn_notify_register(uint32_t ifnum, nss_dtls_cmn_msg_callback_t ev_cb,
 | 
				
			||||||
							     void *app_data);
 | 
												     void *app_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_dtls_cmn_notify_unregister
 | 
					 | 
				
			||||||
 *	Unregister an event callback.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] ifnum  NSS interface number.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * None.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern void nss_dtls_cmn_notify_unregister(uint32_t ifnum);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_dtls_cmn_msg_init
 | 
					 * nss_dtls_cmn_msg_init
 | 
				
			||||||
 *	Initializes a DTLS message.
 | 
					 *	Initializes a DTLS message.
 | 
				
			||||||
@@ -387,6 +476,34 @@ extern struct nss_ctx_instance *nss_dtls_cmn_get_context(void);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
extern int32_t nss_dtls_cmn_get_ifnum(int32_t if_num);
 | 
					extern int32_t nss_dtls_cmn_get_ifnum(int32_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_dtls_cmn_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_dtls_cmn_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -40,10 +40,10 @@
 | 
				
			|||||||
enum nss_dynamic_interface_type {
 | 
					enum nss_dynamic_interface_type {
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_NONE,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_NONE,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_5,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_INNER,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_INNER,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_OUTER,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_OUTER,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_WIFI,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_RESERVED,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_VAP,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_VAP,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_0,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_0,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_PPPOE,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_PPPOE,
 | 
				
			||||||
@@ -105,6 +105,11 @@ enum nss_dynamic_interface_type {
 | 
				
			|||||||
	NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_MIRROR,
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_MIRROR,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_WIFI_EXT_VDEV_WDS,
 | 
						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,
 | 
				
			||||||
	NSS_DYNAMIC_INTERFACE_TYPE_MAX
 | 
						NSS_DYNAMIC_INTERFACE_TYPE_MAX
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -84,6 +84,7 @@ enum nss_edma_stats_rx_t {
 | 
				
			|||||||
	NSS_EDMA_STATS_RX_DESC,
 | 
						NSS_EDMA_STATS_RX_DESC,
 | 
				
			||||||
	NSS_EDMA_STATS_RX_QOS_ERR,
 | 
						NSS_EDMA_STATS_RX_QOS_ERR,
 | 
				
			||||||
	NSS_EDMA_STATS_RX_SRC_PORT_INVALID,
 | 
						NSS_EDMA_STATS_RX_SRC_PORT_INVALID,
 | 
				
			||||||
 | 
						NSS_EDMA_STATS_RX_SRC_IF_INVALID,
 | 
				
			||||||
	NSS_EDMA_STATS_RX_MAX
 | 
						NSS_EDMA_STATS_RX_MAX
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -143,6 +144,7 @@ struct nss_edma_rx_ring_stats {
 | 
				
			|||||||
	uint32_t desc_cnt;		/**< Number of descriptors processed. */
 | 
						uint32_t desc_cnt;		/**< Number of descriptors processed. */
 | 
				
			||||||
	uint32_t qos_err;		/**< Number of QoS errors. */
 | 
						uint32_t qos_err;		/**< Number of QoS errors. */
 | 
				
			||||||
	uint32_t rx_src_port_invalid;	/**< Number of source port invalid errors. */
 | 
						uint32_t rx_src_port_invalid;	/**< Number of source port invalid errors. */
 | 
				
			||||||
 | 
						uint32_t rx_src_if_invalid;	/**< Number of source interface invalid errors. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 ****************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017-2019, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -11,7 +11,7 @@
 | 
				
			|||||||
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 **************************************************************************
 | 
					 ****************************************************************************
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -119,47 +119,49 @@ enum nss_gre_ip_types {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * GRE Base debug statistics
 | 
					 * nss_gre_base_types
 | 
				
			||||||
 | 
					 *	GRE base debug statistics.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum nss_gre_base_debug_types {
 | 
					enum nss_gre_base_types {
 | 
				
			||||||
	GRE_BASE_RX_PACKETS,			/**< Rx packet count. */
 | 
						NSS_GRE_BASE_RX_PACKETS,		/**< Receive packet count. */
 | 
				
			||||||
	GRE_BASE_RX_DROPPED,			/**< Number of packet dropped at Rx. */
 | 
						NSS_GRE_BASE_RX_DROPPED,		/**< Number of packet dropped at receive. */
 | 
				
			||||||
	GRE_BASE_EXP_ETH_HDR_MISSING,		/**< Ethernet header missing. */
 | 
						NSS_GRE_BASE_EXP_ETH_HDR_MISSING,	/**< Ethernet header missing. */
 | 
				
			||||||
	GRE_BASE_EXP_ETH_TYPE_NON_IP,		/**< Packet is not IPV4 or IPV6. */
 | 
						NSS_GRE_BASE_EXP_ETH_TYPE_NON_IP,	/**< Packet is not IPV4 or IPV6. */
 | 
				
			||||||
	GRE_BASE_EXP_IP_UNKNOWN_PROTOCOL,	/**< Packet protocol is unknown. */
 | 
						NSS_GRE_BASE_EXP_IP_UNKNOWN_PROTOCOL,	/**< Packet protocol is unknown. */
 | 
				
			||||||
	GRE_BASE_EXP_IP_HEADER_INCOMPLETE,	/**< Bad IP header. */
 | 
						NSS_GRE_BASE_EXP_IP_HEADER_INCOMPLETE,	/**< Bad IP header. */
 | 
				
			||||||
	GRE_BASE_EXP_IP_BAD_TOTAL_LENGTH,	/**< IP total lenghth is invalid. */
 | 
						NSS_GRE_BASE_EXP_IP_BAD_TOTAL_LENGTH,	/**< IP total length is invalid. */
 | 
				
			||||||
	GRE_BASE_EXP_IP_BAD_CHECKSUM,		/**< IP checksum is bad. */
 | 
						NSS_GRE_BASE_EXP_IP_BAD_CHECKSUM,	/**< IP checksum is bad. */
 | 
				
			||||||
	GRE_BASE_EXP_IP_DATAGRAM_INCOMPLETE,	/**< Bad packet. */
 | 
						NSS_GRE_BASE_EXP_IP_DATAGRAM_INCOMPLETE,/**< Bad packet. */
 | 
				
			||||||
	GRE_BASE_EXP_IP_FRAGMENT,		/**< IP packet is a fragment. */
 | 
						NSS_GRE_BASE_EXP_IP_FRAGMENT,		/**< IP packet is a fragment. */
 | 
				
			||||||
	GRE_BASE_EXP_IP_OPTIONS_INCOMPLETE,	/**< IP option is invalid. */
 | 
						NSS_GRE_BASE_EXP_IP_OPTIONS_INCOMPLETE,	/**< IP option is invalid. */
 | 
				
			||||||
	GRE_BASE_EXP_IP_WITH_OPTIONS,		/**< IP packet with options. */
 | 
						NSS_GRE_BASE_EXP_IP_WITH_OPTIONS,	/**< IP packet with options. */
 | 
				
			||||||
	GRE_BASE_EXP_IPV6_UNKNOWN_PROTOCOL,	/**< Protocol is unknown. */
 | 
						NSS_GRE_BASE_EXP_IPV6_UNKNOWN_PROTOCOL,	/**< Protocol is unknown. */
 | 
				
			||||||
	GRE_BASE_EXP_IPV6_HEADER_INCOMPLETE,	/**< Incomplete ipv6 header. */
 | 
						NSS_GRE_BASE_EXP_IPV6_HEADER_INCOMPLETE,/**< Incomplete ipv6 header. */
 | 
				
			||||||
	GRE_BASE_EXP_GRE_UNKNOWN_SESSION,	/**< Unknown GRE session. */
 | 
						NSS_GRE_BASE_EXP_GRE_UNKNOWN_SESSION,	/**< Unknown GRE session. */
 | 
				
			||||||
	GRE_BASE_EXP_GRE_NODE_INACTIVE,		/**< GRE node is inactive. */
 | 
						NSS_GRE_BASE_EXP_GRE_NODE_INACTIVE,	/**< GRE node is inactive. */
 | 
				
			||||||
	GRE_BASE_DEBUG_MAX,			/**< GRE base debug max. */
 | 
						NSS_GRE_BASE_DEBUG_MAX,			/**< GRE base debug maximum. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/**
 | 
				
			||||||
 * GRE session Packet drop and exception events.
 | 
					 * nss_gre_session_types
 | 
				
			||||||
 | 
					 *	GRE session packet drop and exception events.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum gre_session_debug_types {
 | 
					enum nss_gre_session_types {
 | 
				
			||||||
	GRE_SESSION_PBUF_ALLOC_FAIL,		/**< Pbuf allocation failure. */
 | 
						NSS_GRE_SESSION_PBUF_ALLOC_FAIL,		/**< Pbuf allocation failure. */
 | 
				
			||||||
	GRE_SESSION_DECAP_FORWARD_ENQUEUE_FAIL,	/**< Rx forward enqueue failure. */
 | 
						NSS_GRE_SESSION_DECAP_FORWARD_ENQUEUE_FAIL,	/**< Receive forward enqueue failure. */
 | 
				
			||||||
	GRE_SESSION_ENCAP_FORWARD_ENQUEUE_FAIL,	/**< Tx forward enqueue failure. */
 | 
						NSS_GRE_SESSION_ENCAP_FORWARD_ENQUEUE_FAIL,	/**< Transmit forward enqueue failure. */
 | 
				
			||||||
	GRE_SESSION_DECAP_TX_FORWARDED,		/**< Number of packets forwarded after decap. */
 | 
						NSS_GRE_SESSION_DECAP_TX_FORWARDED,		/**< Number of packets forwarded after decapsulation. */
 | 
				
			||||||
	GRE_SESSION_ENCAP_RX_RECEIVED,		/**< Number of packets received for encap. */
 | 
						NSS_GRE_SESSION_ENCAP_RX_RECEIVED,		/**< Number of packets received for encapsulation. */
 | 
				
			||||||
	GRE_SESSION_ENCAP_RX_DROPPED,		/**< Packets dropped while enqueuing for encap. */
 | 
						NSS_GRE_SESSION_ENCAP_RX_DROPPED,		/**< Packets dropped while enqueuing for encapsulation. */
 | 
				
			||||||
	GRE_SESSION_ENCAP_RX_LINEAR_FAIL,	/**< Packets dropped during encap linearization. */
 | 
						NSS_GRE_SESSION_ENCAP_RX_LINEAR_FAIL,		/**< Packets dropped during encapsulation linearization. */
 | 
				
			||||||
	GRE_SESSION_EXP_RX_KEY_ERROR,		/**< Rx KEY error. */
 | 
						NSS_GRE_SESSION_EXP_RX_KEY_ERROR,		/**< Receive key error. */
 | 
				
			||||||
	GRE_SESSION_EXP_RX_SEQ_ERROR,		/**< Rx Sequence number error. */
 | 
						NSS_GRE_SESSION_EXP_RX_SEQ_ERROR,		/**< Receive Sequence number error. */
 | 
				
			||||||
	GRE_SESSION_EXP_RX_CS_ERROR,		/**< Rx checksum error */
 | 
						NSS_GRE_SESSION_EXP_RX_CS_ERROR,		/**< Receive checksum error */
 | 
				
			||||||
	GRE_SESSION_EXP_RX_FLAG_MISMATCH,	/**< Rx flag mismatch. */
 | 
						NSS_GRE_SESSION_EXP_RX_FLAG_MISMATCH,		/**< Receive flag mismatch. */
 | 
				
			||||||
	GRE_SESSION_EXP_RX_MALFORMED,		/**< Rx packet is malformed. */
 | 
						NSS_GRE_SESSION_EXP_RX_MALFORMED,		/**< Receive packet is malformed. */
 | 
				
			||||||
	GRE_SESSION_EXP_RX_INVALID_PROTOCOL,	/**< Rx packet protocol is invalid. */
 | 
						NSS_GRE_SESSION_EXP_RX_INVALID_PROTOCOL,	/**< Receive packet protocol is invalid. */
 | 
				
			||||||
	GRE_SESSION_EXP_RX_NO_HEADROOM,		/**< Packet does not have enough headroom. */
 | 
						NSS_GRE_SESSION_EXP_RX_NO_HEADROOM,		/**< Packet does not have enough headroom. */
 | 
				
			||||||
	GRE_SESSION_DEBUG_MAX,			/**< Session debug max. */
 | 
						NSS_GRE_SESSION_DEBUG_MAX,			/**< Session debug maximum. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -208,14 +210,33 @@ struct nss_gre_deconfig_msg {
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
struct nss_gre_session_stats_msg {
 | 
					struct nss_gre_session_stats_msg {
 | 
				
			||||||
	struct nss_cmn_node_stats node_stats;		/**< Common node statistics. */
 | 
						struct nss_cmn_node_stats node_stats;		/**< Common node statistics. */
 | 
				
			||||||
	uint32_t stats[GRE_SESSION_DEBUG_MAX];	/**< Session debug statistics. */
 | 
						uint32_t stats[NSS_GRE_SESSION_DEBUG_MAX];	/**< Session debug statistics. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * GRE base statistics message
 | 
					 * GRE base statistics message
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct nss_gre_base_stats_msg {
 | 
					struct nss_gre_base_stats_msg {
 | 
				
			||||||
	uint32_t stats[GRE_BASE_DEBUG_MAX];	/**< Base debug statistics. */
 | 
						uint32_t stats[NSS_GRE_BASE_DEBUG_MAX];		/**< Base debug statistics. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_base_stats_notification
 | 
				
			||||||
 | 
					 *	GRE transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_gre_base_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_base_ctx[NSS_GRE_BASE_DEBUG_MAX];	/**< Base debug transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;					/**< Core ID. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_session_stats_notification
 | 
				
			||||||
 | 
					 *	GRE transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_gre_session_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_session_ctx[NSS_GRE_SESSION_DEBUG_MAX];		/**< Session debug transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;						/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;						/**< Interface number. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -438,6 +459,34 @@ extern void nss_gre_register_pkt_callback(nss_gre_pkt_callback_t cb);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
extern void nss_gre_unregister_pkt_callback(void);
 | 
					extern void nss_gre_unregister_pkt_callback(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2014-2015, 2017-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2014-2015, 2017-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -92,6 +92,60 @@ enum nss_gre_redir_tunnel_types {
 | 
				
			|||||||
	NSS_GRE_REDIR_TUNNEL_TYPE_MAX,		/**< Maximum tunnel type. */
 | 
						NSS_GRE_REDIR_TUNNEL_TYPE_MAX,		/**< Maximum tunnel type. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_stats_types
 | 
				
			||||||
 | 
					 *	GRE redirect statistics types.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_gre_redir_stats_types {
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_TX_DROPS = NSS_STATS_NODE_MAX,
 | 
				
			||||||
 | 
											/**< Dropped transmit packets. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_SJACK_RX_PKTS,	/**< SJACK receive packet counter. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_SJACK_TX_PKTS,	/**< SJACK transmit packet counter. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_OFFLOAD_RX_PKTS_0,	/**< Offload receive packet counter 0. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_OFFLOAD_RX_PKTS_1,	/**< Offload receive packet counter 1. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_OFFLOAD_RX_PKTS_2,	/**< Offload receive packet counter 2. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_OFFLOAD_RX_PKTS_3,	/**< Offload receive packet counter 3. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_OFFLOAD_RX_PKTS_4,	/**< Offload receive packet counter 4. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_OFFLOAD_TX_PKTS_0,	/**< Offload transmit packet counter 0. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_OFFLOAD_TX_PKTS_1,	/**< Offload transmit packet counter 1. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_OFFLOAD_TX_PKTS_2,	/**< Offload transmit packet counter 2. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_OFFLOAD_TX_PKTS_3,	/**< Offload transmit packet counter 3. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_OFFLOAD_TX_PKTS_4,	/**< Offload transmit packet counter 4. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_EXCEPTION_US_RX_PKTS,
 | 
				
			||||||
 | 
											/**< Upstream exception receive packet counter. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_EXCEPTION_US_TX_PKTS,
 | 
				
			||||||
 | 
											/**< Upstream exception transmit packet counter. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_EXCEPTION_DS_RX_PKTS,
 | 
				
			||||||
 | 
											/**< Downstream exception receive packet counter. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_EXCEPTION_DS_TX_PKTS,
 | 
				
			||||||
 | 
											/**< Downstream exception transmit packet counter. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_ENCAP_SG_ALLOC_DROP,
 | 
				
			||||||
 | 
											/**< Encapsulation drop counters due to scatter gather buffer allocation failure. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_DECAP_FAIL_DROP,
 | 
				
			||||||
 | 
											/**< Decapsulation drop counters due to invalid IP header. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_DECAP_SPLIT_DROP,
 | 
				
			||||||
 | 
											/**< Decapsulation drop counters due to split flow processing. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_SPLIT_SG_ALLOC_FAIL,
 | 
				
			||||||
 | 
											/**< Split processing fail counter due to scatter gather buffer allocation failure. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_SPLIT_LINEAR_COPY_FAIL,
 | 
				
			||||||
 | 
											/**< Split processing fail counter due to linear copy fail. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_SPLIT_NOT_ENOUGH_TAILROOM,
 | 
				
			||||||
 | 
											/**< Split processing fail counter due to insufficient tailroom. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_EXCEPTION_DS_INVALID_DST_DROP,
 | 
				
			||||||
 | 
											/**< Downstream exception handling fail counter due to invalid destination. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_DECAP_EAPOL_FRAMES,
 | 
				
			||||||
 | 
											/**< Decapsulation EAPoL frame counters. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_EXCEPTION_DS_INV_APPID,
 | 
				
			||||||
 | 
											/**< Invalid application ID for the transmit completion packets on exception downstream node. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_HEADROOM_UNAVAILABLE,
 | 
				
			||||||
 | 
											/**< Packet headroom unavailable to write metadata. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_TX_COMPLETION_SUCCESS,
 | 
				
			||||||
 | 
											/**< Host enqueue success count for the transmit completion packets. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_TX_COMPLETION_DROP,
 | 
				
			||||||
 | 
											/**< Host enqueue drop count for the transmit completion packets. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_STATS_MAX			/**< Maximum statistics type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_inner_configure_msg
 | 
					 * nss_gre_redir_inner_configure_msg
 | 
				
			||||||
 *	Message information for configuring GRE inner node.
 | 
					 *	Message information for configuring GRE inner node.
 | 
				
			||||||
@@ -246,37 +300,66 @@ struct nss_gre_redir_stats_sync_msg {
 | 
				
			|||||||
	uint32_t tx_completion_drop;			/**< Host enqueue drop count for the Tx completion packets. */
 | 
						uint32_t tx_completion_drop;			/**< Host enqueue drop count for the Tx completion packets. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_tun_stats
 | 
				
			||||||
 | 
					 *	GRE redirect statistics to accumulate all the stats values.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_gre_redir_tun_stats {
 | 
				
			||||||
 | 
						uint64_t rx_packets;		/**< Number of packets received. */
 | 
				
			||||||
 | 
						uint64_t rx_bytes;		/**< Number of bytes received. */
 | 
				
			||||||
 | 
						uint64_t tx_packets;		/**< Number of packets transmitted. */
 | 
				
			||||||
 | 
						uint64_t tx_bytes;		/**< Number of bytes transmitted. */
 | 
				
			||||||
 | 
						uint64_t rx_dropped[NSS_MAX_NUM_PRI];
 | 
				
			||||||
 | 
										/**< Packets dropped on receive due to queue full. */
 | 
				
			||||||
 | 
						uint64_t tx_dropped;		/**< Dropped transmit packets. */
 | 
				
			||||||
 | 
						uint64_t sjack_rx_packets;	/**< SJACK receive packet counter. */
 | 
				
			||||||
 | 
						uint64_t sjack_tx_packets;	/**< SJACK transmit packet counter. */
 | 
				
			||||||
 | 
						uint64_t offl_rx_pkts[NSS_GRE_REDIR_MAX_RADIO];	/**< Offload receive packet counter per radio. */
 | 
				
			||||||
 | 
						uint64_t offl_tx_pkts[NSS_GRE_REDIR_MAX_RADIO];	/**< Offload transmit packet counter per radio. */
 | 
				
			||||||
 | 
						uint64_t exception_us_rx;	/**< Upstream exception receive packet counter. */
 | 
				
			||||||
 | 
						uint64_t exception_us_tx;	/**< Upstream exception transmit packet counter. */
 | 
				
			||||||
 | 
						uint64_t exception_ds_rx;	/**< Downstream exception receive packet counter. */
 | 
				
			||||||
 | 
						uint64_t exception_ds_tx;	/**< Downstream exception transmit packet counter. */
 | 
				
			||||||
 | 
						uint64_t encap_sg_alloc_drop;
 | 
				
			||||||
 | 
										/**< Encapsulation drop counters due to scatter gather buffer allocation failure. */
 | 
				
			||||||
 | 
						uint64_t decap_fail_drop;	/**< Decapsulation drop counters due to invalid IP header. */
 | 
				
			||||||
 | 
						uint64_t decap_split_drop;	/**< Decapsulation drop counters due to split flow processing. */
 | 
				
			||||||
 | 
						uint64_t split_sg_alloc_fail;
 | 
				
			||||||
 | 
										/**< Split processing fail counter due to scatter gather buffer allocation failure. */
 | 
				
			||||||
 | 
						uint64_t split_linear_copy_fail;
 | 
				
			||||||
 | 
										/**< Split processing fail counter due to linear copy fail. */
 | 
				
			||||||
 | 
						uint64_t split_not_enough_tailroom;
 | 
				
			||||||
 | 
										/**< Split processing fail counter due to insufficient tailroom. */
 | 
				
			||||||
 | 
						uint64_t exception_ds_invalid_dst_drop;
 | 
				
			||||||
 | 
										/**< Downstream exception handling fail counter due to invalid destination. */
 | 
				
			||||||
 | 
						uint64_t decap_eapol_frames;	/**< Decapsulation EAPoL frame counters. */
 | 
				
			||||||
 | 
						uint64_t exception_ds_inv_appid;
 | 
				
			||||||
 | 
										/**< Invalid application ID for the transmit completion packets on exception downstream node. */
 | 
				
			||||||
 | 
						uint64_t headroom_unavail;	/**< Packet headroom unavailable to write metadata. */
 | 
				
			||||||
 | 
						uint64_t tx_completion_success;	/**< Host enqueue success count for the transmit completion packets. */
 | 
				
			||||||
 | 
						uint64_t tx_completion_drop;	/**< Host enqueue drop count for the transmit completion packets. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_tunnel_stats
 | 
					 * nss_gre_redir_tunnel_stats
 | 
				
			||||||
 *	GRE redirect statistics as seen by the HLOS.
 | 
					 *	GRE redirect statistics as seen by the HLOS.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct nss_gre_redir_tunnel_stats {
 | 
					struct nss_gre_redir_tunnel_stats {
 | 
				
			||||||
	struct net_device *dev;			/**< Net device. */
 | 
						struct net_device *dev;			/**< Net device. */
 | 
				
			||||||
	struct nss_cmn_node_stats node_stats;		/**< Common node statistics. */
 | 
						struct nss_gre_redir_tun_stats tstats;	/**< Structure to accumulate all the statistics. */
 | 
				
			||||||
	uint64_t tx_dropped;				/**< Dropped Tx packets. */
 | 
					 | 
				
			||||||
	uint64_t sjack_rx_packets;			/**< SJACK Rx packet counter. */
 | 
					 | 
				
			||||||
	uint64_t sjack_tx_packets;			/**< SJACK Tx packet counter. */
 | 
					 | 
				
			||||||
	uint64_t offl_rx_pkts[NSS_GRE_REDIR_MAX_RADIO];	/**< Offload Rx packet counter per radio. */
 | 
					 | 
				
			||||||
	uint64_t offl_tx_pkts[NSS_GRE_REDIR_MAX_RADIO];	/**< Offload Tx packet counter per radio. */
 | 
					 | 
				
			||||||
	uint64_t exception_us_rx;			/**< Upstream exception Rx packet counter. */
 | 
					 | 
				
			||||||
	uint64_t exception_us_tx;			/**< Upstream exception Tx packet counter. */
 | 
					 | 
				
			||||||
	uint64_t exception_ds_rx;			/**< Downstream exception Rx packet counter. */
 | 
					 | 
				
			||||||
	uint64_t exception_ds_tx;			/**< Downstream exception Tx packet counter. */
 | 
					 | 
				
			||||||
	uint64_t encap_sg_alloc_drop;			/**< Encapsulation drop counters due to scatter gather buffer allocation failure. */
 | 
					 | 
				
			||||||
	uint64_t decap_fail_drop;			/**< Decapsulation drop counters due to invalid IP header. */
 | 
					 | 
				
			||||||
	uint64_t decap_split_drop;			/**< Decapsulation drop counters due to split flow processing. */
 | 
					 | 
				
			||||||
	uint64_t split_sg_alloc_fail;			/**< Split processing fail counter due to scatter gather buffer allocation failure. */
 | 
					 | 
				
			||||||
	uint64_t split_linear_copy_fail;		/**< Split processing fail counter due to linear copy fail. */
 | 
					 | 
				
			||||||
	uint64_t split_not_enough_tailroom;		/**< Split processing fail counter due to insufficient tailroom. */
 | 
					 | 
				
			||||||
	uint64_t exception_ds_invalid_dst_drop;		/**< Downstream exception handling fail counter due to invalid destination. */
 | 
					 | 
				
			||||||
	uint64_t decap_eapol_frames;			/**< Decapsulation EAPoL frame counters. */
 | 
					 | 
				
			||||||
	uint64_t exception_ds_inv_appid;		/**< Invalid application ID for the Tx completion packets on exception downstream node. */
 | 
					 | 
				
			||||||
	uint64_t headroom_unavail;			/**< Packet headroom unavailable to write metadata. */
 | 
					 | 
				
			||||||
	uint64_t tx_completion_success;			/**< Host enqueue success count for the Tx completion packets. */
 | 
					 | 
				
			||||||
	uint64_t tx_completion_drop;			/**< Host enqueue drop count for the Tx completion packets. */
 | 
					 | 
				
			||||||
	uint32_t ref_count;			/**< Reference count for statistics. */
 | 
						uint32_t ref_count;			/**< Reference count for statistics. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_stats_notification
 | 
				
			||||||
 | 
					 *	GRE redirect transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_gre_redir_stats_notification {
 | 
				
			||||||
 | 
						struct nss_gre_redir_tunnel_stats stats_ctx;	/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;				/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;				/**< Interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_msg
 | 
					 * nss_gre_redir_msg
 | 
				
			||||||
 *	Data for sending and receiving GRE tunnel redirect messages.
 | 
					 *	Data for sending and receiving GRE tunnel redirect messages.
 | 
				
			||||||
@@ -466,7 +549,7 @@ extern nss_tx_status_t nss_gre_redir_tx_buf_noreuse(struct nss_ctx_instance *nss
 | 
				
			|||||||
			uint32_t if_num);
 | 
								uint32_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_get_stats
 | 
					 * nss_gre_redir_stats_get
 | 
				
			||||||
 *	Gets GRE redirect tunnel statistics.
 | 
					 *	Gets GRE redirect tunnel statistics.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
@@ -478,7 +561,7 @@ extern nss_tx_status_t nss_gre_redir_tx_buf_noreuse(struct nss_ctx_instance *nss
 | 
				
			|||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * TRUE or FALSE.
 | 
					 * TRUE or FALSE.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern bool nss_gre_redir_get_stats(int index, struct nss_gre_redir_tunnel_stats *stats);
 | 
					extern bool nss_gre_redir_stats_get(int index, struct nss_gre_redir_tunnel_stats *stats);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_alloc_and_register_node
 | 
					 * nss_gre_redir_alloc_and_register_node
 | 
				
			||||||
@@ -594,6 +677,34 @@ extern struct dentry *nss_gre_redir_get_dentry(void);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
extern struct device *nss_gre_redir_get_device(void);
 | 
					extern struct device *nss_gre_redir_get_device(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_redir_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_redir_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2018, 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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -72,6 +72,39 @@ enum nss_gre_redir_lag_ds_message_types {
 | 
				
			|||||||
	NSS_GRE_REDIR_LAG_DS_MAX_MSG_TYPES,
 | 
						NSS_GRE_REDIR_LAG_DS_MAX_MSG_TYPES,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_stats_types
 | 
				
			||||||
 | 
					 *	GRE redirect LAG downstream statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_gre_redir_lag_ds_stats_types {
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_DS_STATS_DST_INVALID = NSS_STATS_NODE_MAX,
 | 
				
			||||||
 | 
												/**< Packets that do not have a valid destination. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_DS_STATS_EXCEPTION_PKT,	/**< Packets that are exceptioned to host. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_DS_STATS_MAX,			/**< Maximum statistics type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_stats_types
 | 
				
			||||||
 | 
					 *	GRE redirect LAG upstream statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_gre_redir_lag_us_stats_types {
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_AMSDU_PKTS = NSS_STATS_NODE_MAX,
 | 
				
			||||||
 | 
												/**< Number of AMSDU packets seen. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_AMSDU_PKTS_ENQUEUED,	/**< Number of AMSDU packets enqueued. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_AMSDU_PKTS_EXCEPTIONED,
 | 
				
			||||||
 | 
												/**< Number of AMSDU packets exceptioned. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_EXCEPTIONED,		/**< Number of exceptioned packets. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_FREED,		/**< Freed packets when equeue to NSS to host fails. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_ADD_ATTEMPT,		/**< Add hash attempts. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_ADD_SUCCESS,		/**< Add hash success. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_ADD_FAIL_TABLE_FULL,	/**< Add hash failed due to full table. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_ADD_FAIL_EXISTS,	/**< Add hash failed as entry already exists. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_DEL_ATTEMPT,		/**< Delete hash attempts. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_DEL_SUCCESS,		/**< Delete hash success. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_DEL_FAIL_NOT_FOUND,	/**< Delete hash failed as entry not found in hash table. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_LAG_US_STATS_MAX,			/**< Maximum statistics type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_lag_us_hash_mode
 | 
					 * nss_gre_redir_lag_us_hash_mode
 | 
				
			||||||
 *	GRE redirect LAG upstream hash modes.
 | 
					 *	GRE redirect LAG upstream hash modes.
 | 
				
			||||||
@@ -253,6 +286,16 @@ struct nss_gre_redir_lag_us_tunnel_stats {
 | 
				
			|||||||
	struct nss_gre_redir_lag_us_cmn_db_stats db_stats;	/**< Common hash statistics. */
 | 
						struct nss_gre_redir_lag_us_cmn_db_stats db_stats;	/**< Common hash statistics. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_stats_notification
 | 
				
			||||||
 | 
					 *	GRE redirect LAG upstream transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_gre_redir_lag_us_stats_notification {
 | 
				
			||||||
 | 
						struct nss_gre_redir_lag_us_tunnel_stats stats_ctx;	/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;					/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;					/**< Interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_lag_ds_add_sta_msg
 | 
					 * nss_gre_redir_lag_ds_add_sta_msg
 | 
				
			||||||
 *	Message to add station in LAG deployment.
 | 
					 *	Message to add station in LAG deployment.
 | 
				
			||||||
@@ -324,13 +367,24 @@ struct nss_gre_redir_lag_ds_tun_stats {
 | 
				
			|||||||
	uint64_t rx_bytes;		/**< Received bytes. */
 | 
						uint64_t rx_bytes;		/**< Received bytes. */
 | 
				
			||||||
	uint64_t tx_packets;		/**< Transmit packets. */
 | 
						uint64_t tx_packets;		/**< Transmit packets. */
 | 
				
			||||||
	uint64_t tx_bytes;		/**< Transmit bytes. */
 | 
						uint64_t tx_bytes;		/**< Transmit bytes. */
 | 
				
			||||||
	uint64_t rx_dropped[NSS_MAX_NUM_PRI];			/**< Packets dropped on receive due to queue full. */
 | 
						uint64_t rx_dropped[NSS_MAX_NUM_PRI];
 | 
				
			||||||
 | 
										/**< Packets dropped on receive due to queue full. */
 | 
				
			||||||
	uint64_t dst_invalid;		/**< Packets that do not have a valid destination. */
 | 
						uint64_t dst_invalid;		/**< Packets that do not have a valid destination. */
 | 
				
			||||||
	uint64_t exception_cnt;		/**< Packets that are exceptioned to host. */
 | 
						uint64_t exception_cnt;		/**< Packets that are exceptioned to host. */
 | 
				
			||||||
	uint32_t ifnum;			/**< NSS interface number. */
 | 
						uint32_t ifnum;			/**< NSS interface number. */
 | 
				
			||||||
	bool valid;			/**< Valid flag. */
 | 
						bool valid;			/**< Valid flag. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_stats_notification
 | 
				
			||||||
 | 
					 *	GRE redirect LAG downstream transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_gre_redir_lag_ds_stats_notification {
 | 
				
			||||||
 | 
						struct nss_gre_redir_lag_ds_tun_stats stats_ctx;	/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;					/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;					/**< Interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Callback function for receiving GRE redirect LAG upstream data.
 | 
					 * Callback function for receiving GRE redirect LAG upstream data.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -568,7 +622,7 @@ extern nss_tx_status_t nss_gre_redir_lag_us_tx_msg_sync(struct nss_ctx_instance
 | 
				
			|||||||
extern nss_tx_status_t nss_gre_redir_lag_ds_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_lag_ds_msg *ngrm);
 | 
					extern nss_tx_status_t nss_gre_redir_lag_ds_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_lag_ds_msg *ngrm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_lag_us_get_cmn_stats
 | 
					 * nss_gre_redir_lag_us_stats_get
 | 
				
			||||||
 *	Fetches common node statistics for upstream GRE Redir LAG.
 | 
					 *	Fetches common node statistics for upstream GRE Redir LAG.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
@@ -580,10 +634,10 @@ extern nss_tx_status_t nss_gre_redir_lag_ds_tx_msg_sync(struct nss_ctx_instance
 | 
				
			|||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * True if successful, else false.
 | 
					 * True if successful, else false.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern bool nss_gre_redir_lag_us_get_cmn_stats(struct nss_gre_redir_lag_us_tunnel_stats *cmn_stats, uint32_t index);
 | 
					extern bool nss_gre_redir_lag_us_stats_get(struct nss_gre_redir_lag_us_tunnel_stats *cmn_stats, uint32_t index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_lag_ds_get_stats
 | 
					 * nss_gre_redir_lag_ds_stats_get
 | 
				
			||||||
 *	Fetches common node statistics for downstream GRE Redir LAG.
 | 
					 *	Fetches common node statistics for downstream GRE Redir LAG.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
@@ -595,7 +649,7 @@ extern bool nss_gre_redir_lag_us_get_cmn_stats(struct nss_gre_redir_lag_us_tunne
 | 
				
			|||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * True if successful, else false.
 | 
					 * True if successful, else false.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern bool nss_gre_redir_lag_ds_get_cmn_stats(struct nss_gre_redir_lag_ds_tun_stats *cmn_stats, uint32_t index);
 | 
					extern bool nss_gre_redir_lag_ds_stats_get(struct nss_gre_redir_lag_ds_tun_stats *cmn_stats, uint32_t index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_lag_us_get_context
 | 
					 * nss_gre_redir_lag_us_get_context
 | 
				
			||||||
@@ -615,6 +669,62 @@ extern struct nss_ctx_instance *nss_gre_redir_lag_us_get_context(void);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
extern struct nss_ctx_instance *nss_gre_redir_lag_ds_get_context(void);
 | 
					extern struct nss_ctx_instance *nss_gre_redir_lag_ds_get_context(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_redir_lag_ds_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_redir_lag_ds_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_redir_lag_us_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_redir_lag_us_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -25,6 +25,8 @@
 | 
				
			|||||||
#define NSS_GRE_REDIR_MARK_HLOS_MAGIC 0xaade	/**< Metadata magic set by HLOS. */
 | 
					#define NSS_GRE_REDIR_MARK_HLOS_MAGIC 0xaade	/**< Metadata magic set by HLOS. */
 | 
				
			||||||
#define NSS_GRE_REDIR_MARK_NSS_MAGIC 0xaadf	/**< Metadata magic set by NSS. */
 | 
					#define NSS_GRE_REDIR_MARK_NSS_MAGIC 0xaadf	/**< Metadata magic set by NSS. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct nss_gre_redir_mark_stats gre_mark_stats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_mark messages
 | 
					 * nss_gre_redir_mark messages
 | 
				
			||||||
 *	Message types for GRE redirect mark requests and responses.
 | 
					 *	Message types for GRE redirect mark requests and responses.
 | 
				
			||||||
@@ -46,6 +48,23 @@ enum nss_gre_redir_mark_error_types {
 | 
				
			|||||||
	NSS_GRE_REDIR_MARK_ERROR_TYPE_MAX
 | 
						NSS_GRE_REDIR_MARK_ERROR_TYPE_MAX
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_stats_types
 | 
				
			||||||
 | 
					 *	GRE redirect mark statistics types.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_gre_redir_mark_stats_types {
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_MARK_STATS_HLOS_MAGIC_FAILED = NSS_STATS_NODE_MAX,
 | 
				
			||||||
 | 
												/**< HLOS magic fail count. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_MARK_STATS_INV_DST_IF_DROPS,	/**< Invalid transmit interface drop count. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE,	/**< Next egress interface enqueue success count. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE_DROPS,	/**< Next egress interface enqueue drop count. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_MARK_STATS_INV_APPID,		/**< Invalid application ID for the transmit completion packets. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_MARK_STATS_HEADROOM_UNAVAILABLE,	/**< Packet headroom unavailable to write metadata. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_SUCCESS,	/**< Transmit completion host enqueue success count. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_DROPS,	/**< Transmit completion host enqueue drop count. */
 | 
				
			||||||
 | 
						NSS_GRE_REDIR_MARK_STATS_MAX			/**< Maximum statistics type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_mark_metadata
 | 
					 * nss_gre_redir_mark_metadata
 | 
				
			||||||
 *	HLOS to NSS per packet downstream metadata.
 | 
					 *	HLOS to NSS per packet downstream metadata.
 | 
				
			||||||
@@ -55,7 +74,7 @@ struct nss_gre_redir_mark_metadata {
 | 
				
			|||||||
	uint8_t wifi_tid;		/**< TID value. */
 | 
						uint8_t wifi_tid;		/**< TID value. */
 | 
				
			||||||
	uint8_t app_id;			/**< Application ID. */
 | 
						uint8_t app_id;			/**< Application ID. */
 | 
				
			||||||
	uint16_t hw_hash_idx;		/**< Hardware AST hash index value. */
 | 
						uint16_t hw_hash_idx;		/**< Hardware AST hash index value. */
 | 
				
			||||||
	uint32_t tx_status;		/**< Tx status. */
 | 
						uint32_t tx_status;		/**< Transmit status. */
 | 
				
			||||||
	uint16_t offset;		/**< Buffer offset from the metadata. */
 | 
						uint16_t offset;		/**< Buffer offset from the metadata. */
 | 
				
			||||||
	uint16_t magic;			/**< Metadata magic. */
 | 
						uint16_t magic;			/**< Metadata magic. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -67,21 +86,31 @@ struct nss_gre_redir_mark_metadata {
 | 
				
			|||||||
struct nss_gre_redir_mark_stats_sync_msg {
 | 
					struct nss_gre_redir_mark_stats_sync_msg {
 | 
				
			||||||
	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */
 | 
						struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */
 | 
				
			||||||
	uint32_t hlos_magic_fail;               /**< HLOS magic fail count. */
 | 
						uint32_t hlos_magic_fail;               /**< HLOS magic fail count. */
 | 
				
			||||||
	uint32_t invalid_dst_drop;		/**< Invalid Tx interface drop count. */
 | 
						uint32_t invalid_dst_drop;		/**< Invalid transmit interface drop count. */
 | 
				
			||||||
	uint32_t dst_enqueue_success;		/**< Next egress interface enqueue success count. */
 | 
						uint32_t dst_enqueue_success;		/**< Next egress interface enqueue success count. */
 | 
				
			||||||
	uint32_t dst_enqueue_drop;		/**< Next egress interface enqueue drop count. */
 | 
						uint32_t dst_enqueue_drop;		/**< Next egress interface enqueue drop count. */
 | 
				
			||||||
	uint32_t inv_appid;			/**< Invalid application ID for the Tx completion packets. */
 | 
						uint32_t inv_appid;			/**< Invalid application ID for the transmit completion packets. */
 | 
				
			||||||
	uint32_t headroom_unavail;		/**< Packet headroom unavailable to write metadata. */
 | 
						uint32_t headroom_unavail;		/**< Packet headroom unavailable to write metadata. */
 | 
				
			||||||
	uint32_t tx_completion_success;		/**< Tx completion host enqueue success count. */
 | 
						uint32_t tx_completion_success;		/**< Transmit completion host enqueue success count. */
 | 
				
			||||||
	uint32_t tx_completion_drop;		/**< Tx completion host enqueue drop count. */
 | 
						uint32_t tx_completion_drop;		/**< Transmit completion host enqueue drop count. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_mark_register_cb_msg
 | 
					 * nss_gre_redir_mark_register_cb_msg
 | 
				
			||||||
 *	Tx completion function register configuration message.
 | 
					 *	Transmit completion function register configuration message.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct nss_gre_redir_mark_register_cb_msg {
 | 
					struct nss_gre_redir_mark_register_cb_msg {
 | 
				
			||||||
	uint32_t nss_if_num;			/**< NSS Tx interface number on which callback needs to be registered. */
 | 
						uint32_t nss_if_num;	/**< NSS transmit interface number on which callback needs to be registered. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_stats_notification
 | 
				
			||||||
 | 
					 *	GRE redirect mark transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_gre_redir_mark_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_ctx[NSS_GRE_REDIR_MARK_STATS_MAX];	/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;					/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;					/**< Interface number. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -211,7 +240,7 @@ extern nss_tx_status_t nss_gre_redir_mark_tx_msg(struct nss_ctx_instance *nss_ct
 | 
				
			|||||||
extern nss_tx_status_t nss_gre_redir_mark_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_mark_msg *ngrm);
 | 
					extern nss_tx_status_t nss_gre_redir_mark_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_mark_msg *ngrm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_mark_get_stats
 | 
					 * nss_gre_redir_mark_stats_get
 | 
				
			||||||
 *      Gets GRE redirect mark statistics.
 | 
					 *      Gets GRE redirect mark statistics.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
@@ -223,7 +252,7 @@ extern nss_tx_status_t nss_gre_redir_mark_tx_msg_sync(struct nss_ctx_instance *n
 | 
				
			|||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * TRUE or FALSE.
 | 
					 * TRUE or FALSE.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern bool nss_gre_redir_mark_get_stats(void *stats);
 | 
					extern bool nss_gre_redir_mark_stats_get(struct nss_gre_redir_mark_stats *stats);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_alloc_and_register_node
 | 
					 * nss_gre_redir_alloc_and_register_node
 | 
				
			||||||
@@ -274,6 +303,34 @@ extern struct dentry *nss_gre_redir_mark_get_dentry(void);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
extern struct device *nss_gre_redir_mark_get_device(void);
 | 
					extern struct device *nss_gre_redir_mark_get_device(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_redir_mark_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_redir_mark_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 ****************************************************************************
 | 
				
			||||||
 * Copyright (c) 2016-2018,2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2016-2018, 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -11,7 +11,7 @@
 | 
				
			|||||||
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 **************************************************************************
 | 
					 ****************************************************************************
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -97,6 +97,41 @@ enum nss_gre_tunnel_error_types {
 | 
				
			|||||||
	NSS_GRE_TUNNEL_ERR_MAX,
 | 
						NSS_GRE_TUNNEL_ERR_MAX,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 *  nss_gre_tunnel_stats_type
 | 
				
			||||||
 | 
					 *	GRE tunnel session debug statistic counters.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_gre_tunnel_stats_type {
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_PKTS,			/**< Number of packets received. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_TX_PKTS,			/**< Number of packets transmitted. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_QUEUE_0_DROPPED,	/**< Dropped receive packets 0. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_QUEUE_1_DROPPED,	/**< Dropped receive packets 1. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_QUEUE_2_DROPPED,	/**< Dropped receive packets 2. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_QUEUE_3_DROPPED,	/**< Dropped receive packets 3. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_MALFORMED,		/**< Malformed packet was received. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_INVALID_PROT,		/**< Invalid protocol was received. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_DECAP_QUEUE_FULL,		/**< Decapsulation queue is full. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_SINGLE_REC_DGRAM,	/**< Single fragment was received. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_INVALID_REC_DGRAM,	/**< Invalid fragment was received. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_BUFFER_ALLOC_FAIL,		/**< Buffer memory allocation failed. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_BUFFER_COPY_FAIL,		/**< Buffer memory copy failed. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_OUTFLOW_QUEUE_FULL,	/**< Outflow queue is full. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_DROPPED_HROOM,	/**< Packets dropped because of insufficent headroom. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_CBUFFER_ALLOC_FAIL,	/**< Receive crypto buffer allocation failed. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_CENQUEUE_FAIL,		/**< Receive enqueue-to-crypto failed. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_DECRYPT_DONE,		/**< Receive decryption is complete. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_FORWARD_ENQUEUE_FAIL,	/**< Receive forward enqueue failed. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_TX_CBUFFER_ALLOC_FAIL,	/**< Receive crypto buffer allocation failed. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_TX_CENQUEUE_FAIL,		/**< Transmit enqueue-to-crypto failed. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_DROPPED_TROOM,	/**< Packets dropped because of insufficent tailroom. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_TX_FORWARD_ENQUEUE_FAIL,	/**< Transmit forward enqueue failed. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_TX_CIPHER_DONE,		/**< Transmit cipher is complete. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_CRYPTO_NOSUPP,		/**< Error count for non-supported crypto packets. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_DROPPED_MH_VERSION,	/**< Receive drop: bad meta header. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_RX_UNALIGNED_PKT,		/**< Counter for unaligned packets. */
 | 
				
			||||||
 | 
						NSS_GRE_TUNNEL_STATS_SESSION_MAX,			/**< Maximum statistics type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_tunnel_di_to_wlan_id
 | 
					 * nss_gre_tunnel_di_to_wlan_id
 | 
				
			||||||
 *	Dynamic interface to WLAN ID message structure.
 | 
					 *	Dynamic interface to WLAN ID message structure.
 | 
				
			||||||
@@ -151,20 +186,20 @@ struct nss_gre_tunnel_stats {
 | 
				
			|||||||
	uint32_t rx_dropped_hroom;
 | 
						uint32_t rx_dropped_hroom;
 | 
				
			||||||
				/**< Packets dropped because of insufficent headroom. */
 | 
									/**< Packets dropped because of insufficent headroom. */
 | 
				
			||||||
	uint32_t rx_cbuf_alloc_fail;
 | 
						uint32_t rx_cbuf_alloc_fail;
 | 
				
			||||||
				/**< Rx crypto buffer allocation failed. */
 | 
									/**< Receive crypto buffer allocation failed. */
 | 
				
			||||||
	uint32_t rx_cenqueue_fail;		/**< Rx enqueue-to-crypto failed. */
 | 
						uint32_t rx_cenqueue_fail;		/**< Receive enqueue-to-crypto failed. */
 | 
				
			||||||
	uint32_t rx_decrypt_done;		/**< Rx decryption is complete. */
 | 
						uint32_t rx_decrypt_done;		/**< Receive decryption is complete. */
 | 
				
			||||||
	uint32_t rx_forward_enqueue_fail;	/**< Rx forward enqueue failed. */
 | 
						uint32_t rx_forward_enqueue_fail;	/**< Receive forward enqueue failed. */
 | 
				
			||||||
	uint32_t tx_cbuf_alloc_fail;
 | 
						uint32_t tx_cbuf_alloc_fail;
 | 
				
			||||||
				/**< Rx crypto buffer allocation failed. */
 | 
									/**< Receive crypto buffer allocation failed. */
 | 
				
			||||||
	uint32_t tx_cenqueue_fail;		/**< Tx enqueue-to-crypto failed. */
 | 
						uint32_t tx_cenqueue_fail;		/**< Transmit enqueue-to-crypto failed. */
 | 
				
			||||||
	uint32_t rx_dropped_troom;
 | 
						uint32_t rx_dropped_troom;
 | 
				
			||||||
				/**< Packets dropped because of insufficent tailroom. */
 | 
									/**< Packets dropped because of insufficent tailroom. */
 | 
				
			||||||
	uint32_t tx_forward_enqueue_fail;	/**< Tx forward enqueue failed. */
 | 
						uint32_t tx_forward_enqueue_fail;	/**< Transmit forward enqueue failed. */
 | 
				
			||||||
	uint32_t tx_cipher_done;		/**< Tx cipher is complete. */
 | 
						uint32_t tx_cipher_done;		/**< Transmit cipher is complete. */
 | 
				
			||||||
	uint32_t crypto_nosupp;
 | 
						uint32_t crypto_nosupp;
 | 
				
			||||||
				/**< Error count for non-supported crypto packets. */
 | 
									/**< Error count for non-supported crypto packets. */
 | 
				
			||||||
	uint32_t rx_dropped_mh_ver;		/**< Rx drop: bad meta header. */
 | 
						uint32_t rx_dropped_mh_ver;		/**< Receive drop: bad meta header. */
 | 
				
			||||||
	uint32_t rx_unaligned_pkt;		/**< Counter for unaligned packets. */
 | 
						uint32_t rx_unaligned_pkt;		/**< Counter for unaligned packets. */
 | 
				
			||||||
#if defined(NSS_HAL_IPQ807x_SUPPORT)
 | 
					#if defined(NSS_HAL_IPQ807x_SUPPORT)
 | 
				
			||||||
	uint32_t crypto_resp_error[NSS_CRYPTO_CMN_RESP_ERROR_MAX];
 | 
						uint32_t crypto_resp_error[NSS_CRYPTO_CMN_RESP_ERROR_MAX];
 | 
				
			||||||
@@ -172,6 +207,17 @@ struct nss_gre_tunnel_stats {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_tunnel_stats_notification
 | 
				
			||||||
 | 
					 *	GRE tunnel transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_gre_tunnel_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_ctx[NSS_GRE_TUNNEL_STATS_SESSION_MAX + NSS_CRYPTO_CMN_RESP_ERROR_MAX];
 | 
				
			||||||
 | 
												/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;				/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;				/**< Interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_gre_tunnel_msg
 | 
					 * nss_gre_tunnel_msg
 | 
				
			||||||
 *	Data for sending and receiving GRE tunnel messages.
 | 
					 *	Data for sending and receiving GRE tunnel messages.
 | 
				
			||||||
@@ -347,6 +393,34 @@ extern nss_tx_status_t nss_gre_tunnel_inquiry(
 | 
				
			|||||||
		struct nss_gre_tunnel_configure *inquiry_info,
 | 
							struct nss_gre_tunnel_configure *inquiry_info,
 | 
				
			||||||
		nss_gre_tunnel_msg_callback_t cb, void *app_data);
 | 
							nss_gre_tunnel_msg_callback_t cb, void *app_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_tunnel_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_tunnel_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_gre_tunnel_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_gre_tunnel_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -53,6 +53,8 @@ enum nss_if_message_types {
 | 
				
			|||||||
	NSS_IF_SET_IGS_NODE,
 | 
						NSS_IF_SET_IGS_NODE,
 | 
				
			||||||
	NSS_IF_CLEAR_IGS_NODE,
 | 
						NSS_IF_CLEAR_IGS_NODE,
 | 
				
			||||||
	NSS_IF_RESET_NEXTHOP,
 | 
						NSS_IF_RESET_NEXTHOP,
 | 
				
			||||||
 | 
						NSS_IF_PPE_PORT_CREATE,
 | 
				
			||||||
 | 
						NSS_IF_PPE_PORT_DESTROY,
 | 
				
			||||||
	NSS_IF_MAX_MSG_TYPES = 9999,
 | 
						NSS_IF_MAX_MSG_TYPES = 9999,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -197,6 +199,14 @@ struct nss_if_igs_config {
 | 
				
			|||||||
	int32_t igs_num;	/**< Ingress shaper interface number. */
 | 
						int32_t igs_num;	/**< Ingress shaper interface number. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_if_ppe_port_create
 | 
				
			||||||
 | 
					 *	Message to create PPE port.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_if_ppe_port_create {
 | 
				
			||||||
 | 
						int32_t ppe_port_num;	/**< PPE port number returned by NSS. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_if_msgs
 | 
					 * nss_if_msgs
 | 
				
			||||||
 *	Information for physical NSS interface command messages.
 | 
					 *	Information for physical NSS interface command messages.
 | 
				
			||||||
@@ -230,6 +240,8 @@ union nss_if_msgs {
 | 
				
			|||||||
			/**< Set nexthop of interface. */
 | 
								/**< Set nexthop of interface. */
 | 
				
			||||||
	struct nss_if_igs_config config_igs;
 | 
						struct nss_if_igs_config config_igs;
 | 
				
			||||||
			/**< Configure an ingress shaper interface. */
 | 
								/**< Configure an ingress shaper interface. */
 | 
				
			||||||
 | 
						struct nss_if_ppe_port_create ppe_port_create;
 | 
				
			||||||
 | 
								/**< Create a PPE port. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -371,6 +383,70 @@ nss_tx_status_t nss_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
nss_tx_status_t nss_if_reset_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num);
 | 
					nss_tx_status_t nss_if_reset_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_if_change_mtu
 | 
				
			||||||
 | 
					 *	Change the MTU of the interface.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ctx_instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
				
			||||||
 | 
					 * @param[in] if_num   NSS interface number.
 | 
				
			||||||
 | 
					 * @param[in] mtu      New MTU.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Status of the transmit operation.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					nss_tx_status_t nss_if_change_mtu(struct nss_ctx_instance *nss_ctx, nss_if_num_t if_num, uint16_t mtu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_if_change_mac_addr
 | 
				
			||||||
 | 
					 *	Change the MAC address of the interface.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ctx_instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
				
			||||||
 | 
					 * @param[in] if_num   NSS interface number.
 | 
				
			||||||
 | 
					 * @param[in] mac_addr New MAC address.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Status of the transmit operation.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					nss_tx_status_t nss_if_change_mac_addr(struct nss_ctx_instance *nss_ctx, nss_if_num_t if_num, uint8_t *mac_addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_if_vsi_unassign
 | 
				
			||||||
 | 
					 *	Detach the VSI ID from the given interface.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ctx_instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
				
			||||||
 | 
					 * @param[in] if_num   NSS interface number.
 | 
				
			||||||
 | 
					 * @param[in] vsi      VSI ID.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Status of the transmit operation.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					nss_tx_status_t nss_if_vsi_unassign(struct nss_ctx_instance *nss_ctx, nss_if_num_t if_num, uint32_t vsi);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_if_vsi_assign
 | 
				
			||||||
 | 
					 *	Attach the VSI ID to the given interface.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ctx_instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
				
			||||||
 | 
					 * @param[in] if_num   NSS interface number.
 | 
				
			||||||
 | 
					 * @param[in] vsi      VSI ID.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Status of the transmit operation.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					nss_tx_status_t nss_if_vsi_assign(struct nss_ctx_instance *nss_ctx, nss_if_num_t if_num, uint32_t vsi);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * 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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -106,6 +106,37 @@ enum nss_ipsec_cmn_ctx_type {
 | 
				
			|||||||
	NSS_IPSEC_CMN_CTX_TYPE_MAX
 | 
						NSS_IPSEC_CMN_CTX_TYPE_MAX
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipsec_cmn_stats_types
 | 
				
			||||||
 | 
					 *	IPsec common statistics types.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_ipsec_cmn_stats_types {
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_HEADROOM = NSS_STATS_NODE_MAX,
 | 
				
			||||||
 | 
											/**< Failure in headroom check. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_TAILROOM,	/**< Failure in tailroom check. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_REPLAY,	/**< Failure in anti-replay check. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_REPLAY_DUP,	/**< Failure in anti-replay; duplicate records. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_REPLAY_WIN,	/**< Failure in anti-replay; packet outside the window. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_PBUF_CRYPTO,	/**< Failure in crypto pbuf allocation. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_QUEUE,		/**< Failure due to queue full in IPsec. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_QUEUE_CRYPTO,	/**< Failure due to queue full in crypto. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_QUEUE_NEXTHOP,	/**< Failure due to queue full in next hop. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_PBUF_ALLOC,	/**< Failure in pbuf allocation. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_PBUF_LINEAR,	/**< Failure in pbuf linearization. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_PBUF_STATS,	/**< Failure in pbuf allocation for statistics. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_PBUF_ALIGN,	/**< Failure in pbuf access due to non-word alignmnt */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_CIPHER,	/**< Failure in decrypting the data. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_AUTH,		/**< Failure in authenticating the data. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_SEQ_OVF,	/**< Failure due to sequence number rollover. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_BLK_LEN,	/**< Failure in decapsulation due to bad cipher block length. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_HASH_LEN,	/**< Failure in decapsulation due to bad hash block length. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_TRANSFORM,	/**< Failure in transformation; general error. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_CRYPTO,	/**< Failure in crypto transformation. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_FAIL_CLE,		/**< Failure in classification; general failure. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_IS_STOPPED,		/**< Indicates if SA is stopped; for example: sequence overflow. */
 | 
				
			||||||
 | 
						NSS_IPSEC_CMN_STATS_MAX,		/**< Maximum statistics type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipsec_cmn_flow_tuple
 | 
					 * nss_ipsec_cmn_flow_tuple
 | 
				
			||||||
 *	IPsec tuple for creating flow entries.
 | 
					 *	IPsec tuple for creating flow entries.
 | 
				
			||||||
@@ -336,6 +367,16 @@ struct nss_ipsec_cmn_mdata {
 | 
				
			|||||||
	} data;						/**< Metadata payload. */
 | 
						} data;						/**< Metadata payload. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipsec_cmn_stats_notification
 | 
				
			||||||
 | 
					 *	IPsec common transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_ipsec_cmn_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_ctx[NSS_IPSEC_CMN_STATS_MAX];	/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;				/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;				/**< Interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipsec_cmn_msg
 | 
					 * nss_ipsec_cmn_msg
 | 
				
			||||||
 *	Message structure for NSS IPsec messages.
 | 
					 *	Message structure for NSS IPsec messages.
 | 
				
			||||||
@@ -424,6 +465,23 @@ extern struct nss_ctx_instance *nss_ipsec_cmn_get_context(void);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
extern uint32_t nss_ipsec_cmn_get_ifnum_with_coreid(int32_t ifnum);
 | 
					extern uint32_t nss_ipsec_cmn_get_ifnum_with_coreid(int32_t ifnum);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipsec_cmn_unregister_if
 | 
				
			||||||
 | 
					 *	Deregisters an IPSEC tunnel interface from the NSS.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] if_num  NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * None.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @dependencies
 | 
				
			||||||
 | 
					 * The tunnel interface must have been previously registered.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * True if successful, else false.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern bool nss_ipsec_cmn_unregister_if(uint32_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipsec_cmn_register_if
 | 
					 * nss_ipsec_cmn_register_if
 | 
				
			||||||
 *	Registers the IPsec interface with the NSS for sending and
 | 
					 *	Registers the IPsec interface with the NSS for sending and
 | 
				
			||||||
@@ -451,39 +509,6 @@ extern struct nss_ctx_instance *nss_ipsec_cmn_register_if(uint32_t if_num, struc
 | 
				
			|||||||
						nss_ipsec_cmn_msg_callback_t cb_msg,
 | 
											nss_ipsec_cmn_msg_callback_t cb_msg,
 | 
				
			||||||
						uint32_t features, enum nss_dynamic_interface_type type, void *app_data);
 | 
											uint32_t features, enum nss_dynamic_interface_type type, void *app_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipsec_cmn_unregister_if
 | 
					 | 
				
			||||||
 *	Deregisters a IPSEC tunnel interface from the NSS.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] if_num  NSS interface number.
 | 
					 | 
				
			||||||
. *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * None.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @dependencies
 | 
					 | 
				
			||||||
 * The tunnel interface must have been previously registered.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * True if successful, else false.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern bool nss_ipsec_cmn_unregister_if(uint32_t if_num);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_ipsec_cmn_notify_register
 | 
					 | 
				
			||||||
 *	Register an event callback to handle notification from IPsec firmware package.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * nss_ipsec_cmn_msg_callback_t \n
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] ifnum     NSS interface number.
 | 
					 | 
				
			||||||
 * @param[in] cb        Callback for IPsec message.
 | 
					 | 
				
			||||||
 * @param[in] app_data  Pointer to the application context.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * Pointer to NSS core context.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern struct nss_ctx_instance *nss_ipsec_cmn_notify_register(uint32_t ifnum, nss_ipsec_cmn_msg_callback_t cb, void *app_data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipsec_cmn_notify_unregister
 | 
					 * nss_ipsec_cmn_notify_unregister
 | 
				
			||||||
 *	Deregisters the message notifier from the HLOS driver.
 | 
					 *	Deregisters the message notifier from the HLOS driver.
 | 
				
			||||||
@@ -502,6 +527,22 @@ extern struct nss_ctx_instance *nss_ipsec_cmn_notify_register(uint32_t ifnum, ns
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
extern void nss_ipsec_cmn_notify_unregister(struct nss_ctx_instance *ctx, uint32_t if_num);
 | 
					extern void nss_ipsec_cmn_notify_unregister(struct nss_ctx_instance *ctx, uint32_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipsec_cmn_notify_register
 | 
				
			||||||
 | 
					 *	Registers an event callback to handle notifications from the IPsec firmware package.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ipsec_cmn_msg_callback_t \n
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] ifnum     NSS interface number.
 | 
				
			||||||
 | 
					 * @param[in] cb        Callback for IPsec message.
 | 
				
			||||||
 | 
					 * @param[in] app_data  Pointer to the application context.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Pointer to the NSS core context.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern struct nss_ctx_instance *nss_ipsec_cmn_notify_register(uint32_t ifnum, nss_ipsec_cmn_msg_callback_t cb, void *app_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipsec_cmn_msg_init
 | 
					 * nss_ipsec_cmn_msg_init
 | 
				
			||||||
 *	Initializes an IPsec message.
 | 
					 *	Initializes an IPsec message.
 | 
				
			||||||
@@ -615,6 +656,34 @@ extern bool nss_ipsec_cmn_ppe_port_config(struct nss_ctx_instance *ctx, struct n
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
bool nss_ipsec_cmn_ppe_mtu_update(struct nss_ctx_instance *ctx, uint32_t if_num, uint16_t mtu, uint16_t mru);
 | 
					bool nss_ipsec_cmn_ppe_mtu_update(struct nss_ctx_instance *ctx, uint32_t if_num, uint16_t mtu, uint16_t mru);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipsec_cmn_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_ipsec_cmn_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipsec_cmn_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_ipsec_cmn_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -31,6 +31,111 @@
 | 
				
			|||||||
 * @{
 | 
					 * @{
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * IPv4 connection flags (to be used with nss_ipv4_create::flags).
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define NSS_IPV4_CREATE_FLAG_NO_SEQ_CHECK 0x01
 | 
				
			||||||
 | 
							/**< Rule for not checking sequence numbers. */
 | 
				
			||||||
 | 
					#define NSS_IPV4_CREATE_FLAG_BRIDGE_FLOW 0x02
 | 
				
			||||||
 | 
							/**< Rule that indicates pure bridge flow (no routing is involved). */
 | 
				
			||||||
 | 
					#define NSS_IPV4_CREATE_FLAG_ROUTED 0x04	/**< Rule for a routed connection. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NSS_IPV4_CREATE_FLAG_DSCP_MARKING 0x08	/**< Rule for DSCP marking. */
 | 
				
			||||||
 | 
					#define NSS_IPV4_CREATE_FLAG_VLAN_MARKING 0x10	/**< Rule for VLAN marking. */
 | 
				
			||||||
 | 
					#define NSS_IPV4_CREATE_FLAG_QOS_VALID 0x20	/**< Rule for QoS is valid. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipv4_create
 | 
				
			||||||
 | 
					 *	Information for an IPv4 flow or connection create rule.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * All fields must be passed in host-endian order.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_ipv4_create {
 | 
				
			||||||
 | 
						int32_t src_interface_num;
 | 
				
			||||||
 | 
									/**< Source interface number (virtual or physical). */
 | 
				
			||||||
 | 
						int32_t dest_interface_num;
 | 
				
			||||||
 | 
									/**< Destination interface number (virtual or physical). */
 | 
				
			||||||
 | 
						int32_t protocol;	/**< L4 protocol (e.g., TCP or UDP). */
 | 
				
			||||||
 | 
						uint32_t flags;		/**< Flags (if any) associated with this rule. */
 | 
				
			||||||
 | 
						uint32_t from_mtu;	/**< MTU of the incoming interface. */
 | 
				
			||||||
 | 
						uint32_t to_mtu;	/**< MTU of the outgoing interface. */
 | 
				
			||||||
 | 
						uint32_t src_ip;	/**< Source IP address. */
 | 
				
			||||||
 | 
						int32_t src_port;	/**< Source L4 port (e.g., TCP or UDP port). */
 | 
				
			||||||
 | 
						uint32_t src_ip_xlate;	/**< Translated source IP address (used with SNAT). */
 | 
				
			||||||
 | 
						int32_t src_port_xlate;	/**< Translated source L4 port (used with SNAT). */
 | 
				
			||||||
 | 
						uint32_t dest_ip;	/**< Destination IP address. */
 | 
				
			||||||
 | 
						int32_t dest_port;	/**< Destination L4 port (e.g., TCP or UDP port). */
 | 
				
			||||||
 | 
						uint32_t dest_ip_xlate;
 | 
				
			||||||
 | 
								/**< Translated destination IP address (used with DNAT). */
 | 
				
			||||||
 | 
						int32_t dest_port_xlate;
 | 
				
			||||||
 | 
								/**< Translated destination L4 port (used with DNAT). */
 | 
				
			||||||
 | 
						uint8_t src_mac[ETH_ALEN];
 | 
				
			||||||
 | 
								/**< Source MAC address. */
 | 
				
			||||||
 | 
						uint8_t dest_mac[ETH_ALEN];
 | 
				
			||||||
 | 
								/**< Destination MAC address. */
 | 
				
			||||||
 | 
						uint8_t src_mac_xlate[ETH_ALEN];
 | 
				
			||||||
 | 
								/**< Translated source MAC address (post-routing). */
 | 
				
			||||||
 | 
						uint8_t dest_mac_xlate[ETH_ALEN];
 | 
				
			||||||
 | 
								/**< Translated destination MAC address (post-routing). */
 | 
				
			||||||
 | 
						uint8_t flow_window_scale;	/**< Window scaling factor (TCP). */
 | 
				
			||||||
 | 
						uint32_t flow_max_window;	/**< Maximum window size (TCP). */
 | 
				
			||||||
 | 
						uint32_t flow_end;		/**< TCP window end. */
 | 
				
			||||||
 | 
						uint32_t flow_max_end;		/**< TCP window maximum end. */
 | 
				
			||||||
 | 
						uint32_t flow_pppoe_if_exist;
 | 
				
			||||||
 | 
								/**< Flow direction: PPPoE interface exist flag. */
 | 
				
			||||||
 | 
						int32_t flow_pppoe_if_num;
 | 
				
			||||||
 | 
								/**< Flow direction: PPPoE interface number. */
 | 
				
			||||||
 | 
						uint16_t ingress_vlan_tag;	/**< Ingress VLAN tag expected for this flow. */
 | 
				
			||||||
 | 
						uint8_t return_window_scale;
 | 
				
			||||||
 | 
								/**< Window scaling factor of the return direction (TCP). */
 | 
				
			||||||
 | 
						uint32_t return_max_window;
 | 
				
			||||||
 | 
								/**< Maximum window size of the return direction. */
 | 
				
			||||||
 | 
						uint32_t return_end;
 | 
				
			||||||
 | 
								/**< Flow end for the return direction. */
 | 
				
			||||||
 | 
						uint32_t return_max_end;
 | 
				
			||||||
 | 
								/**< Flow maximum end for the return direction. */
 | 
				
			||||||
 | 
						uint32_t return_pppoe_if_exist;
 | 
				
			||||||
 | 
								/**< Return direction: PPPoE interface existence flag. */
 | 
				
			||||||
 | 
						int32_t return_pppoe_if_num;
 | 
				
			||||||
 | 
								/**< Return direction: PPPoE interface number. */
 | 
				
			||||||
 | 
						uint16_t egress_vlan_tag;	/**< Egress VLAN tag expected for this flow. */
 | 
				
			||||||
 | 
						uint8_t spo_needed;		/**< Indicates whether SPO is required. */
 | 
				
			||||||
 | 
						uint32_t param_a0;		/**< Custom parameter 0. */
 | 
				
			||||||
 | 
						uint32_t param_a1;		/**< Custom parameter 1. */
 | 
				
			||||||
 | 
						uint32_t param_a2;		/**< Custom parameter 2. */
 | 
				
			||||||
 | 
						uint32_t param_a3;		/**< Custom parameter 3. */
 | 
				
			||||||
 | 
						uint32_t param_a4;		/**< Custom parameter 4. */
 | 
				
			||||||
 | 
						uint32_t qos_tag;		/**< Deprecated, will be removed soon. */
 | 
				
			||||||
 | 
						uint32_t flow_qos_tag;		/**< QoS tag value for the flow direction. */
 | 
				
			||||||
 | 
						uint32_t return_qos_tag;	/**< QoS tag value for the return direction. */
 | 
				
			||||||
 | 
						uint8_t dscp_itag;		/**< DSCP marking tag. */
 | 
				
			||||||
 | 
						uint8_t dscp_imask;		/**< DSCP marking input mask. */
 | 
				
			||||||
 | 
						uint8_t dscp_omask;		/**< DSCP marking output mask. */
 | 
				
			||||||
 | 
						uint8_t dscp_oval;		/**< DSCP marking output value. */
 | 
				
			||||||
 | 
						uint16_t vlan_itag;		/**< VLAN marking tag. */
 | 
				
			||||||
 | 
						uint16_t vlan_imask;		/**< VLAN marking input mask. */
 | 
				
			||||||
 | 
						uint16_t vlan_omask;		/**< VLAN marking output mask. */
 | 
				
			||||||
 | 
						uint16_t vlan_oval;		/**< VLAN marking output value. */
 | 
				
			||||||
 | 
						uint32_t in_vlan_tag[MAX_VLAN_DEPTH];
 | 
				
			||||||
 | 
								/**< Ingress VLAN tag expected for this flow. */
 | 
				
			||||||
 | 
						uint32_t out_vlan_tag[MAX_VLAN_DEPTH];
 | 
				
			||||||
 | 
								/**< Egress VLAN tag expected for this flow. */
 | 
				
			||||||
 | 
						uint8_t flow_dscp;		/**< IP DSCP value for the flow direction. */
 | 
				
			||||||
 | 
						uint8_t return_dscp;		/**< IP DSCP value for the return direction. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipv4_destroy
 | 
				
			||||||
 | 
					 *	Information for an IPv4 flow or connection destroy rule.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_ipv4_destroy {
 | 
				
			||||||
 | 
						int32_t protocol;	/**< L4 protocol ID. */
 | 
				
			||||||
 | 
						uint32_t src_ip;	/**< Source IP address. */
 | 
				
			||||||
 | 
						int32_t src_port;	/**< Source L4 port (e.g., TCP or UDP port). */
 | 
				
			||||||
 | 
						uint32_t dest_ip;	/**< Destination IP address. */
 | 
				
			||||||
 | 
						int32_t dest_port;	/**< Destination L4 port (e.g., TCP or UDP port). */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipv4_message_types
 | 
					 * nss_ipv4_message_types
 | 
				
			||||||
 *	IPv4 bridge and routing rule message types.
 | 
					 *	IPv4 bridge and routing rule message types.
 | 
				
			||||||
@@ -111,6 +216,12 @@ enum nss_ipv4_stats_types {
 | 
				
			|||||||
		/**< Number of IPv4 multicast connection destroy requests that missed the cache. */
 | 
							/**< Number of IPv4 multicast connection destroy requests that missed the cache. */
 | 
				
			||||||
	NSS_IPV4_STATS_MC_CONNECTION_FLUSHES,
 | 
						NSS_IPV4_STATS_MC_CONNECTION_FLUSHES,
 | 
				
			||||||
		/**< Number of IPv4 multicast connection flushes. */
 | 
							/**< Number of IPv4 multicast connection flushes. */
 | 
				
			||||||
 | 
						NSS_IPV4_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFNUM,
 | 
				
			||||||
 | 
							/**< Number of IPv4 mirror connection requests with an invalid interface number. */
 | 
				
			||||||
 | 
						NSS_IPV4_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFTYPE,
 | 
				
			||||||
 | 
							/**< Number of IPv4 mirror connection requests with an invalid interface type. */
 | 
				
			||||||
 | 
						NSS_IPV4_STATS_MIRROR_FAILURES,
 | 
				
			||||||
 | 
							/**< Number of IPv4 mirror failures. */
 | 
				
			||||||
	NSS_IPV4_STATS_MAX,
 | 
						NSS_IPV4_STATS_MAX,
 | 
				
			||||||
		/**< Maximum message type. */
 | 
							/**< Maximum message type. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -175,6 +286,7 @@ enum nss_ipv4_stats_types {
 | 
				
			|||||||
		/**< Ingress shaping fields are valid. */
 | 
							/**< Ingress shaping fields are valid. */
 | 
				
			||||||
#define NSS_IPV4_RULE_CREATE_IDENTIFIER_VALID 0x1000
 | 
					#define NSS_IPV4_RULE_CREATE_IDENTIFIER_VALID 0x1000
 | 
				
			||||||
		/**< Identifier is valid. */
 | 
							/**< Identifier is valid. */
 | 
				
			||||||
 | 
					#define NSS_IPV4_RULE_CREATE_MIRROR_VALID 0x2000	/**< Mirror fields are valid. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Multicast command rule flags
 | 
					 * Multicast command rule flags
 | 
				
			||||||
@@ -237,6 +349,15 @@ enum nss_ipv4_stats_types {
 | 
				
			|||||||
#define NSS_IPV4_RETURN_IDENTIFIER_VALID 0x02
 | 
					#define NSS_IPV4_RETURN_IDENTIFIER_VALID 0x02
 | 
				
			||||||
		/**< Identifier for return direction is valid. */
 | 
							/**< Identifier for return direction is valid. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Mirror valid flags (to be used with the valid field of nss_ipv4_mirror_rule structure)
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define NSS_IPV4_MIRROR_FLOW_VALID 0x01
 | 
				
			||||||
 | 
							/**< Mirror interface number for the flow direction is valid. */
 | 
				
			||||||
 | 
					#define NSS_IPV4_MIRROR_RETURN_VALID 0x02
 | 
				
			||||||
 | 
							/**< Mirror interface number for the return direction is valid. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipv4_5tuple
 | 
					 * nss_ipv4_5tuple
 | 
				
			||||||
 *	Common 5-tuple information.
 | 
					 *	Common 5-tuple information.
 | 
				
			||||||
@@ -410,6 +531,16 @@ struct nss_ipv4_identifier_rule {
 | 
				
			|||||||
		/**< Identifier for return direction. */
 | 
							/**< Identifier for return direction. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipv4_mirror_rule
 | 
				
			||||||
 | 
					 *	Mirror rule structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_ipv4_mirror_rule {
 | 
				
			||||||
 | 
						uint32_t valid;			/**< Mirror validity flags. */
 | 
				
			||||||
 | 
						nss_if_num_t flow_ifnum;	/**< Flow mirror interface number. */
 | 
				
			||||||
 | 
						nss_if_num_t return_ifnum;	/**< Return mirror interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipv4_error_response_types
 | 
					 * nss_ipv4_error_response_types
 | 
				
			||||||
 *	Error types for IPv4 messages.
 | 
					 *	Error types for IPv4 messages.
 | 
				
			||||||
@@ -478,6 +609,8 @@ struct nss_ipv4_rule_create_msg {
 | 
				
			|||||||
			/**< Ingress shaping related accleration parameters. */
 | 
								/**< Ingress shaping related accleration parameters. */
 | 
				
			||||||
	struct nss_ipv4_identifier_rule identifier;
 | 
						struct nss_ipv4_identifier_rule identifier;
 | 
				
			||||||
			/**< Rule for adding identifier. */
 | 
								/**< Rule for adding identifier. */
 | 
				
			||||||
 | 
						struct nss_ipv4_mirror_rule mirror_rule;
 | 
				
			||||||
 | 
								/**< Mirror rule parameter. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -821,6 +954,16 @@ struct nss_ipv4_node_sync {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	uint32_t ipv4_mc_connection_flushes;
 | 
						uint32_t ipv4_mc_connection_flushes;
 | 
				
			||||||
			/**< Number of multicast connection flushes. */
 | 
								/**< Number of multicast connection flushes. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uint32_t ipv4_connection_create_invalid_mirror_ifnum;
 | 
				
			||||||
 | 
								/**< Number of create request failed with an invalid mirror interface number. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uint32_t ipv4_connection_create_invalid_mirror_iftype;
 | 
				
			||||||
 | 
								/**< Number of create request failed with an invalid mirror interface type. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uint32_t ipv4_mirror_failures;
 | 
				
			||||||
 | 
								/**< Mirror packet failed. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t exception_events[NSS_IPV4_EXCEPTION_EVENT_MAX];
 | 
						uint32_t exception_events[NSS_IPV4_EXCEPTION_EVENT_MAX];
 | 
				
			||||||
			/**< Number of exception events. */
 | 
								/**< Number of exception events. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -27,6 +27,125 @@
 | 
				
			|||||||
 * @{
 | 
					 * @{
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Converts the format of an IPv6 address from Linux to NSS. @hideinitializer
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define IN6_ADDR_TO_IPV6_ADDR(ipv6, in6) \
 | 
				
			||||||
 | 
						{ \
 | 
				
			||||||
 | 
							((uint32_t *)ipv6)[0] = in6.in6_u.u6_addr32[0]; \
 | 
				
			||||||
 | 
							((uint32_t *)ipv6)[1] = in6.in6_u.u6_addr32[1]; \
 | 
				
			||||||
 | 
							((uint32_t *)ipv6)[2] = in6.in6_u.u6_addr32[2]; \
 | 
				
			||||||
 | 
							((uint32_t *)ipv6)[3] = in6.in6_u.u6_addr32[3]; \
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Converts the format of an IPv6 address from NSS to Linux. @hideinitializer
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define IPV6_ADDR_TO_IN6_ADDR(in6, ipv6) \
 | 
				
			||||||
 | 
						{ \
 | 
				
			||||||
 | 
							in6.in6_u.u6_addr32[0] = ((uint32_t *)ipv6)[0]; \
 | 
				
			||||||
 | 
							in6.in6_u.u6_addr32[1] = ((uint32_t *)ipv6)[1]; \
 | 
				
			||||||
 | 
							in6.in6_u.u6_addr32[2] = ((uint32_t *)ipv6)[2]; \
 | 
				
			||||||
 | 
							in6.in6_u.u6_addr32[3] = ((uint32_t *)ipv6)[3]; \
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Format of an IPv6 address (16 * 8 bits).
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define IPV6_ADDR_OCTAL_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Prints an IPv6 address (16 * 8 bits).
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define IPV6_ADDR_TO_OCTAL(ipv6) ((uint16_t *)ipv6)[0], ((uint16_t *)ipv6)[1], ((uint16_t *)ipv6)[2], ((uint16_t *)ipv6)[3], ((uint16_t *)ipv6)[4], ((uint16_t *)ipv6)[5], ((uint16_t *)ipv6)[6], ((uint16_t *)ipv6)[7]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * IPv6 connection flags (to be used with nss_ipv6_create::flags.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define NSS_IPV6_CREATE_FLAG_NO_SEQ_CHECK 0x1
 | 
				
			||||||
 | 
							/**< Indicates that sequence numbers are not to be checked. */
 | 
				
			||||||
 | 
					#define NSS_IPV6_CREATE_FLAG_BRIDGE_FLOW 0x02
 | 
				
			||||||
 | 
							/**< Indicates that this is a pure bridge flow (no routing is involved). */
 | 
				
			||||||
 | 
					#define NSS_IPV6_CREATE_FLAG_ROUTED 0x04	/**< Rule is for a routed connection. */
 | 
				
			||||||
 | 
					#define NSS_IPV6_CREATE_FLAG_DSCP_MARKING 0x08	/**< Rule for DSCP marking. */
 | 
				
			||||||
 | 
					#define NSS_IPV6_CREATE_FLAG_VLAN_MARKING 0x10	/**< Rule for VLAN marking. */
 | 
				
			||||||
 | 
					#define NSS_IPV6_CREATE_FLAG_QOS_VALID 0x20	/**< Rule for Valid QoS. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipv6_create
 | 
				
			||||||
 | 
					 *	Information for an IPv6 flow or connection create rule.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * All fields must be passed in host-endian order.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_ipv6_create {
 | 
				
			||||||
 | 
						int32_t src_interface_num;
 | 
				
			||||||
 | 
								/**< Source interface number (virtual or physical). */
 | 
				
			||||||
 | 
						int32_t dest_interface_num;
 | 
				
			||||||
 | 
								/**< Destination interface number (virtual or physical). */
 | 
				
			||||||
 | 
						int32_t protocol;	/**< L4 protocol (e.g., TCP or UDP). */
 | 
				
			||||||
 | 
						uint32_t flags;		/**< Flags (if any) associated with this rule. */
 | 
				
			||||||
 | 
						uint32_t from_mtu;	/**< MTU of the incoming interface. */
 | 
				
			||||||
 | 
						uint32_t to_mtu;	/**< MTU of the outgoing interface. */
 | 
				
			||||||
 | 
						uint32_t src_ip[4];	/**< Source IP address. */
 | 
				
			||||||
 | 
						int32_t src_port;	/**< Source L4 port (e.g., TCP or UDP port). */
 | 
				
			||||||
 | 
						uint32_t dest_ip[4];	/**< Destination IP address. */
 | 
				
			||||||
 | 
						int32_t dest_port;	/**< Destination L4 port (e.g., TCP or UDP port). */
 | 
				
			||||||
 | 
						uint8_t src_mac[ETH_ALEN];	/**< Source MAC address. */
 | 
				
			||||||
 | 
						uint8_t dest_mac[ETH_ALEN];	/**< Destination MAC address. */
 | 
				
			||||||
 | 
						uint8_t flow_window_scale;	/**< Window scaling factor (TCP). */
 | 
				
			||||||
 | 
						uint32_t flow_max_window;	/**< Maximum window size (TCP). */
 | 
				
			||||||
 | 
						uint32_t flow_end;		/**< TCP window end. */
 | 
				
			||||||
 | 
						uint32_t flow_max_end;		/**< TCP window maximum end. */
 | 
				
			||||||
 | 
						uint32_t flow_pppoe_if_exist;
 | 
				
			||||||
 | 
								/**< Flow direction: PPPoE interface existence flag. */
 | 
				
			||||||
 | 
						int32_t flow_pppoe_if_num;
 | 
				
			||||||
 | 
								/**< Flow direction: PPPoE interface number. */
 | 
				
			||||||
 | 
						uint16_t ingress_vlan_tag;
 | 
				
			||||||
 | 
								/**< Ingress VLAN tag expected for this flow. */
 | 
				
			||||||
 | 
						uint8_t return_window_scale;
 | 
				
			||||||
 | 
								/**< Window scaling factor (TCP) for the return direction. */
 | 
				
			||||||
 | 
						uint32_t return_max_window;
 | 
				
			||||||
 | 
								/**< Maximum window size (TCP) for the return direction. */
 | 
				
			||||||
 | 
						uint32_t return_end;
 | 
				
			||||||
 | 
								/**< End for the return direction. */
 | 
				
			||||||
 | 
						uint32_t return_max_end;
 | 
				
			||||||
 | 
								/**< Maximum end for the return direction. */
 | 
				
			||||||
 | 
						uint32_t return_pppoe_if_exist;
 | 
				
			||||||
 | 
								/**< Return direction: PPPoE interface exist flag. */
 | 
				
			||||||
 | 
						int32_t return_pppoe_if_num;
 | 
				
			||||||
 | 
								/**< Return direction: PPPoE interface number. */
 | 
				
			||||||
 | 
						uint16_t egress_vlan_tag;	/**< Egress VLAN tag expected for this flow. */
 | 
				
			||||||
 | 
						uint32_t qos_tag;		/**< Deprecated; will be removed soon. */
 | 
				
			||||||
 | 
						uint32_t flow_qos_tag;		/**< QoS tag value for flow direction. */
 | 
				
			||||||
 | 
						uint32_t return_qos_tag;	/**< QoS tag value for the return direction. */
 | 
				
			||||||
 | 
						uint8_t dscp_itag;		/**< DSCP marking tag. */
 | 
				
			||||||
 | 
						uint8_t dscp_imask;		/**< DSCP marking input mask. */
 | 
				
			||||||
 | 
						uint8_t dscp_omask;		/**< DSCP marking output mask. */
 | 
				
			||||||
 | 
						uint8_t dscp_oval;		/**< DSCP marking output value. */
 | 
				
			||||||
 | 
						uint16_t vlan_itag;		/**< VLAN marking tag. */
 | 
				
			||||||
 | 
						uint16_t vlan_imask;		/**< VLAN marking input mask. */
 | 
				
			||||||
 | 
						uint16_t vlan_omask;		/**< VLAN marking output mask. */
 | 
				
			||||||
 | 
						uint16_t vlan_oval;		/**< VLAN marking output value. */
 | 
				
			||||||
 | 
						uint32_t in_vlan_tag[MAX_VLAN_DEPTH];
 | 
				
			||||||
 | 
										/**< Ingress VLAN tag expected for this flow. */
 | 
				
			||||||
 | 
						uint32_t out_vlan_tag[MAX_VLAN_DEPTH];
 | 
				
			||||||
 | 
										/**< Egress VLAN tag expected for this flow. */
 | 
				
			||||||
 | 
						uint8_t flow_dscp;		/**< IP DSCP value for flow direction. */
 | 
				
			||||||
 | 
						uint8_t return_dscp;		/**< IP DSCP value for the return direction. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipv6_destroy
 | 
				
			||||||
 | 
					 *	Information for an IPv6 flow or connection destroy rule.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_ipv6_destroy {
 | 
				
			||||||
 | 
						int32_t protocol;	/**< L4 protocol (e.g., TCP or UDP). */
 | 
				
			||||||
 | 
						uint32_t src_ip[4];	/**< Source IP address. */
 | 
				
			||||||
 | 
						int32_t src_port;	/**< Source L4 port (e.g., TCP or UDP port). */
 | 
				
			||||||
 | 
						uint32_t dest_ip[4];	/**< Destination IP address. */
 | 
				
			||||||
 | 
						int32_t dest_port;	/**< Destination L4 port (e.g., TCP or UDP port). */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipv6_stats_types
 | 
					 * nss_ipv6_stats_types
 | 
				
			||||||
 *	IPv6 node statistics.
 | 
					 *	IPv6 node statistics.
 | 
				
			||||||
@@ -76,6 +195,14 @@ enum nss_ipv6_stats_types {
 | 
				
			|||||||
					/**< Number of IPv6 multicast connection destroy requests that missed the cache. */
 | 
										/**< Number of IPv6 multicast connection destroy requests that missed the cache. */
 | 
				
			||||||
	NSS_IPV6_STATS_MC_CONNECTION_FLUSHES,
 | 
						NSS_IPV6_STATS_MC_CONNECTION_FLUSHES,
 | 
				
			||||||
					/**< Number of IPv6 multicast connection flushes. */
 | 
										/**< Number of IPv6 multicast connection flushes. */
 | 
				
			||||||
 | 
						NSS_IPV6_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFNUM,
 | 
				
			||||||
 | 
							/**< Number of IPv6 mirror connection requests with an invalid interface number. */
 | 
				
			||||||
 | 
						NSS_IPV6_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFTYPE,
 | 
				
			||||||
 | 
							/**< Number of IPv6 mirror connection requests with an invalid interface type. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						NSS_IPV6_STATS_MIRROR_FAILURES,
 | 
				
			||||||
 | 
							/**< Number of IPv6 mirror failures. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	NSS_IPV6_STATS_MAX,
 | 
						NSS_IPV6_STATS_MAX,
 | 
				
			||||||
					/**< Maximum message type. */
 | 
										/**< Maximum message type. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -169,6 +296,7 @@ enum nss_ipv6_dscp_map_actions {
 | 
				
			|||||||
		/**< Destination MAC address fields are valid. */
 | 
							/**< Destination MAC address fields are valid. */
 | 
				
			||||||
#define NSS_IPV6_RULE_CREATE_IGS_VALID 0x800	/**< Ingress shaping fields are valid. */
 | 
					#define NSS_IPV6_RULE_CREATE_IGS_VALID 0x800	/**< Ingress shaping fields are valid. */
 | 
				
			||||||
#define NSS_IPV6_RULE_CREATE_IDENTIFIER_VALID 0x1000	/**< Identifier is valid. */
 | 
					#define NSS_IPV6_RULE_CREATE_IDENTIFIER_VALID 0x1000	/**< Identifier is valid. */
 | 
				
			||||||
 | 
					#define NSS_IPV6_RULE_CREATE_MIRROR_VALID 0x2000	/**< Mirror fields are valid. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Multicast command rule flags
 | 
					 * Multicast command rule flags
 | 
				
			||||||
@@ -229,6 +357,14 @@ enum nss_ipv6_dscp_map_actions {
 | 
				
			|||||||
#define NSS_IPV6_RETURN_IDENTIFIER_VALID 0x02
 | 
					#define NSS_IPV6_RETURN_IDENTIFIER_VALID 0x02
 | 
				
			||||||
		/**< Identifier for return direction is valid. */
 | 
							/**< Identifier for return direction is valid. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Mirror valid flags (to be used with the valid field of nss_ipv6_mirror_rule structure)
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define NSS_IPV6_MIRROR_FLOW_VALID 0x01
 | 
				
			||||||
 | 
							/**< Mirror interface number for the flow direction is valid. */
 | 
				
			||||||
 | 
					#define NSS_IPV6_MIRROR_RETURN_VALID 0x02
 | 
				
			||||||
 | 
							/**< Mirror interface number for the return direction is valid. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipv6_exception_events
 | 
					 * nss_ipv6_exception_events
 | 
				
			||||||
 *	Exception events from an IPv6 bridge or route handler.
 | 
					 *	Exception events from an IPv6 bridge or route handler.
 | 
				
			||||||
@@ -460,6 +596,16 @@ struct nss_ipv6_identifier_rule {
 | 
				
			|||||||
		/**< Identifier for return direction. */
 | 
							/**< Identifier for return direction. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ipv6_mirror_rule
 | 
				
			||||||
 | 
					 *	Mirror rule structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_ipv6_mirror_rule {
 | 
				
			||||||
 | 
						uint32_t valid;			/**< Mirror validity flags. */
 | 
				
			||||||
 | 
						nss_if_num_t flow_ifnum;	/**< Flow mirror interface number. */
 | 
				
			||||||
 | 
						nss_if_num_t return_ifnum;	/**< Return mirror interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_ipv6_error_response_types
 | 
					 * nss_ipv6_error_response_types
 | 
				
			||||||
 *	Error types for IPv6 messages.
 | 
					 *	Error types for IPv6 messages.
 | 
				
			||||||
@@ -556,6 +702,8 @@ struct nss_ipv6_rule_create_msg {
 | 
				
			|||||||
			/**< Ingress shaping related accleration parameters. */
 | 
								/**< Ingress shaping related accleration parameters. */
 | 
				
			||||||
	struct nss_ipv6_identifier_rule identifier;
 | 
						struct nss_ipv6_identifier_rule identifier;
 | 
				
			||||||
			/**< Rule for adding identifier. */
 | 
								/**< Rule for adding identifier. */
 | 
				
			||||||
 | 
						struct nss_ipv6_mirror_rule mirror_rule;
 | 
				
			||||||
 | 
								/**< Mirror rule parameter. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -801,6 +949,16 @@ struct nss_ipv6_node_sync {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	uint32_t ipv6_mc_connection_flushes;
 | 
						uint32_t ipv6_mc_connection_flushes;
 | 
				
			||||||
			/**< Number of multicast connection flushes. */
 | 
								/**< Number of multicast connection flushes. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uint32_t ipv6_connection_create_invalid_mirror_ifnum;
 | 
				
			||||||
 | 
								/**< Number of create request failed with an invalid mirror interface number. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uint32_t ipv6_connection_create_invalid_mirror_iftype;
 | 
				
			||||||
 | 
								/**< Number of create request failed with an invalid mirror interface type. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uint32_t ipv6_mirror_failures;
 | 
				
			||||||
 | 
								/**< Mirror packet failed. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t exception_events[NSS_IPV6_EXCEPTION_EVENT_MAX];
 | 
						uint32_t exception_events[NSS_IPV6_EXCEPTION_EVENT_MAX];
 | 
				
			||||||
			/**< Number of exception events. */
 | 
								/**< Number of exception events. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -36,6 +36,16 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
#define NSS_MAX_MAP_T_DYNAMIC_INTERFACES 4
 | 
					#define NSS_MAX_MAP_T_DYNAMIC_INTERFACES 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NSS_MAPT_MDATA_FLAG_DF_BIT  (1 << 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * mapt meta data
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_map_t_mdata {
 | 
				
			||||||
 | 
						uint16_t flags;
 | 
				
			||||||
 | 
						uint16_t res[6];
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_map_t_msg_types
 | 
					 * nss_map_t_msg_types
 | 
				
			||||||
 *	Message types for MAP-T requests and responses.
 | 
					 *	Message types for MAP-T requests and responses.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
@@ -78,6 +78,20 @@ enum nss_mirror_error_type {
 | 
				
			|||||||
	NSS_MIRROR_ERROR_TYPE_MAX,			/**< Maximum message type. */
 | 
						NSS_MIRROR_ERROR_TYPE_MAX,			/**< Maximum message type. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_mirror_stats
 | 
				
			||||||
 | 
					 *	Mirror interface debug statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_mirror_stats {
 | 
				
			||||||
 | 
						NSS_MIRROR_STATS_PKTS,			/**< Number of packets exceptioned to host. */
 | 
				
			||||||
 | 
						NSS_MIRROR_STATS_BYTES,			/**< Number of bytes exceptioned to host. */
 | 
				
			||||||
 | 
						NSS_MIRROR_STATS_TX_SEND_FAIL,		/**< Transmit send failures. */
 | 
				
			||||||
 | 
						NSS_MIRROR_STATS_DEST_LOOKUP_FAIL,	/**< Destination lookup failures. */
 | 
				
			||||||
 | 
						NSS_MIRROR_STATS_MEM_ALLOC_FAIL,	/**< Memory allocation failures. */
 | 
				
			||||||
 | 
						NSS_MIRROR_STATS_COPY_FAIL,		/**< Copy failures. */
 | 
				
			||||||
 | 
						NSS_MIRROR_STATS_MAX			/**< Maximum statistics count. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_mirror_configure_msg
 | 
					 * nss_mirror_configure_msg
 | 
				
			||||||
 *	Mirror interface configuration information.
 | 
					 *	Mirror interface configuration information.
 | 
				
			||||||
@@ -119,6 +133,16 @@ struct nss_mirror_stats_sync_msg {
 | 
				
			|||||||
	struct nss_mirror_node_stats mirror_stats;	/**< Debug statistics for mirror. */
 | 
						struct nss_mirror_node_stats mirror_stats;	/**< Debug statistics for mirror. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_mirror_stats_notification
 | 
				
			||||||
 | 
					 *	Mirror transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_mirror_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_ctx[NSS_MIRROR_STATS_MAX];	/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;				/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;				/**< Interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_mirror_msg
 | 
					 * nss_mirror_msg
 | 
				
			||||||
 *	Data for sending and receiving mirror interface messages.
 | 
					 *	Data for sending and receiving mirror interface messages.
 | 
				
			||||||
@@ -205,6 +229,17 @@ extern nss_tx_status_t nss_mirror_tx_msg(struct nss_ctx_instance *nss_ctx, struc
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
extern nss_tx_status_t nss_mirror_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_mirror_msg *msg);
 | 
					extern nss_tx_status_t nss_mirror_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_mirror_msg *msg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_mirror_unregister_if
 | 
				
			||||||
 | 
					 *	Deregisters a mirror interface from the NSS.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] if_num  NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * None.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern void nss_mirror_unregister_if(uint32_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_mirror_register_if
 | 
					 * nss_mirror_register_if
 | 
				
			||||||
 *	Registers a mirror interface with the NSS for sending and receiving messages.
 | 
					 *	Registers a mirror interface with the NSS for sending and receiving messages.
 | 
				
			||||||
@@ -228,17 +263,6 @@ extern struct nss_ctx_instance *nss_mirror_register_if(uint32_t if_num,
 | 
				
			|||||||
		nss_mirror_msg_callback_t event_callback,
 | 
							nss_mirror_msg_callback_t event_callback,
 | 
				
			||||||
		struct net_device *netdev, uint32_t features);
 | 
							struct net_device *netdev, uint32_t features);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_mirror_unregister_if
 | 
					 | 
				
			||||||
 *	Deregisters a mirror interface from the NSS.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] if_num  NSS interface number.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * None.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern void nss_mirror_unregister_if(uint32_t if_num);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_mirror_verify_if_num
 | 
					 * nss_mirror_verify_if_num
 | 
				
			||||||
 *	Verify whether the interface is an mirror interface or not.
 | 
					 *	Verify whether the interface is an mirror interface or not.
 | 
				
			||||||
@@ -259,6 +283,34 @@ extern bool nss_mirror_verify_if_num(uint32_t if_num);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
extern void nss_mirror_register_handler(void);
 | 
					extern void nss_mirror_register_handler(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_mirror_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_mirror_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_mirror_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_mirror_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2016-2018, 2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2016-2018, 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -22,6 +22,8 @@
 | 
				
			|||||||
#ifndef _NSS_PPE_H_
 | 
					#ifndef _NSS_PPE_H_
 | 
				
			||||||
#define _NSS_PPE_H_
 | 
					#define _NSS_PPE_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef int32_t nss_ppe_port_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @addtogroup nss_ppe_subsystem
 | 
					 * @addtogroup nss_ppe_subsystem
 | 
				
			||||||
 * @{
 | 
					 * @{
 | 
				
			||||||
@@ -56,6 +58,34 @@ enum nss_ppe_sc_type {
 | 
				
			|||||||
	NSS_PPE_SC_MAX,			/**< Maximum service code. */
 | 
						NSS_PPE_SC_MAX,			/**< Maximum service code. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ppe_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_ppe_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ppe_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_ppe_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** @} */ /* end_addtogroup nss_ppe_subsystem */
 | 
					/** @} */ /* end_addtogroup nss_ppe_subsystem */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* _NSS_PPE_H_ */
 | 
					#endif /* _NSS_PPE_H_ */
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										79
									
								
								feeds/ipq807x/qca-nss-drv/src/exports/nss_ppe_vp.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								feeds/ipq807x/qca-nss-drv/src/exports/nss_ppe_vp.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,79 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 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.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file nss_ppe_vp.h
 | 
				
			||||||
 | 
					 *	NSS PPE Virtual Port definitions.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef _NSS_PPE_VP_H_
 | 
				
			||||||
 | 
					#define _NSS_PPE_VP_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_if_ppe_vp_destroy
 | 
				
			||||||
 | 
					 *	Destroy the PPE VP for a given NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ctx_instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
				
			||||||
 | 
					 * @param[in] if_num   NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Status of the Tx operation.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					nss_tx_status_t nss_ppe_vp_destroy(struct nss_ctx_instance *nss_ctx, nss_if_num_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ppe_vp_create
 | 
				
			||||||
 | 
					 *	Create the PPE VP for a given NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ctx_instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
				
			||||||
 | 
					 * @param[in] if_num   NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Status of the Tx operation.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					nss_tx_status_t nss_ppe_vp_create(struct nss_ctx_instance *nss_ctx, nss_if_num_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ppe_vp_get_ppe_port_by_nssif
 | 
				
			||||||
 | 
					 *	Returns the PPE VP number for a given NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
				
			||||||
 | 
					 * @param[in] nss_if  NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Returns the PPE VP number corresponding to the NSS interface number.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					nss_ppe_port_t nss_ppe_vp_get_ppe_port_by_nssif(struct nss_ctx_instance *nss_ctx, nss_if_num_t nss_if);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_ppe_vp_get_context
 | 
				
			||||||
 | 
					 *	Return the NSS context of PPE VP.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ctx_instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Pointer to the NSS core context.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_ctx_instance *nss_ppe_vp_get_context(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* _NSS_PPE_VP_H_ */
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -27,10 +27,6 @@
 | 
				
			|||||||
 * @{
 | 
					 * @{
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NSS_QVPN_INTERFACE_MAX_LONG BITS_TO_LONGS(NSS_MAX_NET_INTERFACES)	/**< QVPN interface mapping bits. */
 | 
					 | 
				
			||||||
#define NSS_QVPN_STATS_MAX_LINES (NSS_STATS_NODE_MAX + 32)			/**< Maxminum number of lines for QVPN statistics dump. */
 | 
					 | 
				
			||||||
#define NSS_QVPN_STATS_SIZE_PER_IF (NSS_STATS_MAX_STR_LENGTH * NSS_QVPN_STATS_MAX_LINES)	/**< Total number of statistics per QVPN interface. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define NSS_QVPN_CMDS_MAX 10			/**< Maximum number of QVPN commands supported. */
 | 
					#define NSS_QVPN_CMDS_MAX 10			/**< Maximum number of QVPN commands supported. */
 | 
				
			||||||
#define NSS_QVPN_VPN_HDR_HEAD_SIZE_MAX 64	/**< Maximum size of QVPN header. */
 | 
					#define NSS_QVPN_VPN_HDR_HEAD_SIZE_MAX 64	/**< Maximum size of QVPN header. */
 | 
				
			||||||
#define NSS_QVPN_VPN_HDR_TAIL_SIZE_MAX 32	/**< Maximum size of QVPN tail. */
 | 
					#define NSS_QVPN_VPN_HDR_TAIL_SIZE_MAX 32	/**< Maximum size of QVPN tail. */
 | 
				
			||||||
@@ -293,6 +289,16 @@ struct nss_qvpn_stats_sync_msg {
 | 
				
			|||||||
	uint32_t exception_event[NSS_QVPN_EXCEPTION_EVENT_MAX];		/**< QVPN exception events. */
 | 
						uint32_t exception_event[NSS_QVPN_EXCEPTION_EVENT_MAX];		/**< QVPN exception events. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_qvpn_stats_notification
 | 
				
			||||||
 | 
					 *	QVPN transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_qvpn_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_ctx[NSS_STATS_NODE_MAX];		/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;				/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;				/**< Interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_qvpn_msg
 | 
					 * nss_qvpn_msg
 | 
				
			||||||
 *	QVPN message structure for configuration and statistics.
 | 
					 *	QVPN message structure for configuration and statistics.
 | 
				
			||||||
@@ -419,6 +425,17 @@ typedef void (*nss_qvpn_callback_t)(struct net_device *netdev, struct sk_buff *s
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*nss_qvpn_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg);
 | 
					typedef void (*nss_qvpn_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_qvpn_unregister_if
 | 
				
			||||||
 | 
					 *	Deregisters the QVPN interface from the NSS.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] if_num              NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * None.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_qvpn_unregister_if(uint32_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_qvpn_register_if
 | 
					 * nss_qvpn_register_if
 | 
				
			||||||
 *	Register to send/receive QVPN messages to NSS.
 | 
					 *	Register to send/receive QVPN messages to NSS.
 | 
				
			||||||
@@ -441,17 +458,6 @@ struct nss_ctx_instance *nss_qvpn_register_if(uint32_t if_num, nss_qvpn_callback
 | 
				
			|||||||
			nss_qvpn_msg_callback_t qvpn_event_callback, struct net_device *netdev,
 | 
								nss_qvpn_msg_callback_t qvpn_event_callback, struct net_device *netdev,
 | 
				
			||||||
			uint32_t features, void *app_ctx);
 | 
								uint32_t features, void *app_ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_qvpn_unregister_if
 | 
					 | 
				
			||||||
 *	Deregisters the QVPN interface from the NSS.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] if_num              NSS interface number.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * None.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
void nss_qvpn_unregister_if(uint32_t if_num);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_qvpn_ifnum_with_core_id
 | 
					 * nss_qvpn_ifnum_with_core_id
 | 
				
			||||||
 *	Gets the QVPN interface number with the core ID.
 | 
					 *	Gets the QVPN interface number with the core ID.
 | 
				
			||||||
@@ -481,6 +487,34 @@ void nss_qvpn_register_handler(void);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
unsigned long *nss_qvpn_ifmap_get(void);
 | 
					unsigned long *nss_qvpn_ifmap_get(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_qvpn_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_qvpn_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_qvpn_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_qvpn_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * @file nss_rmnet_rx.h
 | 
					 * @file nss_rmnet_rx.h
 | 
				
			||||||
 *	NSS Virtual interface message Structure and APIs
 | 
					 *	NSS RMNET interface message Structure and APIs
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __NSS_RMNET_RX_H
 | 
					#ifndef __NSS_RMNET_RX_H
 | 
				
			||||||
@@ -58,7 +58,7 @@ enum nss_rmnet_rx_msg_types {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_error_types
 | 
					 * nss_rmnet_rx_error_types
 | 
				
			||||||
 *	Error types for the virtual interface.
 | 
					 *	Error types for the RMNET interface.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum nss_rmnet_rx_error_types {
 | 
					enum nss_rmnet_rx_error_types {
 | 
				
			||||||
	NSS_RMNET_RX_SUCCESS,				/**< No error. */
 | 
						NSS_RMNET_RX_SUCCESS,				/**< No error. */
 | 
				
			||||||
@@ -125,19 +125,19 @@ struct nss_rmnet_rx_msg {
 | 
				
			|||||||
	struct nss_cmn_msg cm;		/**< Common message header. */
 | 
						struct nss_cmn_msg cm;		/**< Common message header. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Payload of a virtual interface message.
 | 
						 * Payload of an RMNET interface message.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	union {
 | 
						union {
 | 
				
			||||||
		struct nss_rmnet_rx_config_msg if_config;
 | 
							struct nss_rmnet_rx_config_msg if_config;
 | 
				
			||||||
				/**< Rule for creating a virtual interface. */
 | 
									/**< Rule for creating an RMNET interface. */
 | 
				
			||||||
		struct nss_rmnet_rx_stats stats;
 | 
							struct nss_rmnet_rx_stats stats;
 | 
				
			||||||
				/**< Virtual interface statistics. */
 | 
									/**< RMNET interface statistics. */
 | 
				
			||||||
	} msg;			/**< Message payload. */
 | 
						} msg;			/**< Message payload. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Callback to transmit interface data received from NSS
 | 
					 * Callback to transmit interface data received from NSS
 | 
				
			||||||
 * to the transmit path of the virtual interface.
 | 
					 * to the transmit path of the RMNET interface.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * net_device \n
 | 
					 * net_device \n
 | 
				
			||||||
@@ -183,8 +183,8 @@ struct nss_rmnet_rx_handle {
 | 
				
			|||||||
	int32_t if_num_h2n;			/**< Redirect interface number on host-to-NSS path. */
 | 
						int32_t if_num_h2n;			/**< Redirect interface number on host-to-NSS path. */
 | 
				
			||||||
	struct net_device *ndev;		/**< Associated network device. */
 | 
						struct net_device *ndev;		/**< Associated network device. */
 | 
				
			||||||
	struct nss_rmnet_rx_pvt *pvt;		/**< Private data structure. */
 | 
						struct nss_rmnet_rx_pvt *pvt;		/**< Private data structure. */
 | 
				
			||||||
	uint64_t *stats_n2h;			/**< Virtual interface statistics from NSS-to-host. */
 | 
						uint64_t *stats_n2h;			/**< RMNET interface statistics from NSS-to-host. */
 | 
				
			||||||
	uint64_t *stats_h2n;			/**< Virtual interface statistics from host-to-NSS. */
 | 
						uint64_t *stats_h2n;			/**< RMNET interface statistics from host-to-NSS. */
 | 
				
			||||||
	atomic_t refcnt;			/**< Reference count. */
 | 
						atomic_t refcnt;			/**< Reference count. */
 | 
				
			||||||
	nss_rmnet_rx_msg_callback_t cb;		/**< Message callback. */
 | 
						nss_rmnet_rx_msg_callback_t cb;		/**< Message callback. */
 | 
				
			||||||
	void *app_data;		/**< Application data to be passed to the callback. */
 | 
						void *app_data;		/**< Application data to be passed to the callback. */
 | 
				
			||||||
@@ -192,12 +192,12 @@ struct nss_rmnet_rx_handle {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_destroy_sync
 | 
					 * nss_rmnet_rx_destroy_sync
 | 
				
			||||||
 *	Destroys the virtual interface synchronously.
 | 
					 *	Destroys the RMNET interface synchronously.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * nss_rmnet_rx_handle
 | 
					 * nss_rmnet_rx_handle
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in,out] handle  Pointer to the virtual interface handle (provided during
 | 
					 * @param[in,out] handle  Pointer to the RMNET interface handle (provided during
 | 
				
			||||||
 *                        dynamic interface allocation).
 | 
					 *                        dynamic interface allocation).
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
@@ -210,7 +210,7 @@ extern nss_tx_status_t nss_rmnet_rx_destroy_sync(struct nss_rmnet_rx_handle *han
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_create_sync_nexthop
 | 
					 * nss_rmnet_rx_create_sync_nexthop
 | 
				
			||||||
 *	Creates a virtual interface synchronously with specified nexthops.
 | 
					 *	Creates an RMNET interface synchronously with specified nexthops.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * net_device
 | 
					 * net_device
 | 
				
			||||||
@@ -220,19 +220,33 @@ extern nss_tx_status_t nss_rmnet_rx_destroy_sync(struct nss_rmnet_rx_handle *han
 | 
				
			|||||||
 * @param[in] nexthop_h2n  Nexthop interface number of host-to-NSS dynamic interface.
 | 
					 * @param[in] nexthop_h2n  Nexthop interface number of host-to-NSS dynamic interface.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * Pointer to NSS virtual interface handle.
 | 
					 * Pointer to the NSS RMNET interface handle.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern struct nss_rmnet_rx_handle *nss_rmnet_rx_create_sync_nexthop(struct net_device *netdev, uint32_t nexthop_n2h, uint32_t nexthop_h2n);
 | 
					extern struct nss_rmnet_rx_handle *nss_rmnet_rx_create_sync_nexthop(struct net_device *netdev, uint32_t nexthop_n2h, uint32_t nexthop_h2n);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_rmnet_rx_create
 | 
				
			||||||
 | 
					 *	Creates an RMNET interface synchronously with generic nexthops.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * net_device
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] netdev       Pointer to the associated network device.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Pointer to the NSS RMNET interface handle.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern struct nss_rmnet_rx_handle *nss_rmnet_rx_create(struct net_device *netdev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_tx_buf
 | 
					 * nss_rmnet_rx_tx_buf
 | 
				
			||||||
 *	Forwards virtual interface packets to the NSS.
 | 
					 *	Forwards RMNET interface packets to the NSS.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * nss_rmnet_rx_handle \n
 | 
					 * nss_rmnet_rx_handle \n
 | 
				
			||||||
 * sk_buff
 | 
					 * sk_buff
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in,out] handle  Pointer to the virtual interface handle (provided during
 | 
					 * @param[in,out] handle  Pointer to the RMNET interface handle (provided during
 | 
				
			||||||
 *                        registration).
 | 
					 *                        registration).
 | 
				
			||||||
 * @param[in]    skb     Pointer to the data socket buffer.
 | 
					 * @param[in]    skb     Pointer to the data socket buffer.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -244,14 +258,14 @@ extern nss_tx_status_t nss_rmnet_rx_tx_buf(struct nss_rmnet_rx_handle *handle,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_tx_msg
 | 
					 * nss_rmnet_rx_tx_msg
 | 
				
			||||||
 *	Sends a message to the virtual interface.
 | 
					 *	Sends a message to the RMNET interface.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * nss_ctx_instance \n
 | 
					 * nss_ctx_instance \n
 | 
				
			||||||
 * nss_rmnet_rx_msg
 | 
					 * nss_rmnet_rx_msg
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in] nss_ctx  Pointer to the NSS context (provided during registration).
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context (provided during registration).
 | 
				
			||||||
 * @param[in] nvim     Pointer to the virtual interface message.
 | 
					 * @param[in] nvim     Pointer to the RMNET interface message.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * Command Tx status.
 | 
					 * Command Tx status.
 | 
				
			||||||
@@ -260,12 +274,12 @@ extern nss_tx_status_t nss_rmnet_rx_tx_msg(struct nss_ctx_instance *nss_ctx, str
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_xmit_callback_unregister
 | 
					 * nss_rmnet_rx_xmit_callback_unregister
 | 
				
			||||||
 *	Deregisters the transmit callback from the virtual interface.
 | 
					 *	Deregisters the transmit callback from the RMNET interface.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * nss_rmnet_rx_handle
 | 
					 * nss_rmnet_rx_handle
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in,out] handle  Pointer to the virtual interface handle.
 | 
					 * @param[in,out] handle  Pointer to the RMNET interface handle.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * None.
 | 
					 * None.
 | 
				
			||||||
@@ -274,15 +288,15 @@ extern void nss_rmnet_rx_xmit_callback_unregister(struct nss_rmnet_rx_handle *ha
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_xmit_callback_register
 | 
					 * nss_rmnet_rx_xmit_callback_register
 | 
				
			||||||
 *	Registers a transmit callback to a virtual interface.
 | 
					 *	Registers a transmit callback to an RMNET interface.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * nss_rmnet_rx_handle \n
 | 
					 * nss_rmnet_rx_handle \n
 | 
				
			||||||
 * nss_rmnet_rx_xmit_callback_t
 | 
					 * nss_rmnet_rx_xmit_callback_t
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in,out] handle        Pointer to the virtual interface handle (provided during
 | 
					 * @param[in,out] handle        Pointer to the RMNET interface handle (provided during
 | 
				
			||||||
 *                              dynamic interface allocation).
 | 
					 *                              dynamic interface allocation).
 | 
				
			||||||
 * @param[in]    cb             Callback handler for virtual data packets.
 | 
					 * @param[in]    cb             Callback handler for RMNET data packets.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * None.
 | 
					 * None.
 | 
				
			||||||
@@ -292,12 +306,12 @@ extern void nss_rmnet_rx_xmit_callback_register(struct nss_rmnet_rx_handle *hand
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_unregister
 | 
					 * nss_rmnet_rx_unregister
 | 
				
			||||||
 *	Deregisters a virtual interface from the NSS driver.
 | 
					 *	Deregisters an RMNET interface from the NSS driver.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * nss_rmnet_rx_handle
 | 
					 * nss_rmnet_rx_handle
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in,out] handle  Pointer to the virtual interface handle.
 | 
					 * @param[in,out] handle  Pointer to the RMNET interface handle.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * None.
 | 
					 * None.
 | 
				
			||||||
@@ -306,16 +320,16 @@ extern void nss_rmnet_rx_unregister(struct nss_rmnet_rx_handle *handle);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_register
 | 
					 * nss_rmnet_rx_register
 | 
				
			||||||
 *	Registers a virtual Interface with NSS driver.
 | 
					 *	Registers an RMNET Interface with NSS driver.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * nss_rmnet_rx_handle \n
 | 
					 * nss_rmnet_rx_handle \n
 | 
				
			||||||
 * nss_rmnet_rx_data_callback_t \n
 | 
					 * nss_rmnet_rx_data_callback_t \n
 | 
				
			||||||
 * net_device
 | 
					 * net_device
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in,out] handle        Pointer to the virtual interface handle (provided during
 | 
					 * @param[in,out] handle        Pointer to the RMNET interface handle (provided during
 | 
				
			||||||
 *                              dynamic interface allocation).
 | 
					 *                              dynamic interface allocation).
 | 
				
			||||||
 * @param[in]    data_callback  Callback handler for virtual data packets.
 | 
					 * @param[in]    data_callback  Callback handler for RMNET data packets.
 | 
				
			||||||
 * @param[in]    netdev         Pointer to the associated network device.
 | 
					 * @param[in]    netdev         Pointer to the associated network device.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
@@ -349,22 +363,22 @@ extern int32_t nss_rmnet_rx_get_ifnum(struct net_device *dev);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_get_interface_num
 | 
					 * nss_rmnet_rx_get_interface_num
 | 
				
			||||||
 *	Returns the virtual interface number associated with the handle.
 | 
					 *	Returns the RMNET interface number associated with the handle.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * nss_rmnet_rx_handle
 | 
					 * nss_rmnet_rx_handle
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in] handle  Pointer to the virtual interface handle (provided during
 | 
					 * @param[in] handle  Pointer to the RMNET interface handle (provided during
 | 
				
			||||||
		      dynamic interface allocation).
 | 
							      dynamic interface allocation).
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * Virtual interface number.
 | 
					 * RMNET interface number.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern int32_t nss_rmnet_rx_get_interface_num(struct nss_rmnet_rx_handle *handle);
 | 
					extern int32_t nss_rmnet_rx_get_interface_num(struct nss_rmnet_rx_handle *handle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_rmnet_rx_get_context
 | 
					 * nss_rmnet_rx_get_context
 | 
				
			||||||
 *	Gets the virtual interface context.
 | 
					 *	Gets the RMNET interface context.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * Pointer to the NSS core context.
 | 
					 * Pointer to the NSS core context.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for any
 | 
				
			||||||
 * purpose with or without fee is hereby granted, provided that the above
 | 
					 * purpose with or without fee is hereby granted, provided that the above
 | 
				
			||||||
@@ -68,6 +68,43 @@ enum nss_tls_error {
 | 
				
			|||||||
	NSS_TLS_ERROR_MAX,                  /**< Maximum TLS error. */
 | 
						NSS_TLS_ERROR_MAX,                  /**< Maximum TLS error. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_tls_stats_types
 | 
				
			||||||
 | 
					 *	TLS statistics types.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_tls_stats_types {
 | 
				
			||||||
 | 
						NSS_TLS_STATS_SINGLE_REC = NSS_STATS_NODE_MAX,
 | 
				
			||||||
 | 
											/**< Number of transmit single record datagrams. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_MULTI_REC,		/**< Number of multiple transmit record datagrams. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_TX_INVAL_REQS,		/**< Number of transmit invalidations successfully requested. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_RX_CCS_REC,		/**< Number of change cipher specification records received. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_FAIL_CCS,			/**< Failure to switch to new crypto. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_ETH_NODE_DEACTIVE,	/**< Ethernet node deactivated because no crypto was available. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_CRYPTO_ALLOC_SUCCESS,	/**< Number of successful crypto allocations. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_CRYPTO_FREE_REQ,		/**< Number of crypto-free requests. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_CRYPTO_FREE_SUCCESS,	/**< Number of crypto-free successes. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_FAIL_CRYPTO_ALLOC,	/**< Number of failed crypto allocations. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_FAIL_CRYPTO_LOOKUP,	/**< Failure to find an active crypto session. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_FAIL_REQ_ALLOC,		/**< Failure to allocate request memory pool.  */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_FAIL_PBUF_STATS,		/**< Failure in pbuf allocation for statistics. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_FAIL_CTX_ACTIVE,		/**< Failure in enqueue due to inactive context. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_LEN_ERROR,		/**< Length error. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_TOKEN_ERROR,		/**< Token error; unknown token command or instruction. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_BYPASS_ERROR,		/**< Token contains too much bypass data. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_CRYPTO_ERROR,		/**< Cryptographic block size error. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_HASH_ERROR,		/**< Hash block size error. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_CONFIG_ERROR,		/**< Invalid command, algorithm, or mode combination. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_ALGO_ERROR,		/**< Unsupported algorithm. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_HASH_OVF_ERROR,	/**< Hash input overflow. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_AUTH_ERROR,		/**< Hash input overflow. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_PAD_VERIFY_ERROR,	/**< Pad verification error. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_HW_TIMEOUT_ERROR,		/**< Data timed out. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_NO_DESC_IN,		/**< Ingress DMA descriptor not available. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_NO_DESC_OUT,		/**< Egress DMA descriptor not available. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_NO_REQS,			/**< Not enough requests available for records. */
 | 
				
			||||||
 | 
						NSS_TLS_STATS_MAX,			/**< Maximum statistics type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_tls_hw_stats
 | 
					 * nss_tls_hw_stats
 | 
				
			||||||
 *	TLS HW statistics.
 | 
					 *	TLS HW statistics.
 | 
				
			||||||
@@ -156,6 +193,16 @@ struct nss_tls_cipher_update {
 | 
				
			|||||||
	uint8_t reserved;	/**< Reserved for future use. */
 | 
						uint8_t reserved;	/**< Reserved for future use. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_tls_stats_notification
 | 
				
			||||||
 | 
					 *	TLS transmission statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_tls_stats_notification {
 | 
				
			||||||
 | 
						uint64_t stats_ctx[NSS_TLS_STATS_MAX];		/**< Context transmission statistics. */
 | 
				
			||||||
 | 
						uint32_t core_id;				/**< Core ID. */
 | 
				
			||||||
 | 
						uint32_t if_num;				/**< Interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_tls_msg
 | 
					 * nss_tls_msg
 | 
				
			||||||
 *	Data for sending and receiving TLS messages.
 | 
					 *	Data for sending and receiving TLS messages.
 | 
				
			||||||
@@ -245,7 +292,7 @@ extern nss_tx_status_t nss_tls_tx_msg(struct nss_ctx_instance *nss_ctx, struct n
 | 
				
			|||||||
 * @param[in]  if_num   NSS interface number.
 | 
					 * @param[in]  if_num   NSS interface number.
 | 
				
			||||||
 * @param[in]  type     Type of message.
 | 
					 * @param[in]  type     Type of message.
 | 
				
			||||||
 * @param[in]  len      Size of the payload.
 | 
					 * @param[in]  len      Size of the payload.
 | 
				
			||||||
 * @param[in]  nicm     Pointer to the NSS IPsec message.
 | 
					 * @param[in]  ntcm     Pointer to the NSS IPsec message.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * Status of the Tx operation.
 | 
					 * Status of the Tx operation.
 | 
				
			||||||
@@ -254,6 +301,20 @@ extern nss_tx_status_t nss_tls_tx_msg_sync(struct nss_ctx_instance *nss_ctx, uin
 | 
				
			|||||||
						enum nss_tls_msg_type type, uint16_t len,
 | 
											enum nss_tls_msg_type type, uint16_t len,
 | 
				
			||||||
						struct nss_tls_msg *ntcm);
 | 
											struct nss_tls_msg *ntcm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_tls_unregister_if
 | 
				
			||||||
 | 
					 *	Deregisters a TLS session interface from the NSS.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] if_num  NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * None.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @dependencies
 | 
				
			||||||
 | 
					 * The TLS session interface must have been previously registered.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern void nss_tls_unregister_if(uint32_t if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_tls_register_if
 | 
					 * nss_tls_register_if
 | 
				
			||||||
 *	Registers a TLS session interface with the NSS for sending and receiving
 | 
					 *	Registers a TLS session interface with the NSS for sending and receiving
 | 
				
			||||||
@@ -284,22 +345,19 @@ extern struct nss_ctx_instance *nss_tls_register_if(uint32_t if_num,
 | 
				
			|||||||
							 void *app_ctx);
 | 
												 void *app_ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_tls_unregister_if
 | 
					 * nss_tls_notify_unregister
 | 
				
			||||||
 *	Deregisters a TLS session interface from the NSS.
 | 
					 *	Deregisters an event callback.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in] if_num  NSS interface number.
 | 
					 * @param[in] ifnum  NSS interface number.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * None.
 | 
					 * None.
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @dependencies
 | 
					 | 
				
			||||||
 * The TLS session interface must have been previously registered.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern void nss_tls_unregister_if(uint32_t if_num);
 | 
					extern void nss_tls_notify_unregister(uint32_t ifnum);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_tls_notify_register
 | 
					 * nss_tls_notify_register
 | 
				
			||||||
 *	Register an event callback to handle notification from TLS firmware package.
 | 
					 *	Registers an event callback to handle notification from TLS firmware package.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * nss_tls_msg_callback_t
 | 
					 * nss_tls_msg_callback_t
 | 
				
			||||||
@@ -313,17 +371,6 @@ extern void nss_tls_unregister_if(uint32_t if_num);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
extern struct nss_ctx_instance *nss_tls_notify_register(uint32_t ifnum, nss_tls_msg_callback_t ev_cb, void *app_data);
 | 
					extern struct nss_ctx_instance *nss_tls_notify_register(uint32_t ifnum, nss_tls_msg_callback_t ev_cb, void *app_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_tls_notify_unregister
 | 
					 | 
				
			||||||
 *	Unregister an event callback.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] ifnum  NSS interface number.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * None.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern void nss_tls_notify_unregister(uint32_t ifnum);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_tls_msg_init
 | 
					 * nss_tls_msg_init
 | 
				
			||||||
 *	Initializes a TLS message sent asynchronously.
 | 
					 *	Initializes a TLS message sent asynchronously.
 | 
				
			||||||
@@ -377,6 +424,44 @@ extern struct nss_ctx_instance *nss_tls_get_context(void);
 | 
				
			|||||||
 * Pointer to the device.
 | 
					 * Pointer to the device.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern struct device *nss_tls_get_dev(struct nss_ctx_instance *nss_ctx);
 | 
					extern struct device *nss_tls_get_dev(struct nss_ctx_instance *nss_ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_tls_ifmap_get
 | 
				
			||||||
 | 
					 *	Returns active TLS interfaces.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Pointer to the interface map.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					unsigned long *nss_tls_ifmap_get(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_tls_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_tls_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_tls_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 *	notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or non-zero on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_tls_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @}
 | 
					 * @}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										284
									
								
								feeds/ipq807x/qca-nss-drv/src/exports/nss_udp_st.h
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										284
									
								
								feeds/ipq807x/qca-nss-drv/src/exports/nss_udp_st.h
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,284 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 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.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @file nss_udp_st.h
 | 
				
			||||||
 | 
					 *	NSS Ethernet interface definitions.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_UDP_ST_H
 | 
				
			||||||
 | 
					#define __NSS_UDP_ST_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @addtogroup nss_udp_st_subsystem
 | 
				
			||||||
 | 
					 * @{
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NSS_UDP_ST_TX_CONN_MAX 16
 | 
				
			||||||
 | 
					#define NSS_UDP_ST_FLAG_IPV4 4		/**< L3 Protocol - IPv4. */
 | 
				
			||||||
 | 
					#define NSS_UDP_ST_FLAG_IPV6 6		/**< L3 Protocol - IPv6. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_udp_st_message_types
 | 
				
			||||||
 | 
					 *	UDP speed test message types.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_udp_st_message_types {
 | 
				
			||||||
 | 
						NSS_UDP_ST_START_MSG,			/**< Start message. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_STOP_MSG,			/**< Stop message. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_CFG_RULE_MSG,		/**< Configure IPv4/IPv6 rule. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_UNCFG_RULE_MSG,		/**< Unconfigure IPv4/IPv6 rule. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_STATS_SYNC_MSG,		/**< Statistic syncronization. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_TX_CREATE_MSG,		/**< Create transmit node. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_TX_DESTROY_MSG,		/**< Destroy transmit node. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_RESET_STATS_MSG,		/**< Reset existing statistics. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_MAX_MSG_TYPES,		/**< Maximum message type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_udp_st_test_types
 | 
				
			||||||
 | 
					 *	Test types of the UDP speed test.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_udp_st_test_types {
 | 
				
			||||||
 | 
						NSS_UDP_ST_TEST_RX,			/**< Test type is receive. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_TEST_TX,			/**< Test type is transmit. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_TEST_MAX			/**< Maximum test type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_udp_st_error
 | 
				
			||||||
 | 
					 *	UDP speed test error types.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_udp_st_error {
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_NONE,			/**< No error. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_INCORRECT_RATE,	/**< Incorrect Tx rate. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_INCORRECT_BUFFER_SIZE,	/**< Incorrect buffer size. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_MEMORY_FAILURE,	/**< Memory allocation failed. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_INCORRECT_STATE,	/**< Trying to configure during incorrect state. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_INCORRECT_FLAGS,	/**< Incorrect flag configuration. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_ENTRY_EXIST,		/**< Given tunnel entry already exists. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_ENTRY_ADD_FAILED,	/**< UDP ST Encap entry addition failed. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_ENTRY_NOT_EXIST,	/**< Given tunnel entry does not exists. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_WRONG_START_MSG_TYPE,	/**< Start message type error. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_WRONG_STOP_MSG_TYPE,	/**< Stop message type error. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_TOO_MANY_USERS,	/**< Too many users tried to be added. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_UNKNOWN_MSG_TYPE,	/**< Unknown message type failure. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_PB_ALLOC,		/**< Pbuf allocation failed. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_PB_SIZE,		/**< Pbuf size is too small to fit buffer. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_DROP_QUEUE,		/**< Packet dropped enqueue next node. */
 | 
				
			||||||
 | 
						UDP_ST_ERROR_TIMER_MISSED,		/**< Timer call is missed. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_ERROR_MAX,			/**< Maximum error type. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_udp_st_stats_time
 | 
				
			||||||
 | 
					 *	UDP speed test time statistics types.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_udp_st_stats_time {
 | 
				
			||||||
 | 
						NSS_UDP_ST_STATS_TIME_START,		/**< Start time of the test. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_STATS_TIME_CURRENT,		/**< Current time of the running test. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_STATS_TIME_ELAPSED,		/**< Elapsed time of the current test. */
 | 
				
			||||||
 | 
						NSS_UDP_ST_STATS_TIME_MAX		/**< Maximum time statistics. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Create TX node to start pushing rules.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_udp_st_tx_create {
 | 
				
			||||||
 | 
						uint32_t rate;			/**< Rate in Mbps. */
 | 
				
			||||||
 | 
						uint32_t buffer_size;		/**< UDP buffer size. */
 | 
				
			||||||
 | 
						uint8_t dscp;			/**< DSCP value. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Destroy Tx node.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_udp_st_tx_destroy {
 | 
				
			||||||
 | 
						uint32_t flag;			/**< Tx destroy flag. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * NSS UDP speed test start structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_udp_st_start {
 | 
				
			||||||
 | 
						uint32_t type;	/**< Started test type (for example, receive or transmit). */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * NSS UDP speed test stop structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_udp_st_stop {
 | 
				
			||||||
 | 
						uint32_t type;	/**< Stopped test type (for example, receive or transmit). */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * NSS UDP speed test ip structure
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_udp_st_ip {
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							uint32_t ipv4;          /**< IPv4 address. */
 | 
				
			||||||
 | 
							uint32_t ipv6[4];       /**< IPv6 address. */
 | 
				
			||||||
 | 
						} ip;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * NSS UDP speed test IPv4/IPv6 configuration structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_udp_st_cfg {
 | 
				
			||||||
 | 
						struct nss_udp_st_ip src_ip;	/**< Source IP address. */
 | 
				
			||||||
 | 
						int32_t src_port;		/**< Source L4 port. */
 | 
				
			||||||
 | 
						struct nss_udp_st_ip dest_ip;	/**< Destination IP address. */
 | 
				
			||||||
 | 
						int32_t dest_port;		/**< Destination L4 port. */
 | 
				
			||||||
 | 
						uint32_t type;			/**< Started test type (for example, receive or transmit). */
 | 
				
			||||||
 | 
						uint16_t ip_version;		/**< IP version to indicate IPv4 or IPv6. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * NSS UDP speed test node statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_udp_st_node_stats {
 | 
				
			||||||
 | 
						struct nss_cmn_node_stats node_stats;	/**< Common node statistics for the UDP speed test. */
 | 
				
			||||||
 | 
						uint32_t errors[NSS_UDP_ST_ERROR_MAX];	/**< Error statistics. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * NSS UDP speed test statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_udp_st_stats {
 | 
				
			||||||
 | 
						struct nss_udp_st_node_stats nstats;	/**< Node statistics for the UDP speed test. */
 | 
				
			||||||
 | 
						uint32_t time_stats[NSS_UDP_ST_TEST_MAX][NSS_UDP_ST_STATS_TIME_MAX];
 | 
				
			||||||
 | 
											/**< Time statistics. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * NSS UDP speed test reset statistics structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_udp_st_reset_stats {
 | 
				
			||||||
 | 
						uint32_t flag;  /**< Reset statistics flag. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Message structure of the UDP speed test commands.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_udp_st_msg {
 | 
				
			||||||
 | 
						struct nss_cmn_msg cm;          /**< Message header. */
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							struct nss_udp_st_tx_create create;	/**< Prepare transmit message. */
 | 
				
			||||||
 | 
							struct nss_udp_st_tx_destroy destroy;	/**< Destroy transmit message. */
 | 
				
			||||||
 | 
							struct nss_udp_st_start start;		/**< Start message. */
 | 
				
			||||||
 | 
							struct nss_udp_st_stop stop;		/**< Stop message. */
 | 
				
			||||||
 | 
							struct nss_udp_st_cfg cfg;		/**< IPv4/IPv6 configuration message. */
 | 
				
			||||||
 | 
							struct nss_udp_st_cfg uncfg;		/**< IPv4/IPv6 unconfiguration message. */
 | 
				
			||||||
 | 
							struct nss_udp_st_stats stats;		/**< Statistics synchronization message. */
 | 
				
			||||||
 | 
							struct nss_udp_st_reset_stats reset_stats;
 | 
				
			||||||
 | 
												/**< Reset statistics message. */
 | 
				
			||||||
 | 
						} msg;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Callback function for receiving UDP speed test messages.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_udp_st_msg
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] app_data  Pointer to the application context of the message.
 | 
				
			||||||
 | 
					 * @param[in] msg       Pointer to the message data.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					typedef void (*nss_udp_st_msg_callback_t)(void *app_data, struct nss_udp_st_msg *msg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_udp_st_register_handler
 | 
				
			||||||
 | 
					 *	Registers the UDP speed test message handler.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ctx_instance
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * None.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern void nss_udp_st_register_handler(struct nss_ctx_instance *nss_ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_udp_st_tx
 | 
				
			||||||
 | 
					 *	Transmits a UDP speed test message to the NSS.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ctx_instance \n
 | 
				
			||||||
 | 
					 * nss_udp_st_msg
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
				
			||||||
 | 
					 * @param[in] num      Pointer to the message data.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Status of the transmit operation.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern nss_tx_status_t nss_udp_st_tx(struct nss_ctx_instance *nss_ctx, struct nss_udp_st_msg *num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_udp_st_tx_sync
 | 
				
			||||||
 | 
					 *	Transmits a synchronous UDP speed test message to the NSS.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_ctx_instance \n
 | 
				
			||||||
 | 
					 * nss_udp_st_msg
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nss_ctx  Pointer to the NSS context.
 | 
				
			||||||
 | 
					 * @param[in] num      Pointer to the message data.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Status of the transmit operation.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern nss_tx_status_t nss_udp_st_tx_sync(struct nss_ctx_instance *nss_ctx, struct nss_udp_st_msg *num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_udp_st_msg_init
 | 
				
			||||||
 | 
					 *	Initializes UDP speed test messages.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_udp_st_msg \n
 | 
				
			||||||
 | 
					 * nss_udp_st_msg_callback_t
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in,out] num       Pointer to the NSS interface message.
 | 
				
			||||||
 | 
					 * @param[in]     if_num    NSS interface number.
 | 
				
			||||||
 | 
					 * @param[in]     type      Type of message.
 | 
				
			||||||
 | 
					 * @param[in]     len       Size of the payload.
 | 
				
			||||||
 | 
					 * @param[in]     cb        Callback function for the message.
 | 
				
			||||||
 | 
					 * @param[in]     app_data  Pointer to the application context of the message.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * None.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern void nss_udp_st_msg_init(struct nss_udp_st_msg *num, uint16_t if_num, uint32_t type, uint32_t len,
 | 
				
			||||||
 | 
								nss_udp_st_msg_callback_t cb, void *app_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_udp_st_get_mgr
 | 
				
			||||||
 | 
					 *	Gets the NSS context that is managing UDP speed sest processes.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * Pointer to the NSS core context.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern struct nss_ctx_instance *nss_udp_st_get_mgr(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 *@}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_UDP_ST_H */
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019, 2021 The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -111,6 +111,7 @@ struct nss_vxlan_stats_msg {
 | 
				
			|||||||
	uint32_t except_vni_lookup_failed;	/**< Virtual network ID look up failed. */
 | 
						uint32_t except_vni_lookup_failed;	/**< Virtual network ID look up failed. */
 | 
				
			||||||
	uint32_t dropped_malformed;		/**< Packet is malformed. */
 | 
						uint32_t dropped_malformed;		/**< Packet is malformed. */
 | 
				
			||||||
	uint32_t dropped_next_node_queue_full;	/**< Next node dropped the packet. */
 | 
						uint32_t dropped_next_node_queue_full;	/**< Next node dropped the packet. */
 | 
				
			||||||
 | 
						uint32_t except_inner_hash;		/**< Inner hash calculation failed. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2015-2018, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -722,6 +722,10 @@ struct nss_wifi_peer_ol_stats {
 | 
				
			|||||||
	uint32_t ppdu_retries;	/**< Number of PPDU retries. */
 | 
						uint32_t ppdu_retries;	/**< Number of PPDU retries. */
 | 
				
			||||||
	uint32_t rssi_chains[NSS_WIFI_MAX_RSSI_CHAINS];
 | 
						uint32_t rssi_chains[NSS_WIFI_MAX_RSSI_CHAINS];
 | 
				
			||||||
				/**< Acknowledgment RSSI per chain. */
 | 
									/**< Acknowledgment RSSI per chain. */
 | 
				
			||||||
 | 
						uint32_t rx_msdus;	/**< Number of MSDUs received. */
 | 
				
			||||||
 | 
						uint32_t rx_bytes;	/**< Number of bytes received. */
 | 
				
			||||||
 | 
						uint32_t rx_mpdus;	/**< Number of MPDUs received. */
 | 
				
			||||||
 | 
						uint32_t rx_retries;	/**< Number of MPDU retries. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,6 +35,7 @@ enum nss_wifi_ext_vdev_msg_types {
 | 
				
			|||||||
	NSS_WIFI_EXT_VDEV_MSG_CONFIGURE_WDS,
 | 
						NSS_WIFI_EXT_VDEV_MSG_CONFIGURE_WDS,
 | 
				
			||||||
	NSS_WIFI_EXT_VDEV_SET_NEXT_HOP,
 | 
						NSS_WIFI_EXT_VDEV_SET_NEXT_HOP,
 | 
				
			||||||
	NSS_WIFI_EXT_VDEV_MSG_STATS_SYNC,
 | 
						NSS_WIFI_EXT_VDEV_MSG_STATS_SYNC,
 | 
				
			||||||
 | 
						NSS_WIFI_EXT_VDEV_MSG_CONFIGURE_VLAN,
 | 
				
			||||||
	NSS_WIFI_EXT_VDEV_MSG_MAX
 | 
						NSS_WIFI_EXT_VDEV_MSG_MAX
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -50,12 +51,16 @@ enum nss_wifi_ext_vdev_error_types {
 | 
				
			|||||||
	NSS_WIFI_EXT_VDEV_ERROR_INV_PVAP_ID,	/**< Invalid parent virtual device interface number. */
 | 
						NSS_WIFI_EXT_VDEV_ERROR_INV_PVAP_ID,	/**< Invalid parent virtual device interface number. */
 | 
				
			||||||
	NSS_WIFI_EXT_VDEV_ERROR_RADIO_NOT_PRESENT,	/**< Radio node is not present. */
 | 
						NSS_WIFI_EXT_VDEV_ERROR_RADIO_NOT_PRESENT,	/**< Radio node is not present. */
 | 
				
			||||||
	NSS_WIFI_EXT_VDEV_ERROR_INV_IF,		/**< Message sent on invalid interface number. */
 | 
						NSS_WIFI_EXT_VDEV_ERROR_INV_IF,		/**< Message sent on invalid interface number. */
 | 
				
			||||||
	NSS_WIFI_EXT_VDEV_ERROR_MAX,		/**< Maxiumum error types. */
 | 
						NSS_WIFI_EXT_VDEV_ERROR_INV_VLAN_ID,	/**< Invalid VLAN ID. */
 | 
				
			||||||
 | 
						NSS_WIFI_EXT_VDEV_ERROR_INV_CMD,	/**< Invalid command. */
 | 
				
			||||||
 | 
						NSS_WIFI_EXT_VDEV_ERROR_PEERID_ALREADY_CONFIGURED,
 | 
				
			||||||
 | 
											/**< Peer ID is already configured. */
 | 
				
			||||||
 | 
						NSS_WIFI_EXT_VDEV_ERROR_MAX		/**< Maxiumum error types. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_wifi_ext_vdev_wds_msg
 | 
					 * nss_wifi_ext_vdev_wds_msg
 | 
				
			||||||
 *	Extended WDS config message.
 | 
					 *	Extended WDS configuration message.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct nss_wifi_ext_vdev_wds_msg {
 | 
					struct nss_wifi_ext_vdev_wds_msg {
 | 
				
			||||||
	uint16_t wds_peer_id;	/**< WDS station peer ID. */
 | 
						uint16_t wds_peer_id;	/**< WDS station peer ID. */
 | 
				
			||||||
@@ -90,6 +95,14 @@ struct nss_wifi_ext_vdev_set_next_hop_msg {
 | 
				
			|||||||
	uint32_t if_num;		/**< Interface number. */
 | 
						uint32_t if_num;		/**< Interface number. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifi_ext_vdev_vlan_msg
 | 
				
			||||||
 | 
					 *	Extended VLAN configuration message.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifi_ext_vdev_vlan_msg {
 | 
				
			||||||
 | 
						uint16_t vlan_id;	/**< VLAN ID. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_wifi_ext_vdev_msg
 | 
					 * nss_wifi_ext_vdev_msg
 | 
				
			||||||
 *	Message structure to Send/Receive commands.
 | 
					 *	Message structure to Send/Receive commands.
 | 
				
			||||||
@@ -102,6 +115,7 @@ struct nss_wifi_ext_vdev_msg {
 | 
				
			|||||||
		struct nss_wifi_ext_vdev_wds_msg wmsg;	/**< WDS configure message. */
 | 
							struct nss_wifi_ext_vdev_wds_msg wmsg;	/**< WDS configure message. */
 | 
				
			||||||
		struct nss_wifi_ext_vdev_set_next_hop_msg wnhm;	/**< Next hop set message. */
 | 
							struct nss_wifi_ext_vdev_set_next_hop_msg wnhm;	/**< Next hop set message. */
 | 
				
			||||||
		struct nss_wifi_ext_vdev_stats stats;	/**< Statistics messasge. */
 | 
							struct nss_wifi_ext_vdev_stats stats;	/**< Statistics messasge. */
 | 
				
			||||||
 | 
							struct nss_wifi_ext_vdev_vlan_msg vmsg;	/**< VLAN message. */
 | 
				
			||||||
	} msg;
 | 
						} msg;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -126,7 +140,7 @@ typedef void (*nss_wifi_ext_vdev_data_callback_t)(struct net_device *netdev, str
 | 
				
			|||||||
 * nss_wifi_ext_vdev_msg
 | 
					 * nss_wifi_ext_vdev_msg
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in] app_data  Pointer to the application context of the message.
 | 
					 * @param[in] app_data  Pointer to the application context of the message.
 | 
				
			||||||
 * @param[in]wevm       Pointer to the message data.
 | 
					 * @param[in] wevm      Pointer to the message data.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef void (*nss_wifi_ext_vdev_msg_callback_t)(void *app_data, struct nss_cmn_msg *ncm);
 | 
					typedef void (*nss_wifi_ext_vdev_msg_callback_t)(void *app_data, struct nss_cmn_msg *ncm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -240,8 +254,8 @@ extern nss_tx_status_t nss_wifi_ext_vdev_tx_msg_sync(struct nss_ctx_instance *ns
 | 
				
			|||||||
 * @datatypes
 | 
					 * @datatypes
 | 
				
			||||||
 * nss_ctx_instance \n
 | 
					 * nss_ctx_instance \n
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in] nss_ctx  NSS core context.
 | 
					 * @param[in] ctx      NSS core context.
 | 
				
			||||||
 * @param[in] ifnum  NSS interface number.
 | 
					 * @param[in] if_num   NSS interface number.
 | 
				
			||||||
 * @param[in] next_hop Next hop interface number.
 | 
					 * @param[in] next_hop Next hop interface number.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern nss_tx_status_t nss_wifi_ext_vdev_set_next_hop(struct nss_ctx_instance *ctx, int if_num, int next_hop);
 | 
					extern nss_tx_status_t nss_wifi_ext_vdev_set_next_hop(struct nss_ctx_instance *ctx, int if_num, int next_hop);
 | 
				
			||||||
@@ -267,8 +281,8 @@ extern struct nss_ctx_instance *nss_wifi_ext_vdev_get_ctx(void);
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param[in] if_num         NSS interface number.
 | 
					 * @param[in] if_num         NSS interface number.
 | 
				
			||||||
 * @param[in] cb_func_data   Callback for the data.
 | 
					 * @param[in] cb_func_data   Callback for the data.
 | 
				
			||||||
 * @param[in] cb_func_msg    Callback for the message.
 | 
					 * @param[in] cb_func_ext    Callback for the message.
 | 
				
			||||||
 * @param[in] cb_func_event  Callback for the event message.
 | 
					 * @param[in] cb_func_msg    Callback for the event message.
 | 
				
			||||||
 * @param[in] features       Data socket buffer types supported by this interface.
 | 
					 * @param[in] features       Data socket buffer types supported by this interface.
 | 
				
			||||||
 * @param[in] netdev         Pointer to the associated network device.
 | 
					 * @param[in] netdev         Pointer to the associated network device.
 | 
				
			||||||
 * @param[in] app_ctx        Pointer to the application context.
 | 
					 * @param[in] app_ctx        Pointer to the application context.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,292 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 **************************************************************************
 | 
					 | 
				
			||||||
 * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 | 
					 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 | 
				
			||||||
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
					 | 
				
			||||||
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
					 | 
				
			||||||
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
					 | 
				
			||||||
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
					 | 
				
			||||||
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
					 | 
				
			||||||
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
					 | 
				
			||||||
 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
					 | 
				
			||||||
 **************************************************************************
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * @file nss_wifi_if.h
 | 
					 | 
				
			||||||
 *	NSS Wi-Fi interface message Structure and APIs.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef __NSS_WIFI_IF_H
 | 
					 | 
				
			||||||
#define __NSS_WIFI_IF_H
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * @addtogroup nss_wifi_subsystem
 | 
					 | 
				
			||||||
 * @{
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_msg_types
 | 
					 | 
				
			||||||
 *	Message types for Wi-Fi interface requests and responses.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_wifi_if_msg_types {
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_OPEN = NSS_IF_OPEN,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_CLOSE = NSS_IF_CLOSE,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_LINK_STATE_NOTIFY = NSS_IF_LINK_STATE_NOTIFY,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_MTU_CHANGE = NSS_IF_MTU_CHANGE,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_MAC_ADDR_SET = NSS_IF_MAC_ADDR_SET,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_STATS_SYNC = NSS_IF_STATS,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_ISHAPER_ASSIGN = NSS_IF_ISHAPER_ASSIGN,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_BSHAPER_ASSIGN = NSS_IF_BSHAPER_ASSIGN,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_ISHAPER_UNASSIGN = NSS_IF_ISHAPER_UNASSIGN,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_BSHAPER_UNASSIGN = NSS_IF_BSHAPER_UNASSIGN,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_ISHAPER_CONFIG = NSS_IF_ISHAPER_CONFIG,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_BSHAPER_CONFIG = NSS_IF_BSHAPER_CONFIG,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_VSI_ASSIGN = NSS_IF_VSI_ASSIGN,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_VSI_UNASSIGN = NSS_IF_VSI_UNASSIGN,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_TX_CREATE_MSG = NSS_IF_MAX_MSG_TYPES + 1,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_TX_DESTROY_MSG,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_STATS_SYNC_MSG,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_MAX_MSG_TYPES
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_error_types
 | 
					 | 
				
			||||||
 *	Error types for the Wi-Fi interface.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_wifi_if_error_types {
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_SUCCESS,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_CORE_FAILURE,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_ALLOC_FAILURE,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_DYNAMIC_IF_FAILURE,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_MSG_TX_FAILURE,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_REG_FAILURE,
 | 
					 | 
				
			||||||
	NSS_WIFI_IF_CORE_NOT_INITIALIZED
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_create_msg
 | 
					 | 
				
			||||||
 *	Payload for configuring the Wi-Fi interface.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_wifi_if_create_msg {
 | 
					 | 
				
			||||||
	uint32_t flags;				/**< Interface flags. */
 | 
					 | 
				
			||||||
	uint8_t mac_addr[ETH_ALEN];		/**< MAC address. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_destroy_msg
 | 
					 | 
				
			||||||
 *	Payload for destroying the Wi-Fi interface.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_wifi_if_destroy_msg {
 | 
					 | 
				
			||||||
	int32_t reserved;			/**< Placeholder. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_stats
 | 
					 | 
				
			||||||
 *	Wi-Fi interface statistics received from the NSS.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_wifi_if_stats {
 | 
					 | 
				
			||||||
	struct nss_cmn_node_stats node_stats;
 | 
					 | 
				
			||||||
				/**< Common statistics. */
 | 
					 | 
				
			||||||
	uint32_t tx_enqueue_failed;
 | 
					 | 
				
			||||||
				/**< Number of packets dropped when queuing to the next node in a network graph. */
 | 
					 | 
				
			||||||
	uint32_t shaper_enqueue_failed;
 | 
					 | 
				
			||||||
				/**< Number of packets dropped when queuing to the shaper node. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_msg
 | 
					 | 
				
			||||||
 *	Data for sending and receiving Wi-Fi interface messages.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_wifi_if_msg {
 | 
					 | 
				
			||||||
	struct nss_cmn_msg cm;			/**< Common message header. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Payload of a Wi-Fi interface message.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	union {
 | 
					 | 
				
			||||||
		union nss_if_msgs if_msgs;
 | 
					 | 
				
			||||||
				/**< NSS interface messages. */
 | 
					 | 
				
			||||||
		struct nss_wifi_if_create_msg create;
 | 
					 | 
				
			||||||
				/**< Creates a Wi-Fi interface rule. */
 | 
					 | 
				
			||||||
		struct nss_wifi_if_destroy_msg destroy;
 | 
					 | 
				
			||||||
				/**< Destroys a Wi-Fi interface rule. */
 | 
					 | 
				
			||||||
		struct nss_wifi_if_stats stats;
 | 
					 | 
				
			||||||
				/**< Interface statistics. */
 | 
					 | 
				
			||||||
	} msg;			/**< Message payload. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_pvt
 | 
					 | 
				
			||||||
 *	Private data information for the Wi-Fi interface.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_wifi_if_pvt {
 | 
					 | 
				
			||||||
	struct semaphore sem;
 | 
					 | 
				
			||||||
			/**< Semaphore for a specified Wi-Fi interface number. */
 | 
					 | 
				
			||||||
	struct completion complete;
 | 
					 | 
				
			||||||
			/**< Waits for the NSS to process a message on the specified Wi-Fi interface. */
 | 
					 | 
				
			||||||
	int response;	/**< Response received on a Wi-Fi interface number. */
 | 
					 | 
				
			||||||
	int sem_init_done;
 | 
					 | 
				
			||||||
			/**< Indicates whether the semaphore is initialized. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Callback function for receiving Wi-Fi data.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * net_device \n
 | 
					 | 
				
			||||||
 * sk_buff \n
 | 
					 | 
				
			||||||
 * napi_struct
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] netdev  Pointer to the associated network device.
 | 
					 | 
				
			||||||
 * @param[in] skb     Pointer to the data socket buffer.
 | 
					 | 
				
			||||||
 * @param[in] napi    Pointer to the NAPI structure.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef void (*nss_wifi_if_data_callback_t)(struct net_device *netdev,
 | 
					 | 
				
			||||||
		struct sk_buff *skb, struct napi_struct *napi);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Callback function for receiving Wi-Fi messages.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * nss_cmn_msg
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] app_data  Pointer to the application context of the message.
 | 
					 | 
				
			||||||
 * @param[in] msg       Pointer to the message data.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
typedef void (*nss_wifi_if_msg_callback_t)(void *app_data,
 | 
					 | 
				
			||||||
		struct nss_cmn_msg *msg);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_handle
 | 
					 | 
				
			||||||
 *	Context for WLAN-to-NSS communication.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_wifi_if_handle {
 | 
					 | 
				
			||||||
	struct nss_ctx_instance *nss_ctx;	/**< NSS context. */
 | 
					 | 
				
			||||||
	int32_t if_num;				/**< Interface number. */
 | 
					 | 
				
			||||||
	struct nss_wifi_if_pvt *pvt;		/**< Private data structure. */
 | 
					 | 
				
			||||||
	struct nss_wifi_if_stats stats;
 | 
					 | 
				
			||||||
			/**< Statistics corresponding to this handle. */
 | 
					 | 
				
			||||||
	nss_wifi_if_msg_callback_t cb;
 | 
					 | 
				
			||||||
			/**< Callback registered by other modules. */
 | 
					 | 
				
			||||||
	void *app_data;
 | 
					 | 
				
			||||||
			/**< Application context to be passed to that callback. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_tx_msg
 | 
					 | 
				
			||||||
 *	Sends a message to the Wi-Fi interface.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * nss_ctx_instance \n
 | 
					 | 
				
			||||||
 * nss_wifi_if_msg
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] nss_ctx  Pointer to the NSS context (provided during registration).
 | 
					 | 
				
			||||||
 * @param[in] nwim     Pointer to the Wi-Fi interface message.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * Status of the Tx operation.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern nss_tx_status_t nss_wifi_if_tx_msg(struct nss_ctx_instance *nss_ctx,
 | 
					 | 
				
			||||||
					struct nss_wifi_if_msg *nwim);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_register
 | 
					 | 
				
			||||||
 *	Registers a Wi-Fi interface with the NSS driver.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * nss_wifi_if_handle \n
 | 
					 | 
				
			||||||
 * nss_wifi_if_data_callback_t \n
 | 
					 | 
				
			||||||
 * net_device
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] handle       Pointer to the Wi-Fi context (provided during Wi-Fi
 | 
					 | 
				
			||||||
 *                             interface allocation).
 | 
					 | 
				
			||||||
 * @param[in] rx_callback  Callback handler for Wi-Fi data packets.
 | 
					 | 
				
			||||||
 * @param[in] netdev       Pointer to the associated network device.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * None.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern void nss_wifi_if_register(struct nss_wifi_if_handle *handle,
 | 
					 | 
				
			||||||
				nss_wifi_if_data_callback_t rx_callback,
 | 
					 | 
				
			||||||
				struct net_device *netdev);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_unregister
 | 
					 | 
				
			||||||
 *	Deregisters a Wi-Fi interface from the NSS driver.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * nss_wifi_if_handle
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] handle  Pointer to the Wi-Fi context.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * None.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern void nss_wifi_if_unregister(struct nss_wifi_if_handle *handle);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_create_sync
 | 
					 | 
				
			||||||
 *	Creates a Wi-Fi interface.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * net_device
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] netdev  Pointer to the associated network device.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * Pointer to the Wi-Fi handle.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern struct nss_wifi_if_handle *nss_wifi_if_create_sync(struct net_device *netdev);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_destroy_sync
 | 
					 | 
				
			||||||
 *	Destroys the Wi-Fi interface associated with the interface number.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * nss_wifi_if_handle
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] handle  Pointer to the Wi-Fi handle.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * Status of the Tx operation.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern nss_tx_status_t nss_wifi_if_destroy_sync(struct nss_wifi_if_handle *handle);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_tx_buf
 | 
					 | 
				
			||||||
 *	Sends a data packet or buffer to the NSS.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @datatypes
 | 
					 | 
				
			||||||
 * nss_wifi_if_handle \n
 | 
					 | 
				
			||||||
 * sk_buff
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] handle  Context associated with the interface.
 | 
					 | 
				
			||||||
 * @param[in] skb     Pointer to the data socket buffer.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * Status of the Tx operation.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
extern nss_tx_status_t nss_wifi_if_tx_buf(struct nss_wifi_if_handle *handle,
 | 
					 | 
				
			||||||
					struct sk_buff *skb);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_wifi_if_copy_stats
 | 
					 | 
				
			||||||
 *	Copies Wi-Fi interface statistics for display.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in]  if_num  NSS interface number.
 | 
					 | 
				
			||||||
 * @param[in]  index   Index in the statistics array.
 | 
					 | 
				
			||||||
 * @param[out] line    Pointer to the buffer into which the statistics are copied.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return
 | 
					 | 
				
			||||||
 * Number of bytes copied.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
int32_t nss_wifi_if_copy_stats(int32_t if_num, int index, char *line);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * @}
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif /* __NSS_WIFI_IF_H */
 | 
					 | 
				
			||||||
@@ -43,6 +43,8 @@ enum nss_wifi_mac_db_msg_types {
 | 
				
			|||||||
	NSS_WIFI_MAC_DB_UPDATE_ENTRY_MSG,	/**< Wi-Fi MAC database update entry message. */
 | 
						NSS_WIFI_MAC_DB_UPDATE_ENTRY_MSG,	/**< Wi-Fi MAC database update entry message. */
 | 
				
			||||||
	NSS_WIFI_MAC_DB_DEINIT_MSG,		/**< Wi-Fi MAC database deinitialization message. */
 | 
						NSS_WIFI_MAC_DB_DEINIT_MSG,		/**< Wi-Fi MAC database deinitialization message. */
 | 
				
			||||||
	NSS_WIFI_MAC_DB_GROUP_ENTRIES_ADD_MSG,	/**< Wi-Fi MAC database group entries add message. */
 | 
						NSS_WIFI_MAC_DB_GROUP_ENTRIES_ADD_MSG,	/**< Wi-Fi MAC database group entries add message. */
 | 
				
			||||||
 | 
						NSS_WIFI_MAC_DB_ENTRY_ACTIVITY_MSG,	/**< Wi-Fi MAC database entry activity message. */
 | 
				
			||||||
 | 
						NSS_WIFI_MAC_DB_CREATE_ENTRY_MSG,	/**< Wi-Fi MAC database entry create message. */
 | 
				
			||||||
	NSS_WIFI_MAC_DB_MAX_MSG
 | 
						NSS_WIFI_MAC_DB_MAX_MSG
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -69,9 +71,8 @@ enum nss_wifi_mac_db_if_opmode {
 | 
				
			|||||||
	NSS_WIFI_MAC_DB_ENTRY_IF_OPMODE_MAX	/**< Maximum entry database interface operation mode. */
 | 
						NSS_WIFI_MAC_DB_ENTRY_IF_OPMODE_MAX	/**< Maximum entry database interface operation mode. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/**
 | 
				
			||||||
 * nss_wifi_mac_db_err_types
 | 
					 * Wi-Fi MAC database errors.
 | 
				
			||||||
 *	Wi-Fi MAC database erros.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum nss_wifi_mac_db_err_types {
 | 
					enum nss_wifi_mac_db_err_types {
 | 
				
			||||||
	NSS_WIFI_MAC_DB_ERROR_NONE,
 | 
						NSS_WIFI_MAC_DB_ERROR_NONE,
 | 
				
			||||||
@@ -112,12 +113,42 @@ enum nss_wifi_mac_db_err_types {
 | 
				
			|||||||
		/**< Wi-Fi MAC database error maximum. */
 | 
							/**< Wi-Fi MAC database error maximum. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifi_mac_db_entry_create_msg
 | 
				
			||||||
 | 
					 * 	Wi-Fi MAC database entry create message.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifi_mac_db_entry_create_msg {
 | 
				
			||||||
 | 
						uint8_t mac_addr[ETH_ALEN];			/**< MAC address. */
 | 
				
			||||||
 | 
						uint16_t reserved;				/**< Reserved bytes. */
 | 
				
			||||||
 | 
						int32_t nss_if;					/**< NSS interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifi_mac_db_entry_activity_info
 | 
				
			||||||
 | 
					 * 	Wi-Fi MAC database entry activity information.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifi_mac_db_entry_activity_info {
 | 
				
			||||||
 | 
						uint8_t mac_addr[ETH_ALEN];			/**< MAC address. */
 | 
				
			||||||
 | 
						uint16_t reserved;				/**< Reserved bytes. */
 | 
				
			||||||
 | 
						int32_t nss_if;					/**< NSS interface number. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifi_mac_db_entry_activity_info_msg
 | 
				
			||||||
 | 
					 * 	Wi-Fi MAC database entry activity information message.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifi_mac_db_entry_activity_info_msg {
 | 
				
			||||||
 | 
						uint32_t nentries;		/**< Number of entries. */
 | 
				
			||||||
 | 
						struct nss_wifi_mac_db_entry_activity_info info[1];
 | 
				
			||||||
 | 
										/**< Wi-Fi MAC database entry activity information. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_wifi_mac_db_entry_info_msg
 | 
					 * nss_wifi_mac_db_entry_info_msg
 | 
				
			||||||
 *	Wi-Fi MAC database entry information.
 | 
					 *	Wi-Fi MAC database entry information.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct nss_wifi_mac_db_entry_info_msg {
 | 
					struct nss_wifi_mac_db_entry_info_msg {
 | 
				
			||||||
	uint8_t mac_addr[6];		/**< MAC address. */
 | 
						uint8_t mac_addr[ETH_ALEN];	/**< MAC address. */
 | 
				
			||||||
	uint16_t flag;			/**< Flag information about NSS interface. */
 | 
						uint16_t flag;			/**< Flag information about NSS interface. */
 | 
				
			||||||
	int32_t nss_if;		    	/**< NSS interface number. */
 | 
						int32_t nss_if;		    	/**< NSS interface number. */
 | 
				
			||||||
	uint32_t iftype;		/**< NSS interface type. */
 | 
						uint32_t iftype;		/**< NSS interface type. */
 | 
				
			||||||
@@ -151,6 +182,10 @@ struct nss_wifi_mac_db_msg {
 | 
				
			|||||||
				/**< Wi-Fi MAC database information specific message. */
 | 
									/**< Wi-Fi MAC database information specific message. */
 | 
				
			||||||
		struct nss_wifi_mac_db_entry_group_info_msg nmfdbegimsg;
 | 
							struct nss_wifi_mac_db_entry_group_info_msg nmfdbegimsg;
 | 
				
			||||||
				/**< Wi-Fi MAC database information specific message. */
 | 
									/**< Wi-Fi MAC database information specific message. */
 | 
				
			||||||
 | 
							struct nss_wifi_mac_db_entry_activity_info_msg nmfdbeact_imsg;
 | 
				
			||||||
 | 
									/**< Wi-Fi MAC database entry activity information message. */
 | 
				
			||||||
 | 
							struct nss_wifi_mac_db_entry_create_msg nmfdbecmsg;
 | 
				
			||||||
 | 
									/**< Wi-Fi MAC database entry create message. */
 | 
				
			||||||
	} msg;			/**< Message payload. */
 | 
						} msg;			/**< Message payload. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1000
									
								
								feeds/ipq807x/qca-nss-drv/src/exports/nss_wifi_mesh.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1000
									
								
								feeds/ipq807x/qca-nss-drv/src/exports/nss_wifi_mesh.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -16,7 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @file nss_wifi_vdev.h
 | 
					 * @file nss_wifi_vdev.h
 | 
				
			||||||
 *	NSS TO HLOS Wi-Fi virtual device interface definitions.
 | 
					 *	NSS-to-HLOS Wi-Fi virtual device interface definitions.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __NSS_WIFI_VDEV_H
 | 
					#ifndef __NSS_WIFI_VDEV_H
 | 
				
			||||||
@@ -74,6 +74,8 @@ enum nss_wifi_vdev_msg_types {
 | 
				
			|||||||
	NSS_WIFI_VDEV_INTERFACE_RECOVERY_RESET_MSG,
 | 
						NSS_WIFI_VDEV_INTERFACE_RECOVERY_RESET_MSG,
 | 
				
			||||||
	NSS_WIFI_VDEV_INTERFACE_RECOVERY_RECONF_MSG,
 | 
						NSS_WIFI_VDEV_INTERFACE_RECOVERY_RECONF_MSG,
 | 
				
			||||||
	NSS_WIFI_VDEV_SET_GROUP_KEY,
 | 
						NSS_WIFI_VDEV_SET_GROUP_KEY,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_HMMC_MEMBER_ADD_MSG,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_HMMC_MEMBER_DEL_MSG,
 | 
				
			||||||
	NSS_WIFI_VDEV_MAX_MSG
 | 
						NSS_WIFI_VDEV_MAX_MSG
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -128,6 +130,15 @@ enum nss_wifi_vdev_err_types {
 | 
				
			|||||||
	NSS_WIFI_VDEV_VLAN_MODE_CONFIG_FAIL,
 | 
						NSS_WIFI_VDEV_VLAN_MODE_CONFIG_FAIL,
 | 
				
			||||||
	NSS_WIFI_VDEV_RECOVERY_RESET_FAIL,
 | 
						NSS_WIFI_VDEV_RECOVERY_RESET_FAIL,
 | 
				
			||||||
	NSS_WIFI_VDEV_RECOVERY_RECONF_FAIL,
 | 
						NSS_WIFI_VDEV_RECOVERY_RECONF_FAIL,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_CONFIG_GROUP_KEY_FAIL,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_MULTIPASS_NOT_ENABLED,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_ALLOC_VLAN_MAP_FAILED,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_MTU_CHANGE_FAIL,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_MAC_ADDR_CHANGE_FAIL,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_PPE_PORT_CREATE_FAIL,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_PPE_PORT_DESTROY_FAIL,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_PPE_VSI_ASSIGN_FAIL,
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_PPE_VSI_UNASSIGN_FAIL,
 | 
				
			||||||
	NSS_WIFI_VDEV_EINV_MAX_CFG
 | 
						NSS_WIFI_VDEV_EINV_MAX_CFG
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -150,6 +161,11 @@ enum nss_wifi_vdev_ext_data_pkt_type {
 | 
				
			|||||||
	NSS_WIFI_VDEV_EXT_TX_COMPL_PKT_TYPE = 11,	/**< Tx completion. */
 | 
						NSS_WIFI_VDEV_EXT_TX_COMPL_PKT_TYPE = 11,	/**< Tx completion. */
 | 
				
			||||||
	NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_WDS_LEARN = 12,	/**< WDS source port learning command. */
 | 
						NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_WDS_LEARN = 12,	/**< WDS source port learning command. */
 | 
				
			||||||
	NSS_WIFI_VDEV_EXT_DATA_PPDU_INFO = 13,		/**< PPDU metadata information. */
 | 
						NSS_WIFI_VDEV_EXT_DATA_PPDU_INFO = 13,		/**< PPDU metadata information. */
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_MCBC_RX = 14,	/**< Multicast/broadcast packet received. */
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_MESH_EXT_DATA_PKT_TYPE_RX_SPL_PACKET = 15,
 | 
				
			||||||
 | 
												/**< Mesh link VAP special packet. */
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_MESH_EXT_DATA_PKT_TYPE_RX_MCAST_EXC = 16,
 | 
				
			||||||
 | 
												/**< Mesh link VAP multicast packet. */
 | 
				
			||||||
	NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_MAX
 | 
						NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_MAX
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -185,6 +201,9 @@ enum nss_wifi_vdev_cmd {
 | 
				
			|||||||
	NSS_WIFI_VDEV_ENABLE_IGMP_ME_CMD,	/**< Configuration to set IGMP multicast enhancement on VAP. */
 | 
						NSS_WIFI_VDEV_ENABLE_IGMP_ME_CMD,	/**< Configuration to set IGMP multicast enhancement on VAP. */
 | 
				
			||||||
	NSS_WIFI_VDEV_CFG_WDS_BACKHAUL_CMD,
 | 
						NSS_WIFI_VDEV_CFG_WDS_BACKHAUL_CMD,
 | 
				
			||||||
					/**< Configuration to set WDS backhaul extension on VAP. */
 | 
										/**< Configuration to set WDS backhaul extension on VAP. */
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_CFG_MCBC_EXC_TO_HOST_CMD, /**< Configuration to set multicast/broadcast exception to host on VAP. */
 | 
				
			||||||
 | 
						NSS_WIFI_VDEV_CFG_PEER_AUTHORIZE_CMD,
 | 
				
			||||||
 | 
										/**< Configuration to enable peer authorization on VAP. */
 | 
				
			||||||
	NSS_WIFI_VDEV_MAX_CMD
 | 
						NSS_WIFI_VDEV_MAX_CMD
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -220,6 +239,11 @@ enum nss_wifi_vdev_vlan_tagging_mode {
 | 
				
			|||||||
	NSS_WIFI_VDEV_VLAN_MAX		/**< Wi-Fi maximum VLAN support type. */
 | 
						NSS_WIFI_VDEV_VLAN_MAX		/**< Wi-Fi maximum VLAN support type. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum vap_ext_mode {
 | 
				
			||||||
 | 
						WIFI_VDEV_EXT_MODE_MESH_LINK = 1,	/* Wi-Fi mesh VAP mode */
 | 
				
			||||||
 | 
						WIFI_VDEV_EXT_MODE_MAX,			/* Wi-Fi maximum VAP mode */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_wifi_vdev_config_msg
 | 
					 * nss_wifi_vdev_config_msg
 | 
				
			||||||
 *	Virtual device configuration.
 | 
					 *	Virtual device configuration.
 | 
				
			||||||
@@ -246,7 +270,8 @@ struct nss_wifi_vdev_config_msg {
 | 
				
			|||||||
	uint8_t is_wrap;		/**< Specifies whether the VAP is a WRAP-AP. */
 | 
						uint8_t is_wrap;		/**< Specifies whether the VAP is a WRAP-AP. */
 | 
				
			||||||
	uint8_t is_nss_qwrap_en;	/**< VAP is configured for NSS firmware QWRAP logic. */
 | 
						uint8_t is_nss_qwrap_en;	/**< VAP is configured for NSS firmware QWRAP logic. */
 | 
				
			||||||
	uint8_t tx_per_pkt_vdev_id_check;	/**< Transmit per-packet virtual device ID check. */
 | 
						uint8_t tx_per_pkt_vdev_id_check;	/**< Transmit per-packet virtual device ID check. */
 | 
				
			||||||
	uint8_t reserved;		/**< Reserved for 4-byte alignment padding. */
 | 
						uint8_t align_pad;		/**< Reserved field. */
 | 
				
			||||||
 | 
						uint32_t vap_ext_mode;		/**< Different VAP extended modes. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -435,6 +460,66 @@ struct nss_wifi_vdev_me_snptbl_grp_mbr_update_msg {
 | 
				
			|||||||
				/**< Source IP address. */
 | 
									/**< Source IP address. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifi_vdev_me_hmmc_add_msg
 | 
				
			||||||
 | 
					 *	Information for adding an entry into the host-managed multicast list.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifi_vdev_me_hmmc_add_msg {
 | 
				
			||||||
 | 
						uint32_t ether_type;	/**< IPv4 or IPv6. */
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							uint32_t ipv4_addr;
 | 
				
			||||||
 | 
								/**< IPv4 multicast group address. */
 | 
				
			||||||
 | 
							uint8_t ipv6_addr[NSS_WIFI_VDEV_IPV6_ADDR_LENGTH];
 | 
				
			||||||
 | 
								/**< IPv6 multicast group address. */
 | 
				
			||||||
 | 
						} u;	/**< Type of group addresses. */
 | 
				
			||||||
 | 
						uint32_t netmask;	/**< IP subnet netmask. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifi_vdev_me_hmmc_del_msg
 | 
				
			||||||
 | 
					 *	Information for deleting an entry from the host-managed multicast list.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifi_vdev_me_hmmc_del_msg {
 | 
				
			||||||
 | 
						uint32_t ether_type;	/**< IPv4 or IPv6. */
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							uint32_t ipv4_addr;
 | 
				
			||||||
 | 
								/**< IPv4 multicast group address. */
 | 
				
			||||||
 | 
							uint8_t ipv6_addr[NSS_WIFI_VDEV_IPV6_ADDR_LENGTH];
 | 
				
			||||||
 | 
								/**< IPv6 multicast group address. */
 | 
				
			||||||
 | 
						} u;	/**< Type of group addresses. */
 | 
				
			||||||
 | 
						uint32_t netmask;	/**< IP subnet netmask. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifi_vdev_me_deny_ip_add_msg
 | 
				
			||||||
 | 
					 *	Information for adding an entry into the deny list.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifi_vdev_me_deny_ip_add_msg {
 | 
				
			||||||
 | 
						uint32_t ether_type;	/**< IPv4 or IPv6. */
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							uint32_t ipv4_addr;
 | 
				
			||||||
 | 
								/**< IPv4 multicast group address. */
 | 
				
			||||||
 | 
							uint8_t ipv6_addr[NSS_WIFI_VDEV_IPV6_ADDR_LENGTH];
 | 
				
			||||||
 | 
								/**< IPv6 multicast group address. */
 | 
				
			||||||
 | 
						} u;	/**< Type of group addresses. */
 | 
				
			||||||
 | 
						uint32_t netmask;	/**< IP subnet netmask. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifi_vdev_me_deny_ip_del_msg
 | 
				
			||||||
 | 
					 *	Information for deleting an entry from the deny list.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifi_vdev_me_deny_ip_del_msg {
 | 
				
			||||||
 | 
						uint32_t ether_type;	/**< IPv4 or IPv6. */
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							uint32_t ipv4_addr;
 | 
				
			||||||
 | 
								/**< IPv4 multicast group address. */
 | 
				
			||||||
 | 
							uint8_t ipv6_addr[NSS_WIFI_VDEV_IPV6_ADDR_LENGTH];
 | 
				
			||||||
 | 
								/**< IPv6 multicast group address. */
 | 
				
			||||||
 | 
						} u;	/**< Type of group addresses. */
 | 
				
			||||||
 | 
						uint32_t netmask;	/**< IP subnet netmask. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_wifi_vdev_me_snptbl_deny_grp_add_msg
 | 
					 * nss_wifi_vdev_me_snptbl_deny_grp_add_msg
 | 
				
			||||||
 *	Information for adding a snooplist member to a deny list.
 | 
					 *	Information for adding a snooplist member to a deny list.
 | 
				
			||||||
@@ -952,6 +1037,8 @@ struct nss_wifi_vdev_stats_sync_msg {
 | 
				
			|||||||
	uint32_t rx_mcast_bytes;		/**< Receive multicast bytes count. */
 | 
						uint32_t rx_mcast_bytes;		/**< Receive multicast bytes count. */
 | 
				
			||||||
	uint32_t rx_decrypt_err;		/**< Receive decryption error */
 | 
						uint32_t rx_decrypt_err;		/**< Receive decryption error */
 | 
				
			||||||
	uint32_t rx_mic_err;			/**< Receive MIC error */
 | 
						uint32_t rx_mic_err;			/**< Receive MIC error */
 | 
				
			||||||
 | 
						uint32_t mcbc_exc_host_fail_cnt;
 | 
				
			||||||
 | 
								/**< Number of multicast/broadcast packets failed to send to host through exception path. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -982,7 +1069,15 @@ struct nss_wifi_vdev_msg {
 | 
				
			|||||||
		struct nss_wifi_vdev_me_snptbl_grp_mbr_update_msg vdev_grp_member_update;
 | 
							struct nss_wifi_vdev_me_snptbl_grp_mbr_update_msg vdev_grp_member_update;
 | 
				
			||||||
				/**< Updates a snooplist group member. */
 | 
									/**< Updates a snooplist group member. */
 | 
				
			||||||
		struct nss_wifi_vdev_me_snptbl_deny_grp_add_msg vdev_deny_member_add;
 | 
							struct nss_wifi_vdev_me_snptbl_deny_grp_add_msg vdev_deny_member_add;
 | 
				
			||||||
				/**< Adds a snooplist member to a deny list. */
 | 
									/**< Add a snooplist member to the deny list. */
 | 
				
			||||||
 | 
							struct nss_wifi_vdev_me_hmmc_add_msg vdev_hmmc_member_add;
 | 
				
			||||||
 | 
									/**< Adds a new member into the HMMC list. */
 | 
				
			||||||
 | 
							struct nss_wifi_vdev_me_hmmc_del_msg vdev_hmmc_member_del;
 | 
				
			||||||
 | 
									/**< Delete a member from the HMMC list. */
 | 
				
			||||||
 | 
							struct nss_wifi_vdev_me_deny_ip_add_msg vdev_deny_list_member_add;
 | 
				
			||||||
 | 
									/**< Adds a new member into the deny list. */
 | 
				
			||||||
 | 
							struct nss_wifi_vdev_me_deny_ip_del_msg vdev_deny_list_member_del;
 | 
				
			||||||
 | 
									/**< Delete a member from the deny list. */
 | 
				
			||||||
		struct nss_wifi_vdev_txmsg vdev_txmsgext;
 | 
							struct nss_wifi_vdev_txmsg vdev_txmsgext;
 | 
				
			||||||
				/**< Transmits special data. */
 | 
									/**< Transmits special data. */
 | 
				
			||||||
		struct nss_wifi_vdev_vow_dbg_cfg_msg vdev_vow_dbg_cfg;
 | 
							struct nss_wifi_vdev_vow_dbg_cfg_msg vdev_vow_dbg_cfg;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -62,7 +62,7 @@
 | 
				
			|||||||
				/**< Maximum number of bandwidth supported. */
 | 
									/**< Maximum number of bandwidth supported. */
 | 
				
			||||||
#define NSS_WIFILI_REPT_MU_MIMO 1
 | 
					#define NSS_WIFILI_REPT_MU_MIMO 1
 | 
				
			||||||
#define NSS_WIFILI_REPT_MU_OFDMA_MIMO 3
 | 
					#define NSS_WIFILI_REPT_MU_OFDMA_MIMO 3
 | 
				
			||||||
#define NSS_WIFILI_MAX_RESERVED_TYPE 3
 | 
					#define NSS_WIFILI_MAX_RESERVED_TYPE 2
 | 
				
			||||||
				/**< Maximum reserved type. */
 | 
									/**< Maximum reserved type. */
 | 
				
			||||||
#define NSS_WIFILI_SOC_PER_PACKET_METADATA_SIZE 60
 | 
					#define NSS_WIFILI_SOC_PER_PACKET_METADATA_SIZE 60
 | 
				
			||||||
				/**< Metadata area total size. */
 | 
									/**< Metadata area total size. */
 | 
				
			||||||
@@ -95,6 +95,11 @@
 | 
				
			|||||||
#define NSS_WIFILI_WBM_INTERNAL_ERR_MAX 5
 | 
					#define NSS_WIFILI_WBM_INTERNAL_ERR_MAX 5
 | 
				
			||||||
				/**< WBM internal maximum errors. */
 | 
									/**< WBM internal maximum errors. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Peer Size in Bytes
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define NSS_WIFILI_PEER_SIZE 1600
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Radio specific flags
 | 
					 * Radio specific flags
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -105,6 +110,27 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
#define NSS_WIFILI_PEER_MSG_DISABLE_4ADDR 0x01
 | 
					#define NSS_WIFILI_PEER_MSG_DISABLE_4ADDR 0x01
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __KERNEL__ /* only kernel will use. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Wireless Multimedia Extention Access Category to TID. @hideinitializer
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define NSS_WIFILI_WME_AC_TO_TID(_ac) (	\
 | 
				
			||||||
 | 
							((_ac) == NSS_WIFILI_WME_AC_VO) ? 6 : \
 | 
				
			||||||
 | 
							(((_ac) == NSS_WIFILI_WME_AC_VI) ? 5 : \
 | 
				
			||||||
 | 
							(((_ac) == NSS_WIFILI_WME_AC_BK) ? 1 : \
 | 
				
			||||||
 | 
							0)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Wireless TID to Wireless Extension Multimedia Access Category. @hideinitializer
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define NSS_WIFILI_TID_TO_WME_AC(_tid) (	\
 | 
				
			||||||
 | 
							(((_tid) == 0) || ((_tid) == 3)) ? NSS_WIFILI_WME_AC_BE : \
 | 
				
			||||||
 | 
							((((_tid) == 1) || ((_tid) == 2)) ? NSS_WIFILI_WME_AC_BK : \
 | 
				
			||||||
 | 
							((((_tid) == 4) || ((_tid) == 5)) ? NSS_WIFILI_WME_AC_VI : \
 | 
				
			||||||
 | 
							NSS_WIFILI_WME_AC_VO)))
 | 
				
			||||||
 | 
					#endif /* __KERNEL */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_wifili_thread_scheme_id
 | 
					 * nss_wifili_thread_scheme_id
 | 
				
			||||||
 *	List of thread scheme IDs.
 | 
					 *	List of thread scheme IDs.
 | 
				
			||||||
@@ -209,6 +235,9 @@ enum nss_wifili_msg_types {
 | 
				
			|||||||
	NSS_WIFILI_PEER_EXT_STATS_MSG,
 | 
						NSS_WIFILI_PEER_EXT_STATS_MSG,
 | 
				
			||||||
	NSS_WIFILI_CLR_STATS,
 | 
						NSS_WIFILI_CLR_STATS,
 | 
				
			||||||
	NSS_WIFILI_PEER_4ADDR_EVENT_MSG,
 | 
						NSS_WIFILI_PEER_4ADDR_EVENT_MSG,
 | 
				
			||||||
 | 
						NSS_WIFILI_DBDC_REPEATER_LOOP_DETECTION_MSG,
 | 
				
			||||||
 | 
						NSS_WIFILI_PEER_UPDATE_AUTH_FLAG,
 | 
				
			||||||
 | 
						NSS_WIFILI_SEND_MESH_CAPABILITY_INFO,
 | 
				
			||||||
	NSS_WIFILI_MAX_MSG
 | 
						NSS_WIFILI_MAX_MSG
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -384,6 +413,7 @@ enum nss_wifili_radio_cmd {
 | 
				
			|||||||
	NSS_WIFILI_SET_FORCE_CLIENT_MCAST_TRAFFIC,	/**< Flag to force multicast traffic for a radio. */
 | 
						NSS_WIFILI_SET_FORCE_CLIENT_MCAST_TRAFFIC,	/**< Flag to force multicast traffic for a radio. */
 | 
				
			||||||
	NSS_WIFILI_SET_DROP_SECONDARY_MCAST,		/**< Flag to drop multicast traffic on secondary radio. */
 | 
						NSS_WIFILI_SET_DROP_SECONDARY_MCAST,		/**< Flag to drop multicast traffic on secondary radio. */
 | 
				
			||||||
	NSS_WIFILI_SET_DBDC_FASTLANE,			/**< Flag to set DBDC fast-lane mode. */
 | 
						NSS_WIFILI_SET_DBDC_FASTLANE,			/**< Flag to set DBDC fast-lane mode. */
 | 
				
			||||||
 | 
						NSS_WIFILI_SET_DBDC_NOBACKHAUL_RADIO,           /**< Flag to set DBDC to no backhaul radio. */
 | 
				
			||||||
	NSS_WIFILI_RADIO_MAX_CMD			/**< Maximum radio command index. */
 | 
						NSS_WIFILI_RADIO_MAX_CMD			/**< Maximum radio command index. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -680,6 +710,8 @@ struct nss_wifili_hal_srng_soc_msg {
 | 
				
			|||||||
			/**< Shadow read pointer address. */
 | 
								/**< Shadow read pointer address. */
 | 
				
			||||||
	uint32_t shadow_wrptr_mem_addr;
 | 
						uint32_t shadow_wrptr_mem_addr;
 | 
				
			||||||
			/**< Shadow write pointer address. */
 | 
								/**< Shadow write pointer address. */
 | 
				
			||||||
 | 
						uint32_t lmac_rings_start_id;
 | 
				
			||||||
 | 
								/**< start id of LMAC rings. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -1308,6 +1340,7 @@ struct nss_wifili_rx_err {
 | 
				
			|||||||
struct nss_wifili_rx_ctrl_stats {
 | 
					struct nss_wifili_rx_ctrl_stats {
 | 
				
			||||||
	struct nss_wifili_rx_err err;			/**< Rx peer errors. */
 | 
						struct nss_wifili_rx_err err;			/**< Rx peer errors. */
 | 
				
			||||||
	uint32_t multipass_rx_pkt_drop;         /**< Total number of multipass packets without a VLAN header. */
 | 
						uint32_t multipass_rx_pkt_drop;         /**< Total number of multipass packets without a VLAN header. */
 | 
				
			||||||
 | 
						uint32_t peer_unauth_rx_pkt_drop;		/**< Number of receive packets dropped due to an authorized peer. */
 | 
				
			||||||
	uint32_t reserved_type[NSS_WIFILI_MAX_RESERVED_TYPE];	/**< Reserved type for future use. */
 | 
						uint32_t reserved_type[NSS_WIFILI_MAX_RESERVED_TYPE];	/**< Reserved type for future use. */
 | 
				
			||||||
	uint32_t non_amsdu_cnt;			/**< Number of MSDUs with no MSDU level aggregation. */
 | 
						uint32_t non_amsdu_cnt;			/**< Number of MSDUs with no MSDU level aggregation. */
 | 
				
			||||||
	uint32_t amsdu_cnt;			/**< Number of MSDUs part of AMSDU. */
 | 
						uint32_t amsdu_cnt;			/**< Number of MSDUs part of AMSDU. */
 | 
				
			||||||
@@ -1560,6 +1593,14 @@ struct nss_wifili_peer_isolation_msg {
 | 
				
			|||||||
	uint16_t isolation;			/**< Isolation enabled/disabled. */
 | 
						uint16_t isolation;			/**< Isolation enabled/disabled. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifili_dbdc_repeater_loop_detection_msg
 | 
				
			||||||
 | 
					 *	Wifili DBDC repeater loop detection message.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifili_dbdc_repeater_loop_detection_msg {
 | 
				
			||||||
 | 
						bool dbdc_loop_detected;		/**< DBDC repeater loop detection flag. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_wifili_dbdc_repeater_set_msg
 | 
					 * nss_wifili_dbdc_repeater_set_msg
 | 
				
			||||||
 *	Wifili DBDC repeater set message.
 | 
					 *	Wifili DBDC repeater set message.
 | 
				
			||||||
@@ -1612,6 +1653,16 @@ struct nss_wifili_clr_stats_msg {
 | 
				
			|||||||
	uint8_t vdev_id;;	/**< VAP ID. */
 | 
						uint8_t vdev_id;;	/**< VAP ID. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifili_update_auth_flag
 | 
				
			||||||
 | 
					 * 	Peer authentication flag message.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifili_peer_update_auth_flag {
 | 
				
			||||||
 | 
						uint16_t peer_id;		/**< Peer ID. */
 | 
				
			||||||
 | 
						uint8_t auth_flag;		/**< Peer authentication flag. */
 | 
				
			||||||
 | 
						uint8_t reserved;		/**< Alignment padding. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_wifili_update_pdev_lmac_id_msg
 | 
					 * nss_wifili_update_pdev_lmac_id_msg
 | 
				
			||||||
 * 	Physical device ID and lower MAC ID update message.
 | 
					 * 	Physical device ID and lower MAC ID update message.
 | 
				
			||||||
@@ -1670,7 +1721,7 @@ struct nss_wifili_radio_cfg_msg {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * struct wifili_peer_wds_4addr_allow_msg
 | 
					 * struct wifili_peer_wds_4addr_allow_msg
 | 
				
			||||||
 *	Per peer four address configuration message.
 | 
					 *	Per-peer four address configuration message.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct nss_wifili_peer_wds_4addr_allow_msg {
 | 
					struct nss_wifili_peer_wds_4addr_allow_msg {
 | 
				
			||||||
	uint32_t peer_id;	/**< Peer ID. */
 | 
						uint32_t peer_id;	/**< Peer ID. */
 | 
				
			||||||
@@ -1678,6 +1729,14 @@ struct nss_wifili_peer_wds_4addr_allow_msg {
 | 
				
			|||||||
	bool enable;		/**< Boolean flag to enable/disable four address frames. */
 | 
						bool enable;		/**< Boolean flag to enable/disable four address frames. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * struct nss_wifili_mesh_capability_info
 | 
				
			||||||
 | 
					 * 	Wi-Fi mesh capability flag.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_wifili_mesh_capability_info {
 | 
				
			||||||
 | 
						bool mesh_enable;	/**< Wi-Fi mesh capability flag. */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_wifili_msg
 | 
					 * nss_wifili_msg
 | 
				
			||||||
 *	Structure that describes wifili messages.
 | 
					 *	Structure that describes wifili messages.
 | 
				
			||||||
@@ -1755,7 +1814,13 @@ struct nss_wifili_msg {
 | 
				
			|||||||
		struct nss_wifili_clr_stats_msg clrstats;
 | 
							struct nss_wifili_clr_stats_msg clrstats;
 | 
				
			||||||
				/**< Clear NSS firmware statistics. */
 | 
									/**< Clear NSS firmware statistics. */
 | 
				
			||||||
		struct nss_wifili_peer_wds_4addr_allow_msg wpswm;
 | 
							struct nss_wifili_peer_wds_4addr_allow_msg wpswm;
 | 
				
			||||||
				/**< Peer four address event message. */
 | 
									/**< Peer four-address event message. */
 | 
				
			||||||
 | 
							struct nss_wifili_dbdc_repeater_loop_detection_msg wdrldm;
 | 
				
			||||||
 | 
									/**< Wifili DBDC repeater loop detection message. */
 | 
				
			||||||
 | 
							struct nss_wifili_peer_update_auth_flag peer_auth;
 | 
				
			||||||
 | 
									/**< Peer authentication flag message. */
 | 
				
			||||||
 | 
							struct nss_wifili_mesh_capability_info cap_info;
 | 
				
			||||||
 | 
									/**< Mesh capability flag. */
 | 
				
			||||||
	} msg;			/**< Message payload. */
 | 
						} msg;			/**< Message payload. */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1900,7 +1965,21 @@ void nss_unregister_wifili_radio_if(uint32_t if_num);
 | 
				
			|||||||
 * @return
 | 
					 * @return
 | 
				
			||||||
 * External interface number.
 | 
					 * External interface number.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint32_t nss_get_available_wifili_external_if(void);
 | 
					nss_if_num_t nss_get_available_wifili_external_if(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_wifili_release_external_if
 | 
				
			||||||
 | 
					 *	Release the used interface number
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * nss_if_num
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] if_num             NSS interface number.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * void
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_wifili_release_external_if(nss_if_num_t ifnum);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * nss_wifili_thread_scheme_alloc
 | 
					 * nss_wifili_thread_scheme_alloc
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -48,17 +48,33 @@ struct nss_capwap_handle {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
static struct nss_capwap_handle *nss_capwap_hdl[NSS_MAX_DYNAMIC_INTERFACES];
 | 
					static struct nss_capwap_handle *nss_capwap_hdl[NSS_MAX_DYNAMIC_INTERFACES];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_capwap_get_interface_type()
 | 
				
			||||||
 | 
					 *	Function to get the type of dynamic interface.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static enum nss_dynamic_interface_type nss_capwap_get_interface_type(uint32_t if_num)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_ctx_instance *nss_ctx;
 | 
				
			||||||
 | 
						nss_ctx = &nss_top_main.nss[nss_top_main.capwap_handler_id];
 | 
				
			||||||
 | 
						NSS_VERIFY_CTX_MAGIC(nss_ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return nss_dynamic_interface_get_type(nss_ctx, if_num);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_capwap_verify_if_num()
 | 
					 * nss_capwap_verify_if_num()
 | 
				
			||||||
 *	Verify if_num passed to us.
 | 
					 *	Verify if_num passed to us.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static bool nss_capwap_verify_if_num(uint32_t if_num)
 | 
					static bool nss_capwap_verify_if_num(uint32_t if_num)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						enum nss_dynamic_interface_type type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (nss_is_dynamic_interface(if_num) == false) {
 | 
						if (nss_is_dynamic_interface(if_num) == false) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (nss_dynamic_interface_get_type(nss_capwap_get_ctx(), if_num) != NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP) {
 | 
						type = nss_capwap_get_interface_type(if_num);
 | 
				
			||||||
 | 
						if ((type != NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_HOST_INNER) && (type != NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_OUTER) ) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -88,10 +104,10 @@ static void nss_capwap_refcnt_dec(int32_t if_num)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_capwap_refcnt()
 | 
					 * nss_capwap_refcnt_get()
 | 
				
			||||||
 *	Get refcnt on the tunnel.
 | 
					 *	Get refcnt on the tunnel.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static uint32_t nss_capwap_refcnt(int32_t if_num)
 | 
					static uint32_t nss_capwap_refcnt_get(int32_t if_num)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if_num = if_num - NSS_DYNAMIC_IF_START;
 | 
						if_num = if_num - NSS_DYNAMIC_IF_START;
 | 
				
			||||||
	return atomic_read(&nss_capwap_hdl[if_num]->refcnt);
 | 
						return atomic_read(&nss_capwap_hdl[if_num]->refcnt);
 | 
				
			||||||
@@ -133,28 +149,40 @@ static nss_capwap_msg_callback_t nss_capwap_get_msg_callback(int32_t if_num, voi
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_capwapmgr_update_stats()
 | 
					 * nss_capwap_update_stats()
 | 
				
			||||||
 *	Update per-tunnel stats for each CAPWAP interface.
 | 
					 *	Update per-tunnel stats for each CAPWAP interface.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void nss_capwapmgr_update_stats(struct nss_capwap_handle *handle, struct nss_capwap_stats_msg *fstats)
 | 
					static void nss_capwap_update_stats(struct nss_capwap_handle *handle, struct nss_capwap_stats_msg *fstats)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct nss_capwap_tunnel_stats *stats;
 | 
						struct nss_capwap_tunnel_stats *stats;
 | 
				
			||||||
 | 
						enum nss_dynamic_interface_type type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	stats = &handle->stats;
 | 
						stats = &handle->stats;
 | 
				
			||||||
 | 
						type = nss_capwap_get_interface_type(handle->if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switch(type) {
 | 
				
			||||||
 | 
						case NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_OUTER:
 | 
				
			||||||
		stats->rx_segments += fstats->rx_segments;
 | 
							stats->rx_segments += fstats->rx_segments;
 | 
				
			||||||
		stats->dtls_pkts += fstats->dtls_pkts;
 | 
							stats->dtls_pkts += fstats->dtls_pkts;
 | 
				
			||||||
 | 
					 | 
				
			||||||
		stats->rx_dup_frag += fstats->rx_dup_frag;
 | 
							stats->rx_dup_frag += fstats->rx_dup_frag;
 | 
				
			||||||
		stats->rx_oversize_drops += fstats->rx_oversize_drops;
 | 
							stats->rx_oversize_drops += fstats->rx_oversize_drops;
 | 
				
			||||||
		stats->rx_frag_timeout_drops += fstats->rx_frag_timeout_drops;
 | 
							stats->rx_frag_timeout_drops += fstats->rx_frag_timeout_drops;
 | 
				
			||||||
	stats->rx_queue_full_drops += fstats->rx_queue_full_drops;
 | 
							stats->rx_n2h_drops += fstats->rx_n2h_drops;
 | 
				
			||||||
		stats->rx_n2h_queue_full_drops += fstats->rx_n2h_queue_full_drops;
 | 
							stats->rx_n2h_queue_full_drops += fstats->rx_n2h_queue_full_drops;
 | 
				
			||||||
		stats->rx_mem_failure_drops += fstats->rx_mem_failure_drops;
 | 
							stats->rx_mem_failure_drops += fstats->rx_mem_failure_drops;
 | 
				
			||||||
		stats->rx_csum_drops += fstats->rx_csum_drops;
 | 
							stats->rx_csum_drops += fstats->rx_csum_drops;
 | 
				
			||||||
		stats->rx_malformed += fstats->rx_malformed;
 | 
							stats->rx_malformed += fstats->rx_malformed;
 | 
				
			||||||
		stats->rx_frag_gap_drops += fstats->rx_frag_gap_drops;
 | 
							stats->rx_frag_gap_drops += fstats->rx_frag_gap_drops;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/*
 | 
				
			||||||
 | 
							 * Update pnode rx stats for OUTER node.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							stats->pnode_stats.rx_packets += fstats->pnode_stats.rx_packets;
 | 
				
			||||||
 | 
							stats->pnode_stats.rx_bytes += fstats->pnode_stats.rx_bytes;
 | 
				
			||||||
 | 
							stats->pnode_stats.rx_dropped += nss_cmn_rx_dropped_sum(&fstats->pnode_stats);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_HOST_INNER:
 | 
				
			||||||
		stats->tx_segments += fstats->tx_segments;
 | 
							stats->tx_segments += fstats->tx_segments;
 | 
				
			||||||
		stats->tx_queue_full_drops += fstats->tx_queue_full_drops;
 | 
							stats->tx_queue_full_drops += fstats->tx_queue_full_drops;
 | 
				
			||||||
		stats->tx_mem_failure_drops += fstats->tx_mem_failure_drops;
 | 
							stats->tx_mem_failure_drops += fstats->tx_mem_failure_drops;
 | 
				
			||||||
@@ -165,13 +193,18 @@ static void nss_capwapmgr_update_stats(struct nss_capwap_handle *handle, struct
 | 
				
			|||||||
		stats->tx_dropped_nwireless += fstats->tx_dropped_nwireless;
 | 
							stats->tx_dropped_nwireless += fstats->tx_dropped_nwireless;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
	 * add pnode stats now.
 | 
							 * Update pnode tx stats for INNER node.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
	stats->pnode_stats.rx_packets += fstats->pnode_stats.rx_packets;
 | 
					 | 
				
			||||||
	stats->pnode_stats.rx_bytes += fstats->pnode_stats.rx_bytes;
 | 
					 | 
				
			||||||
	stats->pnode_stats.rx_dropped += nss_cmn_rx_dropped_sum(&fstats->pnode_stats);
 | 
					 | 
				
			||||||
		stats->pnode_stats.tx_packets += fstats->pnode_stats.tx_packets;
 | 
							stats->pnode_stats.tx_packets += fstats->pnode_stats.tx_packets;
 | 
				
			||||||
		stats->pnode_stats.tx_bytes += fstats->pnode_stats.tx_bytes;
 | 
							stats->pnode_stats.tx_bytes += fstats->pnode_stats.tx_bytes;
 | 
				
			||||||
 | 
							stats->tx_dropped_inner += nss_cmn_rx_dropped_sum(&fstats->pnode_stats);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							nss_warning("%px: Received invalid dynamic interface type: %d", handle, type);
 | 
				
			||||||
 | 
							nss_assert(0);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Set to 1 when the tunnel is operating in fast memory.
 | 
						 * Set to 1 when the tunnel is operating in fast memory.
 | 
				
			||||||
@@ -217,7 +250,7 @@ static void nss_capwap_msg_handler(struct nss_ctx_instance *nss_ctx, struct nss_
 | 
				
			|||||||
				/*
 | 
									/*
 | 
				
			||||||
				 * Update driver statistics and send statistics notifications to the registered modules.
 | 
									 * Update driver statistics and send statistics notifications to the registered modules.
 | 
				
			||||||
				 */
 | 
									 */
 | 
				
			||||||
				nss_capwapmgr_update_stats(nss_capwap_hdl[if_num], &ntm->msg.stats);
 | 
									nss_capwap_update_stats(nss_capwap_hdl[if_num], &ntm->msg.stats);
 | 
				
			||||||
				nss_capwap_stats_notify(ncm->interface, nss_ctx->id);
 | 
									nss_capwap_stats_notify(ncm->interface, nss_ctx->id);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -262,16 +295,16 @@ static bool nss_capwap_instance_alloc(struct nss_ctx_instance *nss_ctx, uint32_t
 | 
				
			|||||||
	memset(h, 0, sizeof(struct nss_capwap_handle));
 | 
						memset(h, 0, sizeof(struct nss_capwap_handle));
 | 
				
			||||||
	h->if_num = if_num;
 | 
						h->if_num = if_num;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&nss_capwap_spinlock);
 | 
						spin_lock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
	if (nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] != NULL) {
 | 
						if (nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] != NULL) {
 | 
				
			||||||
		spin_unlock(&nss_capwap_spinlock);
 | 
							spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
		kfree(h);
 | 
							kfree(h);
 | 
				
			||||||
		nss_warning("%px: Another thread is already allocated instance for :%d", nss_ctx, if_num);
 | 
							nss_warning("%px: Another thread is already allocated instance for :%d", nss_ctx, if_num);
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] = h;
 | 
						nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] = h;
 | 
				
			||||||
	spin_unlock(&nss_capwap_spinlock);
 | 
						spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -299,14 +332,14 @@ nss_tx_status_t nss_capwap_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_c
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if_num = msg->cm.interface - NSS_DYNAMIC_IF_START;
 | 
						if_num = msg->cm.interface - NSS_DYNAMIC_IF_START;
 | 
				
			||||||
	spin_lock(&nss_capwap_spinlock);
 | 
						spin_lock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
	if (!nss_capwap_hdl[if_num]) {
 | 
						if (!nss_capwap_hdl[if_num]) {
 | 
				
			||||||
		spin_unlock(&nss_capwap_spinlock);
 | 
							spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
		nss_warning("%px: capwap tunnel if_num is not there: %d", nss_ctx, msg->cm.interface);
 | 
							nss_warning("%px: capwap tunnel if_num is not there: %d", nss_ctx, msg->cm.interface);
 | 
				
			||||||
		return NSS_TX_FAILURE_BAD_PARAM;
 | 
							return NSS_TX_FAILURE_BAD_PARAM;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	nss_capwap_refcnt_inc(msg->cm.interface);
 | 
						nss_capwap_refcnt_inc(msg->cm.interface);
 | 
				
			||||||
	spin_unlock(&nss_capwap_spinlock);
 | 
						spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Trace messages.
 | 
						 * Trace messages.
 | 
				
			||||||
@@ -348,14 +381,14 @@ bool nss_capwap_get_stats(uint32_t if_num, struct nss_capwap_tunnel_stats *stats
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if_num = if_num - NSS_DYNAMIC_IF_START;
 | 
						if_num = if_num - NSS_DYNAMIC_IF_START;
 | 
				
			||||||
	spin_lock(&nss_capwap_spinlock);
 | 
						spin_lock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
	if (nss_capwap_hdl[if_num] == NULL) {
 | 
						if (nss_capwap_hdl[if_num] == NULL) {
 | 
				
			||||||
		spin_unlock(&nss_capwap_spinlock);
 | 
							spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	memcpy(stats, &nss_capwap_hdl[if_num]->stats, sizeof(struct nss_capwap_tunnel_stats));
 | 
						memcpy(stats, &nss_capwap_hdl[if_num]->stats, sizeof(struct nss_capwap_tunnel_stats));
 | 
				
			||||||
	spin_unlock(&nss_capwap_spinlock);
 | 
						spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(nss_capwap_get_stats);
 | 
					EXPORT_SYMBOL(nss_capwap_get_stats);
 | 
				
			||||||
@@ -376,13 +409,13 @@ struct nss_ctx_instance *nss_capwap_notify_register(uint32_t if_num, nss_capwap_
 | 
				
			|||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&nss_capwap_spinlock);
 | 
						spin_lock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
	if (nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] != NULL) {
 | 
						if (nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] != NULL) {
 | 
				
			||||||
		spin_unlock(&nss_capwap_spinlock);
 | 
							spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
		nss_warning("%px: notfiy register tunnel already exists for interface %d", nss_ctx, if_num);
 | 
							nss_warning("%px: notfiy register tunnel already exists for interface %d", nss_ctx, if_num);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spin_unlock(&nss_capwap_spinlock);
 | 
						spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nss_ctx;
 | 
						return nss_ctx;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -410,9 +443,9 @@ nss_tx_status_t nss_capwap_notify_unregister(struct nss_ctx_instance *nss_ctx, u
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	index = if_num - NSS_DYNAMIC_IF_START;
 | 
						index = if_num - NSS_DYNAMIC_IF_START;
 | 
				
			||||||
	spin_lock(&nss_capwap_spinlock);
 | 
						spin_lock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
	if (nss_capwap_hdl[index] == NULL) {
 | 
						if (nss_capwap_hdl[index] == NULL) {
 | 
				
			||||||
		spin_unlock(&nss_capwap_spinlock);
 | 
							spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
		nss_warning("%px: notify unregister received for unallocated if_num: %d", nss_ctx, if_num);
 | 
							nss_warning("%px: notify unregister received for unallocated if_num: %d", nss_ctx, if_num);
 | 
				
			||||||
		return NSS_TX_FAILURE_BAD_PARAM;
 | 
							return NSS_TX_FAILURE_BAD_PARAM;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -421,14 +454,14 @@ nss_tx_status_t nss_capwap_notify_unregister(struct nss_ctx_instance *nss_ctx, u
 | 
				
			|||||||
	 * It's the responsibility of caller to wait and call us again. We return failure saying
 | 
						 * It's the responsibility of caller to wait and call us again. We return failure saying
 | 
				
			||||||
	 * that we can't remove msg handler now.
 | 
						 * that we can't remove msg handler now.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (nss_capwap_refcnt(if_num) != 0) {
 | 
						if (nss_capwap_refcnt_get(if_num) != 0) {
 | 
				
			||||||
		spin_unlock(&nss_capwap_spinlock);
 | 
							spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
		nss_warning("%px: notify unregister tunnel %d: has reference", nss_ctx, if_num);
 | 
							nss_warning("%px: notify unregister tunnel %d: has reference", nss_ctx, if_num);
 | 
				
			||||||
		return NSS_TX_FAILURE_QUEUE;
 | 
							return NSS_TX_FAILURE_QUEUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	nss_capwap_set_msg_callback(if_num, NULL, NULL);
 | 
						nss_capwap_set_msg_callback(if_num, NULL, NULL);
 | 
				
			||||||
	spin_unlock(&nss_capwap_spinlock);
 | 
						spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return NSS_TX_SUCCESS;
 | 
						return NSS_TX_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -449,12 +482,12 @@ struct nss_ctx_instance *nss_capwap_data_register(uint32_t if_num, nss_capwap_bu
 | 
				
			|||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&nss_capwap_spinlock);
 | 
						spin_lock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
	if (nss_ctx->subsys_dp_register[if_num].ndev != NULL) {
 | 
						if (nss_ctx->subsys_dp_register[if_num].ndev != NULL) {
 | 
				
			||||||
		spin_unlock(&nss_capwap_spinlock);
 | 
							spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spin_unlock(&nss_capwap_spinlock);
 | 
						spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	core_status = nss_core_register_handler(nss_ctx, if_num, nss_capwap_msg_handler, NULL);
 | 
						core_status = nss_core_register_handler(nss_ctx, if_num, nss_capwap_msg_handler, NULL);
 | 
				
			||||||
	if (core_status != NSS_CORE_STATUS_SUCCESS) {
 | 
						if (core_status != NSS_CORE_STATUS_SUCCESS) {
 | 
				
			||||||
@@ -488,18 +521,18 @@ bool nss_capwap_data_unregister(uint32_t if_num)
 | 
				
			|||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&nss_capwap_spinlock);
 | 
						spin_lock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * It's the responsibility of caller to wait and call us again.
 | 
						 * It's the responsibility of caller to wait and call us again.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (nss_capwap_refcnt(if_num) != 0) {
 | 
						if (nss_capwap_refcnt_get(if_num) != 0) {
 | 
				
			||||||
		spin_unlock(&nss_capwap_spinlock);
 | 
							spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
		nss_warning("%px: notify unregister tunnel %d: has reference", nss_ctx, if_num);
 | 
							nss_warning("%px: notify unregister tunnel %d: has reference", nss_ctx, if_num);
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	h = nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START];
 | 
						h = nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START];
 | 
				
			||||||
	nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] = NULL;
 | 
						nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] = NULL;
 | 
				
			||||||
	spin_unlock(&nss_capwap_spinlock);
 | 
						spin_unlock_bh(&nss_capwap_spinlock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(void) nss_core_unregister_handler(nss_ctx, if_num);
 | 
						(void) nss_core_unregister_handler(nss_ctx, if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,7 +50,7 @@ static ssize_t nss_capwap_stats_encap(char *line, int len, int i, struct nss_cap
 | 
				
			|||||||
		tcnt = s->tx_dropped_ver_mis;
 | 
							tcnt = s->tx_dropped_ver_mis;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case 5:
 | 
						case 5:
 | 
				
			||||||
		tcnt = 0;
 | 
							tcnt = s->tx_dropped_inner;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case 6:
 | 
						case 6:
 | 
				
			||||||
		tcnt = s->tx_dropped_hroom;
 | 
							tcnt = s->tx_dropped_hroom;
 | 
				
			||||||
@@ -114,7 +114,7 @@ static ssize_t nss_capwap_stats_decap(char *line, int len, int i, struct nss_cap
 | 
				
			|||||||
		tcnt = s->rx_frag_gap_drops;
 | 
							tcnt = s->rx_frag_gap_drops;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case 9:
 | 
						case 9:
 | 
				
			||||||
		tcnt = s->rx_queue_full_drops;
 | 
							tcnt = s->rx_n2h_drops;
 | 
				
			||||||
		return snprintf(line, len, "%s = %llu (n2h = %llu)\n", nss_capwap_strings_decap_stats[i].stats_name, tcnt, s->rx_n2h_queue_full_drops);
 | 
							return snprintf(line, len, "%s = %llu (n2h = %llu)\n", nss_capwap_strings_decap_stats[i].stats_name, tcnt, s->rx_n2h_queue_full_drops);
 | 
				
			||||||
	case 10:
 | 
						case 10:
 | 
				
			||||||
		tcnt = s->rx_n2h_queue_full_drops;
 | 
							tcnt = s->rx_n2h_queue_full_drops;
 | 
				
			||||||
@@ -166,12 +166,22 @@ static ssize_t nss_capwap_stats_read(struct file *fp, char __user *ubuf, size_t
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	for (; if_num <= max_if_num; if_num++) {
 | 
						for (; if_num <= max_if_num; if_num++) {
 | 
				
			||||||
		bool isthere;
 | 
							bool isthere;
 | 
				
			||||||
 | 
							enum nss_dynamic_interface_type dtype;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (nss_is_dynamic_interface(if_num) == false) {
 | 
							if (nss_is_dynamic_interface(if_num) == false) {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (nss_dynamic_interface_get_type(nss_capwap_get_ctx(), if_num) != NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP) {
 | 
							dtype = nss_dynamic_interface_get_type(nss_capwap_get_ctx(), if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/*
 | 
				
			||||||
 | 
							 * Read encap stats from inner node and decap stats from outer node.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							if ((type == 1) && (dtype != NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_HOST_INNER)) {
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if ((type == 0) && (dtype != NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_OUTER)) {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ struct nss_stats_info nss_capwap_strings_encap_stats[NSS_CAPWAP_STATS_ENCAP_MAX]
 | 
				
			|||||||
	{"tx_segments",		NSS_STATS_TYPE_SPECIAL},
 | 
						{"tx_segments",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
	{"tx_drop_seg_ref",	NSS_STATS_TYPE_DROP},
 | 
						{"tx_drop_seg_ref",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"tx_drop_ver_mismatch",NSS_STATS_TYPE_DROP},
 | 
						{"tx_drop_ver_mismatch",NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"tx_drop_unalign",	NSS_STATS_TYPE_DROP},
 | 
						{"tx_dropped_inner",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"tx_drop_hroom",	NSS_STATS_TYPE_DROP},
 | 
						{"tx_drop_hroom",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"tx_drop_DTLS",	NSS_STATS_TYPE_DROP},
 | 
						{"tx_drop_DTLS",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"tx_drop_nwireless",	NSS_STATS_TYPE_DROP},
 | 
						{"tx_drop_nwireless",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
@@ -69,7 +69,7 @@ struct nss_stats_info nss_capwap_strings_decap_stats[NSS_CAPWAP_STATS_DECAP_MAX]
 | 
				
			|||||||
	{"rx_drop_frag_timeout",NSS_STATS_TYPE_DROP},
 | 
						{"rx_drop_frag_timeout",NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"rx_drop_frag_dup",	NSS_STATS_TYPE_DROP},
 | 
						{"rx_drop_frag_dup",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"rx_drop_frag_gap",	NSS_STATS_TYPE_DROP},
 | 
						{"rx_drop_frag_gap",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"rx_drop_qfull",	NSS_STATS_TYPE_DROP},
 | 
						{"rx_drop_n2h",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"rx_drop_n2h_qfull",	NSS_STATS_TYPE_DROP},
 | 
						{"rx_drop_n2h_qfull",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"rx_drop_mem_fail",	NSS_STATS_TYPE_DROP},
 | 
						{"rx_drop_mem_fail",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"rx_drop_csum",	NSS_STATS_TYPE_DROP},
 | 
						{"rx_drop_csum",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -23,6 +23,7 @@
 | 
				
			|||||||
#include "nss_cmn.h"
 | 
					#include "nss_cmn.h"
 | 
				
			||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
#include "nss_clmap_stats.h"
 | 
					#include "nss_clmap_stats.h"
 | 
				
			||||||
 | 
					#include "nss_clmap_strings.h"
 | 
				
			||||||
#include "nss_clmap_log.h"
 | 
					#include "nss_clmap_log.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NSS_CLMAP_TX_TIMEOUT 3000
 | 
					#define NSS_CLMAP_TX_TIMEOUT 3000
 | 
				
			||||||
@@ -106,6 +107,7 @@ static void nss_clmap_msg_handler(struct nss_ctx_instance *nss_ctx, struct nss_c
 | 
				
			|||||||
	switch (nclm->cm.type) {
 | 
						switch (nclm->cm.type) {
 | 
				
			||||||
	case NSS_CLMAP_MSG_TYPE_SYNC_STATS:
 | 
						case NSS_CLMAP_MSG_TYPE_SYNC_STATS:
 | 
				
			||||||
		nss_clmap_stats_sync(nss_ctx, &nclm->msg.stats, ncm->interface);
 | 
							nss_clmap_stats_sync(nss_ctx, &nclm->msg.stats, ncm->interface);
 | 
				
			||||||
 | 
							nss_clmap_stats_notify(nss_ctx, ncm->interface);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -336,7 +338,9 @@ EXPORT_SYMBOL(nss_clmap_get_ctx);
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
void nss_clmap_init()
 | 
					void nss_clmap_init()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nss_clmap_stats_dentry_create();
 | 
					 | 
				
			||||||
	sema_init(&clmap_pvt.sem, 1);
 | 
						sema_init(&clmap_pvt.sem, 1);
 | 
				
			||||||
	init_completion(&clmap_pvt.complete);
 | 
						init_completion(&clmap_pvt.complete);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						nss_clmap_stats_dentry_create();
 | 
				
			||||||
 | 
						nss_clmap_strings_dentry_create();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -15,8 +15,18 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
 | 
					#include "nss_clmap.h"
 | 
				
			||||||
#include "nss_clmap_stats.h"
 | 
					#include "nss_clmap_stats.h"
 | 
				
			||||||
 | 
					#include "nss_clmap_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Declare atomic notifier data structure for statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					ATOMIC_NOTIFIER_HEAD(nss_clmap_stats_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Spinlock to protect clmap statistics update/read
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
DEFINE_SPINLOCK(nss_clmap_stats_lock);
 | 
					DEFINE_SPINLOCK(nss_clmap_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct nss_clmap_stats *stats_db[NSS_CLMAP_MAX_DEBUG_INTERFACES] = {NULL};
 | 
					struct nss_clmap_stats *stats_db[NSS_CLMAP_MAX_DEBUG_INTERFACES] = {NULL};
 | 
				
			||||||
@@ -31,34 +41,23 @@ static char *nss_clmap_interface_type_str[NSS_CLMAP_INTERFACE_TYPE_MAX] = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_clmap_stats_str
 | 
					 * nss_clmap_stats_session_unregister
 | 
				
			||||||
 *	Clmap statistics strings for nss tunnel stats
 | 
					 *	Unregister debug statistic for clmap session.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static char *nss_clmap_stats_str[NSS_CLMAP_INTERFACE_STATS_MAX] = {
 | 
					void nss_clmap_stats_session_unregister(uint32_t if_num)
 | 
				
			||||||
	"rx_pkts",
 | 
					{
 | 
				
			||||||
	"rx_bytes",
 | 
						uint32_t i;
 | 
				
			||||||
	"tx_pkts",
 | 
					
 | 
				
			||||||
	"tx_bytes",
 | 
						spin_lock_bh(&nss_clmap_stats_lock);
 | 
				
			||||||
	"rx_queue_0_dropped",
 | 
						for (i = 0; i < NSS_CLMAP_MAX_DEBUG_INTERFACES; i++) {
 | 
				
			||||||
	"rx_queue_1_dropped",
 | 
							if (stats_db[i] && (stats_db[i]->nss_if_num == if_num)) {
 | 
				
			||||||
	"rx_queue_2_dropped",
 | 
								kfree(stats_db[i]);
 | 
				
			||||||
	"rx_queue_3_dropped",
 | 
								stats_db[i] = NULL;
 | 
				
			||||||
	"MAC DB look up failed",
 | 
								break;
 | 
				
			||||||
	"Invalid packet count",
 | 
							}
 | 
				
			||||||
	"Headroom drop",
 | 
						}
 | 
				
			||||||
	"Next node queue full drop",
 | 
						spin_unlock_bh(&nss_clmap_stats_lock);
 | 
				
			||||||
	"Pbuf alloc failed drop",
 | 
					}
 | 
				
			||||||
	"Linear failed drop",
 | 
					 | 
				
			||||||
	"Shared packet count",
 | 
					 | 
				
			||||||
	"Ethernet frame error",
 | 
					 | 
				
			||||||
	"Macdb create requests count",
 | 
					 | 
				
			||||||
	"Macdb create failures MAC exists count",
 | 
					 | 
				
			||||||
	"Macdb create failures MAC table full count",
 | 
					 | 
				
			||||||
	"Macdb destroy requests count",
 | 
					 | 
				
			||||||
	"Macdb destroy failures MAC not found count",
 | 
					 | 
				
			||||||
	"Macdb destroy failures MAC unhashed count",
 | 
					 | 
				
			||||||
	"Macdb flush requests count"
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_clmap_stats_session_register
 | 
					 * nss_clmap_stats_session_register
 | 
				
			||||||
@@ -94,25 +93,6 @@ bool nss_clmap_stats_session_register(uint32_t if_num, uint32_t if_type, struct
 | 
				
			|||||||
	return stats_status;
 | 
						return stats_status;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_clmap_stats_session_unregister
 | 
					 | 
				
			||||||
 * 	Unregister debug statistic for clmap session.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
void nss_clmap_stats_session_unregister(uint32_t if_num)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	uint32_t i;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_lock_bh(&nss_clmap_stats_lock);
 | 
					 | 
				
			||||||
	for (i = 0; i < NSS_CLMAP_MAX_DEBUG_INTERFACES; i++) {
 | 
					 | 
				
			||||||
		if (stats_db[i] && (stats_db[i]->nss_if_num == if_num)) {
 | 
					 | 
				
			||||||
			kfree(stats_db[i]);
 | 
					 | 
				
			||||||
			stats_db[i] = NULL;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	spin_unlock_bh(&nss_clmap_stats_lock);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_clmap_get_debug_stats()
 | 
					 * nss_clmap_get_debug_stats()
 | 
				
			||||||
 *	Get clmap debug statistics.
 | 
					 *	Get clmap debug statistics.
 | 
				
			||||||
@@ -142,12 +122,12 @@ static int nss_clmap_get_debug_stats(struct nss_clmap_stats *stats)
 | 
				
			|||||||
static ssize_t nss_clmap_stats_read(struct file *fp, char __user *ubuf,
 | 
					static ssize_t nss_clmap_stats_read(struct file *fp, char __user *ubuf,
 | 
				
			||||||
					size_t sz, loff_t *ppos)
 | 
										size_t sz, loff_t *ppos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint32_t max_output_lines = 2 + (NSS_CLMAP_INTERFACE_STATS_MAX * NSS_CLMAP_MAX_DEBUG_INTERFACES + 2) + 2;
 | 
						uint32_t max_output_lines = (NSS_CLMAP_INTERFACE_STATS_MAX * NSS_CLMAP_MAX_DEBUG_INTERFACES) + NSS_STATS_EXTRA_OUTPUT_LINES;
 | 
				
			||||||
	size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines;
 | 
						size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines;
 | 
				
			||||||
	size_t size_wr = 0;
 | 
						size_t size_wr = 0;
 | 
				
			||||||
	ssize_t bytes_read = 0;
 | 
						ssize_t bytes_read = 0;
 | 
				
			||||||
	struct net_device *dev;
 | 
						struct net_device *dev;
 | 
				
			||||||
	uint32_t id, i;
 | 
						uint32_t id;
 | 
				
			||||||
	struct nss_clmap_stats *clmap_stats = NULL;
 | 
						struct nss_clmap_stats *clmap_stats = NULL;
 | 
				
			||||||
	int interface_cnt;
 | 
						int interface_cnt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -171,8 +151,7 @@ static ssize_t nss_clmap_stats_read(struct file *fp, char __user *ubuf,
 | 
				
			|||||||
	 * Get clmap statistics.
 | 
						 * Get clmap statistics.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	interface_cnt = nss_clmap_get_debug_stats(clmap_stats);
 | 
						interface_cnt = nss_clmap_get_debug_stats(clmap_stats);
 | 
				
			||||||
	size_wr = scnprintf(lbuf + size_wr, size_al - size_wr,
 | 
						size_wr += nss_stats_banner(lbuf, size_wr, size_al, "clmap stats", NSS_STATS_SINGLE_CORE);
 | 
				
			||||||
			"\n clmap Interface statistics start:\n\n");
 | 
					 | 
				
			||||||
	for (id = 0; id < interface_cnt; id++) {
 | 
						for (id = 0; id < interface_cnt; id++) {
 | 
				
			||||||
		struct nss_clmap_stats *clmsp = clmap_stats + id;
 | 
							struct nss_clmap_stats *clmsp = clmap_stats + id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -190,16 +169,10 @@ static ssize_t nss_clmap_stats_read(struct file *fp, char __user *ubuf,
 | 
				
			|||||||
				clmsp->nss_if_num, nss_clmap_interface_type_str[clmsp->nss_if_type], dev->name);
 | 
									clmsp->nss_if_num, nss_clmap_interface_type_str[clmsp->nss_if_type], dev->name);
 | 
				
			||||||
		dev_put(dev);
 | 
							dev_put(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (i = 0; i < NSS_CLMAP_INTERFACE_STATS_MAX; i++) {
 | 
							size_wr += nss_stats_print("clmap", NULL, NSS_STATS_SINGLE_INSTANCE, nss_clmap_strings_stats,
 | 
				
			||||||
			size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
 | 
											clmsp->stats, NSS_CLMAP_INTERFACE_STATS_MAX, lbuf, size_wr, size_al);
 | 
				
			||||||
					"\t%s = %llu\n", nss_clmap_stats_str[i],
 | 
					 | 
				
			||||||
					clmsp->stats[i]);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
 | 
					 | 
				
			||||||
			"\n clmap Interface statistics end\n");
 | 
					 | 
				
			||||||
	bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, size_wr);
 | 
						bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, size_wr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kfree(clmap_stats);
 | 
						kfree(clmap_stats);
 | 
				
			||||||
@@ -272,3 +245,52 @@ void nss_clmap_stats_dentry_create(void)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	nss_stats_create_dentry("clmap", &nss_clmap_stats_ops);
 | 
						nss_stats_create_dentry("clmap", &nss_clmap_stats_ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_clmap_stats_notify()
 | 
				
			||||||
 | 
					 *	Sends notifications to all the registered modules.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Leverage NSS-FW statistics timing to update Netlink.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_clmap_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_clmap_stats_notification clmap_stats;
 | 
				
			||||||
 | 
						struct nss_clmap_stats *s = NULL;
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_clmap_stats_lock);
 | 
				
			||||||
 | 
						for (i = 0; i < NSS_CLMAP_MAX_DEBUG_INTERFACES; i++) {
 | 
				
			||||||
 | 
							if (!stats_db[i] || (stats_db[i]->nss_if_num != if_num)) {
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							s = stats_db[i];
 | 
				
			||||||
 | 
							clmap_stats.core_id = nss_ctx->id;
 | 
				
			||||||
 | 
							clmap_stats.if_num = if_num;
 | 
				
			||||||
 | 
							memcpy(clmap_stats.stats_ctx, s->stats, sizeof(clmap_stats.stats_ctx));
 | 
				
			||||||
 | 
							spin_unlock_bh(&nss_clmap_stats_lock);
 | 
				
			||||||
 | 
							atomic_notifier_call_chain(&nss_clmap_stats_notifier, NSS_STATS_EVENT_NOTIFY, &clmap_stats);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_clmap_stats_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_clmap_stats_unregister_notifier()
 | 
				
			||||||
 | 
					 *	Deregisters statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_clmap_stats_unregister_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_unregister(&nss_clmap_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_clmap_stats_unregister_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_clmap_stats_register_notifier()
 | 
				
			||||||
 | 
					 *	Registers statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_clmap_stats_register_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_register(&nss_clmap_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_clmap_stats_register_notifier);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 ******************************************************************************
 | 
					 ******************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -19,51 +19,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define NSS_CLMAP_MAX_DEBUG_INTERFACES 2 * NSS_CLMAP_MAX_INTERFACES
 | 
					#define NSS_CLMAP_MAX_DEBUG_INTERFACES 2 * NSS_CLMAP_MAX_INTERFACES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * Clmap NSS interface type.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_clmap_interface_type {
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_TYPE_US,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_TYPE_DS,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_TYPE_MAX
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * Clmap statistic counters.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_clmap_stats_type {
 | 
					 | 
				
			||||||
        NSS_CLMAP_INTERFACE_STATS_RX_PKTS,
 | 
					 | 
				
			||||||
        NSS_CLMAP_INTERFACE_STATS_RX_BYTES,
 | 
					 | 
				
			||||||
        NSS_CLMAP_INTERFACE_STATS_TX_PKTS,
 | 
					 | 
				
			||||||
        NSS_CLMAP_INTERFACE_STATS_TX_BYTES,
 | 
					 | 
				
			||||||
        NSS_CLMAP_INTERFACE_STATS_RX_QUEUE_0_DROPPED,
 | 
					 | 
				
			||||||
        NSS_CLMAP_INTERFACE_STATS_RX_QUEUE_1_DROPPED,
 | 
					 | 
				
			||||||
        NSS_CLMAP_INTERFACE_STATS_RX_QUEUE_2_DROPPED,
 | 
					 | 
				
			||||||
        NSS_CLMAP_INTERFACE_STATS_RX_QUEUE_3_DROPPED,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_DROPPED_MACDB_LOOKUP_FAILED,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_DROPPED_INVALID_PACKET_SIZE,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_DROPPED_LOW_HEADROOM,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_DROPPED_NEXT_NODE_QUEUE_FULL,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_DROPPED_PBUF_ALLOC_FAILED,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_DROPPED_LINEAR_FAILED,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_SHARED_PACKET_CNT,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_ETHERNET_FRAME_ERROR,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_MACDB_CREATE_REQUESTS_CNT,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_MACDB_CREATE_MAC_EXISTS_CNT,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_MACDB_CREATE_MAC_TABLE_FULL_CNT,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_MACDB_DESTROY_REQUESTS_CNT,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_MACDB_DESTROY_MAC_NOT_FOUND_CNT,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_MACDB_DESTROY_MAC_UNHASHED_CNT,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_MACDB_FLUSH_REQUESTS_CNT,
 | 
					 | 
				
			||||||
	NSS_CLMAP_INTERFACE_STATS_MAX,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Clmap session debug statistics.
 | 
					 * Clmap session debug statistics.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct nss_clmap_stats {
 | 
					struct nss_clmap_stats {
 | 
				
			||||||
	uint64_t stats[NSS_CLMAP_INTERFACE_STATS_MAX];
 | 
						uint64_t stats[NSS_CLMAP_INTERFACE_STATS_MAX];	/* Clmap statistics. */
 | 
				
			||||||
	int32_t if_index;
 | 
						int32_t if_index;				/* Interface index. */
 | 
				
			||||||
	uint32_t nss_if_num;				/* NSS interface number. */
 | 
						uint32_t nss_if_num;				/* NSS interface number. */
 | 
				
			||||||
	enum nss_clmap_interface_type nss_if_type;	/* NSS interface type. */
 | 
						enum nss_clmap_interface_type nss_if_type;	/* NSS interface type. */
 | 
				
			||||||
	bool valid;
 | 
						bool valid;
 | 
				
			||||||
@@ -72,6 +33,7 @@ struct nss_clmap_stats {
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Clmap statistics APIs.
 | 
					 * Clmap statistics APIs.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					extern void nss_clmap_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num);
 | 
				
			||||||
extern bool nss_clmap_stats_session_register(uint32_t if_num, enum nss_clmap_interface_type if_type, struct net_device *netdev);
 | 
					extern bool nss_clmap_stats_session_register(uint32_t if_num, enum nss_clmap_interface_type if_type, struct net_device *netdev);
 | 
				
			||||||
extern void nss_clmap_stats_session_unregister(uint32_t if_num);
 | 
					extern void nss_clmap_stats_session_unregister(uint32_t if_num);
 | 
				
			||||||
extern void nss_clmap_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_clmap_stats_msg *stats_msg, uint32_t if_num);
 | 
					extern void nss_clmap_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_clmap_stats_msg *stats_msg, uint32_t if_num);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										73
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_clmap_strings.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_clmap_strings.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_stats.h"
 | 
				
			||||||
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_strings.h"
 | 
				
			||||||
 | 
					#include "nss_clmap_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_clmap_strings_stats
 | 
				
			||||||
 | 
					 *	Clmap statistics strings for nss tunnel stats
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_stats_info nss_clmap_strings_stats[NSS_CLMAP_INTERFACE_STATS_MAX] = {
 | 
				
			||||||
 | 
						{"rx_pkts",					NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_bytes",					NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx_pkts",					NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx_bytes",					NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_queue_0_dropped",				NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_queue_1_dropped",				NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_queue_2_dropped",				NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_queue_3_dropped",				NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"MAC DB look up failed",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Invalid packet count",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Headroom drop",				NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Next node queue full drop",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Pbuf alloc failed drop",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Linear failed drop",				NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Shared packet count",				NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Ethernet frame error",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Macdb create requests count",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Macdb create failures MAC exists count",	NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Macdb create failures MAC table full count",	NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Macdb destroy requests count",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Macdb destroy failures MAC not found count",	NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Macdb destroy failures MAC unhashed count",	NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Macdb flush requests count",			NSS_STATS_TYPE_SPECIAL}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_clmap_strings_read()
 | 
				
			||||||
 | 
					 *	Read clmap statistics names
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_clmap_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return nss_strings_print(ubuf, sz, ppos, nss_clmap_strings_stats, NSS_CLMAP_INTERFACE_STATS_MAX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_clmap_strings_ops
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STRINGS_DECLARE_FILE_OPERATIONS(clmap);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_clmap_strings_dentry_create()
 | 
				
			||||||
 | 
					 *	Create clmap statistics strings debug entry.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_clmap_strings_dentry_create(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nss_strings_create_dentry("clmap", &nss_clmap_strings_ops);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_clmap_strings.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_clmap_strings.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_CLMAP_STRINGS_H
 | 
				
			||||||
 | 
					#define __NSS_CLMAP_STRINGS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_clmap_stats.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct nss_stats_info nss_clmap_strings_stats[NSS_CLMAP_INTERFACE_STATS_MAX];
 | 
				
			||||||
 | 
					extern void nss_clmap_strings_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_CLMAP_STRINGS_H */
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -197,8 +197,7 @@ bool nss_cmn_interface_is_redirect(struct nss_ctx_instance *nss_ctx, int32_t int
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	enum nss_dynamic_interface_type type = nss_dynamic_interface_get_type(nss_ctx, interface_num);
 | 
						enum nss_dynamic_interface_type type = nss_dynamic_interface_get_type(nss_ctx, interface_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return type == NSS_DYNAMIC_INTERFACE_TYPE_WIFI
 | 
						return type == NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_N2H
 | 
				
			||||||
		|| type == NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_N2H
 | 
					 | 
				
			||||||
		|| type == NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_H2N
 | 
							|| type == NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_H2N
 | 
				
			||||||
		|| type == NSS_DYNAMIC_INTERFACE_TYPE_VIRTIF_DEPRECATED;
 | 
							|| type == NSS_DYNAMIC_INTERFACE_TYPE_VIRTIF_DEPRECATED;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -1064,6 +1064,21 @@ static inline void nss_core_rx_pbuf(struct nss_ctx_instance *nss_ctx, struct n2h
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * 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_set_tc_classify_offload(nbuf);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_core_handle_nrfrag_skb()
 | 
					 * nss_core_handle_nrfrag_skb()
 | 
				
			||||||
 *	Handled the processing of fragmented skb's
 | 
					 *	Handled the processing of fragmented skb's
 | 
				
			||||||
@@ -1111,20 +1126,16 @@ static inline bool nss_core_handle_nr_frag_skb(struct nss_ctx_instance *nss_ctx,
 | 
				
			|||||||
		nbuf->len = payload_len;
 | 
							nbuf->len = payload_len;
 | 
				
			||||||
		nbuf->priority = desc->pri;
 | 
							nbuf->priority = desc->pri;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * TODO: Remove kernel version check when IGS is ported
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
 | 
					 | 
				
			||||||
#ifdef CONFIG_NET_CLS_ACT
 | 
					#ifdef CONFIG_NET_CLS_ACT
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * Skip the ingress QoS for the packet if the descriptor has
 | 
							 * Skip the ingress QoS for the packet if the descriptor has
 | 
				
			||||||
		 * ingress shaped flag set.
 | 
							 * ingress shaped flag set.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
 | 
							if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
 | 
				
			||||||
			nbuf->tc_verd = SET_TC_NCLS_NSS(nbuf->tc_verd);
 | 
								nss_core_set_skb_classify(nbuf);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					
 | 
				
			||||||
		goto pull;
 | 
							goto pull;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1156,19 +1167,14 @@ static inline bool nss_core_handle_nr_frag_skb(struct nss_ctx_instance *nss_ctx,
 | 
				
			|||||||
		nbuf->len = payload_len;
 | 
							nbuf->len = payload_len;
 | 
				
			||||||
		nbuf->priority = desc->pri;
 | 
							nbuf->priority = desc->pri;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * TODO: Remove kernel version check when IGS is ported
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
 | 
					 | 
				
			||||||
#ifdef CONFIG_NET_CLS_ACT
 | 
					#ifdef CONFIG_NET_CLS_ACT
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * Skip the ingress QoS for the packet if the descriptor has
 | 
							 * Skip the ingress QoS for the packet if the descriptor has
 | 
				
			||||||
		 * ingress shaped flag set.
 | 
							 * ingress shaped flag set.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
 | 
							if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
 | 
				
			||||||
			nbuf->tc_verd = SET_TC_NCLS_NSS(nbuf->tc_verd);
 | 
								nss_core_set_skb_classify(nbuf);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
@@ -1276,19 +1282,14 @@ static inline bool nss_core_handle_linear_skb(struct nss_ctx_instance *nss_ctx,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		nbuf->priority = desc->pri;
 | 
							nbuf->priority = desc->pri;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * TODO: Remove kernel version check when IGS is ported
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
 | 
					 | 
				
			||||||
#ifdef CONFIG_NET_CLS_ACT
 | 
					#ifdef CONFIG_NET_CLS_ACT
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * Skip the ingress QoS for the packet if the descriptor has
 | 
							 * Skip the ingress QoS for the packet if the descriptor has
 | 
				
			||||||
		 * ingress shaped flag set.
 | 
							 * ingress shaped flag set.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
 | 
							if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
 | 
				
			||||||
			nbuf->tc_verd = SET_TC_NCLS_NSS(nbuf->tc_verd);
 | 
								nss_core_set_skb_classify(nbuf);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
@@ -1339,19 +1340,14 @@ static inline bool nss_core_handle_linear_skb(struct nss_ctx_instance *nss_ctx,
 | 
				
			|||||||
		nbuf->truesize = desc->payload_len;
 | 
							nbuf->truesize = desc->payload_len;
 | 
				
			||||||
		nbuf->priority = desc->pri;
 | 
							nbuf->priority = desc->pri;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * TODO: Remove kernel version check when IGS is ported
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
 | 
					 | 
				
			||||||
#ifdef CONFIG_NET_CLS_ACT
 | 
					#ifdef CONFIG_NET_CLS_ACT
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * Skip the ingress QoS for the packet if the descriptor has
 | 
							 * Skip the ingress QoS for the packet if the descriptor has
 | 
				
			||||||
		 * ingress shaped flag set.
 | 
							 * ingress shaped flag set.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
 | 
							if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) {
 | 
				
			||||||
			nbuf->tc_verd = SET_TC_NCLS_NSS(nbuf->tc_verd);
 | 
								nss_core_set_skb_classify(nbuf);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		*head_ptr = nbuf;
 | 
							*head_ptr = nbuf;
 | 
				
			||||||
@@ -1735,9 +1731,11 @@ static void nss_core_init_nss(struct nss_ctx_instance *nss_ctx, struct nss_if_me
 | 
				
			|||||||
		 * connections supported by the accelerator.
 | 
							 * connections supported by the accelerator.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		nss_ipv4_conn_cfg = max_ipv4_conn;
 | 
							nss_ipv4_conn_cfg = max_ipv4_conn;
 | 
				
			||||||
 | 
					#ifdef NSS_DRV_IPV6_ENABLE
 | 
				
			||||||
		nss_ipv6_conn_cfg = max_ipv6_conn;
 | 
							nss_ipv6_conn_cfg = max_ipv6_conn;
 | 
				
			||||||
		nss_ipv4_update_conn_count(max_ipv4_conn);
 | 
					 | 
				
			||||||
		nss_ipv6_update_conn_count(max_ipv6_conn);
 | 
							nss_ipv6_update_conn_count(max_ipv6_conn);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
							nss_ipv4_update_conn_count(max_ipv4_conn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef NSS_MEM_PROFILE_LOW
 | 
					#ifdef NSS_MEM_PROFILE_LOW
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -568,6 +568,7 @@ struct nss_top_instance {
 | 
				
			|||||||
	uint8_t mirror_handler_id;
 | 
						uint8_t mirror_handler_id;
 | 
				
			||||||
	uint8_t wmdb_handler_id;
 | 
						uint8_t wmdb_handler_id;
 | 
				
			||||||
	uint8_t dma_handler_id;
 | 
						uint8_t dma_handler_id;
 | 
				
			||||||
 | 
						uint8_t udp_st_handler_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Data/Message callbacks for various interfaces
 | 
						 * Data/Message callbacks for various interfaces
 | 
				
			||||||
@@ -903,6 +904,8 @@ struct nss_platform_data {
 | 
				
			|||||||
				/* Does this core handle TLS Tunnel ? */
 | 
									/* Does this core handle TLS Tunnel ? */
 | 
				
			||||||
	enum nss_feature_enabled mirror_enabled;
 | 
						enum nss_feature_enabled mirror_enabled;
 | 
				
			||||||
				/* Does this core handle mirror? */
 | 
									/* Does this core handle mirror? */
 | 
				
			||||||
 | 
						enum nss_feature_enabled udp_st_enabled;
 | 
				
			||||||
 | 
									/* Does this core handle udp st? */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
#include "nss_crypto_cmn.h"
 | 
					#include "nss_crypto_cmn.h"
 | 
				
			||||||
 | 
					#include "nss_crypto_cmn_strings.h"
 | 
				
			||||||
 | 
					#include "nss_crypto_cmn_stats.h"
 | 
				
			||||||
#include "nss_crypto_cmn_log.h"
 | 
					#include "nss_crypto_cmn_log.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
@@ -94,6 +96,18 @@ static void nss_crypto_cmn_msg_handler(struct nss_ctx_instance *nss_ctx, struct
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	nss_crypto_cmn_log_rx_msg(nim);
 | 
						nss_crypto_cmn_log_rx_msg(nim);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switch (nim->cm.type) {
 | 
				
			||||||
 | 
						case NSS_CRYPTO_CMN_MSG_TYPE_SYNC_NODE_STATS:
 | 
				
			||||||
 | 
						case NSS_CRYPTO_CMN_MSG_TYPE_SYNC_ENG_STATS:
 | 
				
			||||||
 | 
						case NSS_CRYPTO_CMN_MSG_TYPE_SYNC_CTX_STATS:
 | 
				
			||||||
 | 
							/*
 | 
				
			||||||
 | 
							 * Update driver statistics and send statistics
 | 
				
			||||||
 | 
							 * notification to the registered modules.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							nss_crypto_cmn_stats_sync(nss_ctx, &nim->msg.stats);
 | 
				
			||||||
 | 
							nss_crypto_cmn_stats_notify(nss_ctx);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Load, Test & call
 | 
						 * Load, Test & call
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
@@ -357,6 +371,9 @@ void nss_crypto_cmn_register_handler(void)
 | 
				
			|||||||
	sema_init(&g_nss_crypto_cmn.sem, 1);
 | 
						sema_init(&g_nss_crypto_cmn.sem, 1);
 | 
				
			||||||
	init_completion(&g_nss_crypto_cmn.complete);
 | 
						init_completion(&g_nss_crypto_cmn.complete);
 | 
				
			||||||
	nss_core_register_handler(nss_ctx, NSS_CRYPTO_CMN_INTERFACE, nss_crypto_cmn_msg_handler, NULL);
 | 
						nss_core_register_handler(nss_ctx, NSS_CRYPTO_CMN_INTERFACE, nss_crypto_cmn_msg_handler, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						nss_crypto_cmn_stats_dentry_create();
 | 
				
			||||||
 | 
						nss_crypto_cmn_strings_dentry_create();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										166
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_crypto_cmn_stats.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										166
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_crypto_cmn_stats.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,166 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_crypto_cmn_stats.h"
 | 
				
			||||||
 | 
					#include "nss_crypto_cmn_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Declare atomic notifier data structure for statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					ATOMIC_NOTIFIER_HEAD(nss_crypto_cmn_stats_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Spinlock to protect CRYPTO_CMN statistics update/read
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					DEFINE_SPINLOCK(nss_crypto_cmn_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats
 | 
				
			||||||
 | 
					 *	crypto common statistics
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					uint64_t nss_crypto_cmn_stats[NSS_CRYPTO_CMN_STATS_MAX];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_read()
 | 
				
			||||||
 | 
					 *	Read crypto common statistics
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_crypto_cmn_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int32_t i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Max output lines = #stats +
 | 
				
			||||||
 | 
						 * few blank lines for banner printing + Number of Extra outputlines
 | 
				
			||||||
 | 
						 * for future reference to add new stats
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						uint32_t max_output_lines = NSS_CRYPTO_CMN_STATS_MAX + NSS_STATS_EXTRA_OUTPUT_LINES;
 | 
				
			||||||
 | 
						size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines;
 | 
				
			||||||
 | 
						size_t size_wr = 0;
 | 
				
			||||||
 | 
						ssize_t bytes_read = 0;
 | 
				
			||||||
 | 
						uint64_t *stats_shadow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char *lbuf = vzalloc(size_al);
 | 
				
			||||||
 | 
						if (unlikely(!lbuf)) {
 | 
				
			||||||
 | 
							nss_warning("Could not allocate memory for local statistics buffer");
 | 
				
			||||||
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						stats_shadow = vzalloc(NSS_CRYPTO_CMN_STATS_MAX * 8);
 | 
				
			||||||
 | 
						if (unlikely(!stats_shadow)) {
 | 
				
			||||||
 | 
							nss_warning("Could not allocate memory for local shadow buffer");
 | 
				
			||||||
 | 
							vfree(lbuf);
 | 
				
			||||||
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * crypto common statistics
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_crypto_cmn_stats_lock);
 | 
				
			||||||
 | 
						for (i = 0; i < NSS_CRYPTO_CMN_STATS_MAX; i++)
 | 
				
			||||||
 | 
							stats_shadow[i] = nss_crypto_cmn_stats[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_crypto_cmn_stats_lock);
 | 
				
			||||||
 | 
						size_wr += nss_stats_banner(lbuf, size_wr, size_al, "crypto_cmn", NSS_STATS_SINGLE_CORE);
 | 
				
			||||||
 | 
						size_wr += nss_stats_print("crypto_cmn", NULL, NSS_STATS_SINGLE_INSTANCE, nss_crypto_cmn_strings_stats,
 | 
				
			||||||
 | 
										stats_shadow, NSS_CRYPTO_CMN_STATS_MAX, lbuf, size_wr, size_al);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf));
 | 
				
			||||||
 | 
						vfree(lbuf);
 | 
				
			||||||
 | 
						vfree(stats_shadow);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return bytes_read;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_ops
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STATS_DECLARE_FILE_OPERATIONS(crypto_cmn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_dentry_create()
 | 
				
			||||||
 | 
					 *	Create crypto common statistics debug entry.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_crypto_cmn_stats_dentry_create(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nss_stats_create_dentry("crypto_cmn", &nss_crypto_cmn_stats_ops);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_sync()
 | 
				
			||||||
 | 
					 *	Handle the syncing of NSS crypto common statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_crypto_cmn_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_crypto_cmn_stats *nct)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int j;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_crypto_cmn_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Common node stats
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						nss_crypto_cmn_stats[NSS_STATS_NODE_RX_PKTS] += nct->nstats.rx_packets;
 | 
				
			||||||
 | 
						nss_crypto_cmn_stats[NSS_STATS_NODE_RX_BYTES] += nct->nstats.rx_bytes;
 | 
				
			||||||
 | 
						nss_crypto_cmn_stats[NSS_STATS_NODE_TX_PKTS] += nct->nstats.tx_packets;
 | 
				
			||||||
 | 
						nss_crypto_cmn_stats[NSS_STATS_NODE_TX_BYTES] += nct->nstats.tx_bytes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (j = 0; j < NSS_MAX_NUM_PRI; j++)
 | 
				
			||||||
 | 
							nss_crypto_cmn_stats[NSS_STATS_NODE_RX_QUEUE_0_DROPPED + j] += nct->nstats.rx_dropped[j];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * crypto common statistics
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						nss_crypto_cmn_stats[NSS_CRYPTO_CMN_STATS_FAIL_VERSION] += nct->fail_version;
 | 
				
			||||||
 | 
						nss_crypto_cmn_stats[NSS_CRYPTO_CMN_STATS_FAIL_CTX] += nct->fail_ctx;
 | 
				
			||||||
 | 
						nss_crypto_cmn_stats[NSS_CRYPTO_CMN_STATS_FAIL_DMA] += nct->fail_dma;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_crypto_cmn_stats_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_notify()
 | 
				
			||||||
 | 
					 *	Sends notifications to all the registered modules.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Leverage NSS-FW statistics timing to update Netlink.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_crypto_cmn_stats_notify(struct nss_ctx_instance *nss_ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_crypto_cmn_stats_notification crypto_cmn_stats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						crypto_cmn_stats.core_id = nss_ctx->id;
 | 
				
			||||||
 | 
						memcpy(crypto_cmn_stats.stats, nss_crypto_cmn_stats, sizeof(crypto_cmn_stats.stats));
 | 
				
			||||||
 | 
						atomic_notifier_call_chain(&nss_crypto_cmn_stats_notifier, NSS_STATS_EVENT_NOTIFY, &crypto_cmn_stats);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_register_notifier()
 | 
				
			||||||
 | 
					 *	Registers statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_crypto_cmn_stats_register_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_register(&nss_crypto_cmn_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_crypto_cmn_stats_register_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_unregister_notifier()
 | 
				
			||||||
 | 
					 *	Deregisters statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_crypto_cmn_stats_unregister_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_unregister(&nss_crypto_cmn_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_crypto_cmn_stats_unregister_notifier);
 | 
				
			||||||
							
								
								
									
										77
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_crypto_cmn_stats.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_crypto_cmn_stats.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,77 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ******************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 * ****************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_CRYPTO_CMN_STATS_H
 | 
				
			||||||
 | 
					#define __NSS_CRYPTO_CMN_STATS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nss_cmn.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_types
 | 
				
			||||||
 | 
					 *	crypto common transmission node statistics
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum nss_crypto_cmn_stats_types {
 | 
				
			||||||
 | 
						NSS_CRYPTO_CMN_STATS_FAIL_VERSION = NSS_STATS_NODE_MAX,	/* version mismatch failures */
 | 
				
			||||||
 | 
						NSS_CRYPTO_CMN_STATS_FAIL_CTX,				/* context related failures */
 | 
				
			||||||
 | 
						NSS_CRYPTO_CMN_STATS_FAIL_DMA,				/* dma descriptor full */
 | 
				
			||||||
 | 
						NSS_CRYPTO_CMN_STATS_MAX,				/* Maximum message type */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_notification
 | 
				
			||||||
 | 
					 *	crypto common transmission statistics structure
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_crypto_cmn_stats_notification {
 | 
				
			||||||
 | 
						uint32_t core_id;				/* core ID */
 | 
				
			||||||
 | 
						uint64_t stats[NSS_CRYPTO_CMN_STATS_MAX];	/* transmission statistics */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * crypto common statistics APIs
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern void nss_crypto_cmn_stats_notify(struct nss_ctx_instance *nss_ctx);
 | 
				
			||||||
 | 
					extern void nss_crypto_cmn_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_crypto_cmn_stats *nct);
 | 
				
			||||||
 | 
					extern void nss_crypto_cmn_stats_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_register_notifier
 | 
				
			||||||
 | 
					 *	Registers a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or -2 on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_crypto_cmn_stats_register_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_stats_unregister_notifier
 | 
				
			||||||
 | 
					 *	Deregisters a statistics notifier.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @datatypes
 | 
				
			||||||
 | 
					 * notifier_block
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param[in] nb Notifier block.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return
 | 
				
			||||||
 | 
					 * 0 on success or -2 on failure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern int nss_crypto_cmn_stats_unregister_notifier(struct notifier_block *nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_CRYPTO_CMN_STATS_H */
 | 
				
			||||||
							
								
								
									
										61
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_crypto_cmn_strings.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_crypto_cmn_strings.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_stats.h"
 | 
				
			||||||
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_strings.h"
 | 
				
			||||||
 | 
					#include "nss_crypto_cmn_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_strings_stats
 | 
				
			||||||
 | 
					 *	crypto common statistics strings.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_stats_info nss_crypto_cmn_strings_stats[NSS_CRYPTO_CMN_STATS_MAX] = {
 | 
				
			||||||
 | 
						{"rx_pkts",		NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_byts",		NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx_pkts",		NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx_byts",		NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_queue[0]_drops",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_queue[1]_drops",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_queue[2]_drops",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_queue[3]_drops",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_version",	NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"fail_ctx",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"fail_dma",		NSS_STATS_TYPE_SPECIAL}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_strings_read()
 | 
				
			||||||
 | 
					 *	Read crypto common node statistics names
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_crypto_cmn_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return nss_strings_print(ubuf, sz, ppos, nss_crypto_cmn_strings_stats, NSS_CRYPTO_CMN_STATS_MAX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_strings_ops
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STRINGS_DECLARE_FILE_OPERATIONS(crypto_cmn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_crypto_cmn_strings_dentry_create()
 | 
				
			||||||
 | 
					 *	Create crypto common statistics strings debug entry.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_crypto_cmn_strings_dentry_create(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nss_strings_create_dentry("crypto_cmn", &nss_crypto_cmn_strings_ops);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_crypto_cmn_strings.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_crypto_cmn_strings.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 **************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_CRYPTO_CMN_STRINGS_H
 | 
				
			||||||
 | 
					#define __NSS_CRYPTO_CMN_STRINGS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_crypto_cmn_stats.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct nss_stats_info nss_crypto_cmn_strings_stats[NSS_CRYPTO_CMN_STATS_MAX];
 | 
				
			||||||
 | 
					extern void nss_crypto_cmn_strings_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_CRYPTO_CMN_STRINGS_H */
 | 
				
			||||||
@@ -17,6 +17,22 @@
 | 
				
			|||||||
#include "nss_phys_if.h"
 | 
					#include "nss_phys_if.h"
 | 
				
			||||||
#include <nss_dp_api_if.h>
 | 
					#include <nss_dp_api_if.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0))
 | 
				
			||||||
 | 
					#define NSS_DATA_PLANE_SUPPORTED_FEATURES (NETIF_F_HIGHDMA \
 | 
				
			||||||
 | 
										| NETIF_F_HW_CSUM \
 | 
				
			||||||
 | 
										| NETIF_F_RXCSUM \
 | 
				
			||||||
 | 
										| NETIF_F_SG \
 | 
				
			||||||
 | 
										| NETIF_F_FRAGLIST \
 | 
				
			||||||
 | 
										| (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO))
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#define NSS_DATA_PLANE_SUPPORTED_FEATURES (NETIF_F_HIGHDMA \
 | 
				
			||||||
 | 
										| NETIF_F_HW_CSUM \
 | 
				
			||||||
 | 
										| NETIF_F_RXCSUM \
 | 
				
			||||||
 | 
										| NETIF_F_SG \
 | 
				
			||||||
 | 
										| NETIF_F_FRAGLIST \
 | 
				
			||||||
 | 
										| (NETIF_F_TSO | NETIF_F_TSO6))
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_data_plane_param
 | 
					 * nss_data_plane_param
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -33,5 +49,6 @@ struct nss_data_plane_param {
 | 
				
			|||||||
void nss_data_plane_hal_add_dp_ops(struct nss_dp_data_plane_ops *dp_ops);
 | 
					void nss_data_plane_hal_add_dp_ops(struct nss_dp_data_plane_ops *dp_ops);
 | 
				
			||||||
void nss_data_plane_hal_register(struct nss_ctx_instance *nss_ctx);
 | 
					void nss_data_plane_hal_register(struct nss_ctx_instance *nss_ctx);
 | 
				
			||||||
void nss_data_plane_hal_unregister(struct nss_ctx_instance *nss_ctx);
 | 
					void nss_data_plane_hal_unregister(struct nss_ctx_instance *nss_ctx);
 | 
				
			||||||
 | 
					void nss_data_plane_hal_set_features(struct nss_dp_data_plane_ctx *dpc);
 | 
				
			||||||
uint16_t nss_data_plane_hal_get_mtu_sz(uint16_t mtu);
 | 
					uint16_t nss_data_plane_hal_get_mtu_sz(uint16_t mtu);
 | 
				
			||||||
void nss_data_plane_hal_stats_sync(struct nss_data_plane_param *ndpp, struct nss_phys_if_stats *stats);
 | 
					void nss_data_plane_hal_stats_sync(struct nss_data_plane_param *ndpp, struct nss_phys_if_stats *stats);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,6 +55,23 @@ void nss_data_plane_hal_unregister(struct nss_ctx_instance *nss_ctx)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_data_plane_hal_set_features
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_data_plane_hal_set_features(struct nss_dp_data_plane_ctx *dpc)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						dpc->dev->features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
						dpc->dev->hw_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
						dpc->dev->wanted_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Synopsys GMAC does not support checksum offload for QinQ VLANs.
 | 
				
			||||||
 | 
						 * Hence, we do not advertise checksum offload support for VLANs.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						dpc->dev->vlan_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES &
 | 
				
			||||||
 | 
										(~(NETIF_F_RXCSUM | NETIF_F_HW_CSUM));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_data_plane_hal_stats_sync()
 | 
					 * nss_data_plane_hal_stats_sync()
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -83,6 +83,17 @@ void nss_data_plane_hal_unregister(struct nss_ctx_instance *nss_ctx)
 | 
				
			|||||||
					NSS_PTP_EVENT_SERVICE_CODE);
 | 
										NSS_PTP_EVENT_SERVICE_CODE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_data_plane_hal_set_features
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_data_plane_hal_set_features(struct nss_dp_data_plane_ctx *dpc)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						dpc->dev->features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
						dpc->dev->hw_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
						dpc->dev->vlan_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
						dpc->dev->wanted_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_data_plane_hal_stats_sync()
 | 
					 * nss_data_plane_hal_stats_sync()
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -83,6 +83,17 @@ void nss_data_plane_hal_unregister(struct nss_ctx_instance *nss_ctx)
 | 
				
			|||||||
					NSS_PTP_EVENT_SERVICE_CODE);
 | 
										NSS_PTP_EVENT_SERVICE_CODE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_data_plane_hal_set_features
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_data_plane_hal_set_features(struct nss_dp_data_plane_ctx *dpc)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						dpc->dev->features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
						dpc->dev->hw_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
						dpc->dev->vlan_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
						dpc->dev->wanted_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_data_plane_hal_stats_sync()
 | 
					 * nss_data_plane_hal_stats_sync()
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,22 +19,6 @@
 | 
				
			|||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
#include "nss_data_plane_hal.h"
 | 
					#include "nss_data_plane_hal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0))
 | 
					 | 
				
			||||||
#define NSS_DATA_PLANE_SUPPORTED_FEATURES (NETIF_F_HIGHDMA \
 | 
					 | 
				
			||||||
					| NETIF_F_HW_CSUM \
 | 
					 | 
				
			||||||
					| NETIF_F_RXCSUM \
 | 
					 | 
				
			||||||
					| NETIF_F_SG \
 | 
					 | 
				
			||||||
					| NETIF_F_FRAGLIST \
 | 
					 | 
				
			||||||
					| (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO))
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
#define NSS_DATA_PLANE_SUPPORTED_FEATURES (NETIF_F_HIGHDMA \
 | 
					 | 
				
			||||||
					| NETIF_F_HW_CSUM \
 | 
					 | 
				
			||||||
					| NETIF_F_RXCSUM \
 | 
					 | 
				
			||||||
					| NETIF_F_SG \
 | 
					 | 
				
			||||||
					| NETIF_F_FRAGLIST \
 | 
					 | 
				
			||||||
					| (NETIF_F_TSO | NETIF_F_TSO6))
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_data_plane_param
 | 
					 * nss_data_plane_param
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -228,10 +212,7 @@ drop:
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
static void __nss_data_plane_set_features(struct nss_dp_data_plane_ctx *dpc)
 | 
					static void __nss_data_plane_set_features(struct nss_dp_data_plane_ctx *dpc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	dpc->dev->features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
						nss_data_plane_hal_set_features(dpc);
 | 
				
			||||||
	dpc->dev->hw_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
					 | 
				
			||||||
	dpc->dev->vlan_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
					 | 
				
			||||||
	dpc->dev->wanted_features |= NSS_DATA_PLANE_SUPPORTED_FEATURES;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
@@ -120,7 +120,7 @@ static void nss_dma_msg_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (ndm->cm.type == NSS_DMA_MSG_TYPE_SYNC_STATS) {
 | 
						if (ndm->cm.type == NSS_DMA_MSG_TYPE_SYNC_STATS) {
 | 
				
			||||||
		nss_dma_stats_sync(nss_ctx, &ndm->msg.stats);
 | 
							nss_dma_stats_sync(nss_ctx, &ndm->msg.stats);
 | 
				
			||||||
 | 
							nss_dma_stats_notify(nss_ctx);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
@@ -17,9 +17,15 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "nss_core.h"
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_dma.h"
 | 
				
			||||||
#include "nss_dma_stats.h"
 | 
					#include "nss_dma_stats.h"
 | 
				
			||||||
#include "nss_dma_strings.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
 | 
					 * Spinlock to protect DMA statistics update/read
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -117,3 +123,41 @@ void nss_dma_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_dma_stats *
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	spin_unlock_bh(&nss_dma_stats_lock);
 | 
						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);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
@@ -21,44 +21,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <nss_cmn.h>
 | 
					#include <nss_cmn.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * nss_dma_stats_types
 | 
					 | 
				
			||||||
 *	DMA node statistics.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_dma_stats_types {
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_NO_REQ = NSS_STATS_NODE_MAX,	/**< Request descriptor not available. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_NO_DESC,				/**< DMA descriptors not available. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_NEXTHOP,				/**< Failed to retrive next hop. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_NEXTHOP_QUEUE,		/**< Failed to queue next hop. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_LINEAR_SZ,			/**< Failed to get memory for linearization. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_LINEAR_ALLOC,		/**< Failed to allocate buffer for linearization. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_LINEAR_NO_SG,		/**< Skip linearization due to non-SG packet. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_SPLIT_SZ,			/**< Failed to spliting buffer into multiple buffers. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_SPLIT_ALLOC,			/**< Failed to allocate buffer for split. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_SYNC_ALLOC,			/**< Failed to allocate buffer for sending statistics. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_CTX_ACTIVE,			/**< Failed to queue as the node is not active. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E0,			/**< Failed to process in HW, error code E0. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E1,			/**< Failed to process in HW, error code E1. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E2,			/**< Failed to process in HW, error code E2. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E3,			/**< Failed to process in HW, error code E3. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E4,			/**< Failed to process in HW, error code E4. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E5,			/**< Failed to process in HW, error code E5. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E6,			/**< Failed to process in HW, error code E6. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E7,			/**< Failed to process in HW, error code E7. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E8,			/**< Failed to process in HW, error code E8. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E9,			/**< Failed to process in HW, error code E9. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E10,			/**< Failed to process in HW, error code E10. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E11,			/**< Failed to process in HW, error code E11. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E12,			/**< Failed to process in HW, error code E12. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E13,			/**< Failed to process in HW, error code E13. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E14,			/**< Failed to process in HW, error code E14. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_FAIL_HW_E15,			/**< Failed to process in HW, error code E15. */
 | 
					 | 
				
			||||||
	NSS_DMA_STATS_MAX,				/**< Maximum message type. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * DMA statistics APIs
 | 
					 * DMA statistics APIs
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					extern void nss_dma_stats_notify(struct nss_ctx_instance *nss_ctx);
 | 
				
			||||||
extern void nss_dma_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_dma_stats *nds);
 | 
					extern void nss_dma_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_dma_stats *nds);
 | 
				
			||||||
extern void nss_dma_stats_dentry_create(void);
 | 
					extern void nss_dma_stats_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -16,106 +16,22 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
#include "nss_dtls_cmn_log.h"
 | 
					#include "nss_dtls_cmn_log.h"
 | 
				
			||||||
 | 
					#include "nss_dtls_cmn_stats.h"
 | 
				
			||||||
 | 
					#include "nss_dtls_cmn_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NSS_DTLS_CMN_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
					#define NSS_DTLS_CMN_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
				
			||||||
#define NSS_DTLS_CMN_INTERFACE_MAX_LONG BITS_TO_LONGS(NSS_MAX_NET_INTERFACES)
 | 
					#define NSS_DTLS_CMN_INTERFACE_MAX_LONG BITS_TO_LONGS(NSS_MAX_NET_INTERFACES)
 | 
				
			||||||
#define NSS_DTLS_CMN_STATS_MAX_LINES (NSS_STATS_NODE_MAX + 32)
 | 
					
 | 
				
			||||||
#define NSS_DTLS_CMN_STATS_SIZE_PER_IF (NSS_STATS_MAX_STR_LENGTH * NSS_DTLS_CMN_STATS_MAX_LINES)
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Private data structure.
 | 
					 * Private data structure.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static struct nss_dtls_cmn_cmn_pvt {
 | 
					static struct nss_dtls_cmn_pvt {
 | 
				
			||||||
	struct semaphore sem;
 | 
						struct semaphore sem;
 | 
				
			||||||
	struct completion complete;
 | 
						struct completion complete;
 | 
				
			||||||
	enum nss_dtls_cmn_error resp;
 | 
						enum nss_dtls_cmn_error resp;
 | 
				
			||||||
	unsigned long if_map[NSS_DTLS_CMN_INTERFACE_MAX_LONG];
 | 
						unsigned long if_map[NSS_DTLS_CMN_INTERFACE_MAX_LONG];
 | 
				
			||||||
} dtls_cmn_pvt;
 | 
					} dtls_cmn_pvt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_dtls_cmn_stats_sync()
 | 
					 | 
				
			||||||
 *	Update dtls_cmn node statistics.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void nss_dtls_cmn_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	struct nss_dtls_cmn_msg *ndcm = (struct nss_dtls_cmn_msg *)ncm;
 | 
					 | 
				
			||||||
	struct nss_top_instance *nss_top = nss_ctx->nss_top;
 | 
					 | 
				
			||||||
	struct nss_dtls_cmn_ctx_stats *msg_stats = &ndcm->msg.stats;
 | 
					 | 
				
			||||||
	uint64_t *if_stats;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_lock_bh(&nss_top->stats_lock);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * Update common node stats,
 | 
					 | 
				
			||||||
	 * Note: DTLS only supports a single queue for RX.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	if_stats = nss_top->stats_node[ncm->interface];
 | 
					 | 
				
			||||||
	if_stats[NSS_STATS_NODE_RX_PKTS] += msg_stats->pkt.rx_packets;
 | 
					 | 
				
			||||||
	if_stats[NSS_STATS_NODE_RX_BYTES] += msg_stats->pkt.rx_bytes;
 | 
					 | 
				
			||||||
	if_stats[NSS_STATS_NODE_RX_QUEUE_0_DROPPED] += msg_stats->pkt.rx_dropped[0];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if_stats[NSS_STATS_NODE_TX_PKTS] += msg_stats->pkt.tx_packets;
 | 
					 | 
				
			||||||
	if_stats[NSS_STATS_NODE_TX_BYTES] += msg_stats->pkt.tx_bytes;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_unlock_bh(&nss_top->stats_lock);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_dtls_cmn_stats_read()
 | 
					 | 
				
			||||||
 *	Read dtls_cmn node statiistics.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static ssize_t nss_dtls_cmn_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	struct nss_ctx_instance *nss_ctx = nss_dtls_cmn_get_context();
 | 
					 | 
				
			||||||
	enum nss_dynamic_interface_type type;
 | 
					 | 
				
			||||||
	ssize_t bytes_read = 0;
 | 
					 | 
				
			||||||
	size_t len = 0, size;
 | 
					 | 
				
			||||||
	uint32_t if_num;
 | 
					 | 
				
			||||||
	char *buf;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	size = NSS_DTLS_CMN_STATS_SIZE_PER_IF * bitmap_weight(dtls_cmn_pvt.if_map, NSS_MAX_NET_INTERFACES);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	buf = kzalloc(size, GFP_KERNEL);
 | 
					 | 
				
			||||||
	if (!buf) {
 | 
					 | 
				
			||||||
		nss_warning("Could not allocate memory for local statistics buffer");
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * Common node stats for each DTLS dynamic interface.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	for_each_set_bit(if_num, dtls_cmn_pvt.if_map, NSS_MAX_NET_INTERFACES) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		type = nss_dynamic_interface_get_type(nss_ctx, if_num);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		switch (type) {
 | 
					 | 
				
			||||||
		case NSS_DYNAMIC_INTERFACE_TYPE_DTLS_CMN_INNER:
 | 
					 | 
				
			||||||
			len += scnprintf(buf + len, size - len, "\nInner if_num:%03u", if_num);
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		case NSS_DYNAMIC_INTERFACE_TYPE_DTLS_CMN_OUTER:
 | 
					 | 
				
			||||||
			len += scnprintf(buf + len, size - len, "\nOuter if_num:%03u", if_num);
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		default:
 | 
					 | 
				
			||||||
			len += scnprintf(buf + len, size - len, "\nUnknown(%d) if_num:%03u", type, if_num);
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		len += scnprintf(buf + len, size - len, "\n-------------------\n");
 | 
					 | 
				
			||||||
		len += nss_stats_fill_common_stats(if_num, NSS_STATS_SINGLE_INSTANCE, buf, len, size - len, "dtls_cmn");
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bytes_read = simple_read_from_buffer(ubuf, sz, ppos, buf, len);
 | 
					 | 
				
			||||||
	kfree(buf);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return bytes_read;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_dtls_cmn_stats_ops.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
NSS_STATS_DECLARE_FILE_OPERATIONS(dtls_cmn)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_dtls_cmn_verify_ifnum()
 | 
					 * nss_dtls_cmn_verify_ifnum()
 | 
				
			||||||
 *	Verify if the interface number is a DTLS interface.
 | 
					 *	Verify if the interface number is a DTLS interface.
 | 
				
			||||||
@@ -162,8 +78,10 @@ static void nss_dtls_cmn_handler(struct nss_ctx_instance *nss_ctx, struct nss_cm
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ncm->type == NSS_DTLS_CMN_MSG_TYPE_SYNC_STATS)
 | 
						if (ncm->type == NSS_DTLS_CMN_MSG_TYPE_SYNC_STATS) {
 | 
				
			||||||
		nss_dtls_cmn_stats_sync(nss_ctx, ncm);
 | 
							nss_dtls_cmn_stats_sync(nss_ctx, ncm);
 | 
				
			||||||
 | 
							nss_dtls_cmn_stats_notify(nss_ctx, ncm->interface);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Update the callback and app_data for NOTIFY messages.
 | 
						 * Update the callback and app_data for NOTIFY messages.
 | 
				
			||||||
@@ -220,6 +138,15 @@ static void nss_dtls_cmn_callback(void *app_data, struct nss_cmn_msg *ncm)
 | 
				
			|||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_ifmap_get()
 | 
				
			||||||
 | 
					 *	Return DTLS common active interfaces map.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					unsigned long *nss_dtls_cmn_ifmap_get(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return dtls_cmn_pvt.if_map;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_dtls_cmn_tx_buf()
 | 
					 * nss_dtls_cmn_tx_buf()
 | 
				
			||||||
 *	Transmit buffer over DTLS interface.
 | 
					 *	Transmit buffer over DTLS interface.
 | 
				
			||||||
@@ -519,5 +446,6 @@ void nss_dtls_cmn_register_handler(void)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	sema_init(&dtls_cmn_pvt.sem, 1);
 | 
						sema_init(&dtls_cmn_pvt.sem, 1);
 | 
				
			||||||
	init_completion(&dtls_cmn_pvt.complete);
 | 
						init_completion(&dtls_cmn_pvt.complete);
 | 
				
			||||||
	nss_stats_create_dentry("dtls_cmn", &nss_dtls_cmn_stats_ops);
 | 
						nss_dtls_cmn_stats_dentry_create();
 | 
				
			||||||
 | 
						nss_dtls_cmn_strings_dentry_create();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										215
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_dtls_cmn_stats.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										215
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_dtls_cmn_stats.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,215 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_dtls_cmn.h"
 | 
				
			||||||
 | 
					#include "nss_dtls_cmn_stats.h"
 | 
				
			||||||
 | 
					#include "nss_dtls_cmn_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Declare atomic notifier data structure for statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					ATOMIC_NOTIFIER_HEAD(nss_dtls_cmn_stats_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Spinlock to protect dtls common statistics update/read
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					DEFINE_SPINLOCK(nss_dtls_cmn_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					unsigned long *nss_dtls_cmn_ifmap_get(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_ctx_stats
 | 
				
			||||||
 | 
					 *	dtls common ctx statistics
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					uint64_t nss_dtls_cmn_ctx_stats[NSS_MAX_NET_INTERFACES][NSS_DTLS_CMN_CTX_STATS_MAX];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_iface_type()
 | 
				
			||||||
 | 
					 *	Return a string for each interface type.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static const char *nss_dtls_cmn_stats_iface_type(enum nss_dynamic_interface_type type)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						switch (type) {
 | 
				
			||||||
 | 
						case NSS_DYNAMIC_INTERFACE_TYPE_DTLS_CMN_INNER:
 | 
				
			||||||
 | 
							return "dtls_cmn_inner";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case NSS_DYNAMIC_INTERFACE_TYPE_DTLS_CMN_OUTER:
 | 
				
			||||||
 | 
							return "dtls_cmn_outer";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							return "invalid_interface";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_read()
 | 
				
			||||||
 | 
					 *	Read dtls common node statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_dtls_cmn_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Max output lines = #stats +
 | 
				
			||||||
 | 
						 * few blank lines for banner printing + Number of Extra outputlines
 | 
				
			||||||
 | 
						 * for future reference to add new stats
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						uint32_t max_output_lines = NSS_DTLS_CMN_CTX_STATS_MAX + NSS_STATS_EXTRA_OUTPUT_LINES;
 | 
				
			||||||
 | 
						size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines;
 | 
				
			||||||
 | 
						struct nss_ctx_instance *nss_ctx = nss_dtls_cmn_get_context();
 | 
				
			||||||
 | 
						enum nss_dynamic_interface_type type;
 | 
				
			||||||
 | 
						unsigned long *ifmap;
 | 
				
			||||||
 | 
						uint64_t *stats_shadow;
 | 
				
			||||||
 | 
						ssize_t bytes_read = 0;
 | 
				
			||||||
 | 
						size_t size_wr = 0;
 | 
				
			||||||
 | 
						uint32_t if_num;
 | 
				
			||||||
 | 
						int32_t i;
 | 
				
			||||||
 | 
						int count;
 | 
				
			||||||
 | 
						char *lbuf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ifmap = nss_dtls_cmn_ifmap_get();
 | 
				
			||||||
 | 
						count = bitmap_weight(ifmap, NSS_MAX_NET_INTERFACES);
 | 
				
			||||||
 | 
						if (count) {
 | 
				
			||||||
 | 
							size_al = size_al * count;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						lbuf = vzalloc(size_al);
 | 
				
			||||||
 | 
						if (unlikely(!lbuf)) {
 | 
				
			||||||
 | 
							nss_warning("Could not allocate memory for local statistics buffer");
 | 
				
			||||||
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						stats_shadow = vzalloc(NSS_DTLS_CMN_CTX_STATS_MAX * 8);
 | 
				
			||||||
 | 
						if (unlikely(!stats_shadow)) {
 | 
				
			||||||
 | 
							nss_warning("Could not allocate memory for local shadow buffer");
 | 
				
			||||||
 | 
							vfree(lbuf);
 | 
				
			||||||
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Common node stats for each DTLS dynamic interface.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						size_wr += nss_stats_banner(lbuf, size_wr, size_al, "dtls_cmn stats", NSS_STATS_SINGLE_CORE);
 | 
				
			||||||
 | 
						for_each_set_bit(if_num, ifmap, NSS_MAX_NET_INTERFACES) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							type = nss_dynamic_interface_get_type(nss_ctx, if_num);
 | 
				
			||||||
 | 
							if ((type != NSS_DYNAMIC_INTERFACE_TYPE_DTLS_CMN_INNER) &&
 | 
				
			||||||
 | 
								(type != NSS_DYNAMIC_INTERFACE_TYPE_DTLS_CMN_OUTER)) {
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							spin_lock_bh(&nss_dtls_cmn_stats_lock);
 | 
				
			||||||
 | 
							for (i = 0; i < NSS_DTLS_CMN_CTX_STATS_MAX; i++) {
 | 
				
			||||||
 | 
								stats_shadow[i] = nss_dtls_cmn_ctx_stats[if_num][i];
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							spin_unlock_bh(&nss_dtls_cmn_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n%s if_num:%03u\n",
 | 
				
			||||||
 | 
										nss_dtls_cmn_stats_iface_type(type), if_num);
 | 
				
			||||||
 | 
							size_wr += nss_stats_print("dtls_cmn", NULL, NSS_STATS_SINGLE_INSTANCE, nss_dtls_cmn_ctx_stats_str,
 | 
				
			||||||
 | 
											stats_shadow, NSS_DTLS_CMN_CTX_STATS_MAX, lbuf, size_wr, size_al);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf));
 | 
				
			||||||
 | 
						vfree(lbuf);
 | 
				
			||||||
 | 
						vfree(stats_shadow);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return bytes_read;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_ops.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STATS_DECLARE_FILE_OPERATIONS(dtls_cmn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_dentry_create()
 | 
				
			||||||
 | 
					 *	Create dtls common statistics debug entry.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_dtls_cmn_stats_dentry_create(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nss_stats_create_dentry("dtls_cmn", &nss_dtls_cmn_stats_ops);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_sync()
 | 
				
			||||||
 | 
					 *	Update dtls common node statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_dtls_cmn_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_dtls_cmn_msg *ndcm = (struct nss_dtls_cmn_msg *)ncm;
 | 
				
			||||||
 | 
						struct nss_dtls_cmn_ctx_stats *ndccs = &ndcm->msg.stats;
 | 
				
			||||||
 | 
						uint64_t *ctx_stats;
 | 
				
			||||||
 | 
						uint32_t *msg_stats;
 | 
				
			||||||
 | 
						uint16_t i = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_dtls_cmn_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						msg_stats = (uint32_t *)ndccs;
 | 
				
			||||||
 | 
						ctx_stats = nss_dtls_cmn_ctx_stats[ncm->interface];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (i = 0; i < NSS_DTLS_CMN_CTX_STATS_MAX; i++, ctx_stats++, msg_stats++) {
 | 
				
			||||||
 | 
							*ctx_stats += *msg_stats;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_dtls_cmn_stats_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_notify()
 | 
				
			||||||
 | 
					 *	Sends notifications to all the registered modules.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Leverage NSS-FW statistics timing to update Netlink.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_dtls_cmn_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_dtls_cmn_stats_notification *dtls_cmn_stats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dtls_cmn_stats = kmalloc(sizeof(struct nss_dtls_cmn_stats_notification), GFP_ATOMIC);
 | 
				
			||||||
 | 
						if (!dtls_cmn_stats) {
 | 
				
			||||||
 | 
							nss_warning("Unable to allocate memory for stats notification\n");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_dtls_cmn_stats_lock);
 | 
				
			||||||
 | 
						dtls_cmn_stats->core_id = nss_ctx->id;
 | 
				
			||||||
 | 
						dtls_cmn_stats->if_num = if_num;
 | 
				
			||||||
 | 
						memcpy(dtls_cmn_stats->stats_ctx, nss_dtls_cmn_ctx_stats[if_num], sizeof(dtls_cmn_stats->stats_ctx));
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_dtls_cmn_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						atomic_notifier_call_chain(&nss_dtls_cmn_stats_notifier, NSS_STATS_EVENT_NOTIFY, dtls_cmn_stats);
 | 
				
			||||||
 | 
						kfree(dtls_cmn_stats);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_unregister_notifier()
 | 
				
			||||||
 | 
					 *	Deregisters statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_dtls_cmn_stats_unregister_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_unregister(&nss_dtls_cmn_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_dtls_cmn_stats_unregister_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_stats_register_notifier()
 | 
				
			||||||
 | 
					 *	Registers statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_dtls_cmn_stats_register_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_register(&nss_dtls_cmn_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_dtls_cmn_stats_register_notifier);
 | 
				
			||||||
							
								
								
									
										26
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_dtls_cmn_stats.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_dtls_cmn_stats.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ****************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ****************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_DTLS_CMN_STATS_H
 | 
				
			||||||
 | 
					#define __NSS_DTLS_CMN_STATS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nss_cmn.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern void nss_dtls_cmn_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num);
 | 
				
			||||||
 | 
					extern void nss_dtls_cmn_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm);
 | 
				
			||||||
 | 
					extern void nss_dtls_cmn_stats_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_DTLS_CMN_STATS_H */
 | 
				
			||||||
							
								
								
									
										128
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_dtls_cmn_strings.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_dtls_cmn_strings.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,128 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ****************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ****************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_stats.h"
 | 
				
			||||||
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_strings.h"
 | 
				
			||||||
 | 
					#include "nss_dtls_cmn_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_ctx_stats_str
 | 
				
			||||||
 | 
					 *	 dtls common ctx statistics strings.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_stats_info nss_dtls_cmn_ctx_stats_str[NSS_DTLS_CMN_CTX_STATS_MAX] = {
 | 
				
			||||||
 | 
						{"rx_pkts",			NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_byts",			NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx_pkts",			NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx_byts",			NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_queue[0]_drops",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_queue[1]_drops",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_queue[2]_drops",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_queue[3]_drops",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_single_rec",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"rx_multi_rec",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"fail_crypto_resource",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_crypto_enqueue",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_headroom",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_tailroom",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_ver",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_epoch",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_dtls_record",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_capwap",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_replay",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_replay_dup",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_replay_win",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_queue",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_queue_nexthop",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_pbuf_alloc",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_pbuf_linear",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_pbuf_stats",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_pbuf_align",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_ctx_active",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_hwctx_active",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cipher",			NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"fail_auth",			NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"fail_seq_ovf",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_blk_len",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_hash_len",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"len_error",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"token_error",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"bypass_error",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"config_error",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"algo_error",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"hash_ovf_error",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"ttl_error",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"csum_error",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"timeout_error",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[0]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[1]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[2]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[3]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[4]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[5]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[6]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[7]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[8]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[9]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[10]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[11]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[12]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[13]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[14]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[15]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[16]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[17]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[18]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[19]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[20]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[21]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[22]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[23]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[24]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[25]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[26]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[27]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[28]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[29]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[30]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"fail_cle_[31]",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"seq_low",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"seq_high",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"epoch",			NSS_STATS_TYPE_SPECIAL}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_ctx_stats_str_strings_read()
 | 
				
			||||||
 | 
					 *	Read dtls common ctx statistics names
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_dtls_cmn_ctx_stats_str_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return nss_strings_print(ubuf, sz, ppos, nss_dtls_cmn_ctx_stats_str, NSS_DTLS_CMN_CTX_STATS_MAX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_ctx_stats_str_strings_ops
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STRINGS_DECLARE_FILE_OPERATIONS(dtls_cmn_ctx_stats_str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_dtls_cmn_strings_dentry_create()
 | 
				
			||||||
 | 
					 *	Create dtls common statistics strings debug entry.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_dtls_cmn_strings_dentry_create(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nss_strings_create_dentry("dtls_cmn_ctx_stats_str", &nss_dtls_cmn_ctx_stats_str_strings_ops);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_dtls_cmn_strings.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_dtls_cmn_strings.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ****************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ****************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_DTLS_CMN_STRINGS_H
 | 
				
			||||||
 | 
					#define __NSS_DTLS_CMN_STRINGS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_dtls_cmn_stats.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct nss_stats_info nss_dtls_cmn_ctx_stats_str[NSS_DTLS_CMN_CTX_STATS_MAX];
 | 
				
			||||||
 | 
					extern void nss_dtls_cmn_strings_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_DTLS_CMN_STRINGS_H */
 | 
				
			||||||
@@ -26,10 +26,10 @@
 | 
				
			|||||||
const char *nss_dynamic_interface_type_names[NSS_DYNAMIC_INTERFACE_TYPE_MAX] = {
 | 
					const char *nss_dynamic_interface_type_names[NSS_DYNAMIC_INTERFACE_TYPE_MAX] = {
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_NONE",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_NONE",
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR",
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_5",
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_INNER",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_INNER",
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_OUTER",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_OUTER",
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_WIFI",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_RESERVED",
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_VAP",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_VAP",
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_0",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_0",
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_PPPOE",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_PPPOE",
 | 
				
			||||||
@@ -87,6 +87,8 @@ const char *nss_dynamic_interface_type_names[NSS_DYNAMIC_INTERFACE_TYPE_MAX] = {
 | 
				
			|||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N",
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0",
 | 
				
			||||||
	"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1",
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1",
 | 
				
			||||||
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_HOST_INNER",
 | 
				
			||||||
 | 
						"NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_OUTER",
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -732,6 +732,7 @@ void nss_edma_metadata_ring_stats_sync(struct nss_ctx_instance *nss_ctx, struct
 | 
				
			|||||||
		edma_stats.rx_stats[i][NSS_EDMA_STATS_RX_DESC] += nerss->rx_ring[i].desc_cnt;
 | 
							edma_stats.rx_stats[i][NSS_EDMA_STATS_RX_DESC] += nerss->rx_ring[i].desc_cnt;
 | 
				
			||||||
		edma_stats.rx_stats[i][NSS_EDMA_STATS_RX_QOS_ERR] += nerss->rx_ring[i].qos_err;
 | 
							edma_stats.rx_stats[i][NSS_EDMA_STATS_RX_QOS_ERR] += nerss->rx_ring[i].qos_err;
 | 
				
			||||||
		edma_stats.rx_stats[i][NSS_EDMA_STATS_RX_SRC_PORT_INVALID] += nerss->rx_ring[i].rx_src_port_invalid;
 | 
							edma_stats.rx_stats[i][NSS_EDMA_STATS_RX_SRC_PORT_INVALID] += nerss->rx_ring[i].rx_src_port_invalid;
 | 
				
			||||||
 | 
							edma_stats.rx_stats[i][NSS_EDMA_STATS_RX_SRC_IF_INVALID] += nerss->rx_ring[i].rx_src_if_invalid;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -78,7 +78,8 @@ struct nss_stats_info nss_edma_strings_stats_rx[NSS_EDMA_STATS_RX_MAX] = {
 | 
				
			|||||||
	{"rx_csum_err"		, NSS_STATS_TYPE_ERROR},
 | 
						{"rx_csum_err"		, NSS_STATS_TYPE_ERROR},
 | 
				
			||||||
	{"desc_cnt"		, NSS_STATS_TYPE_SPECIAL},
 | 
						{"desc_cnt"		, NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
	{"qos_err"		, NSS_STATS_TYPE_DROP},
 | 
						{"qos_err"		, NSS_STATS_TYPE_DROP},
 | 
				
			||||||
	{"rx_src_port_invalid"	, NSS_STATS_TYPE_DROP}
 | 
						{"rx_src_port_invalid"	, NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_src_interface_invalid"	, NSS_STATS_TYPE_DROP}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -17,6 +17,7 @@
 | 
				
			|||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
#include "nss_gre_stats.h"
 | 
					#include "nss_gre_stats.h"
 | 
				
			||||||
#include "nss_gre_log.h"
 | 
					#include "nss_gre_log.h"
 | 
				
			||||||
 | 
					#include "nss_gre_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NSS_GRE_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
					#define NSS_GRE_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -115,11 +116,13 @@ static void nss_gre_msg_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn
 | 
				
			|||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * debug stats embedded in stats msg
 | 
							 * debug stats embedded in stats msg
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		nss_gre_stats_session_debug_sync(nss_ctx, &ntm->msg.sstats, ncm->interface);
 | 
							nss_gre_stats_session_sync(nss_ctx, &ntm->msg.sstats, ncm->interface);
 | 
				
			||||||
 | 
							nss_gre_stats_session_notify(nss_ctx, ncm->interface);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case NSS_GRE_MSG_BASE_STATS:
 | 
						case NSS_GRE_MSG_BASE_STATS:
 | 
				
			||||||
		nss_gre_stats_base_debug_sync(nss_ctx, &ntm->msg.bstats);
 | 
							nss_gre_stats_base_sync(nss_ctx, &ntm->msg.bstats);
 | 
				
			||||||
 | 
							nss_gre_stats_base_notify(nss_ctx);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
@@ -404,4 +407,5 @@ void nss_gre_register_handler(void)
 | 
				
			|||||||
	init_completion(&nss_gre_pvt.complete);
 | 
						init_completion(&nss_gre_pvt.complete);
 | 
				
			||||||
	nss_core_register_handler(nss_ctx, NSS_GRE_INTERFACE, nss_gre_msg_handler, NULL);
 | 
						nss_core_register_handler(nss_ctx, NSS_GRE_INTERFACE, nss_gre_msg_handler, NULL);
 | 
				
			||||||
	nss_gre_stats_dentry_create();
 | 
						nss_gre_stats_dentry_create();
 | 
				
			||||||
 | 
						nss_gre_strings_dentry_create();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -16,6 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
#include "nss_gre_redir_stats.h"
 | 
					#include "nss_gre_redir_stats.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_strings.h"
 | 
				
			||||||
#include "nss_gre_redir_log.h"
 | 
					#include "nss_gre_redir_log.h"
 | 
				
			||||||
#define NSS_GRE_REDIR_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
					#define NSS_GRE_REDIR_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -30,15 +31,10 @@ static struct {
 | 
				
			|||||||
	int response;
 | 
						int response;
 | 
				
			||||||
} nss_gre_redir_pvt;
 | 
					} nss_gre_redir_pvt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * Spinlock to update tunnel stats.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static DEFINE_SPINLOCK(nss_gre_redir_stats_lock);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Array to hold tunnel stats along with if_num
 | 
					 * Array to hold tunnel stats along with if_num
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static struct nss_gre_redir_tunnel_stats tun_stats[NSS_GRE_REDIR_MAX_INTERFACES];
 | 
					struct nss_gre_redir_tunnel_stats tun_stats[NSS_GRE_REDIR_MAX_INTERFACES];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_callback()
 | 
					 * nss_gre_callback()
 | 
				
			||||||
@@ -59,7 +55,7 @@ static void nss_gre_redir_msg_sync_callback(void *app_data, struct nss_gre_redir
 | 
				
			|||||||
 * nss_gre_redir_verify_ifnum()
 | 
					 * nss_gre_redir_verify_ifnum()
 | 
				
			||||||
 *	Verify interface type.
 | 
					 *	Verify interface type.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static bool nss_gre_redir_verify_ifnum(uint32_t if_num)
 | 
					bool nss_gre_redir_verify_ifnum(uint32_t if_num)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint32_t type;
 | 
						uint32_t type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -72,92 +68,6 @@ static bool nss_gre_redir_verify_ifnum(uint32_t if_num)
 | 
				
			|||||||
			type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_DS;
 | 
								type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_DS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_tunnel_update_stats()
 | 
					 | 
				
			||||||
 *	Update gre_redir tunnel stats.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void nss_gre_redir_tunnel_update_stats(struct nss_ctx_instance *nss_ctx, int if_num, struct nss_gre_redir_stats_sync_msg *ngss)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	int i, j;
 | 
					 | 
				
			||||||
	uint32_t type;
 | 
					 | 
				
			||||||
	struct net_device *dev;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	type = nss_dynamic_interface_get_type(nss_ctx, if_num);
 | 
					 | 
				
			||||||
	dev = nss_cmn_get_interface_dev(nss_ctx, if_num);
 | 
					 | 
				
			||||||
	if (!dev) {
 | 
					 | 
				
			||||||
		nss_warning("%px: Unable to find net device for the interface %d\n", nss_ctx, if_num);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (!nss_gre_redir_verify_ifnum(if_num)) {
 | 
					 | 
				
			||||||
		nss_warning("%px: Unknown type for interface %d\n", nss_ctx, if_num);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_lock_bh(&nss_gre_redir_stats_lock);
 | 
					 | 
				
			||||||
	for (i = 0; i < NSS_GRE_REDIR_MAX_INTERFACES; i++) {
 | 
					 | 
				
			||||||
		if (tun_stats[i].dev == dev) {
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (i == NSS_GRE_REDIR_MAX_INTERFACES) {
 | 
					 | 
				
			||||||
		nss_warning("%px: Unable to find tunnel stats instance for interface %d\n", nss_ctx, if_num);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	nss_assert(tun_stats[i].ref_count);
 | 
					 | 
				
			||||||
	switch (type) {
 | 
					 | 
				
			||||||
	case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_WIFI_HOST_INNER:
 | 
					 | 
				
			||||||
	case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_WIFI_OFFL_INNER:
 | 
					 | 
				
			||||||
	case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_SJACK_INNER:
 | 
					 | 
				
			||||||
		tun_stats[i].node_stats.tx_packets += ngss->node_stats.tx_packets;
 | 
					 | 
				
			||||||
		tun_stats[i].node_stats.tx_bytes += ngss->node_stats.tx_bytes;
 | 
					 | 
				
			||||||
		tun_stats[i].sjack_tx_packets += ngss->sjack_rx_packets;
 | 
					 | 
				
			||||||
		tun_stats[i].encap_sg_alloc_drop += ngss->encap_sg_alloc_drop;
 | 
					 | 
				
			||||||
		tun_stats[i].tx_dropped += nss_cmn_rx_dropped_sum(&(ngss->node_stats));
 | 
					 | 
				
			||||||
		for (j = 0; j < NSS_GRE_REDIR_MAX_RADIO; j++) {
 | 
					 | 
				
			||||||
			tun_stats[i].offl_tx_pkts[j] += ngss->offl_rx_pkts[j];
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_OUTER:
 | 
					 | 
				
			||||||
		tun_stats[i].node_stats.rx_packets += ngss->node_stats.rx_packets;
 | 
					 | 
				
			||||||
		tun_stats[i].node_stats.rx_bytes += ngss->node_stats.rx_bytes;
 | 
					 | 
				
			||||||
		tun_stats[i].sjack_rx_packets += ngss->sjack_rx_packets;
 | 
					 | 
				
			||||||
		tun_stats[i].decap_fail_drop += ngss->decap_fail_drop;
 | 
					 | 
				
			||||||
		tun_stats[i].decap_split_drop += ngss->decap_split_drop;
 | 
					 | 
				
			||||||
		tun_stats[i].split_sg_alloc_fail += ngss->split_sg_alloc_fail;
 | 
					 | 
				
			||||||
		tun_stats[i].split_linear_copy_fail += ngss->split_linear_copy_fail;
 | 
					 | 
				
			||||||
		tun_stats[i].split_not_enough_tailroom += ngss->split_not_enough_tailroom;
 | 
					 | 
				
			||||||
		tun_stats[i].decap_eapol_frames += ngss->decap_eapol_frames;
 | 
					 | 
				
			||||||
		tun_stats[i].node_stats.rx_dropped[0] += nss_cmn_rx_dropped_sum(&(ngss->node_stats));
 | 
					 | 
				
			||||||
		for (j = 0; j < NSS_GRE_REDIR_MAX_RADIO; j++) {
 | 
					 | 
				
			||||||
			tun_stats[i].offl_rx_pkts[j] += ngss->offl_rx_pkts[j];
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_US:
 | 
					 | 
				
			||||||
		tun_stats[i].exception_us_rx += ngss->node_stats.rx_packets;
 | 
					 | 
				
			||||||
		tun_stats[i].exception_us_tx += ngss->node_stats.tx_packets;
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_DS:
 | 
					 | 
				
			||||||
		tun_stats[i].exception_ds_rx += ngss->node_stats.rx_packets;
 | 
					 | 
				
			||||||
		tun_stats[i].exception_ds_tx += ngss->node_stats.tx_packets;
 | 
					 | 
				
			||||||
		tun_stats[i].exception_ds_invalid_dst_drop += ngss->exception_ds_invalid_dst_drop;
 | 
					 | 
				
			||||||
		tun_stats[i].exception_ds_inv_appid += ngss->exception_ds_inv_appid;
 | 
					 | 
				
			||||||
		tun_stats[i].headroom_unavail += ngss->headroom_unavail;
 | 
					 | 
				
			||||||
		tun_stats[i].tx_completion_success += ngss->tx_completion_success;
 | 
					 | 
				
			||||||
		tun_stats[i].tx_completion_drop += ngss->tx_completion_drop;
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_unlock_bh(&nss_gre_redir_stats_lock);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_handler()
 | 
					 * nss_gre_redir_handler()
 | 
				
			||||||
 *	Handle NSS -> HLOS messages for GRE tunnel.
 | 
					 *	Handle NSS -> HLOS messages for GRE tunnel.
 | 
				
			||||||
@@ -209,7 +119,8 @@ static void nss_gre_redir_msg_handler(struct nss_ctx_instance *nss_ctx, struct n
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	switch (ncm->type) {
 | 
						switch (ncm->type) {
 | 
				
			||||||
	case NSS_GRE_REDIR_RX_STATS_SYNC_MSG:
 | 
						case NSS_GRE_REDIR_RX_STATS_SYNC_MSG:
 | 
				
			||||||
		nss_gre_redir_tunnel_update_stats(nss_ctx, ncm->interface, &ngrm->msg.stats_sync);
 | 
							nss_gre_redir_stats_sync(nss_ctx, ncm->interface, &ngrm->msg.stats_sync);
 | 
				
			||||||
 | 
							nss_gre_redir_stats_notify(nss_ctx, ncm->interface);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -540,24 +451,6 @@ nss_tx_status_t nss_gre_redir_configure_outer_node(int ifnum,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(nss_gre_redir_configure_outer_node);
 | 
					EXPORT_SYMBOL(nss_gre_redir_configure_outer_node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_get_stats()
 | 
					 | 
				
			||||||
 *	Get gre_redir tunnel stats.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
bool nss_gre_redir_get_stats(int index, struct nss_gre_redir_tunnel_stats *stats)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	spin_lock_bh(&nss_gre_redir_stats_lock);
 | 
					 | 
				
			||||||
	if (tun_stats[index].ref_count == 0) {
 | 
					 | 
				
			||||||
		spin_unlock_bh(&nss_gre_redir_stats_lock);
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	memcpy(stats, &tun_stats[index], sizeof(struct nss_gre_redir_tunnel_stats));
 | 
					 | 
				
			||||||
	spin_unlock_bh(&nss_gre_redir_stats_lock);
 | 
					 | 
				
			||||||
	return true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
EXPORT_SYMBOL(nss_gre_redir_get_stats);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_tx_msg()
 | 
					 * nss_gre_redir_tx_msg()
 | 
				
			||||||
 *	Transmit a GRE message to NSS FW.
 | 
					 *	Transmit a GRE message to NSS FW.
 | 
				
			||||||
@@ -775,4 +668,6 @@ void nss_gre_redir_register_handler(void)
 | 
				
			|||||||
		nss_warning("%px: Not able to register handler for gre_redir base interface with NSS core\n", nss_ctx);
 | 
							nss_warning("%px: Not able to register handler for gre_redir base interface with NSS core\n", nss_ctx);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						nss_gre_redir_strings_dentry_create();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 ****************************************************************************
 | 
				
			||||||
 * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2018, 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -11,17 +11,18 @@
 | 
				
			|||||||
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 **************************************************************************
 | 
					 ****************************************************************************
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_lag.h"
 | 
				
			||||||
#include "nss_gre_redir_lag_ds_stats.h"
 | 
					#include "nss_gre_redir_lag_ds_stats.h"
 | 
				
			||||||
#include "nss_gre_redir_lag_ds_log.h"
 | 
					#include "nss_gre_redir_lag_ds_log.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_lag_ds_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NSS_GRE_REDIR_LAG_DS_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
					#define NSS_GRE_REDIR_LAG_DS_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct nss_gre_redir_lag_ds_tun_stats tun_stats[NSS_GRE_REDIR_LAG_MAX_NODE];
 | 
					struct nss_gre_redir_lag_ds_tun_stats tun_ds_stats[NSS_GRE_REDIR_LAG_MAX_NODE];
 | 
				
			||||||
static DEFINE_SPINLOCK(nss_gre_redir_lag_ds_stats_lock);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Private data structure
 | 
					 * Private data structure
 | 
				
			||||||
@@ -64,11 +65,11 @@ static void nss_gre_redir_lag_ds_callback(void *app_data, struct nss_gre_redir_l
 | 
				
			|||||||
 * nss_gre_redir_lag_ds_get_node_idx()
 | 
					 * nss_gre_redir_lag_ds_get_node_idx()
 | 
				
			||||||
 *	Returns index of statistics context.
 | 
					 *	Returns index of statistics context.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static inline bool nss_gre_redir_lag_ds_get_node_idx(uint32_t ifnum, uint32_t *idx)
 | 
					bool nss_gre_redir_lag_ds_get_node_idx(uint32_t ifnum, uint32_t *idx)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint32_t node_idx;
 | 
						uint32_t node_idx;
 | 
				
			||||||
	for (node_idx = 0; node_idx < NSS_GRE_REDIR_LAG_MAX_NODE; node_idx++) {
 | 
						for (node_idx = 0; node_idx < NSS_GRE_REDIR_LAG_MAX_NODE; node_idx++) {
 | 
				
			||||||
		if ((tun_stats[node_idx].valid) && (tun_stats[node_idx].ifnum == ifnum)) {
 | 
							if ((tun_ds_stats[node_idx].valid) && (tun_ds_stats[node_idx].ifnum == ifnum)) {
 | 
				
			||||||
			*idx = node_idx;
 | 
								*idx = node_idx;
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -77,38 +78,11 @@ static inline bool nss_gre_redir_lag_ds_get_node_idx(uint32_t ifnum, uint32_t *i
 | 
				
			|||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_lag_ds_update_sync_stats()
 | 
					 | 
				
			||||||
 *	Update synchonized statistics.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void nss_gre_redir_lag_ds_update_sync_stats(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_lag_ds_sync_stats_msg *ngss, uint32_t ifnum)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	int idx, j;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_lock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
					 | 
				
			||||||
	if (!nss_gre_redir_lag_ds_get_node_idx(ifnum, &idx)) {
 | 
					 | 
				
			||||||
		spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
					 | 
				
			||||||
		nss_warning("%px: Unable to update hash stats msg. Stats context not found.\n", nss_ctx);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	tun_stats[idx].tx_packets += ngss->node_stats.tx_packets;
 | 
					 | 
				
			||||||
	tun_stats[idx].tx_bytes += ngss->node_stats.tx_bytes;
 | 
					 | 
				
			||||||
	tun_stats[idx].rx_packets += ngss->node_stats.rx_packets;
 | 
					 | 
				
			||||||
	tun_stats[idx].rx_bytes += ngss->node_stats.rx_bytes;
 | 
					 | 
				
			||||||
	for (j = 0; j < NSS_MAX_NUM_PRI; j++) {
 | 
					 | 
				
			||||||
		tun_stats[idx].rx_dropped[j] += ngss->node_stats.rx_dropped[j];
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	tun_stats[idx].dst_invalid += ngss->ds_stats.dst_invalid;
 | 
					 | 
				
			||||||
	tun_stats[idx].exception_cnt += ngss->ds_stats.exception_cnt;
 | 
					 | 
				
			||||||
	spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_lag_ds_verify_ifnum()
 | 
					 * nss_gre_redir_lag_ds_verify_ifnum()
 | 
				
			||||||
 *	Verify interface type.
 | 
					 *	Verify interface type.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static bool nss_gre_redir_lag_ds_verify_ifnum(uint32_t if_num)
 | 
					bool nss_gre_redir_lag_ds_verify_ifnum(uint32_t if_num)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return nss_dynamic_interface_get_type(nss_gre_redir_lag_ds_get_context(), if_num) == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS;
 | 
						return nss_dynamic_interface_get_type(nss_gre_redir_lag_ds_get_context(), if_num) == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -162,7 +136,8 @@ static void nss_gre_redir_lag_ds_msg_handler(struct nss_ctx_instance *nss_ctx, s
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	switch (ncm->type) {
 | 
						switch (ncm->type) {
 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_DS_STATS_SYNC_MSG:
 | 
						case NSS_GRE_REDIR_LAG_DS_STATS_SYNC_MSG:
 | 
				
			||||||
		nss_gre_redir_lag_ds_update_sync_stats(nss_ctx, &ngrm->msg.ds_sync_stats, ncm->interface);
 | 
							nss_gre_redir_lag_ds_stats_sync(nss_ctx, &ngrm->msg.ds_sync_stats, ncm->interface);
 | 
				
			||||||
 | 
							nss_gre_redir_lag_ds_stats_notify(nss_ctx, ncm->interface);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -217,7 +192,7 @@ static enum nss_gre_redir_lag_err_types nss_gre_redir_lag_ds_unregister_if(uint3
 | 
				
			|||||||
		return NSS_GRE_REDIR_LAG_ERR_STATS_INDEX_NOT_FOUND;
 | 
							return NSS_GRE_REDIR_LAG_ERR_STATS_INDEX_NOT_FOUND;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tun_stats[idx].valid = false;
 | 
						tun_ds_stats[idx].valid = false;
 | 
				
			||||||
	spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
						spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
	return NSS_GRE_REDIR_LAG_SUCCESS;
 | 
						return NSS_GRE_REDIR_LAG_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -258,9 +233,9 @@ static struct nss_ctx_instance *nss_gre_redir_lag_ds_register_if(uint32_t if_num
 | 
				
			|||||||
	nss_core_set_subsys_dp_type(nss_ctx, netdev, if_num, type);
 | 
						nss_core_set_subsys_dp_type(nss_ctx, netdev, if_num, type);
 | 
				
			||||||
	spin_lock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
						spin_lock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
	for (i = 0; i < NSS_GRE_REDIR_LAG_MAX_NODE; i++) {
 | 
						for (i = 0; i < NSS_GRE_REDIR_LAG_MAX_NODE; i++) {
 | 
				
			||||||
		if (!tun_stats[i].valid) {
 | 
							if (!tun_ds_stats[i].valid) {
 | 
				
			||||||
			tun_stats[i].ifnum = if_num;
 | 
								tun_ds_stats[i].ifnum = if_num;
 | 
				
			||||||
			tun_stats[i].valid = true;
 | 
								tun_ds_stats[i].valid = true;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -280,26 +255,6 @@ struct nss_ctx_instance *nss_gre_redir_lag_ds_get_context(void)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(nss_gre_redir_lag_ds_get_context);
 | 
					EXPORT_SYMBOL(nss_gre_redir_lag_ds_get_context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_lag_ds_get_cmn_stats()
 | 
					 | 
				
			||||||
 *	Get statistics for downstream LAG node.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
bool nss_gre_redir_lag_ds_get_cmn_stats(struct nss_gre_redir_lag_ds_tun_stats *cmn_stats, uint32_t index)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if (index >= NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_lock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
					 | 
				
			||||||
	if (!tun_stats[index].valid) {
 | 
					 | 
				
			||||||
		spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	memcpy((void *)cmn_stats, (void *)&tun_stats[index], sizeof(*cmn_stats));
 | 
					 | 
				
			||||||
	spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
					 | 
				
			||||||
	return true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_lag_ds_tx_msg()
 | 
					 * nss_gre_redir_lag_ds_tx_msg()
 | 
				
			||||||
 *	Transmit a gre message to NSS.
 | 
					 *	Transmit a gre message to NSS.
 | 
				
			||||||
@@ -441,6 +396,7 @@ void nss_gre_redir_lag_ds_register_handler(void)
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						nss_gre_redir_lag_ds_strings_dentry_create();
 | 
				
			||||||
	nss_gre_redir_lag_ds_pvt.cb = NULL;
 | 
						nss_gre_redir_lag_ds_pvt.cb = NULL;
 | 
				
			||||||
	nss_gre_redir_lag_ds_pvt.app_data = NULL;
 | 
						nss_gre_redir_lag_ds_pvt.app_data = NULL;
 | 
				
			||||||
	sema_init(&nss_gre_redir_lag_ds_pvt.sem, 1);
 | 
						sema_init(&nss_gre_redir_lag_ds_pvt.sem, 1);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -17,69 +17,38 @@
 | 
				
			|||||||
#include "nss_core.h"
 | 
					#include "nss_core.h"
 | 
				
			||||||
#include "nss_gre_redir_lag.h"
 | 
					#include "nss_gre_redir_lag.h"
 | 
				
			||||||
#include "nss_gre_redir_lag_ds_stats.h"
 | 
					#include "nss_gre_redir_lag_ds_stats.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_lag_ds_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_lag_ds_stats_str
 | 
					 * Declare atomic notifier data structure for statistics.
 | 
				
			||||||
 *	GRE REDIR LAG DS common statistics strings.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static uint8_t *nss_gre_redir_lag_ds_stats_str[NSS_GRE_REDIR_LAG_DS_STATS_MAX] = {
 | 
					ATOMIC_NOTIFIER_HEAD(nss_gre_redir_lag_ds_stats_notifier);
 | 
				
			||||||
	"rx_packets",
 | 
					 | 
				
			||||||
	"rx_bytes",
 | 
					 | 
				
			||||||
	"tx_packets",
 | 
					 | 
				
			||||||
	"tx_bytes",
 | 
					 | 
				
			||||||
	"rx_queue_0_dropped",
 | 
					 | 
				
			||||||
	"rx_queue_1_dropped",
 | 
					 | 
				
			||||||
	"rx_queue_2_dropped",
 | 
					 | 
				
			||||||
	"rx_queue_3_dropped",
 | 
					 | 
				
			||||||
	"dst_invalid",
 | 
					 | 
				
			||||||
	"exception_packets"
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_lag_ds_tunnel_stats()
 | 
					 * Spinlock to protect GRE redirect lag ds statistics update/read
 | 
				
			||||||
 *	Make a row for GRE_REDIR LAG DS stats.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static ssize_t nss_gre_redir_lag_ds_cmn_stats_read_entry(char *line, int len, int type, struct nss_gre_redir_lag_ds_tun_stats *s)
 | 
					DEFINE_SPINLOCK(nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct nss_gre_redir_lag_ds_tun_stats tun_ds_stats[NSS_GRE_REDIR_LAG_MAX_NODE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_stats_get()
 | 
				
			||||||
 | 
					 *	Get statistics for downstream LAG node.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					bool nss_gre_redir_lag_ds_stats_get(struct nss_gre_redir_lag_ds_tun_stats *cmn_stats, uint32_t index)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint64_t tcnt = 0;
 | 
						if (index >= NSS_GRE_REDIR_LAG_MAX_NODE)
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (type) {
 | 
						spin_lock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
	case NSS_STATS_NODE_RX_PKTS:
 | 
						if (!tun_ds_stats[index].valid) {
 | 
				
			||||||
		tcnt = s->rx_packets;
 | 
							spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
		return snprintf(line, len, "Common node stats start:\n\n%s = %llu\n", nss_gre_redir_lag_ds_stats_str[type], tcnt);
 | 
							return false;
 | 
				
			||||||
	case NSS_STATS_NODE_RX_BYTES:
 | 
					 | 
				
			||||||
		tcnt = s->rx_bytes;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_ds_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_TX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->tx_packets;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_ds_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_TX_BYTES:
 | 
					 | 
				
			||||||
		tcnt = s->tx_bytes;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_ds_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_RX_QUEUE_0_DROPPED:
 | 
					 | 
				
			||||||
		tcnt = s->rx_dropped[0];
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_ds_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
#if (NSS_MAX_NUM_PRI > 1)
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_RX_QUEUE_1_DROPPED:
 | 
					 | 
				
			||||||
		tcnt = s->rx_dropped[1];
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_ds_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_RX_QUEUE_2_DROPPED:
 | 
					 | 
				
			||||||
		tcnt = s->rx_dropped[2];
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_ds_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_RX_QUEUE_3_DROPPED:
 | 
					 | 
				
			||||||
		tcnt = s->rx_dropped[3];
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_ds_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_DS_STATS_DST_INVALID:
 | 
					 | 
				
			||||||
		tcnt = s->dst_invalid;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_ds_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_DS_STATS_EXCEPTION_PKT:
 | 
					 | 
				
			||||||
		tcnt = s->exception_cnt;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_ds_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	default:
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						memcpy((void *)cmn_stats, (void *)&tun_ds_stats[index], sizeof(*cmn_stats));
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
@@ -88,47 +57,45 @@ static ssize_t nss_gre_redir_lag_ds_cmn_stats_read_entry(char *line, int len, in
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
static ssize_t nss_gre_redir_lag_ds_cmn_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
					static ssize_t nss_gre_redir_lag_ds_cmn_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ssize_t bytes_read = 0;
 | 
						/*
 | 
				
			||||||
 | 
						 * Max output lines = #stats +
 | 
				
			||||||
 | 
						 * few blank lines for banner printing + Number of Extra outputlines
 | 
				
			||||||
 | 
						 * for future reference to add new stats
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						uint32_t max_output_lines = NSS_GRE_REDIR_LAG_DS_STATS_MAX + NSS_STATS_EXTRA_OUTPUT_LINES;
 | 
				
			||||||
 | 
						size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines;
 | 
				
			||||||
	struct nss_stats_data *data = fp->private_data;
 | 
						struct nss_stats_data *data = fp->private_data;
 | 
				
			||||||
	struct nss_gre_redir_lag_ds_tun_stats stats;
 | 
						struct nss_gre_redir_lag_ds_tun_stats stats;
 | 
				
			||||||
	size_t bytes;
 | 
						ssize_t bytes_read = 0;
 | 
				
			||||||
	char line[80];
 | 
						size_t size_wr = 0;
 | 
				
			||||||
	int start;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (data->index < NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
						char *lbuf = kzalloc(size_al, GFP_KERNEL);
 | 
				
			||||||
		if (nss_gre_redir_lag_ds_get_cmn_stats(&stats, data->index)) {
 | 
						if (unlikely(!lbuf)) {
 | 
				
			||||||
			break;
 | 
							nss_warning("Could not allocate memory for local statistics buffer");
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		data->index++;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (data->index == NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
					 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bytes = snprintf(line, sizeof(line), "\nTunnel stats for \n");
 | 
						while (data->index < NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
				
			||||||
	if (copy_to_user(ubuf, line, bytes) != 0) {
 | 
							if (nss_gre_redir_lag_ds_stats_get(&stats, data->index)) {
 | 
				
			||||||
		return -EFAULT;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bytes_read += bytes;
 | 
					 | 
				
			||||||
	start = NSS_STATS_NODE_RX_PKTS;
 | 
					 | 
				
			||||||
	while (bytes_read < sz && start < NSS_GRE_REDIR_LAG_DS_STATS_MAX) {
 | 
					 | 
				
			||||||
		bytes = nss_gre_redir_lag_ds_cmn_stats_read_entry(line, sizeof(line), start, &stats);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if ((bytes_read + bytes) > sz)
 | 
					 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (copy_to_user(ubuf + bytes_read, line, bytes) != 0) {
 | 
					 | 
				
			||||||
			return -EFAULT;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		bytes_read += bytes;
 | 
					 | 
				
			||||||
		start++;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		data->index++;
 | 
							data->index++;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (data->index >= NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
				
			||||||
 | 
							kfree(lbuf);
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						size_wr += nss_stats_banner(lbuf, size_wr, size_al, "gre_redir_lag_ds stats", NSS_STATS_SINGLE_CORE);
 | 
				
			||||||
 | 
						size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\nTunnel stats for %03u\n", stats.ifnum);
 | 
				
			||||||
 | 
						size_wr += nss_stats_print("gre_redir_lag_ds", NULL, NSS_STATS_SINGLE_INSTANCE, nss_gre_redir_lag_ds_strings_stats,
 | 
				
			||||||
 | 
										&stats.rx_packets, NSS_GRE_REDIR_LAG_DS_STATS_MAX, lbuf, size_wr, size_al);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf));
 | 
				
			||||||
 | 
						data->index++;
 | 
				
			||||||
 | 
						kfree(lbuf);
 | 
				
			||||||
	return bytes_read;
 | 
						return bytes_read;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -161,3 +128,84 @@ struct dentry *nss_gre_redir_lag_ds_stats_dentry_create(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return cmn_stats;
 | 
						return cmn_stats;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_stats_sync()
 | 
				
			||||||
 | 
					 *	Update synchonized statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_lag_ds_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_lag_ds_sync_stats_msg *ngss, uint32_t ifnum)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int idx, j;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
 | 
						if (!nss_gre_redir_lag_ds_get_node_idx(ifnum, &idx)) {
 | 
				
			||||||
 | 
							spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
 | 
							nss_warning("%px: Unable to update hash stats msg. Stats context not found.\n", nss_ctx);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						tun_ds_stats[idx].tx_packets += ngss->node_stats.tx_packets;
 | 
				
			||||||
 | 
						tun_ds_stats[idx].tx_bytes += ngss->node_stats.tx_bytes;
 | 
				
			||||||
 | 
						tun_ds_stats[idx].rx_packets += ngss->node_stats.rx_packets;
 | 
				
			||||||
 | 
						tun_ds_stats[idx].rx_bytes += ngss->node_stats.rx_bytes;
 | 
				
			||||||
 | 
						for (j = 0; j < NSS_MAX_NUM_PRI; j++) {
 | 
				
			||||||
 | 
							tun_ds_stats[idx].rx_dropped[j] += ngss->node_stats.rx_dropped[j];
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						tun_ds_stats[idx].dst_invalid += ngss->ds_stats.dst_invalid;
 | 
				
			||||||
 | 
						tun_ds_stats[idx].exception_cnt += ngss->ds_stats.exception_cnt;
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_stats_notify()
 | 
				
			||||||
 | 
					 *	Sends notifications to all the registered modules.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Leverage NSS-FW statistics timing to update Netlink.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_lag_ds_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_gre_redir_lag_ds_stats_notification *stats_notify;
 | 
				
			||||||
 | 
						int idx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						stats_notify = kzalloc(sizeof(struct nss_gre_redir_lag_ds_stats_notification), GFP_ATOMIC);
 | 
				
			||||||
 | 
						if (!stats_notify) {
 | 
				
			||||||
 | 
							nss_warning("Unable to allocate memory for stats notification\n");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
 | 
						if (!nss_gre_redir_lag_ds_get_node_idx(if_num, &idx)) {
 | 
				
			||||||
 | 
							spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
 | 
							nss_warning("%px: Unable to update hash stats msg. Stats context not found.\n", nss_ctx);
 | 
				
			||||||
 | 
							kfree(stats_notify);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						stats_notify->core_id = nss_ctx->id;
 | 
				
			||||||
 | 
						stats_notify->if_num = if_num;
 | 
				
			||||||
 | 
						memcpy(&(stats_notify->stats_ctx), &(tun_ds_stats[idx]), sizeof(stats_notify->stats_ctx));
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_redir_lag_ds_stats_lock);
 | 
				
			||||||
 | 
						atomic_notifier_call_chain(&nss_gre_redir_lag_ds_stats_notifier, NSS_STATS_EVENT_NOTIFY, stats_notify);
 | 
				
			||||||
 | 
						kfree(stats_notify);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_stats_unregister_notifier()
 | 
				
			||||||
 | 
					 *	Deregisters statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_gre_redir_lag_ds_stats_unregister_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_unregister(&nss_gre_redir_lag_ds_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_redir_lag_ds_stats_unregister_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_stats_register_notifier()
 | 
				
			||||||
 | 
					 *	Registers statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_gre_redir_lag_ds_stats_register_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_register(&nss_gre_redir_lag_ds_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_redir_lag_ds_stats_register_notifier);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 ******************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2018, 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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -11,20 +11,18 @@
 | 
				
			|||||||
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 * ****************************************************************************
 | 
					 * ************************************************************************
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __NSS_GRE_REDIR_LAG_DS_STATS_H__
 | 
					#ifndef __NSS_GRE_REDIR_LAG_DS_STATS_H__
 | 
				
			||||||
#define __NSS_GRE_REDIR_LAG_DS_STATS_H__
 | 
					#define __NSS_GRE_REDIR_LAG_DS_STATS_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					extern spinlock_t nss_gre_redir_lag_ds_stats_lock;
 | 
				
			||||||
 * GRE redirect LAG downstream statistics
 | 
					extern void nss_gre_redir_lag_ds_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num);
 | 
				
			||||||
 */
 | 
					extern bool nss_gre_redir_lag_ds_verify_ifnum(uint32_t if_num);
 | 
				
			||||||
enum nss_gre_redir_lag_ds_stats_types {
 | 
					extern bool nss_gre_redir_lag_ds_get_node_idx(uint32_t ifnum, uint32_t *idx);
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_DS_STATS_DST_INVALID = NSS_STATS_NODE_MAX,
 | 
					extern void nss_gre_redir_lag_ds_stats_sync(struct nss_ctx_instance *nss_ctx,
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_DS_STATS_EXCEPTION_PKT,
 | 
										struct nss_gre_redir_lag_ds_sync_stats_msg *ngss, uint32_t ifnum);
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_DS_STATS_MAX,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extern struct dentry *nss_gre_redir_lag_ds_stats_dentry_create(void);
 | 
					extern struct dentry *nss_gre_redir_lag_ds_stats_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										60
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_lag_ds_strings.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_lag_ds_strings.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_stats.h"
 | 
				
			||||||
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_strings.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_lag_ds_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_strings_stats
 | 
				
			||||||
 | 
					 *	GRE REDIR LAG DS common statistics strings.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_stats_info nss_gre_redir_lag_ds_strings_stats[NSS_GRE_REDIR_LAG_DS_STATS_MAX] = {
 | 
				
			||||||
 | 
						{"rx_packets",		NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_bytes",		NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx_packets",		NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx_bytes",		NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_dropped_0",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_dropped_1",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_dropped_2",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_dropped_3",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"dst_invalid",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"exception_packets",	NSS_STATS_TYPE_SPECIAL}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_strings_read()
 | 
				
			||||||
 | 
					 *	Read gre_redir_lag_ds statistics names
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_gre_redir_lag_ds_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return nss_strings_print(ubuf, sz, ppos, nss_gre_redir_lag_ds_strings_stats, NSS_GRE_REDIR_LAG_DS_STATS_MAX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_strings_ops
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STRINGS_DECLARE_FILE_OPERATIONS(gre_redir_lag_ds);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_ds_strings_dentry_create()
 | 
				
			||||||
 | 
					 *	Create gre_redir_lag_ds statistics strings debug entry.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_lag_ds_strings_dentry_create(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nss_strings_create_dentry("gre_redir_lag_ds", &nss_gre_redir_lag_ds_strings_ops);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_lag_ds_strings.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_lag_ds_strings.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_GRE_REDIR_LAG_DS_STRINGS_H
 | 
				
			||||||
 | 
					#define __NSS_GRE_REDIR_LAG_DS_STRINGS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_gre_redir_lag_ds_stats.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct nss_stats_info nss_gre_redir_lag_ds_strings_stats[NSS_GRE_REDIR_LAG_DS_STATS_MAX];
 | 
				
			||||||
 | 
					extern void nss_gre_redir_lag_ds_strings_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_GRE_REDIR_LAG_DS_STRINGS_H */
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 ****************************************************************************
 | 
				
			||||||
 * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2018, 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -11,39 +11,19 @@
 | 
				
			|||||||
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 **************************************************************************
 | 
					 ****************************************************************************
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
#include "nss_gre_redir_lag_us_stats.h"
 | 
					#include "nss_gre_redir_lag_us_stats.h"
 | 
				
			||||||
#include "nss_gre_redir_lag_us_log.h"
 | 
					#include "nss_gre_redir_lag_us_log.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_lag_us_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NSS_GRE_REDIR_LAG_US_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
					#define NSS_GRE_REDIR_LAG_US_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
				
			||||||
#define NSS_GRE_REDIR_LAG_US_STATS_SYNC_PERIOD msecs_to_jiffies(4000)
 | 
					#define NSS_GRE_REDIR_LAG_US_STATS_SYNC_PERIOD msecs_to_jiffies(4000)
 | 
				
			||||||
#define NSS_GRE_REDIR_LAG_US_STATS_SYNC_UDELAY 4000
 | 
					#define NSS_GRE_REDIR_LAG_US_STATS_SYNC_UDELAY 4000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					struct nss_gre_redir_lag_us_cmn_ctx cmn_ctx;
 | 
				
			||||||
 * nss_gre_redir_lag_us_pvt_sync_stats
 | 
					 | 
				
			||||||
 *	Hash statistics synchronization context.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_gre_redir_lag_us_pvt_sync_stats {
 | 
					 | 
				
			||||||
	struct delayed_work nss_gre_redir_lag_us_work;			/**< Delayed work per LAG US node. */
 | 
					 | 
				
			||||||
	struct nss_gre_redir_lag_us_msg db_sync_msg;			/**< Hash statistics message. */
 | 
					 | 
				
			||||||
	struct nss_gre_redir_lag_us_tunnel_stats tun_stats;		/**< GRE redirect LAG common statistics. */
 | 
					 | 
				
			||||||
	nss_gre_redir_lag_us_msg_callback_t cb;				/**< Callback for hash query message. */
 | 
					 | 
				
			||||||
	void *app_data;							/**< app_data for hash query message. */
 | 
					 | 
				
			||||||
	uint32_t ifnum;							/**< NSS interface number. */
 | 
					 | 
				
			||||||
	bool valid;							/**< Valid flag. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * Common context for stats update.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static struct nss_gre_redir_lag_us_cmn_ctx {
 | 
					 | 
				
			||||||
	spinlock_t nss_gre_redir_lag_us_stats_lock;			/**< Spin lock. */
 | 
					 | 
				
			||||||
	struct workqueue_struct *nss_gre_redir_lag_us_wq;		/**< Work queue. */
 | 
					 | 
				
			||||||
	struct nss_gre_redir_lag_us_pvt_sync_stats stats_ctx[NSS_GRE_REDIR_LAG_MAX_NODE];
 | 
					 | 
				
			||||||
} cmn_ctx;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Sync response context.
 | 
					 * Sync response context.
 | 
				
			||||||
@@ -82,61 +62,6 @@ static void nss_gre_redir_lag_us_callback(void *app_data, struct nss_gre_redir_l
 | 
				
			|||||||
	complete(&nss_gre_redir_lag_us_sync_ctx.complete);
 | 
						complete(&nss_gre_redir_lag_us_sync_ctx.complete);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_lag_us_get_node_idx()
 | 
					 | 
				
			||||||
 *	Returns index of statistics context.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static bool nss_gre_redir_lag_us_get_node_idx(uint32_t ifnum, uint32_t *idx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	uint32_t node_idx;
 | 
					 | 
				
			||||||
	for (node_idx = 0; node_idx < NSS_GRE_REDIR_LAG_MAX_NODE; node_idx++) {
 | 
					 | 
				
			||||||
		if ((cmn_ctx.stats_ctx[node_idx].valid) && (cmn_ctx.stats_ctx[node_idx].ifnum == ifnum)) {
 | 
					 | 
				
			||||||
			*idx = node_idx;
 | 
					 | 
				
			||||||
			return true;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return false;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_lag_us_update_sync_stats()
 | 
					 | 
				
			||||||
 *	Update synchonized statistics.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void nss_gre_redir_lag_us_update_sync_stats(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_lag_us_cmn_sync_stats_msg *ngss,
 | 
					 | 
				
			||||||
		uint32_t ifnum)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	int idx, j;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
					 | 
				
			||||||
	if (!nss_gre_redir_lag_us_get_node_idx(ifnum, &idx)) {
 | 
					 | 
				
			||||||
		spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
					 | 
				
			||||||
		nss_warning("%px: Unable to update hash stats msg. Stats context not found.\n", nss_ctx);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.tx_packets += ngss->node_stats.tx_packets;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.tx_bytes += ngss->node_stats.tx_bytes;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.rx_packets += ngss->node_stats.rx_packets;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.rx_bytes += ngss->node_stats.rx_bytes;
 | 
					 | 
				
			||||||
	for (j = 0; j < NSS_MAX_NUM_PRI; j++) {
 | 
					 | 
				
			||||||
		cmn_ctx.stats_ctx[idx].tun_stats.rx_dropped[j] += ngss->node_stats.rx_dropped[j];
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.us_stats.amsdu_pkts += ngss->us_stats.amsdu_pkts;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.us_stats.amsdu_pkts_enqueued += ngss->us_stats.amsdu_pkts_enqueued;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.us_stats.amsdu_pkts_exceptioned += ngss->us_stats.amsdu_pkts_exceptioned;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.us_stats.exceptioned += ngss->us_stats.exceptioned;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.us_stats.freed += ngss->us_stats.freed;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.db_stats.add_attempt += ngss->db_stats.add_attempt;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.db_stats.add_success += ngss->db_stats.add_success;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.db_stats.add_fail_table_full += ngss->db_stats.add_fail_table_full;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.db_stats.add_fail_exists += ngss->db_stats.add_fail_exists;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.db_stats.del_attempt += ngss->db_stats.del_attempt;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.db_stats.del_success += ngss->db_stats.del_success;
 | 
					 | 
				
			||||||
	cmn_ctx.stats_ctx[idx].tun_stats.db_stats.del_fail_not_found += ngss->db_stats.del_fail_not_found;
 | 
					 | 
				
			||||||
	spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_lag_us_hash_update_stats_req()
 | 
					 * nss_gre_redir_lag_us_hash_update_stats_req()
 | 
				
			||||||
 *	Update query hash message's index for next request.
 | 
					 *	Update query hash message's index for next request.
 | 
				
			||||||
@@ -167,24 +92,13 @@ static void nss_gre_redir_lag_us_hash_update_stats_req(struct nss_ctx_instance *
 | 
				
			|||||||
	 * If more hash entries are to be fetched from FW, queue work with delay of one eighth of
 | 
						 * If more hash entries are to be fetched from FW, queue work with delay of one eighth of
 | 
				
			||||||
	 * the polling period. Else, schedule work with a delay of polling period.
 | 
						 * the polling period. Else, schedule work with a delay of polling period.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (cmn_ctx.stats_ctx[idx].db_sync_msg.msg.hash_stats.db_entry_idx) {
 | 
						if (cmn_ctx.stats_ctx[idx].db_sync_msg.msg.hash_stats.db_entry_idx)
 | 
				
			||||||
		sync_delay = NSS_GRE_REDIR_LAG_US_STATS_SYNC_PERIOD / 8;
 | 
							sync_delay = NSS_GRE_REDIR_LAG_US_STATS_SYNC_PERIOD / 8;
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	queue_delayed_work(cmn_ctx.nss_gre_redir_lag_us_wq, &(cmn_ctx.stats_ctx[idx].nss_gre_redir_lag_us_work),
 | 
						queue_delayed_work(cmn_ctx.nss_gre_redir_lag_us_wq, &(cmn_ctx.stats_ctx[idx].nss_gre_redir_lag_us_work), sync_delay);
 | 
				
			||||||
				sync_delay);
 | 
					 | 
				
			||||||
	spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
						spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_lag_us_verify_ifnum()
 | 
					 | 
				
			||||||
 *	Verify interface type.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static bool nss_gre_redir_lag_us_verify_ifnum(uint32_t if_num)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return nss_dynamic_interface_get_type(nss_gre_redir_lag_us_get_context(), if_num) == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_lag_us_handler()
 | 
					 * nss_gre_redir_lag_us_handler()
 | 
				
			||||||
 *	Handle NSS -> HLOS messages for gre tunnel
 | 
					 *	Handle NSS -> HLOS messages for gre tunnel
 | 
				
			||||||
@@ -234,7 +148,8 @@ static void nss_gre_redir_lag_us_msg_handler(struct nss_ctx_instance *nss_ctx, s
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	switch (ncm->type) {
 | 
						switch (ncm->type) {
 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_CMN_STATS_SYNC_MSG:
 | 
						case NSS_GRE_REDIR_LAG_US_CMN_STATS_SYNC_MSG:
 | 
				
			||||||
		nss_gre_redir_lag_us_update_sync_stats(nss_ctx, &ngrm->msg.us_sync_stats, ncm->interface);
 | 
							nss_gre_redir_lag_us_stats_sync(nss_ctx, &ngrm->msg.us_sync_stats, ncm->interface);
 | 
				
			||||||
 | 
							nss_gre_redir_lag_us_stats_notify(nss_ctx, ncm->interface);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_DB_HASH_NODE_MSG:
 | 
						case NSS_GRE_REDIR_LAG_US_DB_HASH_NODE_MSG:
 | 
				
			||||||
@@ -513,6 +428,32 @@ static struct nss_ctx_instance *nss_gre_redir_lag_us_register_if(uint32_t if_num
 | 
				
			|||||||
	return nss_ctx;
 | 
						return nss_ctx;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_get_node_idx()
 | 
				
			||||||
 | 
					 *	Returns index of statistics context.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					bool nss_gre_redir_lag_us_get_node_idx(uint32_t ifnum, uint32_t *idx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						uint32_t node_idx;
 | 
				
			||||||
 | 
						for (node_idx = 0; node_idx < NSS_GRE_REDIR_LAG_MAX_NODE; node_idx++) {
 | 
				
			||||||
 | 
							if ((cmn_ctx.stats_ctx[node_idx].valid) && (cmn_ctx.stats_ctx[node_idx].ifnum == ifnum)) {
 | 
				
			||||||
 | 
								*idx = node_idx;
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_verify_ifnum()
 | 
				
			||||||
 | 
					 *	Verify interface type.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					bool nss_gre_redir_lag_us_verify_ifnum(uint32_t if_num)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return nss_dynamic_interface_get_type(nss_gre_redir_lag_us_get_context(), if_num) == NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_lag_us_get_context()
 | 
					 * nss_gre_redir_lag_us_get_context()
 | 
				
			||||||
 *	Retrieve context for GRE redirect LAG upstream node.
 | 
					 *	Retrieve context for GRE redirect LAG upstream node.
 | 
				
			||||||
@@ -605,29 +546,6 @@ bool nss_gre_redir_lag_us_configure_node(uint32_t ifnum,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(nss_gre_redir_lag_us_configure_node);
 | 
					EXPORT_SYMBOL(nss_gre_redir_lag_us_configure_node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_lag_us_get_cmn_stats()
 | 
					 | 
				
			||||||
 *	Common upstream statistics.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
bool nss_gre_redir_lag_us_get_cmn_stats(struct nss_gre_redir_lag_us_tunnel_stats *cmn_stats, uint32_t index)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if (index >= NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
					 | 
				
			||||||
		nss_warning("Index is out of valid range %u\n", index);
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
					 | 
				
			||||||
	if (!cmn_ctx.stats_ctx[index].valid) {
 | 
					 | 
				
			||||||
		spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
					 | 
				
			||||||
		nss_warning("Common context not found for the index %u\n", index);
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	memcpy((void *)cmn_stats, (void *)&(cmn_ctx.stats_ctx[index].tun_stats), sizeof(*cmn_stats));
 | 
					 | 
				
			||||||
	spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
					 | 
				
			||||||
	return true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_lag_us_tx_msg()
 | 
					 * nss_gre_redir_lag_us_tx_msg()
 | 
				
			||||||
 *	Transmit a GRE LAG message to NSS firmware asynchronously.
 | 
					 *	Transmit a GRE LAG message to NSS firmware asynchronously.
 | 
				
			||||||
@@ -738,6 +656,7 @@ void nss_gre_redir_lag_us_register_handler(void)
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						nss_gre_redir_lag_us_strings_dentry_create();
 | 
				
			||||||
	nss_gre_redir_lag_us_sync_ctx.cb = NULL;
 | 
						nss_gre_redir_lag_us_sync_ctx.cb = NULL;
 | 
				
			||||||
	nss_gre_redir_lag_us_sync_ctx.app_data = NULL;
 | 
						nss_gre_redir_lag_us_sync_ctx.app_data = NULL;
 | 
				
			||||||
	sema_init(&nss_gre_redir_lag_us_sync_ctx.sem, 1);
 | 
						sema_init(&nss_gre_redir_lag_us_sync_ctx.sem, 1);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -17,109 +17,39 @@
 | 
				
			|||||||
#include "nss_core.h"
 | 
					#include "nss_core.h"
 | 
				
			||||||
#include "nss_gre_redir_lag.h"
 | 
					#include "nss_gre_redir_lag.h"
 | 
				
			||||||
#include "nss_gre_redir_lag_us_stats.h"
 | 
					#include "nss_gre_redir_lag_us_stats.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_lag_us_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NSS_GRE_REDIR_LAG_US_STATS_SYNC_PERIOD msecs_to_jiffies(4000)
 | 
				
			||||||
 | 
					#define NSS_GRE_REDIR_LAG_US_STATS_SYNC_UDELAY 4000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_lag_us_stats_str
 | 
					 * Declare atomic notifier data structure for statistics.
 | 
				
			||||||
 *	GRE REDIR LAG US common statistics strings.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static uint8_t *nss_gre_redir_lag_us_stats_str[NSS_GRE_REDIR_LAG_US_STATS_MAX] = {
 | 
					ATOMIC_NOTIFIER_HEAD(nss_gre_redir_lag_us_stats_notifier);
 | 
				
			||||||
	"rx_packets",
 | 
					
 | 
				
			||||||
	"rx_bytes",
 | 
					extern struct nss_gre_redir_lag_us_cmn_ctx cmn_ctx;
 | 
				
			||||||
	"tx_packets",
 | 
					 | 
				
			||||||
	"tx_bytes",
 | 
					 | 
				
			||||||
	"rx_queue_0_dropped",
 | 
					 | 
				
			||||||
	"rx_queue_1_dropped",
 | 
					 | 
				
			||||||
	"rx_queue_2_dropped",
 | 
					 | 
				
			||||||
	"rx_queue_3_dropped",
 | 
					 | 
				
			||||||
	"Amsdu pkts",
 | 
					 | 
				
			||||||
	"Amsdu pkts enqueued",
 | 
					 | 
				
			||||||
	"Amsdu pkts exceptioned",
 | 
					 | 
				
			||||||
	"Exceptioned",
 | 
					 | 
				
			||||||
	"Freed",
 | 
					 | 
				
			||||||
	"add attempt",
 | 
					 | 
				
			||||||
	"add success",
 | 
					 | 
				
			||||||
	"add fail table full",
 | 
					 | 
				
			||||||
	"add fail exists",
 | 
					 | 
				
			||||||
	"del attempt",
 | 
					 | 
				
			||||||
	"del success",
 | 
					 | 
				
			||||||
	"del fail not found",
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_lag_us_tunnel_stats()
 | 
					 * nss_gre_redir_lag_us_stats_get
 | 
				
			||||||
 *	Make a row for GRE_REDIR LAG US stats.
 | 
					 *	Get the common upstream statistics.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static ssize_t nss_gre_redir_lag_us_cmn_stats_read_entry(char *line, int len, int type, struct nss_gre_redir_lag_us_tunnel_stats *s)
 | 
					bool nss_gre_redir_lag_us_stats_get(struct nss_gre_redir_lag_us_tunnel_stats *cmn_stats, uint32_t index)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint64_t tcnt = 0;
 | 
						if (index >= NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
				
			||||||
 | 
							nss_warning("Index is out of valid range %u\n", index);
 | 
				
			||||||
	switch (type) {
 | 
							return false;
 | 
				
			||||||
	case NSS_STATS_NODE_RX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->rx_packets;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "Common node stats start:\n\n%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_RX_BYTES:
 | 
					 | 
				
			||||||
		tcnt = s->rx_bytes;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_TX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->tx_packets;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_TX_BYTES:
 | 
					 | 
				
			||||||
		tcnt = s->tx_bytes;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_RX_QUEUE_0_DROPPED:
 | 
					 | 
				
			||||||
		tcnt = s->rx_dropped[0];
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
#if (NSS_MAX_NUM_PRI > 1)
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_RX_QUEUE_1_DROPPED:
 | 
					 | 
				
			||||||
		tcnt = s->rx_dropped[1];
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_RX_QUEUE_2_DROPPED:
 | 
					 | 
				
			||||||
		tcnt = s->rx_dropped[2];
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_STATS_NODE_RX_QUEUE_3_DROPPED:
 | 
					 | 
				
			||||||
		tcnt = s->rx_dropped[3];
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_AMSDU_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->us_stats.amsdu_pkts;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_AMSDU_PKTS_ENQUEUED:
 | 
					 | 
				
			||||||
		tcnt = s->us_stats.amsdu_pkts_enqueued;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_AMSDU_PKTS_EXCEPTIONED:
 | 
					 | 
				
			||||||
		tcnt = s->us_stats.amsdu_pkts_exceptioned;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_EXCEPTIONED:
 | 
					 | 
				
			||||||
		tcnt = s->us_stats.exceptioned;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_FREED:
 | 
					 | 
				
			||||||
		tcnt = s->us_stats.freed;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_ADD_ATTEMPT:
 | 
					 | 
				
			||||||
		tcnt = s->db_stats.add_attempt;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_ADD_SUCCESS:
 | 
					 | 
				
			||||||
		tcnt = s->db_stats.add_success;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_ADD_FAIL_TABLE_FULL:
 | 
					 | 
				
			||||||
		tcnt = s->db_stats.add_fail_table_full;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_ADD_FAIL_EXISTS:
 | 
					 | 
				
			||||||
		tcnt = s->db_stats.add_fail_exists;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_DEL_ATTEMPT:
 | 
					 | 
				
			||||||
		tcnt = s->db_stats.del_attempt;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_DEL_SUCCESS:
 | 
					 | 
				
			||||||
		tcnt = s->db_stats.del_success;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_LAG_US_STATS_DEL_FAIL_NOT_FOUND:
 | 
					 | 
				
			||||||
		tcnt = s->db_stats.del_fail_not_found;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_lag_us_stats_str[type], tcnt);
 | 
					 | 
				
			||||||
	default:
 | 
					 | 
				
			||||||
		nss_warning("Unknown tunnel stats type.\n");
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
				
			||||||
 | 
						if (!cmn_ctx.stats_ctx[index].valid) {
 | 
				
			||||||
 | 
							spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
				
			||||||
 | 
							nss_warning("Common context not found for the index %u\n", index);
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						memcpy((void *)cmn_stats, (void *)&(cmn_ctx.stats_ctx[index].tun_stats), sizeof(*cmn_stats));
 | 
				
			||||||
 | 
						spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
@@ -128,15 +58,26 @@ static ssize_t nss_gre_redir_lag_us_cmn_stats_read_entry(char *line, int len, in
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
static ssize_t nss_gre_redir_lag_us_cmn_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
					static ssize_t nss_gre_redir_lag_us_cmn_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ssize_t bytes_read = 0;
 | 
						/*
 | 
				
			||||||
 | 
						 * Max output lines = #stats +
 | 
				
			||||||
 | 
						 * few blank lines for banner printing + Number of Extra outputlines
 | 
				
			||||||
 | 
						 * for future reference to add new stats
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						uint32_t max_output_lines = NSS_GRE_REDIR_LAG_US_STATS_MAX + NSS_STATS_EXTRA_OUTPUT_LINES;
 | 
				
			||||||
 | 
						size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines;
 | 
				
			||||||
	struct nss_stats_data *data = fp->private_data;
 | 
						struct nss_stats_data *data = fp->private_data;
 | 
				
			||||||
	struct nss_gre_redir_lag_us_tunnel_stats stats;
 | 
						struct nss_gre_redir_lag_us_tunnel_stats stats;
 | 
				
			||||||
	size_t bytes;
 | 
						ssize_t bytes_read = 0;
 | 
				
			||||||
	char line[80];
 | 
						size_t size_wr = 0;
 | 
				
			||||||
	int start;
 | 
					
 | 
				
			||||||
 | 
						char *lbuf = kzalloc(size_al, GFP_KERNEL);
 | 
				
			||||||
 | 
						if (unlikely(!lbuf)) {
 | 
				
			||||||
 | 
							nss_warning("Could not allocate memory for local statistics buffer");
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (data->index < NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
						while (data->index < NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
				
			||||||
		if (nss_gre_redir_lag_us_get_cmn_stats(&stats, data->index)) {
 | 
							if (nss_gre_redir_lag_us_stats_get(&stats, data->index)) {
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -144,31 +85,17 @@ static ssize_t nss_gre_redir_lag_us_cmn_stats_read(struct file *fp, char __user
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (data->index == NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
						if (data->index == NSS_GRE_REDIR_LAG_MAX_NODE) {
 | 
				
			||||||
 | 
							kfree(lbuf);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bytes = snprintf(line, sizeof(line), "\nTunnel stats");
 | 
						size_wr += nss_stats_banner(lbuf, size_wr, size_al, "gre_redir_lag_us stats", NSS_STATS_SINGLE_CORE);
 | 
				
			||||||
	if (copy_to_user(ubuf, line, bytes) != 0) {
 | 
						size_wr += nss_stats_print("gre_redir_lag_us", NULL, NSS_STATS_SINGLE_INSTANCE, nss_gre_redir_lag_us_strings_stats,
 | 
				
			||||||
		return -EFAULT;
 | 
										&stats.rx_packets, NSS_GRE_REDIR_LAG_US_STATS_MAX, lbuf, size_wr, size_al);
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bytes_read += bytes;
 | 
					 | 
				
			||||||
	start = NSS_STATS_NODE_RX_PKTS;
 | 
					 | 
				
			||||||
	while (bytes_read < sz && start <= NSS_GRE_REDIR_LAG_US_STATS_DEL_FAIL_NOT_FOUND) {
 | 
					 | 
				
			||||||
		bytes = nss_gre_redir_lag_us_cmn_stats_read_entry(line, sizeof(line), start, &stats);
 | 
					 | 
				
			||||||
		if ((bytes_read + bytes) > sz) {
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (copy_to_user(ubuf + bytes_read, line, bytes) != 0) {
 | 
					 | 
				
			||||||
			return -EFAULT;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		bytes_read += bytes;
 | 
					 | 
				
			||||||
		start++;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf));
 | 
				
			||||||
	data->index++;
 | 
						data->index++;
 | 
				
			||||||
 | 
						kfree(lbuf);
 | 
				
			||||||
	return bytes_read;
 | 
						return bytes_read;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -201,3 +128,99 @@ struct dentry *nss_gre_redir_lag_us_stats_dentry_create(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return cmn_stats;
 | 
						return cmn_stats;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_stats_sync()
 | 
				
			||||||
 | 
					 *	Update synchonized statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_lag_us_stats_sync(struct nss_ctx_instance *nss_ctx,
 | 
				
			||||||
 | 
									struct nss_gre_redir_lag_us_cmn_sync_stats_msg *ngss, uint32_t ifnum)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int idx, j;
 | 
				
			||||||
 | 
						struct nss_gre_redir_lag_us_tunnel_stats *node_stats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
				
			||||||
 | 
						if (!nss_gre_redir_lag_us_get_node_idx(ifnum, &idx)) {
 | 
				
			||||||
 | 
							spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
				
			||||||
 | 
							nss_warning("%px: Unable to update hash stats msg. Stats context not found.\n", nss_ctx);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						node_stats = &cmn_ctx.stats_ctx[idx].tun_stats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						node_stats->tx_packets += ngss->node_stats.tx_packets;
 | 
				
			||||||
 | 
						node_stats->tx_bytes += ngss->node_stats.tx_bytes;
 | 
				
			||||||
 | 
						node_stats->rx_packets += ngss->node_stats.rx_packets;
 | 
				
			||||||
 | 
						node_stats->rx_bytes += ngss->node_stats.rx_bytes;
 | 
				
			||||||
 | 
						for (j = 0; j < NSS_MAX_NUM_PRI; j++) {
 | 
				
			||||||
 | 
							node_stats->rx_dropped[j] += ngss->node_stats.rx_dropped[j];
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						node_stats->us_stats.amsdu_pkts += ngss->us_stats.amsdu_pkts;
 | 
				
			||||||
 | 
						node_stats->us_stats.amsdu_pkts_enqueued += ngss->us_stats.amsdu_pkts_enqueued;
 | 
				
			||||||
 | 
						node_stats->us_stats.amsdu_pkts_exceptioned += ngss->us_stats.amsdu_pkts_exceptioned;
 | 
				
			||||||
 | 
						node_stats->us_stats.exceptioned += ngss->us_stats.exceptioned;
 | 
				
			||||||
 | 
						node_stats->us_stats.freed += ngss->us_stats.freed;
 | 
				
			||||||
 | 
						node_stats->db_stats.add_attempt += ngss->db_stats.add_attempt;
 | 
				
			||||||
 | 
						node_stats->db_stats.add_success += ngss->db_stats.add_success;
 | 
				
			||||||
 | 
						node_stats->db_stats.add_fail_table_full += ngss->db_stats.add_fail_table_full;
 | 
				
			||||||
 | 
						node_stats->db_stats.add_fail_exists += ngss->db_stats.add_fail_exists;
 | 
				
			||||||
 | 
						node_stats->db_stats.del_attempt += ngss->db_stats.del_attempt;
 | 
				
			||||||
 | 
						node_stats->db_stats.del_success += ngss->db_stats.del_success;
 | 
				
			||||||
 | 
						node_stats->db_stats.del_fail_not_found += ngss->db_stats.del_fail_not_found;
 | 
				
			||||||
 | 
						spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_stats_notify()
 | 
				
			||||||
 | 
					 *	Sends notifications to all the registered modules.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Leverage NSS-FW statistics timing to update Netlink.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_lag_us_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_gre_redir_lag_us_stats_notification *stats_notify;
 | 
				
			||||||
 | 
						int idx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						stats_notify = kzalloc(sizeof(struct nss_gre_redir_lag_us_stats_notification), GFP_ATOMIC);
 | 
				
			||||||
 | 
						if (!stats_notify) {
 | 
				
			||||||
 | 
							nss_warning("Unable to allocate memory for stats notification\n");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
				
			||||||
 | 
						if (!nss_gre_redir_lag_us_get_node_idx(if_num, &idx)) {
 | 
				
			||||||
 | 
							spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
				
			||||||
 | 
							nss_warning("%px: Unable to update hash stats msg. Stats context not found.\n", nss_ctx);
 | 
				
			||||||
 | 
							kfree(stats_notify);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						stats_notify->core_id = nss_ctx->id;
 | 
				
			||||||
 | 
						stats_notify->if_num = if_num;
 | 
				
			||||||
 | 
						memcpy(&(stats_notify->stats_ctx), &(cmn_ctx.stats_ctx[idx].tun_stats), sizeof(stats_notify->stats_ctx));
 | 
				
			||||||
 | 
						spin_unlock_bh(&cmn_ctx.nss_gre_redir_lag_us_stats_lock);
 | 
				
			||||||
 | 
						atomic_notifier_call_chain(&nss_gre_redir_lag_us_stats_notifier, NSS_STATS_EVENT_NOTIFY, stats_notify);
 | 
				
			||||||
 | 
						kfree(stats_notify);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_stats_unregister_notifier()
 | 
				
			||||||
 | 
					 *	Deregisters statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_gre_redir_lag_us_stats_unregister_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_unregister(&nss_gre_redir_lag_us_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_redir_lag_us_stats_unregister_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_stats_register_notifier()
 | 
				
			||||||
 | 
					 *	Registers statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_gre_redir_lag_us_stats_register_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_register(&nss_gre_redir_lag_us_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_redir_lag_us_stats_register_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 ******************************************************************************
 | 
					 ******************************************************************************
 | 
				
			||||||
 * Copyright (c) 2018, 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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -18,23 +18,33 @@
 | 
				
			|||||||
#define __NSS_GRE_REDIR_LAG_US_STATS_H__
 | 
					#define __NSS_GRE_REDIR_LAG_US_STATS_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * GRE redirect LAG upstream statistics
 | 
					 * nss_gre_redir_lag_us_pvt_sync_stats
 | 
				
			||||||
 | 
					 *	Hash statistics synchronization context.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum nss_gre_redir_lag_us_stats_types {
 | 
					struct nss_gre_redir_lag_us_pvt_sync_stats {
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_AMSDU_PKTS = NSS_STATS_NODE_MAX,
 | 
						struct delayed_work nss_gre_redir_lag_us_work;		/**< Delayed work per LAG US node. */
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_AMSDU_PKTS_ENQUEUED,
 | 
						struct nss_gre_redir_lag_us_msg db_sync_msg;		/**< Hash statistics message. */
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_AMSDU_PKTS_EXCEPTIONED,
 | 
						struct nss_gre_redir_lag_us_tunnel_stats tun_stats;	/**< GRE redirect LAG common statistics. */
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_EXCEPTIONED,
 | 
						nss_gre_redir_lag_us_msg_callback_t cb;			/**< Callback for hash query message. */
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_FREED,
 | 
						void *app_data;						/**< app_data for hash query message. */
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_ADD_ATTEMPT,
 | 
						uint32_t ifnum;						/**< NSS interface number. */
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_ADD_SUCCESS,
 | 
						bool valid;						/**< Valid flag. */
 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_ADD_FAIL_TABLE_FULL,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_ADD_FAIL_EXISTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_DEL_ATTEMPT,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_DEL_SUCCESS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_DEL_FAIL_NOT_FOUND,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_LAG_US_STATS_MAX,
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Common context for stats update.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_gre_redir_lag_us_cmn_ctx {
 | 
				
			||||||
 | 
						struct workqueue_struct *nss_gre_redir_lag_us_wq;		/**< Work queue. */
 | 
				
			||||||
 | 
						spinlock_t nss_gre_redir_lag_us_stats_lock;			/**< Spin lock. */
 | 
				
			||||||
 | 
						struct nss_gre_redir_lag_us_pvt_sync_stats stats_ctx[NSS_GRE_REDIR_LAG_MAX_NODE];
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern void nss_gre_redir_lag_us_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num);
 | 
				
			||||||
 | 
					extern bool nss_gre_redir_lag_us_get_node_idx(uint32_t ifnum, uint32_t *idx);
 | 
				
			||||||
 | 
					extern bool nss_gre_redir_lag_us_verify_ifnum(uint32_t if_num);
 | 
				
			||||||
 | 
					extern void nss_gre_redir_lag_us_stats_sync(struct nss_ctx_instance *nss_ctx,
 | 
				
			||||||
 | 
										struct nss_gre_redir_lag_us_cmn_sync_stats_msg *ngss, uint32_t ifnum);
 | 
				
			||||||
extern struct dentry *nss_gre_redir_lag_us_stats_dentry_create(void);
 | 
					extern struct dentry *nss_gre_redir_lag_us_stats_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										71
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_lag_us_strings.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_lag_us_strings.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,71 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_stats.h"
 | 
				
			||||||
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_strings.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_lag_us_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_strings_stats
 | 
				
			||||||
 | 
					 *	GRE REDIR LAG US common statistics strings.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_stats_info nss_gre_redir_lag_us_strings_stats[NSS_GRE_REDIR_LAG_US_STATS_MAX] = {
 | 
				
			||||||
 | 
						{"rx_packets",			NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_bytes",			NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx_packets",			NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx_bytes",			NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_dropped_0",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_dropped_1",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_dropped_2",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_dropped_3",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"Amsdu pkts",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Amsdu pkts enqueued",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Amsdu pkts exceptioned",	NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"Exceptioned",			NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"Freed",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"add attempt",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"add success",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"add fail table full",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"add fail exists",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"del attempt",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"del success",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"del fail not found",		NSS_STATS_TYPE_SPECIAL}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_strings_read()
 | 
				
			||||||
 | 
					 *	Read gre_redir_lag_us statistics names
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_gre_redir_lag_us_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return nss_strings_print(ubuf, sz, ppos, nss_gre_redir_lag_us_strings_stats, NSS_GRE_REDIR_LAG_US_STATS_MAX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_strings_ops
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STRINGS_DECLARE_FILE_OPERATIONS(gre_redir_lag_us);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_lag_us_strings_dentry_create()
 | 
				
			||||||
 | 
					 *	Create gre_redir_lag_us statistics strings debug entry.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_lag_us_strings_dentry_create(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nss_strings_create_dentry("gre_redir_lag_us", &nss_gre_redir_lag_us_strings_ops);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_lag_us_strings.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_lag_us_strings.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_GRE_REDIR_LAG_US_STRINGS_H
 | 
				
			||||||
 | 
					#define __NSS_GRE_REDIR_LAG_US_STRINGS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_gre_redir_lag_us_stats.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct nss_stats_info nss_gre_redir_lag_us_strings_stats[NSS_GRE_REDIR_LAG_US_STATS_MAX];
 | 
				
			||||||
 | 
					extern void nss_gre_redir_lag_us_strings_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_GRE_REDIR_LAG_US_STRINGS_H */
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -15,6 +15,7 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_mark_strings.h"
 | 
				
			||||||
#include "nss_gre_redir_mark_stats.h"
 | 
					#include "nss_gre_redir_mark_stats.h"
 | 
				
			||||||
#include "nss_gre_redir_mark_log.h"
 | 
					#include "nss_gre_redir_mark_log.h"
 | 
				
			||||||
#define NSS_GRE_REDIR_MARK_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
					#define NSS_GRE_REDIR_MARK_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
				
			||||||
@@ -28,16 +29,6 @@ static struct {
 | 
				
			|||||||
	int response;
 | 
						int response;
 | 
				
			||||||
} nss_gre_redir_mark_pvt;
 | 
					} nss_gre_redir_mark_pvt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * Spinlock to update GRE redir mark stats.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static DEFINE_SPINLOCK(nss_gre_redir_mark_stats_lock);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * Global GRE redir mark stats structure.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static struct nss_gre_redir_mark_stats gre_mark_stats;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_mark_msg_sync_callback()
 | 
					 * nss_gre_redir_mark_msg_sync_callback()
 | 
				
			||||||
 *	Callback to handle the completion of HLOS-->NSS messages.
 | 
					 *	Callback to handle the completion of HLOS-->NSS messages.
 | 
				
			||||||
@@ -53,54 +44,6 @@ static void nss_gre_redir_mark_msg_sync_callback(void *app_data, struct nss_gre_
 | 
				
			|||||||
	complete(&nss_gre_redir_mark_pvt.complete);
 | 
						complete(&nss_gre_redir_mark_pvt.complete);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_mark_stats_sync()
 | 
					 | 
				
			||||||
 *	Update GRE redir mark stats.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void nss_gre_redir_mark_stats_sync(struct nss_ctx_instance *nss_ctx, int if_num, struct nss_gre_redir_mark_stats_sync_msg *ngss)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	struct net_device *dev;
 | 
					 | 
				
			||||||
	dev = nss_cmn_get_interface_dev(nss_ctx, if_num);
 | 
					 | 
				
			||||||
	if (!dev) {
 | 
					 | 
				
			||||||
		nss_warning("%px: Unable to find net device for the interface %d\n", nss_ctx, if_num);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (if_num != NSS_GRE_REDIR_MARK_INTERFACE) {
 | 
					 | 
				
			||||||
		nss_warning("%px: Unknown type for interface %d\n", nss_ctx, if_num);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * Update the stats in exclusive mode to prevent the read from the process
 | 
					 | 
				
			||||||
	 * context through debug fs.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	spin_lock_bh(&nss_gre_redir_mark_stats_lock);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * Update the common node stats
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_TX_PKTS] += ngss->node_stats.tx_packets;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_TX_BYTES] += ngss->node_stats.tx_bytes;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_RX_PKTS] += ngss->node_stats.rx_packets;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_RX_BYTES] += ngss->node_stats.rx_bytes;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_RX_DROPS] += nss_cmn_rx_dropped_sum(&(ngss->node_stats));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * Update the GRE redir mark specific stats
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_HLOS_MAGIC_FAILED] += ngss->hlos_magic_fail;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_INV_DST_IF_DROPS] += ngss->invalid_dst_drop;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE] += ngss->dst_enqueue_success;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE_DROPS] += ngss->dst_enqueue_drop;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_INV_APPID] += ngss->inv_appid;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_HEADROOM_UNAVAILABLE] += ngss->headroom_unavail;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_SUCCESS] += ngss->tx_completion_success;
 | 
					 | 
				
			||||||
	gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_DROPS] += ngss->tx_completion_drop;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_unlock_bh(&nss_gre_redir_mark_stats_lock);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_mark_handler()
 | 
					 * nss_gre_redir_mark_handler()
 | 
				
			||||||
 *	Handle NSS to HLOS messages for GRE redir mark
 | 
					 *	Handle NSS to HLOS messages for GRE redir mark
 | 
				
			||||||
@@ -137,6 +80,7 @@ static void nss_gre_redir_mark_handler(struct nss_ctx_instance *nss_ctx, struct
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (ncm->type == NSS_GRE_REDIR_MARK_STATS_SYNC_MSG) {
 | 
						if (ncm->type == NSS_GRE_REDIR_MARK_STATS_SYNC_MSG) {
 | 
				
			||||||
		nss_gre_redir_mark_stats_sync(nss_ctx, ncm->interface, &ngrm->msg.stats_sync);
 | 
							nss_gre_redir_mark_stats_sync(nss_ctx, ncm->interface, &ngrm->msg.stats_sync);
 | 
				
			||||||
 | 
							nss_gre_redir_mark_stats_notify(nss_ctx, ncm->interface);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
@@ -160,28 +104,6 @@ static void nss_gre_redir_mark_handler(struct nss_ctx_instance *nss_ctx, struct
 | 
				
			|||||||
	cb((void *)ncm->app_data, ncm);
 | 
						cb((void *)ncm->app_data, ncm);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_mark_get_stats()
 | 
					 | 
				
			||||||
 *	Get gre_redir tunnel stats.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
bool nss_gre_redir_mark_get_stats(void *stats_mem)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	struct nss_gre_redir_mark_stats *stats = (struct nss_gre_redir_mark_stats *)stats_mem;
 | 
					 | 
				
			||||||
	if (!stats) {
 | 
					 | 
				
			||||||
		nss_warning("No memory to copy GRE redir mark stats");
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * Copy the GRE redir mark stats in the memory.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	spin_lock_bh(&nss_gre_redir_mark_stats_lock);
 | 
					 | 
				
			||||||
	memcpy(stats, &gre_mark_stats, sizeof(struct nss_gre_redir_mark_stats));
 | 
					 | 
				
			||||||
	spin_unlock_bh(&nss_gre_redir_mark_stats_lock);
 | 
					 | 
				
			||||||
	return true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
EXPORT_SYMBOL(nss_gre_redir_mark_get_stats);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_mark_reg_cb()
 | 
					 * nss_gre_redir_mark_reg_cb()
 | 
				
			||||||
 *	Configure a callback on VAP.
 | 
					 *	Configure a callback on VAP.
 | 
				
			||||||
@@ -404,6 +326,7 @@ void nss_gre_redir_mark_register_handler(void)
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						nss_gre_redir_mark_strings_dentry_create();
 | 
				
			||||||
	sema_init(&nss_gre_redir_mark_pvt.sem, 1);
 | 
						sema_init(&nss_gre_redir_mark_pvt.sem, 1);
 | 
				
			||||||
	init_completion(&nss_gre_redir_mark_pvt.complete);
 | 
						init_completion(&nss_gre_redir_mark_pvt.complete);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -18,95 +18,64 @@
 | 
				
			|||||||
#include "nss_stats.h"
 | 
					#include "nss_stats.h"
 | 
				
			||||||
#include "nss_gre_redir_mark.h"
 | 
					#include "nss_gre_redir_mark.h"
 | 
				
			||||||
#include "nss_gre_redir_mark_stats.h"
 | 
					#include "nss_gre_redir_mark_stats.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_mark_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NSS_GRE_REDIR_MARK_STATS_STR_LEN 50
 | 
					#define NSS_GRE_REDIR_MARK_STATS_STR_LEN 50
 | 
				
			||||||
#define NSS_GRE_REDIR_MARK_STATS_LEN ((NSS_GRE_REDIR_MARK_STATS_MAX + 7 ) * NSS_GRE_REDIR_MARK_STATS_STR_LEN)
 | 
					#define NSS_GRE_REDIR_MARK_STATS_LEN ((NSS_GRE_REDIR_MARK_STATS_MAX + 7 ) * NSS_GRE_REDIR_MARK_STATS_STR_LEN)
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_redir_mark_stats_str
 | 
					 | 
				
			||||||
 *	GRE redir mark statistics string
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static int8_t *nss_gre_redir_mark_stats_str[NSS_GRE_REDIR_MARK_STATS_MAX] = {
 | 
					 | 
				
			||||||
	"TX Packets",
 | 
					 | 
				
			||||||
	"TX Bytes",
 | 
					 | 
				
			||||||
	"RX Packets",
 | 
					 | 
				
			||||||
	"RX Bytes",
 | 
					 | 
				
			||||||
	"RX Drops",
 | 
					 | 
				
			||||||
	"HLOS Magic Failed",
 | 
					 | 
				
			||||||
	"Tx Inv_dst_if Drops",
 | 
					 | 
				
			||||||
	"Tx Dst_if Enqueue",
 | 
					 | 
				
			||||||
	"Tx Dst_if Enqueue Drops",
 | 
					 | 
				
			||||||
	"Invalid Appid",
 | 
					 | 
				
			||||||
	"Headroom Unavailable",
 | 
					 | 
				
			||||||
	"Tx Completion Host Enqueue Success",
 | 
					 | 
				
			||||||
	"Tx Completion Host Enqueue Drops",
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_mark_stats_cpy()
 | 
					 * Declare atomic notifier data structure for statistics.
 | 
				
			||||||
 *	Fill the stats.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static ssize_t nss_gre_redir_mark_stats_cpy(char *lbuf, int len, int i, struct nss_gre_redir_mark_stats *s)
 | 
					ATOMIC_NOTIFIER_HEAD(nss_gre_redir_mark_stats_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Spinlock to protect GRE redirect mark statistics update/read
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					DEFINE_SPINLOCK(nss_gre_redir_mark_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Global GRE redirect mark stats structure.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_gre_redir_mark_stats gre_mark_stats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_stats_get()
 | 
				
			||||||
 | 
					 *	Get gre_redir tunnel stats.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					bool nss_gre_redir_mark_stats_get(struct nss_gre_redir_mark_stats *stats_mem)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint64_t tcnt = 0;
 | 
						if (!stats_mem) {
 | 
				
			||||||
 | 
							nss_warning("No memory to copy GRE redir mark stats");
 | 
				
			||||||
	switch (i) {
 | 
							return false;
 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_TX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_TX_PKTS];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "Common node stats start:\n\n%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_TX_BYTES:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_TX_BYTES];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_RX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_RX_PKTS];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_RX_BYTES:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_RX_BYTES];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_RX_DROPS:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_RX_DROPS];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\nCommon node stats end.\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_HLOS_MAGIC_FAILED:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_HLOS_MAGIC_FAILED];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "Offload stats start:\n\n%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_INV_DST_IF_DROPS:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_INV_DST_IF_DROPS];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE_DROPS:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE_DROPS];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_INV_APPID:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_INV_APPID];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_HEADROOM_UNAVAILABLE:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_HEADROOM_UNAVAILABLE];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_SUCCESS:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_SUCCESS];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_DROPS:
 | 
					 | 
				
			||||||
		tcnt = s->stats[NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_DROPS];
 | 
					 | 
				
			||||||
		return scnprintf(lbuf, len, "%s = %llu\nOffload stats end.\n", nss_gre_redir_mark_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	default:
 | 
					 | 
				
			||||||
		nss_warning("Unknown stats type %d.\n", i);
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
						/*
 | 
				
			||||||
 | 
						 * Copy the GRE redir mark stats in the memory.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_gre_redir_mark_stats_lock);
 | 
				
			||||||
 | 
						memcpy(stats_mem, &gre_mark_stats, sizeof(struct nss_gre_redir_mark_stats));
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_redir_mark_stats_lock);
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_redir_mark_stats_get);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 * nss_gre_redir_mark_stats_read()
 | 
					 * nss_gre_redir_mark_stats_read()
 | 
				
			||||||
 *	READ GRE redir mark stats.
 | 
					 *	READ GRE redir mark stats.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static ssize_t nss_gre_redir_mark_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
					static ssize_t nss_gre_redir_mark_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Max output lines = #stats +
 | 
				
			||||||
 | 
						 * few blank lines for banner printing + Number of Extra outputlines
 | 
				
			||||||
 | 
						 * for future reference to add new stats
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						uint32_t max_output_lines = NSS_GRE_REDIR_MARK_STATS_MAX + NSS_STATS_EXTRA_OUTPUT_LINES;
 | 
				
			||||||
 | 
						size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines;
 | 
				
			||||||
	struct nss_gre_redir_mark_stats stats;
 | 
						struct nss_gre_redir_mark_stats stats;
 | 
				
			||||||
	size_t size_wr = 0;
 | 
						size_t size_wr = 0;
 | 
				
			||||||
	int start, end;
 | 
					 | 
				
			||||||
	ssize_t bytes_read = 0;
 | 
						ssize_t bytes_read = 0;
 | 
				
			||||||
	bool isthere;
 | 
						bool isthere;
 | 
				
			||||||
	size_t size_al = ((NSS_GRE_REDIR_MARK_STATS_MAX + 7 ) * NSS_GRE_REDIR_MARK_STATS_STR_LEN);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	char *lbuf = kzalloc(size_al, GFP_KERNEL);
 | 
						char *lbuf = kzalloc(size_al, GFP_KERNEL);
 | 
				
			||||||
	if (unlikely(!lbuf)) {
 | 
						if (unlikely(!lbuf)) {
 | 
				
			||||||
@@ -117,21 +86,16 @@ static ssize_t nss_gre_redir_mark_stats_read(struct file *fp, char __user *ubuf,
 | 
				
			|||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * If GRE redir mark does not exists, then (isthere) will be false.
 | 
						 * If GRE redir mark does not exists, then (isthere) will be false.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	isthere = nss_gre_redir_mark_get_stats((void*)&stats);
 | 
						isthere = nss_gre_redir_mark_stats_get(&stats);
 | 
				
			||||||
	if (!isthere) {
 | 
						if (!isthere) {
 | 
				
			||||||
		nss_warning("Could not get GRE redirect stats");
 | 
							nss_warning("Could not get GRE redirect stats");
 | 
				
			||||||
		kfree(lbuf);
 | 
							kfree(lbuf);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\nGRE redir mark stats\n");
 | 
						size_wr += nss_stats_banner(lbuf, size_wr, size_al, "gre_redir_mark stats", NSS_STATS_SINGLE_CORE);
 | 
				
			||||||
 | 
						size_wr += nss_stats_print("gre_redir_mark", NULL, NSS_STATS_SINGLE_INSTANCE, nss_gre_redir_mark_strings_stats,
 | 
				
			||||||
	start = NSS_GRE_REDIR_MARK_STATS_TX_PKTS;
 | 
										stats.stats, NSS_GRE_REDIR_MARK_STATS_MAX, lbuf, size_wr, size_al);
 | 
				
			||||||
	end = NSS_GRE_REDIR_MARK_STATS_MAX;
 | 
					 | 
				
			||||||
	while (start < end) {
 | 
					 | 
				
			||||||
		size_wr += nss_gre_redir_mark_stats_cpy(lbuf + size_wr, size_al - size_wr, start, &stats);
 | 
					 | 
				
			||||||
		start++;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, size_wr);
 | 
						bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, size_wr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -161,3 +125,106 @@ struct dentry *nss_gre_redir_mark_stats_dentry_create(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return gre_redir_mark;
 | 
						return gre_redir_mark;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_stats_sync()
 | 
				
			||||||
 | 
					 *	Update GRE redir mark stats.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_mark_stats_sync(struct nss_ctx_instance *nss_ctx, int if_num, struct nss_gre_redir_mark_stats_sync_msg *ngss)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
						struct net_device *dev;
 | 
				
			||||||
 | 
						dev = nss_cmn_get_interface_dev(nss_ctx, if_num);
 | 
				
			||||||
 | 
						if (!dev) {
 | 
				
			||||||
 | 
							nss_warning("%px: Unable to find net device for the interface %d\n", nss_ctx, if_num);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (if_num != NSS_GRE_REDIR_MARK_INTERFACE) {
 | 
				
			||||||
 | 
							nss_warning("%px: Unknown type for interface %d\n", nss_ctx, if_num);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Update the stats in exclusive mode to prevent the read from the process
 | 
				
			||||||
 | 
						 * context through debug fs.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_gre_redir_mark_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Update the common node stats
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_STATS_NODE_TX_PKTS] += ngss->node_stats.tx_packets;
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_STATS_NODE_TX_BYTES] += ngss->node_stats.tx_bytes;
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_STATS_NODE_RX_PKTS] += ngss->node_stats.rx_packets;
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_STATS_NODE_RX_BYTES] += ngss->node_stats.rx_bytes;
 | 
				
			||||||
 | 
						for (i = 0; i < NSS_MAX_NUM_PRI; i++) {
 | 
				
			||||||
 | 
							gre_mark_stats.stats[NSS_STATS_NODE_RX_QUEUE_0_DROPPED + i] += ngss->node_stats.rx_dropped[i];
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Update the GRE redir mark specific stats
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_HLOS_MAGIC_FAILED] += ngss->hlos_magic_fail;
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_INV_DST_IF_DROPS] += ngss->invalid_dst_drop;
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE] += ngss->dst_enqueue_success;
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE_DROPS] += ngss->dst_enqueue_drop;
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_INV_APPID] += ngss->inv_appid;
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_HEADROOM_UNAVAILABLE] += ngss->headroom_unavail;
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_SUCCESS] += ngss->tx_completion_success;
 | 
				
			||||||
 | 
						gre_mark_stats.stats[NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_DROPS] += ngss->tx_completion_drop;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_redir_mark_stats_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_stats_notify()
 | 
				
			||||||
 | 
					 *	Sends notifications to all the registered modules.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Leverage NSS-FW statistics timing to update Netlink.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_mark_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_gre_redir_mark_stats_notification *stats_notify;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						stats_notify = kzalloc(sizeof(struct nss_gre_redir_mark_stats_notification), GFP_ATOMIC);
 | 
				
			||||||
 | 
						if (!stats_notify) {
 | 
				
			||||||
 | 
							nss_warning("Unable to allocate memory for stats notification\n");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (if_num != NSS_GRE_REDIR_MARK_INTERFACE) {
 | 
				
			||||||
 | 
							nss_warning("%px: Unknown type for interface %d\n", nss_ctx, if_num);
 | 
				
			||||||
 | 
							kfree(stats_notify);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_gre_redir_mark_stats_lock);
 | 
				
			||||||
 | 
						stats_notify->core_id = nss_ctx->id;
 | 
				
			||||||
 | 
						stats_notify->if_num = if_num;
 | 
				
			||||||
 | 
						memcpy(stats_notify->stats_ctx, gre_mark_stats.stats, sizeof(stats_notify->stats_ctx));
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_redir_mark_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						atomic_notifier_call_chain(&nss_gre_redir_mark_stats_notifier, NSS_STATS_EVENT_NOTIFY, stats_notify);
 | 
				
			||||||
 | 
						kfree(stats_notify);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_stats_unregister_notifier()
 | 
				
			||||||
 | 
					 *	Deregisters statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_gre_redir_mark_stats_unregister_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_unregister(&nss_gre_redir_mark_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_redir_mark_stats_unregister_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_stats_register_notifier()
 | 
				
			||||||
 | 
					 *	Registers statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_gre_redir_mark_stats_register_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_register(&nss_gre_redir_mark_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_redir_mark_stats_register_notifier);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 ******************************************************************************
 | 
					 ******************************************************************************
 | 
				
			||||||
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2019, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -17,26 +17,6 @@
 | 
				
			|||||||
#ifndef __NSS_GRE_REDIR_MARK_STATS_H__
 | 
					#ifndef __NSS_GRE_REDIR_MARK_STATS_H__
 | 
				
			||||||
#define __NSS_GRE_REDIR_MARK_STATS_H__
 | 
					#define __NSS_GRE_REDIR_MARK_STATS_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * GRE REDIR statistics types
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_gre_redir_mark_stats_types {
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_TX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_TX_BYTES,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_RX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_RX_BYTES,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_RX_DROPS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_HLOS_MAGIC_FAILED,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_INV_DST_IF_DROPS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_DST_IF_ENQUEUE_DROPS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_INV_APPID,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_HEADROOM_UNAVAILABLE,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_SUCCESS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_TX_COMPLETION_DROPS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_MARK_STATS_MAX
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * NSS core stats -- for H2N/N2H gre_redir_mark debug stats
 | 
					 * NSS core stats -- for H2N/N2H gre_redir_mark debug stats
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -47,6 +27,9 @@ struct nss_gre_redir_mark_stats {
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * NSS GRE REDIR Mark statistics APIs
 | 
					 * NSS GRE REDIR Mark statistics APIs
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					extern void nss_gre_redir_mark_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num);
 | 
				
			||||||
 | 
					extern void nss_gre_redir_mark_stats_sync(struct nss_ctx_instance *nss_ctx, int if_num,
 | 
				
			||||||
 | 
										struct nss_gre_redir_mark_stats_sync_msg *ngss);
 | 
				
			||||||
extern struct dentry *nss_gre_redir_mark_stats_dentry_create(void);
 | 
					extern struct dentry *nss_gre_redir_mark_stats_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __NSS_GRE_REDIR_MARK_STATS_H__ */
 | 
					#endif /* __NSS_GRE_REDIR_MARK_STATS_H__ */
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										66
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_mark_strings.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_mark_strings.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,66 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_stats.h"
 | 
				
			||||||
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_strings.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_mark_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_strings_stats
 | 
				
			||||||
 | 
					 *	GRE redir mark statistics string
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_stats_info nss_gre_redir_mark_strings_stats[NSS_GRE_REDIR_MARK_STATS_MAX] = {
 | 
				
			||||||
 | 
						{"rx Packets",				NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx Bytes",				NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx Packets",				NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"tx Bytes",				NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"rx_dropped_0",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_dropped_1",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_dropped_2",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"rx_dropped_3",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"HLOS Magic Failed",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"tx Inv_dst_if Drops",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"tx Dst_if Enqueue",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"tx Dst_if Enqueue Drops",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"Invalid Appid",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Headroom Unavailable",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"tx Completion Host Enqueue Success",	NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"tx Completion Host Enqueue Drops",	NSS_STATS_TYPE_DROP}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_strings_read()
 | 
				
			||||||
 | 
					 *	Read gre_redir_mark statistics names
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_gre_redir_mark_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return nss_strings_print(ubuf, sz, ppos, nss_gre_redir_mark_strings_stats, NSS_GRE_REDIR_MARK_STATS_MAX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_strings_ops
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STRINGS_DECLARE_FILE_OPERATIONS(gre_redir_mark);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_mark_strings_dentry_create()
 | 
				
			||||||
 | 
					 *	Create gre_redir_mark statistics strings debug entry.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_mark_strings_dentry_create(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nss_strings_create_dentry("gre_redir_mark", &nss_gre_redir_mark_strings_ops);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_mark_strings.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_mark_strings.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ****************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ****************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_GRE_REDIR_MARK_STRINGS_H
 | 
				
			||||||
 | 
					#define __NSS_GRE_REDIR_MARK_STRINGS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_gre_redir_mark_stats.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct nss_stats_info nss_gre_redir_mark_strings_stats[NSS_GRE_REDIR_MARK_STATS_MAX];
 | 
				
			||||||
 | 
					extern void nss_gre_redir_mark_strings_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_GRE_REDIR_MARK_STRINGS_H */
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 ****************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017-2019, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -11,146 +11,46 @@
 | 
				
			|||||||
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 **************************************************************************
 | 
					 ****************************************************************************
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "nss_core.h"
 | 
					#include "nss_core.h"
 | 
				
			||||||
#include "nss_gre_redir.h"
 | 
					#include "nss_gre_redir.h"
 | 
				
			||||||
#include "nss_gre_redir_stats.h"
 | 
					#include "nss_gre_redir_stats.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_stats_str
 | 
					 * Declare atomic notifier data structure for statistics.
 | 
				
			||||||
 *	GRE REDIR statistics string
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int8_t *nss_gre_redir_stats_str[NSS_GRE_REDIR_STATS_MAX] = {
 | 
					ATOMIC_NOTIFIER_HEAD(nss_gre_redir_stats_notifier);
 | 
				
			||||||
	"TX Packets",
 | 
					 | 
				
			||||||
	"TX Bytes",
 | 
					 | 
				
			||||||
	"TX Drops",
 | 
					 | 
				
			||||||
	"RX Packets",
 | 
					 | 
				
			||||||
	"RX Bytes",
 | 
					 | 
				
			||||||
	"RX Drops",
 | 
					 | 
				
			||||||
	"TX Sjack Packets",
 | 
					 | 
				
			||||||
	"RX Sjack packets",
 | 
					 | 
				
			||||||
	"TX Offload Packets",
 | 
					 | 
				
			||||||
	"RX Offload Packets",
 | 
					 | 
				
			||||||
	"US exception RX Packets",
 | 
					 | 
				
			||||||
	"US exception TX Packets",
 | 
					 | 
				
			||||||
	"DS exception RX Packets",
 | 
					 | 
				
			||||||
	"DS exception TX Packets",
 | 
					 | 
				
			||||||
	"Encap SG alloc drop",
 | 
					 | 
				
			||||||
	"Decap fail drop",
 | 
					 | 
				
			||||||
	"Decap split drop",
 | 
					 | 
				
			||||||
	"Split SG alloc fail",
 | 
					 | 
				
			||||||
	"Split linear copy fail",
 | 
					 | 
				
			||||||
	"Split not enough tailroom",
 | 
					 | 
				
			||||||
	"Exception ds invalid dst",
 | 
					 | 
				
			||||||
	"Decap eapol frames",
 | 
					 | 
				
			||||||
	"Exception ds invalid appid",
 | 
					 | 
				
			||||||
	"Headroom Unavailable",
 | 
					 | 
				
			||||||
	"Exception ds Tx completion Success",
 | 
					 | 
				
			||||||
	"Exception ds Tx completion drop"
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_stats()
 | 
					 * Spinlock to protect GRE redirect statistics update/read
 | 
				
			||||||
 *	Make a row for GRE_REDIR stats.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static ssize_t nss_gre_redir_stats(char *line, int len, int i, struct nss_gre_redir_tunnel_stats *s)
 | 
					DEFINE_SPINLOCK(nss_gre_redir_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Array to hold tunnel stats along with if_num
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern struct nss_gre_redir_tunnel_stats tun_stats[NSS_GRE_REDIR_MAX_INTERFACES];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_stats_get()
 | 
				
			||||||
 | 
					 *	Get GRE redirect tunnel stats.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					bool nss_gre_redir_stats_get(int index, struct nss_gre_redir_tunnel_stats *stats)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char name[40];
 | 
						spin_lock_bh(&nss_gre_redir_stats_lock);
 | 
				
			||||||
	uint64_t tcnt = 0;
 | 
						if (tun_stats[index].ref_count == 0) {
 | 
				
			||||||
	int j = 0;
 | 
							spin_unlock_bh(&nss_gre_redir_stats_lock);
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (i) {
 | 
						memcpy(stats, &tun_stats[index], sizeof(struct nss_gre_redir_tunnel_stats));
 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_TX_PKTS:
 | 
						spin_unlock_bh(&nss_gre_redir_stats_lock);
 | 
				
			||||||
		tcnt = s->node_stats.tx_packets;
 | 
						return true;
 | 
				
			||||||
		return snprintf(line, len, "Common node stats start:\n\n%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_TX_BYTES:
 | 
					 | 
				
			||||||
		tcnt = s->node_stats.tx_bytes;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_TX_DROPS:
 | 
					 | 
				
			||||||
		tcnt = s->tx_dropped;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_RX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->node_stats.rx_packets;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_RX_BYTES:
 | 
					 | 
				
			||||||
		tcnt = s->node_stats.rx_bytes;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_RX_DROPS:
 | 
					 | 
				
			||||||
		tcnt = s->node_stats.rx_dropped[0];
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\nCommon node stats end.\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_SJACK_TX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->sjack_tx_packets;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "Offload stats start:\n\n%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_OFFLOAD_TX_PKTS:
 | 
					 | 
				
			||||||
		for (j = 0; j < NSS_GRE_REDIR_MAX_RADIO; j++) {
 | 
					 | 
				
			||||||
			scnprintf(name, sizeof(name), "TX offload pkts for radio %d", j);
 | 
					 | 
				
			||||||
			tcnt += snprintf(line + tcnt, len - tcnt, "%s = %llu\n", name, s->offl_tx_pkts[j]);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return tcnt;
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_SJACK_RX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->sjack_rx_packets;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_OFFLOAD_RX_PKTS:
 | 
					 | 
				
			||||||
		for (j = 0; j < NSS_GRE_REDIR_MAX_RADIO; j++) {
 | 
					 | 
				
			||||||
			scnprintf(name, sizeof(name), "RX offload pkts for radio %d", j);
 | 
					 | 
				
			||||||
			tcnt += snprintf(line + tcnt, len - tcnt, "%s = %llu\n", name, s->offl_rx_pkts[j]);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return tcnt;
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_EXCEPTION_US_RX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->exception_us_rx;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_EXCEPTION_US_TX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->exception_us_tx;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_EXCEPTION_DS_RX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->exception_ds_rx;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_EXCEPTION_DS_TX_PKTS:
 | 
					 | 
				
			||||||
		tcnt = s->exception_ds_tx;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_ENCAP_SG_ALLOC_DROP:
 | 
					 | 
				
			||||||
		tcnt = s->encap_sg_alloc_drop;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_DECAP_FAIL_DROP:
 | 
					 | 
				
			||||||
		tcnt = s->decap_fail_drop;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_DECAP_SPLIT_DROP:
 | 
					 | 
				
			||||||
		tcnt = s->decap_split_drop;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_SPLIT_SG_ALLOC_FAIL:
 | 
					 | 
				
			||||||
		tcnt = s->split_sg_alloc_fail;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_SPLIT_LINEAR_COPY_FAIL:
 | 
					 | 
				
			||||||
		tcnt = s->split_linear_copy_fail;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_SPLIT_NOT_ENOUGH_TAILROOM:
 | 
					 | 
				
			||||||
		tcnt = s->split_not_enough_tailroom;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_EXCEPTION_DS_INVALID_DST_DROP:
 | 
					 | 
				
			||||||
		tcnt = s->exception_ds_invalid_dst_drop;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_DECAP_EAPOL_FRAMES:
 | 
					 | 
				
			||||||
		tcnt = s->decap_eapol_frames;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_EXCEPTION_DS_INV_APPID:
 | 
					 | 
				
			||||||
		tcnt = s->exception_ds_inv_appid;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_HEADROOM_UNAVAILABLE:
 | 
					 | 
				
			||||||
		tcnt = s->headroom_unavail;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_TX_COMPLETION_SUCCESS:
 | 
					 | 
				
			||||||
		tcnt = s->tx_completion_success;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	case NSS_GRE_REDIR_STATS_TX_COMPLETION_DROP:
 | 
					 | 
				
			||||||
		tcnt = s->tx_completion_drop;
 | 
					 | 
				
			||||||
		return snprintf(line, len, "%s = %llu\nOffload stats end.\n", nss_gre_redir_stats_str[i], tcnt);
 | 
					 | 
				
			||||||
	default:
 | 
					 | 
				
			||||||
		nss_warning("Unknown stats type %d.\n", i);
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_redir_stats_get);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_redir_stats_read()
 | 
					 * nss_gre_redir_stats_read()
 | 
				
			||||||
@@ -158,14 +58,25 @@ static ssize_t nss_gre_redir_stats(char *line, int len, int i, struct nss_gre_re
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
static ssize_t nss_gre_redir_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
					static ssize_t nss_gre_redir_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						 /*
 | 
				
			||||||
 | 
						  * Max output lines = #stats +
 | 
				
			||||||
 | 
						  * few blank lines for banner printing + Number of Extra outputlines
 | 
				
			||||||
 | 
						  * for future reference to add new stats
 | 
				
			||||||
 | 
						  */
 | 
				
			||||||
 | 
						uint32_t max_output_lines = NSS_GRE_REDIR_STATS_MAX + NSS_STATS_EXTRA_OUTPUT_LINES;
 | 
				
			||||||
 | 
						size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines * NSS_GRE_REDIR_MAX_INTERFACES;
 | 
				
			||||||
	struct nss_stats_data *data = fp->private_data;
 | 
						struct nss_stats_data *data = fp->private_data;
 | 
				
			||||||
	ssize_t bytes_read = 0;
 | 
					 | 
				
			||||||
	struct nss_gre_redir_tunnel_stats stats;
 | 
						struct nss_gre_redir_tunnel_stats stats;
 | 
				
			||||||
	size_t bytes;
 | 
						ssize_t bytes_read = 0;
 | 
				
			||||||
	char line[80 * NSS_GRE_REDIR_MAX_RADIO];
 | 
						size_t size_wr = 0;
 | 
				
			||||||
	int start, end;
 | 
					 | 
				
			||||||
	int index = 0;
 | 
						int index = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char *lbuf = kzalloc(size_al, GFP_KERNEL);
 | 
				
			||||||
 | 
						if (unlikely(!lbuf)) {
 | 
				
			||||||
 | 
							nss_warning("Could not allocate memory for local statistics buffer");
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (data) {
 | 
						if (data) {
 | 
				
			||||||
		index = data->index;
 | 
							index = data->index;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -174,6 +85,7 @@ static ssize_t nss_gre_redir_stats_read(struct file *fp, char __user *ubuf, size
 | 
				
			|||||||
	 * If we are done accomodating all the GRE_REDIR tunnels.
 | 
						 * If we are done accomodating all the GRE_REDIR tunnels.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (index >= NSS_GRE_REDIR_MAX_INTERFACES) {
 | 
						if (index >= NSS_GRE_REDIR_MAX_INTERFACES) {
 | 
				
			||||||
 | 
							kfree(lbuf);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -183,48 +95,23 @@ static ssize_t nss_gre_redir_stats_read(struct file *fp, char __user *ubuf, size
 | 
				
			|||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * If gre_redir tunnel does not exists, then isthere will be false.
 | 
							 * If gre_redir tunnel does not exists, then isthere will be false.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		isthere = nss_gre_redir_get_stats(index, &stats);
 | 
							isthere = nss_gre_redir_stats_get(index, &stats);
 | 
				
			||||||
		if (!isthere) {
 | 
							if (!isthere) {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		bytes = snprintf(line, sizeof(line), "\nTunnel stats for %s\n", stats.dev->name);
 | 
							size_wr += nss_stats_banner(lbuf, size_wr, size_al, "gre_redir stats", NSS_STATS_SINGLE_CORE);
 | 
				
			||||||
		if ((bytes_read + bytes) > sz) {
 | 
							size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\nTunnel stats for %s\n", stats.dev->name);
 | 
				
			||||||
			break;
 | 
							size_wr += nss_stats_print("gre_redir", NULL, NSS_STATS_SINGLE_INSTANCE, nss_gre_redir_strings_stats,
 | 
				
			||||||
		}
 | 
										&stats.tstats.rx_packets, NSS_GRE_REDIR_STATS_MAX, lbuf, size_wr, size_al);
 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (copy_to_user(ubuf + bytes_read, line, bytes) != 0) {
 | 
					 | 
				
			||||||
			bytes_read = -EFAULT;
 | 
					 | 
				
			||||||
			goto fail;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		bytes_read += bytes;
 | 
					 | 
				
			||||||
		start = NSS_GRE_REDIR_STATS_TX_PKTS;
 | 
					 | 
				
			||||||
		end = NSS_GRE_REDIR_STATS_MAX;
 | 
					 | 
				
			||||||
		while (bytes_read < sz && start < end) {
 | 
					 | 
				
			||||||
			bytes = nss_gre_redir_stats(line, sizeof(line), start, &stats);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if ((bytes_read + bytes) > sz)
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (copy_to_user(ubuf + bytes_read, line, bytes) != 0) {
 | 
					 | 
				
			||||||
				bytes_read = -EFAULT;
 | 
					 | 
				
			||||||
				goto fail;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			bytes_read += bytes;
 | 
					 | 
				
			||||||
			start++;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (bytes_read > 0) {
 | 
					 | 
				
			||||||
		*ppos = bytes_read;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf));
 | 
				
			||||||
	if (data) {
 | 
						if (data) {
 | 
				
			||||||
		data->index = index;
 | 
							data->index = index;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fail:
 | 
						kfree(lbuf);
 | 
				
			||||||
	return bytes_read;
 | 
						return bytes_read;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -258,3 +145,168 @@ struct dentry *nss_gre_redir_stats_dentry_create(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return gre_redir;
 | 
						return gre_redir;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_stats_sync()
 | 
				
			||||||
 | 
					 *	Update gre_redir tunnel stats.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_stats_sync(struct nss_ctx_instance *nss_ctx, int if_num, struct nss_gre_redir_stats_sync_msg *ngss)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int i, j;
 | 
				
			||||||
 | 
						uint32_t type;
 | 
				
			||||||
 | 
						struct net_device *dev;
 | 
				
			||||||
 | 
						struct nss_gre_redir_tun_stats *node_stats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						type = nss_dynamic_interface_get_type(nss_ctx, if_num);
 | 
				
			||||||
 | 
						dev = nss_cmn_get_interface_dev(nss_ctx, if_num);
 | 
				
			||||||
 | 
						if (!dev) {
 | 
				
			||||||
 | 
							nss_warning("%px: Unable to find net device for the interface %d\n", nss_ctx, if_num);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!nss_gre_redir_verify_ifnum(if_num)) {
 | 
				
			||||||
 | 
							nss_warning("%px: Unknown type for interface %d\n", nss_ctx, if_num);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_gre_redir_stats_lock);
 | 
				
			||||||
 | 
						for (i = 0; i < NSS_GRE_REDIR_MAX_INTERFACES; i++) {
 | 
				
			||||||
 | 
							if (tun_stats[i].dev == dev) {
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (i == NSS_GRE_REDIR_MAX_INTERFACES) {
 | 
				
			||||||
 | 
							nss_warning("%px: Unable to find tunnel stats instance for interface %d\n", nss_ctx, if_num);
 | 
				
			||||||
 | 
							spin_unlock_bh(&nss_gre_redir_stats_lock);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						nss_assert(tun_stats[i].ref_count);
 | 
				
			||||||
 | 
						node_stats = &tun_stats[i].tstats;
 | 
				
			||||||
 | 
						switch (type) {
 | 
				
			||||||
 | 
						case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_WIFI_HOST_INNER:
 | 
				
			||||||
 | 
						case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_WIFI_OFFL_INNER:
 | 
				
			||||||
 | 
						case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_SJACK_INNER:
 | 
				
			||||||
 | 
							node_stats->tx_packets += ngss->node_stats.tx_packets;
 | 
				
			||||||
 | 
							node_stats->tx_bytes += ngss->node_stats.tx_bytes;
 | 
				
			||||||
 | 
							node_stats->sjack_tx_packets += ngss->sjack_rx_packets;
 | 
				
			||||||
 | 
							node_stats->encap_sg_alloc_drop += ngss->encap_sg_alloc_drop;
 | 
				
			||||||
 | 
							node_stats->tx_dropped += nss_cmn_rx_dropped_sum(&(ngss->node_stats));
 | 
				
			||||||
 | 
							for (j = 0; j < NSS_GRE_REDIR_MAX_RADIO; j++) {
 | 
				
			||||||
 | 
								node_stats->offl_tx_pkts[j] += ngss->offl_rx_pkts[j];
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_OUTER:
 | 
				
			||||||
 | 
							node_stats->rx_packets += ngss->node_stats.rx_packets;
 | 
				
			||||||
 | 
							node_stats->rx_bytes += ngss->node_stats.rx_bytes;
 | 
				
			||||||
 | 
							node_stats->sjack_rx_packets += ngss->sjack_rx_packets;
 | 
				
			||||||
 | 
							node_stats->decap_fail_drop += ngss->decap_fail_drop;
 | 
				
			||||||
 | 
							node_stats->decap_split_drop += ngss->decap_split_drop;
 | 
				
			||||||
 | 
							node_stats->split_sg_alloc_fail += ngss->split_sg_alloc_fail;
 | 
				
			||||||
 | 
							node_stats->split_linear_copy_fail += ngss->split_linear_copy_fail;
 | 
				
			||||||
 | 
							node_stats->split_not_enough_tailroom += ngss->split_not_enough_tailroom;
 | 
				
			||||||
 | 
							node_stats->decap_eapol_frames += ngss->decap_eapol_frames;
 | 
				
			||||||
 | 
							for (j = 0; j < NSS_MAX_NUM_PRI; j++) {
 | 
				
			||||||
 | 
								node_stats->rx_dropped[j] += ngss->node_stats.rx_dropped[j];
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for (j = 0; j < NSS_GRE_REDIR_MAX_RADIO; j++) {
 | 
				
			||||||
 | 
								node_stats->offl_rx_pkts[j] += ngss->offl_rx_pkts[j];
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_US:
 | 
				
			||||||
 | 
							node_stats->exception_us_rx += ngss->node_stats.rx_packets;
 | 
				
			||||||
 | 
							node_stats->exception_us_tx += ngss->node_stats.tx_packets;
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_DS:
 | 
				
			||||||
 | 
							node_stats->exception_ds_rx += ngss->node_stats.rx_packets;
 | 
				
			||||||
 | 
							node_stats->exception_ds_tx += ngss->node_stats.tx_packets;
 | 
				
			||||||
 | 
							node_stats->exception_ds_invalid_dst_drop += ngss->exception_ds_invalid_dst_drop;
 | 
				
			||||||
 | 
							node_stats->exception_ds_inv_appid += ngss->exception_ds_inv_appid;
 | 
				
			||||||
 | 
							node_stats->headroom_unavail += ngss->headroom_unavail;
 | 
				
			||||||
 | 
							node_stats->tx_completion_success += ngss->tx_completion_success;
 | 
				
			||||||
 | 
							node_stats->tx_completion_drop += ngss->tx_completion_drop;
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_redir_stats_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_stats_notify()
 | 
				
			||||||
 | 
					 *	Sends notifications to all the registered modules.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Leverage NSS-FW statistics timing to update Netlink.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_gre_redir_stats_notification *stats_notify;
 | 
				
			||||||
 | 
						struct net_device *dev;
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						stats_notify = kzalloc(sizeof(struct nss_gre_redir_stats_notification), GFP_ATOMIC);
 | 
				
			||||||
 | 
						if (!stats_notify) {
 | 
				
			||||||
 | 
							nss_warning("Unable to allocate memory for stats notification\n");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dev = nss_cmn_get_interface_dev(nss_ctx, if_num);
 | 
				
			||||||
 | 
						if (!dev) {
 | 
				
			||||||
 | 
							nss_warning("%px: Unable to find net device for the interface %d\n", nss_ctx, if_num);
 | 
				
			||||||
 | 
							kfree(stats_notify);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!nss_gre_redir_verify_ifnum(if_num)) {
 | 
				
			||||||
 | 
							nss_warning("%px: Unknown type for interface %d\n", nss_ctx, if_num);
 | 
				
			||||||
 | 
							kfree(stats_notify);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_gre_redir_stats_lock);
 | 
				
			||||||
 | 
						for (i = 0; i < NSS_GRE_REDIR_MAX_INTERFACES; i++) {
 | 
				
			||||||
 | 
							if (tun_stats[i].dev == dev) {
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (i == NSS_GRE_REDIR_MAX_INTERFACES) {
 | 
				
			||||||
 | 
							nss_warning("%px: Unable to find tunnel stats instance for interface %d\n", nss_ctx, if_num);
 | 
				
			||||||
 | 
							spin_unlock_bh(&nss_gre_redir_stats_lock);
 | 
				
			||||||
 | 
							kfree(stats_notify);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						stats_notify->core_id = nss_ctx->id;
 | 
				
			||||||
 | 
						stats_notify->if_num = if_num;
 | 
				
			||||||
 | 
						memcpy(&(stats_notify->stats_ctx), &(tun_stats[i]), sizeof(stats_notify->stats_ctx));
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_redir_stats_lock);
 | 
				
			||||||
 | 
						atomic_notifier_call_chain(&nss_gre_redir_stats_notifier, NSS_STATS_EVENT_NOTIFY, stats_notify);
 | 
				
			||||||
 | 
						kfree(stats_notify);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_stats_unregister_notifier()
 | 
				
			||||||
 | 
					 *	Degisters statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_gre_redir_stats_unregister_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_unregister(&nss_gre_redir_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_redir_stats_unregister_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_stats_register_notifier()
 | 
				
			||||||
 | 
					 *	Registers statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_gre_redir_stats_register_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_register(&nss_gre_redir_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_redir_stats_register_notifier);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 ******************************************************************************
 | 
					 ******************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017-2019, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -17,42 +17,14 @@
 | 
				
			|||||||
#ifndef __NSS_GRE_REDIR_STATS_H__
 | 
					#ifndef __NSS_GRE_REDIR_STATS_H__
 | 
				
			||||||
#define __NSS_GRE_REDIR_STATS_H__
 | 
					#define __NSS_GRE_REDIR_STATS_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * GRE REDIR statistics
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_gre_redir_stats_types {
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_TX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_TX_BYTES,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_TX_DROPS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_RX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_RX_BYTES,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_RX_DROPS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_SJACK_TX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_SJACK_RX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_OFFLOAD_TX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_OFFLOAD_RX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_EXCEPTION_US_RX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_EXCEPTION_US_TX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_EXCEPTION_DS_RX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_EXCEPTION_DS_TX_PKTS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_ENCAP_SG_ALLOC_DROP,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_DECAP_FAIL_DROP,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_DECAP_SPLIT_DROP,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_SPLIT_SG_ALLOC_FAIL,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_SPLIT_LINEAR_COPY_FAIL,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_SPLIT_NOT_ENOUGH_TAILROOM,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_EXCEPTION_DS_INVALID_DST_DROP,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_DECAP_EAPOL_FRAMES,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_EXCEPTION_DS_INV_APPID,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_HEADROOM_UNAVAILABLE,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_TX_COMPLETION_SUCCESS,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_TX_COMPLETION_DROP,
 | 
					 | 
				
			||||||
	NSS_GRE_REDIR_STATS_MAX
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * NSS GRE REDIR statistics APIs
 | 
					 * NSS GRE REDIR statistics APIs
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					extern spinlock_t nss_gre_redir_stats_lock;
 | 
				
			||||||
 | 
					extern bool nss_gre_redir_verify_ifnum(uint32_t if_num);
 | 
				
			||||||
 | 
					extern void nss_gre_redir_stats_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num);
 | 
				
			||||||
 | 
					extern void nss_gre_redir_stats_sync(struct nss_ctx_instance *nss_ctx, int if_num,
 | 
				
			||||||
 | 
										struct nss_gre_redir_stats_sync_msg *ngss);
 | 
				
			||||||
extern struct dentry *nss_gre_redir_stats_dentry_create(void);
 | 
					extern struct dentry *nss_gre_redir_stats_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __NSS_GRE_REDIR_STATS_H__ */
 | 
					#endif /* __NSS_GRE_REDIR_STATS_H__ */
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										87
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_strings.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_strings.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,87 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_stats.h"
 | 
				
			||||||
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_strings.h"
 | 
				
			||||||
 | 
					#include "nss_gre_redir_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_strings_stats
 | 
				
			||||||
 | 
					 *	GRE redirect statistics string.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_stats_info nss_gre_redir_strings_stats[NSS_GRE_REDIR_STATS_MAX] = {
 | 
				
			||||||
 | 
						{"RX Packets",				NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"RX Bytes",				NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"TX Packets",				NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"TX Bytes",				NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"RX Drops_[0]",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"RX Drops_[1]",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"RX Drops_[2]",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"RX Drops_[3]",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"TX Drops",				NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"RX Sjack Packets",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"TX Sjack packets",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"RX Offload Packets_[0]",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"RX Offload Packets_[1]",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"RX Offload Packets_[2]",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"RX Offload Packets_[3]",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"RX Offload Packets_[4]",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"TX Offload Packets_[0]",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"TX Offload Packets_[1]",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"TX Offload Packets_[2]",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"TX Offload Packets_[3]",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"TX Offload Packets_[4]",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"US exception RX Packets",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"US exception TX Packets",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"DS exception RX Packets",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"DS exception TX Packets",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"Encap SG alloc drop",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"Decap fail drop",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"Decap split drop",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Split SG alloc fail",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Split linear copy fail",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Split not enough tailroom",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"Exception ds invalid dst",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Decap eapol frames",			NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Exception ds invalid appid",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"Headroom Unavailable",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"Exception ds Tx completion Success",	NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"Exception ds Tx completion drop",	NSS_STATS_TYPE_DROP}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_strings_read()
 | 
				
			||||||
 | 
					 *	Read GRE redirect statistics names.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_gre_redir_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return nss_strings_print(ubuf, sz, ppos, nss_gre_redir_strings_stats, NSS_GRE_REDIR_STATS_MAX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_strings_ops
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STRINGS_DECLARE_FILE_OPERATIONS(gre_redir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_redir_strings_dentry_create()
 | 
				
			||||||
 | 
					 *	Create GRE redirect statistics strings debug entry.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_redir_strings_dentry_create(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nss_strings_create_dentry("gre_redir", &nss_gre_redir_strings_ops);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_strings.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_redir_strings.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_GRE_REDIR_STRINGS_H
 | 
				
			||||||
 | 
					#define __NSS_GRE_REDIR_STRINGS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_gre_redir_stats.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct nss_stats_info nss_gre_redir_strings_stats[NSS_GRE_REDIR_STATS_MAX];
 | 
				
			||||||
 | 
					extern void nss_gre_redir_strings_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_GRE_REDIR_STRINGS_H */
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -21,83 +21,26 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
 | 
					#include "nss_gre.h"
 | 
				
			||||||
#include "nss_gre_stats.h"
 | 
					#include "nss_gre_stats.h"
 | 
				
			||||||
 | 
					#include "nss_gre_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Declare atomic notifier data structure for statistics.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					ATOMIC_NOTIFIER_HEAD(nss_gre_stats_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Data structures to store GRE nss debug stats
 | 
					 * Data structures to store GRE nss debug stats
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static DEFINE_SPINLOCK(nss_gre_stats_lock);
 | 
					static DEFINE_SPINLOCK(nss_gre_stats_lock);
 | 
				
			||||||
static struct nss_gre_stats_session_debug session_debug_stats[NSS_GRE_MAX_DEBUG_SESSION_STATS];
 | 
					static struct nss_gre_stats_session session_stats[NSS_GRE_MAX_DEBUG_SESSION_STATS];
 | 
				
			||||||
static struct nss_gre_stats_base_debug base_debug_stats;
 | 
					static struct nss_gre_stats_base base_stats;
 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_stats_base_debug_str
 | 
					 | 
				
			||||||
 *	GRE debug statistics strings for base types
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_stats_info nss_gre_stats_base_debug_str[NSS_GRE_STATS_BASE_DEBUG_MAX] = {
 | 
					 | 
				
			||||||
	{"base_rx_pkts"				,NSS_STATS_TYPE_COMMON},
 | 
					 | 
				
			||||||
	{"base_rx_drops"			,NSS_STATS_TYPE_DROP},
 | 
					 | 
				
			||||||
	{"base_exp_eth_hdr_missing"		,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_eth_type_non_ip"		,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_ip_unknown_protocol"		,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_ip_header_incomplete"	,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_ip_bad_total_length"		,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_ip_bad_checksum"		,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_ip_datagram_incomplete"	,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_ip_fragment"			,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_ip_options_incomplete"	,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_ip_with_options"		,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_ipv6_unknown_protocol"	,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_ipv6_header_incomplete"	,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_unknown_session"		,NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"base_exp_node_inactive"		,NSS_STATS_TYPE_EXCEPTION}
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_stats_session_debug_str
 | 
					 | 
				
			||||||
 *	GRE debug statistics strings for sessions
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
struct nss_stats_info nss_gre_stats_session_debug_str[NSS_GRE_STATS_SESSION_DEBUG_MAX] = {
 | 
					 | 
				
			||||||
	{"session_pbuf_alloc_fail"		, NSS_STATS_TYPE_ERROR},
 | 
					 | 
				
			||||||
	{"session_decap_forward_enqueue_fail"	, NSS_STATS_TYPE_DROP},
 | 
					 | 
				
			||||||
	{"session_encap_forward_enqueue_fail"	, NSS_STATS_TYPE_DROP},
 | 
					 | 
				
			||||||
	{"session_decap_tx_forwarded"		, NSS_STATS_TYPE_SPECIAL},
 | 
					 | 
				
			||||||
	{"session_encap_rx_received"		, NSS_STATS_TYPE_SPECIAL},
 | 
					 | 
				
			||||||
	{"session_encap_rx_drops"		, NSS_STATS_TYPE_DROP},
 | 
					 | 
				
			||||||
	{"session_encap_rx_linear_fail"		, NSS_STATS_TYPE_DROP},
 | 
					 | 
				
			||||||
	{"session_exp_rx_key_error"		, NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"session_exp_rx_seq_error"		, NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"session_exp_rx_cs_error"		, NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"session_exp_rx_flag_mismatch"		, NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"session_exp_rx_malformed"		, NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"session_exp_rx_invalid_protocol"	, NSS_STATS_TYPE_EXCEPTION},
 | 
					 | 
				
			||||||
	{"session_exp_rx_no_headroom"		, NSS_STATS_TYPE_EXCEPTION}
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * GRE statistics APIs
 | 
					 * GRE statistics APIs
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * nss_gre_stats_session_register()
 | 
					 | 
				
			||||||
 *	Register debug statistic for GRE session.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
void nss_gre_stats_session_register(uint32_t if_num, struct net_device *netdev)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	int i;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spin_lock_bh(&nss_gre_stats_lock);
 | 
					 | 
				
			||||||
	for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
 | 
					 | 
				
			||||||
		if (!session_debug_stats[i].valid) {
 | 
					 | 
				
			||||||
			session_debug_stats[i].valid = true;
 | 
					 | 
				
			||||||
			session_debug_stats[i].if_num = if_num;
 | 
					 | 
				
			||||||
			session_debug_stats[i].if_index = netdev->ifindex;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	spin_unlock_bh(&nss_gre_stats_lock);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_stats_session_unregister()
 | 
					 * nss_gre_stats_session_unregister()
 | 
				
			||||||
 *	Unregister debug statistic for GRE session.
 | 
					 *	Unregister debug statistic for GRE session.
 | 
				
			||||||
@@ -108,8 +51,8 @@ void nss_gre_stats_session_unregister(uint32_t if_num)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	spin_lock_bh(&nss_gre_stats_lock);
 | 
						spin_lock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
	for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
 | 
						for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
 | 
				
			||||||
		if (session_debug_stats[i].if_num == if_num) {
 | 
							if (session_stats[i].if_num == if_num) {
 | 
				
			||||||
			memset(&session_debug_stats[i], 0, sizeof(struct nss_gre_stats_session_debug));
 | 
								memset(&session_stats[i], 0, sizeof(struct nss_gre_stats_session));
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -117,25 +60,45 @@ void nss_gre_stats_session_unregister(uint32_t if_num)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_stats_session_debug_sync()
 | 
					 * nss_gre_stats_session_register()
 | 
				
			||||||
 | 
					 *	Register debug statistic for GRE session.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_stats_session_register(uint32_t if_num, struct net_device *netdev)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
 | 
						for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
 | 
				
			||||||
 | 
							if (!session_stats[i].valid) {
 | 
				
			||||||
 | 
								session_stats[i].valid = true;
 | 
				
			||||||
 | 
								session_stats[i].if_num = if_num;
 | 
				
			||||||
 | 
								session_stats[i].if_index = netdev->ifindex;
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_stats_session_sync()
 | 
				
			||||||
 *	debug statistics sync for GRE session.
 | 
					 *	debug statistics sync for GRE session.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void nss_gre_stats_session_debug_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_session_stats_msg *sstats, uint16_t if_num)
 | 
					void nss_gre_stats_session_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_session_stats_msg *sstats, uint16_t if_num)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i, j;
 | 
						int i, j;
 | 
				
			||||||
	enum nss_dynamic_interface_type interface_type = nss_dynamic_interface_get_type(nss_ctx, if_num);
 | 
						enum nss_dynamic_interface_type interface_type = nss_dynamic_interface_get_type(nss_ctx, if_num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock_bh(&nss_gre_stats_lock);
 | 
						spin_lock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
	for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
 | 
						for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
 | 
				
			||||||
		if (session_debug_stats[i].if_num == if_num) {
 | 
							if (session_stats[i].if_num == if_num) {
 | 
				
			||||||
			for (j = 0; j < NSS_GRE_STATS_SESSION_DEBUG_MAX; j++) {
 | 
								for (j = 0; j < NSS_GRE_SESSION_DEBUG_MAX; j++) {
 | 
				
			||||||
				session_debug_stats[i].stats[j] += sstats->stats[j];
 | 
									session_stats[i].stats[j] += sstats->stats[j];
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_INNER) {
 | 
								if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_INNER) {
 | 
				
			||||||
				session_debug_stats[i].stats[NSS_GRE_STATS_SESSION_ENCAP_RX_RECEIVED] += sstats->node_stats.rx_packets;
 | 
									session_stats[i].stats[NSS_GRE_SESSION_ENCAP_RX_RECEIVED] += sstats->node_stats.rx_packets;
 | 
				
			||||||
			} else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_OUTER) {
 | 
								} else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_OUTER) {
 | 
				
			||||||
				session_debug_stats[i].stats[NSS_GRE_STATS_SESSION_DECAP_TX_FORWARDED] += sstats->node_stats.tx_packets;
 | 
									session_stats[i].stats[NSS_GRE_SESSION_DECAP_TX_FORWARDED] += sstats->node_stats.tx_packets;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -144,38 +107,38 @@ void nss_gre_stats_session_debug_sync(struct nss_ctx_instance *nss_ctx, struct n
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_stats_base_debug_sync()
 | 
					 * nss_gre_stats_base_sync()
 | 
				
			||||||
 *	Debug statistics sync for GRE base node.
 | 
					 *	Debug statistics sync for GRE base node.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void nss_gre_stats_base_debug_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_base_stats_msg *bstats)
 | 
					void nss_gre_stats_base_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_base_stats_msg *bstats)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock_bh(&nss_gre_stats_lock);
 | 
						spin_lock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
	for (i = 0; i < NSS_GRE_STATS_BASE_DEBUG_MAX; i++) {
 | 
						for (i = 0; i < NSS_GRE_BASE_DEBUG_MAX; i++) {
 | 
				
			||||||
		base_debug_stats.stats[i] += bstats->stats[i];
 | 
							base_stats.stats[i] += bstats->stats[i];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spin_unlock_bh(&nss_gre_stats_lock);
 | 
						spin_unlock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_stats_session_debug_get()
 | 
					 * nss_gre_stats_session_get()
 | 
				
			||||||
 *	Get GRE session debug statistics.
 | 
					 *	Get GRE session debug statistics.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void nss_gre_stats_session_debug_get(void *stats_mem, int size)
 | 
					static void nss_gre_stats_session_get(void *stats_mem, int size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct nss_gre_stats_session_debug *stats = (struct nss_gre_stats_session_debug *)stats_mem;
 | 
						struct nss_gre_stats_session *stats = (struct nss_gre_stats_session *)stats_mem;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!stats || (size < (sizeof(struct nss_gre_stats_session_debug) * NSS_GRE_MAX_DEBUG_SESSION_STATS)))  {
 | 
						if (!stats || (size < (sizeof(struct nss_gre_stats_session) * NSS_GRE_MAX_DEBUG_SESSION_STATS)))  {
 | 
				
			||||||
		nss_warning("No memory to copy gre stats");
 | 
							nss_warning("No memory to copy gre stats");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock_bh(&nss_gre_stats_lock);
 | 
						spin_lock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
	for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
 | 
						for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
 | 
				
			||||||
		if (session_debug_stats[i].valid) {
 | 
							if (session_stats[i].valid) {
 | 
				
			||||||
			memcpy(stats, &session_debug_stats[i], sizeof(struct nss_gre_stats_session_debug));
 | 
								memcpy(stats, &session_stats[i], sizeof(struct nss_gre_stats_session));
 | 
				
			||||||
			stats++;
 | 
								stats++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -183,25 +146,25 @@ static void nss_gre_stats_session_debug_get(void *stats_mem, int size)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * nss_gre_stats_base_debug_get()
 | 
					 * nss_gre_stats_base_get()
 | 
				
			||||||
 *	Get GRE debug base statistics.
 | 
					 *	Get GRE debug base statistics.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void nss_gre_stats_base_debug_get(void *stats_mem, int size)
 | 
					static void nss_gre_stats_base_get(void *stats_mem, int size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct nss_gre_stats_base_debug *stats = (struct nss_gre_stats_base_debug *)stats_mem;
 | 
						struct nss_gre_stats_base *stats = (struct nss_gre_stats_base *)stats_mem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!stats) {
 | 
						if (!stats) {
 | 
				
			||||||
		nss_warning("No memory to copy GRE base stats\n");
 | 
							nss_warning("No memory to copy GRE base stats\n");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (size < sizeof(struct nss_gre_stats_base_debug)) {
 | 
						if (size < sizeof(struct nss_gre_stats_base)) {
 | 
				
			||||||
		nss_warning("Not enough memory to copy GRE base stats\n");
 | 
							nss_warning("Not enough memory to copy GRE base stats\n");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock_bh(&nss_gre_stats_lock);
 | 
						spin_lock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
	memcpy(stats, &base_debug_stats, sizeof(struct nss_gre_stats_base_debug));
 | 
						memcpy(stats, &base_stats, sizeof(struct nss_gre_stats_base));
 | 
				
			||||||
	spin_unlock_bh(&nss_gre_stats_lock);
 | 
						spin_unlock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -213,15 +176,15 @@ static ssize_t nss_gre_stats_read(struct file *fp, char __user *ubuf, size_t sz,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	uint32_t max_output_lines = 2 /* header & footer for base debug stats */
 | 
						uint32_t max_output_lines = 2 /* header & footer for base debug stats */
 | 
				
			||||||
		+ 2 /* header & footer for session debug stats */
 | 
							+ 2 /* header & footer for session debug stats */
 | 
				
			||||||
		+ NSS_GRE_STATS_BASE_DEBUG_MAX  /* Base debug */
 | 
							+ NSS_GRE_BASE_DEBUG_MAX  /* Base debug */
 | 
				
			||||||
		+ NSS_GRE_MAX_DEBUG_SESSION_STATS * (NSS_GRE_STATS_SESSION_DEBUG_MAX + 2) /*session stats */
 | 
							+ NSS_GRE_MAX_DEBUG_SESSION_STATS * (NSS_GRE_SESSION_DEBUG_MAX + 2) /*session stats */
 | 
				
			||||||
		+ 2;
 | 
							+ 2;
 | 
				
			||||||
	size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines;
 | 
						size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines;
 | 
				
			||||||
	size_t size_wr = 0;
 | 
						size_t size_wr = 0;
 | 
				
			||||||
	ssize_t bytes_read = 0;
 | 
						ssize_t bytes_read = 0;
 | 
				
			||||||
	struct net_device *dev;
 | 
						struct net_device *dev;
 | 
				
			||||||
	struct nss_gre_stats_session_debug *sstats;
 | 
						struct nss_gre_stats_session *sstats;
 | 
				
			||||||
	struct nss_gre_stats_base_debug *bstats;
 | 
						struct nss_gre_stats_base *bstats;
 | 
				
			||||||
	int id;
 | 
						int id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	char *lbuf = kzalloc(size_al, GFP_KERNEL);
 | 
						char *lbuf = kzalloc(size_al, GFP_KERNEL);
 | 
				
			||||||
@@ -230,14 +193,14 @@ static ssize_t nss_gre_stats_read(struct file *fp, char __user *ubuf, size_t sz,
 | 
				
			|||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bstats = kzalloc(sizeof(struct nss_gre_stats_base_debug), GFP_KERNEL);
 | 
						bstats = kzalloc(sizeof(struct nss_gre_stats_base), GFP_KERNEL);
 | 
				
			||||||
	if (unlikely(!bstats)) {
 | 
						if (unlikely(!bstats)) {
 | 
				
			||||||
		nss_warning("Could not allocate memory for base debug statistics buffer");
 | 
							nss_warning("Could not allocate memory for base debug statistics buffer");
 | 
				
			||||||
		kfree(lbuf);
 | 
							kfree(lbuf);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sstats = kzalloc(sizeof(struct nss_gre_stats_session_debug) * NSS_GRE_MAX_DEBUG_SESSION_STATS, GFP_KERNEL);
 | 
						sstats = kzalloc(sizeof(struct nss_gre_stats_session) * NSS_GRE_MAX_DEBUG_SESSION_STATS, GFP_KERNEL);
 | 
				
			||||||
	if (unlikely(!sstats)) {
 | 
						if (unlikely(!sstats)) {
 | 
				
			||||||
		nss_warning("Could not allocate memory for base debug statistics buffer");
 | 
							nss_warning("Could not allocate memory for base debug statistics buffer");
 | 
				
			||||||
		kfree(lbuf);
 | 
							kfree(lbuf);
 | 
				
			||||||
@@ -250,18 +213,18 @@ static ssize_t nss_gre_stats_read(struct file *fp, char __user *ubuf, size_t sz,
 | 
				
			|||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Get all base stats
 | 
						 * Get all base stats
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	nss_gre_stats_base_debug_get((void *)bstats, sizeof(struct nss_gre_stats_base_debug));
 | 
						nss_gre_stats_base_get((void *)bstats, sizeof(struct nss_gre_stats_base));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size_wr += nss_stats_print("gre", NULL, NSS_STATS_SINGLE_INSTANCE
 | 
						size_wr += nss_stats_print("gre", NULL, NSS_STATS_SINGLE_INSTANCE
 | 
				
			||||||
					, nss_gre_stats_base_debug_str
 | 
										, nss_gre_strings_base_stats
 | 
				
			||||||
					, bstats->stats
 | 
										, bstats->stats
 | 
				
			||||||
					, NSS_GRE_STATS_BASE_DEBUG_MAX
 | 
										, NSS_GRE_BASE_DEBUG_MAX
 | 
				
			||||||
					, lbuf, size_wr, size_al);
 | 
										, lbuf, size_wr, size_al);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Get all session stats
 | 
						 * Get all session stats
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	nss_gre_stats_session_debug_get(sstats, sizeof(struct nss_gre_stats_session_debug) * NSS_GRE_MAX_DEBUG_SESSION_STATS);
 | 
						nss_gre_stats_session_get(sstats, sizeof(struct nss_gre_stats_session) * NSS_GRE_MAX_DEBUG_SESSION_STATS);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (id = 0; id < NSS_GRE_MAX_DEBUG_SESSION_STATS; id++) {
 | 
						for (id = 0; id < NSS_GRE_MAX_DEBUG_SESSION_STATS; id++) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -280,9 +243,9 @@ static ssize_t nss_gre_stats_read(struct file *fp, char __user *ubuf, size_t sz,
 | 
				
			|||||||
					     (sstats + id)->if_num);
 | 
										     (sstats + id)->if_num);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		size_wr += nss_stats_print("gre_session", NULL, id
 | 
							size_wr += nss_stats_print("gre_session", NULL, id
 | 
				
			||||||
						, nss_gre_stats_session_debug_str
 | 
											, nss_gre_strings_session_stats
 | 
				
			||||||
						, (sstats + id)->stats
 | 
											, (sstats + id)->stats
 | 
				
			||||||
						, NSS_GRE_STATS_SESSION_DEBUG_MAX
 | 
											, NSS_GRE_SESSION_DEBUG_MAX
 | 
				
			||||||
						, lbuf, size_wr, size_al);
 | 
											, lbuf, size_wr, size_al);
 | 
				
			||||||
		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
 | 
							size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -309,3 +272,67 @@ void nss_gre_stats_dentry_create(void)
 | 
				
			|||||||
	nss_stats_create_dentry("gre", &nss_gre_stats_ops);
 | 
						nss_stats_create_dentry("gre", &nss_gre_stats_ops);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_stats_base_notify()
 | 
				
			||||||
 | 
					 *	Sends notifications to all the registered modules.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Leverage NSS-FW statistics timing to update Netlink.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_stats_base_notify(struct nss_ctx_instance *nss_ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_gre_base_stats_notification gre_stats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
 | 
						gre_stats.core_id = nss_ctx->id;
 | 
				
			||||||
 | 
						memcpy(gre_stats.stats_base_ctx, base_stats.stats, sizeof(gre_stats.stats_base_ctx));
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						atomic_notifier_call_chain(&nss_gre_stats_notifier, NSS_STATS_EVENT_NOTIFY, &gre_stats);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_stats_session_notify()
 | 
				
			||||||
 | 
					 *	Sends notifications to all the registered modules.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Leverage NSS-FW statistics timing to update Netlink.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_stats_session_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct nss_gre_session_stats_notification gre_stats;
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spin_lock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
 | 
						for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
 | 
				
			||||||
 | 
							if (session_stats[i].if_num != if_num) {
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							memcpy(gre_stats.stats_session_ctx, session_stats[i].stats, sizeof(gre_stats.stats_session_ctx));
 | 
				
			||||||
 | 
							gre_stats.core_id = nss_ctx->id;
 | 
				
			||||||
 | 
							gre_stats.if_num = if_num;
 | 
				
			||||||
 | 
							spin_unlock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
 | 
							atomic_notifier_call_chain(&nss_gre_stats_notifier, NSS_STATS_EVENT_NOTIFY, &gre_stats);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						spin_unlock_bh(&nss_gre_stats_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_stats_unregister_notifier()
 | 
				
			||||||
 | 
					 *	Deregisters statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_gre_stats_unregister_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_unregister(&nss_gre_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_stats_unregister_notifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_stats_register_notifier()
 | 
				
			||||||
 | 
					 *	Registers statistics notifier.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					int nss_gre_stats_register_notifier(struct notifier_block *nb)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return atomic_notifier_chain_register(&nss_gre_stats_notifier, nb);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL(nss_gre_stats_register_notifier);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 **************************************************************************
 | 
					 **************************************************************************
 | 
				
			||||||
 * Copyright (c) 2017, The Linux Foundation. All rights reserved.
 | 
					 * Copyright (c) 2017, 2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 * Permission to use, copy, modify, and/or distribute this software for
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -22,62 +22,20 @@
 | 
				
			|||||||
#ifndef __NSS_GRE_STATS_H
 | 
					#ifndef __NSS_GRE_STATS_H
 | 
				
			||||||
#define __NSS_GRE_STATS_H
 | 
					#define __NSS_GRE_STATS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					#include <nss_cmn.h>
 | 
				
			||||||
 * GRE base debug statistics types
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_gre_stats_base_debug_types {
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_RX_PACKETS,			/**< Rx packet count. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_RX_DROPPED,			/**< Rx dropped count. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_ETH_HDR_MISSING,		/**< Ethernet header missing. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_ETH_TYPE_NON_IP,		/**< Not IPV4 or IPV6 packet. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_IP_UNKNOWN_PROTOCOL,	/**< Unknown protocol. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_IP_HEADER_INCOMPLETE,	/**< Bad IP header. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_IP_BAD_TOTAL_LENGTH,	/**< Invalid IP packet length. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_IP_BAD_CHECKSUM,		/**< Bad packet checksum. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_IP_DATAGRAM_INCOMPLETE,	/**< Bad packet. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_IP_FRAGMENT,		/**< IP fragment. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_IP_OPTIONS_INCOMPLETE,	/**< Invalid IP options. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_IP_WITH_OPTIONS,		/**< IP packet with options. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_IPV6_UNKNOWN_PROTOCOL,	/**< Unknown protocol. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_IPV6_HEADER_INCOMPLETE,	/**< Incomplete IPV6 header. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_GRE_UNKNOWN_SESSION,	/**< Unknown GRE session. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_EXP_GRE_NODE_INACTIVE,	/**< GRE node inactive. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_BASE_DEBUG_MAX,			/**< GRE base error max. */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 *  GRE base debug statistics
 | 
					 *  GRE base debug statistics
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct nss_gre_stats_base_debug	{
 | 
					struct nss_gre_stats_base {
 | 
				
			||||||
	uint64_t stats[NSS_GRE_STATS_BASE_DEBUG_MAX];	/**< GRE debug statistics. */
 | 
						uint64_t stats[NSS_GRE_BASE_DEBUG_MAX];	/**< GRE debug statistics. */
 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * GRE session debug statistics types
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum nss_gre_stats_session_debug_types {
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_PBUF_ALLOC_FAIL,			/**< Pbuf alloc failure. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_DECAP_FORWARD_ENQUEUE_FAIL,	/**< Rx forward enqueue failure. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_ENCAP_FORWARD_ENQUEUE_FAIL,	/**< Tx forward enqueue failure. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_DECAP_TX_FORWARDED,		/**< Packets forwarded after decap. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_ENCAP_RX_RECEIVED,		/**< Packets received for encap. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_ENCAP_RX_DROPPED,			/**< Packets dropped while enqueue for encap. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_ENCAP_RX_LINEAR_FAIL,		/**< Packets dropped during encap linearization. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_EXP_RX_KEY_ERROR,			/**< Rx KEY error. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_EXP_RX_SEQ_ERROR,			/**< Rx sequence number error. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_EXP_RX_CS_ERROR,			/**< Rx checksum error. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_EXP_RX_FLAG_MISMATCH,		/**< Rx flag mismatch. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_EXP_RX_MALFORMED,			/**< Rx malformed packet. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_EXP_RX_INVALID_PROTOCOL,		/**< Rx invalid protocol. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_EXP_RX_NO_HEADROOM,		/**< Rx no headroom. */
 | 
					 | 
				
			||||||
	NSS_GRE_STATS_SESSION_DEBUG_MAX,			/**< Session debug max. */
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 *  GRE session debug statistics
 | 
					 *  GRE session debug statistics
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct nss_gre_stats_session_debug {
 | 
					struct nss_gre_stats_session {
 | 
				
			||||||
	uint64_t stats[NSS_GRE_STATS_SESSION_DEBUG_MAX];	/**< Session debug statistics. */
 | 
						uint64_t stats[NSS_GRE_SESSION_DEBUG_MAX];	/**< Session debug statistics. */
 | 
				
			||||||
	int32_t if_index;				/**< Netdevice's ifindex. */
 | 
						int32_t if_index;				/**< Netdevice's ifindex. */
 | 
				
			||||||
	uint32_t if_num;				/**< NSS interface number. */
 | 
						uint32_t if_num;				/**< NSS interface number. */
 | 
				
			||||||
	bool valid;					/**< Is node valid ? */
 | 
						bool valid;					/**< Is node valid ? */
 | 
				
			||||||
@@ -86,8 +44,10 @@ struct nss_gre_stats_session_debug {
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * GRE statistics APIs
 | 
					 * GRE statistics APIs
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern void nss_gre_stats_session_debug_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_session_stats_msg *sstats, uint16_t if_num);
 | 
					extern void nss_gre_stats_base_notify(struct nss_ctx_instance *nss_ctx);
 | 
				
			||||||
extern void nss_gre_stats_base_debug_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_base_stats_msg *bstats);
 | 
					extern void nss_gre_stats_session_notify(struct nss_ctx_instance *nss_ctx, uint32_t if_num);
 | 
				
			||||||
 | 
					extern void nss_gre_stats_session_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_session_stats_msg *sstats, uint16_t if_num);
 | 
				
			||||||
 | 
					extern void nss_gre_stats_base_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_base_stats_msg *bstats);
 | 
				
			||||||
extern void nss_gre_stats_session_register(uint32_t if_num, struct net_device *netdev);
 | 
					extern void nss_gre_stats_session_register(uint32_t if_num, struct net_device *netdev);
 | 
				
			||||||
extern void nss_gre_stats_session_unregister(uint32_t if_num);
 | 
					extern void nss_gre_stats_session_unregister(uint32_t if_num);
 | 
				
			||||||
extern void nss_gre_stats_dentry_create(void);
 | 
					extern void nss_gre_stats_dentry_create(void);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										124
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_strings.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_strings.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,124 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ***************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_stats.h"
 | 
				
			||||||
 | 
					#include "nss_core.h"
 | 
				
			||||||
 | 
					#include "nss_strings.h"
 | 
				
			||||||
 | 
					#include "nss_gre_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_strings_base_stats
 | 
				
			||||||
 | 
					 *	GRE debug statistics strings for base types
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_stats_info nss_gre_strings_base_stats[NSS_GRE_BASE_DEBUG_MAX] = {
 | 
				
			||||||
 | 
						{"base_rx_pkts",			NSS_STATS_TYPE_COMMON},
 | 
				
			||||||
 | 
						{"base_rx_drops",			NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"base_exp_eth_hdr_missing",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_eth_type_non_ip",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_ip_unknown_protocol",	NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_ip_header_incomplete",	NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_ip_bad_total_length",	NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_ip_bad_checksum",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_ip_datagram_incomplete",	NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_ip_fragment",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_ip_options_incomplete",	NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_ip_with_options",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_ipv6_unknown_protocol",	NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_ipv6_header_incomplete",	NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_unknown_session",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"base_exp_node_inactive",		NSS_STATS_TYPE_EXCEPTION}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_base_strings_read()
 | 
				
			||||||
 | 
					 *	 Read GRE base debug statistics names
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_gre_base_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return nss_strings_print(ubuf, sz, ppos, nss_gre_strings_base_stats, NSS_GRE_BASE_DEBUG_MAX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_base_strings_ops
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STRINGS_DECLARE_FILE_OPERATIONS(gre_base);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_strings_session_stats
 | 
				
			||||||
 | 
					 *	GRE debug statistics strings for sessions
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct nss_stats_info nss_gre_strings_session_stats[NSS_GRE_SESSION_DEBUG_MAX] = {
 | 
				
			||||||
 | 
						{"session_pbuf_alloc_fail",		NSS_STATS_TYPE_ERROR},
 | 
				
			||||||
 | 
						{"session_decap_forward_enqueue_fail",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"session_encap_forward_enqueue_fail",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"session_decap_tx_forwarded",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"session_encap_rx_received",		NSS_STATS_TYPE_SPECIAL},
 | 
				
			||||||
 | 
						{"session_encap_rx_drops",		NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"session_encap_rx_linear_fail",	NSS_STATS_TYPE_DROP},
 | 
				
			||||||
 | 
						{"session_exp_rx_key_error",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"session_exp_rx_seq_error",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"session_exp_rx_cs_error",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"session_exp_rx_flag_mismatch",	NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"session_exp_rx_malformed",		NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"session_exp_rx_invalid_protocol",	NSS_STATS_TYPE_EXCEPTION},
 | 
				
			||||||
 | 
						{"session_exp_rx_no_headroom",		NSS_STATS_TYPE_EXCEPTION}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_session_strings_read()
 | 
				
			||||||
 | 
					 *	Read GRE session debug statistics names
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static ssize_t nss_gre_session_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return nss_strings_print(ubuf, sz, ppos, nss_gre_strings_session_stats, NSS_GRE_SESSION_DEBUG_MAX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_session_strings_ops
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					NSS_STRINGS_DECLARE_FILE_OPERATIONS(gre_session);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * nss_gre_strings_dentry_create()
 | 
				
			||||||
 | 
					 *	Create gre statistics strings debug entry.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void nss_gre_strings_dentry_create(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct dentry *gre_d = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!nss_top_main.strings_dentry) {
 | 
				
			||||||
 | 
							nss_warning("qca-nss-drv/strings is not present");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						gre_d = debugfs_create_dir("gre", nss_top_main.strings_dentry);
 | 
				
			||||||
 | 
						if (!gre_d) {
 | 
				
			||||||
 | 
							nss_warning("Failed to create qca-nss-drv/strings/gre directory");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!debugfs_create_file("gre_base", 0400, gre_d, &nss_top_main, &nss_gre_base_strings_ops)) {
 | 
				
			||||||
 | 
							nss_warning("Failed to create qca-nss-drv/strings/gre/gre_base file");
 | 
				
			||||||
 | 
							debugfs_remove_recursive(gre_d);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!debugfs_create_file("gre_session", 0400, gre_d, &nss_top_main, &nss_gre_session_strings_ops)) {
 | 
				
			||||||
 | 
							nss_warning("Failed to create qca-nss-drv/strings/gre/gre_session file");
 | 
				
			||||||
 | 
							debugfs_remove_recursive(gre_d);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										26
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_strings.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								feeds/ipq807x/qca-nss-drv/src/nss_gre_strings.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 ****************************************************************************
 | 
				
			||||||
 | 
					 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
				
			||||||
 | 
					 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 | 
				
			||||||
 | 
					 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 ****************************************************************************
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __NSS_GRE_STRINGS_H
 | 
				
			||||||
 | 
					#define __NSS_GRE_STRINGS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "nss_gre_stats.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern struct nss_stats_info nss_gre_strings_base_stats[NSS_GRE_BASE_DEBUG_MAX];
 | 
				
			||||||
 | 
					extern struct nss_stats_info nss_gre_strings_session_stats[NSS_GRE_SESSION_DEBUG_MAX];
 | 
				
			||||||
 | 
					extern void nss_gre_strings_dentry_create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __NSS_GRE_STRINGS_H */
 | 
				
			||||||
@@ -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
 | 
					 * Permission to use, copy, modify, and/or distribute this software for
 | 
				
			||||||
 * any purpose with or without fee is hereby granted, provided that the
 | 
					 * any purpose with or without fee is hereby granted, provided that the
 | 
				
			||||||
 * above copyright notice and this permission notice appear in all copies.
 | 
					 * above copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
@@ -17,6 +17,7 @@
 | 
				
			|||||||
#include "nss_tx_rx_common.h"
 | 
					#include "nss_tx_rx_common.h"
 | 
				
			||||||
#include "nss_gre_tunnel_stats.h"
 | 
					#include "nss_gre_tunnel_stats.h"
 | 
				
			||||||
#include "nss_gre_tunnel_log.h"
 | 
					#include "nss_gre_tunnel_log.h"
 | 
				
			||||||
 | 
					#include "nss_gre_tunnel_strings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NSS_GRE_TUNNEL_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
					#define NSS_GRE_TUNNEL_TX_TIMEOUT 3000 /* 3 Seconds */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -89,6 +90,7 @@ static void nss_gre_tunnel_handler(struct nss_ctx_instance *nss_ctx, struct nss_
 | 
				
			|||||||
	switch (ngtm->cm.type) {
 | 
						switch (ngtm->cm.type) {
 | 
				
			||||||
	case NSS_GRE_TUNNEL_MSG_STATS:
 | 
						case NSS_GRE_TUNNEL_MSG_STATS:
 | 
				
			||||||
		nss_gre_tunnel_stats_session_sync(nss_ctx, &ngtm->msg.stats, ncm->interface);
 | 
							nss_gre_tunnel_stats_session_sync(nss_ctx, &ngtm->msg.stats, ncm->interface);
 | 
				
			||||||
 | 
							nss_gre_tunnel_stats_notify(nss_ctx, ncm->interface);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -318,16 +320,16 @@ struct nss_ctx_instance *nss_gre_tunnel_register_if(uint32_t if_num,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	BUG_ON(!nss_gre_tunnel_verify_if_num(if_num));
 | 
						BUG_ON(!nss_gre_tunnel_verify_if_num(if_num));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock_bh(&nss_gre_tunnel_stats_session_debug_lock);
 | 
						spin_lock_bh(&nss_gre_tunnel_stats_lock);
 | 
				
			||||||
	for (i = 0; i < NSS_MAX_GRE_TUNNEL_SESSIONS; i++) {
 | 
						for (i = 0; i < NSS_MAX_GRE_TUNNEL_SESSIONS; i++) {
 | 
				
			||||||
		if (!nss_gre_tunnel_session_debug_stats[i].valid) {
 | 
							if (!session_stats[i].valid) {
 | 
				
			||||||
			nss_gre_tunnel_session_debug_stats[i].valid = true;
 | 
								session_stats[i].valid = true;
 | 
				
			||||||
			nss_gre_tunnel_session_debug_stats[i].if_num = if_num;
 | 
								session_stats[i].if_num = if_num;
 | 
				
			||||||
			nss_gre_tunnel_session_debug_stats[i].if_index = netdev->ifindex;
 | 
								session_stats[i].if_index = netdev->ifindex;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spin_unlock_bh(&nss_gre_tunnel_stats_session_debug_lock);
 | 
						spin_unlock_bh(&nss_gre_tunnel_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (i == NSS_MAX_GRE_TUNNEL_SESSIONS) {
 | 
						if (i == NSS_MAX_GRE_TUNNEL_SESSIONS) {
 | 
				
			||||||
		nss_warning("%px: Cannot find free slot for GRE Tunnel session stats, I/F:%u\n", nss_ctx, if_num);
 | 
							nss_warning("%px: Cannot find free slot for GRE Tunnel session stats, I/F:%u\n", nss_ctx, if_num);
 | 
				
			||||||
@@ -336,9 +338,9 @@ struct nss_ctx_instance *nss_gre_tunnel_register_if(uint32_t if_num,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (nss_ctx->subsys_dp_register[if_num].ndev) {
 | 
						if (nss_ctx->subsys_dp_register[if_num].ndev) {
 | 
				
			||||||
		nss_warning("%px: Cannot find free slot for GRE Tunnel NSS I/F:%u\n", nss_ctx, if_num);
 | 
							nss_warning("%px: Cannot find free slot for GRE Tunnel NSS I/F:%u\n", nss_ctx, if_num);
 | 
				
			||||||
		nss_gre_tunnel_session_debug_stats[i].valid = false;
 | 
							session_stats[i].valid = false;
 | 
				
			||||||
		nss_gre_tunnel_session_debug_stats[i].if_num = 0;
 | 
							session_stats[i].if_num = 0;
 | 
				
			||||||
		nss_gre_tunnel_session_debug_stats[i].if_index = 0;
 | 
							session_stats[i].if_index = 0;
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -347,6 +349,7 @@ struct nss_ctx_instance *nss_gre_tunnel_register_if(uint32_t if_num,
 | 
				
			|||||||
	nss_top_main.gre_tunnel_msg_callback = ev_cb;
 | 
						nss_top_main.gre_tunnel_msg_callback = ev_cb;
 | 
				
			||||||
	nss_core_register_handler(nss_ctx, if_num, nss_gre_tunnel_handler, app_ctx);
 | 
						nss_core_register_handler(nss_ctx, if_num, nss_gre_tunnel_handler, app_ctx);
 | 
				
			||||||
	nss_gre_tunnel_stats_dentry_create();
 | 
						nss_gre_tunnel_stats_dentry_create();
 | 
				
			||||||
 | 
						nss_gre_tunnel_strings_dentry_create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nss_ctx;
 | 
						return nss_ctx;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -363,15 +366,15 @@ void nss_gre_tunnel_unregister_if(uint32_t if_num)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	BUG_ON(!nss_gre_tunnel_verify_if_num(if_num));
 | 
						BUG_ON(!nss_gre_tunnel_verify_if_num(if_num));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock_bh(&nss_gre_tunnel_stats_session_debug_lock);
 | 
						spin_lock_bh(&nss_gre_tunnel_stats_lock);
 | 
				
			||||||
	for (i = 0; i < NSS_MAX_GRE_TUNNEL_SESSIONS; i++) {
 | 
						for (i = 0; i < NSS_MAX_GRE_TUNNEL_SESSIONS; i++) {
 | 
				
			||||||
		if (nss_gre_tunnel_session_debug_stats[i].if_num == if_num) {
 | 
							if (session_stats[i].if_num == if_num) {
 | 
				
			||||||
			memset(&nss_gre_tunnel_session_debug_stats[i], 0,
 | 
								memset(&session_stats[i], 0,
 | 
				
			||||||
			       sizeof(struct nss_gre_tunnel_stats_session_debug));
 | 
									sizeof(struct nss_gre_tunnel_stats_session));
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spin_unlock_bh(&nss_gre_tunnel_stats_session_debug_lock);
 | 
						spin_unlock_bh(&nss_gre_tunnel_stats_lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (i == NSS_MAX_GRE_TUNNEL_SESSIONS) {
 | 
						if (i == NSS_MAX_GRE_TUNNEL_SESSIONS) {
 | 
				
			||||||
		nss_warning("%px: Cannot find debug stats for GRE Tunnel session: %d\n", nss_ctx, if_num);
 | 
							nss_warning("%px: Cannot find debug stats for GRE Tunnel session: %d\n", nss_ctx, if_num);
 | 
				
			||||||
 
 | 
				
			|||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user